Index: /temp/tags/eccube-0_9_2beta/.project
===================================================================
--- /temp/tags/eccube-0_9_2beta/.project	(revision 1327)
+++ /temp/tags/eccube-0_9_2beta/.project	(revision 1327)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>test.ec-cube.net</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.trustudio.oss.core.PHPscriptbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.trustudio.oss.core.scriptnature</nature>
+		<nature>org.trustudio.php.core.phpnature</nature>
+	</natures>
+</projectDescription>
Index: /temp/tags/eccube-0_9_2beta/html/error.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/error.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/error.php	(revision 1328)
@@ -0,0 +1,22 @@
+<?php
+
+require_once("./require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'error.tpl';
+		$this->tpl_title = '¥¨¥é¡¼';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/index.php	(revision 3634)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/index.php	(revision 3634)
@@ -0,0 +1,239 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $tpl_login_email;
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/index.tpl';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrSex;
+		$this->arrSex = $arrSex;
+		global $arrJob;
+		$this->arrJob = $arrJob;
+		$this->tpl_onload = 'fnCheckInputDeliv();';
+		
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');				
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+$objCookie = new SC_Cookie();
+$objFormParam = new SC_FormParam();			// ¥Õ¥©¡¼¥àÍÑ
+lfInitParam();								// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+$objFormParam->setParam($_POST);			// POSTÃÍ¤Î¼èÆÀ
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+$objPage->tpl_uniqid = $uniqid;
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($objCustomer->isLoginSuccess()) {
+	// ¤¹¤Ç¤Ë¥í¥°¥¤¥ó¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¤ªÆÏ¤±ÀèÀßÄê²èÌÌ¤ËÅ¾Á÷
+	header("Location: ./deliv.php");
+	exit;
+}
+
+switch($_POST['mode']) {
+case 'nonmember_confirm':
+	$objPage = lfSetNonMember($objPage);
+	// ¢¨break¤Ê¤·
+case 'confirm':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objFormParam->toLower('order_mail');
+	$objFormParam->toLower('order_mail_check');
+	
+	$objPage->arrErr = lfCheckError();
+
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if(count($objPage->arrErr) == 0) {
+		// DB¤Ø¤Î¥Ç¡¼¥¿ÅÐÏ¿
+		lfRegistData($uniqid);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . URL_SHOP_PAYMENT);
+		exit;		
+	}
+	
+	break;
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . URL_CART_TOP);
+	exit;
+	break;
+case 'nonmember':
+	$objPage = lfSetNonMember($objPage);
+	// ¢¨break¤Ê¤·
+default:
+	if($_GET['from'] == 'nonmember') {
+		$objPage = lfSetNonMember($objPage);
+	}
+	// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
+	$uniqid = $objSiteSess->getUniqId();
+	$objQuery = new SC_Query();
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
+	// DBÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($arrRet[0]);
+	$objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
+	$objFormParam->setDBDate($arrRet[0]['order_birth']);
+	break;
+}
+
+// ¥¯¥Ã¥­¡¼È½Äê
+$objPage->tpl_login_email = $objCookie->getCookie('login_email');
+if($objPage->tpl_login_email != "") {
+	$objPage->tpl_login_memory = "1";
+}
+
+// ÁªÂòÍÑÆüÉÕ¤Î¼èÆÀ
+$objDate = new SC_Date(START_BIRTH_YEAR);
+$objPage->arrYear = $objDate->getYear('', 1950);	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+if($objPage->year == '') {
+	$objPage->year = '----';
+}
+
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+if($objPage->arrForm['year']['value'] == ""){
+	$objPage->arrForm['year']['value'] = '----';	
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+/* Èó²ñ°÷ÆþÎÏ¥Ú¡¼¥¸¤Î¥»¥Ã¥È */
+function lfSetNonMember($objPage) {
+	$objPage->tpl_mainpage = 'shopping/nonmember_input.tpl';
+	$objPage->tpl_css = array();
+	$objPage->tpl_css[] = '/css/layout/login/nonmember.css';
+	return $objPage;
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°¡ÊÌ¾¡Ë", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ1", "order_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ2", "order_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ3", "order_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "order_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³ÎÇ§¡Ë", "order_email_check", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"), "", false);
+	$objFormParam->addParam("Ç¯", "year", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
+	$objFormParam->addParam("·î", "month", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
+	$objFormParam->addParam("Æü", "day", INT_LEN, "n", array("MAX_LENGTH_CHECK"), "", false);
+	$objFormParam->addParam("À­ÊÌ", "order_sex", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¿¦¶È", "order_job", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÊÌ¤Î¤ªÆÏ¤±Àè", "deliv_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°¡ÊÌ¾¡Ë", "deliv_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "deliv_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1);
+}
+
+/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
+function lfRegistData($uniqid) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	$sqlval = $objFormParam->getDbArray();
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['order_birth'] = sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
+	$sqlval['update_date'] = 'Now()';
+	$sqlval['customer_id'] = '0';
+	
+	// ´ûÂ¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
+	$objQuery = new SC_Query();
+	$where = "order_temp_id = ?";
+	$cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
+	// ´ûÂ¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
+	if ($cnt == 0) {
+		$objQuery->insert("dtb_order_temp", $sqlval);
+	} else {
+		$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+	}
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+		
+	// ÊÌ¤Î¤ªÆÏ¤±Àè¥Á¥§¥Ã¥¯
+	if($_POST['deliv_check'] == "1") { 
+		$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", "deliv_name01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", "deliv_name02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", "deliv_kana01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", "deliv_kana02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "deliv_zip01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "deliv_zip02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", "deliv_pref"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("½»½ê1", "deliv_addr01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("½»½ê2", "deliv_addr02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ1", "deliv_tel01"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ2", "deliv_tel02"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ3", "deliv_tel03"), array("EXIST_CHECK"));
+	}
+	
+	// Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("TEL", "order_tel01", "order_tel02", "order_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("FAX", "order_fax01", "order_fax02", "order_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "order_zip01", "order_zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("FAX", "deliv_fax01", "deliv_fax02", "deliv_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "deliv_zip01", "deliv_zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "¥á¡¼¥ë¥¢¥É¥ì¥¹¡Ê³ÎÇ§¡Ë", "order_email", "order_email_check"), array("EQUAL_CHECK"));
+	
+	// ¤¹¤Ç¤Ë¥á¥ë¥Þ¥¬¥Æ¡¼¥Ö¥ë¤Ë²ñ°÷¤È¤·¤Æ¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if(sfCheckCustomerMailMaga($arrRet['order_email'])) {
+		$objErr->arrErr['order_email'] = "¤³¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ï¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£<br />";
+	}
+		
+	return $objErr->arrErr;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/complete.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/complete.php	(revision 3448)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/complete.php	(revision 3448)
@@ -0,0 +1,485 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/complete.tpl';
+		$this->tpl_css = '/css/layout/shopping/complete.css';
+		$this->tpl_title = "¤´ÃíÊ¸´°Î»";
+		// ¥³¥ó¥Ð¡¼¥¸¥ç¥ó¥¿¥°¤ÎÉ½¼¨
+		$this->conversion_tag = true;
+		global $arrCONVENIENCE;
+		$this->arrCONVENIENCE = $arrCONVENIENCE;
+		global $arrCONVENIMESSAGE;
+		$this->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
+		global $arrCONVENIENCE;
+		global $arrCONVENIMESSAGE;
+		$objPage->arrCONVENIENCE = $arrCONVENIENCE;
+		$objPage->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objSiteInfo = $objView->objSiteInfo;
+$arrInfo = $objSiteInfo->data;
+$objCustomer = new SC_Customer();
+
+if($_GET['mode'] != 'reload') {
+	// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿¤«È½Äê
+	sfIsPrePage($objSiteSess);
+	// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+	$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+	if ($uniqid != "") {
+
+		// ´°Î»½èÍý
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		$order_id = lfDoComplete($objQuery, $uniqid);
+		$objQuery->commit();
+		
+		// ¥»¥Ã¥·¥ç¥ó¤ËÊÝ´É¤µ¤ì¤Æ¤¤¤ë¾ðÊó¤ò¹¹¿·¤¹¤ë
+		$objCustomer->updateSession();
+
+		// ´°Î»¥á¡¼¥ëÁ÷¿®
+		if($order_id != "") {
+			sfSendOrderMail($order_id, '1');
+		}
+
+		//¥³¥ó¥Ó¥Ë·èºÑ¾ðÊó¤Î¼èÆÀ
+		$conveni_data = $objQuery->get("dtb_order", "conveni_data", "order_id = ? ", array($order_id));
+		if($conveni_data != "") {
+			$objPage->arrConv = unserialize($conveni_data);
+		}
+		
+		// ¥ê¥í¡¼¥É¤Ë¤è¤ëÆó½ÅÅÐÏ¿ËÉ»ß
+		sfReload("mode=reload"); 
+	}
+}
+
+$objPage->arrInfo = $arrInfo;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+// ¥¨¥Ó¥¹¥¿¥°°úÅÏ¤·ÍÑ¥Ç¡¼¥¿¤òÀ¸À®¤¹¤ë
+function lfGetEbisData($order_id) {
+	$objQuery = new SC_Query();
+	$col = "customer_id, total, order_sex, order_job, to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) AS order_age";
+	$arrRet = $objQuery->select($col, "dtb_order", "order_id = ?", array($order_id));
+	
+	if($arrRet[0]['customer_id'] > 0) {
+		// ²ñ°÷ÈÖ¹æ
+		$arrEbis['m1id'] = $arrRet[0]['customer_id'];
+		// Èó²ñ°÷or²ñ°÷
+		$arrEbis['o5id'] = '1';
+	} else {
+		// ²ñ°÷ÈÖ¹æ
+		$arrEbis['m1id'] = '';
+		// Èó²ñ°÷or²ñ°÷
+		$arrEbis['o5id'] = '2';	
+	}
+	
+	// ¹ØÆþ¶â³Û
+	$arrEbis['a1id'] = $arrRet[0]['total'];
+	// À­ÊÌ
+	$arrEbis['o2id'] = $arrRet[0]['order_sex'];
+	// Ç¯Îð
+	$arrEbis['o3id'] = $arrRet[0]['order_age'];
+	// ¿¦¶È
+	$arrEbis['o4id'] = $arrRet[0]['order_job'];
+		
+	$objQuery->setgroupby("product_id");
+	$arrRet = $objQuery->select("product_id", "dtb_order_detail", "order_id = ?", array($order_id));
+	$arrProducts = sfSwapArray($arrRet);
+	
+	$line = "";
+	// ¾¦ÉÊID¤ò¥¢¥ó¥À¡¼¥Ð¡¼¤ÇÀÜÂ³¤¹¤ë¡£
+	foreach($arrProducts['product_id'] as $val) {
+		if($line != "") {
+			$line .= "_$val";		
+		} else {
+			$line .= "$val";
+		}
+	}
+	
+	// ¾¦ÉÊID	
+	$arrEbis['o1id'] = $line;
+	
+	return $arrEbis;
+}
+
+// ´°Î»½èÍý
+function lfDoComplete($objQuery, $uniqid) {
+	global $objCartSess;
+	global $objSiteSess;
+	global $objCustomer;
+	global $arrInfo;
+	
+	// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+	$arrData = sfGetOrderTemp($uniqid);
+	
+	// ²ñ°÷¾ðÊóÅÐÏ¿½èÍý
+	if ($objCustomer->isLoginSuccess()) {
+		// ¿·¤ªÆÏ¤±Àè¤ÎÅÐÏ¿
+		lfSetNewAddr($uniqid, $objCustomer->getValue('customer_id'));
+		// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+		lfSetCustomerPurchase($objCustomer->getValue('customer_id'), $arrData);
+	} else {
+		//¹ØÆþ»þ¶¯À©²ñ°÷ÅÐÏ¿
+		switch(PURCHASE_CUSTOMER_REGIST) {
+		//Ìµ¸ú
+		case '0':
+			// ¹ØÆþ»þ²ñ°÷ÅÐÏ¿
+			if($arrData['member_check'] == '1') {
+				// ²¾²ñ°÷ÅÐÏ¿
+				$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
+				// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+				lfSetCustomerPurchase($customer_id, $arrData);
+			}
+			break;
+		//Í­¸ú
+		case '1':
+			// ²¾²ñ°÷ÅÐÏ¿
+			$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
+			// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+			lfSetCustomerPurchase($customer_id, $arrData);
+			break;
+		}
+		
+	}
+
+	// °ì»þ¥Æ¡¼¥Ö¥ë¤ò¼õÃí¥Æ¡¼¥Ö¥ë¤Ë³ÊÇ¼¤¹¤ë
+	$order_id = lfRegistOrder($objQuery, $arrData);
+	// ¥«¡¼¥È¾¦ÉÊ¤ò¼õÃí¾ÜºÙ¥Æ¡¼¥Ö¥ë¤Ë³ÊÇ¼¤¹¤ë
+	lfRegistOrderDetail($objQuery, $order_id, $objCartSess);
+	// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î¾ðÊó¤òºï½ü¤¹¤ë¡£
+	lfDeleteTempOrder($objQuery, $uniqid);
+	
+	// ¥»¥Ã¥·¥ç¥ó¥«¡¼¥ÈÆâ¤Î¾¦ÉÊ¤òºï½ü¤¹¤ë¡£
+	$objCartSess->delAllProducts();
+	// ÃíÊ¸°ì»þID¤ò²ò½ü¤¹¤ë¡£
+	$objSiteSess->unsetUniqId();
+	
+	return $order_id;
+}
+
+// ²ñ°÷ÅÐÏ¿¡Ê²¾ÅÐÏ¿¡Ë
+function lfRegistPreCustomer($arrData, $arrInfo) {
+	// ¹ØÆþ»þ¤Î²ñ°÷ÅÐÏ¿
+	$sqlval['name01'] = $arrData['order_name01'];
+	$sqlval['name02'] = $arrData['order_name02'];
+	$sqlval['kana01'] = $arrData['order_kana01'];
+	$sqlval['kana02'] = $arrData['order_kana02'];
+	$sqlval['zip01'] = $arrData['order_zip01'];
+	$sqlval['zip02'] = $arrData['order_zip02'];
+	$sqlval['pref'] = $arrData['order_pref'];
+	$sqlval['addr01'] = $arrData['order_addr01'];
+	$sqlval['addr02'] = $arrData['order_addr02'];
+	$sqlval['email'] = $arrData['order_email'];
+	$sqlval['tel01'] = $arrData['order_tel01'];
+	$sqlval['tel02'] = $arrData['order_tel02'];
+	$sqlval['tel03'] = $arrData['order_tel03'];
+	$sqlval['fax01'] = $arrData['order_fax01'];
+	$sqlval['fax02'] = $arrData['order_fax02'];
+	$sqlval['fax03'] = $arrData['order_fax03'];
+	$sqlval['sex'] = $arrData['order_sex'];
+	$sqlval['password'] = $arrData['password'];
+	$sqlval['reminder'] = $arrData['reminder'];
+	$sqlval['reminder_answer'] = $arrData['reminder_answer'];
+	// ²ñ°÷²¾ÅÐÏ¿
+	$sqlval['status'] = 1;
+	// URLÈ½ÄêÍÑ¥­¡¼
+	$sqlval['secret_key'] = sfGetUniqRandomId("t"); 
+	
+	$objQuery = new SC_Query();
+	$objQuery->insert("dtb_customer", $sqlval);
+	
+	// ¸ÜµÒID¤Î¼èÆÀ
+	$arrRet = $objQuery->select("customer_id", "dtb_customer", "secret_key = ?", array($sqlval['secret_key']));
+	$customer_id = $arrRet[0]['customer_id'];
+	
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®ÍÑ¥Õ¥é¥°¤ÎÈ½Äê
+	switch($arrData['mail_flag']) {
+	case '1':	// HTML¥á¡¼¥ë
+		$mail_flag = 4;
+		break;
+	case '2':	// TEXT¥á¡¼¥ë
+		$mail_flag = 5;
+		break;
+	case '3':	// ´õË¾¤Ê¤·
+		$mail_flag = 6;
+		break;
+	default:
+		$mail_flag = 6;
+		break;
+	}
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®ÍÑ¥Æ¡¼¥Ö¥ëÅÐÏ¿
+	lfRegistNonCustomer($arrData['order_email'], $mail_flag);
+	
+	//¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+	$objMailPage = new LC_Page();
+	$objMailPage->to_name01 = $arrData['order_name01'];
+	$objMailPage->to_name02 = $arrData['order_name02'];
+	$objMailPage->CONF = $arrInfo;
+	$objMailPage->uniqid = $sqlval['secret_key'];
+	$objMailView = new SC_SiteView();
+	$objMailView->assignobj($objMailPage);
+	$body = $objMailView->fetch("mail_templates/customer_mail.tpl");
+	
+	$objMail = new GC_SendMail();
+	$objMail->setItem(
+						''										//¡¡°¸Àè
+						, sfMakeSubject("²ñ°÷ÅÐÏ¿¤Î¤´³ÎÇ§")		//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $body									//¡¡ËÜÊ¸
+						, $arrInfo['email03']					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $arrInfo['shop_name']					//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $arrInfo["email03"]					//¡¡reply_to
+						, $arrInfo["email04"]					//¡¡return_path
+						, $arrInfo["email04"]					//  Errors_to
+						, $arrInfo["email01"]					//  Bcc
+														);
+	// °¸Àè¤ÎÀßÄê
+	$name = $arrData['order_name01'] . $arrData['order_name02'] ." ÍÍ";
+	$objMail->setTo($arrData['order_email'], $name);			
+	$objMail->sendMail();
+	
+	return $customer_id;
+}
+
+// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î¤ªÆÏ¤±Àè¤ò¥³¥Ô¡¼¤¹¤ë
+function lfCopyDeliv($uniqid, $arrData) {
+	$objQuery = new SC_Query();
+	
+	// ÊÌ¤Î¤ªÆÏ¤±Àè¤ò»ØÄê¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷Àè¤ËÅÐÏ¿½»½ê¤ò¥³¥Ô¡¼¤¹¤ë¡£
+	if($arrData["deliv_check"] != "1") {
+		$sqlval['deliv_name01'] = $arrData['order_name01'];
+		$sqlval['deliv_name02'] = $arrData['order_name02'];
+		$sqlval['deliv_kana01'] = $arrData['order_kana01'];
+		$sqlval['deliv_kana02'] = $arrData['order_kana02'];
+		$sqlval['deliv_pref'] = $arrData['order_pref'];
+		$sqlval['deliv_zip01'] = $arrData['order_zip01'];
+		$sqlval['deliv_zip02'] = $arrData['order_zip02'];
+		$sqlval['deliv_addr01'] = $arrData['order_addr01'];
+		$sqlval['deliv_addr02'] = $arrData['order_addr02'];
+		$sqlval['deliv_tel01'] = $arrData['order_tel01'];
+		$sqlval['deliv_tel02'] = $arrData['order_tel02'];
+		$sqlval['deliv_tel03'] = $arrData['order_tel03'];
+		$where = "order_temp_id = ?";
+		$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+	}
+}
+
+// ¼õÃí¥Æ¡¼¥Ö¥ë¤ØÅÐÏ¿
+function lfRegistOrder($objQuery, $arrData) {
+	$sqlval = $arrData;
+
+	// ¼õÃí¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤Þ¤Ê¤¤Îó¤ò½üµî
+	unset($sqlval['mail_flag']);		// ¥á¥ë¥Þ¥¬¥Á¥§¥Ã¥¯
+	unset($sqlval['deliv_check']);		// ÊÌ¤Î¤ªÆÏ¤±Àè¥Á¥§¥Ã¥¯
+	unset($sqlval['point_check']);		// ¥Ý¥¤¥ó¥ÈÍøÍÑ¥Á¥§¥Ã¥¯
+	unset($sqlval['member_check']);		// ¹ØÆþ»þ²ñ°÷¥Á¥§¥Ã¥¯
+	unset($sqlval['password']);			// ¥í¥°¥¤¥ó¥Ñ¥¹¥ï¡¼¥É
+	unset($sqlval['reminder']);			// ¥ê¥Þ¥¤¥ó¥À¡¼¼ÁÌä
+	unset($sqlval['reminder_answer']);	// ¥ê¥Þ¥¤¥ó¥À¡¼Åú¤¨
+	
+	$order_id = $objQuery->nextval("dtb_order", "order_id");
+	$sqlval['order_id'] = $order_id;
+	$sqlval['status'] = '1';			// ÃíÊ¸¥¹¥Æ¡¼¥¿¥¹:¿·µ¬¼õÉÕ¤ËÀßÄê
+	
+	// ÊÌ¤Î¤ªÆÏ¤±Àè¤ò»ØÄê¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷Àè¤ËÅÐÏ¿½»½ê¤ò¥³¥Ô¡¼¤¹¤ë¡£
+	if($arrData["deliv_check"] != "1") {
+		$sqlval['deliv_name01'] = $arrData['order_name01'];
+		$sqlval['deliv_name02'] = $arrData['order_name02'];
+		$sqlval['deliv_kana01'] = $arrData['order_kana01'];
+		$sqlval['deliv_kana02'] = $arrData['order_kana02'];
+		$sqlval['deliv_pref'] = $arrData['order_pref'];
+		$sqlval['deliv_zip01'] = $arrData['order_zip01'];
+		$sqlval['deliv_zip02'] = $arrData['order_zip02'];
+		$sqlval['deliv_addr01'] = $arrData['order_addr01'];
+		$sqlval['deliv_addr02'] = $arrData['order_addr02'];
+		$sqlval['deliv_tel01'] = $arrData['order_tel01'];
+		$sqlval['deliv_tel02'] = $arrData['order_tel02'];
+		$sqlval['deliv_tel03'] = $arrData['order_tel03'];
+	}
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_order", $sqlval);
+	
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®´õË¾¾ðÊó¤ÎÅÐÏ¿
+	lfRegistNonCustomer($arrData['order_email'], $arrData['mail_flag']);
+	
+	return $order_id;
+}
+
+// ¼õÃí¾ÜºÙ¥Æ¡¼¥Ö¥ë¤ØÅÐÏ¿
+function lfRegistOrderDetail($objQuery, $order_id, $objCartSess) {
+	// ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
+	$arrCart = $objCartSess->getCartList();
+	$max = count($arrCart);
+	
+	// ´û¤ËÂ¸ºß¤¹¤ë¾ÜºÙ¥ì¥³¡¼¥É¤ò¾Ã¤·¤Æ¤ª¤¯¡£
+	$objQuery->delete("dtb_order_detail", "order_id = ?", $order_id);
+
+	// µ¬³ÊÌ¾°ìÍ÷
+	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+			
+	for ($i = 0; $i < $max; $i++) {
+		// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+		$arrData = sfGetProductsClass($arrCart[$i]['id']);
+		
+		// Â¸ºß¤¹¤ë¾¦ÉÊ¤Î¤ßÉ½¼¨¤¹¤ë¡£
+		if($arrData != "") {
+			$sqlval['order_id'] = $order_id;
+			$sqlval['product_id'] = $arrCart[$i]['id'][0];
+			$sqlval['classcategory_id1'] = $arrCart[$i]['id'][1];
+			$sqlval['classcategory_id2'] = $arrCart[$i]['id'][2];
+			$sqlval['product_name'] = $arrData['name'];
+			$sqlval['product_code'] = $arrData['product_code'];
+			$sqlval['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
+			$sqlval['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
+			$sqlval['point_rate'] = $arrCart[$i]['point_rate'];			
+			$sqlval['price'] = $arrCart[$i]['price'];
+			$sqlval['quantity'] = $arrCart[$i]['quantity'];
+			lfReduceStock($objQuery, $arrCart[$i]['id'], $arrCart[$i]['quantity']);
+			// INSERT¤Î¼Â¹Ô
+			$objQuery->insert("dtb_order_detail", $sqlval);
+		} else {
+			sfDispSiteError(CART_NOT_FOUND);
+		}
+	}
+}
+
+/* ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Îºï½ü */
+function lfDeleteTempOrder($objQuery, $uniqid) {
+	$where = "order_temp_id = ?";
+	$sqlval['delete'] = 1;
+	$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+	// $objQuery->delete("dtb_order_temp", $where, array($uniqid));
+}
+
+// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î½»½ê¤¬ÅÐÏ¿ºÑ¤ß¥Æ¡¼¥Ö¥ë¤È°Û¤Ê¤ë¾ì¹ç¤Ï¡¢ÊÌ¤Î¤ªÆÏ¤±Àè¤ËÄÉ²Ã¤¹¤ë
+function lfSetNewAddr($uniqid, $customer_id) {
+	$objQuery = new SC_Query();
+	$diff = false;
+	$find_same = false;
+	
+	$col = "deliv_name01,deliv_name02,deliv_kana01,deliv_kana02,deliv_tel01,deliv_tel02,deliv_tel03,deliv_zip01,deliv_zip02,deliv_pref,deliv_addr01,deliv_addr02";
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select($col, "dtb_order_temp", $where, array($uniqid));
+	
+	// Í×ÁÇÌ¾¤Îdeliv_¤òºï½ü¤¹¤ë¡£
+	foreach($arrRet[0] as $key => $val) {
+		$keyname = ereg_replace("^deliv_", "", $key);
+		$arrNew[$keyname] = $val;
+	}
+	
+	// ²ñ°÷¾ðÊó¥Æ¡¼¥Ö¥ë¤È¤ÎÈæ³Ó
+	$col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
+	$where = "customer_id = ?";
+	$arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
+	
+	// ²ñ°÷¾ðÊó¤Î½»½ê¤È°Û¤Ê¤ë¾ì¹ç
+	if($arrNew != $arrCustomerAddr[0]) {
+		// ÊÌ¤Î¤ªÆÏ¤±Àè¥Æ¡¼¥Ö¥ë¤Î½»½ê¤ÈÈæ³Ó¤¹¤ë
+		$col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
+		$where = "customer_id = ?";
+		$arrOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($customer_id));
+
+		foreach($arrOtherAddr as $arrval) {
+			if($arrNew == $arrval) {
+				// ¤¹¤Ç¤ËÆ±¤¸½»½ê¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë
+				$find_same = true;
+			}
+		}
+		
+		if(!$find_same) {
+			$diff = true;
+		}
+	}
+	
+	// ¿·¤·¤¤¤ªÆÏ¤±Àè¤¬ÅÐÏ¿ºÑ¤ß¤Î¤â¤Î¤È°Û¤Ê¤ë¾ì¹ç¤ÏÊÌ¤Î¤ªÆÏ¤±Àè¥Æ¡¼¥Ö¥ë¤ËÅÐÏ¿¤¹¤ë
+	if($diff) {
+		$sqlval = $arrNew;
+		$sqlval['customer_id'] = $customer_id;
+		$objQuery->insert("dtb_other_deliv", $sqlval);
+	}
+}
+
+/* ¹ØÆþ¾ðÊó¤ò²ñ°÷¥Æ¡¼¥Ö¥ë¤ËÅÐÏ¿¤¹¤ë */
+function lfSetCustomerPurchase($customer_id, $arrData) {
+	$objQuery = new SC_Query();
+	$col = "first_buy_date, last_buy_date, buy_times, buy_total, point";
+	$where = "customer_id = ?";
+	$arrRet = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
+	$sqlval = $arrRet[0];
+	
+	if($sqlval['first_buy_date'] == "") {
+		$sqlval['first_buy_date'] = "Now()";
+	}
+	$sqlval['last_buy_date'] = "Now()";
+	$sqlval['buy_times']++;
+	$sqlval['buy_total']+= $arrData['total'];
+	$sqlval['point'] = ($sqlval['point'] + $arrData['add_point'] - $arrData['use_point']);
+	
+	// ¥Ý¥¤¥ó¥È¤¬ÉÔÂ­¤·¤Æ¤¤¤ë¾ì¹ç
+	if($sqlval['point'] < 0) {
+		$objQuery->rollback();
+		sfDispSiteError(LACK_POINT);
+	}
+	
+	$objQuery->update("dtb_customer", $sqlval, $where, array($customer_id));
+}
+
+/* Èó²ñ°÷¤Î¥á¥ë¥Þ¥¬¥Æ¡¼¥Ö¥ë¤Ø¤ÎÅÐÏ¿ */
+function lfRegistNonCustomer($email, $mail_flag) {
+	$objQuery = new SC_Query();
+	$objQuery->begin();	
+	// ²ñ°÷¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+	if(!sfCheckCustomerMailMaga($email)) {
+		$where = "email = ?";
+		$objQuery->delete("dtb_customer_mail", $where, array($email));
+		$sqlval['email'] = $email;
+		$sqlval['mail_flag'] = $mail_flag;
+		$objQuery->insert("dtb_customer_mail", $sqlval);
+	}
+	$objQuery->commit();
+}
+
+// ºß¸Ë¤ò¸º¤é¤¹½èÍý
+function lfReduceStock($objQuery, $arrID, $quantity) {
+	$where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
+	$arrRet = $objQuery->select("stock, stock_unlimited", "dtb_products_class", $where, $arrID);
+	
+	// Çä¤êÀÚ¤ì¥¨¥é¡¼
+	if(($arrRet[0]['stock_unlimited'] != '1' && $arrRet[0]['stock'] < $quantity) || $quantity == 0) {
+		$objQuery->rollback();
+		sfDispSiteError(SOLD_OUT);
+	// ÌµÀ©¸Â¤Î¾ì¹ç¡¢ºß¸Ë¤ÏNULL
+	} elseif($arrRet[0]['stock_unlimited'] == '1') {
+		$sqlval['stock'] = null;
+		$objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
+	// ºß¸Ë¤ò¸º¤é¤¹
+	} else {
+		$sqlval['stock'] = ($arrRet[0]['stock'] - $quantity);
+		if($sqlval['stock'] == "") {
+			$sqlval['stock'] = '0';
+		}		
+		$objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/card.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/card.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/card.php	(revision 2812)
@@ -0,0 +1,145 @@
+<?php
+require_once("../require.php");
+
+$arrJPO_INFO['10'] = "°ì³çÊ§¤¤";
+$arrJPO_INFO['21'] = "¥Ü¡¼¥Ê¥¹°ì³çÊ§¤¤";
+$arrJPO_INFO['80'] = "¥ê¥ÜÊ§¤¤";
+$arrJPO_INFO['61C02'] = "Ê¬³ä2²óÊ§¤¤";
+$arrJPO_INFO['61C03'] = "Ê¬³ä3²óÊ§¤¤";
+$arrJPO_INFO['61C05'] = "Ê¬³ä5²óÊ§¤¤";
+$arrJPO_INFO['61C06'] = "Ê¬³ä6²óÊ§¤¤";
+$arrJPO_INFO['61C10'] = "Ê¬³ä10²óÊ§¤¤";
+$arrJPO_INFO['61C12'] = "Ê¬³ä12²óÊ§¤¤";
+$arrJPO_INFO['61C15'] = "Ê¬³ä15²óÊ§¤¤";
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/shopping/card.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'shopping/card.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		global $arrJPO_INFO;
+		$this->arrJPO_INFO = $arrJPO_INFO;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objSiteInfo = $objView->objSiteInfo;
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥¢¥¯¥»¥¹¤ÎÀµÅöÀ­¤ÎÈ½Äê
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+switch($_POST['mode']) {
+// ÅÐÏ¿
+case 'regist':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç
+	if(count($objPage->arrErr) == 0) {
+		// ¥«¡¼¥È½¸·×½èÍý
+		$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+		// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+		$arrData = sfGetOrderTemp($uniqid);
+		// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+		$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+		
+		// ¥«¡¼¥É¤ÎÇ§¾Ú¤ò¹Ô¤¦
+		$arrVal = $objFormParam->getHashArray();
+		$card_no = $arrVal['card_no01'].$arrVal['card_no02'].$arrVal['card_no03'].$arrVal['card_no04'];
+		$card_exp = $arrVal['card_month']. "/" . $arrVal['card_year']; // MM/DD
+		$result = sfGetAuthonlyResult(CGI_DIR, CGI_FILE, $arrVal['name01'], $arrVal['name02'], $card_no, $card_exp, $arrData['payment_total'], $uniqid, $arrVal['jpo_info']);
+		
+		// ±þÅúÆâÍÆ¤Îµ­Ï¿
+		$sqlval['credit_result'] = $result['action-code'];
+		$sqlval['credit_msg'] = $result['aux-msg'].$result['MErrMsg'];
+		$objQuery = new SC_Query();
+		$objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ?", array($uniqid));
+				
+		// Í¿¿®½èÍýÀ®¸ù¤Î¾ì¹ç
+		if($result['action-code'] == '000') {
+			// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+			$objSiteSess->setRegistFlag();
+			// ½èÍý´°Î»¥Ú¡¼¥¸¤Ø
+			header("Location: " . URL_SHOP_COMPLETE);
+		} else {
+			switch($result['action-code']) {
+			case '115':
+				$objPage->tpl_error = "¢¨ ¥«¡¼¥É¤ÎÍ­¸ú´ü¸Â¤¬ÀÚ¤ì¤Æ¤¤¤Þ¤¹¡£";
+				break;
+			case '212':
+				$objPage->tpl_error = "¢¨ ¥«¡¼¥ÉÈÖ¹æ¤Ë¸í¤ê¤¬¤¢¤ê¤Þ¤¹¡£";
+				break;
+			case '100':
+				$objPage->tpl_error = "¢¨ ¥«¡¼¥É²ñ¼Ò¤Ç¤ª¼è°ú¤¬¾µÇ§¤µ¤ì¤Þ¤»¤ó¤Ç¤·¤¿¡£";
+				break;
+			default:
+				$objPage->tpl_error = "¢¨ ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É¤Î¾È¹ç¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+				break;
+			}
+		}
+	}
+	break;
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . URL_SHOP_CONFIRM);
+	exit;
+	break;
+}
+
+$objDate = new SC_Date();
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(RELEASE_YEAR + CREDIT_ADD_YEAR);
+$objPage->arrYear = $objDate->getZeroYear();
+$objPage->arrMonth = $objDate->getZeroMonth();
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ1", "card_no01", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ2", "card_no02", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ3", "card_no03", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥ÉÈÖ¹æ4", "card_no04", CREDIT_NO_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥É´ü¸ÂÇ¯", "card_year", 2, "n", array("EXIST_CHECK", "NUM_COUNT_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥«¡¼¥É´ü¸Â·î", "card_month", 2, "n", array("EXIST_CHECK", "NUM_COUNT_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("À«", "card_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALPHA_CHECK"));
+	$objFormParam->addParam("Ì¾", "card_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALPHA_CHECK"));
+	$objFormParam->addParam("¤ª»ÙÊ§¤¤ÊýË¡", "jpo_info", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "ALNUM_CHECK"));
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/loan.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/loan.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/loan.php	(revision 2812)
@@ -0,0 +1,85 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/loan.tpl';
+		$this->tpl_css = '/css/layout/shopping/pay.css';
+		// ¥Û¡¼¥à¥¢¥É¥ì¥¹
+		$this->tpl_homeaddr = CF_HOMEADDR;
+		// ¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·
+		$this->tpl_simulate = CF_SIMULATE;
+		// ²ÃÌÁÅ¹¥³¡¼¥É
+		$this->tpl_storecode = CF_STORECODE;
+		// Ìá¤êÀè
+		$this->tpl_returnurl = CF_RETURNURL;
+		// ¸Æ¤Ó½Ð¤·¶èÊ¬(0:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¤Î¤ß¡¢1:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó+¿½¹þ)
+		$this->tpl_continue = CF_CONTINUE;
+		// ÌòÌ³Í­Ìµ¶èÊ¬(0:Ìµ¡¢1:Í­)
+		$this->tpl_labor = CF_LABOR;
+		// ·ë²Ì±þÅú(1:·ë²Ì¤¢¤ê¡¢2:·ë²Ì¤Ê¤·)
+		$this->tpl_result = CF_RESULT;
+		// ¥­¥ã¥ó¥»¥ëURL
+		$this->tpl_cancelurl = CF_CANCELURL;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+$objSiteInfo = $objView->objSiteInfo;
+$arrInfo = $objSiteInfo->data;
+
+// ÃíÊ¸°ì»þID¤Î¼èÆÀ
+$uniqid = $objSiteSess->getUniqId();
+
+// ¥í¡¼¥ó·èºÑ¤ÎÌá¤êÃÍ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+if($_GET['tranno'] == $uniqid) {
+	// ¥í¡¼¥ó·èºÑ¼õÉÕÈÖ¹æ¤òDB¤Ë½ñ¤­¹þ¤à
+	$sqlval['loan_result'] = $_GET['receiptno'];
+	$objQuery = new SC_Query();
+	$objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ?", array($uniqid));
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	// ½èÍý´°Î»¥Ú¡¼¥¸¤Ø
+	header("Location: " . URL_SHOP_COMPLETE);
+}
+
+switch($_POST['mode']) {
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_CONFIRM);
+	exit;
+	break;
+default:
+	break;
+}
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+$arrData = sfGetOrderTemp($uniqid);
+// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+// »ÙÊ§¤¤Áí³Û
+$objPage->tpl_amount = $arrData['payment_total'];
+// ¼õÃí²¾ÈÖ¹æ
+$objPage->tpl_tranno = $uniqid;
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objPage->arrInfo = $arrInfo;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/convenience.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/convenience.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/convenience.php	(revision 2812)
@@ -0,0 +1,213 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = "shopping/convenience.tpl";
+		$this->tpl_css = '/css/layout/shopping/pay.css';
+		global $arrCONVENIENCE;
+		$this->arrCONVENIENCE = $arrCONVENIENCE;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page;
+$objView = new SC_SiteView;
+$objSiteSess = new SC_SiteSession;
+$objCartSess = new SC_CartSession;
+$objSiteInfo = $objView->objSiteInfo;
+$objCustomer = new SC_Customer;
+
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥¢¥¯¥»¥¹¤ÎÀµÅöÀ­¤ÎÈ½Äê
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+//¥³¥ó¥Ó¥Ë¤Î¼ïÎà¤Ç½èÍý¥Õ¥¡¥¤¥ë¤òÀÚ¤êÂØ¤¨¤ë
+switch($_POST['mode']) {
+//´°Î»
+case 'complete':
+	//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError();
+	if($objPage->arrErr == "") {
+		// ¥Þ¡¼¥Á¥ã¥ó¥È¾ðÊóÀßÄê¥Õ¥¡¥¤¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É
+		//require("merchant.ini");
+		// ·èºÑ½èÍý¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥¯¥ë¡¼¥É
+		require_once(ROOT_DIR . "data/vtcvsmdk/mdk/lib/BSCVS/Transaction.php");
+		require_once(ROOT_DIR . "data/vtcvsmdk/mdk/lib/BSCVS/Config.php");
+		require_once(ROOT_DIR . "data/vtcvsmdk/mdk/lib/BSCVS/Log.php");
+	
+		// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+		$objTran = new Transaction;
+		
+		// ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+		$objTran->setServer(ROOT_DIR . "data/vtcvsmdk/mdk/conf/cvsgwlib.conf");
+		
+		// ¥«¡¼¥È½¸·×½èÍý
+		$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+		// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+		$arrData = sfGetOrderTemp($uniqid);
+		// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+		$arrPrice = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer);
+		
+		// ¥í¥°½ÐÎÏ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ
+		$logger = $objTran->getLogger();
+		
+		// ¥í¥°½ÐÎÏ(¤³¤³¤«¤é)
+		$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ½èÍý³«»Ï... >>>');
+		
+		//¥³¥ó¥Ó¥Ë¤Î¼ïÎà¤«¤éCVS¥¿¥¤¥×¤ò·èÄê¤¹¤ë
+		switch($_POST['convenience']) {
+		//¥»¥Ö¥ó¥¤¥ì¥Ö¥ó
+		case '1':
+			$cvs_type = '01';
+			break;
+		//¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È
+		case '2':
+			$cvs_type = '03';
+			break;
+		//¥µ¡¼¥¯¥ëK¥µ¥ó¥¯¥¹
+		case '3':
+			$cvs_type = '04';
+			break;
+		//¤½¤ÎÂ¾
+		case '4':
+		case '5':
+			$cvs_type = '02';
+			break;
+		default:
+			sfDispSiteError(PAGE_ERROR);
+			break;
+		}
+	
+		//¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸
+		$arrRequest = array(
+			// ¼è°ú ID
+		    REQ_ORDER_ID => $uniqid,		
+		    // CVS¥¿¥¤¥×
+		    REQ_CVS_TYPE => $cvs_type,
+		    // ¶â³Û
+		    REQ_AMOUNT => $arrPrice['payment_total'],
+		    // »ÙÊ§´ü¸Â
+		    REQ_PAY_LIMIT => lfGetPayLimit(),
+		    // »áÌ¾¡ÊÃí°Õ¡§¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ï UTF-8 ¤ÎÊ¸»ú¤Î¤ß¤ò
+		    // ¼õ¤±ÉÕ¤±¤ë¤¿¤á¡¢¥²¡¼¥È¥¦¥§¥¤ÀÜÂ³¤ÎÁ°¤Ë UTF-8 ¥³¡¼¥É¤ØÊÑ´¹¡Ë
+		    REQ_NAME1 => $objTran->jCode($arrData['order_name01'], ENCODE_UTF8),
+		    REQ_NAME2 => $objTran->jCode($arrData['order_name02'], ENCODE_UTF8),
+			REQ_KANA => $objTran->jCode($arrData['order_kana01'].$arrData['order_kana02'], ENCODE_UTF8),
+		    // ÅÅÏÃÈÖ¹æ
+		    REQ_TEL_NO => $arrData['order_tel01']."-".$arrData['order_tel02']."-".$arrData['order_tel03']
+		);
+
+		//¥Ù¥ê¥È¥é¥ó¥¹¥³¥ó¥Ó¥Ë¥²¡¼¥È¥¦¥§¥¤¤Ë¥ê¥¯¥¨¥¹¥ÈÅÅÊ¸¤òÅê¤²¡¢¼è°ú·ë²Ì¤ò³ÊÇ¼
+		$arrResult = $objTran->doTransaction(CMD_ENTRY, $arrRequest);
+		//¼è°úÀ®¸ù
+		if($arrResult[RES_ACTION_CODE] = '010') {
+			//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+			switch($_POST['convenience']) {
+			//¥»¥Ö¥ó¥¤¥ì¥Ö¥ó
+			case '1':
+				$arrRet['cv_type'] = '1';										//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_payment_url'] = $arrResult[RES_HARAIKOMI_URL];		//Ê§¹þÉ¼URL(PC)
+				$arrRet['cv_receipt_no'] = $arrResult[RES_RECEIPT_NO];			//Ê§¹þÉ¼ÈÖ¹æ
+				break;
+			//¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È
+			case '2':
+				$company_code = substr($arrResult[RES_RECEIPT_NO], 0, 5);
+				$order_no = substr($arrResult[RES_RECEIPT_NO], 6, 12);
+				$arrRet['cv_type'] = '2';						//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_company_code'] = $company_code;	//´ë¶È¥³¡¼¥É
+				$arrRet['cv_order_no'] = $order_no;			//¼õÉÕÈÖ¹æ
+				break;
+			//¥µ¡¼¥¯¥ëK¥µ¥ó¥¯¥¹
+			case '3':
+				$mobile_url = preg_replace("/https:\/\/.+?\/JLPcon/","https://w2.kessai.info/JLM/JLMcon", $arrResult[RES_HARAIKOMI_URL]);
+				$arrRet['cv_type'] = '3';										//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_payment_url'] = $arrResult[RES_HARAIKOMI_URL];		//Ê§¹þÉ¼URL
+				$arrRet['cv_payment_mobile_url'] = $mobile_url;					//Ê§¹þÉ¼URL(¥â¥Ð¥¤¥ë)
+				break;
+			//¥í¡¼¥½¥ó¡¢¥»¥¤¥³¡¼¥Þ¡¼¥È
+			case '4':
+				$arrRet['cv_type'] = '4';									//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_receipt_no'] = $arrResult[RES_RECEIPT_NO];		//Ê§¹þÉ¼ÈÖ¹æ
+				break;
+			//¥ß¥Ë¥¹¥È¥Ã¥×¡¢¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¢¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢
+			case '5':
+				$arrRet['cv_type'] = '5';										//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$arrRet['cv_payment_url'] = $arrResult[RES_HARAIKOMI_URL];		//Ê§¹þÉ¼URL(PC)
+				break;
+			}
+			//»ÙÊ§´ü¸Â
+			$arrRet['cv_payment_limit'] = lfGetPayLimit();
+			//¥³¥ó¥Ó¥Ë·èºÑ¾ðÊó¤ò³ÊÇ¼
+			$sqlval['conveni_data'] = serialize($arrRet);
+			$objQuery = new SC_Query;
+			$objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ? ", array($uniqid));
+			// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+			$objSiteSess->setRegistFlag();
+			//¹ØÆþ´°Î»¥Ú¡¼¥¸¤Ø
+			header("Location: " . URL_SHOP_COMPLETE);
+		//¼ºÇÔ
+		} else {
+			$objPage->arrErr = '¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£';
+		}
+		
+		# ¥í¥°½ÐÎÏ(¤³¤³¤Þ¤Ç)
+		$logger->logprint('DEBUG', '<<< »ÙÊ§·ë²Ì²èÌÌ½èÍý½ªÎ». >>>');
+	
+	}
+	break;
+//Ìá¤ë
+case 'return':
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . URL_SHOP_CONFIRM);
+	exit;
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-------------------------------------------------------------------------------------------------------------
+
+//»ÙÊ§´ü¸Â¤ÎÀ¸À®
+function lfGetPayLimit() {
+    $date = sprintf("%10s",
+                    date("Y/m/d",mktime(0,0,0,date("m"),
+                    date("d")+CV_PAYMENT_LIMIT,date("Y"))));
+    return $date;
+}
+
+//¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥³¥ó¥Ó¥Ë¤Î¼ïÎà", "convenience", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+}
+	
+// ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/confirm.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/confirm.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/confirm.php	(revision 2812)
@@ -0,0 +1,100 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $tpl_total_deliv_fee;
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/confirm.tpl';
+		$this->tpl_css = '/css/layout/shopping/confirm.css';
+		$this->tpl_title = "¤´ÆþÎÏÆâÍÆ¤Î¤´³ÎÇ§";
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrSex;
+		$this->arrSex = $arrSex;
+		global $arrMAILMAGATYPE;
+		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
+		global $arrReminder;
+		$this->arrReminder = $arrReminder;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCartSess = new SC_CartSession();
+$objSiteInfo = $objView->objSiteInfo;
+$objSiteSess = new SC_SiteSession();
+$objCustomer = new SC_Customer();
+$arrInfo = $objSiteInfo->data;
+
+// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿µ­Ï¿¤¬¤¢¤ë¤«È½Äê
+sfIsPrePage($objSiteSess);
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+$objPage->tpl_uniqid = $uniqid;
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+$arrData = sfGetOrderTemp($uniqid);
+// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer);
+
+// ²ñ°÷¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($objCustomer->isLoginSuccess()) {
+	$objPage->tpl_login = '1';
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+}
+
+switch($_POST['mode']) {
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_PAYMENT);
+	exit;
+	break;
+case 'confirm':
+	// ½¸·×·ë²Ì¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+	sfRegistTempOrder($uniqid, $arrData);
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	
+	// ·èºÑÊýË¡¤Ë¤è¤ê²èÌÌÀÚÂØ
+	switch($arrData['payment_id']) {
+/* ¥¯¥ì¥¸¥Ã¥È¡¢¥í¡¼¥ó¡¢¥³¥ó¥Ó¥Ë·èºÑ¤Ï¼¡´ü³«È¯
+	case PAYMENT_CREDIT_ID:
+		header("Location: " . URL_SHOP_CREDIT);
+		break;
+	case PAYMENT_LOAN_ID:
+		header("Location: " . URL_SHOP_LOAN);
+		break;
+	case PAYMENT_CONVENIENCE_ID:
+		header("Location: " . URL_SHOP_CONVENIENCE);
+		break;
+*/
+	default:
+		header("Location: " . URL_SHOP_COMPLETE);
+		break;
+	}
+	break;
+default:
+	break;
+}
+
+$objPage->arrData = $arrData;
+$objPage->arrInfo = $arrInfo;
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/payment.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/payment.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/payment.php	(revision 2812)
@@ -0,0 +1,325 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/shopping/pay.css';
+		$this->tpl_mainpage = 'shopping/payment.tpl';
+		$this->tpl_onload = 'fnCheckInputPoint();';
+		$this->tpl_title = "¤ª»ÙÊ§ÊýË¡¡¦¤ªÆÏ¤±»þ´ÖÅù¤Î»ØÄê";
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+$objSiteInfo = $objView->objSiteInfo;
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+// ¥æ¥Ë¡¼¥¯ID¤ò°ú¤­·Ñ¤°
+$objPage->tpl_uniqid = $uniqid;
+
+// ²ñ°÷¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($objCustomer->isLoginSuccess()) {
+	$objPage->tpl_login = '1';
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+}
+
+// ¶â³Û¤Î¼èÆÀ
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+$objPage->arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+switch($_POST['mode']) {
+case 'confirm':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($objPage->arrData );
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if(count($objPage->arrErr) == 0) {
+		// DB¤Ø¤Î¥Ç¡¼¥¿ÅÐÏ¿
+		lfRegistData($uniqid);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . URL_SHOP_CONFIRM);
+		exit;
+	}else{
+		// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
+		$uniqid = $objSiteSess->getUniqId();
+		// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼
+		lfSetOrderTempData($uniqid);
+	}
+	break;
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Èó²ñ°÷¤Î¾ì¹ç
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_TOP);
+	exit;
+	break;
+// »ÙÊ§¤¤ÊýË¡¤¬ÊÑ¹¹¤µ¤ì¤¿¾ì¹ç
+case 'payment':
+	// ¤³¤³¤Îbreak¤Ï¡¢°ÕÌ£¤¬¤¢¤ë¤Î¤Ç³°¤µ¤Ê¤¤¤Ç²¼¤µ¤¤¡£
+	break;
+default:
+	// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼
+	lfSetOrderTempData($uniqid);
+	break;
+}
+
+// Å¹ÊÞ¾ðÊó¤Î¼èÆÀ
+$arrInfo = $objSiteInfo->data;
+// ¹ØÆþ¶â³Û¤Î¼èÆÀÆÀ
+$total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = lfGetPayment($total_pretax);
+// ÇÛÁ÷»þ´Ö¤Î¼èÆÀ
+$arrRet = sfGetDelivTime($objFormParam->getValue('payment_id'));
+$objPage->arrDelivTime = sfArrKeyValue($arrRet, 'time_id', 'time');
+$objPage->objCustomer = $objCustomer;
+//¡¡ÇÛÁ÷Æü°ìÍ÷¤Î¼èÆÀ
+$objPage->arrDelivDate = lfGetDelivDate();
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¤ª»ÙÊ§¤¤ÊýË¡", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥È", "use_point", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK", "ZERO_START"));
+	$objFormParam->addParam("ÇÛÃ£»þ´Ö", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¤´¼ÁÌä", "message", LTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥È¤ò»ÈÍÑ¤¹¤ë", "point_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '2');
+	$objFormParam->addParam("ÇÛÃ£Æü", "deliv_date", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+}
+
+function lfGetPayment($total_pretax) {
+	$objQuery = new SC_Query();
+	$objQuery->setorder("fix,rank DESC");
+	//ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤»ÙÊ§ÊýË¡¤ò¼èÆÀ
+	$arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", "delete = 0 AND deliv_id IN (SELECT deliv_id FROM dtb_deliv WHERE delete = 0) ");
+	//ÍøÍÑ¾ò·ï¤«¤é»ÙÊ§²ÄÇ½ÊýË¡¤òÈ½Äê
+	foreach($arrRet as $data) {
+		//²¼¸Â¤È¾å¸Â¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+		if($data['rule'] > 0 && $data['upper_rule'] > 0) {
+			if($data['rule'] <= $total_pretax && $data['upper_rule'] >= $total_pretax) {
+				$arrPayment[] = $data;
+			}
+		//²¼¸Â¤Î¤ßÀßÄê¤µ¤ì¤Æ¤¤¤ë
+		} elseif($data['rule'] > 0) {	
+			if($data['rule'] <= $total_pretax) {
+				$arrPayment[] = $data;
+			}
+		//¾å¸Â¤Î¤ßÀßÄê¤µ¤ì¤Æ¤¤¤ë
+		} elseif($data['upper_rule'] > 0) {
+			if($data['upper_rule'] >= $total_pretax) {
+				$arrPayment[] = $data;
+			}
+		//ÀßÄê¤Ê¤·
+		} else {
+			$arrPayment[] = $data;
+		}	
+	}
+	return $arrPayment;	
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError($arrData) {
+	global $objFormParam;
+	global $objCustomer;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	if($_POST['point_check'] == '1') {
+		$objErr->doFunc(array("¥Ý¥¤¥ó¥È¤ò»ÈÍÑ¤¹¤ë", "point_check"), array("EXIST_CHECK"));
+		$objErr->doFunc(array("¥Ý¥¤¥ó¥È", "use_point"), array("EXIST_CHECK"));
+		$max_point = $objCustomer->getValue('point');
+		if($max_point == "") {
+			$max_point = 0;
+		}
+		if($arrRet['use_point'] > $max_point) {
+			$objErr->arrErr['use_point'] = "¢¨ ¤´ÍøÍÑ¥Ý¥¤¥ó¥È¤¬½ê»ý¥Ý¥¤¥ó¥È¤òÄ¶¤¨¤Æ¤¤¤Þ¤¹¡£<br />";
+		}
+		if(($arrRet['use_point'] * POINT_VALUE) > $arrData['subtotal']) {
+			$objErr->arrErr['use_point'] = "¢¨ ¤´ÍøÍÑ¥Ý¥¤¥ó¥È¤¬¤´¹ØÆþ¶â³Û¤òÄ¶¤¨¤Æ¤¤¤Þ¤¹¡£<br />";
+		}
+	}
+	return $objErr->arrErr;
+}
+
+/* »ÙÊ§¤¤ÊýË¡Ê¸»úÎó¤Î¼èÆÀ */
+function lfGetPaymentInfo($payment_id) {
+	$objQuery = new SC_Query();
+	$where = "payment_id = ?";
+	$arrRet = $objQuery->select("payment_method, charge", "dtb_payment", $where, array($payment_id));
+	return (array($arrRet[0]['payment_method'], $arrRet[0]['charge']));
+}
+
+/* ÇÛÁ÷»þ´ÖÊ¸»úÎó¤Î¼èÆÀ */
+function lfGetDelivTimeInfo($time_id) {
+	$objQuery = new SC_Query();
+	$where = "time_id = ?";
+	$arrRet = $objQuery->select("deliv_id, time", "dtb_delivtime", $where, array($time_id));
+	return (array($arrRet[0]['deliv_id'], $arrRet[0]['time']));
+}
+
+/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
+function lfRegistData($uniqid) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	$sqlval = $objFormParam->getDbArray();
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['update_date'] = 'Now()';
+	
+	if($sqlval['payment_id'] != "") {
+		list($sqlval['payment_method'], $sqlval['charge']) = lfGetPaymentInfo($sqlval['payment_id']);
+	} else {
+		$sqlval['payment_id'] = '0';
+		$sqlval['payment_method'] = "";
+	}
+	
+	if($sqlval['deliv_time_id'] != "") {
+		list($sqlval['deliv_id'], $sqlval['deliv_time']) = lfGetDelivTimeInfo($sqlval['deliv_time_id']);
+	} else {
+		$sqlval['deliv_time_id'] = '0';
+		$sqlval['deliv_id'] = '0';
+		$sqlval['deliv_time'] = "";
+	}
+	
+	// »ÈÍÑ¥Ý¥¤¥ó¥È¤ÎÀßÄê
+	if($sqlval['point_check'] != '1') {
+		$sqlval['use_point'] = 0;
+	}
+	
+	sfRegistTempOrder($uniqid, $sqlval);
+}
+
+/* ÇÛÃ£Æü°ìÍ÷¤ò¼èÆÀ¤¹¤ë */
+function lfGetDelivDate() {
+	$objCartSess = new SC_CartSession();
+	$objQuery = new SC_Query();
+	// ¾¦ÉÊID¤Î¼èÆÀ
+	$max = $objCartSess->getMax();
+	for($i = 1; $i <= $max; $i++) {
+		if($_SESSION[$objCartSess->key][$i]['id'][0] != "") {
+			$arrID['product_id'][$i] = $_SESSION[$objCartSess->key][$i]['id'][0];
+		}
+	}
+	if(count($arrID['product_id']) > 0) {
+		$id = implode(",", $arrID['product_id']);
+		//¾¦ÉÊ¤«¤éÈ¯Á÷ÌÜ°Â¤Î¼èÆÀ
+		$deliv_date = $objQuery->get("dtb_products", "MAX(deliv_date_id)", "product_id IN (".$id.")");
+		//È¯Á÷ÌÜ°Â
+		switch($deliv_date) {
+		//Â¨ÆüÈ¯Á÷
+		case '1':
+			$start_day = 1;
+			break;
+		//1-2Æü¸å
+		case '2':
+			$start_day = 3;
+			break;
+		//3-4Æü¸å
+		case '3':
+			$start_day = 5;
+			break;
+		//1½µ´Ö°ÊÆâ
+		case '4':
+			$start_day = 8;
+			break;
+		//2½µ´Ö°ÊÆâ
+		case '5':
+			$start_day = 15;
+			break;
+		//3½µ´Ö°ÊÆâ
+		case '6':
+			$start_day = 22;
+			break;
+		//1¥ö·î°ÊÆâ
+		case '7':
+			$start_day = 32;
+			break;
+		//2¥ö·î°Ê¹ß
+		case '8':
+			$start_day = 62;			
+			break;
+		//¤ª¼è¤ê´ó¤»(¾¦ÉÊÆþ²Ù¸å)
+		case '9':
+			$start_day = "";
+			break;
+		default:
+			//¤ªÆÏ¤±Æü¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+			$start_day = "";
+			break;
+		}
+		//ÇÛÃ£²ÄÇ½Æü¤Î¥¹¥¿¡¼¥ÈÃÍ¤«¤é¡¢ÇÛÃ£Æü¤ÎÇÛÎó¤ò¼èÆÀ¤¹¤ë
+		$arrDelivDate = lfGetDateArray($start_day, DELIV_DATE_END_MAX);
+	}
+	return $arrDelivDate;
+}
+
+//ÇÛÃ£²ÄÇ½Æü¤Î¥¹¥¿¡¼¥ÈÃÍ¤«¤é¡¢ÇÛÃ£Æü¤ÎÇÛÎó¤ò¼èÆÀ¤¹¤ë
+function lfGetDateArray($start_day, $end_day) {
+	global $arrWDAY;
+	//ÇÛÃ£²ÄÇ½Æü¤Î¥¹¥¿¡¼¥ÈÃÍ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ì¤Ð
+	if($start_day >= 1) {
+		$now_time = time();
+		$max_day = $start_day + $end_day;
+		// ½¸·×
+		for ($i = $start_day; $i < $max_day; $i++) {
+			// ´ðËÜ»þ´Ö¤«¤éÆü¿ô¤òÄÉ²Ã¤·¤Æ¤¤¤¯
+			$tmp_time = $now_time + ($i * 24 * 3600);
+			list($y, $m, $d, $w) = split(" ", date("y m d w", $tmp_time));	
+			$val = sprintf("%02d/%02d/%02d(%s)", $y, $m, $d, $arrWDAY[$w]);
+			$arrDate[$val] = $val;
+		}
+	} else {
+		$arrDate = false;
+	}
+	return $arrDate;
+}
+
+//°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼¤¹¤ë
+function lfSetOrderTempData($uniqid) {
+	global $objQuery;
+	global $objFormParam;
+	
+	$objQuery = new SC_Query();
+	$col = "payment_id, use_point, deliv_time_id, message, point_check, deliv_date";
+	$from = "dtb_order_temp";
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select($col, $from, $where, array($uniqid));
+	// DBÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($arrRet[0]);
+	return $objFormParam;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/loan_cancel.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/loan_cancel.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/loan_cancel.php	(revision 2812)
@@ -0,0 +1,84 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/loan.tpl';
+		$this->tpl_css = '/css/layout/shopping/pay.css';
+		// ¥Û¡¼¥à¥¢¥É¥ì¥¹
+		$this->tpl_homeaddr = CF_HOMEADDR;
+		// ¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·
+		$this->tpl_simulate = CF_SIMULATE;
+		// ²ÃÌÁÅ¹¥³¡¼¥É
+		$this->tpl_storecode = CF_STORECODE;
+		// Ìá¤êÀè
+		$this->tpl_returnurl = CF_RETURNURL;
+		// ¸Æ¤Ó½Ð¤·¶èÊ¬(0:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¤Î¤ß¡¢1:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó+¿½¹þ)
+		$this->tpl_continue = CF_CONTINUE;
+		// ÌòÌ³Í­Ìµ¶èÊ¬(0:Ìµ¡¢1:Í­)
+		$this->tpl_labor = CF_LABOR;
+		// ·ë²Ì±þÅú(1:·ë²Ì¤¢¤ê¡¢2:·ë²Ì¤Ê¤·)
+		$this->tpl_result = CF_RESULT;
+		// ¥­¥ã¥ó¥»¥ëURL
+		$this->tpl_cancelurl = CF_CANCELURL;
+		
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+$objSiteInfo = $objView->objSiteInfo;
+$arrInfo = $objSiteInfo->data;
+
+// ÃíÊ¸°ì»þID¤Î¼èÆÀ
+$uniqid = $objSiteSess->getUniqId();
+
+// ¥í¡¼¥ó·èºÑ¤ÎÌá¤êÃÍ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+if($_GET['tranno'] == $uniqid) {
+	// ¥í¡¼¥ó·èºÑ¼õÉÕÈÖ¹æ¤òDB¤Ë½ñ¤­¹þ¤à
+	$sqlval['loan_result'] = $_GET['receiptno'];
+	$objQuery = new SC_Query();
+	$objQuery->update("dtb_order_temp", $sqlval, "order_temp_id = ?", array($uniqid));
+	
+	$objPage->tpl_message = "¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó¤Î¼êÂ³¤­¤Ï¡¢¥­¥ã¥ó¥»¥ë¤µ¤ì¤Þ¤·¤¿¡£";	
+}
+
+switch($_POST['mode']) {
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_CONFIRM);
+	exit;
+	break;
+default:
+	break;
+}
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+$arrData = sfGetOrderTemp($uniqid);
+// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+// »ÙÊ§¤¤Áí³Û
+$objPage->tpl_amount = $arrData['payment_total'];
+// ¼õÃí²¾ÈÖ¹æ
+$objPage->tpl_tranno = $uniqid;
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objPage->arrInfo = $arrInfo;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/shopping/deliv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/shopping/deliv.php	(revision 2192)
+++ /temp/tags/eccube-0_9_2beta/html/shopping/deliv.php	(revision 2192)
@@ -0,0 +1,296 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $arrAddr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/deliv.tpl';
+		$this->tpl_css = '/css/layout/shopping/index.css';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		$this->tpl_title = "¤ªÆÏ¤±Àè»ØÄê";		// ¥¿¥¤¥È¥ë
+
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+$objLoginFormParam = new SC_FormParam();	// ¥í¥°¥¤¥ó¥Õ¥©¡¼¥àÍÑ
+lfInitLoginFormParam();						// ½é´üÀßÄê
+$objLoginFormParam->setParam($_POST);		// POSTÃÍ¤Î¼èÆÀ
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+$objPage->tpl_uniqid = $uniqid;
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess()) {
+	// ÉÔÀµ¥¢¥¯¥»¥¹¤È¤ß¤Ê¤¹
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+switch($_POST['mode']) {
+case 'login':
+	$objLoginFormParam->toLower('login_email');
+	$objPage->arrErr = $objLoginFormParam->checkError();
+	$arrForm =  $objLoginFormParam->getHashArray();
+	// ¥¯¥Ã¥­¡¼ÊÝÂ¸È½Äê
+	if($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
+		$objCookie->setCookie('login_email', $_POST['login_email']);
+	} else {
+		$objCookie->setCookie('login_email', '');
+	}
+
+	if(count($objPage->arrErr) == 0) {
+		// ¥í¥°¥¤¥óÈ½Äê
+		if(!$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) {
+			// ²¾ÅÐÏ¿¤ÎÈ½Äê
+			$objQuery = new SC_Query;
+			$where = "email = ? AND status = 1 AND delete = 0";
+			$ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
+			
+			if($ret > 0) {
+				sfDispSiteError(TEMP_LOGIN_ERROR);
+			} else {
+				sfDispSiteError(SITE_LOGIN_ERROR);
+			}
+		} 
+	} else {
+		// ¥í¥°¥¤¥ó¥Ú¡¼¥¸¤ËÌá¤ë
+		header("Location: " . URL_SHOP_TOP);
+		exit;	
+	}
+	break;
+// ºï½ü
+case 'delete':
+	if (sfIsInt($_POST['other_deliv_id'])) {
+		$objQuery = new SC_Query();
+		$where = "other_deliv_id = ?";
+		$arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id']));
+		$objFormParam->setValue('select_addr_id', '');
+	}
+	break;
+// ²ñ°÷ÅÐÏ¿½»½ê¤ËÁ÷¤ë
+case 'customer_addr':
+	// ¤ªÆÏ¤±Àè¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¹¹¿·½èÍý¤ò¹Ô¤¦
+	if ($_POST['deli'] != "") {
+		// ²ñ°÷¾ðÊó¤Î½»½ê¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤à
+		lfRegistDelivData($uniqid, $objCustomer);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . URL_SHOP_PAYMENT);
+		exit;
+	}else{
+		// ¥¨¥é¡¼¤òÊÖ¤¹
+		$arrErr['deli'] = '¢¨ ¤ªÆÏ¤±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
+	}
+	break;
+	
+// ÅÐÏ¿ºÑ¤ß¤ÎÊÌ¤Î¤ªÆÏ¤±Àè¤ËÁ÷¤ë
+case 'other_addr':
+	// ¤ªÆÏ¤±Àè¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¹¹¿·½èÍý¤ò¹Ô¤¦
+	if ($_POST['deli'] != "") {
+		if (sfIsInt($_POST['other_deliv_id'])) {
+			// ÅÐÏ¿ºÑ¤ß¤ÎÊÌ¤Î¤ªÆÏ¤±Àè¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤à
+			lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['other_deliv_id']);
+			// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+			$objSiteSess->setRegistFlag();
+			// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+			header("Location: " . URL_SHOP_PAYMENT);
+			exit;
+		}
+	}else{
+		// ¥¨¥é¡¼¤òÊÖ¤¹
+		$arrErr['deli'] = '¢¨ ¤ªÆÏ¤±Àè¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£';
+	}
+	break;
+
+/*
+// ÊÌ¤Î¤ªÆÏ¤±Àè¤ò»ØÄê
+case 'new_addr':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if(count($objPage->arrErr) == 0) {
+		// DB¤Ø¤ªÆÏ¤±Àè¤òÅÐÏ¿
+		lfRegistNewAddrData($uniqid, $objCustomer);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . URL_SHOP_PAYMENT);
+		exit;		
+	}
+	break;
+*/
+
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . URL_CART_TOP);
+	exit;
+	break;
+default:
+	$objQuery = new SC_Query();
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
+	$objFormParam->setParam($arrRet[0]);
+	break;
+}
+
+/** É½¼¨½èÍý **/
+
+// ²ñ°÷ÅÐÏ¿½»½ê¤Î¼èÆÀ
+$col = "name01, name02, pref, addr01, addr02";
+$where = "customer_id = ?";
+$objQuery = new SC_Query();
+$arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id']));
+// ÊÌ¤Î¤ªÆÏ¤±Àè½»½ê¤Î¼èÆÀ
+$col = "other_deliv_id, name01, name02, pref, addr01, addr02";
+$objQuery->setorder("other_deliv_id DESC");
+$objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id']));
+$objPage->arrAddr = $arrCustomerAddr;
+$cnt = 1;
+foreach($objOtherAddr as $val) {
+	$objPage->arrAddr[$cnt] = $val;
+	$cnt++;
+}
+
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objPage->arrErr = $arrErr;
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¤ªÌ¾Á°1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê1", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê2", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+}
+
+function lfInitLoginFormParam() {
+	global $objLoginFormParam;
+	$objLoginFormParam->addParam("µ­²±¤¹¤ë", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objLoginFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objLoginFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+
+/* DB¤Ø¥Ç¡¼¥¿¤ÎÅÐÏ¿ */
+function lfRegistNewAddrData($uniqid, $objCustomer) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	$sqlval = $objFormParam->getDbArray();
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['deliv_check'] = '1';
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['update_date'] = 'Now()';
+	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+	$sqlval['order_birth'] = $objCustomer->getValue('birth');
+	
+	sfRegistTempOrder($uniqid, $sqlval);
+}
+
+/* ²ñ°÷¾ðÊó¤Î½»½ê¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
+function lfRegistDelivData($uniqid, $objCustomer) {
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['update_date'] = 'Now()';
+	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+    $sqlval['deliv_check'] = '1';
+	$sqlval['deliv_name01'] = $objCustomer->getValue('name01');
+    $sqlval['deliv_name02'] = $objCustomer->getValue('name02');
+    $sqlval['deliv_kana01'] = $objCustomer->getValue('kana01');
+    $sqlval['deliv_kana02'] = $objCustomer->getValue('kana02');
+    $sqlval['deliv_zip01'] = $objCustomer->getValue('zip01');
+    $sqlval['deliv_zip02'] = $objCustomer->getValue('zip02');
+    $sqlval['deliv_pref'] = $objCustomer->getValue('pref');
+    $sqlval['deliv_addr01'] = $objCustomer->getValue('addr01');
+    $sqlval['deliv_addr02'] = $objCustomer->getValue('addr02');
+    $sqlval['deliv_tel01'] = $objCustomer->getValue('tel01');
+    $sqlval['deliv_tel02'] = $objCustomer->getValue('tel02');
+	$sqlval['deliv_tel03'] = $objCustomer->getValue('tel03');
+
+    $sqlval['deliv_fax01'] = $objCustomer->getValue('fax01');
+    $sqlval['deliv_fax02'] = $objCustomer->getValue('fax02');
+	$sqlval['deliv_fax03'] = $objCustomer->getValue('fax03');
+
+	sfRegistTempOrder($uniqid, $sqlval);
+}
+
+/* ÊÌ¤Î¤ªÆÏ¤±Àè½»½ê¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
+function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) {
+	// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+	$sqlval['order_temp_id'] = $uniqid;
+	$sqlval['update_date'] = 'Now()';
+	$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+	$sqlval['order_birth'] = $objCustomer->getValue('birth');
+		
+	$objQuery = new SC_Query();
+	$where = "other_deliv_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id));
+	
+	$sqlval['deliv_check'] = '1';
+    $sqlval['deliv_name01'] = $arrRet[0]['name01'];
+    $sqlval['deliv_name02'] = $arrRet[0]['name02'];
+    $sqlval['deliv_kana01'] = $arrRet[0]['kana01'];
+    $sqlval['deliv_kana02'] = $arrRet[0]['kana02'];
+    $sqlval['deliv_zip01'] = $arrRet[0]['zip01'];
+    $sqlval['deliv_zip02'] = $arrRet[0]['zip02'];
+    $sqlval['deliv_pref'] = $arrRet[0]['pref'];
+    $sqlval['deliv_addr01'] = $arrRet[0]['addr01'];
+    $sqlval['deliv_addr02'] = $arrRet[0]['addr02'];
+    $sqlval['deliv_tel01'] = $arrRet[0]['tel01'];
+    $sqlval['deliv_tel02'] = $arrRet[0]['tel02'];
+	$sqlval['deliv_tel03'] = $arrRet[0]['tel03'];
+	sfRegistTempOrder($uniqid, $sqlval);
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	// Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
+	if ($_POST['mode'] == 'login'){
+	$objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN), array("EXIST_CHECK"));
+	}
+	$objErr->doFunc(array("TEL", "deliv_tel01", "deliv_tel02", "deliv_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	return $objErr->arrErr;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/phpinfo.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/phpinfo.php	(revision 3713)
+++ /temp/tags/eccube-0_9_2beta/html/phpinfo.php	(revision 3713)
@@ -0,0 +1,4 @@
+<?php
+phpinfo();
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/forgot/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/forgot/index.php	(revision 3634)
+++ /temp/tags/eccube-0_9_2beta/html/forgot/index.php	(revision 3634)
@@ -0,0 +1,141 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	
+	var $errmsg;
+	var $arrReminder;
+	var $temp_password;
+		
+	function LC_Page() {
+		$this->tpl_mainpage = 'forgot/index.tpl';
+		$this->tpl_mainno = '';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSess = new SC_Session();
+$CONF = sf_getBasisData();					// Å¹ÊÞ´ðËÜ¾ðÊó
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+
+if ( $_POST['mode'] == 'mail_check' ){
+	//¥á¥¢¥ÉÆþÎÏ»þ
+	$_POST['email'] = strtolower($_POST['email']);
+	$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND status = 2 AND delete = 0";
+	$result = $conn->getAll($sql, array($_POST['email']) );
+	
+	if ( $result[0]['reminder'] ){		// ËÜ²ñ°÷ÅÐÏ¿ºÑ¤ß¤Î¾ì¹ç
+		// ÆþÎÏemail¤¬Â¸ºß¤¹¤ë		
+		$_SESSION['forgot']['email'] = $_POST['email'];
+		$_SESSION['forgot']['reminder'] = $result[0]['reminder'];
+		// ¥Ò¥ß¥Ä¤ÎÅú¤¨ÆþÎÏ²èÌÌ
+		$objPage->Reminder = $arrReminder[$_SESSION['forgot']['reminder']];
+		$objPage->tpl_mainpage = 'forgot/secret.tpl';
+	} else {
+		$sql = "SELECT customer_id FROM dtb_customer WHERE email ILIKE ? AND status = 1 AND delete = 0";	//²¾ÅÐÏ¿Ãæ¤Î³ÎÇ§
+		$result = $conn->getAll($sql, array($_POST['email']) );
+		if ($result) {
+			$objPage->errmsg = "¤´ÆþÎÏ¤Îemail¥¢¥É¥ì¥¹¤Ï¸½ºß²¾ÅÐÏ¿Ãæ¤Ç¤¹¡£<br>ÅÐÏ¿¤ÎºÝ¤Ë¤ªÁ÷¤ê¤·¤¿¥á¡¼¥ë¤ÎURL¤Ë¥¢¥¯¥»¥¹¤·¡¢<br>ËÜ²ñ°÷ÅÐÏ¿¤ò¤ª´ê¤¤¤·¤Þ¤¹¡£";
+		} else {		//¡¡ÅÐÏ¿¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
+			$objPage->errmsg = "¤´ÆþÎÏ¤Îemail¥¢¥É¥ì¥¹¤ÏÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤»¤ó";
+		}
+	}
+	
+} elseif( $_POST['mode'] == 'secret_check' ){
+	//¥Ò¥ß¥Ä¤ÎÅú¤¨ÆþÎÏ»þ
+	
+	if ( $_SESSION['forgot']['email'] ) {
+		// ¥Ò¥ß¥Ä¤ÎÅú¤¨¤Î²óÅú¤¬Àµ¤·¤¤¤«¥Á¥§¥Ã¥¯
+		
+		$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND delete = 0";
+		$result = $conn->getAll($sql, array($_SESSION['forgot']['email']) );
+		$data = $result[0];
+		
+		if ( $data['reminder_answer'] === $_POST['input_reminder'] ){
+			// ¥Ò¥ß¥Ä¤ÎÅú¤¨¤¬Àµ¤·¤¤
+						
+			// ¿·¤·¤¤¥Ñ¥¹¥ï¡¼¥É¤òÀßÄê¤¹¤ë
+			$objPage->temp_password = gfMakePassword(8);
+						
+			if(FORGOT_MAIL == 1) {
+				// ¥á¡¼¥ë¤ÇÊÑ¹¹ÄÌÃÎ¤ò¤¹¤ë
+				lfSendMail($CONF, $_SESSION['forgot']['email'], $data['name01'], $objPage->temp_password);
+			}
+			
+			// DB¤ò½ñ¤­´¹¤¨¤ë
+			$sql = "UPDATE dtb_customer SET password = ?, update_date = now() WHERE customer_id = ?";
+			$conn->query( $sql, array( crypt($objPage->temp_password) ,$data['customer_id']) );
+			
+			// ´°Î»²èÌÌ¤ÎÉ½¼¨
+			$objPage->tpl_mainpage = 'forgot/complete.tpl';
+			
+			// ¥»¥Ã¥·¥ç¥óÊÑ¿ô¤Î²òÊü
+			$_SESSION['forgot'] = array();
+			unset($_SESSION['forgot']);
+			
+		} else {
+			// ¥Ò¥ß¥Ä¤ÎÅú¤¨¤¬Àµ¤·¤¯¤Ê¤¤
+			
+			$objPage->Reminder = $arrReminder[$_SESSION['forgot']['reminder']];
+			$objPage->errmsg = "¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¼ÁÌä¤ËÂÐ¤¹¤ë²óÅú¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó";
+			$objPage->tpl_mainpage = 'forgot/secret.tpl';
+
+		}
+	
+		
+	} else {
+		// ¥¢¥¯¥»¥¹¸µ¤¬ÉÔÀµ¤Þ¤¿¤Ï¡¢¥»¥Ã¥·¥ç¥óÊÝ»ý´ü´Ö¤¬ÀÚ¤ì¤Æ¤¤¤ë
+		$objPage->errmsg = "email¥¢¥É¥ì¥¹¤òºÆÅÙÅÐÏ¿¤·¤Æ¤¯¤À¤µ¤¤¡£<br />Á°²ó¤ÎÆþÎÏ¤«¤é»þ´Ö¤¬·Ð¤Ã¤Æ¤¤¤Þ¤¹¤È¡¢ËÜ¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤ë²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£";
+	}
+}
+
+// ¥Ç¥Õ¥©¥ë¥ÈÆþÎÏ
+if($_POST['email'] != "") {
+	// POSTÃÍ¤òÆþÎÏ
+	$objPage->tpl_login_email = $_POST['email'];
+} else {
+	// ¥¯¥Ã¥­¡¼ÃÍ¤òÆþÎÏ
+	$objPage->tpl_login_email = $objCookie->getCookie('login_email');
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+// ---------------------------------------------------------------------------------------------------------------
+
+
+function lfSendMail($CONF, $email, $customer_name, $temp_password){
+	//¡¡¥Ñ¥¹¥ï¡¼¥ÉÊÑ¹¹¤ªÃÎ¤é¤»¥á¡¼¥ëÁ÷¿®
+	
+	$objPage = new LC_Page();
+	$objPage->customer_name = $customer_name;
+	$objPage->temp_password = $temp_password;
+	$objMailText = new SC_SiteView();
+	$objMailText->assignobj($objPage);
+	
+	$toCustomerMail = $objMailText->fetch("mail_templates/forgot_mail.tpl");
+	$objMail = new GC_SendMail();
+	
+	$objMail->setItem(
+						  ''								//¡¡°¸Àè
+						, "¥Ñ¥¹¥ï¡¼¥É¤¬ÊÑ¹¹¤µ¤ì¤Þ¤·¤¿" ."¡Ú" .$CONF["shop_name"]. "¡Û"		//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $toCustomerMail					//¡¡ËÜÊ¸
+						, $CONF["email03"]					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $CONF["shop_name"]				//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $CONF["email03"]					//¡¡reply_to
+						, $CONF["email04"]					//¡¡return_path
+						, $CONF["email04"]					//  Errors_to
+
+														);
+	$objMail->setTo($email, $customer_name ." ÍÍ");
+	$objMail->sendMail();	
+	
+}
+
+
+?>
+
Index: /temp/tags/eccube-0_9_2beta/html/products/list.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/list.php	(revision 2787)
+++ /temp/tags/eccube-0_9_2beta/html/products/list.php	(revision 2787)
@@ -0,0 +1,410 @@
+<?php
+$LIST_PHP_DIR = realpath(dirname( __FILE__));
+require_once($LIST_PHP_DIR  . "/../../data/lib/slib.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_View.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_Query.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_Customer.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_Cookie.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_SiteInfo.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_PageNavi.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_CheckError.php");
+require_once($LIST_PHP_DIR  . "/../../data/class/SC_CartSession.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	function LC_Page() {
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		global $arrSTATUS_IMAGE;
+		$this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;
+		global $arrDELIVERYDATE;
+		$this->arrDELIVERYDATE = $arrDELIVERYDATE;
+		global $arrPRODUCTLISTMAX;
+		$this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX;		
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$conn = new SC_DBConn();
+
+//É½¼¨·ï¿ô¤ÎÁªÂò
+if(sfIsInt($_POST['disp_number'])) {
+	$objPage->disp_number = $_POST['disp_number'];
+} else {
+	//ºÇ¾®É½¼¨·ï¿ô¤òÁªÂò
+	$objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX));
+}
+
+//É½¼¨½ç½ø¤ÎÊÝÂ¸
+$objPage->orderby = $_POST['orderby'];
+
+// GET¤Î¥«¥Æ¥´¥êID¤ò¸µ¤ËÀµ¤·¤¤¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë¡£
+$category_id = sfGetCategoryId("", $_GET['category_id']);
+
+// ¥¿¥¤¥È¥ëÊÔ½¸
+$tpl_subtitle = "";
+if($_GET['mode'] == 'search'){
+	$tpl_subtitle = "¸¡º÷·ë²Ì";
+}elseif ($category_id == "" ) {
+	$tpl_subtitle = "Á´¾¦ÉÊ";
+}else{
+	$arrFirstCat = GetFirstCat($category_id);
+	$tpl_subtitle = $arrFirstCat['name'];
+}
+
+$objQuery = new SC_Query();
+$count = $objQuery->count("dtb_best_products", "category_id = ?", array($category_id));
+
+// °Ê²¼¤Î¾ò·ï¤ÇBEST¾¦ÉÊ¤òÉ½¼¨¤¹¤ë
+// ¡¦BESTºÇÂç¿ô¤Î¾¦ÉÊ¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¡£
+// ¡¦¥«¥Æ¥´¥êID¤¬¥ë¡¼¥ÈID¤Ç¤¢¤ë¡£
+// ¡¦¸¡º÷¥â¡¼¥É¤Ç¤Ê¤¤¡£
+if(($count >= BEST_MIN) && lfIsRootCategory($category_id) && ($_GET['mode'] != 'search') ) {
+	// ¾¦ÉÊTOP¤ÎÉ½¼¨½èÍý
+	/** É¬¤º»ØÄê¤¹¤ë **/
+	$objPage->tpl_mainpage = ROOT_DIR . 'html/user_data/templates/list.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È	
+	
+	$objPage->arrBestItems = sfGetBestProducts($conn, $category_id);
+	$objPage->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2);
+} else {
+	if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){
+		// ¸¡º÷»þ¤Ëcategory_id¤¬GET¤ËÂ¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢²¾¤ËËä¤á¤¿ID¤ò¶õÇò¤ËÌá¤¹
+		$category_id = '';	
+	}
+	
+	// ¾¦ÉÊ°ìÍ÷¤ÎÉ½¼¨½èÍý
+	$objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_POST['orderby']);
+	
+	// ¸¡º÷¾ò·ï¤ò²èÌÌ¤ËÉ½¼¨
+	// ¥«¥Æ¥´¥ê¡¼¸¡º÷¾ò·ï
+	if (strlen($_GET['category_id']) == 0) {
+		$arrSearch['category'] = "»ØÄê¤Ê¤·";
+	}else{
+		$arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id));
+		$arrSearch['category'] = $arrCat;
+	}
+	
+	// ¾¦ÉÊÌ¾¸¡º÷¾ò·ï
+	if ($_GET['name'] === "") {
+		$arrSearch['name'] = "»ØÄê¤Ê¤·";
+	}else{
+		$arrSearch['name'] = $_GET['name'];
+	}
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "products/list.php");
+
+if($_POST['mode'] == "cart" && $_POST['product_id'] != "") {
+	// ÃÍ¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯
+	if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "delete = 0 AND status = 1")) {
+		sfDispSiteError(PRODUCT_NOT_FOUND);
+	} else {
+		// ÆþÎÏÃÍ¤ÎÊÑ´¹
+		$objPage->arrErr = lfCheckError($_POST['product_id']);
+		if(count($objPage->arrErr) == 0) {
+			$objCartSess = new SC_CartSession();
+			$classcategory_id = "classcategory_id". $_POST['product_id'];
+			$classcategory_id1 = $_POST[$classcategory_id. '_1'];
+			$classcategory_id2 = $_POST[$classcategory_id. '_2'];
+			$quantity = "quantity". $_POST['product_id'];
+			// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+			if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) {
+				$classcategory_id1 = '0';
+			}
+			// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+			if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) {
+				$classcategory_id2 = '0';
+			}
+			$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
+			header("Location: /cart/index.php");
+			exit;
+		}
+	}
+}
+
+
+$objPage->tpl_subtitle = $tpl_subtitle;
+
+// »ÙÊ§ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = lfGetPayment();
+// ÆþÎÏ¾ðÊó¤òÅÏ¤¹
+$objPage->arrForm = $_POST;
+
+$objPage->category_id = $category_id;
+$objPage->arrSearch = $arrSearch;
+
+sfCustomDisplay($objPage);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥«¥Æ¥´¥êID¤¬¥ë¡¼¥È¤«¤É¤¦¤«¤ÎÈ½Äê */
+function lfIsRootCategory($category_id) {
+	$objQuery = new SC_Query();
+	$level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id));
+	if($level == 1) {
+		return true;
+	}
+	return false;
+}
+
+/* ¾¦ÉÊ°ìÍ÷¤ÎÉ½¼¨ */
+function lfDispProductsList($category_id, $name, $disp_num, $orderby) {
+	global $objPage;
+	$objQuery = new SC_Query();	
+	$objPage->tpl_pageno = $_POST['pageno'];
+
+	//É½¼¨·ï¿ô¤Ç¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂØ¤¨¤ë
+	$objPage->tpl_mainpage = ROOT_DIR . 'html/user_data/templates/list.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È		
+
+	//É½¼¨½ç½ø
+	switch($orderby) {
+	//²Á³Ê½ç
+	case 'price':
+		$order = "price02_min ASC";
+		break;
+	//¿·Ãå½ç
+	case 'date':
+		$order = "create_date DESC";
+		break;
+	default:
+		$order = "category_rank DESC, rank DESC";
+		break;
+	}
+	
+	// ¾¦ÉÊ¸¡º÷¾ò·ï¤ÎºîÀ®¡ÊÌ¤ºï½ü¡¢É½¼¨¡Ë
+	$where = "delete = 0 AND status = 1 ";
+	// ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREÊ¸»úÎó¼èÆÀ
+	if ( $category_id ) {
+		list($tmp_where, $arrval) = sfGetCatWhere($category_id);
+		if($tmp_where != "") {
+			$where.= " AND $tmp_where";
+		}
+	}
+		
+	// ¾¦ÉÊÌ¾¤òwhereÊ¸¤Ë
+	$name = ereg_replace(",", "", $name);
+	if ( strlen($name) > 0 ){
+		$where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) ";
+		$ret = sfManualEscape($name);		
+		$arrval[] = "%$ret%";
+		$arrval[] = "%$ret%";
+	}
+			
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count("vw_products_allclass", $where, $arrval);
+	$objPage->tpl_linemax = $linemax;	// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;					// ³«»Ï¹Ô
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($disp_num, $startno);
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select("*", "vw_products_allclass", $where, $arrval);
+	
+	// µ¬³ÊÌ¾°ìÍ÷
+	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+	// ´ë²è¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÀßÄê
+	if($disp_num == 15) {
+		for($i = 0; $i < count($objPage->arrProducts); $i++) {
+			$objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName);
+			// ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ
+			$objPage = lfGetSaleLimit($objPage->arrProducts[$i]);
+		}
+	}
+
+	return $objPage;
+}
+
+/* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */
+function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) {
+	global $objPage;
+	
+	$classcat_find1 = false;
+	$classcat_find2 = false;
+	// ºß¸Ë¤¢¤ê¤Î¾¦ÉÊ¤ÎÍ­Ìµ
+	$stock_find = false;
+	
+	// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+	$arrProductsClass = lfGetProductsClass($product_id);
+	
+	// µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ
+	$objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']];
+	// µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ
+	$objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']];
+	
+	// ¤¹¤Ù¤Æ¤ÎÁÈ¤ß¹ç¤ï¤»¿ô	
+	$count = count($arrProductsClass);
+	
+	$classcat_id1 = "";
+	
+	$arrSele = array();
+	$arrList = array();
+	
+	$list_id = 0;
+	$arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'";
+	$arrVal[0] = "\tval". $product_id. "_0 = new Array(''";
+	
+	for ($i = 0; $i < $count; $i++) {
+		// ºß¸Ë¤Î¥Á¥§¥Ã¥¯
+		if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
+			continue;
+		}
+		
+		$stock_find = true;
+		
+		// µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
+			$arrList[$list_id].=");\n";
+			$arrVal[$list_id].=");\n";
+			$classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
+			$arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
+			$list_id++;
+		}
+		
+		// µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ
+		if($arrList[$list_id] == "") {
+			$arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'";
+		} else {
+			$arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
+		}
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ
+		if($arrVal[$list_id] == "") {
+			$arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'";
+		} else {
+			$arrVal[$list_id].= ", '".$classcat_id2."'";
+		}
+	}	
+	
+	$arrList[$list_id].=");\n";
+	$arrVal[$list_id].=");\n";
+		
+	// µ¬³Ê1
+	$objPage->arrClassCat1[$product_id] = $arrSele;
+	
+	$lists = "\tlists".$product_id. " = new Array(";
+	$no = 0;
+	foreach($arrList as $val) {
+		$objPage->tpl_javascript.= $val;
+		if ($no != 0) {
+			$lists.= ",list". $product_id. "_". $no;
+		} else {
+			$lists.= "list". $product_id. "_". $no;
+		}
+		$no++;
+	}
+	$objPage->tpl_javascript.= $lists.");\n";
+	
+	$vals = "\tvals".$product_id. " = new Array(";
+	$no = 0;
+	foreach($arrVal as $val) {
+		$objPage->tpl_javascript.= $val;
+		if ($no != 0) {
+			$vals.= ",val". $product_id. "_". $no;
+		} else {
+			$vals.= "val". $product_id. "_". $no;
+		}
+		$no++;
+	}
+	$objPage->tpl_javascript.= $vals.");\n";
+	
+	// ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID
+	$classcategory_id = "classcategory_id". $product_id;
+	$objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); ";
+
+	// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+	if($arrProductsClass[0]['classcategory_id1'] != '0') {
+		$classcat_find1 = true;
+	}
+	
+	// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+	if($arrProductsClass[0]['classcategory_id2'] != '0') {
+		$classcat_find2 = true;
+	}
+		
+	$objPage->tpl_classcat_find1[$product_id] = $classcat_find1;
+	$objPage->tpl_classcat_find2[$product_id] = $classcat_find2;
+	$objPage->tpl_stock_find[$product_id] = $stock_find;
+		
+	return $objPage;
+}
+/* ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ */
+function lfGetProductsClass($product_id) {
+	$arrRet = array();
+	if(sfIsInt($product_id)) {
+		// ¾¦ÉÊµ¬³Ê¼èÆÀ
+		$objQuery = new SC_Query();
+		$col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
+		$table = "vw_product_class";
+		$where = "product_id = ?";
+		$objQuery->setorder("rank1 DESC, rank2 DESC");
+		$arrRet = $objQuery->select($col, $table, $where, array($product_id));
+	}
+	return $arrRet;
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError($id) {
+	global $objPage;
+	
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$objErr = new SC_CheckError();
+	
+	$classcategory_id1 = "classcategory_id". $id. "_1";
+	$classcategory_id2 = "classcategory_id". $id. "_2";
+	$quantity = "quantity". $id;
+	// Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
+	if ($objPage->tpl_classcat_find1[$id]) {
+		$objErr->doFunc(array("µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	}
+	if ($objPage->tpl_classcat_find2[$id]) {
+		$objErr->doFunc(array("µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	}
+	$objErr->doFunc(array("¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+			
+	return $objErr->arrErr;
+}
+
+// ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê
+function lfGetSaleLimit($product) {
+	global $objPage;
+	//ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃÍ¤¬ÀßÄêÃÍ¤è¤êÂç¤­¤¤¾ì¹ç
+	if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) {
+		$objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX;
+	} else {
+		$objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit'];
+	}
+	
+	return $objPage;
+}
+
+//»ÙÊ§ÊýË¡¤Î¼èÆÀ
+//payment_id	1:Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñÎ±
+function lfGetPayment() {
+	$objQuery = new SC_Query;
+	$col = "payment_id, rule, payment_method";
+	$from = "dtb_payment";
+	$where = "delete = 0";
+	$order = "payment_id";
+	$objQuery->setorder($order);
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/batch_relate.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/batch_relate.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/products/batch_relate.php	(revision 1328)
@@ -0,0 +1,38 @@
+<?php
+
+/*¡¡¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹¡£½¸·×¥Õ¥¡¥¤¥ë  */
+
+$BATCH_DIR = realpath(dirname( __FILE__));
+require_once($BATCH_DIR  . "/../../data/lib/slib.php");
+require_once($BATCH_DIR  . "/../../data/lib/glib.php");
+require_once($BATCH_DIR  . "/../../data/class/SC_Query.php");
+require_once($BATCH_DIR  . "/../../data/class/SC_DbConn.php");
+		
+$objQuery = new SC_Query();
+
+$objQuery->begin();
+$objQuery->delete("dtb_bat_relate_products");
+$arrCID = $objQuery->select("customer_id", "dtb_order", "delete = 0");
+foreach($arrCID as $cdata) {
+	$where = "order_id IN (SELECT order_id FROM dtb_order WHERE customer_id = ? )";
+	//¸ÜµÒ¤¬¹ØÆþ¤·¤¿¾¦ÉÊ£É£Ä¤ò¼èÆÀ¤¹¤ë
+	$arrPID = $objQuery->select("product_id", "dtb_order_detail", $where, array($cdata['customer_id']));
+	//¸ÜµÒ¤¬¾¦ÉÊ¤òÊ£¿ô¹ØÆþ¤·¤Æ¤¤¤ì¤Ð
+	if(count($arrPID) > 1) {
+		foreach($arrPID as $pdata1) {
+			//¤³¤Î¾¦ÉÊID
+			$sqlval['product_id'] = $pdata1['product_id'];
+			foreach($arrPID as $pdata2) {
+				if($pdata2['product_id'] != $pdata1['product_id']) {
+					//¤³¤ó¤Ê¾¦ÉÊID
+					$sqlval['relate_product_id'] = $pdata2['product_id'];
+					//¥Ç¡¼¥¿ÁÞÆþ
+					$objQuery->insert("dtb_bat_relate_products", $sqlval);
+				}
+			}
+		}
+	}
+}
+$objQuery->commit();
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/favorite.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/favorite.php	(revision 2789)
+++ /temp/tags/eccube-0_9_2beta/html/products/favorite.php	(revision 2789)
@@ -0,0 +1,30 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "products/favorite.tpl";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}else{
+	switch($_POST['mode']){
+		case 'favorite':
+		$col= "'".$_SESSION['customer']['customer_id']."','".$_POST['product_id']."','1','now()','now()' ";
+		$objQuery->exec("INSERT INTO dtb_customer_favorite VALUES (".$col.")");
+		break;
+	}
+}
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/review.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/review.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/products/review.php	(revision 1328)
@@ -0,0 +1,167 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/review.tpl';
+		global $arrRECOMMEND;
+		$this->arrRECOMMEND = $arrRECOMMEND;
+		global $arrSex;
+		$this->arrSex = $arrSex;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query(); 
+
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "review_id", "convert" => "aKV" ),
+							 array(  "column" => "product_id", "convert" => "aKV" ),
+							 array(  "column" => "reviewer_name", "convert" => "aKV" ),
+							 array(  "column" => "reviewer_url", "convert" => "a"),
+							 array(  "column" => "sex", "convert" => "n" ),
+							 array(  "column" => "email", "convert" => "a" ),
+							 array(  "column" => "recommend_level", "convert" => "n" ),
+							 array(  "column" => "title", "convert" => "aKV" ),
+							 array(  "column" => "comment", "convert" => "aKV" ),
+
+						);
+switch ($_POST['mode']){
+case 'confirm':
+	$arrForm = lfConvertParam($_POST, $arrRegistColumn);
+	$objPage->arrErr = lfErrorCheck($arrForm);
+	//½ÅÊ£¥á¥Ã¥»¡¼¥¸¤ÎÈ½Äê
+	$flag = $objQuery->count("dtb_review","product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
+
+	if ($flag > 0){
+		$objPage->arrErr['title'] .= "½ÅÊ£¤·¤¿¥¿¥¤¥È¥ë¤ÏÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£";
+	}
+		
+	//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	if($objPage->arrErr == ""){
+		//½ÅÊ£¥¿¥¤¥È¥ë¤Ç¤Ê¤¤
+		if($flag == 0){
+			//¾¦ÉÊÌ¾¤Î¼èÆÀ
+			$arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($arrForm['product_id']));
+			$objPage->arrForm = $arrForm;
+			$objPage->tpl_mainpage = 'products/review_confirm.tpl';
+		}
+	} else {
+		//¾¦ÉÊÌ¾¤Î¼èÆÀ
+		$arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($arrForm['product_id']));	
+		$objPage->arrForm = $arrForm;
+	}
+	break;
+
+case 'return':
+	foreach($_POST as $key => $val){
+		$objPage->arrForm[ $key ] = $val;
+	}
+	
+	//¾¦ÉÊÌ¾¤Î¼èÆÀ
+	$objPage->arrForm['name'] = $objQuery->get("dtb_products", "name", "product_id = ? ", array($objPage->arrForm['product_id']));
+	if(empty($objPage->arrForm['name'])) {
+		sfDispSiteError(PAGE_ERROR);
+	}
+	break;
+
+case 'complete':
+	$arrForm = lfConvertParam($_POST, $arrRegistColumn);
+	$arrErr = lfErrorCheck($arrForm);
+	//½ÅÊ£¥á¥Ã¥»¡¼¥¸¤ÎÈ½Äê
+	$flag = $objQuery->count("dtb_review","product_id = ? AND title = ? ", array($arrForm['product_id'], $arrForm['title']));
+	//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	if ($arrErr == ""){
+		//½ÅÊ£¥¿¥¤¥È¥ë¤Ç¤Ê¤¤
+		if($flag == 0) {
+			//ÅÐÏ¿¼Â¹Ô
+			lfRegistRecommendData($arrForm, $arrRegistColumn);
+			//¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ß´°Î»¥Ú¡¼¥¸¤Ø
+			header("Location: ./review_complete.php");
+			exit;
+		}
+	} else {
+		if($flag > 0) {
+			sfDispSiteError(PAGE_ERROR);
+		}
+	}
+	break;
+
+default:
+	if(sfIsInt($_GET['product_id'])) {
+		//¾¦ÉÊ¾ðÊó¤Î¼èÆÀ
+		$arrForm = $objQuery->select("product_id, name", "dtb_products", "delete = 0 AND status = 1 AND product_id=?", array($_GET['product_id']));
+		if(empty($arrForm)) {
+			sfDispSiteError(PAGE_ERROR);
+		}
+		$objPage->arrForm = $arrForm[0];
+	}
+	break;
+
+}
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);					
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("¾¦ÉÊID", "product_id", INT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));			
+	$objErr->doFunc(array("Åê¹Æ¼ÔÌ¾", "reviewer_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("URL", "reviewer_url", MTEXT_LEN), array("MAX_LENGTH_CHECK", "URL_CHECK"));
+	$objErr->doFunc(array("¤ª¤¹¤¹¤á¥ì¥Ù¥ë", "recommend_level"), array("SELECT_CHECK"));
+	$objErr->doFunc(array("¥¿¥¤¥È¥ë", "title", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//ÅÐÏ¿¼Â¹Ô
+function lfRegistRecommendData ($array, $arrRegistColumn) {
+	global $objQuery;
+	
+	// ²¾ÅÐÏ¿
+	foreach ($arrRegistColumn as $data) {
+		if (strlen($array[ $data["column"] ]) > 0 ) {
+			$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+		}
+	}
+	$arrRegist['create_date'] = 'now()';
+	$arrRegist['creator_id'] = '0';
+	//-- ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->insert("dtb_review", $arrRegist);
+	$objQuery->commit();
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/detail.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/detail.php	(revision 2189)
+++ /temp/tags/eccube-0_9_2beta/html/products/detail.php	(revision 2189)
@@ -0,0 +1,429 @@
+<?php
+$DETAIL_PHP_DIR = realpath(dirname( __FILE__));
+require_once($DETAIL_PHP_DIR  . "/../../data/lib/slib.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_View.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_Query.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_Customer.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_Cookie.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_SiteInfo.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_PageNavi.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_CheckError.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_CartSession.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_FormParam.php");
+require_once($DETAIL_PHP_DIR  . "/../../data/class/SC_UploadFile.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		global $arrSTATUS_IMAGE;
+		$this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;
+		global $arrDELIVERYDATE;
+		$this->arrDELIVERYDATE = $arrDELIVERYDATE;
+		global $arrRECOMMEND;
+		$this->arrRECOMMEND = $arrRECOMMEND;
+		
+		//$this->tpl_mainpage="products/detail.tpl";
+		
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+$objQuery = new SC_Query();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "products/detail.php");
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+
+// ´ÉÍý¥Ú¡¼¥¸¤«¤é¤Î³ÎÇ§¤Î¾ì¹ç¤Ï¡¢Èó¸ø³«¤Î¾¦ÉÊ¤âÉ½¼¨¤¹¤ë¡£
+if($_GET['admin'] == 'on') {
+	$where = "delete = 0";
+} else {
+	$where = "delete = 0 AND status = 1";
+}
+
+if($_POST['mode'] != "") {
+	$tmp_id = $_POST['product_id'];
+} else {
+	$tmp_id = $_GET['product_id'];
+}
+
+// ÃÍ¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯
+if(!sfIsInt($_GET['product_id']) || !sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) {
+	sfDispSiteError(PRODUCT_NOT_FOUND);
+}
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	//¤ªµ¤¤ËÆþ¤ê¥Ü¥¿¥óÉ½¼¨
+	$objPage->tpl_login = true;
+	
+	$table = "dtb_customer_reading";
+	$where = "customer_id = ? ";
+	$arrval[] = $objCustomer->getValue('customer_id');
+	//¸ÜµÒ¤Î±ÜÍ÷¾¦ÉÊ¿ô
+	$rpcnt = $objQuery->count($table, $where, $arrval);
+
+	//±ÜÍ÷¿ô¤¬ÀßÄê¿ô°Ê²¼
+	if ($rpcnt < CUSTOMER_READING_MAX){
+		//±ÜÍ÷ÍúÎò¤Ë¿·µ¬ÄÉ²Ã
+		lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+	} else {
+		//±ÜÍ÷ÍúÎò¤ÎÃæ¤Ç°ìÈÖ¸Å¤¤¤â¤Î¤òºï½ü¤·¤Æ¿·µ¬ÄÉ²Ã
+		$where = "customer_id = ? AND update_date = (SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ? ) ";
+		$arrval = array($objCustomer->getValue("customer_id"), $objCustomer->getValue("customer_id"));
+		//ºï½ü
+		$objQuery->delete($table, $where, $arrval);
+		//ÄÉ²Ã
+		lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id'));
+	}
+}
+
+
+// µ¬³ÊÁªÂò¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ®
+$objPage = lfMakeSelect($objPage, $tmp_id);
+
+// ¾¦ÉÊID¤òFORMÆâ¤ËÊÝ»ý¤¹¤ë¡£
+$objPage->tpl_product_id = $tmp_id;
+
+switch($_POST['mode']) {
+case 'cart':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError();
+	if(count($objPage->arrErr) == 0) {
+		$objCartSess = new SC_CartSession();
+		$classcategory_id1 = $_POST['classcategory_id1'];
+		$classcategory_id2 = $_POST['classcategory_id2'];
+				
+		// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if(!$objPage->tpl_classcat_find1) {
+			$classcategory_id1 = '0';
+		}
+		
+		// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if(!$objPage->tpl_classcat_find2) {
+			$classcategory_id2 = '0';
+		}
+
+		$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $objFormParam->getValue('quantity'));
+		header("Location: /cart/index.php");
+
+		exit;
+	}
+	break;
+		
+default:
+	break;
+}
+
+$objQuery = new SC_Query();
+// DB¤«¤é¾¦ÉÊ¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
+$arrRet = $objQuery->select("*", "vw_products_allclass_detail", "product_id = ?", array($tmp_id));
+$objPage->arrProduct = $arrRet[0];
+
+// ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ
+if($objPage->arrProduct['sale_unlimited'] == 1 || $objPage->arrProduct['sale_limit'] > SALE_LIMIT_MAX) {
+  $objPage->tpl_sale_limit = SALE_LIMIT_MAX;
+} else {
+  $objPage->tpl_sale_limit = $objPage->arrProduct['sale_limit'];
+}
+
+// ¥µ¥Ö¥¿¥¤¥È¥ë¤ò¼èÆÀ
+$arrFirstCat = GetFirstCat($arrRet[0]['category_id']);
+$tpl_subtitle = $arrFirstCat['name'];
+$objPage->tpl_subtitle = $tpl_subtitle;
+
+// DB¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+$objUpFile->setDBFileList($objPage->arrProduct);
+// ¥Õ¥¡¥¤¥ëÉ½¼¨ÍÑÇÛÎó¤òÅÏ¤¹
+$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+// »ÙÊ§ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = lfGetPayment();
+// ÆþÎÏ¾ðÊó¤òÅÏ¤¹
+$objPage->arrForm = $objFormParam->getFormParamList();
+//¥ì¥Ó¥å¡¼¾ðÊó¤Î¼èÆÀ
+$objPage->arrReview = lfGetReviewData($tmp_id);
+// ¥¿¥¤¥È¥ë¤Ë¾¦ÉÊÌ¾¤òÆþ¤ì¤ë
+$objPage->tpl_title = "¾¦ÉÊ¾ÜºÙ ". $objPage->arrProduct["name"];
+//¥ª¥¹¥¹¥á¾¦ÉÊ¾ðÊóÉ½¼¨
+$objPage->arrRecommend = lfPreGetRecommendProducts($tmp_id);
+//¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹
+$objPage->arrRelateProducts = lfGetRelateProducts($tmp_id);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("°ìÍ÷-¥á¥¤¥ó²èÁü", 'main_list_image', array('jpg','gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó²èÁü", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó³ÈÂç²èÁü", 'main_large_image', array('jpg'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT);
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö²èÁü$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);	
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü$cnt", "sub_large_image$cnt", array('jpg'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT);
+	}
+	$objUpFile->addFile("¾¦ÉÊÈæ³Ó²èÁü", 'file1', array('jpg'), IMAGE_SIZE, false, NORMAL_IMAGE_HEIGHT, NORMAL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false);
+}
+
+/* µ¬³ÊÁªÂò¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */
+function lfMakeSelect($objPage, $product_id) {
+	global $objPage;
+	$classcat_find1 = false;
+	$classcat_find2 = false;
+	// ºß¸Ë¤¢¤ê¤Î¾¦ÉÊ¤ÎÍ­Ìµ
+	$stock_find = false;
+	
+	// µ¬³ÊÌ¾°ìÍ÷
+	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+	// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+	$arrProductsClass = lfGetProductsClass($product_id);
+	
+	// µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ
+	$objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']];
+	// µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ
+	$objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']];
+	
+	// ¤¹¤Ù¤Æ¤ÎÁÈ¤ß¹ç¤ï¤»¿ô	
+	$count = count($arrProductsClass);
+	
+	$classcat_id1 = "";
+	
+	$arrSele = array();
+	$arrList = array();
+	
+	$list_id = 0;
+	$arrList[0] = "\tlist0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'";
+	$arrVal[0] = "\tval0 = new Array(''";
+	
+	for ($i = 0; $i < $count; $i++) {
+		// ºß¸Ë¤Î¥Á¥§¥Ã¥¯
+		if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
+			continue;
+		}
+		
+		$stock_find = true;
+		
+		// µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
+			$arrList[$list_id].=");\n";
+			$arrVal[$list_id].=");\n";
+			$classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
+			$arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
+			$list_id++;
+		}
+		
+		// µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ
+		if($arrList[$list_id] == "") {
+			$arrList[$list_id] = "\tlist".$list_id." = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '".$arrClassCatName[$classcat_id2]."'";
+		} else {
+			$arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
+		}
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ
+		if($arrVal[$list_id] == "") {
+			$arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'";
+		} else {
+			$arrVal[$list_id].= ", '".$classcat_id2."'";
+		}
+	}	
+	
+	$arrList[$list_id].=");\n";
+	$arrVal[$list_id].=");\n";
+		
+	// µ¬³Ê1
+	$objPage->arrClassCat1 = $arrSele;
+	
+	$lists = "\tlists = new Array(";
+	$no = 0;
+	
+	foreach($arrList as $val) {
+		$objPage->tpl_javascript.= $val;
+		if ($no != 0) {
+			$lists.= ",list".$no;
+		} else {
+			$lists.= "list".$no;
+		}
+		$no++;
+	}
+	$objPage->tpl_javascript.=$lists.");\n";
+	
+	$vals = "\tvals = new Array(";
+	$no = 0;
+	
+	foreach($arrVal as $val) {
+		$objPage->tpl_javascript.= $val;
+		if ($no != 0) {
+			$vals.= ",val".$no;
+		} else {
+			$vals.= "val".$no;
+		}
+		$no++;
+	}
+	$objPage->tpl_javascript.=$vals.");\n";
+	
+	// ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID
+	$objPage->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . $_POST['classcategory_id2'] . "');";
+
+	// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+	if($arrProductsClass[0]['classcategory_id1'] != '0') {
+		$classcat_find1 = true;
+	}
+	
+	// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë
+	if($arrProductsClass[0]['classcategory_id2'] != '0') {
+		$classcat_find2 = true;
+	}
+		
+	$objPage->tpl_classcat_find1 = $classcat_find1;
+	$objPage->tpl_classcat_find2 = $classcat_find2;
+	$objPage->tpl_stock_find = $stock_find;
+		
+	return $objPage;
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+
+	$objFormParam->addParam("µ¬³Ê1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("µ¬³Ê2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸Ä¿ô", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+}
+
+/* ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ */
+function lfGetProductsClass($product_id) {
+	$arrRet = array();
+	if(sfIsInt($product_id)) {
+		// ¾¦ÉÊµ¬³Ê¼èÆÀ
+		$objQuery = new SC_Query();
+		$col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
+		$table = "vw_product_class";
+		$where = "product_id = ?";
+		$objQuery->setorder("rank1 DESC, rank2 DESC");
+		$arrRet = $objQuery->select($col, $table, $where, array($product_id));
+	}
+	return $arrRet;
+}
+
+/* ÅÐÏ¿ºÑ¤ß¥ª¥¹¥¹¥á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß */
+function lfPreGetRecommendProducts($product_id) {
+	$objQuery = new SC_Query();
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
+	$max = count($arrRet);
+	$no = 0;
+	for($i = 0; $i < $max; $i++) {
+		$where = "delete = 0 AND product_id = ? AND status = 1";
+		$arrProductInfo = $objQuery->select("main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate", "vw_products_allclass", $where, array($arrRet[$i]['recommend_product_id'])); 
+				
+		if(count($arrProductInfo) > 0) {
+			$arrRecommend[$no] = $arrProductInfo[0];
+			$arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
+			$arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
+			$no++;
+		}	
+	}
+	return $arrRecommend;
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	global $objPage;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+		
+	// Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯
+	if ($objPage->tpl_classcat_find1) {
+		$objErr->doFunc(array("µ¬³Ê1", "classcategory_id1"), array("EXIST_CHECK"));
+	}
+	if ($objPage->tpl_classcat_find2) {
+		$objErr->doFunc(array("µ¬³Ê2", "classcategory_id2"), array("EXIST_CHECK"));
+	}
+			
+	return $objErr->arrErr;
+}
+
+//±ÜÍ÷ÍúÎò¿·µ¬ÅÐÏ¿
+function lfRegistReadingData($tmp_id, $customer_id){
+	$objQuery = new SC_Query;
+	$sqlval['customer_id'] = $customer_id;
+	$sqlval['reading_product_id'] = $tmp_id;
+	$sqlval['create_date'] = 'NOW()';
+	$objQuery->insert("dtb_customer_reading", $sqlval);
+}
+
+//¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹
+function lfGetRelateProducts($tmp_id) {
+	$objQuery = new SC_Query;
+	//¼«Æ°Ãê½Ð
+	$objQuery->setorder("random()");
+	//É½¼¨·ï¿ô¤ÎÀ©¸Â
+	$objQuery->setlimit(RELATED_PRODUCTS_MAX);
+	//¸¡º÷¾ò·ï
+	$col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate";
+	$from = "vw_products_allclass AS V ";
+	$where = "delete = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? ";
+	$arrval[] = $tmp_id;
+	//·ë²Ì¤Î¼èÆÀ
+	$arrProducts = $objQuery->select($col, $from, $where, $arrval);
+	
+	return $arrProducts;
+}
+
+//¾¦ÉÊ¤´¤È¤Î¥ì¥Ó¥å¡¼¾ðÊó¤ò¼èÆÀ¤¹¤ë
+function lfGetReviewData($id) {
+	$objQuery = new SC_Query;
+	//¾¦ÉÊ¤´¤È¤Î¥ì¥Ó¥å¡¼¾ðÊó¤ò¼èÆÀ¤¹¤ë
+	$col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment";
+	$from = "dtb_review";
+	$where = "delete = 0 AND status = 1 AND product_id = ? ";
+	$arrval[] = $id;
+	$arrReview = $objQuery->select($col, $from, $where, $arrval);
+	return $arrReview; 
+}
+
+//»ÙÊ§ÊýË¡¤Î¼èÆÀ
+//payment_id	1:¥¯¥ì¥¸¥Ã¥È¡¡2:¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó	
+function lfGetPayment() {
+	$objQuery = new SC_Query;
+	$col = "payment_id, rule, payment_method";
+	$from = "dtb_payment";
+	$where = "delete = 0";
+	$order = "payment_id";
+	$objQuery->setorder($order);
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/top.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/top.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/products/top.php	(revision 1328)
@@ -0,0 +1,20 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/product/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'products/top.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/detail_image.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/detail_image.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/products/detail_image.php	(revision 1328)
@@ -0,0 +1,51 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'products/detail_image.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ´ÉÍý¥Ú¡¼¥¸¤«¤é¤Î³ÎÇ§¤Î¾ì¹ç¤Ï¡¢Èó¸ø³«¤Î¾¦ÉÊ¤âÉ½¼¨¤¹¤ë¡£
+if($_GET['admin'] == 'on') {
+	$where = "delete = 0";
+} else {
+	$where = "delete = 0 AND status = 1";
+}
+
+// ÃÍ¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯
+if(!sfIsInt($_GET['product_id']) || !sfIsRecord("dtb_products", "product_id", $_GET['product_id'], $where)) {
+	sfDispSiteError(PRODUCT_NOT_FOUND);
+}
+
+
+$image_key = $_GET['image'];
+
+$objQuery = new SC_Query();
+$col = "name, $image_key";
+$arrRet = $objQuery->select($col, "dtb_products", "product_id = ?", array($_GET['product_id']));
+
+if (sfIsInt($_GET['width']) && sfIsInt($_GET['height'])) {
+	$objPage->tpl_width = $_GET['width'];
+	$objPage->tpl_height = $_GET['height']; 	
+} else {
+	$objPage->tpl_width = LARGE_IMAGE_WIDTH;
+	$objPage->tpl_height = LARGE_IMAGE_HEIGHT;
+}
+
+$objPage->tpl_table_width = $objPage->tpl_width + 20;
+$objPage->tpl_table_height = $objPage->tpl_height + 20;
+
+$objPage->tpl_image = $arrRet[0][$image_key];
+$objPage->tpl_name = $arrRet[0]['name'];
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/format.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/format.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/products/format.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/product/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'products/top.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+
+
+
+
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/userdata.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/userdata.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/products/userdata.php	(revision 1328)
@@ -0,0 +1,13 @@
+<?php
+
+/*¡¡¾¦ÉÊ¾ÜºÙ¥Ú¡¼¥¸¤ÎHTML³«ÊüÉôÊ¬¥Æ¥ó¥×¥ì¡¼¥ÈÉ½¼¨ÍÑ¥Õ¥¡¥¤¥ë */
+
+$objUserView = new SC_UserView(TEMPLATE_FTP_DIR, COMPILE_FTP_DIR);
+//HTML³«ÊüÍÑ¤Î¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÌ¾
+$tpl_name = "products_detail_share.tpl";
+//¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+if(file_exists(TEMPLATE_FTP_DIR . $tpl_name)) {
+	$objUserView->display($tpl_name);
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/products/review_complete.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/products/review_complete.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/products/review_complete.php	(revision 1328)
@@ -0,0 +1,16 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/review_complete.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);					
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/user_data/templates/default1/contents.css
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/user_data/templates/default1/contents.css	(revision 4425)
+++ /temp/tags/eccube-0_9_2beta/html/user_data/templates/default1/contents.css	(revision 4425)
@@ -0,0 +1,72 @@
+@charset "euc-jp";
+
+/*FORM*/
+.box3 { width: 33px; }	/*W3*/
+.box6 { width: 54px; }	/*W6*/
+.box10 { width: 82px; }	/*W10*/
+.box12 { width: 96px; }	/*W12*/
+.box18 { width: 138px; }	/*W18*/
+.box19 { width: 145px; }	/*W19*/
+.box20 { width: 152px; }	/*W20*/
+.box30 { width: 222px; }	/*W30*/
+.box33 { width: 243px; }	/*W30*/
+.box40 { width: 292px; }	/*W40*/
+.box47 { width: 341px; }	/*W47*/
+.area40 { width: 302px; height: 134px; }	/*W40¡ßH8*/
+.area45 { width: 337px; height: 290px; }	/*W40¡ßH20*/
+.area46 { width: 337px; height: 134px; }	/*W40¡ßH8*/
+.area50 { width: 372px; height: 290px; }	/*W50¡ßH20*/
+.area55 { width: 407px; height: 290px; }	/*W55¡ßH20*/
+.area65 { width: 444px; height: 290px; }	/*W65¡ßH20*/
+.area68 { width: 498px; height: 134px; }	/*W68¡ßH8*/
+.area80 { width: 572px; height: 134px; }	/*W80¡ßH8*/
+.area80_2 { width: 572px; height: 420px; }	/*W80¡ßH30*/
+.area92 { width: 666px; height: 160px; }	/*W92¡ßH10*/
+.area96 { width: 694px; height: 420px; }	/*W80¡ßH30*/
+.area96_2 { width: 694px; height: 160px; }	/*W80¡ßH10*/
+
+/*LINK*/
+a:link { color: #3a75af; text-decoration: underline; }
+a:visited { color: #3a75af; text-decoration: underline; }
+a:hover { color: #3a75af; text-decoration: none; }
+
+/*OVER*/
+a.over:link{ color:#4a6fa6; text-decoration: none; }
+a.over:visited { color:#4a6fa6; text-decoration: none; }
+a.over:hover { color:#4a6fa6; text-decoration: underline; }
+
+/*COLOR*/
+.white { color: #ffffff; }
+.whitest { color: #ffffff; font-weight: bold; }
+.red { color: #ec0000; }
+.redst { color: #ec0000; font-weight: bold; }
+.blue { color: #3a75af; }
+.bluest { color: #3a75af; font-weight: bold; }
+.black { color: #000000; }
+.blackst { color: #000000; font-weight: bold; }
+.orange { color: #ff6600; }
+.orangest { color: #ff6600; font-weight: bold; }
+
+/*PHOTO*/
+.picture { 
+	border-width: 1px;
+	border-style: solid;
+	border-color: #cccccc;
+}
+
+/*PHOTO*/
+img { 
+	border: 0px;
+}
+
+
+#container #right #contents #right #price{
+border-width: 1px;
+border-style: solid;
+border-color: #ccc;
+padding: 0;
+margin: 0;
+padding: 0;
+width: 295px;
+background: #ecf5ff;
+}
Index: /temp/tags/eccube-0_9_2beta/html/faq/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/faq/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/faq/index.php	(revision 1328)
@@ -0,0 +1,21 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/faq/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'faq/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'faq';				
+		$this->tpl_title = '¤è¤¯¤¢¤ë¼ÁÌä';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/fax/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/fax/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/fax/index.php	(revision 1328)
@@ -0,0 +1,21 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/fax/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'fax/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'fax';				
+		$this->tpl_title = 'FAXÃíÊ¸¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/info.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/info.php	(revision 3607)
+++ /temp/tags/eccube-0_9_2beta/html/info.php	(revision 3607)
@@ -0,0 +1,3 @@
+<?php
+	phpinfo();
+?>
Index: /temp/tags/eccube-0_9_2beta/html/preview/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/preview/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/preview/index.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSess = new SC_Session();
+
+if ($_SESSION['preview'] === "ON") {
+	// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+	$objPage = sfGetPageLayout($objPage, true);
+	
+	// ²èÌÌ¤ÎÉ½¼¨
+	$objView->assignobj($objPage);
+	$objView->display(SITE_FRAME);
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/index.php	(revision 3346)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/index.php	(revision 3346)
@@ -0,0 +1,77 @@
+<?php
+//¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¾¦ÉÊ¸¡º÷¤ò¼Â¹Ô¤¹¤ë¡£¡ÊEC¥­¥Ã¥ÈÆ°ºî»î¸³ÍÑ¤Î³«È¯¡Ë
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/index.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/¹ØÆþÍúÎò°ìÍ÷';
+		$this->tpl_navi = ROOT_DIR . USER_DIR . 'templates/mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'index';
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();			
+$objQuery = new SC_Query();             
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if(!isset($_SESSION['customer'])) {
+	sfDispSiteError(CUSTOMER_ERROR);
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+//¥Ú¡¼¥¸Á÷¤êÍÑ
+$objPage->tpl_pageno = $_POST['pageno'];
+	
+$col = "order_id, create_date, payment_id, payment_total";
+$from = "dtb_order";
+$where = "delete = 0 AND customer_id=?";
+$arrval = array($objCustomer->getvalue('customer_id'));
+$order = "order_id DESC";
+
+$linemax = $objQuery->count($from, $where, $arrval);
+$objPage->tpl_linemax = $linemax;
+
+// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
+$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+$startno = $objNavi->start_row;
+
+// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+// É½¼¨½ç½ø
+$objQuery->setorder($order);
+
+//¹ØÆþÍúÎò¤Î¼èÆÀ
+$objPage->arrOrder = $objQuery->select($col, $from, $where, $arrval);
+
+// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+
+$objView->assignobj($objPage);				//$objpageÆâ¤ÎÁ´¤Æ¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤òsmarty¤Ë³ÊÇ¼
+$objView->display(SITE_FRAME);				//¥Ñ¥¹¤È¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤Î¸Æ¤Ó½Ð¤·¡¢¼Â¹Ô
+
+
+//-------------------------------------------------------------------------------------------------------------------------
+											
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+			$objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","EMAIL_CHECK","MAX_LENGTH_CHECK"));
+			$objErr->dofunc(array("¥Ñ¥¹¥ï¡¼¥É", "login_password", PASSWORD_LEN2), array("EXIST_CHECK","ALNUM_CHECK"));
+	return $objErr->arrErr;
+}
+				
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/login.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/login.php	(revision 3346)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/login.php	(revision 3346)
@@ -0,0 +1,57 @@
+<?php
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/login.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸(¥í¥°¥¤¥ó)';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+
+//SSLURLÈ½Äê
+if (SSLURL_CHECK == 1){
+	$ssl_url= sfRmDupSlash(SSL_URL.$_SERVER['REQUEST_URI']);
+	if (!ereg("^https://", $non_ssl_url)){
+		sfDispSiteError(URL_ERROR);
+	}
+}
+
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	header("location: ./index.php");
+} else {
+	// ¥¯¥Ã¥­¡¼È½Äê
+	$objPage->tpl_login_email = $objCookie->getCookie('login_email');
+		if($objPage->tpl_login_email != "") {
+		$objPage->tpl_login_memory = "1";
+	}
+	
+	// POST¤µ¤ì¤Æ¤­¤¿ID¤¬¤¢¤ë¾ì¹ç¤ÏÍ¥Àè¤¹¤ë¡£
+	if($_POST['mypage_login_email'] != "") {
+		$objPage->tpl_login_email = $_POST['mypage_login_email'];
+	}
+}
+
+$objView->assignobj($objPage);				//$objpageÆâ¤ÎÁ´¤Æ¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤òsmarty¤Ë³ÊÇ¼
+$objView->display(SITE_FRAME);				//¥Ñ¥¹¤È¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤Î¸Æ¤Ó½Ð¤·¡¢¼Â¹Ô
+
+//-------------------------------------------------------------------------------------------------------------------------
+											
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+			$objErr->doFunc(array("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","EMAIL_CHECK","MAX_LENGTH_CHECK"));
+			$objErr->dofunc(array("¥Ñ¥¹¥ï¡¼¥É", "login_password", PASSWORD_LEN2), array("EXIST_CHECK","ALNUM_CHECK"));
+	return $objErr->arrErr;
+}									
+											
+?> 
Index: /temp/tags/eccube-0_9_2beta/html/mypage/refusal_complete.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/refusal_complete.php	(revision 3346)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/refusal_complete.php	(revision 3346)
@@ -0,0 +1,30 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/refusal_complete.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(´°Î»¥Ú¡¼¥¸)";
+		$this->tpl_navi = ROOT_DIR . USER_DIR . 'templates/mypage/navi.tpl';
+		$this->tpl_mypageno = 'refusal';
+		$this->point_disp = false;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$objCustomer = new SC_Customer();
+//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+$objPage->CustomerPoint = $objCustomer->getvalue('point');
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/change_complete.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/change_complete.php	(revision 3346)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/change_complete.php	(revision 3346)
@@ -0,0 +1,34 @@
+<?php
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/change_complete.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(´°Î»¥Ú¡¼¥¸)';
+		$this->tpl_navi = ROOT_DIR . USER_DIR . 'templates/mypage/navi.tpl';
+		$this->tpl_mypageno = 'change';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/delivery_addr.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/delivery_addr.php	(revision 3335)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/delivery_addr.php	(revision 3335)
@@ -0,0 +1,161 @@
+<?php
+
+require_once("../require.php");
+
+session_start();
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/delivery_addr.tpl';
+		$this->tpl_title = "¿·¤·¤¤¤ªÆÏ¤±Àè¤ÎÄÉ²Ã¥ÊÑ¹¹";
+		global $arrPref;
+		$this->arrPref = $arrPref;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+$objConn = new SC_DBConn();
+$ParentPage = MYPAGE_DELIVADDR_URL;
+
+// GET¤Ç¥Ú¡¼¥¸¤ò»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï»ØÄê¥Ú¡¼¥¸¤ËÌá¤¹
+if (isset($_GET['page'])) {
+	$ParentPage = $_GET['page'];
+}
+$objPage->ParentPage = $ParentPage;
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+if ($_POST['mode'] == ""){
+	$_SESSION['other_deliv_id'] = $_GET['other_deliv_id'];
+}
+
+if ($_GET['other_deliv_id'] != ""){
+	//ÉÔÀµ¥¢¥¯¥»¥¹È½Äê
+	$flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id']));
+	if (!$objCustomer->isLoginSuccess() || $flag == 0){
+		sfDispSiteError(CUSTOMER_ERROR);
+	}
+}
+
+//ÊÌ¤Î¤ªÆÏ¤±Àè£Ä£ÂÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "name01",		"convert" => "aKV" ),
+							 array(  "column" => "name02",		"convert" => "aKV" ),
+							 array(  "column" => "kana01",		"convert" => "CKV" ),
+							 array(  "column" => "kana02",		"convert" => "CKV" ),
+							 array(  "column" => "zip01",		"convert" => "n" ),
+							 array(  "column" => "zip02",		"convert" => "n" ),
+							 array(  "column" => "pref",		"convert" => "n" ),
+							 array(  "column" => "addr01",		"convert" => "aKV" ),
+							 array(  "column" => "addr02",		"convert" => "aKV" ),
+							 array(  "column" => "tel01",		"convert" => "n" ),
+							 array(  "column" => "tel02",		"convert" => "n" ),
+							 array(  "column" => "tel03",		"convert" => "n" ),
+						);
+
+switch ($_POST['mode']){
+	case 'edit':
+		$_POST = lfConvertParam($_POST,$arrRegistColumn);
+		$objPage->arrErr =lfErrorCheck($_POST);
+		if ($objPage->arrErr){
+			foreach ($_POST as $key => $val){
+				$objPage->$key = $val;
+			}
+		}else{
+			//ÊÌ¤Î¤ªÆÏ¤±ÀèÅÐÏ¿¿ô¤Î¼èÆÀ
+			$deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id')));
+			if ($deliv_count < DELIV_ADDR_MAX){
+				lfRegistData($_POST,$arrRegistColumn);
+			}
+			$objPage->tpl_onload = "fnUpdateParent('".$_POST['ParentPage']."'); window.close();";
+		}
+		break;
+}
+
+if ($_GET['other_deliv_id'] != ""){
+	//ÊÌ¤Î¤ªÆÏ¤±Àè¾ðÊó¼èÆÀ
+	$arrOtherDeliv = $objQuery->select("*", "dtb_other_deliv", "other_deliv_id=? ", array($_SESSION['other_deliv_id']));
+	$objPage->arrOtherDeliv = $arrOtherDeliv[0];
+}
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+//-------------------------------------------------------------------------------------------------------------
+
+/* ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÀ«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÌ¾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê¡Ê1¡Ë", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê¡Ê2¡Ë", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
+	return $objErr->arrErr;
+	
+}
+
+/* ÅÐÏ¿¼Â¹Ô */
+function lfRegistData($array, $arrRegistColumn) {
+	global $objConn;
+	global $objCustomer;
+	
+	foreach ($arrRegistColumn as $data) {
+		if (strlen($array[ $data["column"] ]) > 0) {
+			$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+		}
+	}
+	
+	$arrRegist['customer_id'] = $objCustomer->getvalue('customer_id');
+	
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+	if ($array['other_deliv_id'] != ""){
+	$objConn->autoExecute("dtb_other_deliv", $arrRegist, "other_deliv_id='" .addslashes($array["other_deliv_id"]). "'");
+	}else{
+	$objConn->autoExecute("dtb_other_deliv", $arrRegist);
+	}
+	$objConn->query("COMMIT");
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/history.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/history.php	(revision 3346)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/history.php	(revision 3346)
@@ -0,0 +1,82 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/history.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/¹ØÆþÍúÎò¾ÜºÙ";
+		$this->tpl_navi = ROOT_DIR . USER_DIR . 'templates/mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'index';
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//ÉÔÀµ¥¢¥¯¥»¥¹È½Äê
+$from = "dtb_order";
+$where = "delete = 0 AND customer_id = ? AND order_id = ? ";
+$arrval = array($objCustomer->getValue('customer_id'), $_POST['order_id']);
+//DB¤Ë¾ðÊó¤¬¤¢¤ë¤«È½Äê
+$cnt = $objQuery->count($from, $where, $arrval);
+//¥í¥°¥¤¥ó¤·¤Æ¤¤¤Ê¤¤¡¢¤Þ¤¿¤ÏDB¤Ë¾ðÊó¤¬Ìµ¤¤¾ì¹ç
+if (!$objCustomer->isLoginSuccess() || $cnt == 0){
+	sfDispSiteError(CUSTOMER_ERROR);
+} else {
+	//¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+	$objPage->arrDisp = lfGetOrderData($_POST['order_id']);
+	// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+	$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+	// ÇÛÁ÷»þ´Ö¤Î¼èÆÀ
+	$arrRet = sfGetDelivTime($objPage->arrDisp['payment_id']);
+	$objPage->arrDelivTime = sfArrKeyValue($arrRet, 'time_id', 'time');
+
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+//¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+function lfGetOrderData($order_id) {
+	//¼õÃíÈÖ¹æ¤¬¿ô»ú¤Ç¤¢¤ì¤Ð
+	if(sfIsInt($order_id)) {
+		// DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
+		$objQuery = new SC_Query();
+		$col = "order_id, create_date, payment_id, subtotal, tax, use_point, add_point, discount, ";
+		$col .= "deliv_fee, charge, payment_total, deliv_name01, deliv_name02, deliv_kana01, deliv_kana02, ";
+		$col .= "deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_time_id, deliv_date ";
+		$from = "dtb_order";
+		$where = "order_id = ?";
+		$arrRet = $objQuery->select($col, $from, $where, array($order_id));
+		$arrOrder = $arrRet[0];
+		// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+		$arrRet = lfGetOrderDetail($order_id);
+		$arrOrderDetail = sfSwapArray($arrRet);
+		$arrData = array_merge($arrOrder, $arrOrderDetail);
+	}
+	return $arrData;
+}
+
+// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+function lfGetOrderDetail($order_id) {
+	$objQuery = new SC_Query();
+	$col = "product_id, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
+	$where = "order_id = ?";
+	$objQuery->setorder("classcategory_id1, classcategory_id2");
+	$arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
+	return $arrRet;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/refusal.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/refusal.php	(revision 3346)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/refusal.php	(revision 3346)
@@ -0,0 +1,55 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/refusal.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(ÆþÎÏ¥Ú¡¼¥¸)";
+		$this->tpl_navi = ROOT_DIR . USER_DIR . 'templates/mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'refusal';
+		//session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+$objQuery = new SC_Query();
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+switch ($_POST['mode']){
+	case 'confirm':
+	$objPage->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/refusal_confirm.tpl';
+	$objPage->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(³ÎÇ§¥Ú¡¼¥¸)";
+
+	break;
+	
+	case 'complete':
+	//²ñ°÷ºï½ü
+	$objQuery->exec("UPDATE dtb_customer SET delete=1 WHERE customer_id=?", array($objCustomer->getValue('customer_id')));
+	$objQuery->delete("dtb_customer_mail", "email ILIKE ?", array($objCustomer->getValue('email')));
+	$objCustomer->EndSession();
+	//´°Î»¥Ú¡¼¥¸¤Ø
+	header("Location: ./refusal_complete.php");
+	exit;
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/delivery.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/delivery.php	(revision 3346)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/delivery.php	(revision 3346)
@@ -0,0 +1,76 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/delivery.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/¤ªÆÏ¤±ÀèÄÉ²Ã¥ÊÑ¹¹";
+		$this->tpl_navi = ROOT_DIR . USER_DIR . 'templates/mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'delivery';
+		global $arrPref;
+		$this->arrPref= $arrPref;
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+$objQuery = new SC_Query();
+$objConn = new SC_DBConn();
+
+//¥í¥°¥¤¥óÈ½Äê
+if(!$objCustomer->isLoginSuccess()) {
+	sfDispSiteError(CUSTOMER_ERROR);
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//ºï½ü
+if($_POST['mode'] == 'delete') {
+	//ÉÔÀµ¥¢¥¯¥»¥¹È½Äê
+	$flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id']));
+	if($flag > 0) {
+		//ºï½ü
+		$objQuery->delete("dtb_other_deliv", "other_deliv_id=?", array($_POST['other_deliv_id']));
+	} else {
+		sfDispSiteError(CUSTOMER_ERROR);
+	}
+}
+
+$objPage->tpl_pageno = $_POST['pageno'];
+
+$from = "dtb_other_deliv";
+$where = "customer_id=?";
+$arrval = array($objCustomer->getValue('customer_id'));
+$order = "other_deliv_id DESC";
+
+//¤ªÆÏ¤±ÀèÅÐÏ¿·ï¿ô¼èÆÀ
+$linemax = $objQuery->count($from, $where, $arrval);
+
+$objPage->tpl_linemax = $linemax;
+
+// É½¼¨½ç½ø
+$objQuery->setorder($order);
+
+//ÊÌ¤Î¤ªÆÏ¤±Àè¾ðÊóÉ½¼¨
+$objPage->arrOtherDeliv = $objQuery->select("*", $from, $where, $arrval);
+
+//¤ªÆÏ¤±ÀèÅÐÏ¿¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤ËÅÏ¤¹
+$objPge->deliv_cnt = count($objPage->arrOtherDeliv);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/change.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/change.php	(revision 3531)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/change.php	(revision 3531)
@@ -0,0 +1,339 @@
+<?php
+//¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¾¦ÉÊ¸¡º÷¤ò¼Â¹Ô¤¹¤ë¡£¡ÊEC¥­¥Ã¥ÈÆ°ºî»î¸³ÍÑ¤Î³«È¯¡Ë
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/change.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(ÆþÎÏ¥Ú¡¼¥¸)';
+		$this->tpl_navi = ROOT_DIR . USER_DIR . 'templates/mypage/navi.tpl';
+		$this->tpl_mainno = 'mypage';
+		$this->tpl_mypageno = 'change';
+		global $arrReminder;
+		global $arrPref;
+		global $arrJob;
+		global $arrMAILMAGATYPE;
+		global $arrSex;
+		$this->arrReminder = $arrReminder;
+		$this->arrPref = $arrPref;
+		$this->arrJob = $arrJob;
+		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
+		$this->arrSex = $arrSex;
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();				
+$objView = new SC_SiteView();			
+$objQuery = new SC_Query();             
+$objCustomer = new SC_Customer();
+$objFormParam = new SC_FormParam();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objDate = new SC_Date(1901);
+$objPage->arrYear = $objDate->getYear();	
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR); 
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+	$objPage->CustomerPoint = $objCustomer->getvalue('point');
+}
+
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "name01",		"convert" => "aKV" ),
+							 array(  "column" => "name02",		"convert" => "aKV" ),
+							 array(  "column" => "kana01",		"convert" => "CKV" ),
+							 array(  "column" => "kana02",		"convert" => "CKV" ),
+							 array(  "column" => "zip01",		"convert" => "n" ),
+							 array(  "column" => "zip02",		"convert" => "n" ),
+							 array(  "column" => "pref",		"convert" => "n" ),
+							 array(  "column" => "addr01",		"convert" => "aKV" ),
+							 array(  "column" => "addr02",		"convert" => "aKV" ),
+							 array(  "column" => "email",		"convert" => "a" ),
+							 array(  "column" => "tel01",		"convert" => "n" ),
+							 array(  "column" => "tel02",		"convert" => "n" ),
+							 array(  "column" => "tel03",		"convert" => "n" ),
+							 array(  "column" => "fax01",		"convert" => "n" ),
+							 array(  "column" => "fax02",		"convert" => "n" ),
+							 array(  "column" => "fax03",		"convert" => "n" ),
+							 array(  "column" => "sex",			"convert" => "n" ),
+							 array(  "column" => "job",			"convert" => "n" ),
+							 array(  "column" => "birth",		"convert" => "n" ),
+							 array(  "column" => "password",	"convert" => "an" ),
+							 array(  "column" => "reminder",	"convert" => "n" ),
+							 array(  "column" => "reminder_answer", "convert" => "aKV" ),
+						);
+
+
+switch ($_POST['mode']){
+	
+case 'confirm':
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+	$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+
+	/* ÃÂÀ¸Æü¤ÎÊÑ¹¹¤Ï²ÄÇ½¤Ë¤¹¤ë
+	//ÃÂÀ¸ÆüÉÔÀµÊÑ¹¹¤Î¥Á¥§¥Ã¥¯
+	$arrCustomer = lfGetCustomerData();
+	if ($arrCustomer['birth'] != "" && ($objPage->arrForm['year'] != $arrCustomer['year'] || $objPage->arrForm['month'] != $arrCustomer['month'] || $objPage->arrForm['day'] != $arrCustomer['day'])){
+		sfDispSiteError(CUSTOMER_ERROR);
+	}else{
+	*/
+		//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+		$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+		$email_flag = true;
+		//¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÊÑ¹¹¤·¤Æ¤¤¤ë¾ì¹ç¡¢¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î½ÅÊ£¥Á¥§¥Ã¥¯
+		if ($objPage->arrForm['email'] != $objCustomer->getValue('email')){
+			$email_cnt = $objQuery->count("dtb_customer","delete=0 AND email=?", array($objPage->arrForm['email']));
+			if ($email_cnt > 0){
+				$email_flag = false;
+			}
+		}
+		//¥¨¥é¡¼¤Ê¤·¤Ç¤«¤Ä¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬½ÅÊ£¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if ($objPage->arrErr == "" && $email_flag == true){
+			//³ÎÇ§¥Ú¡¼¥¸¤Ø
+			$objPage->tpl_mainpage = ROOT_DIR . USER_DIR . 'templates/mypage/change_confirm.tpl';
+			$objPage->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(³ÎÇ§¥Ú¡¼¥¸)';
+			$passlen = strlen($objPage->arrForm['password']);
+			$objPage->passlen = lfPassLen($passlen);
+		} else {
+			lfFormReturn($objPage->arrForm,$objPage);
+			if ($email_flag == false){
+				$objPage->arrErr['email'].="´û¤Ë»ÈÍÑ¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£";
+			}
+		}
+	//}
+	break;
+	
+case 'return':
+	$objPage->arrForm = $_POST;
+	lfFormReturn($objPage->arrForm,$objPage);
+	break;
+	
+case 'complete':
+
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$arrForm = lfConvertParam($_POST, $arrRegistColumn);
+	$arrForm['email'] = strtolower($arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	
+	/* ÃÂÀ¸Æü¤ÎÊÑ¹¹¤Ï²ÄÇ½¤Ë¤¹¤ë
+	//ÃÂÀ¸ÆüÉÔÀµÊÑ¹¹¤Î¥Á¥§¥Ã¥¯
+	$arrCustomer = lfGetCustomerData();
+	if ($arrCustomer['birth'] != "" && ($arrForm['year'] !=  $arrCustomer['year'] || $arrForm['month'] != $arrCustomer['month'] || $arrForm['day'] != $arrCustomer['day'])){
+		sfDispSiteError(CUSTOMER_ERROR);
+	} else {*/
+	
+		//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+		$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+		$email_flag = true;
+		if($objPage->arrForm['email'] != $objCustomer->getValue('email')) {
+			//¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î½ÅÊ£¥Á¥§¥Ã¥¯
+			$email_cnt = $objQuery->count("dtb_customer","delete=0 AND email=?", array($objPage->arrForm['email']));
+			if ($email_cnt > 0){
+				$email_flag = false;
+			}
+		}
+		//¥¨¥é¡¼¤Ê¤·¤Ç¤«¤Ä¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬½ÅÊ£¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if($objPage->arrErr == "" && $email_flag) {
+			$arrForm['customer_id'] = $objCustomer->getValue('customer_id');
+			//-- ÊÔ½¸ÅÐÏ¿
+			sfEditCustomerData($arrForm, $arrRegistColumn);
+			//¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾õÂÖ¤Ë¹¹¿·¤¹¤ë
+			$objCustomer->updateSession();
+			//´°Î»¥Ú¡¼¥¸¤Ø
+			header("Location: ./change_complete.php");
+			exit;
+		} else {
+			sfDispSiteError(CUSTOMER_ERROR);
+		}
+	//}
+	break;
+	
+default:
+	//¸ÜµÒ¾ðÊó¼èÆÀ
+	$objPage->arrForm = lfGetCustomerData();
+	$objPage->arrForm['password'] = DEFAULT_PASSWORD;
+	$objPage->arrForm['password02'] = DEFAULT_PASSWORD;
+	break;
+}
+
+//ÃÂÀ¸Æü¥Ç¡¼¥¿ÅÐÏ¿¤ÎÍ­Ìµ
+$arrCustomer = lfGetCustomerData();
+if ($arrCustomer['birth'] != ""){	
+	$objPage->birth_check = true;
+}
+
+$objView->assignobj($objPage);				//$objpageÆâ¤ÎÁ´¤Æ¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤òsmarty¤Ë³ÊÇ¼
+$objView->display(SITE_FRAME);				//¥Ñ¥¹¤È¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤Î¸Æ¤Ó½Ð¤·¡¢¼Â¹Ô
+
+//-------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¤ªÌ¾Á°(À«)", "name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°(Ì¾)", "name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê(¥»¥¤)", "kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê(¥á¥¤)", "kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¤´½»½ê1", "addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤´½»½ê2", "addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÅÅÏÃÈÖ¹æ1", "tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¤ªÅÅÏÃÈÖ¹æ2", "tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¤ªÅÅÏÃÈÖ¹æ3", "tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+}
+											
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+function lfErrorCheck($array) {
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "NO_SPTAB" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email02", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK","NO_SPTAB" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email", "email02") ,array("EQUAL_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ", "fax01", "fax02", "fax03", TEL_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("¤´À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¤´¿¦¶È", "job") ,array("NUM_CHECK"));
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É(³ÎÇ§)", 'password02', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", '¥Ñ¥¹¥ï¡¼¥É(³ÎÇ§)', 'password', 'password02'), array("EQUAL_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¼ÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤ÎÅú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag") ,array("SELECT_CHECK", "NUM_CHECK"));
+	return $objErr->arrErr;
+	
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//¸ÜµÒ¾ðÊó¤Î¼èÆÀ
+function lfGetCustomerData(){
+	global $objQuery;
+	global $objCustomer;
+	//¸ÜµÒ¾ðÊó¼èÆÀ
+	$ret = $objQuery->select("*","dtb_customer","customer_id=?", array($objCustomer->getValue('customer_id')));
+	$arrForm = $ret[0];
+
+	//¥á¥ë¥Þ¥¬¥Õ¥é¥°¼èÆÀ
+	$arrForm['mail_flag'] = $objQuery->get("dtb_customer_mail","mail_flag","email=?", array($objCustomer->getValue('email')));
+	
+	//ÃÂÀ¸Æü¤ÎÇ¯·îÆü¼èÆÀ
+	if (isset($arrForm['birth'])){
+		$arrDate = sfDispDBDate($arrForm['birth'],false);
+		list($year, $month, $day) = split("/", $arrDate);
+		
+		$arrForm['year'] = $year;
+		$arrForm['month'] = $month;
+		$arrForm['day'] = $day;
+	}
+	return $arrForm;
+}
+	
+// ÊÔ½¸ÅÐÏ¿
+function lfRegistData($array, $arrRegistColumn) {
+	global $objQuery;
+	global $objCustomer;
+	
+	foreach ($arrRegistColumn as $data) {
+		if ($data["column"] != "password") {
+			if($array[ $data['column'] ] == "") {
+				$arrRegist[ $data['column'] ] = NULL;
+			} else {
+				$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+			}
+		}
+	}
+	if (strlen($array["year"]) > 0 && strlen($array["month"]) > 0 && strlen($array["day"]) > 0) {
+		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+	} else {
+		$arrRegist["birth"] = NULL;
+	}
+
+	//-- ¥Ñ¥¹¥ï¡¼¥É¤Î¹¹¿·¤¬¤¢¤ë¾ì¹ç¤Ï°Å¹æ²½¡£¡Ê¹¹¿·¤¬¤Ê¤¤¾ì¹ç¤ÏUPDATEÊ¸¤ò¹½À®¤·¤Ê¤¤¡Ë
+	if ($array["password"] != DEFAULT_PASSWORD) $arrRegist["password"] = crypt($array["password"]);
+	$arrRegist["update_date"] = "NOW()";
+	
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($objCustomer->getValue('customer_id')));
+	$objQuery->commit();
+}
+
+//³ÎÇ§¥Ú¡¼¥¸ÍÑ¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨ÍÑ
+
+function lfPassLen($passlen){
+	$ret = "";
+	for ($i=0;$i<$passlen;true){
+	$ret.="*";
+	$i++;
+	}
+	return $ret;
+}
+
+//¥¨¥é¡¼¡¢Ìá¤ë»þ¤Ë¥Õ¥©¡¼¥à¤ËÆþÎÏ¾ðÊó¤òÊÖ¤¹
+function lfFormReturn($array,$objPage){
+	foreach($array as $key => $val){
+		switch ($key){
+			case 'password':
+			case 'password02':
+			$objPage->$key = $val;
+			break;
+			default:
+			$array[ $key ] = $val;
+			break;
+		}
+	}
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/mypage/login_check.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/mypage/login_check.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/mypage/login_check.php	(revision 1328)
@@ -0,0 +1,56 @@
+<?php
+
+require_once("../require.php");
+
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'login':
+	$objFormParam->toLower('mypage_login_email');
+	$arrErr = $objFormParam->checkError();
+	$arrForm =  $objFormParam->getHashArray();
+	
+	// ¥¯¥Ã¥­¡¼ÊÝÂ¸È½Äê
+	if ($arrForm['mypage_login_memory'] == "1" && $arrForm['mypage_login_email'] != "") {
+		$objCookie->setCookie('login_email', $_POST['mypage_login_email']);
+	} else {
+		$objCookie->setCookie('login_email', '');
+	}
+	if ($count == 0){
+		if($objCustomer->getCustomerDataFromEmailPass($arrForm['mypage_login_pass'], $arrForm['mypage_login_email'])) {
+			header("Location: ./index.php");
+			exit;
+		} else {
+			$objQuery = new SC_Query;
+			$where = "email = ? AND status = 1 AND delete = 0";
+			$ret = $objQuery->count("dtb_customer", $where, array($arrForm['mypage_login_email']));
+			
+			if($ret > 0) {
+				sfDispSiteError(TEMP_LOGIN_ERROR);
+			} else {
+				sfDispSiteError(SITE_LOGIN_ERROR);
+			}
+		}
+	}
+	
+	break;
+
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("µ­²±¤¹¤ë", "mypage_login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "mypage_login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "mypage_login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/upgrade/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/upgrade/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/upgrade/index.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+
+require_once("../require.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = 'upgrade/index.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+$con = ftp_connect("localhost");
+$res = ftp_login($con, "osuser", "password");
+if($con != false && $res != false) {
+	//¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É
+	if($_POST['filename'] != "") {
+		
+		$download_file = ROOT_DIR . "data/module/upload/" . $_POST['filename'];
+		
+		if(ftp_get($con, $download_file, $_POST['filename'], FTP_BINARY)) {
+			ftp_quit($con);
+			//¥Õ¥¡¥¤¥ë½êÍ­¼ÔÊÑ¹¹
+			echo "¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£";
+			sfPrintR(exec("tar zxvf " . $download_file . " ./", $arrRes));
+		} else
+			echo '¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£';
+		}
+	}
+	
+	//¥Ç¥£¥ì¥¯¥È¥êÆâ¤ÎÁ´¤Æ¤Î¥Õ¥¡¥¤¥ë¤ò¼èÆÀ
+	$arrRet = ftp_nlist($con, ".");
+	$i = 0;
+	//É¬Í×¤Ê¥Õ¥¡¥¤¥ë¾ðÊó¤ò¼èÆÀ
+	foreach($arrRet as $val) {
+		if(!ereg("^\.|^\..", $val)) {
+			$arrFile[$i]['filename'] = $val;
+			$arrFile[$i]['date'] = date("YÇ¯m·îdÆü", ftp_mdtm($con, $val));
+			$arrFile[$i]['filesize'] = number_format(ftp_size($con, $val))."Byte";
+			$i++;
+		}
+	}
+	$objPage->arrFile = $arrFile;
+}
+
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display(SITE_FRAME);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+
+//-------------------------------------------------------------------------------------------------------
+
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/index.php	(revision 3626)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/index.php	(revision 3626)
@@ -0,0 +1,794 @@
+<?php
+require_once("../require.php");
+require_once("./index_sub.php");
+require_once("../batch/daily.php");
+
+require_once("./class/SC_GraphPie.php");
+require_once("./class/SC_GraphLine.php");
+require_once("./class/SC_GraphBar.php");
+
+class LC_Page {
+	var $arrResults;
+	var $keyname;
+	var $tpl_image;
+	var $arrTitle;
+	function LC_Page() {
+		$this->tpl_mainpage = 'total/index.tpl';
+		$this->tpl_subnavi = 'total/subnavi.tpl';
+		$this->tpl_graphsubtitle = 'total/subtitle.tpl';
+		$this->tpl_titleimage = '/img/title/title_sale.jpg';
+		$this->tpl_mainno = 'total';
+		global $arrWDAY;
+		$this->arrWDAY = $arrWDAY;
+		// ¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+		$this->arrTitle[''] = "´ü´ÖÊÌ½¸·×";
+		$this->arrTitle['term'] = "´ü´ÖÊÌ½¸·×";
+		$this->arrTitle['products'] = "¾¦ÉÊÊÌ½¸·×";
+		$this->arrTitle['age'] = "Ç¯ÂåÊÌ½¸·×";
+		$this->arrTitle['job'] = "¿¦¶ÈÊÌ½¸·×";
+		$this->arrTitle['member'] = "²ñ°÷ÊÌ½¸·×";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ÆþÎÏ´ü´Ö¤ò¥»¥Ã¥·¥ç¥ó¤Ëµ­Ï¿¤¹¤ë
+lfSaveDateSession();
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$objFormParam->setParam($_POST);
+$objFormParam->setParam($_GET);
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrHidden[$key] = $val;		
+	}
+}
+
+switch($_POST['mode']) {
+case 'pdf':
+case 'csv':
+case 'search':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	$arrRet = $objFormParam->getHashArray();
+	
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if (count($objPage->arrErr) == 0) {
+		foreach ($arrRet as $key => $val) {
+			if($val == "") {
+				continue;
+			}
+			switch ($key) {
+			case 'search_startyear':
+				$sdate = $_POST['search_startyear'] . "/" . $_POST['search_startmonth'] . "/" . $_POST['search_startday'];
+				break;
+			case 'search_endyear':
+				$edate = $_POST['search_endyear'] . "/" . $_POST['search_endmonth'] . "/" . $_POST['search_endday'];
+				break;
+			case 'search_startyear_m':
+				list($sdate, $edate) = sfTermMonth($_POST['search_startyear_m'], $_POST['search_startmonth_m'], CLOSE_DAY);
+				break;
+			default:
+				break;
+			}
+		}
+
+		if($_POST['type'] != "") {
+			$type = $_POST['type'];
+		}
+				
+		$page = $objFormParam->getValue('page');
+		switch($page) {
+		// ¾¦ÉÊÊÌ½¸·×
+		case 'products':
+			if($type == "") {
+				$type = 'all';
+			}
+			$objPage->tpl_page_type = "total/page_products.tpl";
+			// Ì¤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦
+			lfRealTimeDailyTotal($sdate, $edate);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderProducts($type, $sdate, $edate, $objPage);
+			break;
+		// ¿¦¶ÈÊÌ½¸·×
+		case 'job':
+			if($type == "") {
+				$type = 'all';
+			}
+			$objPage->tpl_page_type = "total/page_job.tpl";
+			// Ì¤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦
+			lfRealTimeDailyTotal($sdate, $edate);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderJob($type, $sdate, $edate, $objPage);
+			break;
+		// ²ñ°÷ÊÌ½¸·×
+		case 'member':
+			if($type == "") {
+				$type = 'all';
+			}
+			$objPage->tpl_page_type = "total/page_member.tpl";
+			// Ì¤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦
+			lfRealTimeDailyTotal($sdate, $edate);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderMember($type, $sdate, $edate, $objPage);
+			break;
+		// Ç¯ÂåÊÌ½¸·×
+		case 'age':
+			if($type == "") {
+				$type = 'all';
+			}
+			$objPage->tpl_page_type = "total/page_age.tpl";
+			// Ì¤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦
+			lfRealTimeDailyTotal($sdate, $edate);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderAge($type, $sdate, $edate, $objPage);
+			break;
+		// ´ü´ÖÊÌ½¸·×
+		default:
+			if($type == "") {
+				$type = 'day';
+			}
+			$objPage->tpl_page_type = "total/page_term.tpl";
+			// Ì¤½¸·×¥Ç¡¼¥¿¤Î½¸·×¤ò¹Ô¤¦
+			lfRealTimeDailyTotal($sdate, $edate);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage = lfGetOrderTerm($type, $sdate, $edate, $objPage);
+			
+			break;
+		}
+
+		if($_POST['mode'] == 'csv') {
+			// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤Î¼èÆÀ
+			list($arrTitleCol, $arrDataCol) = lfGetCSVColum($page, $objPage->keyname);
+			$head = sfGetCSVList($arrTitleCol);
+			$data = lfGetDataColCSV($objPage->arrResults, $arrDataCol);
+			// CSV¤òÁ÷¿®¤¹¤ë¡£
+			sfCSVDownload($head.$data, $page."_".$type);
+			exit;
+		}
+		
+		if($_POST['mode'] == 'pdf') {
+			// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤Î¼èÆÀ
+			list($arrTitleCol, $arrDataCol, $arrColSize, $arrAlign, $title) = lfGetPDFColum($page, $type, $objPage->keyname);
+			$head = sfGetPDFList($arrTitleCol);
+			$data = lfGetDataColPDF($objPage->arrResults, $arrDataCol, 40);
+			// PDF½ÐÎÏÍÑ
+			$graph_name = basename($objPage->tpl_image);
+			lfPDFDownload($graph_name, $head . $data, $arrColSize, $arrAlign, $sdate, $edate, $title);
+			exit;	
+		}	
+	}
+	break;
+default:
+	if(count($_GET) == 0) {
+		/*
+			¥ê¥¢¥ë¥¿¥¤¥à½¸·×¤ËÀÚ¤êÂØ¤¨ by Nakagawa 2006/08/31
+			// 1¥ö·îÊ¬¤Î½¸·×
+			lfStartDailyTotal(31,0);
+		*/
+	}
+	break;
+}
+
+// ÅÐÏ¿¡¦¹¹¿·Æü¸¡º÷ÍÑ
+$objDate = new SC_Date();
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrYear = $objDate->getYear();
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objPage->tpl_subtitle = $objPage->arrTitle[$objFormParam->getValue('page')];
+
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------
+/* PDF½ÐÎÏ */
+function lfPDFDownload($image, $table, $arrColSize, $arrAlign, $sdate, $edate, $title) {
+	
+	$objPdf = new SC_Pdf();
+	$objPdf->setTableColor("CCCCCC", "F0F0F0", "D1DEFE");
+			
+	// ÅÚÂæ¤È¤Ê¤ëPDF¥Õ¥¡¥¤¥ë¤Î»ØÄê
+	$objPdf->setTemplate(PDF_DIR . "total.pdf");
+
+	$disp_sdate = sfDispDBDate($sdate, false);
+	$disp_edate = sfDispDBDate($edate, false);
+				
+	$arrText['title_block'] = $title;
+	$arrText['date_block'] = "$disp_sdate-$disp_edate";
+	$arrImage['graph_block'] = GRAPH_DIR . $image;
+	
+	// Ê¸Ëö¤Î\n¤òºï½ü¤¹¤ë
+	$table = ereg_replace("\n$", "", $table);
+	$arrRet = split("\n", $table);
+	$page_max = intval((count($arrRet) / 35) + 1);
+	
+	for($page = 1; $page <= $page_max; $page++) {
+		if($page > 1) {
+			// 2¥Ú¡¼¥¸°Ê¹ß
+			$start_no = 35 * ($page - 1) + 1;
+		} else {
+			// ³«»Ï¥Ú¡¼¥¸
+			$start_no = 1;			
+		}
+				
+		$arrText['page_block'] = $page . " / " . $page_max;
+		$objPdf->setTextBlock($arrText);
+		$objPdf->setImageBlock($arrImage);
+		// ¥Ö¥í¥Ã¥¯ÃÍ¤ÎÆþÎÏ
+		$objPdf->writeBlock();
+		// ºÇ½ª¥Ú¡¼¥¸¤Î¤ß¡¢¾¦ÉÊÊÌ½¸·×¤Ï¹ç·×¤¬¤Ê¤¤¤Î¤ÇºÇ½ª¹Ô¤Î¿§¤òÊÑ¹¹¤·¤Ê¤¤¡£
+		if($page == $page_max && $_POST['page'] != 'products') {
+			$last_color_flg = true;
+		} else {
+			$last_color_flg = false;
+		}	
+		$objPdf->writeTableCenter($table, 500, $arrColSize, $arrAlign, 35, $start_no, $last_color_flg);
+		$objPdf->closePage();
+	}
+
+	// PDF¤Î½ÐÎÏ
+	$objPdf->output();	
+}
+
+/* ¥»¥Ã¥·¥ç¥ó¤ËÆþÎÏ´ü´Ö¤òµ­Ï¿¤¹¤ë */
+function lfSaveDateSession() {
+	if($_POST['form'] == 1) {
+		$_SESSION['total']['startyear_m'] = $_POST['search_startyear_m'];
+		$_SESSION['total']['startmonth_m'] = $_POST['search_startmonth_m'];
+	}
+	
+	if($_POST['form'] == 2) {
+		$_SESSION['total']['startyear'] = $_POST['search_startyear'];
+		$_SESSION['total']['startmonth'] = $_POST['search_startmonth'];
+		$_SESSION['total']['startday'] = $_POST['search_startday'];
+		$_SESSION['total']['endyear'] = $_POST['search_endyear'];
+		$_SESSION['total']['endmonth'] = $_POST['search_endmonth'];
+		$_SESSION['total']['endday'] = $_POST['search_endday'];
+	}
+}
+
+/* ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Î¼èÆÀ */
+function lfGetDateDefault() {
+	$year = date("Y");
+	$month = date("m");
+	$day = date("d");
+	
+	$list = $_SESSION['total'];
+	
+	// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤Ë³«»Ï·îÅÙ¤¬ÊÝÂ¸¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+	if($_SESSION['total']['startyear_m'] == "") {
+		$list['startyear_m'] = $year;
+		$list['startmonth_m'] = $month;
+	}
+	
+	// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤Ë³«»ÏÆüÉÕ¡¢½ªÎ»ÆüÉÕ¤¬ÊÝÂ¸¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+	if($_SESSION['total']['startyear'] == "" && $_SESSION['total']['endyear'] == "") {
+		$list['startyear'] = $year;
+		$list['startmonth'] = $month;
+		$list['startday'] = $day;
+		$list['endyear'] = $year;
+		$list['endmonth'] = $month;
+		$list['endday'] = $day;
+	}
+	
+	return $list;	
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+		
+	// ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Î¼èÆÀ
+	$arrList = lfGetDateDefault();
+	
+	// ·îÅÙ½¸·×
+	$objFormParam->addParam("·îÅÙ", "search_startyear_m", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startyear_m']);
+	$objFormParam->addParam("·îÅÙ", "search_startmonth_m", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startmonth_m']);
+	// ´ü´Ö½¸·×
+	$objFormParam->addParam("³«»ÏÆü", "search_startyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startyear']);
+	$objFormParam->addParam("³«»ÏÆü", "search_startmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startmonth']);
+	$objFormParam->addParam("³«»ÏÆü", "search_startday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['startday']);
+	$objFormParam->addParam("½ªÎ»Æü", "search_endyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endyear']);
+	$objFormParam->addParam("½ªÎ»Æü", "search_endmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endmonth']);
+	$objFormParam->addParam("½ªÎ»Æü", "search_endday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), $arrList['endday']);
+	
+	// hidden¥Ç¡¼¥¿¤Î¼èÆÀÍÑ
+	$objFormParam->addParam("", "page");
+	$objFormParam->addParam("", "type");
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÆÃ¼ì¹àÌÜ¥Á¥§¥Ã¥¯
+	if($_POST['form'] == 1) {
+		$objErr->doFunc(array("·îÅÙ", "search_startyear_m"), array("ONE_EXIST_CHECK"));
+	}
+	
+	if($_POST['form'] == 2) {
+		$objErr->doFunc(array("´ü´Ö", "search_startyear", "search_endyear"), array("ONE_EXIST_CHECK"));
+	}
+			
+	$objErr->doFunc(array("·îÅÙ", "search_startyear_m", "search_startmonth_m"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM"));
+	return $objErr->arrErr;
+}
+
+/* ÀÞ¤ìÀþ¥°¥é¥Õ¤ÎºîÀ® */
+function lfGetGraphLine($arrResults, $keyname, $type, $xtitle, $ytitle, $sdate, $edate) {
+	
+	$ret_path = "";
+	
+	// ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£
+	if(count($arrResults) > 0) {
+		
+		// ¥°¥é¥Õ¤ÎÀ¸À®
+		$arrList = sfArrKeyValue($arrResults, $keyname, "total");
+
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$pngname = lfGetGraphPng($type);
+		
+		$path = GRAPH_DIR . $pngname;
+		
+		// ¥é¥Ù¥ëÉ½¼¨¥¤¥ó¥¿¡¼¥Ð¥ë¤òµá¤á¤ë
+		$interval = intval(count($arrList) / 20);
+		if($interval < 1) {
+			$interval = 1;
+		}
+		$objGraphPie = new SC_GraphPie();
+		$objGraphLine = new SC_GraphLine();
+		
+		// ÃÍ¤Î¥»¥Ã¥È
+		$objGraphLine->setData($arrList);
+		$objGraphLine->setXLabel(array_keys($arrList));
+		
+		// ¥é¥Ù¥ë²óÅ¾(ÆüËÜ¸ìÉÔ²Ä)
+		if($keyname == "key_day"){
+			$objGraphLine->setXLabelAngle(-45);
+		}
+
+		// ¥¿¥¤¥È¥ë¥»¥Ã¥È
+		$objGraphLine->setXTitle($xtitle);
+		$objGraphLine->setYTitle($ytitle);
+		
+		// ¥á¥¤¥ó¥¿¥¤¥È¥ëºîÀ®
+		list($sy, $sm, $sd) = split("[/ ]" , $sdate);
+		list($ey, $em, $ed) = split("[/ ]" , $edate);
+		$start_date = $sy . "Ç¯" . $sm . "·î" . $sd . "Æü";
+		$end_date = $ey . "Ç¯" . $em . "·î" . $ed . "Æü";
+		$objGraphLine->drawTitle("½¸·×´ü´Ö¡§" . $start_date . " - " . $end_date);
+		
+		// ¥°¥é¥ÕÉÁ²è
+		$objGraphLine->drawGraph();
+		$objGraphLine->outputGraph(false, $path);
+
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$ret_path = GRAPH_URL . $pngname;
+	}
+	return $ret_path;
+}
+
+// ±ß¥°¥é¥Õ¤ÎºîÀ® 
+function lfGetGraphPie($arrResults, $keyname, $type, $title = "", $sdate = "", $edate = "") {
+	
+	$ret_path = "";
+	
+	// ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£
+	if(count($arrResults) > 0) {
+		// ¥°¥é¥Õ¤ÎÀ¸À®
+		$arrList = sfArrKeyValue($arrResults, $keyname, "total", GRAPH_PIE_MAX, GRAPH_LABEL_MAX);
+		
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$pngname = lfGetGraphPng($type);
+		$path = GRAPH_DIR . $pngname;
+		
+		// ¥°¥é¥Õ²èÁü¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤À¤±ºîÀ®¤¹¤ë
+		if(!file_exists($path)) {
+			$objGraphPie = new SC_GraphPie();
+			
+			/* ¥Ç¥Ð¥Ã¥°É½¼¨ÍÑ by naka
+			foreach($arrList as $key => $val) {
+				$objGraphPie->debugPrint("key:$key val:$val");
+			}
+			*/
+			
+			// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+			$objGraphPie->setData($arrList);
+			// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+			$objGraphPie->setLegend(array_keys($arrList));
+									
+			// ¥á¥¤¥ó¥¿¥¤¥È¥ëºîÀ®
+			list($sy, $sm, $sd) = split("[/ ]" , $sdate);
+			list($ey, $em, $ed) = split("[/ ]" , $edate);
+			$start_date = $sy . "Ç¯" . $sm . "·î" . $sd . "Æü";
+			$end_date = $ey . "Ç¯" . $em . "·î" . $ed . "Æü";
+			$objGraphPie->drawTitle("½¸·×´ü´Ö¡§" . $start_date . " - " . $end_date);
+					
+			// ±ß¥°¥é¥ÕÉÁ²è
+			$objGraphPie->drawGraph();
+			
+			// ¥°¥é¥Õ¤Î½ÐÎÏ
+			$objGraphPie->outputGraph(false, $path);			
+		}
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$ret_path = GRAPH_URL . $pngname;
+	}
+	return $ret_path;
+}
+
+// ËÀ¥°¥é¥Õ¤ÎºîÀ® 
+function lfGetGraphBar($arrResults, $keyname, $type, $xtitle, $ytitle, $sdate, $edate) {
+	$ret_path = "";
+	
+	// ·ë²Ì¤¬0¹Ô°Ê¾å¤¢¤ë¾ì¹ç¤Î¤ß¥°¥é¥Õ¤òÀ¸À®¤¹¤ë¡£
+	if(count($arrResults) > 0) {
+		// ¥°¥é¥Õ¤ÎÀ¸À®
+		$arrList = sfArrKeyValue($arrResults, $keyname, "total", GRAPH_PIE_MAX, GRAPH_LABEL_MAX);
+		
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$pngname = lfGetGraphPng($type);
+		$path = GRAPH_DIR . $pngname;
+		
+		// ¥°¥é¥Õ²èÁü¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤À¤±ºîÀ®¤¹¤ë
+		if(!file_exists($path)) {
+			$objGraphBar = new SC_GraphBar();
+			
+			foreach(array_keys($arrList) as $val) {
+				$arrKey[] = ereg_replace("¡Á", "-", $val);
+			}
+			
+			// ¥°¥é¥ÕÉÁ²è
+			$objGraphBar->setXLabel($arrKey);
+			$objGraphBar->setXTitle($xtitle);
+			$objGraphBar->setYTitle($ytitle);
+			$objGraphBar->setData($arrList);
+			
+			// ¥á¥¤¥ó¥¿¥¤¥È¥ëºîÀ®
+			$arrKey = array_keys($arrList);
+			list($sy, $sm, $sd) = split("[/ ]" , $sdate);
+			list($ey, $em, $ed) = split("[/ ]" , $edate);
+			$start_date = $sy . "Ç¯" . $sm . "·î" . $sd . "Æü";
+			$end_date = $ey . "Ç¯" . $em . "·î" . $ed . "Æü";
+			$objGraphBar->drawTitle("½¸·×´ü´Ö¡§" . $start_date . " - " . $end_date);
+			
+			$objGraphBar->drawGraph();
+			$objGraphBar->outputGraph(false,$path);
+		}
+
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$ret_path = GRAPH_URL . $pngname;
+	}
+	return $ret_path;
+}
+
+// ¥°¥é¥ÕÍÑ¤ÎPNG¥Õ¥¡¥¤¥ëÌ¾ 
+function lfGetGraphPng($keyname) {
+	if($_POST['search_startyear_m'] != "") {
+		$pngname = sprintf("%s_%02d%02d.png", $keyname, substr($_POST['search_startyear_m'],2), $_POST['search_startmonth_m']);
+	} else {
+		$pngname = sprintf("%s_%02d%02d%02d_%02d%02d%02d.png", $keyname, substr($_POST['search_startyear'], 2), $_POST['search_startmonth'], $_POST['search_startday'], substr($_POST['search_endyear'],2), $_POST['search_endmonth'], $_POST['search_endday']);
+	}
+	return $pngname;
+}
+
+// ²ñ°÷¡¢Èó²ñ°÷½¸·×¤ÎWHEREÊ¬¤ÎºîÀ®
+function lfGetWhereMember($col_date, $sdate, $edate, $type, $col_member = "customer_id") {
+	// ¼èÆÀÆüÉÕ¤Î»ØÄê
+	if($sdate != "") {
+		if ($where != "") {
+			$where.= " AND ";
+		}			
+		$where.= " $col_date >= '". $sdate ."'";
+	}
+		
+	if($edate != "") {
+		if ($where != "") {
+			$where.= " AND ";
+		}			
+		$where.= " $col_date < date('" . $edate ."')+1";
+	}
+	
+	// ²ñ°÷¡¢Èó²ñ°÷¤ÎÈ½Äê
+	switch($type) {
+	// Á´ÂÎ
+	case 'all':
+		break;
+	case 'member':
+		if ($where != "") {
+			$where.= " AND ";
+		}
+		$where.= " $col_member <> 0";
+		break;
+	case 'nonmember':
+		if ($where != "") {
+			$where.= " AND ";
+		}
+		$where.= " $col_member = 0";
+		break;
+	default:
+		break;
+	}
+	
+	return array($where, $arrval);
+}
+
+/** ²ñ°÷ÊÌ½¸·× **/
+function lfGetOrderMember($type, $sdate, $edate, $objPage, $graph = true) {
+	global $arrSex;
+		
+	list($where, $arrval) = lfGetWhereMember('create_date', $sdate, $edate, $type);
+	
+	// ²ñ°÷½¸·×¤Î¼èÆÀ
+	$col = "COUNT(*) AS order_count, SUM(total) AS total, int8(AVG(total)) AS total_average, order_sex";
+	$from = "dtb_order";
+	$objQuery = new SC_Query();
+	$objQuery->setGroupBy("order_sex");
+	
+	$tmp_where = $where . " AND customer_id <> 0 AND delete = 0 ";
+	$arrRet = $objQuery->select($col, $from, $tmp_where, $arrval);
+	
+	// ²ñ°÷¹ØÆþ¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤¹¤ë¡£
+	$max = count($arrRet);
+	for($i = 0; $i < $max; $i++) {
+		$arrRet[$i]['member_name'] = '²ñ°÷'.$arrSex[$arrRet[$i]['order_sex']];
+	}
+	$objPage->arrResults = $arrRet;
+	
+	// Èó²ñ°÷½¸·×¤Î¼èÆÀ
+	$tmp_where = $where . " AND customer_id = 0 AND delete = 0 ";
+	$arrRet = $objQuery->select($col, $from, $tmp_where, $arrval);
+	// Èó²ñ°÷¹ØÆþ¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤¹¤ë¡£
+	$max = count($arrRet);
+	for($i = 0; $i < $max; $i++) {
+		$arrRet[$i]['member_name'] = 'Èó²ñ°÷'.$arrSex[$arrRet[$i]['order_sex']];
+	}
+	
+	$objPage->arrResults = array_merge($objPage->arrResults, $arrRet);
+	
+	// ±ß¥°¥é¥Õ¤ÎÀ¸À®
+	if($graph) {	
+		$image_key = "member";
+		$objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "member_name", $image_key, "(Çä¾åÈæÎ¨)", $sdate, $edate);
+	}
+	
+	return $objPage;
+}
+
+/** ¾¦ÉÊÊÌ½¸·× **/
+function lfGetOrderProducts($type, $sdate, $edate, $objPage, $graph = true) {
+	list($where, $arrval) = lfGetWhereMember('create_date', $sdate, $edate, $type);
+	
+	$sql = "SELECT product_id, T1.product_code, T2.name, T1.products_count, T1.order_count, T1.price, T1.total ";
+	$sql.= "FROM ( ";
+	$sql.= "SELECT product_id, product_code, price, ";
+	$sql.= "COUNT(*) AS order_count, ";
+	$sql.= "SUM(quantity) AS products_count, ";
+	$sql.= "(price * sum(quantity)) AS total ";
+	$sql.= "FROM dtb_order_detail WHERE order_id IN (SELECT order_id FROM dtb_order WHERE $where ) ";
+	$sql.= "GROUP BY product_id, product_code, price ";
+	$sql.= ") ";
+	$sql.= "AS T1 LEFT JOIN dtb_products AS T2 USING (product_id) WHERE T2.name IS NOT NULL AND status = 1 ORDER BY T1.total DESC ";
+	
+	if($_POST['mode'] != "csv") {
+		$sql.= "LIMIT " . PRODUCTS_TOTAL_MAX;
+	}
+	
+	$objQuery = new SC_Query();
+	$objPage->arrResults = $objQuery->getall($sql, $arrval);
+	
+	// ±ß¥°¥é¥Õ¤ÎÀ¸À®
+	if($graph) {
+		$image_key = "products_" . $type;
+		$objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "name", $image_key, "(Çä¾åÈæÎ¨)", $sdate, $edate);
+	}
+	
+	return $objPage;
+}
+
+/** ¿¦¶ÈÊÌ½¸·× **/
+function lfGetOrderJob($type, $sdate, $edate, $objPage, $graph = true) {
+	global $arrJob;	
+		
+	list($where, $arrval) = lfGetWhereMember('T2.create_date', $sdate, $edate, $type);
+	
+	$sql = "SELECT job, count(*) AS order_count, SUM(total) AS total, int8(AVG(total)) AS total_average ";
+	$sql.= "FROM dtb_customer AS T1 LEFT JOIN dtb_order AS T2 USING ( customer_id ) WHERE $where AND T2.delete = 0";
+	$sql.= "GROUP BY job ORDER BY total DESC";
+	
+	$objQuery = new SC_Query();
+	$objPage->arrResults = $objQuery->getall($sql, $arrval);
+			
+	$max = count($objPage->arrResults);
+	for($i = 0; $i < $max; $i++) {
+		$job_key = $objPage->arrResults[$i]['job'];
+		if($job_key != "") {
+			$objPage->arrResults[$i]['job_name'] = $arrJob[$job_key];
+		} else {
+			$objPage->arrResults[$i]['job_name'] = "Ì¤²óÅú";
+		}
+	}
+	
+	// ±ß¥°¥é¥Õ¤ÎÀ¸À®	
+	if($graph) {
+		$image_key = "job_" . $type;
+		$objPage->tpl_image = lfGetGraphPie($objPage->arrResults, "job_name", $image_key, "(Çä¾åÈæÎ¨)", $sdate, $edate);
+	}
+	
+	return $objPage;
+}
+
+/** Ç¯ÂåÊÌ½¸·× **/
+function lfGetOrderAge($type, $sdate, $edate, $objPage, $graph = true) {
+
+	list($where, $arrval) = lfGetWhereMember('order_date', $sdate, $edate, $type, "member");
+	
+	$sql = "SELECT SUM(order_count) AS order_count, SUM(total) AS total, start_age, end_age ";
+	$sql.= "FROM dtb_bat_order_daily_age WHERE $where ";
+	$sql.= "GROUP BY start_age, end_age ORDER BY start_age, end_age";
+
+	$objQuery = new SC_Query();
+	$objPage->arrResults = $objQuery->getall($sql, $arrval);
+	
+	$max = count($objPage->arrResults);
+	for($i = 0; $i < $max; $i++) {
+		if($objPage->arrResults[$i]['order_count'] > 0) {
+			$objPage->arrResults[$i]['total_average'] = intval($objPage->arrResults[$i]['total'] / $objPage->arrResults[$i]['order_count']);
+		}	
+		$start_age = $objPage->arrResults[$i]['start_age'];
+		$end_age = $objPage->arrResults[$i]['end_age'];
+		if($start_age != "" || $end_age != "") {
+			if($end_age != 999) {
+				$objPage->arrResults[$i]['age_name'] = $start_age . "¡Á" . $end_age . "ºÐ";
+			} else {
+				$objPage->arrResults[$i]['age_name'] = $start_age . "ºÐ¡Á";
+			}
+		} else {
+			$objPage->arrResults[$i]['age_name'] = "Ì¤²óÅú";
+		}
+	}
+	
+	// ËÀ¥°¥é¥Õ¤ÎÀ¸À®
+	if($graph) {
+		$image_key = "age_" . $type;
+		$xtitle = "(Ç¯Îð)";
+		$ytitle = "(Çä¾å¹ç·×)";
+		$objPage->tpl_image = lfGetGraphBar($objPage->arrResults, "age_name", $image_key, $xtitle, $ytitle, $sdate, $edate);
+	}
+	
+	return $objPage;
+}
+
+/** ´ü´ÖÊÌ½¸·× **/
+function lfGetOrderTerm($type, $sdate, $edate, $objPage, $graph = true) {
+		
+		$tmp_col = "sum(total_order) as total_order, sum(men) as men, sum(women) as women,";
+		$tmp_col.= "sum(men_member) as men_member, sum(men_nonmember) as men_nonmember,";
+		$tmp_col.= "sum(women_member) as women_member, sum(women_nonmember) as women_nonmember,";
+		$tmp_col.= "sum(total) as total, int8(avg(total_average)) as total_average";
+		$objQuery = new SC_Query();
+		
+		switch($type) {
+		// ·îÊÌ
+		case 'month':
+			$col = $tmp_col . ",key_month";
+			$objQuery->setgroupby("key_month");
+			$objQuery->setOrder("key_month");
+			$objPage->keyname = "key_month";
+			$objPage->tpl_tail = "·î";
+			$from = "dtb_bat_order_daily";
+			$xtitle = "(·îÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		// Ç¯ÊÌ
+		case 'year':
+			$col = $tmp_col . ",key_year";
+			$objQuery->setgroupby("key_year");
+			$objQuery->setOrder("key_year");
+			$objPage->keyname = "key_year";
+			$objPage->tpl_tail = "Ç¯";
+			$from = "dtb_bat_order_daily";
+			$xtitle = "(Ç¯ÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		// ÍËÆüÊÌ
+		case 'wday':
+			$col = $tmp_col . ",key_wday, wday";
+			$objQuery->setgroupby("key_wday, wday");
+			$objQuery->setOrder("wday");
+			$objPage->keyname = "key_wday";
+			$objPage->tpl_tail = "ÍËÆü";
+			$from = "dtb_bat_order_daily";
+			$xtitle = "(ÍËÆüÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		// »þ´ÖÊÌ
+		case 'hour':
+			$col = $tmp_col . ",hour";
+			$objQuery->setgroupby("hour");
+			$objQuery->setOrder("hour");
+			$objPage->keyname = "hour";
+			$objPage->tpl_tail = "»þ";
+			$from = "dtb_bat_order_daily_hour";
+			$xtitle = "(»þ´ÖÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		default:
+			$col = "*";
+			$objQuery->setOrder("key_day");
+			$objPage->keyname = "key_day";
+			$from = "dtb_bat_order_daily";
+			$xtitle = "(ÆüÊÌ)";
+			$ytitle = "(Çä¾å¹ç·×)";
+			break;
+		}
+		
+
+	// ¼èÆÀÆüÉÕ¤Î»ØÄê
+		if($sdate != "") {
+			if ($where != "") {
+				$where.= " AND ";
+			}			
+			$where.= " order_date >= '". $sdate ."'";
+		}
+		
+		if($edate != "") {
+			if ($where != "") {
+				$where.= " AND ";
+			}
+			$where.= " order_date < date('" . $edate ."')+1";
+		}
+
+		// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+		$objPage->arrResults = $objQuery->select($col, $from, $where, $arrval);
+		
+		// ÀÞ¤ìÀþ¥°¥é¥Õ¤ÎÀ¸À®	
+		if($graph) {
+			$image_key = "term_" . $type;
+			$objPage->tpl_image = lfGetGraphLine($objPage->arrResults, $objPage->keyname, $image_key, $xtitle, $ytitle, $sdate, $edate);
+		}
+		
+		// ¸¡º÷·ë²Ì¤¬0¤Ç¤Ê¤¤¾ì¹ç
+		if(count($objPage->arrResults) > 0) {
+			// ºÇ½ª½¸·×¹Ô¼èÆÀ¤¹¤ë
+			$col = $tmp_col;
+			$objQuery = new SC_Query();
+			$arrRet = $objQuery->select($col, $from, $where, $arrval);
+			$arrRet[0][$objPage->keyname] = "¹ç·×";
+			$objPage->arrResults[] = $arrRet[0];
+		}
+
+		// Ê¿¶ÑÃÍ¤Î·×»»
+		$max = count($objPage->arrResults);
+		for($i = 0; $i < $max; $i++) {
+			if($objPage->arrResults[$i]['total_order'] > 0) {
+				$objPage->arrResults[$i]['total_average'] = intval($objPage->arrResults[$i]['total'] / $objPage->arrResults[$i]['total_order']);
+			}
+		}
+		
+		return $objPage;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/line.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/line.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/line.php	(revision 1328)
@@ -0,0 +1,178 @@
+<?php
+require_once("./class/SC_GraphPie.php");
+require_once("./class/SC_GraphLine.php");
+
+class LC_Page {
+	function LC_Page($arrData) {
+		$this->arrData = $arrData;
+	}
+}
+
+
+$objGraphPie = new SC_GraphPie();
+$objGraphLine = new SC_GraphLine();
+
+$arrData1 = array(
+	3250,
+	423,
+	533,
+	1158,
+	1120,
+	1300,
+	2223,
+	100,
+	250,
+	23,
+	33,
+	58,
+	120,
+	3300,
+	4223,
+	5120,
+	2300,
+	3223,
+	100,
+	4250,
+	100
+);
+
+$arrData2 = array(
+	3300,
+	4223,
+	5120,
+	2300,
+	3223,
+	100,
+	4250,
+	23,
+	3250,
+	423,
+	533,
+	1158,
+	1120,
+	1300,
+	2223,
+	100,
+	250,
+	23,
+	33,
+	58,
+	120,
+	100
+);
+
+$arrData3 = array(
+	6223,
+	6223,
+	6223,
+	6300,
+	3223,
+	2223,
+	6300,
+	6223,
+	5120,
+	2300,
+	3223,
+	6223,
+	6223,
+	3300,
+	4223,
+	5120,
+	6300,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+	3223,
+	2223,
+);
+
+$arrXLabel = array(
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',	
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'1·î',
+	'2·î',
+	'3·î',
+	'4·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'8·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'8·î',
+	'5·î',
+	'6·î',
+	'7·î',
+	'8·î'
+
+);
+$arrYLabel = array(
+	1000,
+	2000,
+	3000,
+	4000,
+	5000,
+	6000,
+	7000,
+	8000,
+	9000,
+	10000
+);
+
+$arrLegend = array(
+	'»î¸³1',
+	'»î¸³2',
+	'»î¸³3',
+	'»î¸³4',
+	'»î¸³5',
+	'»î¸³6',
+	'»î¸³7'
+);
+
+// ¥°¥é¥ÕÉÁ²è
+$objGraphLine->setXLabel($arrXLabel);
+//$objGraphLine->setYScale($arrYLabel);
+$objGraphLine->setXTitle("´ü´Ö(·î)");
+$objGraphLine->setYTitle("Çä¾å¤²(±ß)");
+$objGraphLine->setData($arrData1);
+//$objGraphLine->setData($arrData1);
+//$objGraphLine->setData($arrData3);
+
+// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+//$objGraphLine->setLegend($arrLegend);
+$objGraphLine->drawGraph();
+
+$objGraphLine->outputGraph(false, "/home/web/os-test.lockon.co.jp/html/upload/graph_image/test.png");
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphLine.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphLine.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphLine.php	(revision 1328)
@@ -0,0 +1,286 @@
+<?
+$SC_GRAPHLINE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHLINE_DIR . "/SC_GraphBase.php");	
+
+// ÀÞ¤ìÀþ¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphLine extends SC_GraphBase{
+	var $area_width;
+	var $area_height;
+	var $ygrid_on;
+	var $graph_max;		// ¥°¥é¥Õ¤Î¥¨¥ê¥¢ºÇÂçÃÍ(Y¼´ÄºÅÀ¤ÎÃÍ)
+	var $arrXLabel;	
+	var $XLabelAngle;	// X¼´¥é¥Ù¥ë³ÑÅÙ	
+	var $XTitle;		// X¼´¥¿¥¤¥È¥ë
+	var $YTitle;		// Y¼´¥¿¥¤¥È¥ë
+	var $arrDataList;	// ¥°¥é¥Õ¥Ç¡¼¥¿¤ò³ÊÇ¼
+	var $arrPointList;	// ÀÞ¤ìÀþºÂÉ¸¤ò³ÊÇ¼
+	var $line_max;		// Ê£¿ô¤ÎÉÁ²è¤Î¾ì¹ç¤Ë²Ã»»¤·¤Æ¤¤¤¯
+	
+	var $x_margin;
+	var $y_margin;
+			
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphLine(
+		$bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP,
+		$area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) {
+		parent::SC_GraphBase($bgw, $bgh, $left, $top);	
+		$this->area_width = $area_width;
+		$this->area_height = $area_height;
+		$this->ygrid_on = true;
+		$this->line_max = 0;
+		$this->graph_max = 0;
+		$this->XLabelAngle = 0;
+		$this->x_margin = 0;
+		$this->y_margin = 0;
+	}
+	
+	// X¼´¥é¥Ù¥ë¤Î³ÑÅÙ¥»¥Ã¥È
+	function setXLabelAngle($Angle) {
+		$this->XLabelAngle = $Angle;
+	}
+	
+	// Y¼´¥¿¥¤¥È¥ë
+	function drawYTitle() {
+		// Y¼´¤Ë¥¿¥¤¥È¥ë¤òÆþ¤ì¤ë
+		if($this->YTitle != "") {
+			$text_width = $this->getTextWidth($this->YTitle, FONT_SIZE);
+			$x_pos = $this->left - ($text_width / 2);
+			$y_pos = $this->top - FONT_SIZE - LINE_YTITLE_PAD;		
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, $this->YTitle);
+		}
+	}
+	
+	// X¼´¥¿¥¤¥È¥ë
+	function drawXTitle() {
+		// Y¼´¤Ë¥¿¥¤¥È¥ë¤òÆþ¤ì¤ë
+		if($this->XTitle != "") {
+			$text_width = $this->getTextWidth($this->XTitle, FONT_SIZE);
+			$x_pos = $this->left + $this->area_width - ($text_width / 2);
+			$y_pos = $this->top + $this->area_height + LINE_XTITLE_PAD;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, $this->XTitle);
+		}
+	}
+	
+	// Y¼´¤ÎÉÁ²è
+	function drawYLine() {
+		imageline($this->image, $this->left, $this->top, $this->left, $this->top + $this->area_height, $this->flame_color);
+		// ÌÜÀ¹¤êÉý¤òµá¤á¤ë(Ãæ´ÖÅÀ¤Ï¼«Æ°)
+		$size = $this->area_height / (LINE_Y_SCALE * 2);
+		// ¾å¤«¤éÌÜÀ¹¤ê¤òÆþ¤ì¤Æ¤¤¤¯
+		$pos = 0;
+		for($i = 0; $i < (LINE_Y_SCALE * 2); $i++) {
+			// ÌÜÀ¹¤êÉý
+			if(($i % 2) == 0) {
+				$sw = LINE_SCALE_SIZE;
+				if($this->ygrid_on) {
+					imageline($this->image, $this->left, $this->top + $pos, $this->left + $this->area_width, $this->top + $pos, $this->grid_color);
+				}
+			} else {
+				$sw = LINE_SCALE_SIZE / 2;
+			}
+			imageline($this->image, $this->left, $this->top + $pos, $this->left + $sw, $this->top + $pos, $this->flame_color);
+			$pos += $size;
+		}
+		// Y¼´¤ËÌÜÀ¹¤êÃÍ¤òÆþ¤ì¤ë
+		$this->setYScale();
+		$this->drawYTitle();	
+	}
+	
+	// X¼´¤ÎÉÁ²è
+	function drawXLine($bar = false) {
+		imageline($this->image, $this->left, $this->top + $this->area_height, $this->left + $this->area_width, $this->top + $this->area_height, $this->flame_color);
+		$arrPointList = $this->arrPointList[0];
+		$count = count($arrPointList);
+		
+		// ËÀ¥°¥é¥Õ¤Î¾ì¹ç¤ÏÈ¾ÌÜÀ¹¤ê¤º¤é¤¹
+		if($bar) {
+			$half_scale = intval($this->area_width / ($count + 1) / 2);
+		} else {
+			$half_scale = 0;
+		}
+		
+		// ¥é¥Ù¥ë¤ÎÉ½¼¨¥¤¥ó¥¿¡¼¥Ð¥ë¤ò»»½Ð
+		$interval = ceil($count / LINE_XLABEL_MAX);	// ÀÚ¤ê¾å¤²				
+		for($i = 0; $i < $count; $i++) {
+			// X¼´¤ËÌÜÀ¹¤ê¤òÆþ¤ì¤ë
+			$x = $arrPointList[$i][0];
+			$pos = $this->top + $this->area_height;
+			imageline($this->image, $x - $half_scale, $pos, $x - $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color);			
+			// ¥é¥Ù¥ë¤òÆþ¤ì¤ë
+			if(($i % $interval) == 0) {
+				$text_width = $this->getTextWidth($this->arrXLabel[$i], FONT_SIZE);
+				$x_pos = $x - ($text_width / 2);
+				
+				if ($this->XLabelAngle == "-45"){
+					$this->x_margin = - $text_width / 4;
+					$this->y_margin = $text_width / 2 + 5;
+				}
+				
+				$this->setText(FONT_SIZE, $x_pos + $this->x_margin, $pos + FONT_SIZE + $this->y_margin, $this->arrXLabel[$i], NULL, $this->XLabelAngle);
+			}
+		}
+		
+		// ËÀ¥°¥é¥Õ¤Î¾ì¹ç¤ÏºÇ¸å¤ÎÌÜÀ¹¤ê¤ò°ì¤ÄÄÉ²Ã¤¹¤ë
+		if($bar) {
+			imageline($this->image, $x + $half_scale, $pos, $x + $half_scale, $pos - LINE_SCALE_SIZE,  $this->flame_color);	
+		}
+		
+		$this->drawXTitle();
+	}
+		
+	// ¥°¥ê¥Ã¥ÉÉ½¼¨
+	function setYGridOn($ygrid_on) {
+		$this->ygrid_on = $ygrid_on;
+	}
+	
+	// ¥Ý¥¤¥ó¥È¤ÎÉÁ²è
+	function setMark($line_no, $left, $top, $size = LINE_MARK_SIZE) {
+		// ¶ö¿ô¤ËÊÑ´¹¤·¤Æ¤ª¤¯
+		$size += $size % 2;
+		$array = array(
+			$left, $top - ($size / 2),
+			$left + ($size / 2), $top,
+			$left, $top + ($size / 2),
+			$left - ($size / 2), $top,
+		);		
+		imagefilledpolygon($this->image, $array, 4, $this->arrColor[$line_no]);
+		imagepolygon($this->image, $array, 4, $this->flame_color);
+ 		imagesetpixel ($this->image, $left, $top + ($size / 2), $this->flame_color);
+	}	
+	
+	// Y¼´ÌÜÀ¹¤ê¤ËÃÍ¤òÆþ¤ì¤ë
+	function setYScale() {
+		// 1ÌÜÀ¹¤ê¤ÎÃÍ
+		$number = intval($this->graph_max / LINE_Y_SCALE);				
+		// ÌÜÀ¹¤êÉý¤òµá¤á¤ë
+		$size = $this->area_height / LINE_Y_SCALE;
+		$pos = 0;
+		for($i = 0; $i <= LINE_Y_SCALE; $i++) {
+			$snumber = $number * (LINE_Y_SCALE - $i);
+			$disp_number = number_format($snumber);
+			$num_width = $this->getTextWidth($disp_number, FONT_SIZE);
+			$this->setText(FONT_SIZE, $this->left - $num_width - 2, $this->top + $pos - (FONT_SIZE / 2), $disp_number);
+			$pos += $size;
+		}
+	}
+	
+	// 
+	function setMax($arrData) {
+		// ¥Ç¡¼¥¿¤ÎºÇÂçÃÍ¤ò¼èÆÀ¤¹¤ë¡£
+		$data_max = max($arrData);
+		// 10¤Î²¿ÇÜ¤«¤ò¼èÆÀ
+		$figure = strlen($data_max) - 1;
+		// ¼¡¤Î·å¤ò·×»»¤¹¤ë
+		$tenval = pow(10, $figure);
+		// ¥°¥é¥Õ¾å¤Ç¤ÎºÇÂçÃÍ¤òµá¤á¤ë
+		$this->graph_max = $tenval * (intval($data_max / $tenval) + 1);
+		// ºÇÂçÃÍ¤¬10Ì¤Ëþ¤Î¾ì¹ç¤ÎÂÐ±þ
+		if($this->graph_max < 10) {
+			$this->graph_max = 10;
+		}	
+	}
+	
+	// ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawGraph() {
+		// ¥°¥é¥ÕÇØ·Ê¤òÉÁ²è
+		$this->drawYLine();
+		$this->drawXLine();
+		
+		// ÀÞ¤ìÀþ¥°¥é¥ÕÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLine($i);
+		}
+		
+		// ¥Þ¡¼¥¯¤òÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawMark($i);
+		}
+		
+		// ¥é¥Ù¥ë¤òÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLabel($i);		
+		}
+
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend();	
+	}
+	
+	// ¥é¥¤¥ó¤òÉÁ²è¤¹¤ë
+	function drawLine($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			if(isset($arrPointList[$i + 1])) {
+				$next_x = $arrPointList[$i + 1][0];
+				$next_y = $arrPointList[$i + 1][1];
+				imageline($this->image, $x, $y, $next_x, $next_y, $this->arrColor[$line_no]);
+			}
+		}
+	}
+	
+	// ¥Þ¡¼¥¯¤òÉÁ²è¤¹¤ë
+	function drawMark($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];			
+			$this->setMark($line_no, $x, $y);
+		}
+	}
+	
+	// ¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($line_no) {
+		$arrData = $this->arrDataList[$line_no];
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			$text_width = $this->getTextWidth(number_format($arrData[$i]), FONT_SIZE);
+			$y_pos = $y - FONT_SIZE - 5;
+			$x_pos = $x - $text_width / 2;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, number_format($arrData[$i]));
+		}
+	}
+	
+	// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+	function setData($arrData) {
+		$this->arrDataList[$this->line_max] = array_values((array)$arrData);
+		$this->setMax($this->arrDataList[$this->line_max]);
+		// ÃÍ¤ÎÉÁ²èÊÑ´¹Î¨
+		$rate = $this->area_height / $this->graph_max;
+		// ÉÁ²èÎ¨¤ò·×»»
+		$count = count($this->arrDataList[$this->line_max]);
+		$scale_width = $this->area_width / ($count + 1);		
+		$this->arrPointList[$this->line_max] = array();
+		for($i = 0; $i < $count; $i++) {
+			// XºÂÉ¸¤òµá¤á¤ë
+			$x = intval($this->left + ($scale_width * ($i + 1)));
+			// YºÂÉ¸¤òµá¤á¤ë
+			$y = intval($this->top + $this->area_height - ($this->arrDataList[$this->line_max][$i] * $rate));
+			// XYºÂÉ¸¤òÊÝÂ¸¤¹¤ë
+			$this->arrPointList[$this->line_max][] = array($x, $y);
+		}
+		$this->line_max++;
+	}
+	
+	// X¼´¥é¥Ù¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setXLabel($arrXLabel) {
+		$this->arrXLabel = array_values((array)$arrXLabel);
+	}
+	
+	// X¼´¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setXTitle($title) {
+		$this->XTitle = $title;
+	}
+	
+	// Y¼´¥¿¥¤¥È¥ë¤ò¥»¥Ã¥È¤¹¤ë
+	function setYTitle($title) {
+		$this->YTitle = $title;
+	}	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphBase.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphBase.php	(revision 2872)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphBase.php	(revision 2872)
@@ -0,0 +1,220 @@
+<?php
+/*
+$SC_GRAPHPIE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHPIE_DIR . "/config.php");
+require_once($SC_GRAPHPIE_DIR . "/lib.php");	
+*/
+require_once(realpath(dirname( __FILE__)) . "/config.php");
+require_once(realpath(dirname( __FILE__)) . "/lib.php");	
+
+// SC_Graph¶¦ÄÌ¥¯¥é¥¹
+class SC_GraphBase {
+	var $arrRGB;
+	var $arrColor;
+	var $arrDarkColor;
+	var $image;
+	var $left;
+	var $top;
+	var $shade_color;
+	var $flame_color;
+	var $shade_on;
+	var $text_color;
+	var $labelbg_color;
+	var $bgw;
+	var $bgh;
+	var $clabelbg_color;
+	var $title_color;
+	var $text_top;
+	var $mark_color;
+	var $arrLegend;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphBase($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left, $top) {
+		global $ARR_GRAPH_RGB;
+		global $ARR_BG_COLOR;
+		global $ARR_SHADE_COLOR;
+		global $ARR_FLAME_COLOR;
+		global $ARR_TEXT_COLOR;
+		global $ARR_LABELBG_COLOR;
+		global $ARR_LEGENDBG_COLOR;
+		global $ARR_TITLE_COLOR;
+		global $ARR_GRID_COLOR;
+		
+		// ²èÁüºîÀ®
+		$this->bgw = $bgw;
+		$this->bgh = $bgh;	
+		$this->image = imagecreatetruecolor($bgw, $bgh);
+		// ¥¢¥ó¥Á¥¨¥¤¥ê¥¢¥¹Í­¸ú
+		imageantialias($this->image, true);
+		// ÇØ·Ê¿§¤ò¥»¥Ã¥È
+		imagefill($this->image, 0, 0, lfGetImageColor($this->image, $ARR_BG_COLOR));
+		
+		// »ÈÍÑ¿§¤ÎÀ¸À®
+		$this->setColorList($ARR_GRAPH_RGB);
+		// ¥°¥é¥ÕÉÁ²è°ÌÃÖ¤ÎÀßÄê
+		$this->left = $left;
+		$this->top = $top;
+		$this->shade_color = lfGetImageColor($this->image, $ARR_SHADE_COLOR);
+		$this->flame_color = lfGetImageColor($this->image, $ARR_FLAME_COLOR);
+		$this->text_color = lfGetImageColor($this->image, $ARR_TEXT_COLOR);
+		$this->labelbg_color = lfGetImageColor($this->image, $ARR_LABELBG_COLOR);
+		$this->clabelbg_color = lfGetImageColor($this->image, $ARR_LEGENDBG_COLOR);
+		$this->title_color = lfGetImageColor($this->image, $ARR_TITLE_COLOR);
+		$this->grid_color = lfGetImageColor($this->image, $ARR_GRID_COLOR);
+			
+		// ±Æ¤¢¤ê
+		$this->shade_on = true;
+    }
+	
+	// ¥ª¥Ö¥¸¥§¥¯¥È¥«¥é¡¼¤ÎÀßÄê
+	function setColorList($arrRGB) {
+		$this->arrRGB = $arrRGB;
+		$count = count($this->arrRGB);
+		// ÄÌ¾ï¿§¤ÎÀßÄê
+		for($i = 0; $i < $count; $i++) {
+			$this->arrColor[$i] = lfGetImageColor($this->image, $this->arrRGB[$i]);
+		}
+		// °Å¿§¤ÎÀßÄê
+		for($i = 0; $i < $count; $i++) {
+			$this->arrDarkColor[$i] = lfGetImageDarkColor($this->image, $this->arrRGB[$i]);
+		}		
+	}
+	
+	// ±Æ¤Î¤¢¤ê¤Ê¤·
+	function setShadeOn($shade_on) {
+		$this->shade_on = $shade_on;
+	}
+	
+	// ²èÁü¤ò½ÐÎÏ¤¹¤ë
+	function outputGraph($header = true, $filename = "") {
+		if($header) {
+			header('Content-type: image/png');
+		}
+		
+		if ($filename != "") {
+			imagepng($this->image, $filename);
+		}else{
+			imagepng($this->image);
+		}
+		
+		imagedestroy($this->image);
+	}
+
+	// ÉÁ²è»þ¤Î¥Æ¥­¥¹¥ÈÉý¤òµá¤á¤ë
+	function getTextWidth($text, $font_size) {
+		$text_len = strlen($text);
+		$ret = $font_size * $text_len * TEXT_RATE;	
+		/*
+			¢¨Àµ³Î¤ÊÃÍ¤¬¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¤Î¤ÇÇÑ»ß
+			// ¥Æ¥­¥¹¥ÈÉý¤Î¼èÆÀ
+			$arrPos = imagettfbbox($font_size, 0, FONT_PATH, $text);
+			$ret = $arrPos[2] - $arrPos[0];
+		*/
+		return $ret;
+	}
+	
+	// ¥Æ¥­¥¹¥È¤ò½ÐÎÏ¤¹¤ë
+	function setText($font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false) {
+		// »þ·×²ó¤ê¤Ë³ÑÅÙ¤òÊÑ¹¹
+		$angle = -$angle;		
+		// ¥é¥Ù¥ëÇØ·Ê
+		if($labelbg) {
+			$text_width = $this->getTextWidth($text, $font_size);
+			imagefilledrectangle($this->image, $left - 2, $top - 2, $left + $text_width + 2, $top + $font_size + 2, $this->labelbg_color);
+		}
+		$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+		if($color != NULL) {
+			ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_PATH, $text);
+		} else {
+			ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $this->text_color, FONT_PATH, $text);			
+		}
+	}
+	
+	// ¥¿¥¤¥È¥ë¤ò½ÐÎÏ¤¹¤ë
+	function drawTitle($text, $font_size = TITLE_FONT_SIZE) {
+		// ½ÐÎÏ°ÌÃÖ¤Î»»½Ð
+		$text_width = $this->getTextWidth($text, $font_size);
+		$left = ($this->bgw - $text_width) / 2;
+		$top = TITLE_TOP;
+		$this->setText($font_size, $left, $top, $text, $this->title_color);		
+	}
+	
+	// ¥í¥°¤ò½ÐÎÏ¤¹¤ë
+	function debugPrint($text) {
+		$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+		if(!isset($this->text_top)) {
+			$this->text_top = FONT_SIZE + LINE_PAD;
+		}		
+		// ¥Æ¥­¥¹¥ÈÉÁ²è
+		ImageTTFText($this->image, FONT_SIZE, 0, LINE_PAD, $this->text_top, $this->text_color, FONT_PATH, $text);
+		$this->text_top += FONT_SIZE + LINE_PAD;
+	}
+		
+	// ¥«¥é¡¼¥é¥Ù¥ë¤òÉÁ²è
+	function drawLegend($legend_max = "", $clabelbg = true) {
+		// ËÞÎã¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐÃæ»ß
+		if(count($this->arrLegend) <= 0) {
+			return;
+		}		
+		
+		if($legend_max != "") {
+			$label_max = $legend_max;
+		} else {
+			$label_max = count($this->arrLegend);
+		}
+
+		$height_max = 0;
+		$text_max = 0;
+		$width_max = 0;
+		
+		// °ìÈÖÊ¸»ú¿ô¤¬Â¿¤¤¤â¤Î¤ò¼èÆÀ
+		for($i = 0; $i < $label_max; $i++) {
+			$text_len = strlen($this->arrLegend[$i]);
+			if($text_max < $text_len) {
+				$text_max = $text_len;
+			}
+			$height_max += FONT_SIZE + LINE_PAD;
+		}
+		$width_max = FONT_SIZE * $text_max * TEXT_RATE;		
+
+		// 	¥«¥é¡¼¥¢¥¤¥³¥ó¤ÈÊ¸»ú´Ö¤ò´Þ¤á¤¿Éý
+		$width_max += FONT_SIZE + (LINE_PAD * 2);	
+		$left = $this->bgw - $width_max - LEGEND_RIGHT;
+		$top = LEGEND_TOP;
+		// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+		if($clabelbg) {
+			$this->drawClabelBG($left - LINE_PAD, $top, $left + $width_max, $top + $height_max + LINE_PAD);
+		}
+		$top += LINE_PAD;
+				
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		for($i = 0; $i < $label_max; $i++) {			
+			// ¥«¥é¡¼¥¢¥¤¥³¥ó¤ÎÉ½¼¨
+			imagerectangle($this->image, $left, $top, $left + FONT_SIZE, $top + FONT_SIZE, $this->flame_color);
+			imagefilledrectangle($this->image, $left + 1, $top + 1, $left + FONT_SIZE - 1, $top + FONT_SIZE - 1, $this->arrColor[($i % $c_max)]);
+			// ¥é¥Ù¥ë¤ÎÉ½¼¨
+			$this->setText(FONT_SIZE, $left + FONT_SIZE + LINE_PAD, $top, $this->arrLegend[$i]);
+			$top += FONT_SIZE + LINE_PAD;
+		}
+	}
+	
+	// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+	function drawClabelBG($left, $top, $right, $bottom) {
+		// ±Æ¤ÎÉÁ²è
+		if($this->shade_on) {
+			imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom + 2, $this->shade_color);
+		}
+		// ¥«¥é¡¼¥é¥Ù¥ëÇØ·Ê¤ÎÉÁ²è
+		imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->clabelbg_color);
+		imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color);
+	}
+	
+	// ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë
+	function setLegend($arrLegend) {
+		$this->arrLegend = array_values((array)$arrLegend);
+	}
+
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphPie.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphPie.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphPie.php	(revision 1328)
@@ -0,0 +1,196 @@
+<?php
+
+$SC_GRAPHPIE_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHPIE_DIR . "/SC_GraphBase.php");	
+
+// ±ß¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphPie extends SC_GraphBase{
+	var $cw;
+	var $ch;
+	var $cz;
+	var $cx;
+	var $cy;
+	var $arrLabel;
+	var $arrData;
+	
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphPie($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = PIE_LEFT, $top = PIE_TOP) {
+		parent::SC_GraphBase($bgw, $bgh, $left, $top);
+		// ¥µ¥¤¥ºÀßÄê
+		$this->setSize(PIE_WIDTH, PIE_HEIGHT, PIE_THICK);
+		// °ÌÃÖÀßÄê
+		$this->setPosition($this->left + ($this->cw / 2), $this->top + ($this->ch / 2));
+    }
+	
+	// ¥Ç¡¼¥¿¤ò360¡ëÃÍ¤ËÊÑ´¹¤¹¤ë
+	function getCircleData($array) {
+		if(!is_array($array)) {
+			return;
+		}
+		$arrRet = array();
+		foreach($array as $val) {
+			$total += $val;			
+		}
+		if($total <= 0) {
+			return;
+		}		
+		$rate = 360 / $total;
+		// ¥é¥Ù¥ëÉ½¼¨ÍÑ
+		$p_rate = 100 / $total;
+		$cnt = 0;
+		foreach($array as $val) {
+			$ret = round($val * $rate);
+			$new_total+= $ret;
+			$arrRet[] = $ret;
+			// ¥Ñ¡¼¥»¥ó¥ÈÉ½¼¨ÍÑ
+			$this->arrLabel[] = round($val * $p_rate) . " %";
+			$cnt++;
+		}
+		// ¹ç·×¤¬360¤Ë¤Ê¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤ª¤¯
+		$arrRet[0] -= $new_total - 360;
+		return $arrRet;
+	}	
+		
+	// ±ß¤Î°ÌÃÖÀßÄê¤ò¹Ô¤¦
+	function setPosition($cx, $cy) {
+		$this->cx = $cx;
+		$this->cy = $cy;
+	}
+		
+	// ±ß¤Î¥µ¥¤¥ºÀßÄê¤ò¹Ô¤¦
+	function setSize($cw, $ch, $cz = 0) {
+		$this->cw = $cw;
+		$this->ch = $ch;
+		$this->cz = $cz;
+	}
+	
+	// ±Æ¤ÎÉÁ²è
+	function drawShade() {
+		$move = 1;
+		for($i = ($this->cy + $this->cz); $i <= ($this->cy + $this->cz + ($this->cz * PIE_SHADE_IMPACT)); $i++) {
+			imagefilledarc($this->image, $this->cx + $move, $i, $this->cw, $this->ch, 0, 360, $this->shade_color, IMG_ARC_PIE);
+			$move += 0.5;
+		}
+	}
+	
+	// ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+	function setData($arrData) {
+		$this->arrData = array_values($arrData);
+	}
+	
+	// ±ß¥°¥é¥Õ¤òÉÁ²è¤¹¤ë
+	function drawGraph() {
+		$x = $this->cx;
+		$y = $this->cy;
+		$z = $this->cz;
+		$h = $this->ch;
+		$w = $this->cw;
+		
+		// ¥Ç¡¼¥¿¤Î³ÑÅÙ¤ò¼èÆÀ¤¹¤ë
+		$arrRad = $this->getCircleData($this->arrData);
+		$rd_max = count($arrRad);
+		
+		// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç
+		if($rd_max <= 0) {
+			return;
+		}
+		
+		// ±Æ¤ÎÉÁ²è
+		if($this->shade_on) {
+			$this->drawShade();
+		}
+			
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		$dc_max = count($this->arrDarkColor);
+		
+		// Â¦ÌÌ¤ÎÉÁ²è		
+		for ($i = ($y + $z - 1); $i >= $y; $i--) {
+			$start = 0;
+			for($j = 0; $j < $rd_max; $j++) {
+				// ³ÑÅÙ¤¬0ÅÙ°Ê¾å¤Î¾ì¹ç¤Î¤ßÂ¦ÌÌ¤òÉÁ²è¤¹¤ë¡£
+				if($arrRad[$j] > 0) {
+					$end = $start + $arrRad[$j];
+					if($start == 0 && $end == 360) {
+						// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+						imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[($j % $dc_max)]);
+					} else {
+						// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë
+						imagearc($this->image, $x, $i, $w, $h, $start - 90, $end - 90, $this->arrDarkColor[($j % $dc_max)]);	
+					}			
+					$start = $end;
+				}
+			}
+		}
+		// ÄìÌÌ¤ÎÉÁ²è
+		imagearc($this->image, $x, $y + $z, $w, $h, 0, 180 , $this->flame_color);
+
+		// ¾åÌÌ¤ÎÉÁ²è
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			if($start == 0 && $end == 360) {
+				// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+				imagefilledarc($this->image, $x, $y, $w, $h, 0, 360, $this->arrColor[($i % $c_max)], IMG_ARC_PIE);			
+			} else {
+				// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£		
+				imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->arrColor[($i % $c_max)], IMG_ARC_PIE);
+			}
+			$start = $end;
+		}
+
+		// ¾åÌÌ¤Î±ï¼è¤ê
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			if($start == 0 && $end == 360) {
+				// -90¢·270¤Ç»ØÄê¤¹¤ë¤È±ß¤¬ÉÁ²è¤Ç¤­¤Ê¤¤¤Î¤Ç0¢·360¤Ë»ØÄê
+				imagearc($this->image, $x, $y, $w, $h, 0, 360 , $this->flame_color);
+			}
+			// -90¡ë¤Ï12»þ¤Î°ÌÃÖ¤«¤é³«»Ï¤¹¤ë¤è¤¦¤ËÊäÀµ¤·¤Æ¤¤¤ë¡£
+			imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->flame_color, IMG_ARC_EDGED|IMG_ARC_NOFILL);
+			$start = $end;
+		}
+
+		// Â¦ÌÌ¤Î±ï¼è¤ê
+		imageline($this->image, $x + ($w / 2), $y, $x + ($w / 2), $y + $z, $this->flame_color);
+		imageline($this->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $this->flame_color);
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$end = $start + $arrRad[$i];
+			// Á°ÌÌ¤Î¤ß
+			if($end > 90 && $end < 270) {
+				list($ax, $ay) = lfGetArcPos($x, $y, $w, $h, $end);
+				// ¥é¥¤¥ó¤Î¤º¤ì¤òÊäÀµ¤¹¤ë
+				if($end > 180) {
+					$ax = $ax + 1;
+				}
+				imageline($this->image, $ax, $ay, $ax, $ay + $z, $this->flame_color);
+			}
+			$start = $end;	
+		}
+				
+		// ¥é¥Ù¥ë¤ÎÉÁ²è
+		$this->drawLabel($arrRad);
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend(count($this->arrData));			
+	}
+	
+	// ±ß¥°¥é¥Õ¤Î¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($arrRad) {
+		$rd_max = count($arrRad);
+		$start = 0;
+		for($i = 0; $i < $rd_max; $i++) {
+			$center = $start + ($arrRad[$i] / 2);
+			$end = $start + $arrRad[$i];
+			list($sx, $sy) = lfGetArcPos($this->cx, $this->cy, ($this->cw / 1.5), ($this->ch / 1.5), $center);
+			list($ex, $ey) = lfGetArcPos($this->cx, $this->cy, ($this->cw * 1.5), ($this->ch * 1.5), $center);
+			// »Ø¼¨Àþ¤ÎÉÁ²è
+			imageline($this->image, $sx, $sy, $ex + 2, $ey - PIE_LABEL_UP, $this->flame_color);
+			$this->setText(FONT_SIZE, $ex - 10, $ey - PIE_LABEL_UP - FONT_SIZE, $this->arrLabel[$i], NULL, 0, true);
+			$start = $end;
+		}
+	}	
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/class/config.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/class/config.php	(revision 2897)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/class/config.php	(revision 2897)
@@ -0,0 +1,93 @@
+<?php
+
+/*
+	¶¦ÄÌ 
+*/
+// TTF¥Õ¥©¥ó¥È¥Õ¥¡¥¤¥ë
+define("FONT_PATH", ROOT_DIR . "/data/fonts/ipag.ttf");
+define("FONT_SIZE", 8);			// ¥Õ¥©¥ó¥È¥µ¥¤¥º
+define("TITLE_FONT_SIZE", 11);	// ¥¿¥¤¥È¥ë¥Õ¥©¥ó¥È¥µ¥¤¥º
+define("BG_WIDTH", 720);		// ÇØ·ÊÉý
+define("BG_HEIGHT", 400);		// ÇØ·Ê¹â¤µ
+define("LINE_PAD", 5);			// ¹Ô´Ö
+define("TEXT_RATE", 0.75);		// ¥Õ¥©¥ó¥ÈÊäÀµÃÍ(¼ÂºÝ¤ÎÉÁ²èÉý/¥Õ¥©¥ó¥È¥µ¥¤¥º)
+
+/*
+	±ß¥°¥é¥Õ
+*/
+define("PIE_LEFT", 200);			// ±ß¥°¥é¥Õ°ÌÃÖ
+define("PIE_TOP", 150);				// ±ß¥°¥é¥Õ°ÌÃÖ
+define("PIE_WIDTH", 230);			// ±ß¥°¥é¥ÕÉý
+define("PIE_HEIGHT", 100);			// ±ß¥°¥é¥Õ¹â¤µ
+define("PIE_THICK", 30);			// ±ß¥°¥é¥ÕÂÀ¤µ
+define("PIE_LABEL_UP", 20);			// ±ß¥°¥é¥Õ¤Î¥é¥Ù¥ë°ÌÃÖ¤ò¾å¤Ë¤¢¤²¤ë
+define("PIE_SHADE_IMPACT", 0.1);	// ÃÍ¤¬Âç¤­¤¤¤Û¤É±Æ¤¬Ä¹¤¯¤Ê¤ë
+
+/*
+	ÀÞ¤ìÀþ¥°¥é¥Õ
+*/
+define("LINE_Y_SCALE", 10);			// Y¼´¤ÎÌÜÀ¹¤ê¿ô
+define("LINE_X_SCALE", 10);			// X¼´¤ÎÌÜÀ¹¤ê¿ô
+define("LINE_LEFT", 60);			// Àþ¥°¥é¥Õ°ÌÃÖ
+define("LINE_TOP", 50);				// Àþ¥°¥é¥Õ°ÌÃÖ
+define("LINE_AREA_WIDTH", 600);		// Àþ¥°¥é¥ÕÇØ·Ê¤Î¥µ¥¤¥º
+define("LINE_AREA_HEIGHT", 300);	// Àþ¥°¥é¥ÕÇØ·Ê¤Î¥µ¥¤¥º
+define("LINE_MARK_SIZE", 6);		// Àþ¥°¥é¥Õ¥Þ¡¼¥¯¤Î¥µ¥¤¥º
+define("LINE_SCALE_SIZE", 6);		// ÌÜÀ¹¤êÉý
+define("LINE_XLABEL_MAX", 30);		// X¼´¤Î¥é¥Ù¥ë¤ÎÉ½¼¨À©¸Â¿ô
+define("LINE_XTITLE_PAD", 25);		// X¼´¤Î¥¿¥¤¥È¥ë¤È¼´¤Î´Ö³Ö
+define("LINE_YTITLE_PAD", 15);		// Y¼´¤Î¥¿¥¤¥È¥ë¤È¼´¤Î´Ö³Ö
+
+/* 
+	ËÀ¥°¥é¥Õ
+*/
+define("BAR_PAD", 6);				// ¥°¥é¥Õ¤ÈÌÜÀ¹¤ê¤Î´Ö³Ö
+
+/*
+	¥¿¥¤¥È¥ë¥é¥Ù¥ë
+*/
+define("TITLE_TOP", 10);	// ÇØ·ÊÏÈ¤È¤Î¾åÉý
+
+/*
+	ËÞÎã
+*/
+define("LEGEND_TOP", 10); 	// ÇØ·ÊÏÈ¤È¤Î¾åÉý
+define("LEGEND_RIGHT", 10); // ÇØ·ÊÏÈ¤È¤Î±¦Éý
+
+
+/*
+	É½¼¨¿§
+*/
+// ËÞÎãÇØ·Ê
+$ARR_LEGENDBG_COLOR = array(245,245,245);
+// ¥é¥Ù¥ëÇØ·Ê
+$ARR_LABELBG_COLOR = array(255,255,255);
+// ¥°¥é¥Õ¥«¥é¡¼
+$ARR_GRAPH_RGB = array(
+	array(200,50,50),
+	array(50,50,200),
+	array(50,200,50),
+	array(255,255,255),
+	array(244,200,200),
+	array(200,200,255),
+	array(50,200,50),
+	array(255,255,255),
+	array(244,244,244),
+);
+// ±Æ¤Î¿§
+$ARR_SHADE_COLOR = array(100,100,100);
+// ±ï¤Î¿§
+$ARR_FLAME_COLOR = array(100, 100, 140);
+// Ê¸»ú¿§
+$ARR_TEXT_COLOR = array(55, 55, 55);
+// ÇØ·Ê¥«¥é¡¼
+$ARR_BG_COLOR = array(255,255,255);	
+// ¥¿¥¤¥È¥ëÊ¸»ú¿§
+$ARR_TITLE_COLOR = array(100, 100, 100);
+// ¥°¥ê¥Ã¥ÉÀþ¿§
+$ARR_GRID_COLOR = array(200, 200, 200);
+// ¥Þ¡¼¥¯¤Î¿§
+$ARR_MARK_COLOR = array(130, 130, 255);
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/class/lib.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/class/lib.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/class/lib.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+
+// ±ß¤ÎÃæ¿´ÅÀ¤ÈÄ¾·Â¤«¤é¸Ì¤Î½ªÃ¼ºÂÉ¸¤ò»»½Ð¤¹¤ë¡£
+/*
+	$cx	: Ãæ¿´ÅÀXºÂÉ¸
+	$cy	: Ãæ¿´ÅÀYºÂÉ¸
+	$r	: È¾·Â
+	$e	: ³ÑÅÙ
+*/
+function lfGetArcPos($cx, $cy, $cw, $ch, $e) {
+	// »°³Ñ´Ø¿ôÍÑ¤Î³ÑÅÙ¤òµá¤á¤ë
+	$s = 90 - $e;
+	$r = $cw / 2;
+	// °ÌÃÖ¤òµá¤á¤ë
+	$x = $cx + ($r * cos(deg2rad($s)));
+	$y = $cy - (($r * sin(deg2rad($s))) * ($ch / $cw));		
+	return array(round($x), round($y));
+}
+
+
+
+/* ²èÁü¤Ë¥Æ¥­¥¹¥È¤òÉÁ²è¤¹¤ë */
+function lfImageText($dst_image, $text, $font_size, $left, $top, $font, $arrRGB) {
+	$color = ImageColorAllocate($dst_image, $arrRGB[0], $arrRGB[1], $arrRGB[2]);
+	$text = mb_convert_encoding($text, "UTF-8", "EUC-JP");
+	// É½¼¨³ÑÅÙ	
+	$angle = 0;
+	// ¥Æ¥­¥¹¥ÈÉÁ²è
+	ImageTTFText($dst_image, $font_size, $angle, $left, $top, $color, $font, $text);
+}
+
+// É½¼¨¿§¤Î¼èÆÀ
+function lfGetImageColor($image, $array) {
+	if(count($array) != 3) {
+		return NULL;
+	}
+	$ret = imagecolorallocate($image, $array[0], $array[1], $array[2]);
+	return $ret;
+}
+
+// ±ÆÍÑÉ½¼¨¿§¤Î¼èÆÀ
+function lfGetImageDarkColor($image, $array) {
+	if(count($array) != 3) {
+		return NULL;
+	}
+	$i = 0;
+	foreach($array as $val) {
+		$dark[$i] = $val - 45;
+		if($dark[$i] < 0) {
+			$dark[$i] = 0;
+		}
+		$i++;
+	}
+	$ret = imagecolorallocate($image, $dark[0], $dark[1], $dark[2]);
+	return $ret;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphBar.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphBar.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/class/SC_GraphBar.php	(revision 1328)
@@ -0,0 +1,78 @@
+<?
+$SC_GRAPHBAR_DIR = realpath(dirname( __FILE__));
+require_once($SC_GRAPHBAR_DIR . "/SC_GraphLine.php");	
+
+// ÀÞ¤ìÀþ¥°¥é¥ÕÀ¸À®¥¯¥é¥¹
+class SC_GraphBar extends SC_GraphLine{
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_GraphLine(
+		$bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP,
+		$area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) {
+		parent::SC_GraphLine($bgw, $bgh, $left, $top, $area_width, $area_height);	
+	}
+	
+	// ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawGraph() {
+		$this->drawYLine();
+		$this->drawXLine(true);
+		
+		// ËÀ¥°¥é¥Õ¤ÎÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawBar($i);
+		}
+		
+		// ¥é¥Ù¥ë¤ÎÉÁ²è
+		for($i = 0; $i < $this->line_max; $i++) {
+			$this->drawLabel($i);
+		}
+		
+		// ËÞÎã¤ÎÉÁ²è
+		$this->drawLegend();	
+	}
+	
+	// ËÀ¥°¥é¥Õ¤ÎÉÁ²è
+	function drawBar($line_no) {
+		$arrPointList = $this->arrPointList[$line_no];
+		// ¥Ç¡¼¥¿¿ô¤ò¿ô¤¨¤ë
+		$count = count($arrPointList);
+		// È¾ÌÜÀ¹¤ê¤ÎÉý¤òµá¤á¤ë
+		$half_scale = intval($this->area_width / ($count + 1) / 2);
+		// ÌÜÀ¹¤ê¤ÎÉý¤òµá¤á¤ë
+		$scale_width = intval($this->area_width / ($count + 1));
+		// ËÀ¥°¥é¥Õ¤Î¥µ¥¤¥º¤òµá¤á¤ë
+		$bar_width = intval(($scale_width - (BAR_PAD * 2)) / $this->line_max);
+		// ¿§¿ô¤Î¼èÆÀ
+		$c_max = count($this->arrColor);
+		for($i = 0; $i < $count; $i++) {
+			$left = $arrPointList[$i][0] - $half_scale + BAR_PAD + ($bar_width * $line_no);
+			$top = $arrPointList[$i][1];
+			$right = $left + $bar_width;
+			$bottom = $this->top + $this->area_height;
+			
+			// ±Æ¤ÎÉÁ²è
+			if($this->shade_on) {
+				imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom, $this->shade_color);
+			}
+			//imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[($i % $c_max)]);
+			imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[$line_no]);			
+			imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color);					
+		}
+	}
+	
+	// ¥é¥Ù¥ë¤òÉÁ²è¤¹¤ë
+	function drawLabel($line_no) {
+		$arrData = $this->arrDataList[$line_no];
+		$arrPointList = $this->arrPointList[$line_no];
+		$count = count($arrPointList);
+		for($i = 0; $i < $count; $i++) {
+			$x = $arrPointList[$i][0];
+			$y = $arrPointList[$i][1];
+			$text_width = $this->getTextWidth(number_format($arrData[$i]), FONT_SIZE);
+			$y_pos = $y - FONT_SIZE - 5;
+			$x_pos = $x - $text_width / 2;
+			$this->setText(FONT_SIZE, $x_pos, $y_pos, number_format($arrData[$i]));
+		}
+	}
+	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/total/index_sub.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/total/index_sub.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/total/index_sub.php	(revision 1328)
@@ -0,0 +1,242 @@
+<?php
+
+function lfGetPDFColum($page, $type, $key = "") {
+	
+	$arrSUBNAME['day'] = "ÆüÊÌ";
+	$arrSUBNAME['month'] = "·îÊÌ";
+	$arrSUBNAME['year'] = "Ç¯ÊÌ";
+	$arrSUBNAME['hour'] = "»þ´ÖÊÌ";
+	$arrSUBNAME['wday'] = "ÍËÆüÊÌ";
+	$arrSUBNAME['all'] = "Á´ÂÎ";
+	$arrSUBNAME['member'] = "²ñ°÷";
+	$arrSUBNAME['nonmember'] = "Èó²ñ°÷";
+			
+	switch($page) {
+	// ¾¦ÉÊÊÌ½¸·×
+	case 'products':
+		$title = "¾¦ÉÊÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			60,
+			120,
+			220,
+			80,
+			80,
+			80,
+		);
+		$arrAlign = array(
+			'right',
+			'center',
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	// ¿¦¶ÈÊÌ½¸·×
+	case 'job':
+		$title = "¿¦¶ÈÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			100,
+			100,
+			100,
+			100,
+		);
+		$arrAlign = array(
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	// ²ñ°÷ÊÌ½¸·×
+	case 'member':
+		$title = "²ñ°÷ÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			100,
+			100,
+			100,
+			100,
+		);
+		$arrAlign = array(
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	// Ç¯ÂåÊÌ½¸·×
+	case 'age':
+		$title = "Ç¯ÂåÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			80,
+			100,
+			100,
+			100,
+		);
+		$arrAlign = array(
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	// ´ü´ÖÊÌ½¸·×
+	default:
+		$title = "´ü´ÖÊÌ½¸·×(" . $arrSUBNAME[$type] . ")";
+		$arrColSize = array(
+			60,
+			60,
+			50,
+			50,
+			80,
+			80,
+			80,
+			80,
+			80,
+			80,
+		);
+		$arrAlign = array(
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+			'right',
+		);
+		break;
+	}
+	
+	list($arrTitleCol, $arrDataCol) = lfGetCSVColum($page, $key);
+		
+	return array($arrTitleCol, $arrDataCol, $arrColSize, $arrAlign, $title);
+}
+
+
+function lfGetCSVColum($page, $key = "") {
+	switch($page) {
+	// ¾¦ÉÊÊÌ½¸·×
+	case 'products':
+		$arrTitleCol = array(
+			'¾¦ÉÊÈÖ¹æ',
+			'¾¦ÉÊÌ¾',
+			'¹ØÆþ·ï¿ô',
+			'ÅÀ¿ô',
+			'Ã±²Á',
+			'¶â³Û'			
+		);
+		$arrDataCol = array(
+			'product_code',
+			'name',
+			'order_count',
+			'products_count',
+			'price',
+			'total',
+		);
+		break;
+	// ¿¦¶ÈÊÌ½¸·×
+	case 'job':
+		$arrTitleCol = array(
+			'¿¦¶È',
+			'¹ØÆþ·ï¿ô',
+			'¹ØÆþ¹ç·×',
+			'¹ØÆþÊ¿¶Ñ',
+		);
+		$arrDataCol = array(
+			'job_name',
+			'order_count',
+			'total',
+			'total_average',
+		);
+		break;
+	// ²ñ°÷ÊÌ½¸·×
+	case 'member':
+		$arrTitleCol = array(
+			'²ñ°÷',
+			'¹ØÆþ·ï¿ô',
+			'¹ØÆþ¹ç·×',
+			'¹ØÆþÊ¿¶Ñ',
+		);
+		$arrDataCol = array(
+			'member_name',
+			'order_count',
+			'total',
+			'total_average',
+		);
+		break;
+	// Ç¯ÂåÊÌ½¸·×
+	case 'age':
+		$arrTitleCol = array(
+			'Ç¯Îð',
+			'¹ØÆþ·ï¿ô',
+			'¹ØÆþ¹ç·×',
+			'¹ØÆþÊ¿¶Ñ',
+		);
+		$arrDataCol = array(
+			'age_name',
+			'order_count',
+			'total',
+			'total_average',
+		);
+		break;
+	// ´ü´ÖÊÌ½¸·×
+	default:
+		$arrTitleCol = array(
+			'´ü´Ö',
+			'¹ØÆþ·ï¿ô',
+			'ÃËÀ­',
+			'½÷À­',
+			'ÃËÀ­(²ñ°÷)',
+			'ÃËÀ­(Èó²ñ°÷)',
+			'½÷À­(²ñ°÷)',
+			'½÷À­(Èó²ñ°÷)',
+			'¹ØÆþ¹ç·×',
+			'¹ØÆþÊ¿¶Ñ',		
+		);
+		$arrDataCol = array(
+			$key,
+			'total_order',
+			'men',
+			'women',
+			'men_member',
+			'men_nonmember',
+			'women_member',
+			'women_nonmember',
+			'total',
+			'total_average'
+		);
+		break;
+	}
+	
+	return array($arrTitleCol, $arrDataCol);
+}
+
+// É¬Í×¤Ê¥«¥é¥à¤Î¤ßÃê½Ð¤¹¤ë(CSV¥Ç¡¼¥¿¤Ç¼èÆÀ¤¹¤ë)
+function lfGetDataColCSV($arrData, $arrDataCol) {
+	$max = count($arrData);
+	for($i = 0; $i < $max; $i++) {
+		foreach($arrDataCol as $val) {		
+			$arrRet[$i][$val] = $arrData[$i][$val];
+		}
+		$csv_data.= sfGetCSVList($arrRet[$i]);
+	}
+	return $csv_data;
+}
+
+// É¬Í×¤Ê¥«¥é¥à¤Î¤ßÃê½Ð¤¹¤ë(PDF¥Ç¡¼¥¿¤Ç¼èÆÀ¤¹¤ë)
+function lfGetDataColPDF($arrData, $arrDataCol, $len) {
+	$max = count($arrData);
+	for($i = 0; $i < $max; $i++) {
+		foreach($arrDataCol as $val) {		
+			$arrRet[$i][$val] = sfCutString($arrData[$i][$val], $len);
+		}
+		$csv_data.= sfGetPDFList($arrRet[$i]);
+	}
+	return $csv_data;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/system/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/system/index.php	(revision 3582)
+++ /temp/tags/eccube-0_9_2beta/html/admin/system/index.php	(revision 3582)
@@ -0,0 +1,64 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $tpl_category;	// Ê¬Îà(HOME:1,¿ÍÊªÅÐÏ¿:2,¿ÍÊª¸¡º÷:3,¥·¥¹¥Æ¥à:4,¥í¥°¥¢¥¦¥È:5)
+	var $list_data;		// ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿¼èÆÀÍÑ
+	var $arrAUTHORITY;
+	var $tpl_onload;
+	var $tpl_disppage;	// É½¼¨Ãæ¤Î¥Ú¡¼¥¸ÈÖ¹æ
+	var $tpl_strnavi;
+	function LC_Page() {
+		$this->tpl_mainpage = 'system/index.tpl';
+		$this->tpl_subnavi = 'system/subnavi.tpl';
+		$this->tpl_mainno = 'system';
+		$this->tpl_subno = 'index';
+		$this->tpl_onload = 'fnGetRadioChecked();';
+		$this->tpl_subtitle = '¥á¥ó¥Ð¡¼´ÉÍý';
+		global $arrAUTHORITY;
+		$this->arrAUTHORITY = $arrAUTHORITY;
+	}
+}
+
+// ¥»¥Ã¥·¥ç¥ó¥¯¥é¥¹
+$objSess = new SC_Session();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$conn = new SC_DbConn();
+
+// ¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤ÎÊÝ»ý¥¯¥é¥¹
+$objPage = new LC_Page();
+// SQLºîÀ®ÍÑ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+$objSql = new SC_SelectSql();
+$objSql->setSelect("SELECT member_id,name,department,login_id,authority,rank,work FROM dtb_member");
+$objSql->setOrder("rank DESC");
+$objSql->setWhere("delete <> 1 AND member_id <> ". ADMIN_ID);
+
+//´Ê°×¥¯¥¨¥ê¼Â¹Ô¥ª¥Ö¥¸¥§¥¯¥È
+$oquery = new SC_Query();
+// ¹Ô¿ô¤Î¼èÆÀ
+$linemax = $oquery->count("dtb_member", "delete <> 1 AND member_id <>".ADMIN_ID);
+
+// ²ÔÆ°Ãæ¤Î·ï¿ô¤ò¼èÆÀ
+$workmax = $oquery->count("dtb_member", "work = 1 AND delete <> 1 AND member_id <>".ADMIN_ID);
+$objPage->workmax= $workmax;
+
+// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+$objNavi = new SC_PageNavi($_GET['pageno'], $linemax, MEMBER_PMAX, "fnMemberPage", NAVI_PMAX);
+$objPage->tpl_strnavi = $objNavi->strnavi;
+$objPage->tpl_disppage = $objNavi->now_page;
+$objPage->tpl_pagemax = $objNavi->max_page;
+$startno = $objNavi->start_row;
+
+// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+$objSql->setLimitOffset(MEMBER_PMAX, $startno);
+$objPage->list_data = $conn->getAll($objSql->getSql());
+
+// ¥Ú¡¼¥¸¤ÎÉ½¼¨
+$objView = new SC_AdminView();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/system/csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/system/csv.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/system/csv.php	(revision 1328)
@@ -0,0 +1,8 @@
+"¥¢¥Ã¥×¥Ç¡¼¥Èµ¡Ç½ID","¥Õ¥¡¥¤¥ëÌ¾","µ¡Ç½Ì¾","µ¡Ç½ÀâÌÀ","¥Ð¡¼¥¸¥ç¥ó","ºÇ½ª¹¹¿·Æü»þ"
+"1","DB.tgz","DB´ÉÍýµ¡Ç½","DB¤ò´ÉÍý¤¹¤ëµ¡Ç½¤Ç¤¹¡£","1.0","2006Ç¯£µ·î£±£¶Æü"
+"2","Smarty.tar.gz","¥¹¥Þ¡¼¥Æ¥£¡¼µ¡Ç½","¥¹¡¼¥Þ¡¼¥Æ¥£¡¼µ¡Ç½¤Ç¤¹","2.3","£²£°£°£¶Ç¯£µ·î£±£¶Æü"
+"3","Mail.tgz","¥á¡¼¥ë","¤³¤ì¤Þ¤¿¥Û¥²µ¡Ç½¤Î¥ê¥ê¡¼¥¹¤Ç¤¹","3.5","2006Ç¯5·î£²£³Æü"
+"4","PEAR.tgz","PEARµ¡Ç½","Íü¤Ç¤Ï¤Ê¤¤¤è¤ó","2.2","2006Ç¯8·î1Æü"
+"5","upload_file.tgz","¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë·²","¤­¤ç¡¼¤ì¤Ä¤Ñ¤Ã¤±¡¼¤¸¡ª","10.3","2006/4/5"
+"6","Mail_Mime.tgz","¤á¡¼¤ë¤Þ¤¤¤à","¤­¤ç¡¼¤ì¤Ä¤Ñ¤Ã¤±¡¼¤¸¡ª¤á¡¼¤ë¤Þ¤¤¤à","10.3","2006/4/5"
+"7","point.tgz","¥Ý¥¤¥ó¥ÈÉÕÍ¿µ¡Ç½","¾¦ÉÊ¤Ë¥Ý¥¤¥ó¥È¤òÉÕÍ¿¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£","10.3","2006/4/5"
Index: /temp/tags/eccube-0_9_2beta/html/admin/system/rank.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/system/rank.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/system/rank.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+require_once("../require.php");
+
+$conn = new SC_DbConn();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥é¥ó¥­¥ó¥°¤ÎÊÑ¹¹
+if($_GET['move'] == 'up') {
+	// ÀµÅö¤Ê¿ôÃÍ¤Ç¤¢¤Ã¤¿¾ì¹ç
+	if(sfIsInt($_GET['id'])){
+		lfRunkUp($conn, $_GET['id']);
+	} else {
+		// ¥¨¥é¡¼½èÍý
+		gfPrintLog("error id=".$_GET['id']);
+	}
+} else if($_GET['move'] == 'down') {
+	if(sfIsInt($_GET['id'])){
+		lfRunkDown($conn, $_GET['id']);
+	}  else {
+		// ¥¨¥é¡¼½èÍý
+		gfPrintLog("error id=".$_GET['id']);
+	}
+}
+
+// ¥Ú¡¼¥¸¤ÎÉ½¼¨
+$location = "Location: " . URL_SYSTEM_TOP . "?pageno=".$_GET['pageno'];
+header($location);
+
+// ¥é¥ó¥­¥ó¥°¤ò¾å¤²¤ë¡£
+function lfRunkUp($conn, $id) {
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
+	$rank = $conn->getOne("SELECT rank FROM dtb_member WHERE member_id = ".$id);
+	// ¥é¥ó¥¯¤ÎºÇÂçÃÍ¤ò¼èÆÀ¤¹¤ë¡£
+	$maxno = $conn->getOne("SELECT max(rank) FROM dtb_member");
+	// ¥é¥ó¥¯¤¬ºÇÂçÃÍ¤è¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+	if($rank < $maxno) {
+		// ¥é¥ó¥¯¤¬¤Ò¤È¤Ä¾å¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+		$sqlse = "SELECT member_id FROM dtb_member WHERE rank = ?";
+		$up_id = $conn->getOne($sqlse, $rank + 1);
+		// ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
+		$conn->query("BEGIN");
+		$sqlup = "UPDATE dtb_member SET rank = ? WHERE member_id = ?";
+		$conn->query($sqlup, array($rank + 1, $id));
+		$conn->query($sqlup, array($rank, $up_id));
+		$conn->query("COMMIT");
+	}
+}
+
+// ¥é¥ó¥­¥ó¥°¤ò²¼¤²¤ë¡£
+function lfRunkDown($conn, $id) {
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
+	$rank = $conn->getOne("SELECT rank FROM dtb_member WHERE member_id = ".$id);
+	// ¥é¥ó¥¯¤ÎºÇ¾®ÃÍ¤ò¼èÆÀ¤¹¤ë¡£
+	$minno = $conn->getOne("SELECT min(rank) FROM dtb_member");
+	// ¥é¥ó¥¯¤¬ºÇÂçÃÍ¤è¤ê¤âÂç¤­¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+	if($rank > $minno) {
+		// ¥é¥ó¥¯¤¬¤Ò¤È¤Ä²¼¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+		$sqlse = "SELECT member_id FROM dtb_member WHERE rank = ?";
+		$down_id = $conn->getOne($sqlse, $rank - 1);
+		// ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
+		$conn->query("BEGIN");
+		$sqlup = "UPDATE dtb_member SET rank = ? WHERE member_id = ?";
+		$conn->query($sqlup, array($rank - 1, $id));
+		$conn->query($sqlup, array($rank, $down_id));
+		$conn->query("COMMIT");
+	}
+}	
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/system/check.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/system/check.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/system/check.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+/*
+ *		check.php ²ÔÆ¯¡¦Èó²ÔÆ¯¤ÎÀÚÂØ
+ */
+require_once("../require.php");
+
+$conn = new SC_DbConn();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// GETÃÍ¤ÎÀµÅöÀ­¤òÈ½Äê¤¹¤ë
+if(sfIsInt($_GET['id']) && ($_GET['no'] == 1 || $_GET['no'] == 0)){
+	$sqlup = "UPDATE dtb_member SET work = ? WHERE member_id = ?";
+	$conn->query($sqlup, array($_GET['no'], $_GET['id']));
+} else {
+	// ¥¨¥é¡¼½èÍý
+	gfPrintLog("error id=".$_GET['id']);
+}
+
+// ¥Ú¡¼¥¸¤ÎÉ½¼¨
+$location = "Location: " . URL_SYSTEM_TOP . "?pageno=".$_GET['pageno'];
+header($location);
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/system/input.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/system/input.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/system/input.php	(revision 1328)
@@ -0,0 +1,192 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	var $arrErr;		// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸½ÐÎÏÍÑ
+	var $tpl_recv;		// ÆþÎÏ¾ðÊóPOSTÀè
+	var $tpl_onload;	// ¥Ú¡¼¥¸ÆÉ¤ß¹þ¤ß»þ¤Î¥¤¥Ù¥ó¥È
+	var $arrForm;		// ¥Õ¥©¡¼¥à½ÐÎÏÍÑ
+	var $tpl_mode;		// ¿·µ¬ºîÀ®:new or ÊÔ½¸:edit
+	var $tpl_member_id; // ÊÔ½¸»þ¤Ë»ÈÍÑ¤¹¤ë¡£
+	var $tpl_pageno;
+	var $tpl_onfocus;	// ¥Ñ¥¹¥ï¡¼¥É¹àÌÜÁªÂò»þ¤Î¥¤¥Ù¥ó¥ÈÍÑ
+	var $tpl_old_login_id;
+	function LC_Page() {
+		$this->tpl_recv =  'input.php';
+		$this->tpl_pageno = $_REQUEST['pageno'];
+		$this->SHORTTEXT_MAX = STEXT_LEN;
+		$this->MIDDLETEXT_MAX = MTEXT_LEN;
+		$this->LONGTEXT_MAX = LTEXT_LEN;
+		global $arrAUTHORITY;
+		$this->arrAUTHORITY = $arrAUTHORITY;
+	}
+}
+
+$conn = new SC_DbConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// member_id¤¬»ØÄê¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¡¢ÊÔ½¸¥â¡¼¥É¤È¤¹¤ë¡£
+if(sfIsInt($_GET['id'])) {
+	$objPage->tpl_mode = 'edit';
+	$objPage->tpl_member_id = $_GET['id'];
+	$objPage->tpl_onfocus = "fnClearText(this.name);";
+	// DB¤Î¥á¥ó¥Ð¡¼¾ðÊó¤òÆÉ¤ß½Ð¤¹
+	$data_list = fnGetMember($conn, $_GET['id']);
+	// ³ºÅö¥æ¡¼¥¶¤òÉ½¼¨¤µ¤»¤ë
+	$objPage->arrForm = $data_list[0];
+	// ¥À¥ß¡¼¤Î¥Ñ¥¹¥ï¡¼¥É¤ò¥»¥Ã¥È¤·¤Æ¤ª¤¯¡£
+	$objPage->arrForm['password'] = DUMMY_PASS;
+	// ¥í¥°¥¤¥óID¤òÊÝ´É¤·¤Æ¤ª¤¯¡£
+	$objPage->tpl_old_login_id = $data_list[0]['login_id'];
+} else {
+	// ¿·µ¬ºîÀ®¥â¡¼¥É
+	$objPage->tpl_mode = "new";
+	$objPage->arrForm['authority'] = -1;
+}
+
+// ¿·µ¬ºîÀ®¥â¡¼¥É or ÊÔ½¸¥â¡¼¥É
+if( $_POST['mode'] == 'new' || $_POST['mode'] == 'edit') {
+	// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = fnErrorCheck($conn);
+	
+	// ÆþÎÏ¤¬Àµ¾ï¤Ç¤¢¤Ã¤¿¾ì¹ç¤Ï¡¢DB¤Ë½ñ¤­¹þ¤à
+	if(count($objPage->arrErr) == 0) {
+		if($_POST['mode'] == 'new') {
+			// ¥á¥ó¥Ð¡¼¤ÎÄÉ²Ã
+			fnInsertMember();
+			// ¥ê¥í¡¼¥É¤Ë¤è¤ëÆó½ÅÅÐÏ¿ÂÐºö¤Î¤¿¤á¡¢Æ±¤¸¥Ú¡¼¥¸¤ËÈô¤Ð¤¹¡£
+			header("Location: ". $_SERVER['PHP_SELF'] . "?mode=reload");	
+			exit;
+		}
+		if($_POST['mode'] == 'edit') {
+			// ¥á¥ó¥Ð¡¼¤ÎÄÉ²Ã
+			if(fnUpdateMember($_POST['member_id'])) {
+				// ¿Æ¥¦¥£¥ó¥É¥¦¤ò¹¹¿·¸å¡¢¼«¥¦¥£¥ó¥É¥¦¤òÊÄ¤¸¤ë¡£
+				$url = URL_SYSTEM_TOP . "?pageno=".$_POST['pageno'];
+				$objPage->tpl_onload="fnUpdateParent('".$url."'); window.close();";
+			}
+		}
+	// ÆþÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç
+	} else {
+		// ¥â¡¼¥É¤ÎÀßÄê
+		$objPage->tpl_mode = $_POST['mode'];
+		$objPage->tpl_member_id = $_POST['member_id'];
+		$objPage->tpl_old_login_id = $_POST['old_login_id'];
+		// ¤¹¤Ç¤ËÆþÎÏ¤·¤¿ÃÍ¤òÉ½¼¨¤¹¤ë¡£
+		$objPage->arrForm = $_POST;
+		// ÄÌ¾ïÆþÎÏ¤Î¥Ñ¥¹¥ï¡¼¥É¤Ï°ú¤­·Ñ¤¬¤Ê¤¤¡£
+		if($objPage->arrForm['password'] != DUMMY_PASS) {
+			$objPage->arrForm['password'] = '';
+		}
+	}
+}
+
+// ¥ê¥í¡¼¥É¤Î»ØÄê¤¬¤¢¤Ã¤¿¾ì¹ç
+if( $_GET['mode'] == 'reload') {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ò¹¹¿·¤¹¤ë¤è¤¦¤Ë¥»¥Ã¥È¤¹¤ë¡£
+	$url = URL_SYSTEM_TOP;
+	$objPage->tpl_onload="fnUpdateParent('".$url."')";
+}
+
+// ¥Æ¥ó¥×¥ì¡¼¥ÈÍÑÊÑ¿ô¤Î³ä¤êÅö¤Æ
+$objView->assignobj($objPage);
+$objView->display('system/input.tpl');
+
+/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
+function fnErrorCheck($conn) {
+	
+	$objErr = new SC_CheckError();
+	
+	$_POST["name"] = mb_convert_kana($_POST["name"] ,"KV");
+	$_POST["department"] = mb_convert_kana($_POST["department"] ,"KV");
+	
+	// Ì¾Á°¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("Ì¾Á°",'name'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("Ì¾Á°",'name',STEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
+	
+	// ÊÔ½¸¥â¡¼¥É¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢½ÅÊ£¥Á¥§¥Ã¥¯
+	if (!isset($objErr->arrErr['name']) && $_POST['mode'] != 'edit') {
+		$sql = "SELECT name FROM dtb_member WHERE delete <> 1 AND name = ?";
+		$result = $conn->getOne($sql, array($_POST['name'])); 
+		if ( $result ) {
+			$objErr->arrErr['name'] = "´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÌ¾Á°¤Ê¤Î¤ÇÍøÍÑ¤Ç¤­¤Þ¤»¤ó¡£<br>";
+		}
+	}
+		
+	// ¥í¥°¥¤¥óID¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("¥í¥°¥¤¥óID",'login_id'), array("EXIST_CHECK", "ALNUM_CHECK"));
+	$objErr->doFunc(array("¥í¥°¥¤¥óID",'login_id',ID_MIN_LEN , ID_MAX_LEN) ,array("NUM_RANGE_CHECK"));
+	
+	// ¿·µ¬¥â¡¼¥É¤â¤·¤¯¤Ï¡¢ÊÔ½¸¥â¡¼¥É¤Ç¥í¥°¥¤¥óID¤¬ÊÑ¹¹¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	if (!isset($objErr->arrErr['login_id']) && $_POST['mode'] != 'edit' || ($_POST['mode'] == 'edit' && $_POST['login_id'] != $_POST['old_login_id'])) {
+		$sql = "SELECT login_id FROM dtb_member WHERE delete <> 1 AND login_id = ?";
+		$result = $conn->getOne($sql, array($_POST['login_id'])); 
+		if ( $result != "" ) {
+			$objErr->arrErr['login_id'] = "´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëID¤Ê¤Î¤ÇÍøÍÑ¤Ç¤­¤Þ¤»¤ó¡£<br>";
+		}
+	}
+	
+	// ¥Ñ¥¹¥ï¡¼¥É¥Á¥§¥Ã¥¯(ÊÔ½¸¥â¡¼¥É¤ÇDUMMY_PASS¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¥¹¥ë¡¼¤¹¤ë)
+	if(!($_POST['mode'] == 'edit' && $_POST['password'] == DUMMY_PASS)) { 
+		$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É",'password'), array("EXIST_CHECK", "ALNUM_CHECK"));
+		if (!$arrErr['password']) {
+			// ¥Ñ¥¹¥ï¡¼¥É¤Î¥Á¥§¥Ã¥¯
+			$objErr->doFunc( array("¥Ñ¥¹¥ï¡¼¥É",'password',4 ,15 ) ,array( "NUM_RANGE_CHECK" ) );	
+		}
+	}
+	
+	// ¸¢¸Â¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("¸¢¸Â",'authority'),array("EXIST_CHECK"));
+	return $objErr->arrErr;
+}
+
+/* DB¤Ø¤Î¥Ç¡¼¥¿ÁÞÆþ */
+function fnInsertMember() {
+	// ¥¯¥¨¥ê¡¼¥¯¥é¥¹¤ÎÀë¸À
+	$oquery = new SC_Query();
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $_POST['name'];
+	$sqlval['department'] = $_POST['department'];
+	$sqlval['login_id'] = $_POST['login_id'];
+	$sqlval['password'] = crypt($_POST['password']);
+	$sqlval['authority'] = $_POST['authority'];
+	$sqlval['rank']=  $oquery->max("dtb_member", "rank") + 1;
+	$sqlval['work'] = "1"; // ²ÔÆ¯¤ËÀßÄê
+	$sqlval['delete'] = "0";	// ºï½ü¥Õ¥é¥°¤òOFF¤ËÀßÄê
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	// INSERT¤Î¼Â¹Ô
+	$ret = $oquery->insert("dtb_member", $sqlval);
+	return $ret;
+}
+
+/* DB¤Ø¤Î¥Ç¡¼¥¿¹¹¿· */
+function fnUpdateMember($id) {
+	// ¥¯¥¨¥ê¡¼¥¯¥é¥¹¤ÎÀë¸À
+	$oquery = new SC_Query();
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $_POST['name'];
+	$sqlval['department'] = $_POST['department'];
+	$sqlval['login_id'] = $_POST['login_id'];
+	if($_POST['password'] != DUMMY_PASS) {
+		$sqlval['password'] = crypt($_POST['password']);
+	}
+	$sqlval['authority'] = $_POST['authority'];
+	$sqlval['update_date'] = "now()";
+	// UPDATE¤Î¼Â¹Ô
+	$where = "member_id = " . $id;
+	$ret = $oquery->update("dtb_member", $sqlval, $where);
+	return $ret;
+}
+
+/* DB¤«¤é¥Ç¡¼¥¿¤ÎÆÉ¤ß¹þ¤ß */
+function fnGetMember($conn, $id) {
+	$sqlse = "SELECT name,department,login_id,authority FROM dtb_member WHERE member_id = ?";
+	$ret = $conn->getAll($sqlse, Array($id));
+	return $ret;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/system/delete.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/system/delete.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/system/delete.php	(revision 1328)
@@ -0,0 +1,47 @@
+<?php
+require_once("../require.php");
+
+$conn = new SC_DbConn();
+$oquery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// member_id¤Î¥Á¥§¥Ã¥¯
+if(sfIsInt($_GET['id'])){
+	// ¥ì¥³¡¼¥É¤Îºï½ü
+	$conn->query("BEGIN");
+	fnRenumberRank($conn, $oquery, $_GET['id']);
+	fnDeleteRecord($conn, $_GET['id']);
+	$conn->query("COMMIT");
+} else {
+	// ¥¨¥é¡¼½èÍý
+	gfPrintLog("error id=".$_GET['id']);
+}
+
+// ¥Ú¡¼¥¸¤ÎÉ½¼¨
+$location = "Location: " . URL_SYSTEM_TOP . "?pageno=".$_GET['pageno'];
+header($location);
+
+// ¥é¥ó¥­¥ó¥°¤Î¿¶¤êÄ¾¤·
+function fnRenumberRank($conn, $oquery, $id) {
+	$where = "member_id = $id";
+	// ¥é¥ó¥¯¤Î¼èÆÀ
+	$rank = $oquery->get("dtb_member", "rank", $where);
+	// ºï½ü¤·¤¿¥ì¥³¡¼¥É¤è¤ê¾å¤Î¥é¥ó¥­¥ó¥°¤ò²¼¤²¤ÆRANK¤Î¶õ¤­¤òËä¤á¤ë¡£
+	$sqlup = "UPDATE dtb_member SET rank = (rank - 1) WHERE rank > $rank AND delete <> 1";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $conn->query($sqlup);
+	return $ret;
+}
+
+// ¥ì¥³¡¼¥É¤Îºï½ü(ºï½ü¥Õ¥é¥°¤òON¤Ë¤¹¤ë)
+function fnDeleteRecord($conn, $id) {
+	// ¥é¥ó¥¯¤òºÇ²¼°Ì¤Ë¤¹¤ë¡¢DEL¥Õ¥é¥°ON
+	$sqlup = "UPDATE dtb_member SET rank = 0, delete = 1 WHERE member_id = $id";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $conn->query($sqlup);
+	return $ret;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/system/member_csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/system/member_csv.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/system/member_csv.php	(revision 1328)
@@ -0,0 +1,41 @@
+<?php
+require_once("../require.php");
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$data = lfGetCSVData();
+sfCSVDownload($data);
+exit();
+
+function lfGetCSVData() {
+	global $arrAUTHORITY;
+	global $arrWORK;
+	
+	$oquery = new SC_Query();
+	$cols = "authority,name,department,login_id,work";
+	$oquery->setwhere("delete <> 1");
+	$oquery->andwhere("member_id <> ".ADMIN_ID);
+	$oquery->setoption("ORDER BY rank DESC");
+	$list_data = $oquery->select($cols, "dtb_member");
+	$max = count($list_data);
+	
+	for($i = 0; $i < $max; $i++ ){
+		$line = "";
+		$line .= "\"".$arrAUTHORITY[$list_data[$i]['authority']]."\",";
+		$tmp = ereg_replace("\"","\"\"",$list_data[$i]['name']);
+		$line .= "\"".$tmp."\",";
+		$tmp = ereg_replace("\"","\"\"",$list_data[$i]['department']);
+		$line .= "\"".$tmp."\",";
+		$tmp = ereg_replace("\"","\"\"",$list_data[$i]['login_id']);
+		$line .= "\"".$tmp."\",";
+		$line .= "\"".$arrWORK[$list_data[$i]['work']]."\"\n";
+		$data .= $line;
+	}
+	
+	$header = "\"¸¢¸Â\",\"Ì¾Á°\",\"½êÂ°\",\"¥í¥°¥¤¥óID\",\"²ÔÆ¯¾õ¶·\"\n";
+	
+	return $header.$data;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/system/update.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/system/update.php	(revision 3677)
+++ /temp/tags/eccube-0_9_2beta/html/admin/system/update.php	(revision 3677)
@@ -0,0 +1,266 @@
+<?php
+require_once("../require.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = 'system/update.tpl';
+		$this->tpl_subnavi = 'system/subnavi.tpl';
+		$this->tpl_mainno = 'system';		
+		$this->tpl_subno = 'update';
+		$this->tpl_subtitle = '¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍý';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+// ¥»¥Ã¥·¥ç¥ó¥¯¥é¥¹
+$objSess = new SC_Session();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+switch($_POST['mode']) {
+// ¥¢¥Ã¥×¥Ç¡¼¥È¾ðÊó¥Õ¥¡¥¤¥ë¤ò¼èÆÀ
+case 'edit':
+	// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+	lfLoadUpdateList();
+	break;
+// ¥¤¥ó¥¹¥È¡¼¥ë
+case 'install':
+	// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+	lfLoadUpdateList();
+	// ¥â¥¸¥å¡¼¥ë·´¤Î¥¤¥ó¥¹¥È¡¼¥ë
+	lfInstallModule();
+	break;
+// ¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë
+case 'uninstall':
+	// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+	lfLoadUpdateList();
+	// ¥â¥¸¥å¡¼¥ë·´¤Î¥¤¥ó¥¹¥È¡¼¥ë	
+	lfUninstallModule();
+	break;
+default:
+	break;
+}
+
+$col = "module_id, module_name, now_version, latest_version, module_explain, create_date, release_date";
+$objQuery->setorder("module_id");
+$objPage->arrUpdate = $objQuery->select($col, "dtb_update");
+
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display(MAIN_FRAME);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+//-------------------------------------------------------------------------------------------------------
+// ¹¹¿·¥Õ¥¡¥¤¥ë¤Î¼èÆÀ
+function lfCopyUpdateFile($val) {
+	global $objPage;
+	
+	$src_path = sfRmDupSlash(UPDATE_HTTP . $val . ".txt");
+	$dst_path = sfRmDupSlash(ROOT_DIR . $val);
+	$flg_ok = true;	// ½èÍý¤ÎÀ®¸ùÈ½Äê
+	
+	$src_fp = @fopen($src_path, "rb");
+	
+	if(!$src_fp) {
+		sfErrorHeader(">> " . $src_path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+		$flg_ok = false;
+	} else {
+		// ¥Õ¥¡¥¤¥ë¤ò¤¹¤Ù¤ÆÆÉ¤ß¹þ¤à
+		$contents = '';
+		while (!feof($src_fp)) {
+			$contents .= fread($src_fp, 1024);
+		}
+		fclose($src_fp);
+		
+		// ¥Ç¥£¥ì¥¯¥È¥êºîÀ®¤ò»î¤ß¤ë
+		lfMakeDirectory($dst_path);
+		// ¥Õ¥¡¥¤¥ë½ñ¹þ¤ß		
+		$dst_fp = @fopen($dst_path, "wb");
+		if(!$dst_fp) {
+			sfErrorHeader(">> " . $dst_path . "¤ò¥ª¡¼¥×¥ó¤Ç¤­¤Þ¤»¤ó¡£");
+			$flg_ok = false;
+		} else {
+			fwrite($dst_fp, $contents);
+			fclose($dst_fp);
+		}
+	}
+	
+	if($flg_ok) {
+		$objPage->update_mess.= ">> " . $dst_path . "¡§¥³¥Ô¡¼À®¸ù<br>";
+	} else {
+		$objPage->update_mess.= ">> " . $dst_path . "¡§¥³¥Ô¡¼¼ºÇÔ<br>";		
+	}
+	
+	return $flg_ok;
+}
+
+// ¤¹¤Ù¤Æ¤Î¥Ñ¥¹¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¤¹¤ë
+function lfMakeDirectory($path) {
+	$pos = 0;
+	$cnt = 0;				// Ìµ¸Â¥ë¡¼¥×ÂÐºö
+	$len = strlen($path);	// Ìµ¸Â¥ë¡¼¥×ÂÐºö
+	
+	while($cnt <= $len) {
+		$pos = strpos($path, "/", $pos);
+		// ¤³¤³¤Ç¤ÎÈ½Äê¤Ï¡¢Åù¹æ3¤Ä¤ò»ÈÍÑ
+		if($pos === false) {
+			// ¥¹¥é¥Ã¥·¥å¤¬¸«¤Ä¤«¤é¤Ê¤¤¾ì¹ç¤Ï¥ë¡¼¥×¤«¤éÈ´¤±¤ë
+			break;
+		}
+		$pos++; // Ê¸»úÈ¯¸«°ÌÃÖ¤ò°ìÊ¸»ú¿Ê¤á¤ë
+		$dir = substr($path, 0, $pos);
+		
+		// ¤¹¤Ç¤ËÂ¸ºß¤¹¤ë¤«¤É¤¦¤«Ä´¤Ù¤ë
+		if(!file_exists($dir)) {
+			mkdir($dir);
+		}
+		$cnt++; // Ìµ¸Â¥ë¡¼¥×ÂÐºö
+	}
+}
+
+// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+function lfLoadUpdateList() {
+	$objQuery = new SC_Query();
+	$path = UPDATE_HTTP . "update.txt";
+	$fp = @fopen($path, "rb");
+	
+	if(!$fp) {
+		sfErrorHeader(">> " . $path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+	} else {
+		while (!feof($fp)) {
+			$arrCSV = fgetcsv($fp, UPDATE_CSV_LINE_MAX);
+			// ¥«¥é¥à¿ô¤¬Àµ¾ï¤Ç¤¢¤Ã¤¿¾ì¹ç¤Î¤ß
+			if(count($arrCSV) == UPDATE_CSV_COL_MAX) {
+				// ¼èÆÀ¤·¤¿¥¢¥Ã¥×¥Ç¡¼¥È¾ðÊó¤òDB¤Ë½ñ¤­¹þ¤à
+				$sqlval['module_id'] = $arrCSV[0];
+				$sqlval['module_name'] = $arrCSV[1];
+				$sqlval['latest_version'] = $arrCSV[3];
+				$sqlval['module_explain'] = $arrCSV[4];
+				$sqlval['main_php'] = $arrCSV[5];
+				$sqlval['extern_php'] = $arrCSV[6];
+				$sqlval['sql'] = $arrCSV[7];
+				$sqlval['uninstall_sql'] = $arrCSV[8];				
+				$sqlval['other_files'] = $arrCSV[9];
+				$sqlval['delete'] = $arrCSV[10];
+				$sqlval['update_date'] = "now()";
+				$sqlval['release_date'] = $arrCSV[12];
+				// ´ûÂ¸¥ì¥³¡¼¥É¤Î¥Á¥§¥Ã¥¯
+				$cnt = $objQuery->count("dtb_update", "module_id = ?", array($sqlval['module_id']));
+				if($cnt > 0) {
+					// ¤¹¤Ç¤Ë¼èÆÀ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¹¹¿·¤¹¤ë¡£	
+					$objQuery->update("dtb_update", $sqlval, "module_id = ?", array($sqlval['module_id']));
+				} else {
+					// ¿·µ¬¥ì¥³¡¼¥É¤ÎÄÉ²Ã
+					$objQuery->insert("dtb_update", $sqlval);
+				}
+			}
+		}
+		fclose($fp);
+	}
+}
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½èÍý
+function lfInstallModule() {
+	global $objPage;
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("module_id, extern_php, other_files, sql, latest_version", "dtb_update", "module_id = ?", array($_POST['module_id']));
+	$flg_ok = true;	// ½èÍý¤ÎÀ®¸ùÈ½Äê
+	
+	if(count($arrRet) > 0) {
+		$arrFiles = array();
+		if($arrRet[0]['other_files'] != "") {
+			$arrFiles = split("\|", $arrRet[0]['other_files']);
+		}
+		$arrFiles[] = $arrRet[0]['extern_php'];
+		foreach($arrFiles as $val) {
+			// ¹¹¿·¥Õ¥¡¥¤¥ë¤Î¼èÆÀ
+			$ret=lfCopyUpdateFile($val);
+			if(!$ret) {
+				$flg_ok = false;
+			}
+		}
+	} else {
+		sfErrorHeader(">> ÂÐ¾Ý¤Îµ¡Ç½¤Ï¡¢ÇÛÉÛ¤ò½ªÎ»¤·¤Æ¤ª¤ê¤Þ¤¹¡£");
+		$flg_ok = false;
+	}
+	
+	// É¬Í×¤ÊSQLÊ¸¤Î¼Â¹Ô
+	if($arrRet[0]['sql'] != "") {
+		// SQLÊ¸¼Â¹Ô¡¢¥Ñ¥é¡¼¥á¡¼¥¿¤Ê¤·¡¢¥¨¥é¡¼Ìµ»ë
+		$ret = $objQuery->query($arrRet[0]['sql'],"",true);
+		if(DB::isError($ret)) {
+			// ¥¨¥é¡¼Ê¸¤ò¼èÆÀ¤¹¤ë
+			ereg("\[(.*)\]", $ret->userinfo, $arrKey);
+			$objPage->update_mess.=">> ¥Æ¡¼¥Ö¥ë¹½À®¤ÎÊÑ¹¹¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";
+			$objPage->update_mess.= $arrKey[0] . "<br>";
+			$flg_ok = false;
+		} else {
+			$objPage->update_mess.=">> ¥Æ¡¼¥Ö¥ë¹½À®¤ÎÊÑ¹¹¤ò¹Ô¤¤¤Þ¤·¤¿¡£<br>";
+		}
+	}
+	
+	if($flg_ok) {
+		$sqlval['now_version'] = $arrRet[0]['latest_version'];
+		$sqlval['update_date'] = "now()";
+		$objQuery->update("dtb_update", $sqlval, "module_id = ?", array($arrRet[0]['module_id']));
+	}
+}
+
+// ¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë½èÍý
+function lfUninstallModule() {
+	global $objPage;
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("module_id, extern_php, other_files, sql, uninstall_sql, latest_version", "dtb_update", "module_id = ?", array($_POST['module_id']));
+	$flg_ok = true;	// ½èÍý¤ÎÀ®¸ùÈ½Äê
+	
+	if(count($arrRet) > 0) {
+		$arrFiles = array();
+		if($arrRet[0]['other_files'] != "") {
+			$arrFiles = split("\|", $arrRet[0]['other_files']);
+		}
+		$arrFiles[] = $arrRet[0]['extern_php'];
+		foreach($arrFiles as $val) {
+			$path = ROOT_DIR . $val;
+			if(file_exists($path)) {
+				// ¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë
+				if(unlink($path)) {
+					$objPage->update_mess.= ">> " . $path . "¡§ºï½üÀ®¸ù<br>";
+				} else {
+					$objPage->update_mess.= ">> " . $path . "¡§ºï½ü¼ºÇÔ<br>";
+				}
+			}
+		}
+		
+		// É¬Í×¤ÊSQLÊ¸¤Î¼Â¹Ô
+		if($arrRet[0]['uninstall_sql'] != "") {
+			// SQLÊ¸¼Â¹Ô¡¢¥Ñ¥é¡¼¥á¡¼¥¿¤Ê¤·¡¢¥¨¥é¡¼Ìµ»ë
+			$ret = $objQuery->query($arrRet[0]['uninstall_sql'],"",true);
+			if(DB::isError($ret)) {
+				// ¥¨¥é¡¼Ê¸¤ò¼èÆÀ¤¹¤ë
+				ereg("\[(.*)\]", $ret->userinfo, $arrKey);
+				$objPage->update_mess.=">> ¥Æ¡¼¥Ö¥ë¹½À®¤ÎÊÑ¹¹¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";
+				$objPage->update_mess.= $arrKey[0] . "<br>";
+				$flg_ok = false;
+			} else {
+				$objPage->update_mess.=">> ¥Æ¡¼¥Ö¥ë¹½À®¤ÎÊÑ¹¹¤ò¹Ô¤¤¤Þ¤·¤¿¡£<br>";
+			}
+		}		
+	} else {
+		sfErrorHeader(">> ÂÐ¾Ý¤Îµ¡Ç½¤Ï¡¢ÇÛÉÛ¤ò½ªÎ»¤·¤Æ¤ª¤ê¤Þ¤¹¡£");
+	}
+	
+	if($flg_ok) {
+		// ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òºï½ü¤¹¤ë¡£
+		$sqlval['now_version'] = "";
+		$sqlval['update_date'] = "now()";
+		$objQuery->update("dtb_update", $sqlval, "module_id = ?", array($arrRet[0]['module_id']));
+	}
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/contents/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/contents/index.php	(revision 2736)
+++ /temp/tags/eccube-0_9_2beta/html/admin/contents/index.php	(revision 2736)
@@ -0,0 +1,269 @@
+<?php
+
+require_once("../require.php");
+
+//---- Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+//---- ¥Ú¡¼¥¸É½¼¨¥¯¥é¥¹
+class LC_Page {
+	
+	var $arrSession;
+	var $tpl_mainpage;
+	var $sub_navipage;
+	var $regist_data;
+	var $arrYear;
+	var $arrMonth;
+	var $arrDate;
+	var $selected_year;
+	var $selected_month;
+	var $selected_day;
+	var $list_data;
+	var $max_rank;
+	var $edit_mode;
+	var $news_title;
+	var $news_date_unix;
+	var $news_url;
+	var $link_method;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/index.tpl';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "index";
+		$this->tpl_mainno = 'contents';
+		$this->selected_year = date("Y");
+		$this->selected_month = date("n");
+		$this->selected_day = date("j");
+		$this->tpl_subtitle = '¿·Ãå¾ðÊó´ÉÍý';
+	}
+}
+
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$conn = new SC_DbConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objDate = new SC_Date(ADMIN_NEWS_STARTYEAR);
+
+//----¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrYear = $objDate->getYear();
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+//----¡¡¿·µ¬ÅÐÏ¿/ÊÔ½¸ÅÐÏ¿
+if ( $_POST['mode'] == 'regist'){
+	$_POST = lfConvData($_POST);
+
+	if ($objPage->arrErr = lfErrorCheck()) {		// ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+		foreach($_POST as $key => $val) {
+			$objPage->$key = $val;
+		}
+		$objPage->selected_year = $_POST["year"];
+		$objPage->selected_month = $_POST["month"];
+		$objPage->selected_day = $_POST["day"];
+
+	} else {
+		
+		if (isset($_POST['link_method']) == ""){
+			$_POST['link_method'] = 1;
+		}
+		
+		$registDate = $_POST['year'] ."/". $_POST['month'] ."/". $_POST['day'];
+
+		//-- ÊÔ½¸ÅÐÏ¿
+		if (strlen($_POST["news_id"]) > 0 && is_numeric($_POST["news_id"])) {
+
+			lfNewsUpdate();
+
+		//--¡¡¿·µ¬ÅÐÏ¿
+		} else {
+			lfNewsInsert();
+		}
+
+		$objPage->tpl_onload = "window.alert('ÊÔ½¸¤¬´°Î»¤·¤Þ¤·¤¿');";
+	}
+}
+
+//----¡¡ÊÔ½¸¥Ç¡¼¥¿¼èÆÀ
+if ($_POST["mode"] == "search" && is_numeric($_POST["news_id"])) {
+	$sql = "SELECT *, EXTRACT(EPOCH FROM news_date) AS news_date_unix FROM dtb_news WHERE news_id = ? ";
+	$result = $conn->getAll($sql, array($_POST["news_id"]));
+	foreach($result[0] as $key => $val ){
+		$objPage->$key = $val;
+	}
+	$objPage->selected_year = date("Y", $result[0]["news_date_unix"]);		
+	$objPage->selected_month = date("m", $result[0]["news_date_unix"]);
+	$objPage->selected_day = date("d", $result[0]["news_date_unix"]);
+	$objPage->edit_mode = "on";
+}
+
+//----¡¡¥Ç¡¼¥¿ºï½ü
+if ( $_POST['mode'] == 'delete' && is_numeric($_POST["news_id"])) {
+
+	//-- ºï½ü¤¹¤ë¿·Ãå¾ðÊó°Ê¹ß¤Îrank¤ò1¤Ä·«¤ê¾å¤²¤Æ¤ª¤¯
+	$conn->query("BEGIN");
+	$sql = "UPDATE dtb_news SET rank = rank - 1, update_date = NOW() WHERE delete = 0 AND rank > ( SELECT rank FROM dtb_news WHERE delete = 0 AND news_id = ? )";
+	$conn->query( $sql, array( $_POST['news_id']  ) );
+
+	$sql = "UPDATE dtb_news SET rank = 0, delete = 1, update_date = NOW() WHERE news_id = ?";
+	$conn->query( $sql, array( $_POST['news_id'] ) );
+	$conn->query("COMMIT");
+
+	sfReload();				//¼«Ê¬¤Ë¥ê¥À¥¤¥ì¥¯¥È¡ÊºÆÆÉ¹þ¤Ë¤è¤ë¸íÆ°ºîËÉ»ß¡Ë
+}
+
+//----¡¡É½¼¨½ç°Ì°ÜÆ°
+
+if ( $_POST['mode'] == 'move' && is_numeric($_POST["news_id"]) ) {
+	if ($_POST["term"] == "up") {
+		sfRankUp("dtb_news", "news_id", $_POST["news_id"]);
+	} else if ($_POST["term"] == "down") {
+		sfRankDown("dtb_news", "news_id", $_POST["news_id"]);	
+	}
+	//sf_rebuildIndex($conn);
+	sfReload();
+}
+
+//----¡¡»ØÄêÉ½¼¨½ç°Ì°ÜÆ°
+if ($_POST['mode'] == 'moveRankSet') {
+	$key = "pos-".$_POST['news_id'];
+	$input_pos = mb_convert_kana($_POST[$key], "n");
+	if(sfIsInt($input_pos)) {
+		sfMoveRank("dtb_news", "news_id", $_POST['news_id'], $input_pos);
+		sfReload();
+	}
+}
+
+
+//---- Á´¥Ç¡¼¥¿¼èÆÀ
+$sql = "SELECT *, EXTRACT(EPOCH FROM news_date) as news_date_unix FROM dtb_news WHERE delete = '0' ORDER BY rank DESC";
+$objPage->list_data = $conn->getAll($sql);
+$objPage->line_max = count($objPage->list_data);
+$sql = "SELECT MAX(rank) FROM dtb_news WHERE delete = '0'";		// rank¤ÎºÇÂçÃÍ¤ò¼èÆÀ
+$objPage->max_rank = $conn->getOne($sql);
+
+$objPage->arrForm['news_select'] = 0;
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+//function --------------------------------------------------------------------------------------------- 
+
+//---- ÆþÎÏÊ¸»úÎó¤òÇÛÎó¤Ø
+function lfConvData( $data ){
+	
+	 // Ê¸»úÎó¤ÎÊÑ´¹¡Êmb_convert_kana¤ÎÊÑ´¹¥ª¥×¥·¥ç¥ó¡Ë							
+	$arrFlag = array(
+					  "year" => "n"
+					 ,"month" => "n"
+					 ,"day" => "n"
+					 ,"url" => "a"
+					 ,"news_title" => "aKV"
+					 ,"news_comment" => "aKV"
+					 ,"link_method" => "n"
+					);
+		
+	if ( is_array($data) ){
+		foreach ($arrFlag as $key=>$line) {
+			$data[$key] = mb_convert_kana($data[$key], $line);
+		}
+	}
+
+	return $data;
+}
+
+//----¡¡»ØÄê½ç°Ì¤Ø°ÜÆ°
+function sf_setRankPosition($conn, $tableName, $keyIdColumn, $keyId, $position) {
+
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë
+	$conn->query("BEGIN");
+	$rank = $conn->getOne("SELECT rank FROM $tableName WHERE $keyIdColumn = ?", array($keyId));	
+
+	if( $position > $rank ) $term = "- 1";	//Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤êÂç¤­¤¤¾ì¹ç
+	if( $position < $rank ) $term = "+ 1";	//Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤ê¾®¤µ¤¤¾ì¹ç
+
+	//--¡¡»ØÄê¤·¤¿½ç°Ì¤Î¾¦ÉÊ¤«¤é°ÜÆ°¤µ¤»¤ë¾¦ÉÊ¤Þ¤Ç¤Îrank¤ò£±¤Ä¤º¤é¤¹
+	$sql = "UPDATE $tableName SET rank = rank $term, update_date = NOW() WHERE rank BETWEEN ? AND ? AND delete = 0";
+	if( $position > $rank ) $conn->query( $sql, array( $rank + 1, $position ) );
+	if( $position < $rank ) $conn->query( $sql, array( $position, $rank - 1 ) );
+
+	//-- »ØÄê¤·¤¿½ç°Ì¤Ørank¤ò½ñ¤­´¹¤¨¤ë¡£
+	$sql  = "UPDATE $tableName SET rank = ?, update_date = NOW() WHERE $keyIdColumn = ? AND delete = 0 ";
+	$conn->query( $sql, array( $position, $keyId ) );
+	$conn->query("COMMIT");
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯¡Ê½ç°Ì°ÜÆ°ÍÑ¡Ë
+function sf_errorCheckPosition($conn, $tableName, $position, $keyIdColumn, $keyId) {
+
+	$objErr = new SC_CheckError();
+	$objErr->doFunc( array("°ÜÆ°½ç°Ì", "moveposition", 4 ), array( "ZERO_CHECK", "NUM_CHECK", "EXIST_CHECK", "MAX_LENGTH_CHECK" ) );
+
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
+	$rank = $conn->getOne("SELECT rank FROM $tableName WHERE $keyIdColumn = ?", array($keyId));
+	if ($rank == $position ) $objErr->arrErr["moveposition"] .= "¢¨ »ØÄê¤·¤¿°ÜÆ°½ç°Ì¤Ï¸½ºß¤Î½ç°Ì¤Ç¤¹¡£";
+	
+	// rank¤ÎºÇÂçÃÍ°Ê¾å¤ÎÆþÎÏ¤òµöÍÆ¤·¤Ê¤¤											 
+	if( ! $objErr->arrErr["position"] ) {								 
+		$sql = "SELECT MAX( rank ) FROM " .$tableName. " WHERE delete = 0";
+		$result = $conn->getOne($sql);
+		if( $position > $result ) $objErr->arrErr["moveposition"] .= "¢¨ ÆþÎÏ¤µ¤ì¤¿½ç°Ì¤Ï¡¢ÅÐÏ¿¿ô¤ÎºÇÂçÃÍ¤òÄ¶¤¨¤Æ¤¤¤Þ¤¹¡£";
+	}
+
+	return $objErr->arrErr;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck(){
+
+	$objErr = new SC_CheckError();
+
+	$objErr->doFunc(array("ÆüÉÕ(Ç¯)", "year"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("ÆüÉÕ(·î)", "month"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("ÆüÉÕ(Æü)", "day"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("ÆüÉÕ", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥¿¥¤¥È¥ë", 'news_title', MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ËÜÊ¸", 'url', URL_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ËÜÊ¸", 'news_comment', LTEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+//INSERTÊ¸
+function lfNewsInsert(){
+	global $conn;
+	global $registDate;
+	
+	if ($_POST["link_method"] == "") {
+		$_POST["link_method"] = 1;
+	}
+
+	$sql = "INSERT INTO dtb_news (news_date, news_title, creator_id, news_url, link_method, news_comment, rank)
+			VALUES ( ?,?,?,?,?,? , (SELECT MAX(rank) + 1 FROM dtb_news WHERE delete = '0'))";
+	$arrRegist = array($registDate, $_POST["news_title"], $_SESSION['member_id'],  $_POST["news_url"], $_POST["link_method"], $_POST["news_comment"]);
+
+	$conn->query($sql, $arrRegist);
+	
+	// ºÇ½é¤Î1·ïÌÜ¤ÎÅÐÏ¿¤Ïrank¤ËNULL¤¬Æþ¤ë¤Î¤ÇÂÐºö
+	$sql = "UPDATE dtb_news SET rank = 1 WHERE delete = 0 AND rank IS NULL";
+	$conn->query($sql);
+}
+
+//UPDATEÊ¸
+function lfNewsUpdate(){
+	global $conn;
+	global $registDate;
+	
+	if ($_POST["link_method"] == "") {
+		$_POST["link_method"] = 1;
+	}	
+
+	$sql = "UPDATE dtb_news SET news_date = ?, news_title = ?, creator_id = ?, update_date = NOW(),  news_url = ?, link_method = ?, news_comment = ? WHERE news_id = ?";
+	$arrRegist = array($registDate, $_POST['news_title'], $_SESSION['member_id'], $_POST['news_url'], $_POST["link_method"], $_POST['news_comment'], $_POST['news_id']);
+		
+	$conn->query($sql, $arrRegist);	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/contents/recommend.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/contents/recommend.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/contents/recommend.php	(revision 1328)
@@ -0,0 +1,135 @@
+<?
+
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/recomend.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "recommend";
+		$this->tpl_subtitle = '¥ª¥¹¥¹¥á´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+$arrRegistColumn = array(
+ 							 array(  "column" => "product_id", "convert" => "n" ),
+							 array(  "column" => "category_id", "convert" => "n" ),
+							 array(  "column" => "rank", "convert" => "n" ),
+							 array(  "column" => "title", "convert" => "aKV" ),
+							 array(  "column" => "comment", "convert" => "aKV" ),
+						);
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+//ºÇÂçÅÐÏ¿¿ô¤ÎÉ½¼¨
+$objPage->tpl_disp_max = RECOMMEND_NUM;
+
+// ÅÐÏ¿»þ
+if ( $_POST['mode'] == 'regist' ){
+		
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	$objPage->arrForm = $_POST;	
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr[$objPage->arrForm['rank']] = lfErrorCheck();
+	if ( ! $objPage->arrErr[$objPage->arrForm['rank']]) {
+		// ¸Å¤¤¤Î¤ò¾Ã¤¹
+		$sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
+		$conn->query($sql, array($objPage->arrForm['category_id'] ,$objPage->arrForm['rank']));
+	
+		// £Ä£ÂÅÐÏ¿
+		$objPage->arrForm['creator_id'] = $_SESSION['member_id'];
+		$objPage->arrForm['update_date'] = "NOW()";
+		$conn->autoExecute("dtb_best_products", $objPage->arrForm );		
+	}	
+
+} elseif ( $_POST['mode'] == 'delete' ){
+// ºï½ü»þ
+
+	$sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
+	$conn->query($sql, array($_POST['category_id'] ,$_POST['rank']));
+	
+}
+
+// ¥«¥Æ¥´¥êID¼èÆÀ Ìµ¤¤¤È¤­¤Ï¥È¥Ã¥×¥Ú¡¼¥¸
+if ( sfCheckNumLength($_POST['category_id']) ){
+	$objPage->category_id = $_POST['category_id'];
+} else {
+	$objPage->category_id = 0;
+}
+
+// ´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÆâÍÆ¤ò¼èÆÀ¤¹¤ë
+$sql = "SELECT B.name, B.main_list_image, A.* FROM dtb_best_products as A INNER JOIN dtb_products as B USING (product_id)
+		 WHERE A.category_id = ? AND A.delete = 0 ORDER BY rank";
+$arrItems = $conn->getAll($sql, array($objPage->category_id));
+foreach( $arrItems as $data ){
+	$objPage->arrItems[$data['rank']] = $data;
+}
+
+// ¾¦ÉÊÊÑ¹¹»þ¤Ï¡¢ÁªÂò¤µ¤ì¤¿¾¦ÉÊ¤Ë°ì»þÅª¤ËÃÖ¤­´¹¤¨¤ë
+if ( $_POST['mode'] == 'set_item'){
+	$sql = "SELECT product_id, name, main_list_image FROM dtb_products WHERE product_id = ? AND delete = 0";
+	$result = $conn->getAll($sql, array($_POST['product_id']));
+	if ( $result ){
+		$data = $result[0];
+		foreach( $data as $key=>$val){
+			$objPage->arrItems[$_POST['rank']][$key] = $val;
+		}
+		$objPage->arrItems[$_POST['rank']]['rank'] = $_POST['rank'];
+	}
+	$objPage->checkRank = $_POST['rank'];
+}
+
+//³Æ¥Ú¡¼¥¸¶¦ÄÌ
+$objPage->cnt_question = 6;
+$objPage->arrActive = $arrActive;
+$objPage->arrQuestion = $arrQuestion;
+
+// ¥«¥Æ¥´¥ê¼èÆÀ
+$objPage->arrCatList = sfGetCategoryList("level = 1");
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	$new_array = array();
+	foreach ($arrConvList as $key => $val) {
+		$new_array[$key] = $array[$key];
+		if( strlen($val) > 0) {
+			$new_array[$key] = mb_convert_kana($new_array[$key] ,$val);
+		}
+	}
+	return $new_array;
+	
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	
+	$objErr->doFunc(array("¸«½Ð¤·¥³¥á¥ó¥È", "title", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥ª¥¹¥¹¥á¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/contents/csv_sql.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/contents/csv_sql.php	(revision 4408)
+++ /temp/tags/eccube-0_9_2beta/html/admin/contents/csv_sql.php	(revision 4408)
@@ -0,0 +1,404 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/csv_output.inc");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/csv_sql.tpl';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = 'csv';
+		$this->tpl_subno_csv = 'csv_sql';
+		$this->tpl_mainno = "contents";
+		$this->tpl_subtitle = 'CSV½ÐÎÏÀßÄê';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+$objPage->arrSubnavi = $arrSubnavi;
+$objPage->arrSubnaviName = $arrSubnaviName;
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// SQL_ID¤Î¼èÆÀ
+if ($_POST['sql_id'] != "") {
+	$sql_id = $_POST['sql_id'];
+}elseif($_GET['sql_id'] != ""){
+	$sql_id = $_GET['sql_id'];
+}else{
+	$sql_id = "";
+}
+
+$mode = $_POST['mode'];
+
+switch($_POST['mode']) {
+	// ¥Ç¡¼¥¿¤ÎÅÐÏ¿
+	case "confirm":
+		// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+		$objPage->arrErr = lfCheckError($_POST);
+		
+		if (count($objPage->arrErr) <= 0){
+			// ¥Ç¡¼¥¿¤Î¹¹¿·
+			$sql_id = lfUpdData($sql_id, $_POST);
+			// ´°Î»¥á¥Ã¥»¡¼¥¸É½¼¨
+			$objPage->tpl_onload = "alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+		}
+		break;
+	
+	// ³ÎÇ§²èÌÌ
+	case "preview":
+		// SQLÊ¸É½¼¨
+		$sql = "SELECT \n" . $_POST['sql'];
+		$objPage->sql = $sql;
+		
+		// ¥¨¥é¡¼É½¼¨
+		$objErrMsg = lfCheckSQL($_POST);
+		if ($objErrMsg != "") {
+			$errMsg = $objErrMsg->message . "\n" . $objErrMsg->userinfo;
+		}
+		
+		$objPage->sqlerr = $errMsg;
+
+		$objPage->objView = $objView;
+		
+		// ²èÌÌ¤ÎÉ½¼¨
+		$objView->assignobj($objPage);
+		$objView->display('contents/csv_sql_view.tpl');
+		exit;
+		break;
+
+	// ¿·µ¬ºîÀ®
+	case "new_page":
+		header("location: ./csv_sql.php");
+		break;
+		
+	// ¥Ç¡¼¥¿ºï½ü
+	case "delete":
+		lfDelData($sql_id);
+		header("location: ./csv_sql.php");
+		break;
+		
+	case "csv_output":
+		// CSV½ÐÎÏ¥Ç¡¼¥¿¼èÆÀ
+		$arrCsvData = lfGetSqlList(" WHERE sql_id = ?", array($_POST['csv_output_id']));
+		
+		$objQuery = new SC_Query();
+		$arrCsvOutputData = $objQuery->getall("SELECT " . $arrCsvData[0]['sql']);
+		
+		if (count($arrCsvOutputData) > 0) {
+			
+			$arrKey = array_keys(sfSwapArray($arrCsvOutputData));
+			foreach($arrKey as $data) {
+				if ($i != 0) $header .= ", ";
+				$header .= $data;
+				$i ++;
+			}
+			$header .= "\n";
+
+			$data = lfGetCSVData($arrCsvOutputData, $arrKey);
+			// CSV½ÐÎÏ
+			sfCSVDownload($header.$data);
+			exit;
+		break;
+		}else{
+			$objPage->tpl_onload = "alert('½ÐÎÏ¥Ç¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó¡£');";
+			$sql_id = "";
+			$_POST="";
+		}
+		break;
+}
+
+// mode ¤¬ confirm °Ê³°¤Î¤È¤­¤Ï´°Î»¥á¥Ã¥»¡¼¥¸¤Ï½ÐÎÏ¤·¤Ê¤¤
+if ($mode != "confirm" and $mode != "csv_output") {
+	$objPage->tpl_onload = "";
+}
+
+// ÅÐÏ¿ºÑ¤ßSQL°ìÍ÷¼èÆÀ
+$arrSqlList = lfGetSqlList();
+
+// ÊÔ½¸ÍÑSQL¥Ç¡¼¥¿¤Î¼èÆÀ
+if ($sql_id != "") {
+	$arrSqlData = lfGetSqlList(" WHERE sql_id = ?", array($sql_id));
+}
+
+// ¥Æ¡¼¥Ö¥ë°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+$arrTableList = lfGetTableList();
+$arrTableList = sfSwapArray($arrTableList);
+
+// ¸½ºßÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Æ¡¼¥Ö¥ë¤ò¼èÆÀ¤¹¤ë
+if ($_POST['selectTable'] == ""){
+	$selectTable = $arrTableList['relname'][0];
+}else{
+	$selectTable = $_POST['selectTable'];
+}
+
+// ¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+$arrColList = lfGetColumnList($selectTable);
+$arrColList =  sfSwapArray($arrColList);
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¤Ë½ÐÎÏ¤¹¤ë¥Ç¡¼¥¿¤ò¥»¥Ã¥È
+$objPage->arrSqlList = $arrSqlList;																// SQL°ìÍ÷
+$objPage->arrTableList = sfarrCombine($arrTableList['relname'], $arrTableList['description']);	// ¥Æ¡¼¥Ö¥ë°ìÍ÷
+$objPage->arrColList = sfarrCombine($arrColList['attname'],$arrColList['description']);			// ¥«¥é¥à°ìÍ÷
+$objPage->selectTable = $selectTable;															// ÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Æ¡¼¥Ö¥ë
+$objPage->sql_id = $sql_id;																		// ÁªÂò¤µ¤ì¤Æ¤¤¤ëSQL
+
+// POST¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+if (count($_POST) > 0) {
+	$arrSqlData[0]['name'] = $_POST['name'];
+	$arrSqlData[0]['sql'] = $_POST['sql'];
+}
+$objPage->arrSqlData = $arrSqlData[0];															// ÁªÂò¤µ¤ì¤Æ¤¤¤ëSQL¥Ç¡¼¥¿
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetTableList
+ * ½èÍýÆâÍÆ	¡§¥Æ¡¼¥Ö¥ë°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ ¡¡¡§¼èÆÀ·ë²Ì
+ **************************************************************************************************************/
+function lfGetTableList(){
+	$objQuery = new SC_Query();
+	$arrRet = array();		// ·ë²Ì¼èÆÀÍÑ
+	
+	$sql = "";
+	$sql .= " SELECT";
+	$sql .= "     c.relname ,";
+	$sql .= "     c.relname || ':' ||obj_description(c.oid) as description";
+	$sql .= " FROM";
+	$sql .= "     pg_class c,";
+	$sql .= "     pg_user u";
+	$sql .= " WHERE";
+	$sql .= "     c.relowner = u.usesysid AND";
+	$sql .= "     relname IN (SELECT";
+	$sql .= "                     tablename";
+	$sql .= "                 FROM";
+	$sql .= "                     pg_tables";
+	$sql .= "                 WHERE";
+	$sql .= "                     tableowner=? ";
+	$sql .= "                 )";
+	$sql .= " ORDER BY c.relname ";
+	$arrRet = $objQuery->getAll($sql, array(DB_USER));
+	
+	return $arrRet;
+}
+
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetColunmList
+ * ½èÍýÆâÍÆ	¡§¥Æ¡¼¥Ö¥ë¤Î¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§$selectTable¡§¥Æ¡¼¥Ö¥ëÌ¾¾Î
+ * Ìá¤êÃÍ ¡¡¡§¼èÆÀ·ë²Ì
+ **************************************************************************************************************/
+function lfGetColumnList($selectTable){
+	$objQuery = new SC_Query();
+	$arrRet = array();		// ·ë²Ì¼èÆÀÍÑ
+	
+	$sql = "";
+	$sql .= " SELECT";
+	$sql .= "     a.attname,";
+	$sql .= "     a.attnum as fldnum, ";
+	$sql .= "     (select case count(description) when 0 then a.attname else (select a.attname || ':' || description from pg_description where a.attrelid=objoid and a.attnum=objsubid ) end from pg_description where a.attrelid=objoid and a.attnum=objsubid ) as description ";
+	$sql .= " FROM";
+	$sql .= "     pg_class c,";
+	$sql .= "         pg_attribute a left join pg_description e on (a.attrelid=e.objoid and a.attnum=e.objsubid) ";
+	$sql .= " ";
+	$sql .= " WHERE";
+	$sql .= "     (c.relname=?) AND";
+	$sql .= "     (c.oid=a.attrelid) AND";
+	$sql .= "     a.attnum > 0";
+	$sql .= " ORDER BY";
+	$sql .= "     fldnum";
+	$sql .= " ";
+	$arrRet = $objQuery->getAll($sql, array($selectTable));	
+
+	return $arrRet;
+	
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetSqlList
+ * ½èÍýÆâÍÆ	¡§ÅÐÏ¿ºÑ¤ßSQL°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$where¡§Where¶ç
+ * °ú¿ô2	¡§$arrData¡§¹Ê¤ê¹þ¤ß¥Ç¡¼¥¿
+ * Ìá¤êÃÍ ¡¡¡§¼èÆÀ·ë²Ì
+ **************************************************************************************************************/
+function lfGetSqlList($where = "" , $arrData = array()){
+	$objQuery = new SC_Query();
+	$arrRet = array();		// ·ë²Ì¼èÆÀÍÑ
+	
+	$sql = "";
+	$sql .= " SELECT";
+	$sql .= "     sql_id,";
+	$sql .= "     name,";
+	$sql .= "     sql,";
+	$sql .= "     update_date,";
+	$sql .= "     create_date";
+	$sql .= " FROM";
+	$sql .= "     dtb_csv_sql";
+	
+	// Where¶ç¤Î»ØÄê¤¬¤¢¤ì¤Ð·ë¹ç¤¹¤ë
+	if ($where != "") {
+		$sql .= " $where ";
+	}else{
+		$sql .= " ORDER BY sql_id ";
+	}
+	$sql .= " ";
+
+	// ¥Ç¡¼¥¿¤ò°ú¿ô¤ÇÅÏ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥»¥Ã¥È¤¹¤ë
+	if (count($arrData) > 0) {
+		$arrRet = $objQuery->getall($sql, $arrData);
+	}else{
+		$arrRet = $objQuery->getall($sql);
+	}
+
+	return $arrRet;
+	
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdCsvOutput
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô		¡§POST¥Ç¡¼¥¿
+ * ÌáÃÍ		¡§¥¨¥é¡¼ÆâÍÆ
+ **************************************************************************************************************/
+function lfCheckError($data){
+	$objErr = new SC_CheckError();
+	$objErr->doFunc( array("Ì¾¾Î", "name"), array("EXIST_CHECK") );
+	$objErr->doFunc( array("SQLÊ¸", "sql"), array("EXIST_CHECK") );
+	
+	// SQL¤ÎÂÅÅöÀ­¥Á¥§¥Ã¥¯
+	if ($objErr->arrErr['sql'] == "") {
+		$objsqlErr = lfCheckSQL($data);
+		if ($objsqlErr != "") {
+			$objErr->arrErr["sql"] = "SQLÊ¸¤¬ÉÔÀµ¤Ç¤¹¡£SQLÊ¸¤ò¸«Ä¾¤·¤Æ¤¯¤À¤µ¤¤";
+		}
+	}
+	
+	return $objErr->arrErr;
+
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfCheckSQL
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¤µ¤ì¤¿SQLÊ¸¤¬Àµ¤·¤¤¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô		¡§POST¥Ç¡¼¥¿
+ * ÌáÃÍ		¡§¥¨¥é¡¼ÆâÍÆ
+ **************************************************************************************************************/
+function lfCheckSQL($data){
+	$err = "";
+	$objDbConn = new SC_DbConn();
+	$sql = "SELECT " . $data['sql'] . " ";
+	$ret = $objDbConn->conn->query($sql);
+	if ($objDbConn->conn->isError($ret)){
+		$err = $ret;
+	}
+	
+	return $err;
+}
+
+function lfprintr($data){
+	print_r($data);
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdData
+ * ½èÍýÆâÍÆ	¡§DB¤Ë¥Ç¡¼¥¿¤òÊÝÂ¸¤¹¤ë
+ * °ú¿ô1	¡§$sql_id¥¥¥¹¹¿·¤¹¤ë¥Ç¡¼¥¿¤ÎSQL_ID
+ * °ú¿ô2	¡§$arrData¥¥¥¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§$sql_id:SQL_ID¤òÊÖ¤¹
+ **************************************************************************************************************/
+function lfUpdData($sql_id = "", $arrData = array()){
+	$objQuery = new SC_Query();		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ(¹¹¿·È½Äê)
+	$arrVal = array();				// ¥Ç¡¼¥¿¹¹¿·
+
+	// sql_id ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤ÏUPDATE
+	if ($sql_id != "") {
+		// Â¸ºß¥Á¥§¥Ã¥¯
+		$arrSqlData = lfGetSqlList(" WHERE sql_id = ?", array($sql_id));
+		if (count($arrSqlData) > 0) {
+			// ¥Ç¡¼¥¿¹¹¿·
+			$sql = "UPDATE dtb_csv_sql SET name = ?, sql = ?, update_date = now() WHERE sql_id = ? ";
+			$arrVal= array($arrData['name'], $arrData['sql'], $sql_id);
+		}else{
+			// ¥Ç¡¼¥¿¤Î¿·µ¬ºîÀ®
+			$sql_id = "";
+			$sql = "INSERT INTO dtb_csv_sql (name, sql) values (?, ?) ";
+			$arrVal= array($arrData['name'], $arrData['sql']);
+			
+		}
+	}else{
+		// ¥Ç¡¼¥¿¤Î¿·µ¬ºîÀ®
+		$sql = "INSERT INTO dtb_csv_sql (name, sql) values (?, ?) ";
+		$arrVal= array($arrData['name'], $arrData['sql']);
+	}
+	// SQL¼Â¹Ô	
+	$arrRet = $objQuery->query($sql,$arrVal);
+	
+	// ¿·µ¬ºîÀ®»þ¤Ï$sql_id¤ò¼èÆÀ
+	if ($sql_id == "") {
+		$arrNewData = lfGetSqlList(" ORDER BY create_date DESC");
+		$sql_id = $arrNewData[0]['sql_id'];
+	}
+	
+	return $sql_id;
+}
+
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfDelData
+ * ½èÍýÆâÍÆ	¡§¥Ç¡¼¥¿¤òºï½ü¤¹¤ë
+ * °ú¿ô1	¡§$sql_id¥¥¥ºï½ü¤¹¤ë¥Ç¡¼¥¿¤ÎSQL_ID
+ * Ìá¤êÃÍ	¡§¼Â¹Ô·ë²Ì¡¡TRUE¡§À®¸ù FALSE¡§¼ºÇÔ
+ **************************************************************************************************************/
+function lfDelData($sql_id = ""){
+	$objQuery = new SC_Query();		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$Ret = false;					// ¼Â¹Ô·ë²Ì
+
+	// sql_id ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Î¤ß¼Â¹Ô
+	if ($sql_id != "") {
+		// ¥Ç¡¼¥¿¤Îºï½ü
+		$sql = "DELETE FROM dtb_csv_sql WHERE sql_id = ? ";
+		// SQL¼Â¹Ô	
+		$ret = $objQuery->query($sql,array($sql_id));
+	}else{
+		$ret = false;
+	}
+
+	// ·ë²Ì¤òÊÖ¤¹
+	return $ret;
+}
+
+
+//---- CSV½ÐÎÏÍÑ¥Ç¡¼¥¿¼èÆÀ
+function lfGetCSVData( $array, $arrayIndex){	
+	for ($i=0; $i<count($array); $i++){
+		for ($j=0; $j<count($array[$i]); $j++ ){
+			if ( $j > 0 ) $return .= ",";
+			$return .= "\"";			
+			if ( $arrayIndex ){
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";	
+			} else {
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+			}
+		}
+		$return .= "\n";			
+	}
+	
+	return $return;
+}
+
Index: /temp/tags/eccube-0_9_2beta/html/admin/contents/csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/contents/csv.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/contents/csv.php	(revision 1328)
@@ -0,0 +1,123 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/csv_output.inc");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/csv.tpl';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = 'csv';
+		$this->tpl_subno_csv = $this->arrSubnavi[1];
+		$this->tpl_mainno = "contents";
+		$this->tpl_subtitle = 'CSV½ÐÎÏÀßÄê';
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+$objPage->arrSubnavi = $arrSubnavi;
+$objPage->arrSubnaviName = $arrSubnaviName;
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$arrOutput = array();
+$arrChoice = array();
+
+$get_tpl_subno_csv = $_GET['tpl_subno_csv'];
+// GET¤ÇÃÍ¤¬Á÷¤é¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¤½¤ÎÃÍ¤ò¸µ¤Ë²èÌÌÉ½¼¨¤òÀÚ¤êÂØ¤¨¤ë
+if ($get_tpl_subno_csv != ""){
+	// Á÷¤é¤ì¤Æ¤­¤¿ÃÍ¤¬ÇÛÎó¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐTOP¤òÉ½¼¨
+	if (in_array($get_tpl_subno_csv,$objPage->arrSubnavi)){
+		$subno_csv = $get_tpl_subno_csv;
+	}else{
+		$subno_csv = $objPage->arrSubnavi[1];
+	}
+} else {
+	// GET¤ÇÃÍ¤¬¤Ê¤±¤ì¤ÐPOST¤ÎÃÍ¤ò»ÈÍÑ¤¹¤ë
+	if ($_POST['tpl_subno_csv'] != ""){
+		$subno_csv = $_POST['tpl_subno_csv'];
+	}else{
+		$subno_csv = $objPage->arrSubnavi[1];
+	}
+}
+
+// subno¤ÎÈÖ¹æ¤ò¼èÆÀ
+$subno_id = array_keys($objPage->arrSubnavi,$subno_csv);
+$subno_id = $subno_id[0];
+// ¥Ç¡¼¥¿¤ÎÅÐÏ¿
+if ($_POST["mode"] == "confirm") {
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError($_POST['output_list']);
+	
+	if (count($objPage->arrErr) <= 0){
+		// ¥Ç¡¼¥¿¤Î¹¹¿·
+		lfUpdCsvOutput($subno_id, $_POST['output_list']);
+		
+		// ²èÌÌ¤Î¥ê¥í¡¼¥É
+		sfReload("tpl_subno_csv=$subno_csv");
+	}
+}
+
+// ½ÐÎÏ¹àÌÜ¤Î¼èÆÀ
+$arrOutput = sfSwapArray(sfgetCsvOutput($subno_csv, "WHERE csv_id = ? AND status = 1", array($subno_id)));
+$arrOutput = sfarrCombine($arrOutput['col'], $arrOutput['disp_name']);
+
+// Èó½ÐÎÏ¹àÌÜ¤Î¼èÆÀ
+$arrChoice = sfSwapArray(sfgetCsvOutput($subno_csv, "WHERE csv_id = ? AND status = 2", array($subno_id)));
+$arrChoice = sfarrCombine($arrChoice['col'], $arrChoice['disp_name']);
+
+$objPage->arrOutput=$arrOutput;
+$objPage->arrChoice=$arrChoice;
+
+
+$objPage->SubnaviName = $objPage->arrSubnaviName[$subno_id];
+$objPage->tpl_subno_csv = $subno_csv;
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdCsvOutput
+ * ½èÍýÆâÍÆ	¡§CSV½ÐÎÏ¹àÌÜ¤ò¹¹¿·¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ **************************************************************************************************************/
+function lfUpdCsvOutput($csv_id, $arrData = array()){
+	$objQuery = new SC_Query();
+
+	// ¤Ò¤È¤Þ¤º¡¢Á´Éô»ÈÍÑ¤·¤Ê¤¤¤Ç¹¹¿·¤¹¤ë
+	$upd_sql = "UPDATE dtb_csv SET status = 2, rank = NULl WHERE csv_id = ?";
+	$objQuery->query($upd_sql, array($csv_id));
+
+	// »ÈÍÑ¤¹¤ë¤â¤Î¤À¤±¡¢ºÆ¹¹¿·¤¹¤ë¡£
+	if (is_array($arrData)) {
+		foreach($arrData as $key => $val){
+			$upd_sql = "UPDATE dtb_csv SET status = 1, rank = ? WHERE csv_id = ? AND col = ? ";
+			$objQuery->query($upd_sql, array($key+1, $csv_id,$val));
+		}
+	}
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdCsvOutput
+ * ½èÍýÆâÍÆ	¡§CSV½ÐÎÏ¹àÌÜ¤ò¹¹¿·¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * ÌáÃÍ		¡§¤Ê¤·
+ **************************************************************************************************************/
+function lfCheckError($data){
+	$objErr = new SC_CheckError();
+	$objErr->doFunc( array("½ÐÎÏ¹àÌÜ", "output_list"), array("EXIST_CHECK") );
+	
+	return $objErr->arrErr;
+
+}
+
Index: /temp/tags/eccube-0_9_2beta/html/admin/contents/recommend_search.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/contents/recommend_search.php	(revision 3592)
+++ /temp/tags/eccube-0_9_2beta/html/admin/contents/recommend_search.php	(revision 3592)
@@ -0,0 +1,142 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/recomend_search.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = '';
+		$this->tpl_subno = "";
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if ($_POST['mode'] == "search") {
+	
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	
+	
+	$where = "delete = 0";
+	
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	foreach ($objPage->arrForm as $key => $val) {
+		if($val == "") {
+			continue;
+		}
+		
+		switch ($key) {
+			case 'search_name':
+				
+				$where .= " AND name ILIKE ?";
+				$arrval[] = "%$val%";
+				break;
+			case 'search_category_id':
+				// »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
+				$arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val);
+				$tmp_where = "";
+				foreach ($arrRet as $val) {
+					if($tmp_where == "") {
+						$tmp_where.= " AND ( category_id = ?";
+					} else {
+						$tmp_where.= " OR category_id = ?";
+					}
+					$arrval[] = $val;
+				}
+				$where.= $tmp_where . " )";
+				break;
+			case 'search_product_code':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+				$where .= " OR product_code ILIKE ?";
+				$arrval[] = "%$val%";
+				$arrval[] = "%$val%";
+				break;
+			default:
+				break;
+		}
+	}
+	
+	$order = "update_date DESC";
+	
+	// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+	$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+	$from = "vw_products_nonclass";
+		
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+
+	/*	Á´¸¢É½¼¨¤¹¤ë¤è¤¦¤ËÊÑ¹¹
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	if(is_numeric($_POST['search_page_max'])) {	
+		$page_max = $_POST['search_page_max'];
+	} else {
+		$page_max = SEARCH_PMAX;
+	}
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+	*/
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+}
+
+// ¥«¥Æ¥´¥ê¼èÆÀ
+$objPage->arrCatList = sfGetCategoryList();
+
+
+
+
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam() {
+	global $objPage;
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	$arrConvList['search_name'] = "KVa";
+	$arrConvList['search_product_code'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/contents/inquiry.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/contents/inquiry.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/contents/inquiry.php	(revision 1328)
@@ -0,0 +1,261 @@
+<?php
+
+require_once("../require.php");
+
+require_once("../order/index_csv.php");
+
+$arrCVSCOL = array( 
+		
+				);
+						
+$arrCVSTITLE = array(
+				'²óÅúID',
+				'¼ÁÌäID',
+				'²óÅúÆü»þ',
+				'²óÅúÌ¾',
+				'¸ÜµÒÌ¾1',
+				'¸ÜµÒÌ¾2',
+				'¸ÜµÒÌ¾¥«¥Ê1',
+				'¸ÜµÒÌ¾¥«¥Ê2',
+				'Í¹ÊØÈÖ¹æ1',
+				'Í¹ÊØÈÖ¹æ2',
+				'ÅÔÆ»ÉÜ¸©',
+				'½»½ê1',
+				'½»½ê2',
+				'ÅÅÏÃÈÖ¹æ1',
+				'ÅÅÏÃÈÖ¹æ2',
+				'ÅÅÏÃÈÖ¹æ3',
+				'¥á¡¼¥ë¥¢¥É¥ì¥¹',
+				'²óÅú1',
+				'²óÅú2',
+				'²óÅú3',
+				'²óÅú4',
+				'²óÅú5',
+				'²óÅú6'				
+			);
+
+
+
+
+
+class LC_Page {
+	var $cnt_question;
+
+	var $ERROR;
+	var $ERROR_COLOR;
+	var $MESSAGE;
+	
+	var $QUESTION_ID;
+	
+	var $arrActive;
+	var $arrQuestion;
+	var $arrSession;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/inquiry.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "inquiry";
+		$this->tpl_subtitle = '¥¢¥ó¥±¡¼¥È´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+$arrActive = array( "0"=>"²ÔÆ¯", "1"=>"Èó²ÔÆ¯" );
+$arrQuestion = array( "0"=>"»ÈÍÑ¤·¤Ê¤¤", "1"=>"¥Æ¥­¥¹¥È¥¨¥ê¥¢", "2"=>"¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹"
+					, "3"=>"¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹", "4"=>"¥é¥¸¥ª¥Ü¥¿¥ó" 
+				);
+
+
+$sql = "SELECT *, to_char( create_date, 'YYYY/MM/DD' ) as disp_date FROM dtb_question WHERE delete = 0 ORDER BY question_id";
+$result = $conn->getAll($sql);
+$objPage->list_data = $result;
+						
+if ( $_GET['mode'] == 'regist' ){
+
+	for ( $i=0; $i<count($_POST["question"]); $i++ ) {
+		$_POST['question'][$i]['name'] = mb_convert_kana( trim ( $_POST['question'][$i]['name'] ), "K" );
+		for ( $j=0; $j<count( $_POST['question'][$i]['option'] ); $j++ ){
+			$_POST['question'][$i]['option'][$j] = mb_convert_kana( trim ( $_POST['question'][$i]['option'][$j] ) );
+		}
+	}
+	
+	$error = lfErrCheck();
+		
+	if ( ! $error  ){
+		
+		if ( ! is_numeric($_POST['question_id']) ){
+			//ÅÐÏ¿
+			$sql = "select nextval('dtb_question_question_id_seq');";
+			$question_id = $conn->getOne($sql);
+			
+			$value = serialize($_POST);
+			$sql_val = array( $value, $_POST['title'] ,$question_id );
+			$conn->query("INSERT INTO dtb_question ( question, question_name, question_id ) VALUES (?, ?, ?)", $sql_val );
+			$objPage->MESSAGE = "ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿";
+			$objPage->QUESTION_ID = $question_id;
+			sfReload();
+		} else {
+			//ÊÔ½¸
+			$value = serialize($_POST);
+			$sql_val = array( $value, $_POST['title'] ,$_POST['question_id'] );
+			$conn->query("UPDATE dtb_question SET question = ?, question_name = ? WHERE question_id = ?", $sql_val );
+			$objPage->MESSAGE = "ÊÔ½¸¤¬´°Î»¤·¤Þ¤·¤¿";
+			$objPage->QUESTION_ID = $_POST['question_id'];
+			sfReload();
+		}
+	} else {
+		//¥¨¥é¡¼É½¼¨
+		$objPage->ERROR = $error;
+		$objPage->QUESTION_ID = $_REQUEST['question_id'];
+		$objPage->ERROR_COLOR = lfGetErrColor($error, ERR_COLOR);
+
+	}
+} elseif ( ( $_GET['mode'] == 'delete' ) && ( sfCheckNumLength($_GET['question_id']) )  ){
+
+	$sql = "UPDATE dtb_question SET delete = 1 WHERE question_id = ?";
+	$conn->query( $sql, array( $_GET['question_id'] ) );
+	sfReload();
+	
+} elseif ( ( $_GET['mode'] == 'csv' ) && ( sfCheckNumLength($_GET['question_id']) ) ){ 
+
+			$head = sfGetCSVList($arrCVSTITLE);
+			$list_data = $conn->getAll("SELECT result_id,question_id,question_date,question_name,name01,name02,kana01,kana02,zip01,zip02,pref,addr01,addr02,tel01,tel02,tel03,mail01,question01,question02,question03,question04,question05,question06 FROM dtb_question_result WHERE delete = 0 ORDER BY result_id ASC");
+			$data = "";
+			for($i = 0; $i < count($list_data); $i++) {
+				// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+				$data .= lfMakeCSV($list_data[$i]);
+			}
+			// CSV¤òÁ÷¿®¤¹¤ë
+			sfCSVDownload($head.$data);
+			exit;
+
+} else {
+	
+	if ( is_numeric($_GET['question_id']) ){
+	
+		$sql = "SELECT question FROM dtb_question WHERE question_id = ?";
+		$result = $conn->getOne($sql, array($_GET['question_id']));
+		
+		if ( $result ){
+			$_POST = unserialize( $result );
+			$objPage->QUESTION_ID = $_GET['question_id'];
+		}
+	}
+} 
+
+
+
+
+//³Æ¥Ú¡¼¥¸¶¦ÄÌ
+$objPage->cnt_question = 6;
+$objPage->arrActive = $arrActive;
+$objPage->arrQuestion = $arrQuestion;
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+
+
+// ------------  ¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô ------------  
+
+function lfGetErrColor( $arr, $err_color ){
+	
+	foreach ( $arr as $key=>$val ) {
+		if ( is_string($val) && strlen($val) > 0 ){
+			$return[$key] = $err_color;
+		} elseif ( is_array( $val ) ) {
+			$return[$key] = lfGetErrColor ( $val, $err_color);
+		}
+	}
+	return $return;
+}
+
+
+
+
+
+
+
+// ------------  ¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô ------------  
+
+function lfErrCheck (){
+
+	$objErr = new SC_CheckError();
+	$errMsg = "";
+
+	$objErr->doFunc( array( "²ÔÆ¯¡¦Èó²ÔÆ¯", "active" ), array( "SELECT_CHECK" ) );
+	
+	$_POST["title"] = mb_convert_kana( trim (  $_POST["title"] ), "K" );
+	$objErr->doFunc( array( "¥¢¥ó¥±¡¼¥ÈÌ¾", "title" ), array( "EXIST_CHECK" ) );
+
+	$_POST["contents"] = mb_convert_kana( trim (  $_POST["contents"] ), "K" );
+	$objErr->doFunc( array( "¥¢¥ó¥±¡¼¥ÈÆâÍÆ" ,"contents" ), array( "EXIST_CHECK" ) );
+
+	
+	if ( ! $_POST['question'][0]["name"] ){
+		$objErr->arrErr['question'][0]["name"] = "£±¤Ä¤á¤Î¼ÁÌäÌ¾¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó";
+	}
+	
+	//¡¡¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¡¢¥é¥¸¥ª¥Ü¥¿¥ó¤òÁªÂò¤·¤¿¾ì¹ç¤ÏºÇÄã1¤Ä°Ê¾å¹àÌÜ¤òµ­Æþ¤µ¤»¤ë¡£
+	for( $i = 0; $i < count( $_POST["question"] ); $i++ ) {
+		
+		if ( $_POST["question"][$i]["kind"] ) {
+			if (strlen($_POST["question"][$i]["name"]) == 0) {
+				$objErr->arrErr["question"][$i]["name"] = "¥¿¥¤¥È¥ë¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£";
+			} else if ( strlen($_POST["question"][$i]["name"]) > STEXT_LEN ) {
+				$objErr->arrErr["question"][$i]["name"] = "¥¿¥¤¥È¥ë¤Ï". STEXT_LEN  ."»ú°ÊÆâ¤ÇÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£";
+			}
+		}
+		
+		if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4  ) {
+
+			$temp_data = array();
+			for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) {	
+
+				// ¹àÌÜ´Ö¡Ê¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¡Ë¤¬¤¢¤¤¤Æ¤¤¤¿¤éµÍ¤á¤Æ¤¤¤¯
+				if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j]  ), "asKVn" );
+
+			}
+
+			 $_POST["question"][$i]["option"] = $temp_data;
+
+			if( ( strlen( $_POST["question"][$i] ["option"][0] ) == 0 ) || ( strlen( $_POST["question"][$i] ["option"][0] ) > 0
+			 && strlen( $_POST["question"][$i] ["option"][1] ) == 0 ) ) $objErr->arrErr["question"][$i]['kind'] = "²¼µ­¤Î2¤Ä°Ê¾å¤Î¹àÌÜ¤Ëµ­Æþ¤·¤Æ¤¯¤À¤µ¤¤¡£";
+		}
+	}
+
+	return lfGetArrInput( $objErr->arrErr );
+
+}
+
+
+function lfGetArrInput( $arr ){
+	// ÃÍ¤¬ÆþÎÏ¤µ¤ì¤¿ÇÛÎó¤Î¤ß¤òÊÖ¤¹
+	
+	if ( is_array($arr)	){
+		foreach ( $arr as $key=>$val ) {
+			if ( is_string($val) && strlen($val) > 0 ){
+				$return[$key] = $val;
+			} elseif ( is_array( $val ) ) {
+				$data = lfGetArrInput ( $val );
+				if ( $data ){
+					$return[$key] = $data;
+				}
+			}
+		}
+	}
+	return $return;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/contents/inquiry_customer.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/contents/inquiry_customer.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/contents/inquiry_customer.php	(revision 1328)
@@ -0,0 +1,268 @@
+<?
+require_once("../require.php");
+
+class LC_Page {
+	var $errmsg;
+	var $arrPref;
+	
+	var $QUESTION;
+	var $question_id;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/inquiry_customer.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/sub_navi.tpl';
+		$this->tpl_subno = "inquiry";
+		$this->tpl_subtitle = '¥¢¥ó¥±¡¼¥È´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+
+// ÅÔÆ»ÉÜ¸©¥×¥ë¥À¥¦¥óÍÑÇÛÎó
+$objPage->arrPref = $arrPref;	
+
+
+// CSVÊÝÂ¸¹àÌÜ
+$ITEM = array(   "name"
+				,"name_kana"
+				,"zip"
+				,"state"
+				,"address01"
+				,"address02"
+				,"tel"
+				,"mail01"
+		);
+
+		
+		
+if ( ( ! $_POST['mode'] == 'confirm' ) && ( ! is_numeric($_REQUEST['question_id']) ) ){
+	echo "ÉÔÀµ¥¢¥¯¥»¥¹";
+	exit;
+}
+		
+		
+// ¥Æ¥ó¥×¥ì¡¼¥ÈÅÐÏ¿¹àÌÜ¼èÆÀ
+$sql = "SELECT question_id, question FROM dtb_question WHERE question_id = ?";
+$result = $conn->getAll( $sql, array($_REQUEST['question_id']) );
+$objPage->QUESTION = lfGetArrInput( unserialize( $result[0]['question'] ) );
+$objPage->question_id = $result[0]['question_id'];
+
+
+if ( (int)$objPage->QUESTION["delete"] !== 0 ){
+
+	$objPage->tpl_mainpage = "question/closed.tpl";
+	
+} elseif( $_POST['mode'] == "confirm" ) {
+
+	$errmsg  = errCheck();
+
+	if( $errmsg ) {
+
+		$objPage->errmsg = $errmsg;
+
+	} else {
+		$page_title = "¥Õ¥¡¥¤¥Æ¥ó¤é¤¯¤é¤¯¥·¥ç¥Ã¥Ô¥ó¥° - ¥¢¥ó¥±¡¼¥È ÆâÍÆ³ÎÇ§-";
+		$page_file_name = "question/confirm.tpl";
+	}
+	
+
+} elseif( $_POST['mode'] == "complete" )  {
+
+	//´°Î»²èÌÌ
+	$page_file_name = "question/complete.tpl";
+	
+	// ¼õÉÕÆüÉÕ¡¢ÍËÆü¡¢»þ´Ö¤ò¼èÆÀ¤¹¤ë
+	$date = getDateLocal();
+	
+	
+	//¥Ç¡¼¥¿ºîÀ®
+	$SQLDATA = $_POST;
+	$SQLDATA['zip'] = $SQLDATA['zip01'] ."-". $SQLDATA['zip02'];
+	$SQLDATA['tel'] = $SQLDATA['tel01'] ."-". $SQLDATA['tel02'] ."-". $SQLDATA['tel03'];
+	
+	//--------- ¢§ SQL ---------//
+		$sql = "INSERT INTO dtb_question_result ( question_name, question_id";
+		$sql_val = " ?, ? ";
+		$value[] = $objPage->QUESTION[title];
+		$value[] = $objPage->QUESTION[question_id];
+		
+		foreach ($ITEM as $val) {
+			if ( strlen( $SQLDATA[$val] ) > 0  ){
+				$sql .= "," .$val;
+				$sql_val .= ",? ";
+				$value[] = $SQLDATA[$val];
+			}
+		}
+		
+		for ( $i=0; $i<(count($objPage->QUESTION)+1); $i++ ){
+			
+			$tmpVal = "";
+			
+			if ( $objPage->QUESTION[question][$i][kind] == 1 or $objPage->QUESTION[question][$i][kind] == 2 ) {
+				
+				//¥Æ¥­¥¹¥È¥¨¥ê¥¢¡¦¥Ü¥Ã¥¯¥¹
+				$tmpVal = $SQLDATA['option'][$i];
+			
+			} elseif ( $objPage->QUESTION[question][$i][kind] == 4 ){
+				
+				//¥é¥Â¥ª¥Ü¥¿¥ó
+				$tmpVal = Array_Search_key ( $SQLDATA['option'][$i] , $objPage->QUESTION[question][$i][option] );
+			
+			} elseif ( $objPage->QUESTION[question][$i][kind] == 3 )  {
+				
+				//¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹
+				if ( is_array( $SQLDATA['option'][$i] ) ) {
+					foreach ($SQLDATA['option'][$i] as $data) {
+						if ( strlen($data) ) {
+							if ( $tmpVal ) $tmpVal .= "\n";
+							$tmpVal .= Array_Search_key ( $data , $objPage->QUESTION[question][$i][option] );
+						}
+					}
+				}
+			}
+
+
+			if ( strlen($tmpVal) > 0 ) {
+				$value[] = $tmpVal;
+				$sql .= "," ."question".($i+1);
+				$sql_val .= ",? ";
+			}
+		}
+	
+		
+		$sql = $sql .") VALUES ( ".$sql_val.")";
+		$conn->query( $sql, $value );
+		
+	//--------- ¢¥ SQL ---------//
+
+}
+
+
+$objPage->cnt_question = 6;
+$objPage->arrActive = $arrActive;
+$objPage->arrQuestion = $arrQuestion;
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+
+
+
+
+
+
+
+
+
+
+
+
+// ------------  ¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô ------------  
+function errCheck() {
+
+	$objErr = new ERROR_CHECK();
+	$errmsg = array();
+
+
+	//¡¡¤ªÌ¾Á°
+	$_POST["name"] = mb_convert_kana( trim( $_POST["name"] ) ,"asKVn" );	
+	$errmsg["name"] = $objErr->doFunc( array( $_POST["name"] , "¤ªÌ¾Á°", NAME_VOL, "BIG" ), array( "EXIST_CHECK", "MAX_LENGTH_CHECK" ) );
+
+	//¡¡¥Õ¥ê¥¬¥Ê
+	$_POST["name_kana"] = mb_convert_kana( trim( $_POST["name_kana"]) , "sCKV" ); 
+	$errmsg["name_kana"] = $objErr->doFunc( array( $_POST["name_kana"] , "¥Õ¥ê¥¬¥Ê", NAME_VOL, "BIG" ), array( "EXIST_CHECK", "MAX_LENGTH_CHECK" , "KANA_CHECK") );
+
+	//¡¡Í¹ÊØÈÖ¹æ
+	if( strlen( $_POST["zip01"] ) > 0 && strlen( $_POST["zip02"] ) > 0 ) {
+		
+		$_POST["zip01"] = mb_convert_kana( trim( $_POST["zip01"] ) , "n");
+		$_POST["zip02"] = mb_convert_kana( trim( $_POST["zip02"] ) , "n");
+		$zip = $_POST["zip01"] . $_POST["zip02"];
+		$errmsg["zip"] = $objErr->doFunc( array( $zip , "Í¹ÊØÈÖ¹æ", ZIP_NO ), array( "NUM_CHECK", "NUM_COUNT_CHECK2" ) );
+
+		//Æ±¤¸Ê¸»ú¤Ð¤«¤ê¤ÎÍ¹ÊØÈÖ¹æ¤Ïµö²Ä¤·¤Ê¤¤
+		if ( ereg('^(0+|1+|2+|3+|4+|5+|6+|7+|8+|9+)$', $zip ) ) $errmsg['zip'] .= "¢¨ Í¹ÊØÈÖ¹æ¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br>";
+	}
+
+	//¡¡¤´½»½ê
+	if( strlen( $_POST["address01"] ) > 0 || strlen( $_POST["address02"] ) > 0 ) {
+
+		$_POST["address01"] = mb_convert_kana( trim($_POST["address01"] ), "asKVn" );
+		$_POST["address02"] = mb_convert_kana( trim($_POST["address02"] ), "asKVn" );
+
+		if( $_POST["state"] == "" ) $errmsg["address"] = "¢¨ ÅÔÆ»ÉÜ¸©¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£<br>";
+		$errmsg["address"] .= $objErr->doFunc( array( $_POST["address01"], "¤´½»½ê¡Ê»Ô¶èÄ®Â¼¡Ë", ADDRESS_VOL, "BIG" ), array( "EXIST_CHECK", "MAX_LENGTH_CHECK" ) );
+		$errmsg["address"] .= $objErr->doFunc( array( $_POST["address02"], "¤´½»½ê¡ÊÈÖÃÏ¤Ê¤É¡Ë", ADDRESS_VOL, "BIG" ), array( "EXIST_CHECK", "MAX_LENGTH_CHECK" ) );
+	}
+
+	//¡¡¤ªÅÅÏÃÈÖ¹æ
+	if( strlen( $_POST["tel01"] ) > 0 ||  strlen( $_POST["tel03"] ) > 0 ||  strlen( $_POST["tel03"] ) > 0 ) {
+
+		$_POST["tel01"] = mb_convert_kana( trim($_POST["tel01"] ), "n" );
+		$_POST["tel02"] = mb_convert_kana( trim($_POST["tel02"] ), "n" );
+		$_POST["tel03"] = mb_convert_kana( trim($_POST["tel03"] ), "n" );
+		$tel = $_POST["tel01"] . $_POST["tel02"] . $_POST["tel03"];
+		$errmsg["tel"] = $objErr->doFunc( array( $tel, "ÅÅÏÃÈÖ¹æ", TEL_MIN_NO, TEL_MAX_NO ), array( "NUM_CHECK", "NUM_COUNT_CHECK" ) );
+	
+		//Æ±¤¸Ê¸»ú¤Ð¤«¤ê¤ÎÅÅÏÃÈÖ¹æ¤Ïµö²Ä¤·¤Ê¤¤
+		if ( ereg('^(0+|1+|2+|3+|4+|5+|6+|7+|8+|9+)$',$_POST['tel01'].$_POST['tel02'].$_POST['tel03']) ) $errmsg['tel'] .= "¢¨ ÅÅÏÃÈÖ¹æ¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br>";
+
+	}
+
+	//¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹
+	$_POST["mail01"] = mb_convert_kana( trim( $_POST["mail01"] ), "a" );
+	$_POST["mail02"] = mb_convert_kana( trim( $_POST["mail02"] ), "a" );
+	$errmsg_mail =  $objErr->doFunc( array( $_POST["mail01"] , "¥á¡¼¥ë¥¢¥É¥ì¥¹", EMAIL_VOL, "small" )
+									,array( "EXIST_CHECK", "EMAIL_CHECK", "MAX_LENGTH_CHECK"  ) );
+
+	$errmsg_mail .= $objErr->doFunc( array( $_POST["mail02"] , "³ÎÇ§ÍÑ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹", EMAIL_VOL, "small" )
+									,array( "EXIST_CHECK", "EMAIL_CHECK", "MAX_LENGTH_CHECK"   ) );
+	if( ! $errmsg_mail ) {
+
+		$errmsg["mail"] = $objErr->doFunc( array( $_POST["mail01"] , "¥á¡¼¥ë¥¢¥É¥ì¥¹", $_POST["mail02"] , "³ÎÇ§ÍÑ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹" ), array( "EQUAL_CHECK" ) );
+
+	} else {
+
+		$errmsg["mail"] = $errmsg_mail;
+	}
+
+	$errmsg['option'] =  array_map( "checkNull", $_POST['option'] );
+	for( $i = 0; $i < count( $_POST["option"] ) ; $i ++ ) {
+
+		$_POST["option"][$i] = mb_convert_kana( trim( $_POST["option"][$i] ), "asKVn" );
+
+	}
+	
+	return $returnMsg = lfGetArrInput($errmsg);
+
+}
+
+
+
+function lfGetArrInput( $arr ){
+	// ÃÍ¤¬ÆþÎÏ¤µ¤ì¤¿ÇÛÎó¤Î¤ß¤òÊÖ¤¹
+	
+	if ( is_array($arr)	){
+		foreach ( $arr as $key=>$val ) {
+			if ( is_string($val) && strlen($val) > 0 ){
+				$return[$key] = $val;
+			} elseif ( is_array( $val ) ) {
+				$data = lfGetArrInput ( $val );
+				if ( $data ){
+					$return[$key] = $data;
+				}
+			}
+		}
+	}
+	return $return;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/contents/page_edit.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/contents/page_edit.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/contents/page_edit.php	(revision 1328)
@@ -0,0 +1,114 @@
+<?php
+
+require_once("../require.php");
+require_once("./page_edit.inc");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/page_edit.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "page_edit";
+		global $arrPageList;
+		$this->arrPageList = $arrPageList;
+		$this->tpl_subtitle = '¥Ú¡¼¥¸ÊÔ½¸';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+$objFormParam = new SC_FormParam();			// ¥Õ¥©¡¼¥àÍÑ
+lfInitParam();								// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+$objFormParam->setParam($_POST);			// POSTÃÍ¤Î¼èÆÀ
+
+switch($_POST['mode']) {
+case 'edit':
+	$objPage->arrErr = $objFormParam->checkError();
+	if(count($objPage->arrErr) == 0) {
+		$page = $_POST['page'];
+		if($arrPageTpl[$page] != "") {
+			// °ì»þ¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤à
+			$path = TEMPLATE_FTP_DIR . $arrPageTpl[$page] . ".tmp";
+			$ret = lfWriteFile($path, $objFormParam->getValue('template'));
+			// ËÜÈÖ¥Õ¥¡¥¤¥ë¤ËÈ¿±Ç
+			if($ret > 0) {
+				$dst_path = TEMPLATE_FTP_DIR . $arrPageTpl[$page];
+				if(!copy($path, $dst_path)) {
+					print("¥Õ¥¡¥¤¥ë¤Î½ñ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+				}
+			}
+		}
+	}	
+	break;
+case 'preview':
+	$objPage->arrErr = $objFormParam->checkError();
+	if(count($objPage->arrErr) == 0) {
+		$page = $_POST['page'];
+		if($arrPageTpl[$page] != "") {
+			// °ì»þ¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤à
+			$path = TEMPLATE_FTP_DIR . $arrPageTpl[$page] . ".tmp";
+			$ret = lfWriteFile($path, $objFormParam->getValue('template'));
+			// ¥×¥ì¥Ó¥å¡¼É½¼¨
+			$url = $arrPageURL[$page] . "tpl=" . $arrPageTpl[$page] . ".tmp";
+			$objPage->tpl_onload ="window.open('$url', 'preview');";
+		}
+	}	
+	break;
+case 'select':
+	$page = $_POST['page'];
+	if($arrPageTpl[$page] != "") {
+		// ¥Õ¥¡¥¤¥ë¤ÎÃæ¿È¤òÆÉ¤ó¤ÇÊ¸»úÎó¤Ë³ÊÇ¼¤¹¤ë
+		$path = TEMPLATE_FTP_DIR . $arrPageTpl[$page];
+		if(file_exists($path)) {
+	 		$fp = fopen($path, "r");
+			$contents = fread($fp, filesize($path));
+			$objFormParam->setValue('template', $contents);
+			fclose($fp);
+		}
+	} else {
+		$objFormParam->setValue('template', "");
+	}
+	break;
+default:
+	
+	break;
+}
+
+/*
+
+// ¥Õ¥¡¥¤¥ë¤ÎÃæ¿È¤òÆÉ¤ó¤ÇÊ¸»úÎó¤Ë³ÊÇ¼¤¹¤ë
+$path = TEMPLATE_FTP_DIR . "index.tpl";
+$fp = fopen($path, "r");
+$contents = fread($fp, filesize($path));
+
+$objFormParam->setValue('template', $contents);
+
+fclose($fp);
+
+*/
+
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//---------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥Ú¡¼¥¸ÁªÂò", "page", INT_LEN, "n", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥È", "template", LLTEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+}
+
+function lfWriteFile($path, $string) {
+	$fp = fopen($path,"w+");
+	flock($fp, LOCK_EX);
+	$ret = fwrite($fp, $string);
+	fclose($fp);
+	return $ret;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/index.php	(revision 1328)
@@ -0,0 +1,14 @@
+<?php
+require_once("./require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'login.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objView->assignobj($objPage);
+$objView->display(LOGIN_FRAME);
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/develop/csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/develop/csv.php	(revision 2706)
+++ /temp/tags/eccube-0_9_2beta/html/admin/develop/csv.php	(revision 2706)
@@ -0,0 +1,219 @@
+<?php
+
+require_once("../require.php");
+
+$conn = new SC_DBConn();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+
+// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+$filepath = $argv[1]; 
+
+if(!file_exists($filepath)) {
+	fwrite(STDOUT, "no file exists.\n");
+	exit;
+}
+
+// ¥¨¥ó¥³¡¼¥É
+$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+
+$total = 0;
+
+for($i = 0; $i < 1500; $i++) {
+	$ret = lfRegistCSV($enc_filepath, $colmax, $total);
+	$total+= $ret;
+}
+
+fwrite(STDOUT, "¢£" . $total . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£\n");
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", MTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥«¥Æ¥´¥êID", "category_id", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price02", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþÀ©¸Â", "sale_limit", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥«¡¼URL", "comment1", LTEXT_LEN, "KVa", array("URL_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹", "product_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷¥³¥á¥ó¥È", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	for($i = 1; $i <= PRODUCTSUB_MAX; $i++) {
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë($i)", "sub_title$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È($i)", "sub_comment$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü($i)", "sub_image$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü³ÈÂç($i)", "sub_large_image$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	}
+		
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷²èÁü", "main_list_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¥á¥¤¥ó¾ÜºÙ²èÁü", "main_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¥á¥¤¥ó¾ÜºÙ³ÈÂç²èÁü", "main_large_image", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("Èæ³Ó²èÁü", "file1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", "file2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Á÷ÎÁ", "deliv_fee", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸ËÌµÀ©¸Â", "stock_unlimited", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ÈÎÇäÌµÀ©¸Â", "sale_unlimited", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+}
+
+/* ÆÃ¼ì¹àÌÜ¤ÎÊÑ´¹ */
+function lfConvFormat($array) {
+	global $arrDISP;
+	foreach($array as $key => $val) {
+		switch($key) {
+		case 'status':
+			$arrRet[$key] = sfSearchKey($arrDISP, $val, 1);
+			break;
+		default:
+			$arrRet[$key] = $val;
+			break;
+		}
+	}
+	return $arrRet;
+}
+
+/* ¾¦ÉÊ¤Î¿·µ¬ÄÉ²Ã */
+function lfInsertProduct($objQuery) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	
+	// µ¬³Ê¤ËÅÐÏ¿¤µ¤ì¤ëÃÍ¤ò½ü³°¤¹¤ë¡£
+	foreach($arrRet as $key => $val) {
+		switch($key) {
+		case 'product_code':
+		case 'price01':
+		case 'price02':
+		case 'stock':
+		case 'stock_unlimited':
+			break;
+		default:
+			$sqlval[$key] = $val;
+			break;
+		}
+	}
+				
+	$product_id = $objQuery->nextval("dtb_products", "product_id");
+	$sqlval['product_id'] = $product_id;
+	$sqlval['status'] = 1;	// É½¼¨¤ËÀßÄê¤¹¤ë¡£
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	
+	if($_SESSION['member_id'] == "") {
+		$sqlval['creator_id'] = '0';
+	}
+		
+	$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "delete = 0 AND category_id = ?", array($sqlval['category_id'])) + 1;
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrRet, $product_id);
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->fast_insert("dtb_products", $sqlval);
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError(false);
+	
+	if(!isset($objErr->arrErr['category_id'])) {
+		$objQuery = new SC_Query();
+		$col = "level";
+		$table = "dtb_category";
+		$where = "category_id = ?";
+		$level = $objQuery->get($table, $col, $where, array($arrRet['category_id']));
+		if($level != LEVEL_MAX) {
+			$objErr->arrErr['category_id'] = "¢¨ ¤³¤Î¥«¥Æ¥´¥êID¤Ë¤Ï¾¦ÉÊ¤òÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£";
+		}
+	}
+	return $objErr->arrErr;
+}
+
+function lfRegistCSV($filepath, $colmax, $total) {
+	global $objFormParam;
+			
+	$fp = fopen($filepath, "r");
+	$line = 0;		// ¹Ô¿ô
+	$regist = 0;	// ÅÐÏ¿¿ô
+	
+	$objQuery = new SC_Query();
+	
+	$err = false;
+	
+	while(!feof($fp)) {
+		$arrCSV = fgetcsv($fp, 10000);
+		// ¹Ô¥«¥¦¥ó¥È
+		$line++;
+						
+		// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+		$max = count($arrCSV);
+		
+		// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+		if($max <= 1) {
+			continue;			
+		}
+			
+		// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+		if($max != $colmax) {
+			fwrite(STDOUT, "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£\n");
+			
+			ob_start();
+			print_r($arrCSV);
+			$objPage->tpl_debug = ob_get_contents();
+			ob_end_clean();	
+			
+			$err = true;
+		} else {
+			// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+			$objFormParam->setParam($arrCSV, true);
+			$arrRet = $objFormParam->getHashArray();
+			// ÃÍ¤ò¥Õ¥©¡¼¥Þ¥Ã¥ÈÊÑ´¹¤·¤Æ³ÊÇ¼¤¹¤ë¡£
+			$arrRet = lfConvFormat($arrRet);
+			$objFormParam->setParam($arrRet);
+			// ÆþÎÏÃÍ¤ÎÊÑ´¹
+			$objFormParam->convParam();
+			// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+			$objPage->arrCSVErr = lfCheckError();
+		}
+			
+		// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+		if(count($objPage->arrCSVErr) > 0) {
+			fwrite(STDOUT, "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£\n");
+			$objPage->arrParam = $objFormParam->getHashArray();
+			$err = true;
+		}
+			
+		if(!$err) {
+			$all = $total + $line;
+			fwrite(STDOUT, "writing $all\n");
+			$objQuery->begin();
+			lfInsertProduct($objQuery);
+			$objQuery->commit();
+			$regist++;
+		}
+	}
+	fclose($fp);
+	
+	return $regist;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/develop/upload_csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/develop/upload_csv.php	(revision 2706)
+++ /temp/tags/eccube-0_9_2beta/html/admin/develop/upload_csv.php	(revision 2706)
@@ -0,0 +1,248 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $arrCSVErr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'develop/upload_csv.tpl';
+		$this->tpl_subnavi = '';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'upload_csv';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if(ADMIN_MODE != 1) {
+	print("¤³¤Î¥Ú¡¼¥¸¤Ë¤Ï¡¢¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤»¤ó¡£");
+	exit;
+}
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+$objPage->arrTitle = $objFormParam->getTitleArray();
+
+switch($_POST['mode']) {
+case 'csv_upload':
+	$err = false;
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr['csv_file'] = $objUpFile->makeTempFile('csv_file');
+	
+	if($objPage->arrErr['css_file'] == "") {
+		$objPage->arrErr = $objUpFile->checkEXISTS();
+	}
+	
+	if($objPage->arrErr['csv_file'] == "") {
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$filepath = $objUpFile->getTempFilePath('csv_file');
+		// ¥¨¥ó¥³¡¼¥É
+		$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+		$fp = fopen($enc_filepath, "r");
+		
+		$line = 0;		// ¹Ô¿ô
+		$regist = 0;	// ÅÐÏ¿¿ô
+		
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		
+		while(!feof($fp) && !$err) {
+			$arrCSV = fgetcsv($fp, 10000);
+			// ¹Ô¥«¥¦¥ó¥È
+			$line++;
+	
+			// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+			$max = count($arrCSV);
+			
+			// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+			if($max <= 1) {
+				continue;			
+			}
+			
+			// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+			if($max != $colmax) {
+				$objPage->arrCSVErr['blank'] = "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£";
+				
+				ob_start();
+				print_r($arrCSV);
+				$objPage->tpl_debug = ob_get_contents();
+				ob_end_clean();	
+				
+				$err = true;
+			} else {
+				// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+				$objFormParam->setParam($arrCSV, true);
+				$arrRet = $objFormParam->getHashArray();
+				// ÃÍ¤ò¥Õ¥©¡¼¥Þ¥Ã¥ÈÊÑ´¹¤·¤Æ³ÊÇ¼¤¹¤ë¡£
+				$arrRet = lfConvFormat($arrRet);
+				$objFormParam->setParam($arrRet);
+				// ÆþÎÏÃÍ¤ÎÊÑ´¹
+				$objFormParam->convParam();
+				// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+				$objPage->arrCSVErr = lfCheckError();
+			}
+			
+			// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			if(count($objPage->arrCSVErr) > 0) {
+				$objPage->tpl_errtitle = "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+				$objPage->arrParam = $objFormParam->getHashArray();
+				$err = true;
+			}
+			
+			if(!$err) {
+				gfPrintLog("write $line");
+				lfInsertProduct($objQuery);
+				$regist++;
+			}
+		}
+		fclose($fp);
+		
+		if(!$err) {
+			$objQuery->commit();
+			
+			gfPrintLog("commit csv:$regist");
+						
+			$objPage->tpl_oktitle = "¢£" . $regist . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£";
+		} else {
+			$objQuery->rollback();
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", MTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥«¥Æ¥´¥êID", "category_id", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price02", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþÀ©¸Â", "sale_limit", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥«¡¼URL", "comment1", LTEXT_LEN, "KVa", array("URL_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹", "product_flag", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷¥³¥á¥ó¥È", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	for($i = 1; $i <= PRODUCTSUB_MAX; $i++) {
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë($i)", "sub_title$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È($i)", "sub_comment$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü($i)", "sub_image$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+		$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü³ÈÂç($i)", "sub_large_image$i", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	}
+		
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷²èÁü", "main_list_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¥á¥¤¥ó¾ÜºÙ²èÁü", "main_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¥á¥¤¥ó¾ÜºÙ³ÈÂç²èÁü", "main_large_image", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("Èæ³Ó²èÁü", "file1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK","FIND_FILE"));
+	$objFormParam->addParam("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", "file2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Á÷ÎÁ", "deliv_fee", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸ËÌµÀ©¸Â", "stock_unlimited", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ÈÎÇäÌµÀ©¸Â", "sale_unlimited", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+}
+
+/* ÆÃ¼ì¹àÌÜ¤ÎÊÑ´¹ */
+function lfConvFormat($array) {
+	global $arrDISP;
+	foreach($array as $key => $val) {
+		switch($key) {
+		case 'status':
+			$arrRet[$key] = sfSearchKey($arrDISP, $val, 1);
+			break;
+		default:
+			$arrRet[$key] = $val;
+			break;
+		}
+	}
+	return $arrRet;
+}
+
+/* ¾¦ÉÊ¤Î¿·µ¬ÄÉ²Ã */
+function lfInsertProduct($objQuery) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	
+	// µ¬³Ê¤ËÅÐÏ¿¤µ¤ì¤ëÃÍ¤ò½ü³°¤¹¤ë¡£
+	foreach($arrRet as $key => $val) {
+		switch($key) {
+		case 'product_code':
+		case 'price01':
+		case 'price02':
+		case 'stock':
+		case 'stock_unlimited':
+			break;
+		default:
+			$sqlval[$key] = $val;
+			break;
+		}
+	}
+			
+	$product_id = $objQuery->nextval("dtb_products", "product_id");
+	$sqlval['product_id'] = $product_id;
+	$sqlval['status'] = 1;	// É½¼¨¤ËÀßÄê¤¹¤ë¡£
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "delete = 0 AND category_id = ?", array($sqlval['category_id'])) + 1;
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrRet, $product_id);
+	
+	gfPrintLog("insert productclass end");
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_products", $sqlval);
+	
+	gfPrintLog("insert product end");
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError(false);
+	
+	if(!isset($objErr->arrErr['category_id'])) {
+		$objQuery = new SC_Query();
+		$col = "level";
+		$table = "dtb_category";
+		$where = "category_id = ?";
+		$level = $objQuery->get($table, $col, $where, array($arrRet['category_id']));
+		if($level != LEVEL_MAX) {
+			$objErr->arrErr['category_id'] = "¢¨ ¤³¤Î¥«¥Æ¥´¥êID¤Ë¤Ï¾¦ÉÊ¤òÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/login.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/login.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/login.php	(revision 1328)
@@ -0,0 +1,78 @@
+<?php
+require_once("./require.php");
+
+$conn = new SC_DBConn();
+
+$osess = new SC_Session();
+$ret = false;
+
+// ÆþÎÏÈ½Äê
+if(strlen($_POST{'login_id'}) > 0 && strlen($_POST{'password'}) > 0) {
+	// Ç§¾Ú¥Ñ¥¹¥ï¡¼¥É¤ÎÈ½Äê
+	$ret = fnCheckPassword($conn);
+}
+
+if($ret){
+	// À®¸ù
+	header("Location: ".URL_HOME);
+	exit;
+} else {
+	// ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨
+	sfDispError(LOGIN_ERROR);
+	exit;
+}
+
+/* Ç§¾Ú¥Ñ¥¹¥ï¡¼¥É¤ÎÈ½Äê */
+function fnCheckPassword($conn) {
+	$sql = "SELECT member_id, password, authority, login_date, name FROM dtb_member WHERE login_id = ? AND delete <> 1 AND work = 1";
+	$arrcol = array ($_POST['login_id']);
+	// DB¤«¤é°Å¹æ²½¥Ñ¥¹¥ï¡¼¥É¤ò¼èÆÀ¤¹¤ë¡£
+	$data_list = $conn->getAll($sql ,$arrcol); 
+	// ¥Ñ¥¹¥ï¡¼¥É¤Î¼èÆÀ
+	$password = $data_list[0]['password'];
+	// ¥æ¡¼¥¶ÆþÎÏ¥Ñ¥¹¥ï¡¼¥É¤ÎÈ½Äê
+	$ret = crypt($_POST['password'], $password);
+	
+	if ($ret == $password) {
+   		// ¥»¥Ã¥·¥ç¥óÅÐÏ¿
+		fnSetLoginSession($data_list[0]['member_id'], $data_list[0]['authority'], $data_list[0]['login_date'], $data_list[0]['name']);
+		// ¥í¥°¥¤¥óÆü»þ¤ÎÅÐÏ¿
+		fnSetLoginDate();
+		return true;
+	} 
+	
+	// ¥Ñ¥¹¥ï¡¼¥É
+	gfPrintLog($_POST['login_id'] . " password incorrect.");
+	return false;
+}
+
+/* Ç§¾Ú¥»¥Ã¥·¥ç¥ó¤ÎÅÐÏ¿ */
+function fnSetLoginSession($member_id,$authority,$login_date, $login_name = '') {
+	global $osess;
+	// Ç§¾ÚºÑ¤ß¤ÎÀßÄê
+	$osess->SetSession('cert', CERT_STRING);
+	$osess->SetSession('login_id', $_POST{'login_id'});
+	$osess->SetSession('authority', $authority);
+	$osess->SetSession('member_id', $member_id);
+	$osess->SetSession('login_name', $login_name);
+	
+	if(strlen($login_date) > 0) {
+		$osess->SetSession('last_login', $login_date);
+	} else {
+		$osess->SetSession('last_login', date("Y-m-d H:i:s"));
+	}
+	$sid = $osess->GetSID();
+	// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+	gfPrintLog("login : user=".$_SESSION{'login_id'}." auth=".$_SESSION{'authority'}." lastlogin=". $_SESSION{'last_login'} ." sid=".$sid);
+}
+
+/* ¥í¥°¥¤¥óÆü»þ¤Î¹¹¿· */
+function fnSetLoginDate() {
+	global $osess;
+	$oquery = new SC_Query();
+	$sqlval['login_date'] = date("Y-m-d H:i:s");
+	$member_id = $osess->GetSession('member_id');
+	$where = "member_id = " . $member_id;
+	$ret = $oquery->update("dtb_member", $sqlval, $where);
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/logout.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/logout.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/logout.php	(revision 1328)
@@ -0,0 +1,10 @@
+<?php
+
+require_once("./require.php");
+
+$objSess = new SC_Session();
+$objSess->logout();
+
+header("Location: /admin/index.php");
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/customer/edit.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/customer/edit.php	(revision 3619)
+++ /temp/tags/eccube-0_9_2beta/html/admin/customer/edit.php	(revision 3619)
@@ -0,0 +1,332 @@
+<?php
+
+require_once("../require.php");
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+//---- ¥Ú¡¼¥¸É½¼¨ÍÑ¥¯¥é¥¹
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $list_data;
+
+	var $arrErr;
+	var $arrYear;
+	var $arrMonth;
+	var $arrDay;
+	var $arrPref;
+	var $arrJob;
+	var $arrSex;
+	var $arrReminder;
+	var $count;
+	
+	var $tpl_strnavi;
+				
+	function LC_Page() {
+		$this->tpl_mainpage = 'customer/edit.tpl';
+		$this->tpl_mainno = 'customer';
+		$this->tpl_subnavi = 'customer/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¸ÜµÒ¥Þ¥¹¥¿';
+		
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrJob;
+		$this->arrJob = $arrJob;
+		global $arrSex;		
+		$this->arrSex = $arrSex;
+		global $arrReminder;
+		$this->arrReminder = $arrReminder;
+	}
+}
+$objQuery = new SC_Query();
+$objConn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objDate = new SC_Date(1901);
+$objPage->arrYear = $objDate->getYear();	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "name01",		"convert" => "aKV" ),
+							 array(  "column" => "name02",		"convert" => "aKV" ),
+							 array(  "column" => "kana01",		"convert" => "CKV" ),
+							 array(  "column" => "kana02",		"convert" => "CKV" ),
+							 array(  "column" => "zip01",		"convert" => "n" ),
+							 array(  "column" => "zip02",		"convert" => "n" ),
+							 array(  "column" => "pref",		"convert" => "n" ),
+							 array(  "column" => "addr01",		"convert" => "aKV" ),
+							 array(  "column" => "addr02",		"convert" => "aKV" ),
+							 array(  "column" => "email",		"convert" => "a" ),
+							 array(  "column" => "tel01",		"convert" => "n" ),
+							 array(  "column" => "tel02",		"convert" => "n" ),
+							 array(  "column" => "tel03",		"convert" => "n" ),
+							 array(  "column" => "fax01",		"convert" => "n" ),
+							 array(  "column" => "fax02",		"convert" => "n" ),
+							 array(  "column" => "fax03",		"convert" => "n" ),
+							 array(  "column" => "sex",			"convert" => "n" ),
+							 array(  "column" => "job",			"convert" => "n" ),
+							 array(  "column" => "birth",		"convert" => "n" ),
+							 array(  "column" => "password",	"convert" => "a" ),
+							 array(  "column" => "reminder",	"convert" => "n" ),
+							 array(  "column" => "reminder_answer", "convert" => "aKV" ),
+							 array(  "column" => "note",		"convert" => "aKV" ),
+							 array(  "column" => "point",		"convert" => "n" ),
+							 array(  "column" => "status",		"convert" => "n" )
+						 );
+
+//---- ÅÐÏ¿½ü³°ÍÑ¥«¥é¥àÇÛÎó
+$arrRejectRegistColumn = array("year", "month", "day");
+
+// ¸¡º÷¾ò·ï¤òÊÝ»ý
+if ($_POST['mode'] == "edit_search") {
+	$arrSearch = $_POST;
+}else{
+	$arrSearch = $_POST['search_data'];
+}
+if(is_array($arrSearch)){
+	foreach($arrSearch as $key => $val){
+		$arrSearchData[$key] = $val;
+	}
+}
+
+$objPage->arrSearchData= $arrSearchData;
+
+//----¡¡¸ÜµÒÊÔ½¸¾ðÊó¼èÆÀ
+if (($_POST["mode"] == "edit" || $_POST["mode"] == "edit_search") && is_numeric($_POST["edit_customer_id"])) {
+
+	//--¡¡¸ÜµÒ¥Ç¡¼¥¿¼èÆÀ
+	$sql = "SELECT A.*, EXTRACT(EPOCH FROM A.birth) AS birth_unix, B.mail_flag FROM dtb_customer AS A LEFT OUTER JOIN dtb_customer_mail AS B USING(email)
+			 WHERE A.delete = 0 AND A.customer_id = ?";
+	$result = $objConn->getAll($sql, array($_POST["edit_customer_id"]));
+	$objPage->list_data = $result[0];
+	
+	if (strlen($objPage->list_data["birth_unix"]) > 0) {
+		$objPage->list_data["year"] = date("Y", $objPage->list_data["birth_unix"]);
+		$objPage->list_data["month"] = date("m", $objPage->list_data["birth_unix"]);
+		$objPage->list_data["day"] = date("d", $objPage->list_data["birth_unix"]);
+	}
+	$objPage->list_data["password"] = DEFAULT_PASSWORD;
+	//DBÅÐÏ¿¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÅÏ¤¹
+	$objPage->tpl_edit_email = $result[0]['email'];
+	//¹ØÆþÍúÎò¾ðÊó¤Î¼èÆÀ
+	$objPage->arrPurchaseHistory = lfPurchaseHistory($_POST['edit_customer_id']);
+	// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+	$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+}
+
+//----¡¡¸ÜµÒ¾ðÊóÊÔ½¸
+if ( $_POST["mode"] != "edit" && is_numeric($_POST["customer_id"])) {
+
+	//-- POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+	//-- ÆþÎÏ¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+
+	//-- ÆþÎÏ¥¨¥é¡¼È¯À¸ or ¥ê¥¿¡¼¥ó»þ
+	if ($objPage->arrErr || $_POST["mode"] == "return") {
+		foreach($objPage->arrForm as $key => $val) {
+			$objPage->list_data[ $key ] = $val;
+		}
+		//¹ØÆþÍúÎò¾ðÊó¤Î¼èÆÀ
+		$objPage->arrPurchaseHistory = lfPurchaseHistory($_POST['customer_id']);
+		// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+		$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+		
+	} else {
+		//-- ³ÎÇ§
+		if ($_POST["mode"] == "confirm") {
+			$objPage->tpl_mainpage = 'customer/edit_confirm.tpl';
+			$passlen = strlen($objPage->arrForm['password']);
+			$objPage->passlen = lfPassLen($passlen);
+		}
+		//--¡¡ÊÔ½¸
+		if($_POST["mode"] == "complete") {
+			$objPage->tpl_mainpage = 'customer/edit_complete.tpl';
+			
+			// ¸½ºß¤Î²ñ°÷¾ðÊó¤ò¼èÆÀ¤¹¤ë
+			$arrCusSts = $objQuery->getOne("SELECT status FROM dtb_customer WHERE customer_id = ?", array($_POST["customer_id"]));
+
+			// ²ñ°÷¾ðÊó¤¬ÊÑ¹¹¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥·¡¼¥¯¥ì¥Ã¥È¢ñ¤â¹¹¿·¤¹¤ë¡£
+			if ($arrCusSts != $_POST['status']){
+				$secret = sfGetUniqRandomId("r");
+				$objPage->arrForm['secret_key'] = $secret;
+				array_push($arrRegistColumn, array('column' => 'secret_key', 'convert' => 'n'));
+			}
+			
+			//-- ÊÔ½¸ÅÐÏ¿
+			sfEditCustomerData($objPage->arrForm, $arrRegistColumn);
+		}
+	}
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+
+//-------------- function
+
+// ÊÔ½¸ÅÐÏ¿
+function lfRegisDatat($array, $arrRegistColumn) {
+	global $objConn;
+	
+	foreach ($arrRegistColumn as $data) {
+		if($array[$data["column"]] != "") {
+			$arrRegist[$data["column"]] = $array[$data["column"]];
+		} else {
+			$arrRegist[$data["column"]] = NULL;
+		}
+	}
+	if (strlen($array["year"]) > 0) {
+		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+	}
+
+	//-- ¥Ñ¥¹¥ï¡¼¥É¤Î¹¹¿·¤¬¤¢¤ë¾ì¹ç¤Ï°Å¹æ²½¡£¡Ê¹¹¿·¤¬¤Ê¤¤¾ì¹ç¤ÏUPDATEÊ¸¤ò¹½À®¤·¤Ê¤¤¡Ë
+	if ($array["password"] != DEFAULT_PASSWORD) {
+		$arrRegist["password"] = crypt($array["password"]);
+	} else {
+		unset($arrRegist['password']);
+	}
+	
+	$arrRegist["update_date"] = "NOW()";
+	$arrRegistMail["mail_flag"] = $array["mail_flag"];
+	$arrRegistMail['email'] = $array['email'];
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+	$objConn->autoExecute("dtb_customer", $arrRegist, "customer_id = '" .addslashes($array["customer_id"]). "'");
+	//-- ¥á¥ë¥Þ¥¬ÅÐÏ¿
+	$objConn->autoExecute("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($array["edit_email"]). "'");
+	$objConn->query("COMMIT");
+}
+
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+
+	$objErr->doFunc(array("²ñ°÷¾õÂÖ", 'status'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÀ«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡ÊÌ¾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê¡Ê1¡Ë", "addr01", MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê¡Ê2¡Ë", "addr02", MTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	
+	//¸½²ñ°÷¤ÎÈ½Äê ¢ª¡¡¸½²ñ°÷¤â¤·¤¯¤Ï²¾ÅÐÏ¿Ãæ¤Ï¡¢¥á¥¢¥É°ì°Õ¤¬Á°Äó¤Ë¤Ê¤Ã¤Æ¤ë¤Î¤ÇÆ±¤¸¥á¥¢¥É¤ÇÅÐÏ¿ÉÔ²Ä
+	if (strlen($array["email"]) > 0) {
+		$sql = "SELECT customer_id FROM dtb_customer WHERE email ILIKE ? escape '#' AND (status = 1 OR status = 2) AND delete = 0 AND customer_id <> ?";
+		$checkMail = ereg_replace( "_", "#_", $array["email"]);
+		$result = $objConn->getAll($sql, array($checkMail, $array["customer_id"]));
+		if (count($result) > 0) {
+			$objErr->arrErr["email"] .= "¢¨ ¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£";
+		} 
+	}
+	
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(¥â¥Ð¥¤¥ë)', "email_mobile", MTEXT_LEN) ,array("EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ", "fax01", "fax02", "fax03", TEL_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("¤´À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¤´¿¦¶È", "job") ,array("NUM_CHECK"));
+	if ($array["password"] != DEFAULT_PASSWORD) {
+		$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	}
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¥Ò¥ó¥È ¼ÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¥Ò¥ó¥È Åú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag") ,array("SELECT_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", 'mail_flag'), array("SELECT_CHECK"));
+	$objErr->doFunc(array("SHOPÍÑ¥á¥â", 'note', LTEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("½ê»ý¥Ý¥¤¥ó¥È", "point", TEL_LEN) ,array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	return $objErr->arrErr;
+	
+}
+
+//¹ØÆþÍúÎò¾ðÊó¤Î¼èÆÀ
+function lfPurchaseHistory($customer_id){
+		global $objQuery;
+		global $objPage;
+		
+		$objPage->tpl_pageno = $_POST['search_pageno'];
+		$objPage->edit_customer_id = $customer_id;
+
+		// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+		$page_max = SEARCH_PMAX;
+		//¹ØÆþÍúÎò¤Î·ï¿ô¼èÆÀ
+		$objPage->tpl_linemax = $objQuery->count("dtb_order","customer_id=?", array($customer_id));
+		$linemax = $objPage->tpl_linemax;
+		
+		// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+		$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage2", NAVI_PMAX);
+		$objPage->arrPagenavi = $objNavi->arrPagenavi;
+		$objPage->arrPagenavi['mode'] = 'edit';
+		$startno = $objNavi->start_row;
+		
+		// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+		$objQuery->setlimitoffset($page_max, $startno);
+		// É½¼¨½ç½ø
+		$order = "order_id DESC";
+		$objQuery->setorder($order);
+		//¹ØÆþÍúÎò¾ðÊó¤Î¼èÆÀ
+		$arrPurchaseHistory = $objQuery->select("*", "dtb_order", "customer_id=?", array($customer_id));
+		
+		return $arrPurchaseHistory;
+}
+
+//³ÎÇ§¥Ú¡¼¥¸ÍÑ¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨ÍÑ
+
+function lfPassLen($passlen){
+	$ret = "";
+	for ($i=0;$i<$passlen;true){
+		$ret.="*";
+		$i++;
+	}
+	return $ret;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/customer/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/customer/index.php	(revision 2166)
+++ /temp/tags/eccube-0_9_2beta/html/admin/customer/index.php	(revision 2166)
@@ -0,0 +1,424 @@
+<?php
+
+require_once("../require.php");
+require_once(ROOT_DIR."data/include/csv_output.inc");
+
+//---- ¥Ú¡¼¥¸É½¼¨ÍÑ¥¯¥é¥¹
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	var $list_data;
+	var $search_data;
+	var $arrErr;
+	var $arrYear;
+	var $arrMonth;
+	var $arrDay;
+	var $arrJob;
+	var $arrSex;
+	var $arrPageMax;
+	var $count;
+	var $search_SQL;
+	
+	var $tpl_strnavi;
+	
+	var $arrHtmlmail;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'customer/index.tpl';
+		$this->tpl_mainno = 'customer';
+		$this->tpl_subnavi = 'customer/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¸ÜµÒ¥Þ¥¹¥¿';
+		
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrJob;
+		$arrJob["ÉÔÌÀ"] = "ÉÔÌÀ";
+		$this->arrJob = $arrJob;
+		global $arrSex;		
+		$this->arrSex = $arrSex;
+		global $arrPageRows;
+		$this->arrPageRows = $arrPageRows;
+		
+		global $arrMAILMAGATYPE;
+		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
+		$this->arrHtmlmail[''] = "¤¹¤Ù¤Æ";
+		$this->arrHtmlmail[1] = $arrMAILMAGATYPE[1];
+		$this->arrHtmlmail[2] = $arrMAILMAGATYPE[2];		
+	}
+}
+
+//----¡¡CSV¥À¥¦¥ó¥í¡¼¥ÉÍÑ
+$arrColumnCSV= array(
+						0  => array("sql" => "customer_id", "csv" => "customer_id", "header" => "¸ÜµÒID"),
+						1  => array("sql" => "name01", "csv" => "name01", "header" => "Ì¾Á°1"),
+						2  => array("sql" => "name02", "csv" => "name02", "header" => "Ì¾Á°2"),
+						3  => array("sql" => "kana01", "csv" => "kana01", "header" => "¥Õ¥ê¥¬¥Ê1"),
+						4  => array("sql" => "kana02", "csv" => "kana02", "header" => "¥Õ¥ê¥¬¥Ê2"),
+						5  => array("sql" => "zip01", "csv" => "zip01", "header" => "Í¹ÊØÈÖ¹æ1"),
+						6  => array("sql" => "zip02", "csv" => "zip02", "header" => "Í¹ÊØÈÖ¹æ2"),
+						7  => array("sql" => "pref", "csv" => "pref", "header" => "ÅÔÆ»ÉÜ¸©"),
+						8  => array("sql" => "addr01", "csv" => "addr01", "header" => "½»½ê1"),
+						9  => array("sql" => "addr02", "csv" => "addr02", "header" => "½»½ê2"),
+						10 => array("sql" => "email", "csv" => "email", "header" => "E-MAIL"),
+						11 => array("sql" => "tel01", "csv" => "tel01", "header" => "TEL1"),
+						12 => array("sql" => "tel02", "csv" => "tel02", "header" => "TEL2"),
+						13 => array("sql" => "tel03", "csv" => "tel03", "header" => "TEL3"),
+						14 => array("sql" => "fax01", "csv" => "fax01", "header" => "FAX1"),
+						15 => array("sql" => "fax02", "csv" => "fax02", "header" => "FAX2"),
+						16 => array("sql" => "fax03", "csv" => "fax03", "header" => "FAX3"),
+						17 => array("sql" => "CASE WHEN sex = 1 THEN 'ÃËÀ­' ELSE '½÷À­' END AS sex", "csv" => "sex", "header" => "À­ÊÌ"),
+						18 => array("sql" => "job", "csv" => "job", "header" => "¿¦¶È"),
+						19 => array("sql" => "to_char(birth, 'YYYYÇ¯MM·îDDÆü') AS birth", "csv" => "birth", "header" => "ÃÂÀ¸Æü"),
+						20 => array("sql" => "to_char(first_buy_date, 'YYYYÇ¯MM·îDDÆüHH24:MI') AS first_buy_date", "csv" => "first_buy_date", "header" => "½é²ó¹ØÆþÆü"),
+						21 => array("sql" => "to_char(last_buy_date, 'YYYYÇ¯MM·îDDÆüHH24:MI') AS last_buy_date", "csv" => "last_buy_date", "header" => "ºÇ½ª¹ØÆþÆü"),
+						22 => array("sql" => "buy_times", "csv" => "buy_times", "header" => "¹ØÆþ²ó¿ô"),
+						23 => array("sql" => "point", "csv" => "point", "header" => "¥Ý¥¤¥ó¥È»Ä¹â"),
+						24 => array("sql" => "note", "csv" => "note", "header" => "È÷¹Í"),
+						25 => array("sql" => "to_char(create_date, 'YYYYÇ¯MM·îDDÆüHH24:MI') AS create_date", "csv" => "create_date", "header" => "ÅÐÏ¿Æü"),
+						26 => array("sql" => "to_char(update_date, 'YYYYÇ¯MM·îDDÆüHH24:MI') AS update_date", "csv" => "update_date", "header" => "¹¹¿·Æü")
+					);
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$objConn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objDate = new SC_Date(1901);
+$objPage->arrYear = $objDate->getYear();	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+$objPage->objDate = $objDate;
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// POSTÃÍ¤Î°ú¤­·Ñ¤®
+$objPage->arrForm = $_POST;
+
+// ¥Ú¡¼¥¸Á÷¤êÍÑ
+$objPage->arrHidden['search_pageno'] = $_POST['search_pageno'];
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	switch($key) {
+		case 'sex':
+			$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
+			if(!is_array($val)) {
+				$objPage->arrForm[$key] = split("-", $val);
+			}
+			break;
+		default:
+			$objPage->arrHidden[$key] = $val;
+			break;
+	}
+}
+
+// ¸ÜµÒºï½ü
+if ($_POST['mode'] == "delete") {
+	$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND delete = 0";
+	$result_customer = $objConn->getAll($sql, array($_POST["edit_customer_id"]));
+
+	if ($result_customer[0]["status"] == 2) {			//ËÜ²ñ°÷ºï½ü
+		$arrDel = array("delete" => 1, "update_date" => "NOW()"); 
+		$objConn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["edit_customer_id"]) );
+	} elseif ($result_customer[0]["status"] == 1) {		//²¾²ñ°÷ºï½ü
+		$sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
+		$objConn->query($sql, array($_POST["edit_customer_id"]));
+	}
+	$sql = "DELETE FROM dtb_customer_mail WHERE email = ?";
+	$objConn->query($sql, array($result_customer[0]["email"]));
+}
+
+if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError($objPage->arrForm);
+
+	$where = "delete = 0";
+
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	if (count($objPage->arrErr) == 0) {
+		
+		//-- ¸¡º÷¥Ç¡¼¥¿¼èÆÀ
+		$objSelect = new SC_CustomerList($objPage->arrForm, "customer");
+		
+		// É½¼¨·ï¿ôÀßÄê
+		$page_rows = $objPage->arrForm['page_rows'];
+		if(is_numeric($page_rows)) {	
+			$page_max = $page_rows;
+		} else {
+			$page_max = SEARCH_PMAX;
+		}
+		$offset = $page_max * ($objPage->arrForm['search_pageno'] - 1);
+		$objSelect->setLimitOffset($page_max, $offset);		
+		
+		if ($_POST["mode"] == 'csv') {
+			$searchSql = $objSelect->getListCSV($arrColumnCSV);
+		}else{
+			$searchSql = $objSelect->getList();
+		}
+		
+		$objPage->search_data = $objConn->getAll($searchSql, $objSelect->arrVal);
+
+		switch($_POST['mode']) {
+		case 'csv':
+			$i = 0;
+			$header = "";
+			
+			// CSV¥«¥é¥à¼èÆÀ
+			$arrCsvOutput = (sfgetCsvOutput(2, " WHERE csv_id = 2 AND status = 1"));
+
+			if (count($arrCsvOutput) <= 0) break;
+
+			foreach($arrCsvOutput as $data) {
+				$arrColumn[] = $data["col"];
+				if ($i != 0) $header .= ", ";
+				$header .= $data["disp_name"];
+				$i ++;
+			}
+			$header .= "\n";
+
+			//-¡¡ÅÔÆ»ÉÜ¸©/¿¦¶È¤ÎÊÑ´¹
+			for($i = 0; $i < count($objPage->search_data); $i ++) {
+				$objPage->search_data[$i]["pref"] = $arrPref[ $objPage->search_data[$i]["pref"] ];
+				$objPage->search_data[$i]["job"]  = $arrJob[ $objPage->search_data[$i]["job"] ];
+			}
+
+			//-¡¡CSV½ÐÎÏ
+			$data = lfGetCSVData($objPage->search_data, $arrColumn);
+			
+			sfCSVDownload($header.$data);
+			exit;
+			break;
+		case 'delete_all':
+			// ¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü
+			$where = "product_id IN (SELECT product_id FROM vw_products_nonclass WHERE $where)";
+			$sqlval['delete'] = 1;
+			$objQuery->update("dtb_products", $sqlval, $where, $arrval);
+
+			$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND delete = 0";
+			$result_customer = $objConn->getAll($sql, array($_POST["del_customer_id"]));
+
+			if ($result_customer[0]["status"] == 2) {			//ËÜ²ñ°÷ºï½ü
+				$arrDel = array("delete" => 1, "update_date" => "NOW()");
+				$objConn->autoExecute("dtb_customer", $arrDel, "customer_id = " .addslashes($_POST["del_customer_id"]) );
+			} elseif ($result_customer[0]["status"] == 1) {		//²¾²ñ°÷ºï½ü
+				$sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
+				$objConn->query($sql, array($_POST["del_customer_id"]));
+			}
+			$sql = "DELETE FROM dtb_customer_mail WHERE email = ?";
+			$objConn->query($sql, array($result_customer[0]["email"]));	
+			
+			break;
+		default:
+
+			// ¹Ô¿ô¤Î¼èÆÀ
+			$linemax = $objConn->getOne( $objSelect->getListCount(), $objSelect->arrVal);
+			$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+			$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnCustomerPage", NAVI_PMAX);
+			$startno = $objNavi->start_row;
+			$objPage->arrPagenavi = $objNavi->arrPagenavi;		
+		}
+	}
+}
+
+$objPage->arrCatList = sfGetCategoryList();
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+//--------------------------------------------------------------------------------------------------------------------------------------
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam() {
+	global $objPage;
+	
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	$arrConvList['customer_id'] = "n" ;
+	$arrConvList['name'] = "aKV" ;
+	$arrConvList['pref'] = "n" ;
+	$arrConvList['kana'] = "CKV" ;
+	$arrConvList['b_start_year'] = "n" ;
+	$arrConvList['b_start_month'] = "n" ;
+	$arrConvList['b_start_day'] = "n" ;
+	$arrConvList['b_end_year'] = "n" ;
+	$arrConvList['b_end_month'] = "n" ;
+	$arrConvList['b_end_day'] = "n" ;
+	$arrConvList['tel'] = "n" ;
+	$arrConvList['birth_month'] = "n" ;
+	$arrConvList['email'] = "a" ;
+	$arrConvList['buy_total_from'] = "n" ;
+	$arrConvList['buy_total_to'] = "n" ;
+	$arrConvList['buy_times_from'] = "n" ;
+	$arrConvList['buy_times_to'] = "n" ;
+	$arrConvList['start_year'] = "n" ;
+	$arrConvList['start_month'] = "n" ;
+	$arrConvList['start_day'] = "n" ;
+	$arrConvList['end_year'] = "n" ;
+	$arrConvList['end_month'] = "n" ;
+	$arrConvList['end_day'] = "n" ;
+	$arrConvList['page_rows'] = "n" ;
+	$arrConvList['buy_start_year'] = "n" ;		//¡¡ºÇ½ª¹ØÆþÆü START Ç¯
+	$arrConvList['buy_start_month'] = "n" ;		//¡¡ºÇ½ª¹ØÆþÆü START ·î
+	$arrConvList['buy_start_day'] = "n" ;		//¡¡ºÇ½ª¹ØÆþÆü START Æü
+	$arrConvList['buy_end_year'] = "n" ;			//¡¡ºÇ½ª¹ØÆþÆü END Ç¯
+	$arrConvList['buy_end_month'] = "n" ;		//¡¡ºÇ½ª¹ØÆþÆü END ·î
+	$arrConvList['buy_end_day'] = "n" ;			//¡¡ºÇ½ª¹ØÆþÆü END Æü
+	$arrConvList['buy_product_name'] = "aKV" ;	//¡¡¹ØÆþ¾¦ÉÊÌ¾
+	$arrConvList['buy_product_code'] = "aKV" ;	//¡¡¹ØÆþ¾¦ÉÊ¥³¡¼¥É
+	$arrConvList['category_id'] = "" ;			//¡¡¥«¥Æ¥´¥ê
+		
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError($array) {
+
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¸ÜµÒ¥³¡¼¥É", "customer_id", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", "pref", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸ÜµÒÌ¾", "name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸ÜµÒÌ¾(¥«¥Ê)", "kana", STEXT_LEN), array("KANA_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)", "b_start_year", "b_start_month", "b_start_day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÃÂÀ¸Æü(½ªÎ»Æü)", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)","ÃÂÀ¸Æü(½ªÎ»Æü)", "b_start_year", "b_start_month", "b_start_day", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_SET_TERM"));
+	$objErr->doFunc(array("ÃÂÀ¸·î", "birth_month", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "tel", TEL_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ¶â³Û(³«»Ï)", "buy_total_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ¶â³Û(½ªÎ»)", "buy_total_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	if ( (is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && ($array["buy_total_from"] > $array["buy_total_to"]) ) $objErr->arrErr["buy_total_from"] .= "¢¨ ¹ØÆþ¶â³Û¤Î»ØÄêÈÏ°Ï¤¬ÉÔÀµ¤Ç¤¹¡£";
+	$objErr->doFunc(array("¹ØÆþ²ó¿ô(³«»Ï)", "buy_times_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ²ó¿ô(½ªÎ»)", "buy_times_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	if ( (is_numeric($array["buy_times_from"]) && is_numeric($array["buy_times_to"]) ) && ($array["buy_times_from"] > $array["buy_times_to"]) ) $objErr->arrErr["buy_times_from"] .= "¢¨ ¹ØÆþ²ó¿ô¤Î»ØÄêÈÏ°Ï¤¬ÉÔÀµ¤Ç¤¹¡£";
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)", "start_year", "start_month", "start_day",), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "end_year", "end_month", "end_day"), array("CHECK_DATE"));	
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "start_year", "start_month", "start_day", "end_year", "end_month", "end_day"), array("CHECK_SET_TERM"));
+	$objErr->doFunc(array("É½¼¨·ï¿ô", "page_rows", 3), array("NUM_CHECK","MAX_LENGTH_CHECK"));	
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)", "buy_start_year", "buy_start_month", "buy_start_day",), array("CHECK_DATE"));	//ºÇ½ª¹ØÆþÆü(³«»ÏÆü)
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþ(½ªÎ»Æü)", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_DATE"));			//ºÇ½ª¹ØÆþÆü(½ªÎ»Æü)
+	//¹ØÆþ¶â³Û(from) ¡ä ¹ØÆþ¶â³Û(to) ¤Î¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "buy_start_year", "buy_start_month", "buy_start_day", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_SET_TERM"));	
+	$objErr->doFunc(array("¹ØÆþ¾¦ÉÊ¥³¡¼¥É", "buy_product_code", STEXT_LEN), array("MAX_LENGTH_CHECK"));						//¹ØÆþ¾¦ÉÊ¥³¡¼¥É
+	$objErr->doFunc(array("¹ØÆþ¾¦ÉÊÌ¾", "buy_product_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));							//¹ØÆþ¾¦ÉÊÌ¾¾Î
+
+	return $objErr->arrErr;
+}
+
+function lfSetWhere($arrForm){
+	foreach ($arrForm as $key => $val) {
+		
+		$val = sfManualEscape($val);
+		
+		if($val == "") continue;
+		
+		switch ($key) {
+			case 'product_id':
+				$where .= " AND product_id = ?";
+				$arrval[] = $val;
+				break;
+			case 'product_class_id':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_class_id = ?)";
+				$arrval[] = $val;
+				break;
+			case 'name':
+				$where .= " AND name ILIKE ?";
+				$arrval[] = "%$val%";
+				break;
+			case 'category_id':
+				list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
+				if($tmp_where != "") {
+					$where.= " AND $tmp_where";
+					$arrval = array_merge($arrval, $tmp_arrval);
+				}
+				break;
+			case 'product_code':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+				$arrval[] = "%$val%";
+				break;
+			case 'startyear':
+				$date = sfGetTimestamp($_POST['startyear'], $_POST['startmonth'], $_POST['startday']);
+				$where.= " AND update_date >= ?";
+				$arrval[] = $date;
+				break;
+			case 'endyear':
+				$date = sfGetTimestamp($_POST['endyear'], $_POST['endmonth'], $_POST['endday']);
+				$where.= " AND update_date <= ?";
+				$arrval[] = $date;
+				break;
+			case 'product_flag':
+				global $arrSTATUS;
+				$product_flag = sfSearchCheckBoxes($val);
+				if($product_flag != "") {
+					$where.= " AND product_flag LIKE ?";
+					$arrval[] = $product_flag;					
+				}
+				break;
+			case 'status':
+				$tmp_where = "";
+				foreach ($val as $element){
+					if ($element != ""){
+						if ($tmp_where == ""){
+							$tmp_where.="AND (status LIKE ? "; 
+						}else{
+							$tmp_where.="OR status LIKE ? ";
+						}
+						$arrval[]=$element;
+					}
+				}
+				if ($tmp_where != ""){
+					$tmp_where.=")";
+					$where.= "$tmp_where";
+				}	
+				break;
+			default:
+				break;
+		}
+	}
+}
+
+//---- CSV½ÐÎÏÍÑ¥Ç¡¼¥¿¼èÆÀ
+function lfGetCSVData( $array, $arrayIndex){	
+	
+	for ($i=0; $i<count($array); $i++){
+		
+		for ($j=0; $j<count($array[$i]); $j++ ){
+			if ( $j > 0 ) $return .= ",";
+			$return .= "\"";			
+			if ( $arrayIndex ){
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";	
+			} else {
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+			}
+		}
+		$return .= "\n";			
+	}
+	
+	return $return;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/payment_input.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/payment_input.php	(revision 2004)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/payment_input.php	(revision 2004)
@@ -0,0 +1,164 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/payment_input.tpl';
+		$this->tpl_subtitle = '»ÙÊ§ÊýË¡ÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+$objUpFile = lfInitFile($objUpFile);
+// Hidden¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+$objUpFile->setHiddenFileList($_POST);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'edit':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError();
+	if(count($objPage->arrErr) == 0) {
+		lfRegistData($_POST['payment_id']);
+		// °ì»þ¥Õ¥¡¥¤¥ë¤òËÜÈÖ¥Ç¥£¥ì¥¯¥È¥ê¤Ë°ÜÆ°¤¹¤ë
+		$objUpFile->moveTempFile();
+		// ¿Æ¥¦¥£¥ó¥É¥¦¤ò¹¹¿·¤¹¤ë¤è¤¦¤Ë¥»¥Ã¥È¤¹¤ë¡£
+		$objPage->tpl_onload="fnUpdateParent('".URL_PAYMENT_TOP."'); window.close();";
+	}
+	break;
+// ²èÁü¤Î¥¢¥Ã¥×¥í¡¼¥É
+case 'upload_image':
+	// ¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+	$objPage->arrErr = array_merge($objPage->arrErr, $objUpFile->checkEXISTS($_POST['image_key']));
+	// ²èÁüÊÝÂ¸½èÍý
+	$objPage->arrErr[$_POST['image_key']] = $objUpFile->makeTempFile($_POST['image_key']);
+	break;
+// ²èÁü¤Îºï½ü
+case 'delete_image':
+	$objUpFile->deleteFile($_POST['image_key']);
+	break;
+default:
+	break;
+}
+
+if($_POST['mode'] == "") {
+	switch($_GET['mode']) {
+	case 'pre_edit':
+		if(sfIsInt($_GET['payment_id'])) {
+			$arrRet = lfGetData($_GET['payment_id']);
+			$objFormParam->setParam($arrRet);
+			// DB¥Ç¡¼¥¿¤«¤é²èÁü¥Õ¥¡¥¤¥ëÌ¾¤ÎÆÉ¹þ
+			$objUpFile->setDBFileList($arrRet);
+			$objPage->tpl_payment_id = $_GET['payment_id'];
+		}
+		break;
+	default:
+		break;
+	}
+} else {
+	$objPage->tpl_payment_id = $_POST['payment_id'];
+}
+
+$objPage->arrDelivList = sfGetIDValueList("dtb_deliv", "deliv_id", "service_name");
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+// FORMÉ½¼¨ÍÑÇÛÎó¤òÅÏ¤¹¡£
+$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+// HIDDENÍÑ¤ËÇÛÎó¤òÅÏ¤¹¡£
+$objPage->arrHidden = array_merge((array)$objPage->arrHidden, (array)$objUpFile->getHiddenFileList());
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile($objUpFile) {
+	$objUpFile->addFile("¥í¥´²èÁü", 'payment_image', array('gif'), IMAGE_SIZE, false, CLASS_IMAGE_WIDTH, CLASS_IMAGE_HEIGHT);
+	return $objUpFile;
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("»ÙÊ§ÊýË¡", "payment_method", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¼ê¿ôÎÁ", "charge", PRICE_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÍøÍÑ¾ò·ï(¡Á±ß°Ê¾å)", "rule", PRICE_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÍøÍÑ¾ò·ï(¡Á±ß°Ê²¼)", "upper_rule", PRICE_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÇÛÁ÷¥µ¡¼¥Ó¥¹", "deliv_id", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸ÇÄê", "fix");
+}
+
+/* DB¤«¤é¥Ç¡¼¥¿¤òÆÉ¤ß¹þ¤à */
+function lfGetData($payment_id) {
+	$objQuery = new SC_Query();
+	$where = "payment_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_payment", $where, array($payment_id));
+	return $arrRet[0];
+}
+
+/* DB¤Ø¥Ç¡¼¥¿¤òÅÐÏ¿¤¹¤ë */
+function lfRegistData($payment_id = "") {
+	global $objFormParam;
+	global $objUpFile;
+	
+	$objQuery = new SC_Query();
+	$sqlval = $objFormParam->getHashArray();
+	$arrRet = $objUpFile->getDBFileList();	// ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+	$sqlval = array_merge($sqlval, $arrRet);	
+	$sqlval['update_date'] = 'Now()';
+	
+	if($sqlval['fix'] != '1') {
+		$sqlval['fix'] = 2;	// ¼«Í³ÀßÄê
+	}
+	
+	// ¿·µ¬ÅÐÏ¿
+	if($payment_id == "") {
+		// INSERT¤Î¼Â¹Ô
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+		$sqlval['rank'] = $objQuery->max("dtb_payment", "rank") + 1;
+		$objQuery->insert("dtb_payment", $sqlval);
+	// ´ûÂ¸ÊÔ½¸
+	} else {
+		$where = "payment_id = ?";
+		$objQuery->update("dtb_payment", $sqlval, $where, array($payment_id));
+	}
+}
+
+/*¡¡ÍøÍÑ¾ò·ï¤Î¿ôÃÍ¥Á¥§¥Ã¥¯ */
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÍøÍÑ¾ò·ï¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("ÍøÍÑ¾ò·ï(¡Á±ß°Ê¾å)", "ÍøÍÑ¾ò·ï(¡Á±ß°Ê²¼)", "rule", "upper_rule"), array("GREATER_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/kiyaku.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/kiyaku.php	(revision 2762)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/kiyaku.php	(revision 2762)
@@ -0,0 +1,147 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/kiyaku.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'kiyaku';
+		$this->tpl_subtitle = '²ñ°÷µ¬ÌóÅÐÏ¿';
+		$this->tpl_mainno = 'basis';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// Í×µáÈ½Äê
+switch($_POST['mode']) {
+// ÊÔ½¸½èÍý
+case 'edit':
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm);
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck();
+	if(count($objPage->arrErr) <= 0) {
+		if($_POST['kiyaku_id'] == "") {
+			lfInsertClass($objPage->arrForm);	// ¿·µ¬ºîÀ®
+		} else {
+			lfUpdateClass($objPage->arrForm);	// ´ûÂ¸ÊÔ½¸
+		}
+		// ºÆÉ½¼¨
+		sfReload();
+	} else {
+		// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+		$objPage->tpl_kiyaku_id = $_POST['kiyaku_id'];
+	}
+	break;
+// ºï½ü
+case 'delete':
+	sfDeleteRankRecord("dtb_kiyaku", "kiyaku_id", $_POST['kiyaku_id'], "", true);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+// ÊÔ½¸Á°½èÍý
+case 'pre_edit':
+	// ÊÔ½¸¹àÌÜ¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£
+	$where = "kiyaku_id = ?";
+	$arrRet = $objQuery->select("kiyaku_text, kiyaku_title", "dtb_kiyaku", $where, array($_POST['kiyaku_id']));
+	// ÆþÎÏ¹àÌÜ¤Ë¥«¥Æ¥´¥êÌ¾¤òÆþÎÏ¤¹¤ë¡£
+	$objPage->arrForm['kiyaku_title'] = $arrRet[0]['kiyaku_title'];
+	$objPage->arrForm['kiyaku_text'] = $arrRet[0]['kiyaku_text'];
+	// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+	$objPage->tpl_kiyaku_id = $_POST['kiyaku_id'];
+break;
+case 'down':
+	sfRankDown("dtb_kiyaku", "kiyaku_id", $_POST['kiyaku_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'up':
+	sfRankUp("dtb_kiyaku", "kiyaku_id", $_POST['kiyaku_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+default:
+	break;
+}
+
+// µ¬³Ê¤ÎÆÉ¹þ
+$where = "delete <> 1";
+$objQuery->setorder("rank DESC");
+$objPage->arrKiyaku = $objQuery->select("kiyaku_title, kiyaku_text, kiyaku_id", "dtb_kiyaku", $where);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------------
+
+/* DB¤Ø¤ÎÁÞÆþ */
+function lfInsertClass($arrData) {
+	$objQuery = new SC_Query();
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['kiyaku_title'] = $arrData['kiyaku_title'];
+	$sqlval['kiyaku_text'] = $arrData['kiyaku_text'];
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_kiyaku", "rank") + 1;
+	$sqlval['update_date'] = "Now()";
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_kiyaku", $sqlval);
+	return $ret;
+}
+
+/* DB¤Ø¤Î¹¹¿· */
+function lfUpdateClass($arrData) {
+	$objQuery = new SC_Query();
+	// UPDATE¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['kiyaku_title'] = $arrData['kiyaku_title'];
+	$sqlval['kiyaku_text'] = $arrData['kiyaku_text'];
+	$sqlval['update_date'] = "Now()";
+	$where = "kiyaku_id = ?";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_kiyaku", $sqlval, $where, array($_POST['kiyaku_id']));
+	return $ret;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	// Ê¸»úÊÑ´¹
+	$arrConvList['kiyaku_title'] = "KVa";
+	$arrConvList['kiyaku_text'] = "KVa";
+
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("µ¬Ìó¥¿¥¤¥È¥ë", "kiyaku_title", SMTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("µ¬ÌóÆâÍÆ", "kiyaku_text", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	if(!isset($objErr->arrErr['name'])) {
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("kiyaku_id, kiyaku_title", "dtb_kiyaku", "delete = 0 AND kiyaku_title = ?", array($_POST['kiyaku_title']));
+		// ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËÆ±¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç		
+		if ($arrRet[0]['kiyaku_id'] != $_POST['kiyaku_id'] && $arrRet[0]['kiyaku_title'] == $_POST['kiyaku_title']) {
+			$objErr->arrErr['name'] = "¢¨ ´û¤ËÆ±¤¸ÆâÍÆ¤ÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/payment.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/payment.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/payment.php	(revision 1328)
@@ -0,0 +1,64 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/payment.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_mainno = 'basis';
+		$this->tpl_subno = 'payment';
+		$this->tpl_subtitle = '»ÙÊ§ÊýË¡ÀßÄê';
+	}
+}
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+switch($_POST['mode']) {
+	case 'delete':
+	// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü
+	sfDeleteRankRecord("dtb_payment", "payment_id", $_POST['payment_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'up':
+	sfRankUp("dtb_payment", "payment_id", $_POST['payment_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'down':
+	sfRankDown("dtb_payment", "payment_id", $_POST['payment_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+}
+
+$objPage->arrDelivList = sfGetIDValueList("dtb_deliv", "deliv_id", "service_name");
+$objPage->arrPaymentListFix = lfGetPaymentList(1);
+$objPage->arrPaymentListFree = lfGetPaymentList(2);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+// ÇÛÁ÷¶È¼Ô°ìÍ÷¤Î¼èÆÀ
+function lfGetPaymentList($fix = 1) {
+	$objQuery = new SC_Query();
+	// ÇÛÁ÷¶È¼Ô°ìÍ÷¤Î¼èÆÀ
+	$col = "payment_id, payment_method, charge, rule, upper_rule, note, deliv_id";
+	$where = "delete = 0 AND fix = ?";
+	$table = "dtb_payment";
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select($col, $table, $where, array($fix));
+	return $arrRet;
+}
+
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/delivery_input.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/delivery_input.php	(revision 1950)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/delivery_input.php	(revision 1950)
@@ -0,0 +1,176 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/delivery_input.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'delivery';
+		$this->tpl_mainno = 'basis';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		$this->tpl_subtitle = 'ÇÛÁ÷¶È¼ÔÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'edit':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError();
+	if(count($objPage->arrErr) == 0) {
+		$objPage->tpl_deliv_id = lfRegistData();
+		$objPage->tpl_onload = "window.alert('ÇÛÁ÷¶È¼ÔÀßÄê¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+	}
+	break;
+case 'pre_edit':
+	if($_POST['deliv_id'] != "") {
+		lfGetDelivData($_POST['deliv_id']);
+		$objPage->tpl_deliv_id = $_POST['deliv_id'];
+	}
+	break;
+default:
+	break;
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("ÇÛÁ÷¶È¼ÔÌ¾", "name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÁÉ¼No.³ÎÇ§URL", "confirm_url", STEXT_LEN, "n", array("URL_CHECK", "MAX_LENGTH_CHECK"), "http://");
+	
+	for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+		$objFormParam->addParam("ÇÛÁ÷»þ´Ö$cnt", "time$cnt", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	}
+	
+	if(INPUT_DELIV_FEE) {
+		for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+			$objFormParam->addParam("ÇÛÁ÷ÎÁ¶â$cnt", "fee$cnt", PRICE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+		}
+	}
+}
+
+/* DB¤ËÅÐÏ¿¤¹¤ë */
+function lfRegistData() {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval['name'] = $arrRet['name'];
+	$sqlval['service_name'] = $arrRet['name'];
+	$sqlval['confirm_url'] = $arrRet['confirm_url'];
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['update_date'] = 'Now()';
+	
+	if($_POST['deliv_id'] != "") {
+		$deliv_id = $_POST['deliv_id'];
+		$where = "deliv_id = ?";
+		$objQuery->update("dtb_deliv", $sqlval, $where, array($deliv_id));
+		$objQuery->delete("dtb_delivfee", $where, array($deliv_id));
+		$objQuery->delete("dtb_delivtime", $where, array($deliv_id));
+	} else {
+		// ÅÐÏ¿¤¹¤ëÇÛÁ÷¶È¼ÔID¤Î¼èÆÀ
+		$deliv_id = $objQuery->nextval('dtb_deliv', 'deliv_id');
+		$sqlval['deliv_id'] = $deliv_id;
+		$sqlval['rank'] = $objQuery->max("dtb_deliv", "rank") + 1;
+		// INSERT¤Î¼Â¹Ô
+		$objQuery->insert("dtb_deliv", $sqlval);
+	}
+	
+	$sqlval = array();
+	// ÇÛÁ÷»þ´Ö¤ÎÀßÄê
+	for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+		$keyname = "time$cnt";
+		if($arrRet[$keyname] != "") {
+			$sqlval['deliv_id'] = $deliv_id;
+			$sqlval['time'] = $arrRet[$keyname];
+			// INSERT¤Î¼Â¹Ô
+			$objQuery->insert("dtb_delivtime", $sqlval);
+		}
+	}
+	
+	if(INPUT_DELIV_FEE) {
+		$sqlval = array();
+		// ÇÛÁ÷ÎÁ¶â¤ÎÀßÄê
+		for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
+			$keyname = "fee$cnt";
+			if($arrRet[$keyname] != "") {
+				$sqlval['deliv_id'] = $deliv_id;
+				$sqlval['fee'] = $arrRet[$keyname];
+				$sqlval['pref'] = $cnt;
+				// INSERT¤Î¼Â¹Ô
+				$objQuery->insert("dtb_delivfee", $sqlval);
+			}
+		}
+	}
+	$objQuery->commit();
+	return $deliv_id;
+}
+
+/* ÇÛÁ÷¶È¼Ô¾ðÊó¤Î¼èÆÀ */
+function lfGetDelivData($deliv_id) {
+	global $objFormParam;
+	$objQuery = new SC_Query();
+	// ÇÛÁ÷¶È¼Ô°ìÍ÷¤Î¼èÆÀ
+	$col = "deliv_id, name, service_name, confirm_url";
+	$where = "deliv_id = ?";
+	$table = "dtb_deliv";
+	$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+	$objFormParam->setParam($arrRet[0]);
+	// ÇÛÁ÷»þ´Ö¤Î¼èÆÀ
+	$col = "time";
+	$where = "deliv_id = ?";
+	$table = "dtb_delivtime";
+	$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+	$objFormParam->setParamList($arrRet, 'time');
+	// ÇÛÁ÷ÎÁ¶â¤Î¼èÆÀ
+	$col = "fee";
+	$where = "deliv_id = ?";
+	$table = "dtb_delivfee";
+	$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+	$objFormParam->setParamList($arrRet, 'fee');
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	if(!isset($objErr->arrErr['name']) && $_POST['deliv_id'] == "") {
+		// ´ûÂ¸¥Á¥§¥Ã¥¯
+		$ret = sfIsRecord("dtb_deliv", "service_name", array($arrRet['service_name']));
+		if ($ret) {
+			$objErr->arrErr['name'] = "¢¨ Æ±¤¸Ì¾¾Î¤ÎÁÈ¤ß¹ç¤ï¤»¤ÏÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£<br>";
+		}
+	}
+	
+	return $objErr->arrErr;
+}
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/mail.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/mail.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/mail.php	(revision 1328)
@@ -0,0 +1,104 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/mail.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_mainno = 'basis';
+		$this->tpl_subno = 'mail';
+		$this->tpl_subtitle = '¥á¡¼¥ëÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$objPage->arrMailTEMPLATE = $arrMAILTEMPLATE;
+
+
+if ( $_POST['mode'] == 'id_set'){
+	// ¥Æ¥ó¥×¥ì¡¼¥È¥×¥ë¥À¥¦¥óÊÑ¹¹»þ
+	
+	if ( sfCheckNumLength( $_POST['template_id']) ){
+		$sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
+		$result = $conn->getAll($sql, array($_POST['template_id']) );
+		if ( $result ){
+			$objPage->arrForm = $result[0];
+		} else {
+			$objPage->arrForm['template_id'] = $_POST['template_id'];
+		}
+	}
+	
+} elseif ( $_POST['mode'] == 'regist' && sfCheckNumLength( $_POST['template_id']) ){
+
+	// POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = lfConvertParam($_POST);
+	$objPage->arrErr = fnErrorCheck($objPage->arrForm);
+	
+	if ( $objPage->arrErr ){
+		// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸
+		$objPage->tpl_msg = "¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿";
+		
+	} else {
+		// Àµ¾ï
+		lfRegist($conn, $objPage->arrForm);
+		
+		// ´°Î»¥á¥Ã¥»¡¼¥¸
+		$objPage->tpl_onload = "window.alert('¥á¡¼¥ëÀßÄê¤¬´°Î»¤·¤Þ¤·¤¿¡£¥Æ¥ó¥×¥ì¡¼¥È¤òÁªÂò¤·¤ÆÆâÍÆ¤ò¤´³ÎÇ§¤¯¤À¤µ¤¤¡£');";
+		unset($objPage->arrForm);
+	}
+
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+function lfRegist( $conn, $data ){
+	
+	$data['creator_id'] = $_SESSION['member_id'];
+	$data["update_date"] = "now()";
+	
+	$sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
+	$result = $conn->getAll($sql, array($_POST['template_id']) );
+	if ( $result ){
+		$sql_where = "template_id = ". addslashes($_POST['template_id']);
+	}
+	$conn->autoExecute("dtb_mailtemplate", $data, $sql_where);	
+}
+
+
+function lfConvertParam($array) {
+	
+	$new_array["template_id"] = $array["template_id"];
+	$new_array["subject"] = mb_convert_kana($array["subject"] ,"KV");
+	$new_array["header"] = mb_convert_kana($array["header"] ,"KV");
+	$new_array["footer"] = mb_convert_kana($array["footer"] ,"KV");
+	
+	return $new_array;
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
+function fnErrorCheck($array) {
+	
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È",'template_id'), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥¿¥¤¥È¥ë",'subject',MTEXT_LEN,"BIG"), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Ø¥Ã¥À¡¼",'header',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥Ã¥¿¡¼",'footer',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/delivery.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/delivery.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/delivery.php	(revision 1328)
@@ -0,0 +1,61 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/delivery.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'delivery';
+		$this->tpl_mainno = 'basis';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrTAXRULE;
+		$this->arrTAXRULE = $arrTAXRULE;
+		$this->tpl_subtitle = 'ÇÛÁ÷¶È¼ÔÀßÄê';
+
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+switch($_POST['mode']) {
+case 'delete':
+	// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü
+	sfDeleteRankRecord("dtb_deliv", "deliv_id", $_POST['deliv_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'up':
+	sfRankUp("dtb_deliv", "deliv_id", $_POST['deliv_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'down':
+	sfRankDown("dtb_deliv", "deliv_id", $_POST['deliv_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+default:
+	break;
+}
+
+// ÇÛÁ÷¶È¼Ô°ìÍ÷¤Î¼èÆÀ
+$col = "deliv_id, name, service_name";
+$where = "delete = 0";
+$table = "dtb_deliv";
+$objQuery->setorder("rank DESC");
+$objPage->arrDelivList = $objQuery->select($col, $table, $where);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/tradelaw.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/tradelaw.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/tradelaw.php	(revision 1328)
@@ -0,0 +1,139 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/tradelaw.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'tradelaw';
+		$this->tpl_mainno = 'basis';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrTAXRULE;
+		$this->arrTAXRULE = $arrTAXRULE;
+		$this->tpl_subtitle = 'ÆÃÄê¾¦¼è°úË¡';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+$cnt = $objQuery->count("dtb_baseinfo");
+
+if ($cnt > 0) {
+	$objPage->tpl_mode = "update";
+} else {
+	$objPage->tpl_mode = "insert";
+}
+
+if($_POST['mode'] != "") {
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	
+	if(count($objPage->arrErr) == 0) {
+		switch($_POST['mode']) {
+		case 'update':
+			lfUpdateData(); // ´ûÂ¸ÊÔ½¸
+			break;
+		case 'insert':
+			lfInsertData(); // ¿·µ¬ºîÀ®
+			break;
+		default:
+			break;
+		}
+		// ºÆÉ½¼¨
+		//sfReload();
+		$objPage->tpl_onload = "window.alert('ÆÃÄê¾¦¼è°úË¡¤ÎÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+	}
+} else {
+	$arrCol = $objFormParam->getKeyList(); // ¥­¡¼Ì¾°ìÍ÷¤ò¼èÆÀ
+	$col	= sfGetCommaList($arrCol);
+	$arrRet = $objQuery->select($col, "dtb_baseinfo");
+	// DBÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($arrRet[0]);
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("ÈÎÇä¶È¼Ô", "law_company", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("±¿±ÄÀÕÇ¤¼Ô", "law_manager", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "law_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "law_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "law_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "law_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "law_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "law_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "law_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "law_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ1", "law_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ2", "law_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("FAXÈÖ¹æ3", "law_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "law_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK"));
+	$objFormParam->addParam("URL", "law_url", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "URL_CHECK"));
+	$objFormParam->addParam("É¬Í×ÎÁ¶â", "law_term01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÃíÊ¸ÊýË¡", "law_term02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("»ÙÊ§ÊýË¡", "law_term03", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("»ÙÊ§´ü¸Â", "law_term04", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("°ú¤­ÅÏ¤·»þ´ü", "law_term05", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÊÖÉÊ¡¦¸ò´¹¤Ë¤Ä¤¤¤Æ", "law_term06", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+
+function lfUpdateData() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = 'Now()';
+	$objQuery = new SC_Query();
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_baseinfo", $sqlval);
+}
+
+function lfInsertData() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = 'Now()';
+	$objQuery = new SC_Query();
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_baseinfo", $sqlval);
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÅÅÏÃÈÖ¹æ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("TEL", "law_tel01", "law_tel02", "law_tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("FAX", "law_fax01", "law_fax02", "law_fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "law_zip01", "law_zip02"), array("ALL_EXIST_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/seo.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/seo.php	(revision 1977)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/seo.php	(revision 1977)
@@ -0,0 +1,168 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/seo.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'seo';
+		$this->tpl_mainno = 'basis';
+		$this->tpl_subtitle = 'SEO´ÉÍý';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrTAXRULE;
+		$this->arrTAXRULE = $arrTAXRULE;
+		
+	}
+}
+
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ç¡¼¥¿¤Î¼èÆÀ
+$arrPageData = lfgetPageData(" edit_flg = 2 ");
+$objPage->arrPageData = $arrPageData;
+
+$page_id = $_POST['page_id'];
+
+if($_POST['mode'] == "confirm") {
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr[$page_id] = lfErrorCheck($arrPOST['meta'][$page_id]);
+	
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¥Ç¡¼¥¿¤ò¹¹¿·
+	if(count($objPage->arrErr[$page_id]) == 0) {
+
+		// ¹¹¿·¥Ç¡¼¥¿¤ÎÊÑ´¹
+		$arrMETA = lfConvertParam($_POST['meta'][$page_id]);
+
+		// ¹¹¿·¥Ç¡¼¥¿ÇÛÎóÀ¸À®
+		$arrUpdData = array($arrMETA['author'], $arrMETA['description'], $arrMETA['keyword'], $page_id);
+		// ¥Ç¡¼¥¿¹¹¿·
+		lfUpdPageData($arrUpdData);
+	}else{	
+		// POST¤Î¥Ç¡¼¥¿¤òºÆÉ½¼¨
+		$arrPageData = lfSetData($arrPageData, $arrPOST['meta']);
+		$objPage->arrPageData = $arrPageData;
+	}
+}
+
+// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¥Ç¡¼¥¿¤Î¼èÆÀ
+if(count($objPage->arrErr[$page_id]) == 0) {
+	// ¥Ç¡¼¥¿¤Î¼èÆÀ
+	$arrPageData = lfgetPageData(" edit_flg = 2 ");
+	$objPage->arrPageData = $arrPageData;
+}
+
+// É½¼¨¥ÈóÉ½¼¨ÀÚ¤êÂØ¤¨
+$arrDisp_flg = array();
+foreach($arrPageData as $key => $val){
+	$arrDisp_flg[$val['page_id']] = $_POST['disp_flg'.$val['page_id']];
+}
+
+$objPage->disp_flg = $arrDisp_flg;
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdPageData
+ * ½èÍýÆâÍÆ	¡§¥Ú¡¼¥¸¥ì¥¤¥¢¥¦¥È¥Æ¡¼¥Ö¥ë¤Ë¥Ç¡¼¥¿¹¹¿·¤ò¹Ô¤¦
+ * °ú¿ô		¡§¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¹¹¿··ë²Ì
+ **************************************************************************************************************/
+function lfUpdPageData($arrUpdData = array()){
+	$objQuery = new SC_Query();
+	$sql = "";
+
+	// SQLÀ¸À®
+	$sql .= " UPDATE ";
+	$sql .= "     dtb_pagelayout ";
+	$sql .= " SET ";
+	$sql .= "     author = ? , ";
+	$sql .= "     description = ? , ";
+	$sql .= "     keyword = ? ";
+	$sql .= " WHERE ";
+	$sql .= "     page_id = ? ";
+	$sql .= " ";
+
+	// SQL¼Â¹Ô
+	$ret = $objQuery->query($sql, $arrUpdData);
+	
+	return $ret;	
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfErrorCheck
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô		¡§¥¨¥é¡¼¥Á¥§¥Ã¥¯ÂÐ¾Ý¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¥¨¥é¡¼ÆâÍÆ
+ **************************************************************************************************************/
+function lfErrorCheck($array) {
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥á¥¿¥¿¥°:Author", "author", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¥¿¥¿¥°:Description", "description", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¥¿¥¿¥°:Keywords", "keyword", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfSetData
+ * ½èÍýÆâÍÆ	¡§¥Æ¥ó¥×¥ì¡¼¥ÈÉ½¼¨¥Ç¡¼¥¿¤ËÃÍ¤ò¥»¥Ã¥È¤¹¤ë
+ * °ú¿ô1	¡§É½¼¨¸µ¥Ç¡¼¥¿
+ * °ú¿ô2	¡§É½¼¨¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§É½¼¨¥Ç¡¼¥¿
+ **************************************************************************************************************/
+function lfSetData($arrPageData, $arrDispData){
+	
+	foreach($arrPageData as $key => $val){
+		$page_id = $val['page_id'];
+		$arrPageData[$key]['author'] = $arrDispData[$page_id]['author'];
+		$arrPageData[$key]['description'] = $arrDispData[$page_id]['description'];
+		$arrPageData[$key]['keyword'] = $arrDispData[$page_id]['keyword'];
+	}
+	
+	return $arrPageData;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¿ÍÊª´ðËÜ¾ðÊó
+	
+	// ¥¹¥Ý¥Ã¥È¾¦ÉÊ
+	$arrConvList['author'] = "KVa";
+	$arrConvList['description'] = "KVa";
+	$arrConvList['keyword'] = "KVa";
+
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/index.php	(revision 3710)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/index.php	(revision 3710)
@@ -0,0 +1,209 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/index.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_mainno = 'basis';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrTAXRULE;
+		$this->arrTAXRULE = $arrTAXRULE;
+		$this->tpl_subtitle = 'SHOP¥Þ¥¹¥¿';
+	}
+}
+
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$cnt = $objQuery->count("dtb_baseinfo");
+
+if ($cnt > 0) {
+	$objPage->tpl_mode = "update";
+} else {
+	$objPage->tpl_mode = "insert";
+}
+
+if($_POST['mode'] != "") {
+	// POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	
+	// ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm);
+	// ÆþÎÏ¥Ç¡¼¥¿¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	
+	if(count($objPage->arrErr) == 0) {
+		switch($_POST['mode']) {
+		case 'update':
+			lfUpdateData($objPage->arrForm);	// ´ûÂ¸ÊÔ½¸
+			break;
+		case 'insert':
+			lfInsertData($objPage->arrForm);	// ¿·µ¬ºîÀ®
+			break;
+		default:
+			break;
+		}
+		// ºÆÉ½¼¨
+		sfReload();
+	}
+} else {
+	$arrCol = lfGetCol();
+	$col	= sfGetCommaList($arrCol);
+	$arrRet = $objQuery->select($col, "dtb_baseinfo");
+	$objPage->arrForm = $arrRet[0];
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+// ´ðËÜ¾ðÊóÍÑ¤Î¥«¥é¥à¤ò¼è¤ê½Ð¤¹¡£
+function lfGetCol() {
+	$arrCol = array(
+		"company_name",
+		"company_kana",
+		"shop_name",
+		"shop_kana",
+		"zip01",
+		"zip02",
+		"pref",
+		"addr01",
+		"addr02",
+		"tel01",
+		"tel02",
+		"tel03",
+		"fax01",
+		"fax02",
+		"fax03",
+		"business_hour",
+		"email01",
+		"email02",
+		"email03",
+		"email04",
+		"tax",
+		"tax_rule",
+		"free_rule",
+		"good_traded",
+		"message"
+		
+	);
+	return $arrCol;
+}
+
+function lfUpdateData($array) {
+	$objQuery = new SC_Query();
+	$arrCol = lfGetCol();
+	foreach($arrCol as $val) {
+		$sqlval[$val] = $array[$val];
+	}
+	$sqlval['update_date'] = 'Now()';
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_baseinfo", $sqlval);
+}
+
+function lfInsertData($array) {
+	$objQuery = new SC_Query();
+	$arrCol = lfGetCol();
+	foreach($arrCol as $val) {
+		$sqlval[$val] = $array[$val];
+	}	
+	$sqlval['update_date'] = 'Now()';
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_baseinfo", $sqlval);
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¿ÍÊª´ðËÜ¾ðÊó
+	
+	// ¥¹¥Ý¥Ã¥È¾¦ÉÊ
+	$arrConvList['company_name'] = "KVa";
+	$arrConvList['company_kana'] = "KVC";
+	$arrConvList['shop_name'] = "KVa";
+	$arrConvList['shop_kana'] = "KVC";
+	$arrConvList['addr01'] = "KVa";
+	$arrConvList['addr02'] = "KVa";
+	$arrConvList['zip01'] = "n";
+	$arrConvList['zip02'] = "n";
+	$arrConvList['tel01'] = "n";
+	$arrConvList['tel02'] = "n";
+	$arrConvList['tel03'] = "n";
+	$arrConvList['fax01'] = "n";
+	$arrConvList['fax02'] = "n";
+	$arrConvList['fax03'] = "n";
+	$arrConvList['email01'] = "a";
+	$arrConvList['email02'] = "a";
+	$arrConvList['email03'] = "a";
+	$arrConvList['email04'] = "a";
+	$arrConvList['tax'] = "n";
+	$arrConvList['free_rule'] = "n";
+	$arrConvList['business_hour'] = "KVa";
+	$arrConvList['good_traded'] = "";
+	$arrConvList['message'] = "";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("²ñ¼ÒÌ¾", "company_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("²ñ¼ÒÌ¾(¥«¥Ê)", "company_kana", STEXT_LEN), array("KANA_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("Å¹Ì¾", "shop_name", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("Å¹Ì¾(¥«¥Ê)", "shop_kana", STEXT_LEN), array("KANA_CHECK","MAX_LENGTH_CHECK"));
+	// Í¹ÊØÈÖ¹æ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1","zip01",ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK","NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2","zip02",ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK","NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	// ½»½ê¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", "pref"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("½»½ê1", "addr01", STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("½»½ê2", "addr02", STEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	// ¥á¡¼¥ë¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array('¾¦ÉÊÃíÊ¸¼õÉÕ¥á¡¼¥ë¥¢¥É¥ì¥¹', "email01", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('Ìä¤¤¹ç¤ï¤»¼õÉÕ¥á¡¼¥ë¥¢¥É¥ì¥¹', "email02", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ëÁ÷¿®¸µ¥á¡¼¥ë¥¢¥É¥ì¥¹', "email03", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('Á÷¿®¥¨¥é¡¼¼õÉÕ¥á¡¼¥ë¥¢¥É¥ì¥¹', "email04", STEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK","MAX_LENGTH_CHECK"));
+	// ÅÅÏÃÈÖ¹æ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("TEL", "tel01", "tel02", "tel03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	$objErr->doFunc(array("FAX", "fax01", "fax02", "fax03", TEL_ITEM_LEN), array("TEL_CHECK"));
+	// ¤½¤ÎÂ¾
+	$objErr->doFunc(array("¾ÃÈñÀÇÎ¨", "tax", PERCENTAGE_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("Á÷ÎÁÌµÎÁ¾ò·ï", "free_rule", PRICE_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("Å¹ÊÞ±Ä¶È»þ´Ö", "business_hour", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	$objErr->doFunc(array("¼è°·¾¦ÉÊ", "good_traded", LLTEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¥Ã¥»¡¼¥¸", "message", LLTEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/zip_install.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/zip_install.php	(revision 3108)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/zip_install.php	(revision 3108)
@@ -0,0 +1,99 @@
+<?php
+require_once("../require.php");
+
+ini_set("max_execution_time", 600);
+
+define("ZIP_CSV_LINE_MAX", 8192);
+define("IMAGE_MAX", 680);	// ²èÁü¤ÎÉ½¼¨¸Ä¿ô
+
+$path = ROOT_DIR . "html/admin/basis/KEN_ALL.CSV";
+
+$objQuery = new SC_Query();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$fp = fopen($path, "r");
+
+// °ìÉô¤ÎIE¤Ï256¥Ð¥¤¥È°Ê¾å¼õ¤±¼è¤Ã¤Æ¤«¤éÉ½¼¨¤ò³«»Ï¤¹¤ë¡£
+for($i = 0; $i < 256; $i++) {
+	print(" ");
+}
+print("\n");
+MyFlush();
+
+if(!$fp) {
+	sfErrorHeader(">> " . $path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+} else {
+	print("<img src='/img/install/main_w.jpg'><br>");
+	MyFlush();
+	
+	// CSV¤Î·ï¿ô¤ò¿ô¤¨¤ë
+	$line = 0;
+	while(!feof($fp)) {
+		fgets($fp, ZIP_CSV_LINE_MAX);
+		$line++;
+	}
+	
+	print("<img src='/img/install/space_w.gif'>");
+	MyFlush();
+		
+	// ¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¤òÌá¤¹
+	fseek($fp, 0);
+	
+	// ²èÁü¤ò°ì¸ÄÉ½¼¨¤¹¤ë·ï¿ô¤òµá¤á¤ë¡£
+	$disp_line = intval($line / IMAGE_MAX);
+	
+	// ´û¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤ò¿ô¤¨¤ë
+	$end_cnt = $objQuery->count("mtb_zip");
+	$cnt = 1;
+	$img_cnt = 0;
+	while (!feof($fp)) {
+		$arrCSV = fgetcsv($fp, ZIP_CSV_LINE_MAX);
+		
+		// ¤¹¤Ç¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤òÈô¤Ð¤¹¡£
+		if($cnt > $end_cnt) {
+			$sqlval['code'] = $arrCSV[0];
+			$sqlval['old_zipcode'] = $arrCSV[1];
+			$sqlval['zipcode'] = $arrCSV[2];
+			$sqlval['state_kana'] = $arrCSV[3];
+			$sqlval['city_kana'] = $arrCSV[4];
+			$sqlval['town_kana'] = $arrCSV[5];
+			$sqlval['state'] = $arrCSV[6];
+			$sqlval['city'] = $arrCSV[7];
+			$sqlval['town'] = $arrCSV[8];
+			$sqlval['flg1'] = $arrCSV[9];
+			$sqlval['flg2'] = $arrCSV[10];
+			$sqlval['flg3'] = $arrCSV[11];
+			$sqlval['flg4'] = $arrCSV[12];
+			$sqlval['flg5'] = $arrCSV[13];
+			$sqlval['flg6'] = $arrCSV[14];	
+			$objQuery->insert("mtb_zip", $sqlval);
+		}
+		
+		$cnt++;
+		// $disp_line·ï¤´¤È¤Ë¿ÊÄ½É½¼¨¤¹¤ë
+		if($cnt % $disp_line == 0 && $img_cnt < IMAGE_MAX) {
+			print("<img src='/img/install/graph_1_w.gif'>");
+			MyFlush();
+			$img_cnt++;
+		}
+	}
+	fclose($fp);
+	
+	print("<img src='/img/install/space_w.gif'><br>\n");
+	print("<table width='700' height='50' border='0' cellpadding='0' cellspacing='0' bgcolor='#494E5F'>\n");
+	print("<tr>\n");
+	print("<td align='center'><a href='javascript:window.close()'><img src='/img/install/close.gif' alt='CLOSE' width='85' height='22' border='0' /></a></td>\n");
+	print("</tr>\n");
+	print("</table>\n");
+}
+
+function MyFlush() {
+	flush();
+	ob_end_flush();
+	ob_start();
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/basis/point.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/basis/point.php	(revision 1949)
+++ /temp/tags/eccube-0_9_2beta/html/admin/basis/point.php	(revision 1949)
@@ -0,0 +1,99 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'basis/point.tpl';
+		$this->tpl_subnavi = 'basis/subnavi.tpl';
+		$this->tpl_subno = 'point';
+		$this->tpl_mainno = 'basis';
+		$this->tpl_subtitle = '¥Ý¥¤¥ó¥ÈÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+$cnt = $objQuery->count("dtb_baseinfo");
+
+if ($cnt > 0) {
+	$objPage->tpl_mode = "update";
+} else {
+	$objPage->tpl_mode = "insert";
+}
+
+if($_POST['mode'] != "") {
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = $objFormParam->checkError();
+	
+	if(count($objPage->arrErr) == 0) {
+		switch($_POST['mode']) {
+		case 'update':
+			lfUpdateData(); // ´ûÂ¸ÊÔ½¸
+			break;
+		case 'insert':
+			lfInsertData(); // ¿·µ¬ºîÀ®
+			break;
+		default:
+			break;
+		}
+		// ºÆÉ½¼¨
+		//sfReload();
+		$objPage->tpl_onload = "window.alert('¥Ý¥¤¥ó¥ÈÀßÄê¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+	}
+} else {
+	$arrCol = $objFormParam->getKeyList(); // ¥­¡¼Ì¾°ìÍ÷¤ò¼èÆÀ
+	$col	= sfGetCommaList($arrCol);
+	$arrRet = $objQuery->select($col, "dtb_baseinfo");
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($arrRet[0]);
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("²ñ°÷ÅÐÏ¿»þÉÕÍ¿¥Ý¥¤¥ó¥È", "welcome_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+}
+
+function lfUpdateData() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = 'Now()';
+	$objQuery = new SC_Query();
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_baseinfo", $sqlval);
+}
+
+function lfInsertData() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = 'Now()';
+	$objQuery = new SC_Query();
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_baseinfo", $sqlval);
+}
+
Index: /temp/tags/eccube-0_9_2beta/html/admin/require.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/require.php	(revision 2186)
+++ /temp/tags/eccube-0_9_2beta/html/admin/require.php	(revision 2186)
@@ -0,0 +1,26 @@
+<?php
+
+$include_dir = realpath(dirname( __FILE__));
+
+require_once($include_dir . "/../../data/conf/conf.php");	
+require_once($include_dir . "/../../data/lib/glib.php");
+require_once($include_dir . "/../../data/lib/slib.php");
+require_once($include_dir . "/../../data/class/SC_View.php");
+require_once($include_dir . "/../../data/class/SC_DbConn.php");
+require_once($include_dir . "/../../data/class/SC_Session.php");
+require_once($include_dir . "/../../data/class/SC_Query.php");
+require_once($include_dir . "/../../data/class/SC_SelectSql.php");
+require_once($include_dir . "/../../data/class/SC_CheckError.php");
+require_once($include_dir . "/../../data/class/SC_PageNavi.php");
+require_once($include_dir . "/../../data/class/SC_Date.php");
+require_once($include_dir . "/../../data/class/SC_Image.php");
+require_once($include_dir . "/../../data/class/SC_UploadFile.php");
+require_once($include_dir . "/../../data/class/SC_SiteInfo.php");
+require_once($include_dir . "/../../data/class/GC_SendMail.php");
+require_once($include_dir . "/../../data/class/SC_FormParam.php");
+require_once($include_dir . "/../../data/class/SC_CustomerList.php");
+require_once($include_dir . "/../../data/class/SC_Customer.php");
+require_once($include_dir . "/../../data/class/SC_Pdf.php");
+
+//fnSetErrorHandler();
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/edit.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/edit.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/edit.php	(revision 1328)
@@ -0,0 +1,174 @@
+¡¡
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="../css/contents.css" type="text/css" />
+<script type="text/javascript" src="../js/css.js"></script>
+<script type="text/javascript" src="../js/navi.js"></script>
+<title>EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸</title>
+</head>
+
+<body bgcolor="#f3f3f3" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="../css/common.css" type="text/css" />
+</noscript>
+
+
+<div align="center">
+<!--¢§HEADER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#bfbf9f" height="3" colspan="2"></td></tr>
+	<tr bgcolor="#dedecd">
+		<td height="40" width="365"><a href="../home.php"><img src="../misc/logo.gif" width="365" height="16" alt="EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸" border="0" /></a></td>
+		<td width="415" align="right"><a href="../home.php" onmouseover="chgImg('../misc/home_on.gif','home');" onmouseout="chgImg('../misc/home.gif','home');"><img src="../misc/home.gif" width="70" height="20" alt="HOME" border="0" name="home" id="home" /></a><img src="../misc/_.gif" width="3" height="1" alt="" />
+		<a href="#" onmouseover="chgImg('../misc/hp_on.gif','hp');" onmouseout="chgImg('../misc/hp.gif','hp');" target="_blank"><img src="../misc/hp.gif" width="70" height="20" alt="HP¤ò¸«¤ë" border="0" name="hp" id="hp" /></a><img src="../misc/_.gif" width="3" height="1" alt="" />
+		<a href="../index.html" onmouseover="chgImg('../misc/logout_on.gif','logout');" onmouseout="chgImg('../misc/logout.gif','logout');"><img src="../misc/logout.gif" width="70" height="20" alt="¥í¥°¥¢¥¦¥È" border="0" name="logout" id="logout" /></a><img src="../misc/_.gif" width="20" height="1" alt="" /></td>
+	</tr>
+	<tr><td bgcolor="#ffffff" height="1" colspan="3"></td></tr>
+</table>
+<!--¢¥HEADER-->
+
+<!--¢§MAIN NAVI-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td><a href="../basis/index.php" onmouseover="chgImg('../misc/basis_on.gif','basis');" onmouseout="chgImg('../misc/basis.gif','basis');"><img src="../misc/basis.gif" width="108" height="26" alt="´ðËÜ¾ðÊó" border="0" name="basis" id="basis" /></a></td>
+		<td><a href="../product/index.php"><img src="../misc/product_on.gif" width="108" height="26" alt="¾¦ÉÊ´ÉÍý" border="0" /></a></td>
+		<td><a href="../customer/index.php" onmouseover="chgImg('../misc/customer_on.gif','customer');" onmouseout="chgImg('../misc/customer.gif','customer');"><img src="../misc/customer.gif" width="108" height="26" alt="¸ÜµÒ´ÉÍý" border="0" name="customer" id="customer" /></a></td>
+		<td><a href="../order/index.php" onmouseover="chgImg('../misc/order_on.gif','order');" onmouseout="chgImg('../misc/order.gif','order');"><img src="../misc/order.gif" width="108" height="26" alt="¼õÃí´ÉÍý" border="0" name="order" id="order" /></a></td>
+		<td><a href="../sales/index.php" onmouseover="chgImg('../misc/sales_on.gif','sales');" onmouseout="chgImg('../misc/sales.gif','sales');"><img src="../misc/sales.gif" width="108" height="26" alt="Çä¾å´ÉÍý" border="0" name="sales" id="sales" /></a></td>
+		<td><a href="../mail/index.php" onmouseover="chgImg('../misc/mail_on.gif','mail');" onmouseout="chgImg('../misc/mail.gif','mail');"><img src="../misc/mail.gif" width="108" height="26" alt="¥á¡¼¥ëÇÛ¿®" border="0" name="mail" id="mail" /></a></td>
+		<td><a href="../contents/index.php" onmouseover="chgImg('../misc/contents_on.gif','contents');" onmouseout="chgImg('../misc/contents.gif','contents');"><img src="../misc/contents.gif" width="132" height="26" alt="¥³¥ó¥Æ¥ó¥Ä´ÉÍý" border="0" name="contents" id="contents" /></a></td>
+	</tr>
+	<tr><td colspan="7" height="1" bgcolor="#dedecd"></td></tr>
+	<tr><td colspan="7" bgcolor="#ffffff" height="15"></td></tr>
+</table>
+<!--¢¥MAIN NAVI-->
+
+<!--¢§CONTENTS-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td bgcolor="#ffffff" align="center" valign="top" height="400">
+		<table width="740" border="0" cellspacing="0" cellpadding="0" summary=" ">
+			<tr>
+				<!--¢§SUB NAVI-->
+				<td class="fs12n"><span class="over">¢£¾¦ÉÊ¥Þ¥¹¥¿</span>¡¡<a href="./csv.php">¢£CSV¥¢¥Ã¥×¥í¡¼¥É</a>¡¡<a href="./input.php">¢£¾¦ÉÊÅÐÏ¿</a>¡¡<a href="./standard_input.php">¢£µ¬³ÊÅÐÏ¿</a>¡¡<a href="./category.php">¢£¥«¥Æ¥´¥êÀßÄê</a>¡¡<a href="./review.php">¢£¥ì¥Ó¥å¡¼´ÉÍý</a></td>
+				<!--¢¥SUB NAVI-->
+			</tr><tr><td height="25"></td></tr>
+		</table>
+		
+		<!--¢§MAIN CONTENTS-->
+		<table width="740" border="0" cellspacing="0" cellpadding="0" summary=" ">
+			<tr>
+				<td class="fs14n"><strong>¢£¾¦ÉÊ¥Þ¥¹¥¿¡§¾¦ÉÊÊÔ½¸</strong></td>
+			</tr>
+		</table>
+		
+		<!--¢§ÅÐÏ¿¥Æ¡¼¥Ö¥ë¤³¤³¤«¤é-->
+		<form name="form1" id="form1" method="post" action="">
+		<table width="740" border="0" cellspacing="1" cellpadding="5" summary=" " bgcolor="#cccccc">
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾¦ÉÊ¥³¡¼¥É<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="text" name="code" size="60" class="box60" /><span class="red"> ¡Ê¾å¸Â50Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾¦ÉÊÌ¾<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="text" name="name" size="60" class="box60" /><span class="red"> ¡Ê¾å¸Â50Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¥«¥Æ¥´¥ê<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><select name="category">
+				<option value="" selected="selected">ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option>
+				<option value="¥À¥ß¡¼">¥À¥ß¡¼</option>
+				</select></td>
+			</tr>
+			<tr class="fs12n">
+				<td bgcolor="#f0f0f0" width="160">¾¦ÉÊ²Á³Ê<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557">¡ï<input type="text" name="price" size="6" class="box6" /><span class="red10"> ¡ÊÈ¾³Ñ¿ô»ú¤ÇÆþÎÏ Îã¡§28800¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">À½Â¤¸µ</td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="text" name="maker" size="60" class="box60" /><span class="red"> ¡Ê¾å¸Â50Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">ÈÎÇä¸µ</td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="text" name="dealer" size="60" class="box60" /><span class="red"> ¡Ê¾å¸Â50Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr class="fs12n">
+				<td bgcolor="#f0f0f0" width="160">¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="radio" name="status" value="Ìµ¤·" checked="checked" />Ìµ¤·¡¡<input type="radio" name="status" value="NEW" />NEW¡¡<input type="radio" name="status" value="¥ª¥¹¥¹¥á" />¥ª¥¹¥¹¥á¡¡<input type="radio" name="status" value="ÃíÌÜ" />ÃíÌÜ¡¡<input type="radio" name="status" value="¸ÂÄê" />¸ÂÄê</td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">°ìÍ÷²èÌÌ¥³¥á¥ó¥È<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><textarea name="textfield01" cols="60" rows="8" class="area60"></textarea><span class="red"> ¡Ê¾å¸Â200Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¤ª¤¹¤¹¤á¥Ý¥¤¥ó¥È<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><textarea name="textfield02" cols="60" rows="8" class="area60"></textarea><span class="red"> ¡Ê¾å¸Â3000Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">À½ÉÊ¾Ò²ð<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><textarea name="textfield03" cols="60" rows="8" class="area60"></textarea><span class="red"> ¡Ê¾å¸Â3000Ê¸»ú¡Ë</span></td>
+			</tr>
+			<tr class="fs12n">
+				<td bgcolor="#f0f0f0" width="160">ºß¸Ë¿ô<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="text" name="stock" size="6" class="box6" /> Ã±°Ì¡¡<input type="checkbox" name="nostock" value="ºß¸ËÀ©¸ÂÌµ¤·" />ºß¸ËÀ©¸ÂÌµ¤·</td>
+			</tr>
+			<tr class="fs12n">
+				<td bgcolor="#f0f0f0" width="160">¹ØÆþÀ©¸Â¿ô<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="text" name="purchase" size="6" class="box6" /> Ã±°Ì¤Þ¤Ç</td>
+			</tr>
+			<tr class="fs12">
+				<td bgcolor="#f0f0f0" width="160">ÇÛÁ÷¶È¼Ô<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="checkbox" name="delivery01" value="¥ä¥Þ¥È±¿Í¢" />¥ä¥Þ¥È±¿Í¢<br />
+				<input type="checkbox" name="delivery02" value="º´ÀîµÞÊØ" />º´ÀîµÞÊØ<br />
+				<input type="checkbox" name="delivery03" value="ÆüËÜÍ¹À¯¸ø¼Ò" />ÆüËÜÍ¹À¯¸ø¼Ò</td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">°ìÍ÷ÍÑ²èÁü</td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image00" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾ÜºÙÍÑ²èÁü¡Ê1¡Ë<span class="red"> *</span></td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image01" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾ÜºÙÍÑ²èÁü¡Ê2¡Ë</td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image02" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾ÜºÙÍÑ²èÁü¡Ê3¡Ë</td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image03" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">ÊÌ¥¦¥¤¥ó¥É¥¦ÍÑ²èÁü</td>
+				<td bgcolor="#ffffff" width="557"><input type="file" name="image_window" size="60" class="box60" /></td>
+			</tr>
+			<tr>
+				<td bgcolor="#f0f0f0" width="160" class="fs12n">¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë</td>
+				<td bgcolor="#ffffff" width="557" class="fs10n"><input type="file" name="product_file" size="60" class="box60" /><span class="red"> ¡Ê¡û¡û·Á¼°¡Ë</span></td>
+			</tr>
+		</table>
+		<!--¢¥ÅÐÏ¿¥Æ¡¼¥Ö¥ë¤³¤³¤Þ¤Ç-->
+		<br />
+		<input type="button" name="subm" value="¤³¤ÎÆâÍÆ¤ÇÅÐÏ¿¤¹¤ë" />
+		</form>
+		
+		<!--¢¥MAIN CONTENTS-->
+		</td>
+	</tr>
+</table>
+<!--¢¥CONTENTS-->
+
+<!--¢§FOOTER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#ffffff" height="60"></td></tr>
+	<tr><td bgcolor="#e5e5df" height="5"></td></tr>
+</table>
+<!--¢¥FOOTER-->
+</div>
+</body>
+</html>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/product_rank.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/product_rank.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/product_rank.php	(revision 1328)
@@ -0,0 +1,88 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/product_rank.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'product_rank';
+		$this->tpl_subtitle = '¾¦ÉÊÊÂ¤ÓÂØ¤¨';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$objPage->tpl_pageno = $_POST['pageno'];
+
+// ÄÌ¾ï»þ¤Ï¿Æ¥«¥Æ¥´¥ê¤ò0¤ËÀßÄê¤¹¤ë¡£
+$objPage->arrForm['parent_category_id'] = $_POST['parent_category_id'];
+
+switch($_POST['mode']) {
+case 'up':
+	$where = "category_id = " . addslashes($_POST['parent_category_id']);
+	sfRankUp("dtb_products", "product_id", $_POST['product_id'], $where);
+	break;
+case 'down':
+	$where = "category_id = " . addslashes($_POST['parent_category_id']);
+	sfRankDown("dtb_products", "product_id", $_POST['product_id'], $where);
+	break;
+case 'move':
+	$key = "pos-".$_POST['product_id'];
+	$input_pos = mb_convert_kana($_POST[$key], "n");
+	if(sfIsInt($input_pos)) {
+		$where = "category_id = " . addslashes($_POST['parent_category_id']);
+		sfMoveRank("dtb_products", "product_id", $_POST['product_id'], $input_pos, $where);
+	}
+	break;
+case 'tree':
+	// ¥«¥Æ¥´¥ê¤ÎÀÚÂØ¤Ï¡¢¥Ú¡¼¥¸ÈÖ¹æ¤ò¥¯¥ê¥¢¤¹¤ë¡£
+	$objPage->tpl_pageno = "";
+	break;
+default:
+	break;
+}
+
+$objPage->arrTree = sfGetCatTree($_POST['parent_category_id']);
+$objPage->arrProductsList = lfGetProduct($_POST['parent_category_id']);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¾¦ÉÊÆÉ¤ß¹þ¤ß */
+function lfGetProduct($category_id) {
+	global $objPage;
+	
+	$objQuery = new SC_Query();
+	$col = "product_id, name, main_list_image, rank, product_code";
+	$table = "vw_products_nonclass";
+	$where = "delete = 0 AND category_id = ?";
+	
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($table, $where, array($category_id));
+	// ½ç°Ì¡¢³ºÅö·ï¿ôÉ½¼¨ÍÑ
+	$objPage->tpl_linemax = $linemax;
+	
+	$objNavi = new SC_PageNavi($objPage->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
+	$startno = $objNavi->start_row;
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// NaviÉ½¼¨Ê¸»úÎó
+	$objPage->tpl_pagemax = $objNavi->max_page;		// ¥Ú¡¼¥¸ºÇÂç¿ô¡Ê¡Ö¾å¤Ø²¼¤Ø¡×É½¼¨È½ÄêÍÑ¡Ë
+	$objPage->tpl_disppage = $objNavi->now_page;	// É½¼¨¥Ú¡¼¥¸ÈÖ¹æ¡Ê¡Ö¾å¤Ø²¼¤Ø¡×É½¼¨È½ÄêÍÑ¡Ë
+			
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+	
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select($col, $table, $where, array($category_id));
+	return $arrRet;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/upload_csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/upload_csv.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/upload_csv.php	(revision 1328)
@@ -0,0 +1,198 @@
+<?php
+require_once("../require.php");
+require_once("./upload_csv.inc");
+
+// 1¹Ô¤¢¤¿¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("CSV_LINE_MAX", 10000);
+
+class LC_Page {
+	var $arrSession;
+	var $arrCSVErr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/upload_csv.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'upload_csv';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+$objFormParam->setHtmlDispNameArray();
+$objPage->arrTitle = $objFormParam->getHtmlDispNameArray();
+
+switch($_POST['mode']) {
+case 'csv_upload':
+	$err = false;
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr['csv_file'] = $objUpFile->makeTempFile('csv_file');
+	
+	if($objPage->arrErr['css_file'] == "") {
+		$objPage->arrErr = $objUpFile->checkEXISTS();
+	}
+	
+	if($objPage->arrErr['csv_file'] == "") {
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$filepath = $objUpFile->getTempFilePath('csv_file');
+		// ¥¨¥ó¥³¡¼¥É
+		$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+		$fp = fopen($enc_filepath, "r");
+		$line = 0;		// ¹Ô¿ô
+		$regist = 0;	// ÅÐÏ¿¿ô
+		
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		
+		while(!feof($fp) && !$err) {
+			$arrCSV = fgetcsv($fp, CSV_LINE_MAX);
+						
+			// ¹Ô¥«¥¦¥ó¥È
+			$line++;
+			
+			if($line <= 1) {
+				continue;
+			}			
+							
+			// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+			$max = count($arrCSV);
+			
+			// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+			if($max <= 1) {
+				continue;			
+			}
+			
+			// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+			if($max != $colmax) {
+				$objPage->arrCSVErr['blank'] = "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£";
+				$err = true;
+			} else {
+				// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+				$objFormParam->setParam($arrCSV, true);
+				$arrRet = $objFormParam->getHashArray();
+				$objFormParam->setParam($arrRet);
+				// ÆþÎÏÃÍ¤ÎÊÑ´¹
+				$objFormParam->convParam();
+				// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+				$objPage->arrCSVErr = lfCheckError();
+			}
+			
+			// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			if(count($objPage->arrCSVErr) > 0) {
+				$objPage->tpl_errtitle = "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+				$objPage->arrParam = $objFormParam->getHashArray();
+				$err = true;
+			}
+			
+			if(!$err) {
+				lfRegistProduct($objQuery);
+				$regist++;
+			}
+		}
+		fclose($fp);
+		
+		if(!$err) {
+			$objQuery->commit();
+			$objPage->tpl_oktitle = "¢£" . $regist . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£";
+			// ¾¦ÉÊ·ï¿ô¥«¥¦¥ó¥È´Ø¿ô¤Î¼Â¹Ô
+			sfCategory_Count($objQuery);
+		} else {
+			$objQuery->rollback();
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+		
+	$objFormParam->addParam("¾¦ÉÊID", "product_id", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("µ¬³ÊID", "product_class_id", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	
+	$objFormParam->addParam("µ¬³ÊÌ¾1(ÊÑ¹¹ÉÔ²Ä)", "dummy1");
+	$objFormParam->addParam("µ¬³ÊÌ¾2(ÊÑ¹¹ÉÔ²Ä)", "dummy2");
+	
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸ø³«¥Õ¥é¥°(1:¸ø³« 2:Èó¸ø³«)", "status", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹", "product_flag", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("»²¹Í»Ô¾ì²Á³Ê", "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("²Á³Ê", "price02", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("Á÷ÎÁ", "deliv_fee", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþÀ©¸Â", "sale_limit", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥«¡¼URL", "comment1", STEXT_LEN, "KVa", array("SPTAB_CHECK","URL_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸¡º÷¥ï¡¼¥É", "comment3", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("°ìÍ÷-¥á¥¤¥ó¥³¥á¥ó¥È", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("°ìÍ÷-¥á¥¤¥ó²èÁü", "main_list_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó²èÁü", "main_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó³ÈÂç²èÁü", "main_large_image", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥«¥é¡¼Èæ³Ó²èÁü", "file1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", "file2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(1)", "sub_title1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(1)", "sub_comment1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(1)", "sub_image1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(1)", "sub_large_image1", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(2)", "sub_title2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(2)", "sub_comment2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(2)", "sub_image2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(2)", "sub_large_image2", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(3)", "sub_title3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(3)", "sub_comment3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(3)", "sub_image3", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(3)", "sub_large_image3", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(4)", "sub_title4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(4)", "sub_comment4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(4)", "sub_image4", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(4)", "sub_large_image4", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+		
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(5)", "sub_title5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(5)", "sub_comment5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö²èÁü(5)", "sub_image5", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü(5)", "sub_large_image5", LTEXT_LEN, "KVa", array("FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	$objFormParam->addParam("È¯Á÷ÆüÌÜ°Â", "deliv_date_id", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	
+	$objFormParam->addParam("¤ª¤¹¤¹¤á¾¦ÉÊ(1)", "recommend_product_id1", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(1)", "recommend_comment1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ª¤¹¤¹¤á¾¦ÉÊ(2)", "recommend_product_id2", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(2)", "recommend_comment2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ª¤¹¤¹¤á¾¦ÉÊ(3)", "recommend_product_id3", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(3)", "recommend_comment3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ª¤¹¤¹¤á¾¦ÉÊ(4)", "recommend_product_id4", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(4)", "recommend_comment4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/review.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/review.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/review.php	(revision 1328)
@@ -0,0 +1,238 @@
+<?php
+
+require_once("../require.php");
+require_once("./index_csv.php");
+
+session_start();
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		global $arrPageMax;
+		global $arrRECOMMEND;
+		global $arrSex;
+		$this->arrPageMax = $arrPageMax;
+		$this->arrRECOMMEND = $arrRECOMMEND;
+		$this->arrSex = $arrSex;
+		$this->tpl_mainpage = 'products/review.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'review';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¥ì¥Ó¥å¡¼´ÉÍý';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objDate = new SC_Date();
+$objQuery = new SC_Query();
+
+// ÅÐÏ¿¡¦¹¹¿·¸¡º÷³«»ÏÇ¯
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrStartYear = $objDate->getYear();
+$objPage->arrStartMonth = $objDate->getMonth();
+$objPage->arrStartDay = $objDate->getDay();
+// ÅÐÏ¿¡¦¹¹¿·¸¡º÷½ªÎ»Ç¯
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrEndYear = $objDate->getYear();
+$objPage->arrEndMonth = $objDate->getMonth();
+$objPage->arrEndDay = $objDate->getDay();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+//¥ì¥Ó¥å¡¼¾ðÊó¤Î¥«¥é¥à¤Î¼èÆÀ
+$select="review_id, A.product_id, reviewer_name, sex, recommend_level, ";
+$select.="reviewer_url, title, comment, A.status, A.create_date, A.update_date, name";
+$from = "dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ";
+
+	// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+	foreach ($_POST as $key => $val) {
+		if (ereg("^search_", $key)) {
+			switch ($key){
+				case 'search_sex':
+				$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
+				if(!is_array($val)) {
+					$objPage->arrForm[$key] = split("-", $val);
+				}
+				break;
+				
+				default:
+					$objPage->arrHidden[$key] = $val;
+					break;
+			}
+		}
+	}
+
+if ($_POST['mode'] == "delete"){
+	//¥ì¥Ó¥å¡¼¤Îºï½ü
+	$objQuery->exec("UPDATE dtb_review SET delete=1 WHERE review_id=?", array($_POST['review_id']));
+}
+	
+if ($_POST['mode'] == 'search' || $_POST['mode'] == 'csv' || $_POST['mode'] == 'delete'){
+	
+	//ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤¾¦ÉÊ¤ò¸¡º÷
+	$where="A.delete = 0 AND B.delete = 0";
+	$objPage->arrForm = $_POST;
+	if (!is_array($_POST['search_sex'])){
+		$objPage->arrForm['search_sex'] = split("-", $_POST['search_sex']);
+	}
+	//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError();
+	
+	if (!$objPage->arrErr){
+		foreach ($_POST as $key => $val){
+
+			$val = sfManualEscape($val);
+			
+			if($val == "") {
+				continue;
+			}
+			
+			switch ($key){
+			case 'search_reviewer_name':
+				$val = ereg_replace(" ", "%", $val);
+				$val = ereg_replace("¡¡", "%", $val);
+				$where.= "AND reviewer_name ILIKE ? ";
+				$arrval[] = "%$val%";
+				break;
+				
+			case 'search_reviewer_url':
+				$val = ereg_replace(" ", "%", $val);
+				$val = ereg_replace("¡¡", "%", $val);
+				$where.= "AND reviewer_url ILIKE ? ";
+				$arrval[] = "%$val%";
+				break;
+				
+			case 'search_name':
+				$val = ereg_replace(" ", "%", $val);
+				$val = ereg_replace("¡¡", "%", $val);
+				$where.= "AND name ILIKE ? ";
+				$arrval[] = "%$val%";
+				break;
+				
+			case 'search_product_code':
+				$val = ereg_replace(" ", "%", $val);
+				$val = ereg_replace("¡¡", "%", $val);
+				$where.= "AND A.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? )";
+				$arrval[] = "%$val%";
+				break;
+				
+			case 'search_sex':
+				$tmp_where = "";
+				//$val=ÇÛÎó¤ÎÃæ¿È,$element=³Æ¥­¡¼¤ÎÃÍ(1,2)
+				if (is_array($val)){
+					foreach($val as $element) {
+						if($element != "") {
+							if($tmp_where == "") {
+								$tmp_where .= " AND (sex = ?";
+							} else {
+								$tmp_where .= " OR sex = ?";
+							}
+							$arrval[] = $element;
+						}
+					}
+					if($tmp_where != "") {
+						$tmp_where .= ")";
+						$where .= " $tmp_where ";
+					}
+				}
+				
+				break;
+				
+			case 'search_recommend_level':
+				$where.= "AND recommend_level LIKE ? ";
+				$arrval[] = $val;
+				break;
+				
+			case 'search_startyear':
+				if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])){
+					$date = sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
+					$where.= " AND A.create_date >= ? ";
+					$arrval[] = $date;
+				}
+				break;
+				
+			case 'search_endyear':
+				if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])){
+					$date = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
+					$where.= " AND A.create_date <= ? ";
+					$arrval[] = $date;
+				}
+				break;
+			}
+		}
+			
+	}
+	
+	$order = "A.create_date DESC";
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	if(is_numeric($_POST['search_page_max'])) {	
+		$page_max = $_POST['search_page_max'];
+	} else {
+		$page_max = SEARCH_PMAX;
+	}
+	
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->arrPagenavi = $objNavi->arrPagenavi;
+	$startno = $objNavi->start_row;
+
+	$objPage->tpl_pageno = $_POST['search_pageno'];
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	
+	//¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrReview = $objQuery->select($select, $from, $where, $arrval);
+	
+	//CSV¥À¥¦¥ó¥í¡¼¥É
+	if ($_POST['mode'] == 'csv'){
+		// ¥ª¥×¥·¥ç¥ó¤Î»ØÄê
+		$option = "ORDER BY review_id";
+		// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤ÎºîÀ®
+		$head = sfGetCSVList($arrREVIEW_CVSTITLE);
+		$data = lfGetReviewCSV($where, '', $arrval);
+		// CSV¤òÁ÷¿®¤¹¤ë¡£
+		sfCSVDownload($head.$data);
+		exit;
+	}	
+}
+	
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-------------------------------------------------------------------------------------
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError() {
+	$objErr = new SC_CheckError();
+	switch ($_POST['mode']){
+		case 'search':
+		$objErr->doFunc(array("Åê¹Æ¼Ô", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+		$objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+		$objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE"));
+		$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM"));
+		break;
+		
+		case 'complete':
+		$objErr->doFunc(array("¤ª¤¹¤¹¤á¥ì¥Ù¥ë", "recommend_level"), array("SELECT_CHECK"));
+		$objErr->doFunc(array("¥¿¥¤¥È¥ë", "title", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		break;
+	}
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/review_show.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/review_show.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/review_show.php	(revision 1328)
@@ -0,0 +1,73 @@
+¡¡
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="/admin/css/contents.css" type="text/css" />
+<script type="text/javascript" src="/js/css.js"></script>
+<title>EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸</title>
+<script type="text/javascript">
+<!--
+self.moveTo(20,20);self.focus();
+//-->
+</script>
+</head>
+
+<body bgcolor="#ffffff" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
+<noscript>
+<link rel="stylesheet" href="/admin/css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<!--¢§MAIN CONTENTS-->
+<table width="400" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td class="fs14n"><strong>¢¡¥ì¥Ó¥å¡¼</strong></td>
+	</tr>
+	<tr><td height="15"></td></tr>
+</table>
+<table width="400" bgcolor="#cccccc" border="0" cellspacing="1" cellpadding="5" summary=" ">
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">Åê¹ÆÆü</td>
+		<td width="287" bgcolor="#ffffff">2005/06/29</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">Åê¹Æ¼ÔÌ¾</td>
+		<td width="287" bgcolor="#ffffff">»³ÅÄÂÀÏº</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">¾¦ÉÊÌ¾</td>
+		<td width="287" bgcolor="#ffffff">RAKUWA¥Í¥Ã¥¯</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">¤ª¤¹¤¹¤á¥ì¥Ù¥ë</td>
+		<td width="287" bgcolor="#ffffff">¡ú¡ú¡ú¡ú¡ú</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">¥¿¥¤¥È¥ë</td>
+		<td width="287" bgcolor="#ffffff">ËèÆü¤ÎÄÌ¶Ð¤¬¤³¤ì¤Ç¤é¤¯¤Ë¤Ê¤ê¤Þ¤·¤¿¡Á</td>
+	</tr>
+	<tr class="fs12">
+		<td width="90" bgcolor="#f0f0f0">¥³¥á¥ó¥È</td>
+		<td width="287" bgcolor="#ffffff">¤³¤ì¤¬ËÍ¤Ë¤È¤Ã¤ÆºÇ½é¤ÎNSX¤Ê¤ó¤Ç¤¹¤¬¡¢°ÊÁ°¤«¤éÍß¤·¤¯¤Æ¤º¤Ã¤ÈÁÀ¤Ã¤Æ¤¤¤Þ¤·¤¿¡£¥ê¡¼¥¹¤Î¿·¤·¤¤¥×¥í¥°¥é¥à¤¬½Ð¤¿¤Î¤Ç¡¢¤³¤ì¤Ï¥Á¥ã¥ó¥¹¤È¤Ð¤«¤ê¤Ë¹ØÆþ¤·¤¿¤ó¤Ç¤¹¡£ËÍ¤Ï¡¢¤³¤Î¿·¤·¤¤¥¹¥¿¥¤¥ê¥ó¥°¤¬¤¹¤´¤¯µ¤¤ËÆþ¤Ã¤Æ¤¤¤Þ¤¹¡£ºÇ¿·¤Ç¤¹¤«¤é¤Í¡£NSX¤Î¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤Î¤¤¤¤¤È¤³¤í¤Ï¡¢¥Ï¥ó¥É¥ê¥ó¥°¤Î¤è¤µ¤È¥³¡¼¥Ê¥ê¥ó¥°Ãæ¤Î¥Ð¥é¥ó¥¹¤Î¤è¤µ¤Ç¤¹¤Í¡£¤¹¤´¤¯¥Ð¥é¥ó¥¹¤¬¼è¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢¾¯¤·ÌµÍý¤ò¤·¤Æ¤â¤¢¤Þ¤ê¥ê¥¢¤¬Î®¤ì¤Ê¤¤¤ó¤Ç¤¹¡£¥µ¥¹¥Ú¥ó¥·¥ç¥ó¤â¤¤¤¤¤Ç¤¹¤Í¡£¥É¥¤¥Ä¤Î¥¹¥Ý¡¼¥Ä¥µ¥ë¡¼¥ó¤Î¥µ¥¹¥Ú¥ó¥·¥ç¥ó¤¬¹¥¤­¤Ç10Ç¯°Ê¾å¾è¤Ã¤Æ¤¤¤¿¤ó¤Ç¤¹¤±¤É¡¢NSX¤Ï¤½¤ì°Ê¾å¤Ç¤¹¡£¤è¤¯Áö¤ê¹þ¤ó¤Ç¥Á¥å¡¼¥Ë¥ó¥°¤·¤¿¤ó¤À¤Ê¡¦¡¦¤È¤¤¤¦¤³¤È¤¬Áö¤ê¤Ê¤¬¤éÅÁ¤ï¤Ã¤Æ¤­¤Þ¤¹¡£²¿¤È¸À¤¦¤«¡¢¥É¥é¥¤¥Ð¡¼¤Ë¸ì¤ê¤«¤±¤Æ¤¯¤ë´¶¤¸¤Ê¤ó¤Ç¤¹¤è¡£¼Á¤Î¹â¤µ¤È¤¤¤¦¤«¡¢²¹¤â¤ê¤È¤¤¤¦¤«¡¢¤ª¸ß¤¤Ê¬¤«¤ê¹ç¤¨¤ë¤è¤¦¤Ê¤Ä¤Ê¤¬¤ê¤ò´¶¤¸¤ë¤ó¤Ç¤¹¡£</td>
+	</tr>
+</table>
+
+<br />
+
+<table width="400" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td align="center">
+		<form name="form1" id="form1" method="post" action="">
+		<input type="button" name="close" value="¥¦¥¤¥ó¥É¥¦¤òÊÄ¤¸¤ë" onClick="window.close()" />
+		</form></td>
+	</tr>
+</table>
+<!--¢¥MAIN CONTENTS-->
+</div>
+
+</body>
+</html>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/classcategory.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/classcategory.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/classcategory.php	(revision 1328)
@@ -0,0 +1,170 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $arrHidden;
+	var $arrForm;
+	var $tpl_class_name;
+	var $arrClassCat;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/classcategory.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_subno = 'class';
+		$this->tpl_subtitle = 'µ¬³ÊÅÐÏ¿';
+		$this->tpl_mainno = 'products';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$get_check = false;
+
+// µ¬³ÊID¤Î¥Á¥§¥Ã¥¯
+if(sfIsInt($_GET['class_id'])) {
+	// µ¬³ÊÌ¾¤Î¼èÆÀ
+	$objPage->tpl_class_name = $objQuery->get("dtb_class", "name", "class_id = ?", array($_GET['class_id']));
+	if($objPage->tpl_class_name != "") {
+		// µ¬³ÊID¤Î°ú¤­·Ñ¤®
+		$objPage->arrHidden['class_id'] = $_GET['class_id'];
+		$get_check = true;
+	}
+}
+
+if(!$get_check) {
+	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸¤ËÈô¤Ð¤¹¡£
+	header("Location: " . URL_CLASS_REGIST);
+	exit;
+}
+
+// ¿·µ¬ºîÀ® or ÊÔ½¸
+switch($_POST['mode']) {
+// ÅÐÏ¿¥Ü¥¿¥ó²¡²¼
+case 'edit':
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤ÎÊÑ´¹
+	$_POST = lfConvertParam($_POST);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck();
+	if(count($objPage->arrErr) <= 0) {
+		if($_POST['classcategory_id'] == "") {
+			lfInsertClass();	// DB¤Ø¤Î½ñ¤­¹þ¤ß
+		} else {
+			lfUpdateClass();	// DB¤Ø¤Î½ñ¤­¹þ¤ß
+		}
+		// ºÆÉ½¼¨
+		sfReload("class_id=" . $_GET['class_id']);
+	} else {
+		// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+		$objPage->tpl_classcategory_id = $_POST['classcategory_id'];
+	}
+	break;
+// ºï½ü
+case 'delete':
+	// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü
+	$where = "class_id = " . addslashes($_POST['class_id']);
+	sfDeleteRankRecord("dtb_classcategory", "classcategory_id", $_POST['classcategory_id'], $where, true);
+	break;
+// ÊÔ½¸Á°½èÍý
+case 'pre_edit':
+	// ÊÔ½¸¹àÌÜ¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£
+	$where = "classcategory_id = ?";
+	$name = $objQuery->get("dtb_classcategory", "name", $where, array($_POST['classcategory_id']));
+	// ÆþÎÏ¹àÌÜ¤Ë¥«¥Æ¥´¥êÌ¾¤òÆþÎÏ¤¹¤ë¡£
+	$objPage->arrForm['name'] = $name;
+	// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+	$objPage->tpl_classcategory_id = $_POST['classcategory_id'];
+	break;
+case 'down':
+	$where = "class_id = " . addslashes($_POST['class_id']);
+	sfRankDown("dtb_classcategory", "classcategory_id", $_POST['classcategory_id'], $where);
+	break;
+case 'up':
+	$where = "class_id = " . addslashes($_POST['class_id']);
+	sfRankUp("dtb_classcategory", "classcategory_id", $_POST['classcategory_id'], $where);
+	break;
+default:
+	break;
+}
+
+// µ¬³ÊÊ¬Îà¤ÎÆÉ¹þ
+$where = "delete <> 1 AND class_id = ?";
+$objQuery->setorder("rank DESC");
+$objPage->arrClassCat = $objQuery->select("name, classcategory_id", "dtb_classcategory", $where, array($_GET['class_id']));
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------
+
+/* DB¤Ø¤ÎÁÞÆþ */
+function lfInsertClass() {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	// ¿Æµ¬³ÊID¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+	$where = "delete <> 1 AND class_id = ?";
+	$ret = 	$objQuery->get("dtb_class", "class_id", $where, array($_POST['class_id']));
+	if($ret != "") {	
+		// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+		$sqlval['name'] = $_POST['name'];
+		$sqlval['class_id'] = $_POST['class_id'];
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+		$sqlval['rank'] = $objQuery->max("dtb_classcategory", "rank", $where, array($_POST['class_id'])) + 1;
+		// INSERT¤Î¼Â¹Ô
+		$ret = $objQuery->insert("dtb_classcategory", $sqlval);
+	}
+	$objQuery->commit();
+	return $ret;
+}
+
+/* DB¤Ø¤Î¹¹¿· */
+function lfUpdateClass() {
+	$objQuery = new SC_Query();
+	// UPDATE¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $_POST['name'];
+	$sqlval['update_date'] = "Now()";
+	$where = "classcategory_id = ?";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_classcategory", $sqlval, $where, array($_POST['classcategory_id']));
+	return $ret;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	// Ê¸»úÊÑ´¹
+	$arrConvList['name'] = "KVa";
+
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("Ê¬ÎàÌ¾", "name", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	if(!isset($objErr->arrErr['name'])) {
+		$objQuery = new SC_Query();
+		$where = "class_id = ? AND name = ?";
+		$arrRet = $objQuery->select("classcategory_id, name", "dtb_classcategory", $where, array($_GET['class_id'], $_POST['name']));
+		// ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËÆ±¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç
+		if ($arrRet[0]['classcategory_id'] != $_POST['classcategory_id'] && $arrRet[0]['name'] == $_POST['name']) {
+			$objErr->arrErr['name'] = "¢¨ ´û¤ËÆ±¤¸ÆâÍÆ¤ÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/class.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/class.php	(revision 2105)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/class.php	(revision 2105)
@@ -0,0 +1,144 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/class.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_subno = 'class';
+		$this->tpl_subtitle = 'µ¬³ÊÅÐÏ¿';
+		$this->tpl_mainno = 'products';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// Í×µáÈ½Äê
+switch($_POST['mode']) {
+// ÊÔ½¸½èÍý
+case 'edit':
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck();
+	if(count($objPage->arrErr) <= 0) {
+		if($_POST['class_id'] == "") {
+			lfInsertClass($objPage->arrForm);	// ¿·µ¬ºîÀ®
+		} else {
+			lfUpdateClass($objPage->arrForm);	// ´ûÂ¸ÊÔ½¸
+		}
+		// ºÆÉ½¼¨
+		sfReload();
+	} else {
+		// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+		$objPage->tpl_class_id = $_POST['class_id'];
+	}
+	break;
+// ºï½ü
+case 'delete':
+	sfDeleteRankRecord("dtb_class", "class_id", $_POST['class_id'], "", true);
+	$objQuery = new SC_Query();
+	$objQuery->delete("dtb_classcategory", "class_id = ?", $_POST['class_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+// ÊÔ½¸Á°½èÍý
+case 'pre_edit':
+	// ÊÔ½¸¹àÌÜ¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£
+	$where = "class_id = ?";
+	$class_name = $objQuery->get("dtb_class", "name", $where, array($_POST['class_id']));
+	// ÆþÎÏ¹àÌÜ¤Ë¥«¥Æ¥´¥êÌ¾¤òÆþÎÏ¤¹¤ë¡£
+	$objPage->arrForm['name'] = $class_name;
+	// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+	$objPage->tpl_class_id = $_POST['class_id'];
+break;
+case 'down':
+	sfRankDown("dtb_class", "class_id", $_POST['class_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+case 'up':
+	sfRankUp("dtb_class", "class_id", $_POST['class_id']);
+	// ºÆÉ½¼¨
+	sfReload();
+	break;
+default:
+	break;
+}
+
+// µ¬³Ê¤ÎÆÉ¹þ
+$where = "delete <> 1";
+$objQuery->setorder("rank DESC");
+$objPage->arrClass = $objQuery->select("name, class_id", "dtb_class", $where);
+$objPage->arrClassCatCount = sfGetClassCatCount();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------------
+
+/* DB¤Ø¤ÎÁÞÆþ */
+function lfInsertClass($arrData) {
+	$objQuery = new SC_Query();
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $arrData['name'];
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_class", "rank") + 1;
+	// INSERT¤Î¼Â¹Ô
+	$ret = $objQuery->insert("dtb_class", $sqlval);
+	return $ret;
+}
+
+/* DB¤Ø¤Î¹¹¿· */
+function lfUpdateClass($arrData) {
+	$objQuery = new SC_Query();
+	// UPDATE¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $arrData['name'];
+	$sqlval['update_date'] = "Now()";
+	$where = "class_id = ?";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $objQuery->update("dtb_class", $sqlval, $where, array($arrData['class_id']));
+	return $ret;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	// Ê¸»úÊÑ´¹
+	$arrConvList['name'] = "KVa";
+
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+/* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("µ¬³ÊÌ¾", "name", STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	
+	if(!isset($objErr->arrErr['name'])) {
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("class_id, name", "dtb_class", "delete = 0 AND name = ?", array($_POST['name']));
+		// ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËÆ±¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç		
+		if ($arrRet[0]['class_id'] != $_POST['class_id'] && $arrRet[0]['name'] == $_POST['name']) {
+			$objErr->arrErr['name'] = "¢¨ ´û¤ËÆ±¤¸ÆâÍÆ¤ÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/product_class.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/product_class.php	(revision 3493)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/product_class.php	(revision 3493)
@@ -0,0 +1,392 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrCatList;
+	var $arrSRANK;
+	var $arrForm;
+	var $arrSubList;
+	var $arrHidden;
+	var $arrTempImage;
+	var $arrSaveImage;
+	var $tpl_mode;
+	var $arrSearchHidden;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/product_class.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'product';
+		$this->tpl_subtitle = '¾¦ÉÊÅÐÏ¿';
+		global $arrSRANK;
+		$this->arrSRANK = $arrSRANK;
+		global $arrDISP;
+		$this->arrDISP = $arrDISP;
+		global $arrCLASS;
+		$this->arrCLASS = $arrCLASS;
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		$this->tpl_onload = "";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;	
+	}
+}
+
+$objPage->tpl_product_id = $_POST['product_id'];
+$objPage->tpl_pageno = $_POST['pageno'];
+
+switch($_POST['mode']) {
+// µ¬³Êºï½üÍ×µá
+case 'delete':
+	$objQuery = new SC_Query();
+	
+	$objQuery->setLimitOffset(1);
+	$where = "product_id = ? AND NOT (classcategory_id1 = 0 AND classcategory_id2 = 0)";
+	$objQuery->setOrder("rank1 DESC, rank2 DESC");
+	$arrRet = $objQuery->select("*", "vw_cross_products_class", $where, array($_POST['product_id']));
+	
+	if(count($arrRet) > 0) {
+
+		$sqlval['product_id'] = $arrRet[0]['product_id'];
+		$sqlval['classcategory_id1'] = '0';
+		$sqlval['classcategory_id2'] = '0';
+		$sqlval['product_code'] = $arrRet[0]['product_code'];
+		$sqlval['stock'] = $arrRet[0]['stock'];
+		$sqlval['price01'] = $arrRet[0]['price01'];
+		$sqlval['price02'] = $arrRet[0]['price02'];
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+		$objQuery->begin();
+		$where = "product_id = ?";
+		$objQuery->delete("dtb_products_class", $where, array($_POST['product_id']));		
+		$objQuery->insert("dtb_products_class", $sqlval);
+		$objQuery->commit();
+	}
+	
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸	
+	break;
+	
+// ÊÔ½¸Í×µá
+case 'pre_edit':
+	$objQuery = new SC_Query();
+	$where = "product_id = ? AND NOT(classcategory_id1 = 0 AND classcategory_id2 = 0) ";
+	$ret = $objQuery->count("dtb_products_class", $where, array($_POST['product_id']));
+	
+	if($ret > 0) {
+		// µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ(DB¤ÎÃÍ¤òÍ¥Àè¤¹¤ë¡£)
+		$objPage->arrClassCat = lfGetClassCatListEdit($_POST['product_id']);	
+	}
+	
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// µ¬³ÊÁÈ¤ß¹ç¤ï¤»É½¼¨
+case 'disp':
+	$objPage->arrForm['select_class_id1'] = $_POST['select_class_id1'];
+	$objPage->arrForm['select_class_id2'] = $_POST['select_class_id2'];
+
+	$objPage->arrErr = lfClassError();
+	if (count($objPage->arrErr) == 0) {
+		// µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ
+		$objPage->arrClassCat = lfGetClassCatListDisp($_POST['select_class_id1'], $_POST['select_class_id2']);
+	}
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// µ¬³ÊÅÐÏ¿Í×µá
+case 'edit':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($_POST);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfProductClassError($objPage->arrForm);
+	
+	if(count($objPage->arrErr) == 0) {
+		// ³ÎÇ§¥Ú¡¼¥¸ÀßÄê
+		$objPage->tpl_mainpage = 'products/product_class_confirm.tpl';
+		lfProductConfirmPage(); // ³ÎÇ§¥Ú¡¼¥¸É½¼¨
+	} else {
+		// µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ
+		$objPage->arrClassCat = lfGetClassCatListDisp($_POST['class_id1'], $_POST['class_id2'], false);
+		lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	}
+	break;
+// ³ÎÇ§¥Ú¡¼¥¸¤«¤é¤ÎÌá¤ê
+case 'confirm_return':
+	// ¥Õ¥©¡¼¥à¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// µ¬³Ê¤ÎÁªÂò¾ðÊó¤Ï°ú¤­·Ñ¤¬¤Ê¤¤¡£
+	$objPage->arrForm['select_class_id1'] = "";
+	$objPage->arrForm['select_class_id2'] = "";
+	// µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ(¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï½ÐÎÏ¤·¤Ê¤¤)
+	$objPage->arrClassCat = lfGetClassCatListDisp($_POST['class_id1'], $_POST['class_id2'], false);
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+case 'complete':
+	// ´°Î»¥Ú¡¼¥¸ÀßÄê	
+	$objPage->tpl_mainpage = 'products/product_class_complete.tpl';
+	// ¾¦ÉÊµ¬³Ê¤ÎÅÐÏ¿
+	lfInsertProductClass($_POST, $_POST['product_id']);
+	break;
+default:
+	lfProductClassPage();	// µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------
+/* µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸É½¼¨ÍÑ */
+function lfProductClassPage() {
+	global $objPage;
+	$objPage->arrHidden = $_POST;
+	$objPage->arrHidden['select_class_id1'] = "";
+	$objPage->arrHidden['select_class_id2'] = "";
+	$arrClass = sfGetIDValueList("dtb_class", 'class_id', 'name');
+	// µ¬³ÊÊ¬Îà¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤µ¬³Ê¤ÏÉ½¼¨¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
+	$arrClassCatCount = sfGetClassCatCount();
+	foreach($arrClass as $key => $val) {
+		if($arrClassCatCount[$key] > 0) {
+			$objPage->arrClass[$key] = $arrClass[$key];
+		}
+	}
+	
+	// ¾¦ÉÊÌ¾¤ò¼èÆÀ
+	$objQuery = new SC_Query();
+	$product_name = $objQuery->getOne("SELECT name FROM dtb_products WHERE product_id = ?", array($_POST['product_id']));
+	$objPage->arrForm['product_name'] = $product_name;
+	
+}
+
+function lfSetDefaultClassCat($objQuery, $product_id, $max) {
+	global $objPage;
+	
+	// ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤ÎÆÉ¹þ
+	$col = "product_code, price01, price02, stock, stock_unlimited";
+	$arrRet = $objQuery->select($col, "dtb_products_class", "product_id = ? AND classcategory_id1 = 0 AND classcategory_id2 = 0", array($product_id));;
+	
+	if(count($arrRet) > 0) {
+		$no = 1;
+		for($cnt = 0; $cnt < $max; $cnt++) {
+			$objPage->arrForm["product_code:".$no] = $arrRet[0]['product_code'];
+			$objPage->arrForm['stock:'.$no] = $arrRet[0]['stock'];
+			$objPage->arrForm['price01:'.$no] = $arrRet[0]['price01'];
+			$objPage->arrForm['price02:'.$no] = $arrRet[0]['price02'];
+			$objPage->arrForm['stock_unlimited:'.$no] = $arrRet[0]['stock_unlimited'];
+			$no++;
+		}
+	}
+}
+
+/* µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ */
+function lfGetClassCatListDisp($class_id1, $class_id2, $default = true) {
+	global $objPage;
+	$objQuery = new SC_Query();
+		
+	if($class_id2 != "") {
+		// µ¬³Ê1¤Èµ¬³Ê2
+		$sql = "SELECT * ";
+		$sql.= "FROM vw_cross_class ";
+		$sql.= "WHERE class_id1 = ? AND class_id2 = ? ORDER BY rank1 DESC, rank2 DESC;";
+		$arrRet = $objQuery->getall($sql, array($class_id1, $class_id2));
+	} else {
+		// µ¬³Ê1¤Î¤ß
+		$sql = "SELECT * ";
+		$sql.= "FROM vw_cross_class ";
+		$sql.= "WHERE class_id1 = ? AND class_id2 = 0 ORDER BY rank1 DESC;";
+		$arrRet = $objQuery->getall($sql, array($class_id1));
+		
+	}
+	
+	$max = count($arrRet);
+	
+	if($default) {
+		// ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤òÀßÄê
+		lfSetDefaultClassCat($objQuery, $_POST['product_id'], $max);
+	}
+	
+	$objPage->arrForm["class_id1"] = $arrRet[0]['class_id1'];
+	$objPage->arrForm["class_id2"] = $arrRet[0]['class_id2'];
+	$objPage->tpl_onload.= "fnCheckAllStockLimit('$max', '" . DISABLED_RGB . "');";
+	
+	return $arrRet;
+}
+
+/* µ¬³ÊÁÈ¤ß¹ç¤ï¤»°ìÍ÷¤Î¼èÆÀ(ÊÔ½¸²èÌÌ) */
+function lfGetClassCatListEdit($product_id) {
+	global $objPage;
+	// ´ûÂ¸ÊÔ½¸¤Î¾ì¹ç
+	$objQuery = new SC_Query();
+	
+	$col = "class_id1, class_id2, name1, name2, rank1, rank2, ";
+	$col.= "product_class_id, product_id, T1_classcategory_id AS classcategory_id1, T2_classcategory_id AS classcategory_id2, ";
+	$col.= "product_code, stock, stock_unlimited, sale_limit, price01, price02, status";
+	
+	$sql = "SELECT $col FROM ";
+	$sql.= "( ";
+	$sql.= "SELECT T1.class_id AS class_id1, T2.class_id AS class_id2, T1.classcategory_id AS T1_classcategory_id, T2.classcategory_id AS T2_classcategory_id, T1.name AS name1, T2.name AS name2, T1.rank AS rank1, T2.rank AS rank2 ";
+	$sql.= "FROM dtb_classcategory AS T1, dtb_classcategory AS T2 ";
+	$sql.= "WHERE T1.class_id || '|' || T2.class_id IN (SELECT class_id1 || '|' || class_id2 FROM vw_cross_products_class WHERE product_id = ? GROUP BY class_id1, class_id2) ";
+	$sql.= ") AS T1 ";
+			
+	$sql.= "LEFT JOIN (SELECT * FROM dtb_products_class WHERE product_id = ?) AS T3 ";
+	$sql.= "ON T1_classcategory_id = T3.classcategory_id1 AND T2_classcategory_id = T3.classcategory_id2 ";
+	$sql.= "ORDER BY rank1 DESC, rank2 DESC";
+	
+	$arrList =  $objQuery->getAll($sql, array($product_id, $product_id));
+		
+	$objPage->arrForm["class_id1"] = $arrList[0]['class_id1'];
+	$objPage->arrForm["class_id2"] = $arrList[0]['class_id2'];
+	
+	$max = count($arrList);
+	
+	// ¥Ç¥Õ¥©¥ë¥ÈÃÍ¤òÀßÄê
+	lfSetDefaultClassCat($objQuery, $product_id, $max);
+	
+	$no = 1;
+	
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		$objPage->arrForm["classcategory_id1:".$no] = $arrList[$cnt]['classcategory_id1'];
+		$objPage->arrForm["classcategory_id2:".$no] = $arrList[$cnt]['classcategory_id2'];
+		if($arrList[$cnt]['product_id'] != "") {
+			$objPage->arrForm["product_code:".$no] = $arrList[$cnt]['product_code'];
+			$objPage->arrForm['stock:'.$no] = $arrList[$cnt]['stock'];
+			$objPage->arrForm['stock_unlimited:'.$no] = $arrList[$cnt]['stock_unlimited'];
+			$objPage->arrForm['price01:'.$no] = $arrList[$cnt]['price01'];
+			$objPage->arrForm['price02:'.$no] = $arrList[$cnt]['price02'];
+			// JavaScript½é´ü²½ÍÑÊ¸»úÎó
+			$line.= "'check:".$no."',";			
+		}
+		$no++;
+	}
+		
+	$line = ereg_replace(",$", "", $line);
+	$objPage->tpl_javascript = "list = new Array($line);";
+	$color = DISABLED_RGB;
+	$objPage->tpl_onload.= "fnListCheck(list); fnCheckAllStockLimit('$max', '$color');";
+
+	return $arrList;
+}
+
+/* µ¬³Ê¤ÎÅÐÏ¿ */
+function lfInsertProductClass($arrList, $product_id) {
+	$objQuery = new SC_Query();
+	
+	$objQuery->begin();
+		
+	// ´ûÂ¸µ¬³Ê¤Îºï½ü
+	$where = "product_id = ?";
+	$objQuery->delete("dtb_products_class", $where, array($product_id));
+	
+	$cnt = 1;
+	// ¤¹¤Ù¤Æ¤Îµ¬³Ê¤òÅÐÏ¿¤¹¤ë¡£
+	while($arrList["classcategory_id1:".$cnt] != "") {
+		if($arrList["check:".$cnt] == 1) {
+			$sqlval['product_id'] = $product_id;
+			$sqlval['classcategory_id1'] = $arrList["classcategory_id1:".$cnt];
+			$sqlval['classcategory_id2'] = $arrList["classcategory_id2:".$cnt];
+			$sqlval['product_code'] = $arrList["product_code:".$cnt];
+			$sqlval['stock'] = $arrList["stock:".$cnt];
+			$sqlval['stock_unlimited'] = $arrList["stock_unlimited:".$cnt];
+			$sqlval['price01'] = $arrList['price01:'.$cnt];
+			$sqlval['price02'] = $arrList['price02:'.$cnt];
+			$sqlval['creator_id'] = $_SESSION['member_id'];
+			// INSERT¤Î¼Â¹Ô
+			$objQuery->insert("dtb_products_class", $sqlval);
+		}
+		$cnt++;
+	}
+	
+	$objQuery->commit();
+}
+
+// µ¬³ÊÁªÂò¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfClassError() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("µ¬³Ê1", "select_class_id1"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("µ¬³Ê", "select_class_id1", "select_class_id2"), array("TOP_EXIST_CHECK"));
+	$objErr->doFunc(array("µ¬³Ê1", "µ¬³Ê2", "select_class_id1", "select_class_id2"), array("DIFFERENT_CHECK"));
+	return $objErr->arrErr;
+}
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+
+	$no = 1;
+	while($array["classcategory_id1:".$no] != "") {
+		$arrConvList["product_code:".$no] = "KVa";
+		$arrConvList["price01:".$no] = "n";
+		$arrConvList["price02:".$no] = "n";
+		$arrConvList["stock:".$no] = "n";
+		$no++;
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+// ¾¦ÉÊµ¬³Ê¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfProductClassError($array) {
+	$objErr = new SC_CheckError($array);
+	$no = 1;
+		
+	while($array["classcategory_id1:".$no] != "") {
+		if($array["check:".$no] == 1) {
+			$objErr->doFunc(array("¾¦ÉÊ¥³¡¼¥É", "product_code:".$no, STEXT_LEN), array("MAX_LENGTH_CHECK"));
+			$objErr->doFunc(array("»²¹Í»Ô¾ì²Á³Ê", "price01:".$no, PRICE_LEN), array("ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+			$objErr->doFunc(array("²Á³Ê", "price02:".$no, PRICE_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+
+			if($array["stock_unlimited:".$no] != '1') {
+				$objErr->doFunc(array("ºß¸Ë¿ô", "stock:".$no, AMOUNT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+			}
+		}
+		if(count($objErr->arrErr) > 0) {
+			$objErr->arrErr["error:".$no] = $objErr->arrErr["product_code:".$no];
+			$objErr->arrErr["error:".$no].= $objErr->arrErr["price01:".$no];
+			$objErr->arrErr["error:".$no].= $objErr->arrErr["price02:".$no];
+			$objErr->arrErr["error:".$no].= $objErr->arrErr["stock:".$no];
+		}
+		$no++;
+	}
+	return $objErr->arrErr;
+}
+
+/* ³ÎÇ§¥Ú¡¼¥¸É½¼¨ÍÑ */
+function lfProductConfirmPage() {
+	global $objPage;
+	$objPage->arrForm['mode'] = 'complete';
+	$objPage->arrClass = sfGetIDValueList("dtb_class", 'class_id', 'name');
+	$cnt = 0;
+	$check = 0;
+	$no = 1;
+	while($_POST["classcategory_id1:".$no] != "") {
+		if($_POST["check:".$no] != "") {
+			$check++;
+		}
+		$no++;
+		$cnt++;
+	}
+	$objPage->tpl_check = $check;
+	$objPage->tpl_count = $cnt;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/review_edit.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/review_edit.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/review_edit.php	(revision 1328)
@@ -0,0 +1,153 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/review_edit.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'review';
+		global $arrRECOMMEND;
+		$this->arrRECOMMEND = $arrRECOMMEND;
+		$this->tpl_subtitle = '¥ì¥Ó¥å¡¼´ÉÍý';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+//¸¡º÷¥ï¡¼¥É¤Î°ú·Ñ¤®
+foreach ($_POST as $key => $val){
+	if (ereg("^search_", $key)){
+	$objPage->arrSearchHidden[$key] = $val;
+	}
+}
+
+//¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ÍÑ¥«¥é¥à
+$arrRegistColumn = array (		
+								array( "column" => "status"),
+								array( "column" => "recommend_level"),		
+								array(	"column" => "title",		"convert" => "KVa"),
+								array(	"column" => "comment",		"convert" => "KVa")	
+							);
+
+//¥ì¥Ó¥å¡¼ID¤òÅÏ¤¹
+$objPage->tpl_review_id = $_POST['review_id'];
+//¥ì¥Ó¥å¡¼¾ðÊó¤Î¥«¥é¥à¤Î¼èÆÀ
+$objPage->arrReview = lfGetReviewData($_POST['review_id']);
+//ÅÐÏ¿ºÑ¤ß¤Î¥¹¥Æ¡¼¥¿¥¹¤òÅÏ¤¹
+$objPage->tpl_pre_status = $objPage->arrReview['status'];
+//¾¦ÉÊ¤´¤È¤Î¥ì¥Ó¥å¡¼É½¼¨¿ô¼èÆÀ
+$count = $objQuery->count("dtb_review", "delete=0 AND status=1 AND product_id=?", array($objPage->arrReview['product_id']));
+//¥ì¥Ó¥å¡¼É½¼¨¿ô¤¬ÀßÄêÃÍ°Ê¾å¤Î¾ì¹ç
+if ($count >= REVIEW_REGIST_MAX){
+	//É½¼¨¤ÏÁªÂò¤Ç¤­¤Ê¤¤
+	$objPage->tpl_status_change = false;
+}else{
+	//Î¾ÊýÁªÂò²ÄÇ½
+	$objPage->tpl_status_change = true;
+}
+					
+switch($_POST['mode']) {
+//ÅÐÏ¿
+case 'complete':
+	//¥Õ¥©¡¼¥àÃÍ¤ÎÊÑ´¹
+	$arrReview = lfConvertParam($_POST, $arrRegistColumn);
+	$objPage->arrErr = lfCheckError($arrReview);
+	//ÈóÉ½¼¨¤«¤éÉ½¼¨¤Ë¥¹¥Æ¡¼¥¿¥¹¤òÀÚ¤êÂØ¤¨¤Æ¡¢¾¦ÉÊ¤´¤È¤ÎÉ½¼¨¥ì¥Ó¥å¡¼¿ô¤¬ÀßÄêÃÍ¤òÄ¶¤¨¤Æ¤¤¤ë¤È¤­
+	if ($arrReview['pre_status'] == '2' && $arrReview['status'] == '1' && $count >= REVIEW_REGIST_MAX){
+		$objPage->arrErr['status'] = '¢¨ ¥ì¥Ó¥å¡¼É½¼¨¿ô¤Ï5·ï¤Þ¤Ç¤Ç¤¹¡£';
+		$objPage->arrReview = $arrReview;
+	} else {
+		//¥¨¥é¡¼Ìµ¤·
+		if (!$objPage->arrErr){
+			//¥ì¥Ó¥å¡¼¾ðÊó¤ÎÊÔ½¸ÅÐÏ¿
+			lfRegistReviewData($arrReview, $arrRegistColumn);
+			$objPage->arrReview = $arrReview;
+			$objPage->tpl_onload = "confirm('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//------------------------------------------------------------------------------------------------------------------------------------
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError($array) {
+	$objErr = new SC_CheckError($array);
+		$objErr->doFunc(array("¤ª¤¹¤¹¤á¥ì¥Ù¥ë", "recommend_level"), array("SELECT_CHECK"));
+		$objErr->doFunc(array("¥¿¥¤¥È¥ë", "title", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	return $objErr->arrErr;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//¥ì¥Ó¥å¡¼¾ðÊó¤Î¼èÆÀ
+function lfGetReviewData($review_id){
+	global $objPage;
+	global $objQuery;
+	$select="review_id, A.product_id, reviewer_name, sex, recommend_level, ";
+	$select.="reviewer_url, title, comment, A.status, A.create_date, A.update_date, name";
+	$from = "dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ";
+	$where = "A.delete = 0 AND B.delete = 0 AND review_id = ? ";
+	$arrReview = $objQuery->select($select, $from, $where, array($review_id));
+	if(!empty($arrReview)) {
+		$objPage->arrReview = $arrReview[0];
+	} else {
+		sfDispError("");
+	}
+	return $objPage->arrReview;
+}
+
+//¥ì¥Ó¥å¡¼¾ðÊó¤ÎÊÔ½¸ÅÐÏ¿
+function lfRegistReviewData($array, $arrRegistColumn){
+	global $objQuery;
+	foreach ($arrRegistColumn as $data) {
+		if (strlen($array[ $data["column"] ]) > 0 ) {
+			$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+		}
+		if ($data['column'] == 'update_date'){
+			$arrRegist['update_date'] = 'now()';
+		}
+	}
+	//ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->update("dtb_review", $arrRegist, "review_id='".$_POST['review_id']."'");
+	$objQuery->commit();
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/index.php	(revision 3641)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/index.php	(revision 3641)
@@ -0,0 +1,343 @@
+<?php
+
+require_once("../require.php");
+require_once("./index_csv.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+	var $arrProducts;
+	var $arrPageMax;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/index.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¾¦ÉÊ¥Þ¥¹¥¿';
+
+		global $arrPageMax;
+		$this->arrPageMax = $arrPageMax;
+		global $arrDISP;
+		$this->arrDISP = $arrDISP;
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		global $arrPRODUCTSTATUS_COLOR;
+		$this->arrPRODUCTSTATUS_COLOR = $arrPRODUCTSTATUS_COLOR;
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+
+	}
+}
+
+//$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+$objDate = new SC_Date();
+
+// ÅÐÏ¿¡¦¹¹¿·¸¡º÷³«»ÏÇ¯
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrStartYear = $objDate->getYear();
+$objPage->arrStartMonth = $objDate->getMonth();
+$objPage->arrStartDay = $objDate->getDay();
+// ÅÐÏ¿¡¦¹¹¿·¸¡º÷½ªÎ»Ç¯
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrEndYear = $objDate->getYear();
+$objPage->arrEndMonth = $objDate->getMonth();
+$objPage->arrEndDay = $objDate->getDay();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+//¥­¥ã¥ó¥Ú¡¼¥ó¤ÎÊÔ½¸»þ
+if(sfIsInt($_POST['campaign_id']) && $_POST['mode'] == "camp_search") {
+	$objQuery = new SC_Query();
+	$search_data = $objQuery->get("dtb_campaign", "search_condition", "campaign_id = ? ", array($_POST['campaign_id']));
+	$arrSearch = unserialize($search_data);
+	foreach ($arrSearch as $key => $val) {
+		$_POST[$key] = $val;
+	}
+}
+
+// POSTÃÍ¤Î°ú¤­·Ñ¤®
+$objPage->arrForm = $_POST;
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key) || ereg("^campaign_", $key)) {
+		switch($key) {
+			case 'search_product_flag':
+			case 'search_status':
+				$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
+				if(!is_array($val)) {
+					$objPage->arrForm[$key] = split("-", $val);
+				}
+				break;
+			default:
+				$objPage->arrHidden[$key] = $val;
+				break;
+		}
+	}
+}
+
+// ¥Ú¡¼¥¸Á÷¤êÍÑ
+$objPage->arrHidden['search_pageno'] = $_POST['search_pageno'];
+
+// ¾¦ÉÊºï½ü
+if ($_POST['mode'] == "delete") {
+	
+	if($_POST['category_id'] != "") {
+		// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü
+		$where = "category_id = " . addslashes($_POST['category_id']);
+		sfDeleteRankRecord("dtb_products", "product_id", $_POST['product_id'], $where);
+	} else {
+		sfDeleteRankRecord("dtb_products", "product_id", $_POST['product_id']);
+	}
+	// »Ò¥Æ¡¼¥Ö¥ë(¾¦ÉÊµ¬³Ê)¤Îºï½ü
+	$objQuery = new SC_Query();
+	$objQuery->delete("dtb_products_class", "product_id = ?", array($_POST['product_id']));
+	
+	// ·ï¿ô¥«¥¦¥ó¥È¥Ð¥Ã¥Á¼Â¹Ô
+	sfCategory_Count($objQuery);	
+}
+
+
+if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all" || $_POST['mode'] == "camp_search") {
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckError();
+
+	$where = "delete = 0";
+
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if (count($objPage->arrErr) == 0) {
+
+		foreach ($objPage->arrForm as $key => $val) {
+				
+			$val = sfManualEscape($val);
+			
+			if($val == "") {
+				continue;
+			}
+			
+			switch ($key) {
+				case 'search_product_id':	// ¾¦ÉÊID
+					$where .= " AND product_id = ?";
+					$arrval[] = $val;
+					break;
+				case 'search_product_class_name': //µ¬³ÊÌ¾¾Î
+					$where_in = " (SELECT classcategory_id FROM dtb_classcategory WHERE class_id IN (SELECT class_id FROM dtb_class WHERE name LIKE ?)) ";
+					$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE classcategory_id1 IN " . $where_in;
+					$where .= " OR classcategory_id2 IN" . $where_in . ")";
+					$arrval[] = "%$val%";
+					$arrval[] = "%$val%";
+					break;
+				case 'search_name':			// ¾¦ÉÊÌ¾
+					$where .= " AND name ILIKE ?";
+					$arrval[] = "%$val%";
+					break;
+				case 'search_category_id':	// ¥«¥Æ¥´¥ê¡¼
+					list($tmp_where, $tmp_arrval) = sfGetCatWhere($val);
+					if($tmp_where != "") {
+						$where.= " AND $tmp_where";
+						$arrval = array_merge($arrval, $tmp_arrval);
+					}
+					break;
+				case 'search_product_code':	// ¾¦ÉÊ¥³¡¼¥É
+					$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+					$arrval[] = "%$val%";
+					break;
+				case 'search_startyear':	// ÅÐÏ¿¹¹¿·Æü¡ÊFROM¡Ë
+					$date = sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
+					$where.= " AND update_date >= '" . $_POST['search_startyear'] . "/" . $_POST['search_startmonth']. "/" .$_POST['search_startday'] . "'";
+//					$arrval[] = $date;
+					break;
+				case 'search_endyear':		// ÅÐÏ¿¹¹¿·Æü¡ÊTO¡Ë
+					$date = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
+					$where.= " AND update_date <= date('" . $_POST['search_endyear'] . "/" . $_POST['search_endmonth'] . "/" . $_POST['search_endday'] . "')+1";
+
+//					$arrval[] = $date;
+					break;
+				case 'search_product_flag':	//¼ïÊÌ
+					global $arrSTATUS;
+					$search_product_flag = sfSearchCheckBoxes($val);
+					if($search_product_flag != "") {
+						$where.= " AND product_flag LIKE ?";
+						$arrval[] = $search_product_flag;					
+					}
+					break;
+				case 'search_status':		// ¥¹¥Æ¡¼¥¿¥¹
+					$tmp_where = "";
+					foreach ($val as $element){
+						if ($element != ""){
+							if ($tmp_where == ""){
+								$tmp_where.="AND (status LIKE ? ";
+							}else{
+								$tmp_where.="OR status LIKE ? ";
+							}
+							$arrval[]=$element;
+						}
+					}
+					if ($tmp_where != ""){
+						$tmp_where.=")";
+						$where.= "$tmp_where";
+					}
+					break;
+				default:
+					break;
+			}
+		}
+
+		$order = "update_date DESC";
+		$objQuery = new SC_Query();
+		
+		switch($_POST['mode']) {
+		case 'csv':
+			// ¥ª¥×¥·¥ç¥ó¤Î»ØÄê
+			$option = "ORDER BY $order";
+			// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤ÎºîÀ®
+			$arrOutput = sfSwapArray(sfgetCsvOutput(1, " WHERE csv_id = 1 AND status = 1"));
+			
+			if (count($arrOutput) <= 0) break;
+			
+			$arrOutputCols = $arrOutput['col'];
+			$arrOutputTitle = $arrOutput['disp_name'];
+			
+			$head = sfGetCSVList($arrOutputTitle);
+			
+			$data = lfGetProductsCSV($where, $option, $arrval, $arrOutputCols);
+
+			// CSV¤òÁ÷¿®¤¹¤ë¡£
+			sfCSVDownload($head.$data);
+			exit;
+			break;
+		case 'delete_all':
+			// ¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü
+			$where = "product_id IN (SELECT product_id FROM vw_products_nonclass WHERE $where)";
+			$sqlval['delete'] = 1;
+			$objQuery->update("dtb_products", $sqlval, $where, $arrval);
+			break;
+		default:
+			// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+			$col = "product_id, name, category_id, main_list_image, status, product_code, price01, price02, stock, stock_unlimited";
+			$from = "vw_products_nonclass";
+
+			// ¹Ô¿ô¤Î¼èÆÀ
+			$linemax = $objQuery->count($from, $where, $arrval);
+			$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+			if(is_numeric($_POST['search_page_max'])) {	
+				$page_max = $_POST['search_page_max'];
+			} else {
+				$page_max = SEARCH_PMAX;
+			}
+
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+			$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+			$startno = $objNavi->start_row;
+			$objPage->arrPagenavi = $objNavi->arrPagenavi;
+			
+			//¥­¥ã¥ó¥Ú¡¼¥ó¾¦ÉÊ¸¡º÷»þ¤Ï¡¢Á´·ë²Ì¤Î¾¦ÉÊID¤òÊÑ¿ô¤Ë³ÊÇ¼¤¹¤ë
+			if($_POST['search_mode'] == 'campaign') {
+				$arrRet = $objQuery->select($col, $from, $where, $arrval);
+				if(count($arrRet) > 0) {
+					$arrRet = sfSwapArray($arrRet);
+					$pid = implode("-", $arrRet['product_id']);
+					$objPage->arrHidden['campaign_product_id'] = $pid;
+				}
+			}
+
+			// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+			$objQuery->setlimitoffset($page_max, $startno);
+			// É½¼¨½ç½ø
+			$objQuery->setorder($order);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+			
+			break;
+		}
+	}
+}
+
+// ¥«¥Æ¥´¥ê¤ÎÆÉ¹þ
+$objPage->arrCatList = sfGetCategoryList();
+$objPage->arrCatIDName = lfGetIDName($objPage->arrCatList);
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+// ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ 
+function lfConvertParam() {
+	global $objPage;
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	$arrConvList['search_name'] = "KVa";
+	$arrConvList['search_product_code'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+// ¥¨¥é¡¼¥Á¥§¥Ã¥¯ 
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError() {
+	$objErr = new SC_CheckError();
+	$objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM"));
+	return $objErr->arrErr;
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹ÍÑWHEREÊ¸ºîÀ®
+function lfGetCBWhere($key, $max) {
+	$str = "";
+	$find = false;
+	for ($cnt = 1; $cnt <= $max; $cnt++) {
+		if ($_POST[$key . $cnt] == "1") {
+			$str.= "1";
+			$find = true;
+		} else {
+			$str.= "_";
+		}
+	}
+	if (!$find) {
+		$str = "";
+	}
+	return $str;
+}
+
+// ¥«¥Æ¥´¥êID¤ò¥­¡¼¡¢¥«¥Æ¥´¥êÌ¾¤òÃÍ¤Ë¤¹¤ëÇÛÎó¤òÊÖ¤¹¡£
+function lfGetIDName($arrCatList) {
+	$max = count($arrCatList);
+	for ($cnt = 0; $cnt < $max; $cnt++ ) {
+		$key = $arrCatList[$cnt]['category_id'];
+		$val = $arrCatList[$cnt]['category_name'];
+		$arrRet[$key] = $val;	
+	}
+	return $arrRet;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/bak_upload_csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/bak_upload_csv.php	(revision 2706)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/bak_upload_csv.php	(revision 2706)
@@ -0,0 +1,231 @@
+<?php
+
+require_once("../require.php");
+
+// 1¹Ô¤¢¤¿¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("CSV_LINE_MAX", 10000);
+
+class LC_Page {
+	var $arrSession;
+	var $arrCSVErr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/upload_csv.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'upload_csv';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+$objPage->arrTitle = $objFormParam->getTitleArray();
+
+switch($_POST['mode']) {
+case 'csv_upload':
+	$err = false;
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr['csv_file'] = $objUpFile->makeTempFile('csv_file');
+	
+	if($objPage->arrErr['css_file'] == "") {
+		$objPage->arrErr = $objUpFile->checkEXISTS();
+	}
+	
+	if($objPage->arrErr['csv_file'] == "") {
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$filepath = $objUpFile->getTempFilePath('csv_file');
+		// ¥¨¥ó¥³¡¼¥É
+		$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+		$fp = fopen($enc_filepath, "r");
+		$line = 0;		// ¹Ô¿ô
+		$regist = 0;	// ÅÐÏ¿¿ô
+		
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		
+		while(!feof($fp) && !$err) {
+			$arrCSV = fgetcsv($fp, CSV_LINE_MAX);
+						
+			// ¹Ô¥«¥¦¥ó¥È
+			$line++;
+			
+			if($line <= 1) {
+				continue;
+			}			
+							
+			// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+			$max = count($arrCSV);
+			
+			// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+			if($max <= 1) {
+				continue;			
+			}
+			
+			// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+			if($max != $colmax) {
+				$objPage->arrCSVErr['blank'] = "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£";
+				$err = true;
+			} else {
+				// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+				$objFormParam->setParam($arrCSV, true);
+				$arrRet = $objFormParam->getHashArray();
+				// ÃÍ¤ò¥Õ¥©¡¼¥Þ¥Ã¥ÈÊÑ´¹¤·¤Æ³ÊÇ¼¤¹¤ë¡£
+				$arrRet = lfConvFormat($arrRet);
+				$objFormParam->setParam($arrRet);
+				// ÆþÎÏÃÍ¤ÎÊÑ´¹
+				$objFormParam->convParam();
+				// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+				$objPage->arrCSVErr = lfCheckError();
+			}
+			
+			// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			if(count($objPage->arrCSVErr) > 0) {
+				$objPage->tpl_errtitle = "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+				$objPage->arrParam = $objFormParam->getHashArray();
+				$err = true;
+			}
+			
+			if(!$err) {
+				lfInsertProduct($objQuery);
+				$regist++;
+			}
+		}
+		fclose($fp);
+		
+		if(!$err) {
+			$objQuery->commit();
+			$objPage->tpl_oktitle = "¢£" . $regist . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£";
+		} else {
+			$objQuery->rollback();
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥«¥Æ¥´¥êID", "category_id", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹", "product_flag", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price01", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊ²Á³Ê", "price02", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþÀ©¸Â", "sale_limit", INT_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó°ìÍ÷¥³¥á¥ó¥È", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(1)", "sub_title1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(1)", "sub_comment1", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(2)", "sub_title2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(2)", "sub_comment2", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(3)", "sub_title3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(3)", "sub_comment3", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(4)", "sub_title4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(4)", "sub_comment4", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(5)", "sub_title5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(5)", "sub_comment5", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë(6)", "sub_title6", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È(6)", "sub_comment6", LTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+}
+
+/* ÆÃ¼ì¹àÌÜ¤ÎÊÑ´¹ */
+function lfConvFormat($array) {
+	global $arrDISP;
+	foreach($array as $key => $val) {
+		switch($key) {
+		case 'status':
+			$arrRet[$key] = sfSearchKey($arrDISP, $val, 1);
+			break;
+		default:
+			$arrRet[$key] = $val;
+			break;
+		}
+	}
+	return $arrRet;
+}
+
+/* ¾¦ÉÊ¤Î¿·µ¬ÄÉ²Ã */
+function lfInsertProduct($objQuery) {
+	global $objFormParam;
+	$arrRet = $objFormParam->getHashArray();
+	
+	// µ¬³Ê¤ËÅÐÏ¿¤µ¤ì¤ëÃÍ¤ò½ü³°¤¹¤ë¡£
+	foreach($arrRet as $key => $val) {
+		switch($key) {
+		case 'product_code':
+		case 'price01':
+		case 'price02':
+		case 'point_rate':
+		case 'stock':
+			break;
+		default:
+			$sqlval[$key] = $val;
+			break;
+		}
+	}
+	
+	$product_id = $objQuery->nextval("dtb_products", "product_id");
+	$sqlval['product_id'] = $product_id;
+	$sqlval['status'] = 2;	// ÈóÉ½¼¨¤ËÀßÄê¤¹¤ë¡£
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "delete = 0 AND category_id = ?", array($sqlval['category_id'])) + 1;
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrRet, $product_id);
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_products", $sqlval);
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError(false);
+	
+	if(!isset($objErr->arrErr['category_id'])) {
+		$objQuery = new SC_Query();
+		$col = "level";
+		$table = "dtb_category";
+		$where = "category_id = ?";
+		$level = $objQuery->get($table, $col, $where, array($arrRet['category_id']));
+		if($level != LEVEL_MAX) {
+			$objErr->arrErr['category_id'] = "¢¨ ¤³¤Î¥«¥Æ¥´¥êID¤Ë¤Ï¾¦ÉÊ¤òÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£";
+		}
+	}
+	return $objErr->arrErr;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/upload_rakuten.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/upload_rakuten.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/upload_rakuten.php	(revision 1328)
@@ -0,0 +1,162 @@
+<?php
+require_once("../require.php");
+require_once("./upload_csv.inc");
+
+// 1¹Ô¤¢¤¿¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("CSV_LINE_MAX", 10000);
+
+class LC_Page {
+	var $arrSession;
+	var $arrCSVErr;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/upload_csv.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subno = 'upload_rakuten';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$colmax = $objFormParam->getCount();
+$objFormParam->setHtmlDispNameArray();
+$objPage->arrTitle = $objFormParam->getHtmlDispNameArray();
+
+switch($_POST['mode']) {
+case 'csv_upload':
+	$err = false;
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr['csv_file'] = $objUpFile->makeTempFile('csv_file');
+	
+	if($objPage->arrErr['css_file'] == "") {
+		$objPage->arrErr = $objUpFile->checkEXISTS();
+	}
+	
+	if($objPage->arrErr['csv_file'] == "") {
+		// °ì»þ¥Õ¥¡¥¤¥ëÌ¾¤Î¼èÆÀ
+		$filepath = $objUpFile->getTempFilePath('csv_file');
+		// ¥¨¥ó¥³¡¼¥É
+		$enc_filepath = sfEncodeFile($filepath, "EUC-JP", CSV_TEMP_DIR);
+		$fp = fopen($enc_filepath, "r");
+		$line = 0;		// ¹Ô¿ô
+		$regist = 0;	// ÅÐÏ¿¿ô
+		
+		$objQuery = new SC_Query();
+		$objQuery->begin();
+		
+		while(!feof($fp) && !$err) {
+			$arrCSV = fgetcsv($fp, CSV_LINE_MAX);
+						
+			// ¹Ô¥«¥¦¥ó¥È
+			$line++;
+			
+			if($line <= 1) {
+				continue;
+			}			
+							
+			// ¹àÌÜ¿ô¥«¥¦¥ó¥È
+			$max = count($arrCSV);
+			
+			// ¹àÌÜ¿ô¤¬1°Ê²¼¤Î¾ì¹ç¤ÏÌµ»ë¤¹¤ë
+			if($max <= 1) {
+				continue;			
+			}
+			
+			// ¹àÌÜ¿ô¥Á¥§¥Ã¥¯
+			if($max != $colmax) {
+				$objPage->arrCSVErr['blank'] = "¢¨ ¹àÌÜ¿ô¤¬" . $max . "¸Ä¸¡½Ð¤µ¤ì¤Þ¤·¤¿¡£¹àÌÜ¿ô¤Ï" . $colmax . "¸Ä¤Ë¤Ê¤ê¤Þ¤¹¡£";
+				$err = true;
+			} else {
+				// ¥·¡¼¥±¥ó¥¹ÇÛÎó¤ò³ÊÇ¼¤¹¤ë¡£
+				$objFormParam->setParam($arrCSV, true);
+				$arrRet = $objFormParam->getHashArray();
+				$objFormParam->setParam($arrRet);
+				// ÆþÎÏÃÍ¤ÎÊÑ´¹
+				$objFormParam->convParam();
+				// <br>¤Ê¤·¤Ç¥¨¥é¡¼¼èÆÀ¤¹¤ë¡£
+				$objPage->arrCSVErr = lfCheckError();
+			}
+			
+			// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			if(count($objPage->arrCSVErr) > 0) {
+				$objPage->tpl_errtitle = "¢£" . $line . "¹ÔÌÜ¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+				$objPage->arrParam = $objFormParam->getHashArray();
+				$err = true;
+			}
+			
+			if(!$err) {
+				lfRegistProduct($objQuery);
+				$regist++;
+			}
+		}
+		fclose($fp);
+		
+		if(!$err) {
+			$objQuery->commit();
+			$objPage->tpl_oktitle = "¢£" . $regist . "·ï¤Î¥ì¥³¡¼¥É¤òÅÐÏ¿¤·¤Þ¤·¤¿¡£";
+			// ¾¦ÉÊ·ï¿ô¥«¥¦¥ó¥È´Ø¿ô¤Î¼Â¹Ô
+			sfCategory_Count($objQuery);
+		} else {
+			$objQuery->rollback();
+		}
+	}
+	break;
+default:
+	break;
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//--------------------------------------------------------------------------------------------------------------------------
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("CSV¥Õ¥¡¥¤¥ë", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	
+	$objFormParam->addParam("¥Õ¥é¥°(ÂÐ±þ¤Ê¤·)", "dummy1");
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥â¥Ð¥¤¥ëÍÑ¾¦ÉÊÌ¾(ÂÐ±þ¤Ê¤·)", "dummy2");
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¾¦ÉÊID(ÂÐ±þ¤Ê¤·)", "dummy3");
+	$objFormParam->addParam("¾¦ÉÊ¥Ú¡¼¥¸ID(ÂÐ±þ¤Ê¤·)", "dummy1");
+	$objFormParam->addParam("¼ÂÇä²Á³Ê", "price01", PRICE_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("É½¼¨²Á³Ê", "price02", PRICE_LEN, "n", array("EXIST_CHECK","MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¾ÃÈñÀÇ¥Õ¥é¥°(ÂÐ±þ¤Ê¤·)", "dummy4");
+	$objFormParam->addParam("Á÷ÎÁ(ÂÐ±þ¤Ê¤·)", "dummy5");
+	$objFormParam->addParam("¸ÄÊÌÁ÷ÎÁ(ÂÐ±þ¤Ê¤·)", "dummy6");
+	$objFormParam->addParam("ÃíÊ¸¥Ü¥¿¥ó(ÂÐ±þ¤Ê¤·)", "dummy7");
+	$objFormParam->addParam("»ñÎÁÀÁµá¥Ü¥¿¥ó(ÂÐ±þ¤Ê¤·)", "dummy8");
+	$objFormParam->addParam("Ìä¤¤¹ç¤ï¤»¥Ü¥¿¥ó(ÂÐ±þ¤Ê¤·)", "dummy9");
+	$objFormParam->addParam("¤ª´«¤á¥Ü¥¿¥ó(ÂÐ±þ¤Ê¤·)", "dummy10");
+	$objFormParam->addParam("¤Î¤·ÂÐ±þ¥Õ¥é¥°(ÂÐ±þ¤Ê¤·)", "dummy11");
+	$objFormParam->addParam("ºß¸Ë¿ô", "stock", INT_LEN, "n", array("MAX_LENGTH_CHECK","NUM_CHECK"));
+	$objFormParam->addParam("¹àÌÜÁªÂò»è(ÂÐ±þ¤Ê¤·)", "dummy12");
+	$objFormParam->addParam("´ü´Ö¸ÂÄêÈÎÇä(ÂÐ±þ¤Ê¤·)", "dummy13");
+	$objFormParam->addParam("ÀâÌÀÊ¸", "main_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥â¥Ð¥¤¥ëÀâÌÀÊ¸(ÂÐ±þ¤Ê¤·)", "dummy14");
+	$objFormParam->addParam("²èÁü(ÂÐ±þ¤Ê¤·)", "dummy15");
+	$objFormParam->addParam("³ÚÅ·¥Ç¥£¥ì¥¯¥È¥êID(ÂÐ±þ¤Ê¤·)", "dummy16");
+	$objFormParam->addParam("¥â¥Ð¥¤¥ë(ÂÐ±þ¤Ê¤·)", "dummy17");
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/category.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/category.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/category.php	(revision 1328)
@@ -0,0 +1,302 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/category.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'category';
+		$this->tpl_onload = " fnSetFocus('category_name'); ";
+		$this->tpl_subtitle = '¥«¥Æ¥´¥ê¡¼ÅÐÏ¿';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ÄÌ¾ï»þ¤Ï¿Æ¥«¥Æ¥´¥ê¤ò0¤ËÀßÄê¤¹¤ë¡£
+$objPage->arrForm['parent_category_id'] = $_POST['parent_category_id'];
+
+switch($_POST['mode']) {
+case 'edit':
+	$objFormParam->convParam();
+	$arrRet =  $objFormParam->getHashArray();
+	$objPage->arrErr = lfCheckError($arrRet);
+	
+	if(count($objPage->arrErr) == 0) {
+		if($_POST['category_id'] == "") {
+			$objQuery = new SC_Query();
+			$count = $objQuery->count("dtb_category");
+			if($count < CATEGORY_MAX) {			
+				lfInsertCat($_POST['parent_category_id']);
+			} else {
+				print("¥«¥Æ¥´¥ê¤ÎÅÐÏ¿ºÇÂç¿ô¤òÄ¶¤¨¤Þ¤·¤¿¡£");
+			}
+		} else {
+			lfUpdateCat($_POST['category_id']);
+		}
+	} else {
+		$objPage->arrForm = array_merge($objPage->arrForm, $objFormParam->getHashArray());
+		$objPage->arrForm['category_id'] = $_POST['category_id'];
+	}
+	break;
+case 'pre_edit':
+	// ÊÔ½¸¹àÌÜ¤Î¥«¥Æ¥´¥êÌ¾¤òDB¤è¤ê¼èÆÀ¤¹¤ë¡£
+	$oquery = new SC_Query();
+	$where = "category_id = ?";
+	$cat_name = $oquery->get("dtb_category", "category_name", $where, array($_POST['category_id']));
+	// ÆþÎÏ¹àÌÜ¤Ë¥«¥Æ¥´¥êÌ¾¤òÆþÎÏ¤¹¤ë¡£
+	$objPage->arrForm['category_name'] = $cat_name;
+	// POST¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+	$objPage->arrForm['category_id'] = $_POST['category_id'];
+	break;
+case 'delete':
+	$objQuery = new SC_Query();
+	// »Ò¥«¥Æ¥´¥ê¤Î¥Á¥§¥Ã¥¯
+	$where = "parent_category_id = ? AND delete = 0";
+	$count = $objQuery->count("dtb_category", $where, array($_POST['category_id']));
+	if($count != 0) {
+		$objPage->arrErr['category_name'] = "¢¨ »Ò¥«¥Æ¥´¥ê¤¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤­¤Þ¤»¤ó¡£<br>";
+	}
+	// ÅÐÏ¿¾¦ÉÊ¤Î¥Á¥§¥Ã¥¯
+	$where = "category_id = ? AND delete = 0";
+	$count = $objQuery->count("dtb_products", $where, array($_POST['category_id']));
+	if($count != 0) {
+		$objPage->arrErr['category_name'] = "¢¨ ¥«¥Æ¥´¥êÆâ¤Ë¾¦ÉÊ¤¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤­¤Þ¤»¤ó¡£<br>";
+	}	
+	
+	if(!isset($objPage->arrErr['category_name'])) {
+		// ¥é¥ó¥¯ÉÕ¤­¥ì¥³¡¼¥É¤Îºï½ü(¢¨½èÍýÉé²Ù¤ò¹ÍÎ¸¤·¤Æ¥ì¥³¡¼¥É¤´¤Èºï½ü¤¹¤ë¡£)
+		sfDeleteRankRecord("dtb_category", "category_id", $_POST['category_id'], "", true);
+	}
+	break;
+case 'up':
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	$up_id = lfGetUpRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
+	if($up_id != "") {
+		// ¾å¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô
+		$my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
+		// ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô
+		$up_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id);
+		if($my_count > 0 && $up_count > 0) {
+			// ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Ë²Ã»»
+			lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $up_count);
+			// ¾å¤Î¥°¥ë¡¼¥×¤«¤é¸º»»
+			lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id, $my_count);
+		}
+	}
+	$objQuery->commit();
+	break;
+case 'down':
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	$down_id = lfGetDownRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
+	if($down_id != "") {
+		// ²¼¤Î¥°¥ë¡¼¥×¤Îrank¤Ë²Ã»»¤¹¤ë¿ô
+		$my_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
+		// ¼«Ê¬¤Î¥°¥ë¡¼¥×¤Îrank¤«¤é¸º»»¤¹¤ë¿ô
+		$down_count = lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id);
+		if($my_count > 0 && $down_count > 0) {
+			// ¼«Ê¬¤Î¥°¥ë¡¼¥×¤«¤é¸º»»
+			lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id, $my_count);
+			// ²¼¤Î¥°¥ë¡¼¥×¤Ë²Ã»»
+			lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $down_count);
+		}
+	}
+	$objQuery->commit();
+	break;
+case 'tree':
+	break;
+default:
+	$objPage->arrForm['parent_category_id'] = 0;
+	break;
+}
+
+$objPage->arrList = lfGetCat($objPage->arrForm['parent_category_id']);
+$objPage->arrTree = sfGetCatTree($objPage->arrForm['parent_category_id']);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+// ¥«¥Æ¥´¥ê¤Î¿·µ¬ÄÉ²Ã
+function lfInsertCat($parent_category_id) {
+	global $objFormParam;
+	
+	$objQuery = new SC_Query();
+	$objQuery->begin();	// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Î³«»Ï
+	
+	
+	if($parent_category_id == 0) {
+		// ROOT³¬ÁØ¤ÇºÇÂç¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£		
+		$where = "parent_category_id = ?";
+		$rank = $objQuery->max("dtb_category", "rank", $where, array($parent_category_id)) + 1;
+	} else {
+		// ¿Æ¤Î¥é¥ó¥¯¤ò¼«Ê¬¤Î¥é¥ó¥¯¤È¤¹¤ë¡£
+		$where = "category_id = ?";
+		$rank = $objQuery->get("dtb_category", "rank", $where, array($parent_category_id));
+		// ÄÉ²Ã¥ì¥³¡¼¥É¤Î¥é¥ó¥¯°Ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä¤¢¤²¤ë¡£
+		$sqlup = "UPDATE dtb_category SET rank = (rank + 1) WHERE rank >= ?";
+		$objQuery->exec($sqlup, array($rank));
+	}
+	
+	$where = "category_id = ?";
+	// ¼«Ê¬¤Î¥ì¥Ù¥ë¤ò¼èÆÀ¤¹¤ë(¿Æ¤Î¥ì¥Ù¥ë + 1)	
+	$level = $objQuery->get("dtb_category", "level", $where, array($parent_category_id)) + 1;
+	
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['parent_category_id'] = $parent_category_id;
+	$sqlval['rank'] = $rank;
+	$sqlval['level'] = $level;
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_category", $sqlval);
+	
+	$objQuery->commit();	// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Î½ªÎ»
+}
+
+// ¥«¥Æ¥´¥ê¤ÎÊÔ½¸
+function lfUpdateCat($category_id) {
+	global $objFormParam;
+	$objQuery = new SC_Query();
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$sqlval = $objFormParam->getHashArray();
+	$sqlval['update_date'] = "Now()";
+	$where = "category_id = ?";
+	$objQuery->update("dtb_category", $sqlval, $where, array($category_id));
+}
+
+// ¥«¥Æ¥´¥ê¤Î¼èÆÀ
+function lfGetCat($parent_category_id) {
+	$objQuery = new SC_Query();
+	$col = "category_id, category_name, level, rank";
+	$where = "delete = 0 AND parent_category_id = ?";
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, "dtb_category", $where, array($parent_category_id));
+	return $arrRet;
+}
+
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥«¥Æ¥´¥êÌ¾", "category_name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError($array) {
+	global $objFormParam;
+	$objErr = new SC_CheckError($array);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ³¬ÁØ¥Á¥§¥Ã¥¯
+	if(!isset($objErr->arrErr['category_name'])) {
+		$objQuery = new SC_Query();
+		$level = $objQuery->get("dtb_category", "level", "category_id = ?", array($_POST['parent_category_id']));
+		
+		if($level >= LEVEL_MAX) {
+			$objErr->arrErr['category_name'] = "¢¨ ".LEVEL_MAX."³¬ÁØ°Ê¾å¤ÎÅÐÏ¿¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br>";
+		}
+	}
+		
+	// ½ÅÊ£¥Á¥§¥Ã¥¯
+	if(!isset($objErr->arrErr['category_name'])) {
+		$objQuery = new SC_Query();
+		$where = "parent_category_id = ? AND category_name = ?";
+		$arrRet = $objQuery->select("category_id, category_name", "dtb_category", $where, array($_POST['parent_category_id'], $array['category_name']));
+		// ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËÆ±¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç
+		if ($arrRet[0]['category_id'] != $_POST['category_id'] && $arrRet[0]['category_name'] == $_POST['category_name']) {
+			$objErr->arrErr['category_name'] = "¢¨ ´û¤ËÆ±¤¸ÆâÍÆ¤ÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";
+		}
+	}
+
+	return $objErr->arrErr;
+}
+
+
+// ÊÂ¤Ó¤¬1¤Ä²¼¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+function lfGetDownRankID($objQuery, $table, $pid_name, $id_name, $id) {
+	// ¿ÆID¤ò¼èÆÀ¤¹¤ë¡£
+	$col = "$pid_name";
+	$where = "$id_name = ?";
+	$pid = $objQuery->get($table, $col, $where, $id);
+	// ¤¹¤Ù¤Æ¤Î»Ò¤ò¼èÆÀ¤¹¤ë¡£
+	$col = "$id_name";
+	$where = "delete = 0 AND $pid_name = ? ORDER BY rank DESC";
+	$arrRet = $objQuery->select($col, $table, $where, array($pid));
+	$max = count($arrRet);
+	$down_id = "";
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($arrRet[$cnt][$id_name] == $id) {
+			$down_id = $arrRet[($cnt + 1)][$id_name];
+			break;
+		}
+	}
+	return $down_id;
+}
+
+// ÊÂ¤Ó¤¬1¤Ä¾å¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+function lfGetUpRankID($objQuery, $table, $pid_name, $id_name, $id) {
+	// ¿ÆID¤ò¼èÆÀ¤¹¤ë¡£
+	$col = "$pid_name";
+	$where = "$id_name = ?";
+	$pid = $objQuery->get($table, $col, $where, $id);
+	// ¤¹¤Ù¤Æ¤Î»Ò¤ò¼èÆÀ¤¹¤ë¡£
+	$col = "$id_name";
+	$where = "delete = 0 AND $pid_name = ? ORDER BY rank DESC";
+	$arrRet = $objQuery->select($col, $table, $where, array($pid));
+	$max = count($arrRet);
+	$up_id = "";
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($arrRet[$cnt][$id_name] == $id) {
+			$up_id = $arrRet[($cnt - 1)][$id_name];
+			break;
+		}
+	}
+	return $up_id;
+}
+
+function lfCountChilds($objQuery, $table, $pid_name, $id_name, $id) {
+	// »ÒID°ìÍ÷¤ò¼èÆÀ
+	$arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);	
+	return count($arrRet);
+}
+
+function lfUpRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count) {
+	// »ÒID°ìÍ÷¤ò¼èÆÀ
+	$arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);	
+	$line = sfGetCommaList($arrRet);
+	$sql = "UPDATE $table SET rank = (rank + $count) WHERE $id_name IN ($line) ";
+	$sql.= "AND delete = 0";
+	$ret = $objQuery->exec($sql);
+	return $ret;
+}
+
+function lfDownRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count) {
+	// »ÒID°ìÍ÷¤ò¼èÆÀ
+	$arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);	
+	$line = sfGetCommaList($arrRet);
+	$sql = "UPDATE $table SET rank = (rank - $count) WHERE $id_name IN ($line) ";
+	$sql.= "AND delete = 0";
+	$ret = $objQuery->exec($sql);
+	return $ret;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/regist_review.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/regist_review.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/regist_review.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'home.tpl';
+		$this->tpl_mainpage = 'products/regist_review.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 3;
+		$this->tpl_subtitle = '¥ì¥Ó¥å¡¼´ÉÍý';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/product_select.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/product_select.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/product_select.php	(revision 1328)
@@ -0,0 +1,146 @@
+<?php
+
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/product_select.tpl';
+		$this->tpl_mainno = 'products';
+		$this->tpl_subnavi = '';
+		$this->tpl_subno = "";
+		$this->tpl_subtitle = '¾¦ÉÊÁªÂò';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+if ($_POST['mode'] == "search") {
+	
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	
+	$where = "delete = 0";
+	
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	foreach ($objPage->arrForm as $key => $val) {
+		if($val == "") {
+			continue;
+		}
+		
+		switch ($key) {
+			case 'search_name':
+				$where .= " AND name ILIKE ?";
+				$arrval[] = "%$val%";
+				break;
+			case 'search_category_id':
+				// »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
+				$arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val);
+				$tmp_where = "";
+				foreach ($arrRet as $val) {
+					if($tmp_where == "") {
+						$tmp_where.= " AND ( category_id = ?";
+					} else {
+						$tmp_where.= " OR category_id = ?";
+					}
+					$arrval[] = $val;
+				}
+				$where.= $tmp_where . " )";
+				break;
+			case 'search_product_code':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+				$where .= " OR product_code ILIKE ?";
+				$arrval[] = "%$val%";
+				$arrval[] = "%$val%";
+				break;
+			default:
+				break;
+		}
+	}
+	
+	$order = "update_date DESC";
+	
+	// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+	$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+	$from = "vw_products_nonclass";
+		
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	if(is_numeric($_POST['search_page_max'])) {	
+		$page_max = $_POST['search_page_max'];
+	} else {
+		$page_max = SEARCH_PMAX;
+	}
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+		
+}
+
+// ¥«¥Æ¥´¥ê¼èÆÀ
+$objPage->arrCatList = sfGetCategoryList();
+
+
+
+
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+
+
+
+
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam() {
+	global $objPage;
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	$arrConvList['search_name'] = "KVa";
+	$arrConvList['search_product_code'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/product.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/product.php	(revision 3360)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/product.php	(revision 3360)
@@ -0,0 +1,465 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrCatList;
+	var $arrSRANK;
+	var $arrForm;
+	var $arrSubList;
+	var $arrHidden;
+	var $arrTempImage;
+	var $arrSaveImage;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_mainpage = 'products/product.tpl';
+		$this->tpl_subnavi = 'products/subnavi.tpl';
+		$this->tpl_mainno = 'products';		
+		$this->tpl_subno = 'product';
+		$this->tpl_subtitle = '¾¦ÉÊÅÐÏ¿';
+		global $arrSRANK;
+		$this->arrSRANK = $arrSRANK;
+		global $arrDISP;
+		$this->arrDISP = $arrDISP;
+		global $arrCLASS;
+		$this->arrCLASS = $arrCLASS;
+		global $arrSTATUS;
+		$this->arrSTATUS = $arrSTATUS;
+		global $arrSTATUS_VALUE;
+		$this->arrSTATUS_VALUE = $arrSTATUS_VALUE;
+		global $arrSTATUS_IMAGE;
+		$this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;
+		global $arrDELIVERYDATE;
+		$this->arrDELIVERYDATE = $arrDELIVERYDATE;
+		$this->tpl_nonclass = true;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSiteInfo = new SC_SiteInfo();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// Hidden¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+$objUpFile->setHiddenFileList($_POST);
+
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;	
+	}
+}
+
+// FORM¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+$objPage->arrForm = $_POST;
+
+switch($_POST['mode']) {
+// ¸¡º÷²èÌÌ¤«¤é¤ÎÊÔ½¸
+case 'pre_edit':
+	// ÊÔ½¸»þ
+	if(sfIsInt($_POST['product_id'])){
+		// DB¤«¤é¾¦ÉÊ¾ðÊó¤ÎÆÉ¹þ
+		$objPage->arrForm = lfGetProduct($_POST['product_id']);
+		// ¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹¤ÎÊÑ´¹
+		$arrRet = sfSplitCBValue($objPage->arrForm['product_flag'], "product_flag");
+		$objPage->arrForm = array_merge($objPage->arrForm, $arrRet);
+		// DB¤«¤é¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß
+		$objPage->arrRecommend = lfPreGetRecommendProducts($_POST['product_id']);
+		// DB¥Ç¡¼¥¿¤«¤é²èÁü¥Õ¥¡¥¤¥ëÌ¾¤ÎÆÉ¹þ
+		$objUpFile->setDBFileList($objPage->arrForm);
+		// µ¬³ÊÅÐÏ¿¤¢¤ê¤Ê¤·È½Äê
+		$objPage->tpl_nonclass = lfCheckNonClass($_POST['product_id']);
+		lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	}
+	break;
+		
+// ¾¦ÉÊÅÐÏ¿¡¦ÊÔ½¸
+case 'edit':
+	// µ¬³ÊÅÐÏ¿¤¢¤ê¤Ê¤·È½Äê
+	$objPage->tpl_nonclass = lfCheckNonClass($_POST['product_id']);
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm);
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	// ¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+	$objPage->arrErr = array_merge((array)$objPage->arrErr, (array)$objUpFile->checkEXISTS());
+	// ¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç
+	if(count($objPage->arrErr) == 0) {
+		lfProductConfirmPage(); // ³ÎÇ§¥Ú¡¼¥¸
+	} else {
+		lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	}
+	break;
+// ³ÎÇ§¥Ú¡¼¥¸¤«¤é´°Î»¥Ú¡¼¥¸¤Ø
+case 'complete':
+	$objPage->tpl_mainpage = 'products/complete.tpl';
+	
+	$objPage->tpl_product_id = lfRegistProduct($_POST);		// ¥Ç¡¼¥¿ÅÐÏ¿
+	
+	$objQuery = new SC_Query();
+	// ·ï¿ô¥«¥¦¥ó¥È¥Ð¥Ã¥Á¼Â¹Ô
+	sfCategory_Count($objQuery);
+	// °ì»þ¥Õ¥¡¥¤¥ë¤òËÜÈÖ¥Ç¥£¥ì¥¯¥È¥ê¤Ë°ÜÆ°¤¹¤ë
+	$objUpFile->moveTempFile();
+
+	break;
+// ²èÁü¤Î¥¢¥Ã¥×¥í¡¼¥É
+case 'upload_image':
+	// ¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+	$objPage->arrErr = array_merge((array)$objPage->arrErr, (array)$objUpFile->checkEXISTS($_POST['image_key']));
+	// ²èÁüÊÝÂ¸½èÍý
+	$objPage->arrErr[$_POST['image_key']] = $objUpFile->makeTempFile($_POST['image_key']);
+	lfProductPage(); // ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// ²èÁü¤Îºï½ü
+case 'delete_image':
+	$objUpFile->deleteFile($_POST['image_key']);
+	lfProductPage(); // ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// ³ÎÇ§¥Ú¡¼¥¸¤«¤é¤ÎÌá¤ê
+case 'confirm_return':
+	// µ¬³ÊÅÐÏ¿¤¢¤ê¤Ê¤·È½Äê
+	$objPage->tpl_nonclass = lfCheckNonClass($_POST['product_id']);
+	lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+// ¤ª¤¹¤¹¤á¾¦ÉÊÁªÂò
+case 'recommend_select' :
+	lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+default:
+	// ¸ø³«¡¦Èó¸ø³«¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ
+	$objPage->arrForm['status'] = DEFAULT_PRODUCT_DISP;
+	lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	break;
+}
+
+if($_POST['mode'] != 'pre_edit') {
+	// ¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß
+	$objPage->arrRecommend = lfGetRecommendProducts();
+}
+
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objPage->arrInfo = $objSiteInfo->data;
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------
+
+/* ¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß */
+function lfGetRecommendProducts() {
+	global $objPage;
+	$objQuery = new SC_Query();
+	
+	for($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
+		$keyname = "recommend_id" . $i;
+		$delkey = "recommend_delete" . $i;
+		$commentkey = "recommend_comment" . $i;
+
+		if($_POST[$keyname] != "" && $_POST[$delkey] != 1) {
+			$arrRet = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass", "product_id = ?", array($_POST[$keyname])); 
+			$arrRecommend[$i] = $arrRet[0];
+			$arrRecommend[$i]['product_id'] = $_POST[$keyname];
+			$arrRecommend[$i]['comment'] = $objPage->arrForm[$commentkey];
+		}
+	}
+	return $arrRecommend;
+}
+
+/* ¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÅÐÏ¿ */
+function lfInsertRecommendProducts($objQuery, $arrList, $product_id) {
+	// °ìÃ¶¥ª¥¹¥¹¥á¾¦ÉÊ¤ò¤¹¤Ù¤Æºï½ü¤¹¤ë
+	$objQuery->delete("dtb_recommend_products", "product_id = ?", array($product_id));
+	$sqlval['product_id'] = $product_id;
+	$rank = RECOMMEND_PRODUCT_MAX;
+	for($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
+		$keyname = "recommend_id" . $i;
+		$commentkey = "recommend_comment" . $i;
+		$deletekey = "recommend_delete" . $i;
+		if($arrList[$keyname] != "" && $arrList[$deletekey] != '1') {
+			$sqlval['recommend_product_id'] = $arrList[$keyname];
+			$sqlval['comment'] = $arrList[$commentkey];
+			$sqlval['rank'] = $rank;
+			$sqlval['creator_id'] = $_SESSION['member_id'];
+			$objQuery->insert("dtb_recommend_products", $sqlval);
+			$rank--;
+		}
+	}
+}
+
+/* ÅÐÏ¿ºÑ¤ß¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß */
+function lfPreGetRecommendProducts($product_id) {
+	$objQuery = new SC_Query();
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
+	$max = count($arrRet);
+	$no = 1;
+	
+	for($i = 0; $i < $max; $i++) {
+		$arrProductInfo = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass", "product_id = ?", array($arrRet[$i]['recommend_product_id'])); 
+		$arrRecommend[$no] = $arrProductInfo[0];
+		$arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
+		$arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
+		$no++;
+	}
+	return $arrRecommend;
+}
+
+/* ¾¦ÉÊ¾ðÊó¤ÎÆÉ¤ß¹þ¤ß */
+function lfGetProduct($product_id) {
+	$objQuery = new SC_Query();
+	$col = "*";
+	$table = "vw_products_nonclass";
+	$where = "product_id = ?";
+	$arrRet = $objQuery->select($col, $table, $where, array($product_id));
+		
+	return $arrRet[0];
+}
+
+/* ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸É½¼¨ÍÑ */
+function lfProductPage() {
+	global $objPage;
+	global $objUpFile;
+	
+	// ¥«¥Æ¥´¥ê¤ÎÆÉ¹þ
+	list($objPage->arrCatVal, $objPage->arrCatOut) = sfGetLevelCatList(false);
+
+	if($objPage->arrForm['status'] == "") {
+		$objPage->arrForm['status'] = 1;
+	}
+	
+	if(!is_array($objPage->arrForm['product_flag'])) {
+		// ¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹¤ÎÊ¬³äÆÉ¹þ
+		$objPage->arrForm['product_flag'] = sfSplitCheckBoxes($objPage->arrForm['product_flag']);
+	}
+	
+	// HIDDENÍÑ¤ËÇÛÎó¤òÅÏ¤¹¡£
+	$objPage->arrHidden = array_merge((array)$objPage->arrHidden, (array)$objUpFile->getHiddenFileList());
+	// FormÍÑÇÛÎó¤òÅÏ¤¹¡£
+	$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+	
+	$objPage->tpl_onload = "fnCheckSaleLimit('" . DISABLED_RGB . "'); fnCheckStockLimit('" . DISABLED_RGB . "');";
+}
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("°ìÍ÷-¥á¥¤¥ó²èÁü", 'main_list_image', array('jpg', 'gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó²èÁü", 'main_image', array('jpg', 'gif'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
+	$objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó³ÈÂç²èÁü", 'main_large_image', array('jpg', 'gif'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT);
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö²èÁü$cnt", "sub_image$cnt", array('jpg', 'gif'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);	
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü$cnt", "sub_large_image$cnt", array('jpg', 'gif'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT);
+	}
+	$objUpFile->addFile("¾¦ÉÊÈæ³Ó²èÁü", 'file1', array('jpg', 'gif'), IMAGE_SIZE, false, OTHER_IMAGE1_HEIGHT, OTHER_IMAGE1_HEIGHT);
+	$objUpFile->addFile("¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ë", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false);
+}
+
+/* ¾¦ÉÊ¤ÎÅÐÏ¿ */
+function lfRegistProduct($arrList) {
+	global $objUpFile;
+	global $arrSTATUS;
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['name'] = $arrList['name'];
+	$sqlval['category_id'] = $arrList['category_id'];
+	$sqlval['status'] = $arrList['status'];
+	$sqlval['product_flag'] = $arrList['product_flag'];
+	$sqlval['main_list_comment'] = $arrList['main_list_comment'];
+	$sqlval['main_comment'] = $arrList['main_comment'];
+	$sqlval['point_rate'] = $arrList['point_rate'];
+	
+	$sqlval['deliv_fee'] = $arrList['deliv_fee'];
+	$sqlval['comment1'] = $arrList['comment1'];
+	$sqlval['comment2'] = $arrList['comment2'];
+	$sqlval['comment3'] = $arrList['comment3'];
+	$sqlval['comment4'] = $arrList['comment4'];
+	$sqlval['comment5'] = $arrList['comment5'];
+	$sqlval['comment6'] = $arrList['comment6'];
+	$sqlval['main_list_comment'] = $arrList['main_list_comment'];
+	$sqlval['sale_limit'] = $arrList['sale_limit'];
+	$sqlval['sale_unlimited'] = $arrList['sale_unlimited'];
+	$sqlval['deliv_date_id'] = $arrList['deliv_date_id'];
+	$sqlval['update_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$arrRet = $objUpFile->getDBFileList();
+	$sqlval = array_merge($sqlval, $arrRet);
+		
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$sqlval['sub_title'.$cnt] = $arrList['sub_title'.$cnt];
+		$sqlval['sub_comment'.$cnt] = $arrList['sub_comment'.$cnt];
+	}
+
+	if($arrList['product_id'] == "") {
+		$product_id = $objQuery->nextval("dtb_products", "product_id");
+		$sqlval['product_id'] = $product_id;
+		// ¥«¥Æ¥´¥êÆâ¤ÇºÇÂç¤Î¥é¥ó¥¯¤ò³ä¤êÅö¤Æ¤ë
+		$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "category_id = ?", array($arrList['category_id'])) + 1;
+		// INSERT¤Î¼Â¹Ô
+		$objQuery->insert("dtb_products", $sqlval);
+	} else {
+		$product_id = $arrList['product_id'];
+		// ºï½üÍ×µá¤Î¤¢¤Ã¤¿´ûÂ¸¥Õ¥¡¥¤¥ë¤Îºï½ü
+		$arrRet = lfGetProduct($arrList['product_id']);
+		$objUpFile->deleteDBFile($arrRet);
+		
+		// ¥«¥Æ¥´¥êÆâ¥é¥ó¥¯¤ÎÄ´À°½èÍý
+		$old_catid = $objQuery->get("dtb_products", "category_id", "product_id = ?", array($arrList['product_id']));
+		sfMoveCatRank($objQuery, "dtb_products", "product_id", "category_id", $old_catid, $arrList['category_id'], $arrList['product_id']);
+		
+		// UPDATE¤Î¼Â¹Ô
+		$where = "product_id = ?";
+		$objQuery->update("dtb_products", $sqlval, $where, array($arrList['product_id']));
+	}
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrList, $product_id);
+	
+	// ¤ª¤¹¤¹¤á¾¦ÉÊÅÐÏ¿
+	lfInsertRecommendProducts($objQuery, $arrList, $product_id);
+	
+	$objQuery->commit();
+	return $product_id;
+}
+
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	// ¿ÍÊª´ðËÜ¾ðÊó
+	
+	// ¥¹¥Ý¥Ã¥È¾¦ÉÊ
+	$arrConvList['name'] = "KVa";
+	$arrConvList['main_list_comment'] = "KVa";
+	$arrConvList['main_comment'] = "KVa";
+	$arrConvList['price01'] = "n";
+	$arrConvList['price02'] = "n";
+	$arrConvList['stock'] = "n";
+	$arrConvList['sale_limit'] = "n";
+	$arrConvList['point_rate'] = "n";
+	$arrConvList['product_code'] = "KVna";
+	$arrConvList['comment1'] = "a";
+	//¥Û¥Í¥±¡¼¥­:Á÷ÎÁ¤Î»ØÄê¤Ê¤·
+	$arrConvList['deliv_fee'] = "n";
+	
+	// ¾ÜºÙ-¥µ¥Ö
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$arrConvList["sub_title$cnt"] = "KVa";
+	}
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$arrConvList["sub_comment$cnt"] = "KVa";
+	}
+	
+	// ¤ª¤¹¤¹¤á¾¦ÉÊ
+	for ($cnt = 1; $cnt <= RECOMMEND_PRODUCT_MAX; $cnt++) {
+		$arrConvList["recommend_comment$cnt"] = "KVa";
+	}
+
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	
+	global $arrSTATUS;
+	$array['product_flag'] = sfMergeCheckBoxes($array['product_flag'], count($arrSTATUS));
+	
+	return $array;
+}
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+	global $objPage;
+	global $arrAllowedTag;
+	
+	$objErr = new SC_CheckError($array);
+	$objErr->doFunc(array("¾¦ÉÊÌ¾", "name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¾¦ÉÊ¥«¥Æ¥´¥ê", "category_id", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("°ìÍ÷-¥á¥¤¥ó¥³¥á¥ó¥È", "main_list_comment", MTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¾ÜºÙ-¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", LLTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¾ÜºÙ-¥á¥¤¥ó¥³¥á¥ó¥È", "main_comment", $arrAllowedTag), array("HTML_TAG_CHECK"));
+	$objErr->doFunc(array("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate", PERCENTAGE_LEN), array("EXIST_CHECK", "NUM_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¾¦ÉÊÁ÷ÎÁ", "deliv_fee", PRICE_LEN), array("NUM_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸¡º÷¥ï¡¼¥É", "comment3", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥«¡¼URL", "comment1", URL_LEN), array("SPTAB_CHECK", "URL_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("È¯Á÷ÆüÌÜ°Â", "deliv_date_id", INT_LEN), array("NUM_CHECK"));
+	
+	if($objPage->tpl_nonclass) {
+		$objErr->doFunc(array("¾¦ÉÊ¥³¡¼¥É", "product_code", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK","MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("ÄÌ¾ï²Á³Ê", "price01", PRICE_LEN), array("ZERO_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¾¦ÉÊ²Á³Ê", "price02", PRICE_LEN), array("EXIST_CHECK", "NUM_CHECK", "ZERO_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+			
+		if($array['stock_unlimited'] != "1") {
+			$objErr->doFunc(array("ºß¸Ë¿ô", "stock", AMOUNT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+		}
+	}
+	
+	if($array['sale_unlimited'] != "1") {	
+		$objErr->doFunc(array("¹ØÆþÀ©¸Â", "sale_limit", AMOUNT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
+	}
+	
+	if(isset($objErr->arrErr['category_id'])) {
+		// ¼«Æ°ÁªÂò¤òËÉ¤°¤¿¤á¤Ë¥À¥ß¡¼Ê¸»ú¤òÆþ¤ì¤Æ¤ª¤¯
+		$objPage->arrForm['category_id'] = "#";
+	}
+	
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$objErr->doFunc(array("¾ÜºÙ-¥µ¥Ö¥¿¥¤¥È¥ë$cnt", "sub_title$cnt", STEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È$cnt", "sub_comment$cnt", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("¾ÜºÙ-¥µ¥Ö¥³¥á¥ó¥È$cnt", "sub_comment$cnt", $arrAllowedTag),  array("HTML_TAG_CHECK"));	
+	}
+	
+	for ($cnt = 1; $cnt <= RECOMMEND_PRODUCT_MAX; $cnt++) {
+		if($_POST["recommend_id$cnt"] != "" && $_POST["recommend_delete$cnt"] != 1) {
+			$objErr->doFunc(array("¤ª¤¹¤¹¤á¾¦ÉÊ¥³¥á¥ó¥È$cnt", "recommend_comment$cnt", LTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+		}
+	}
+	
+	return $objErr->arrErr;
+}
+
+/* ³ÎÇ§¥Ú¡¼¥¸É½¼¨ÍÑ */
+function lfProductConfirmPage() {
+	global $objPage;
+	global $objUpFile;
+	$objPage->tpl_mainpage = 'products/confirm.tpl';
+	$objPage->arrForm['mode'] = 'complete';
+	// ¥«¥Æ¥´¥ê¤ÎÆÉ¹þ
+	$objPage->arrCatList = sfGetCategoryList();
+	// FormÍÑÇÛÎó¤òÅÏ¤¹¡£
+	$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+}
+
+/* µ¬³Ê¤¢¤êÈ½ÄêÍÑ(µ¬³Ê¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç:TRUE) */
+function lfCheckNonClass($product_id) {
+	if(sfIsInt($product_id)) {
+		$objQuery  = new SC_Query();
+		$where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0";
+		$count = $objQuery->count("dtb_products_class", $where, array($product_id));
+		if($count > 0) {
+			return false;
+		}
+	}
+	return true;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/products/index_csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/products/index_csv.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/products/index_csv.php	(revision 1328)
@@ -0,0 +1,136 @@
+<?php
+require_once(ROOT_DIR."data/include/csv_output.inc");
+$arrREVIEW_CVSCOL = array( 
+						'B.name',
+						'A.status',
+						'A.create_date',
+						'A.reviewer_name',
+						'A.sex',
+						'A.recommend_level',
+						'A.title',
+						'A.comment'
+						);
+						
+$arrREVIEW_CVSTITLE = array(
+						'¾¦ÉÊÌ¾',
+						'¥ì¥Ó¥å¡¼É½¼¨',
+						'Åê¹ÆÆü',
+						'Åê¹Æ¼ÔÌ¾',
+						'À­ÊÌ',
+						'¤ª¤¹¤¹¤á¥ì¥Ù¥ë',
+						'¥¿¥¤¥È¥ë',
+						'¥³¥á¥ó¥È'
+						);
+
+// CSV½ÐÎÏ¥Ç¡¼¥¿¤òºîÀ®¤¹¤ë¡£(¾¦ÉÊ)
+function lfGetProductsCSV($where, $option, $arrval, $arrOutputCols) {
+	global $arrPRODUCTS_CVSCOL;
+
+	$from = "vw_product_class";
+	$cols = sfGetCommaList($arrOutputCols);
+	
+	$objQuery = new SC_Query();
+	$objQuery->setoption($option);
+	
+	$list_data = $objQuery->select($cols, $from, $where, $arrval);
+	$max = count($list_data);
+	
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+	
+	for($i = 0; $i < $max; $i++) {
+		// ´ØÏ¢¾¦ÉÊ¾ðÊó¤ÎÉÕÍ¿
+		$list_data[$i]['classcategory_id1'] = $arrClassCatName[$list_data[$i]['classcategory_id1']];
+		$list_data[$i]['classcategory_id2'] = $arrClassCatName[$list_data[$i]['classcategory_id2']];
+		
+		// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+		$data .= lfMakeProductsCSV($list_data[$i]);	
+	}
+	return $data;
+}
+
+// CSV½ÐÎÏ¥Ç¡¼¥¿¤òºîÀ®¤¹¤ë¡£(¥ì¥Ó¥å¡¼)
+function lfGetReviewCSV($where, $option, $arrval) {
+	global $arrREVIEW_CVSCOL;
+
+	$from = "dtb_review AS A INNER JOIN dtb_products AS B on A.product_id = B.product_id ";
+	$cols = sfGetCommaList($arrREVIEW_CVSCOL);
+	
+	$objQuery = new SC_Query();
+	$objQuery->setoption($option);
+	
+	$list_data = $objQuery->select($cols, $from, $where, $arrval);	
+
+	$max = count($list_data);
+	for($i = 0; $i < $max; $i++) {
+		// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+		$data .= lfMakeReviewCSV($list_data[$i]);
+	}
+	return $data;
+}
+
+// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£(¾¦ÉÊ)
+function lfMakeProductsCSV($list) {
+	global $arrDISP;
+	$line = "";
+	if(is_array($list)) {
+		foreach($list as $key => $val) {
+			$tmp = "";
+			switch($key) {
+			case 'point_rate':
+				if($val == "") {
+					$tmp = '0';
+				} else {
+					$tmp = $val;
+				}
+				break;
+			default:
+				$tmp = $val;
+				break;
+			}
+	
+			$tmp = ereg_replace("[\",]", " ", $tmp);
+			$line .= "\"".$tmp."\",";
+		}
+		// Ê¸Ëö¤Î","¤òÊÑ´¹
+		$line = ereg_replace(",$", "\n", $line);
+	}
+	return $line;
+}
+
+
+// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£(¥ì¥Ó¥å¡¼)
+function lfMakeReviewCSV($list) {
+	global $arrSex;
+	global $arrRECOMMEND;
+	global $arrDISP;
+	
+	$line = "";
+	
+	foreach($list as $key => $val) {
+		$tmp = "";
+		switch($key) {
+		case 'sex':
+			$tmp = $arrSex[$val];
+			break;
+		case 'recommend_level':
+			$tmp = $arrRECOMMEND[$val];
+			break;
+		case 'status':
+			$tmp = $arrDISP[$val];
+			break;
+		default:
+			$tmp = $val;
+			break;
+		}
+
+		$tmp = ereg_replace("[\",]", " ", $tmp);
+		$line .= "\"".$tmp."\",";
+	}
+	// Ê¸Ëö¤Î","¤òÊÑ´¹
+	$line = ereg_replace(",$", "\n", $line);
+	return $line;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/login_error.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/login_error.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/login_error.php	(revision 1328)
@@ -0,0 +1,57 @@
+¡¡
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="./css/contents.css" type="text/css" />
+<script type="text/javascript" src="./js/css.js"></script>
+<title>EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸</title>
+</head>
+
+<body bgcolor="#f3f3f3" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="preLoadImg()">
+<noscript>
+<link rel="stylesheet" href="./css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<!--¢§HEADER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#bfbf9f" height="3"></td></tr>
+	<tr>
+		<td bgcolor="#dedecd" height="40"><img src="./misc/logo.gif" width="365" height="16" alt="EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸" /></td>
+	</tr>
+	<tr><td height="1" bgcolor="#ffffff"></td></tr>
+</table>
+<!--¢¥HEADER-->
+
+<!--¢§CONTENTS-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td height="400" bgcolor="#ffffff" align="center">
+		<form id="form1" method="post" action="">
+		<table width="400" bgcolor="#cccccc" cellspacing="1" cellpadding="10">
+			<tr>
+				
+			  <td height="200" align="center" class="fs12n" bgcolor="#ffffff"> 
+				<span class="red">¥Ñ¥¹¥ï¡¼¥É¤¬°ã¤¤¤Þ¤¹</span><br />¡¡<br />
+				<input name="subm" id="subm" type="button" onclick="location.href='./index.html'" value="Ìá¤ë" />
+				</td>
+			</tr>
+		</table>
+		</form>
+		</td>
+	</tr>
+</table>
+<!--¢¥CONTENTS-->
+
+<!--¢§FOOTER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#e5e5df" height="5"></td></tr>
+</table>
+<!--¢¥FOOTER-->
+</div>
+</body>
+</html>
Index: /temp/tags/eccube-0_9_2beta/html/admin/sales/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/sales/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/sales/index.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'sales/index.tpl';
+		$this->tpl_mainno = 'sales';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;	
+	}
+}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/design/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/design/index.php	(revision 4145)
+++ /temp/tags/eccube-0_9_2beta/html/admin/design/index.php	(revision 4145)
@@ -0,0 +1,406 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/index.tpl';
+		$this->tpl_subnavi = 'design/subnavi.tpl';
+		$this->tpl_subno = "layout";		
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥ì¥¤¥¢¥¦¥ÈÊÔ½¸';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// ¥Ú¡¼¥¸ID¤ò¼èÆÀ
+if (isset($_GET['page_id'])) {
+	$page_id = $_GET['page_id'];
+}else if ($_POST['page_id']){
+	$page_id = $_POST['page_id'];
+}else{
+	$page_id = 1;
+}
+
+// ÊÔ½¸²ÄÇ½¥Ú¡¼¥¸¤ò¼èÆÀ
+$objPage->arrEditPage = lfgetPageData();
+
+// ¥Ö¥í¥Ã¥¯ÇÛÃÖÍÑ¥Ç¡¼¥¿¤ò¼èÆÀ
+$sel   = ", pos.target_id, pos.bloc_id, pos.bloc_row ";
+$from  = ", dtb_blocposition AS pos";
+$where = " where ";
+$where .= " lay.page_id = ? AND ";
+$where .= "lay.page_id = pos.page_id AND exists (select bloc_id from dtb_bloc as blc where pos.bloc_id = blc.bloc_id) ORDER BY lay.page_id,pos.target_id, pos.bloc_row, pos.bloc_id ";
+$arrData = array($page_id);
+$arrBlocPos = lfgetLayoutData($sel, $from, $where, $arrData );
+
+// ¥Ç¡¼¥¿¤ÎÂ¸ºß¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+$arrPageData = lfgetPageData("page_id = ?", array($page_id));
+if (count($arrPageData) <= 0) {
+	$exists_page = 0;
+}else{
+	$exists_page = 1;
+}
+$objPage->exists_page = $exists_page;
+
+// ¥á¥Ã¥»¡¼¥¸É½¼¨
+if ($_GET['msg'] == "on") {
+	$objPage->complate_msg="alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+}
+
+// ¥Ö¥í¥Ã¥¯¤ò¼èÆÀ
+$arrBloc = lfgetBlocData();
+
+// ¿·µ¬¥Ö¥í¥Ã¥¯ºîÀ®
+if ($_POST['mode'] == 'new_bloc') {
+	header("location: ./bloc.php");
+}
+
+// ¿·µ¬¥Ú¡¼¥¸ºîÀ®
+if ($_POST['mode'] == 'new_page') {
+	header("location: ./main_edit.php");
+}
+
+// ¥Ç¡¼¥¿ÅÐÏ¿½èÍý
+if ($_POST['mode'] == 'confirm' or $_POST['mode'] == 'preview') {
+	
+	$arrPageData = array();
+	if ($_POST['mode'] == 'preview') {
+		$arrPageData = lfgetPageData(" page_id = ? " , array($page_id));
+		$page_id = 0;
+		$_POST['page_id'] = 0;
+	}
+	
+	// ¹¹¿·ÍÑ¤Ë¥Ç¡¼¥¿¤òÀ°¤¨¤ë
+	$arrUpdBlocData = array();
+	$arrTargetFlip = array_flip($arrTarget);
+	
+	$upd_cnt = 1;
+	$arrUpdData[$upd_cnt]['page_id'] = $_POST['page_id'];
+	
+	// POST¤Î¥Ç¡¼¥¿¤ò»È¤¤¤ä¤¹¤¤¤è¤¦¤Ë½¤Àµ
+	for($upd_cnt = 1; $upd_cnt <= $_POST['bloc_cnt']; $upd_cnt++){
+		if (!isset($_POST['id_'.$upd_cnt])) {
+			break;
+		}
+		$arrUpdBlocData[$upd_cnt]['name'] 		= $_POST['name_'.$upd_cnt];							// ¥Ö¥í¥Ã¥¯Ì¾¾Î
+		$arrUpdBlocData[$upd_cnt]['id']	  		= $_POST['id_'.$upd_cnt];							// ¥Ö¥í¥Ã¥¯ID 
+		$arrUpdBlocData[$upd_cnt]['target_id'] 	= $arrTargetFlip[$_POST['target_id_'.$upd_cnt]];	// ¥¿¡¼¥²¥Ã¥ÈID
+		$arrUpdBlocData[$upd_cnt]['top'] 		= $_POST['top_'.$upd_cnt];							// TOPºÂÉ¸
+		$arrUpdBlocData[$upd_cnt]['update_url']	= $_SERVER['HTTP_REFERER'];							// ¹¹¿·URL
+	}
+
+	// ¥Ç¡¼¥¿¤Î¹¹¿·¤ò¹Ô¤¦
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	// delete¼Â¹Ô
+	$del_sql = "";
+	$del_sql .= "DELETE FROM dtb_blocposition WHERE page_id = ? ";
+	$arrRet = $objDBConn->query($del_sql,array($page_id));
+	
+	// ¥Ö¥í¥Ã¥¯¤Î½ç½ø¤ò¼èÆÀ¤·¡¢¹¹¿·¤ò¹Ô¤¦
+	foreach($arrUpdBlocData as $key => $val){
+		// ¥Ö¥í¥Ã¥¯¤Î½ç½ø¤ò¼èÆÀ
+		$bloc_row = lfGetRowID($arrUpdBlocData, $val);
+		$arrUpdBlocData[$key]['bloc_row'] = $bloc_row;
+		$arrUpdBlocData[$key]['page_id'] 	= $_POST['page_id'];	// ¥Ú¡¼¥¸ID
+		
+		if ($arrUpdBlocData[$key]['target_id'] == 5) {
+			$arrUpdBlocData[$key]['bloc_row'] = "0";
+		}
+		
+		// insertÊ¸À¸À®
+		$ins_sql = "";
+		$ins_sql .= "INSERT INTO dtb_blocposition ";
+		$ins_sql .= " values ( ";
+		$ins_sql .= "	?  ";			// ¥Ú¡¼¥¸ID
+		$ins_sql .= "	,? ";			// ¥¿¡¼¥²¥Ã¥ÈID
+		$ins_sql .= "	,? ";			// ¥Ö¥í¥Ã¥¯ID
+		$ins_sql .= "	,? ";			// ¥Ö¥í¥Ã¥¯¤ÎÊÂ¤Ó½ç½ø
+		$ins_sql .= "	,(SELECT filename FROM dtb_bloc WHERE bloc_id = ?) ";			// ¥Õ¥¡¥¤¥ëÌ¾¾Î
+		$ins_sql .= "	)  ";
+
+		// insert¥Ç¡¼¥¿À¸À®
+		$arrInsData = array($page_id,
+							 $arrUpdBlocData[$key]['target_id'],
+							 $arrUpdBlocData[$key]['id'],
+							 $arrUpdBlocData[$key]['bloc_row'],
+							 $arrUpdBlocData[$key]['id']
+							);
+		// SQL¼Â¹Ô
+		$arrRet = $objDBConn->query($ins_sql,$arrInsData);
+	}
+
+	// ¥×¥ì¥Ó¥å¡¼½èÍý
+	if ($_POST['mode'] == 'preview') {
+		
+		if ($page_id == "") {
+			header("location: ./index.php");
+		}
+		lfSetPreData($arrPageData);
+		
+		$_SESSION['preview'] = "ON";
+		header("location: /preview/index.php");
+	}else{
+		header("location: ./index.php?page_id=$page_id&msg=on");
+	}
+}
+
+// ¥Ç¡¼¥¿ºï½ü½èÍý ¥Ù¡¼¥¹¥Ç¡¼¥¿¤Ç¤Ê¤±¤ì¤Ð¥Õ¥¡¥¤¥ë¤òºï½ü
+if ($_POST['mode'] == 'delete' and 	!lfCheckBaseData($page_id)) {
+	lfDelPageData($page_id);
+}
+
+// ¥Ö¥í¥Ã¥¯¾ðÊó¤ò²èÌÌÇÛÃÖÍÑ¤ËÊÔ½¸
+$tpl_arrBloc = array();
+$cnt = 0;
+// »ÈÍÑ¤µ¤ì¤Æ¤¤¤ë¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤òÀ¸À®
+foreach($arrBlocPos as $key => $val){
+	if ($val['page_id'] == $page_id) {
+		$tpl_arrBloc = lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt);
+		$cnt++;
+	}
+}
+
+// Ì¤»ÈÍÑ¤Î¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤òÄÉ²Ã
+foreach($arrBloc as $key => $val){
+	if (!lfChkBloc($val, $tpl_arrBloc)) {
+		$val['target_id'] = 5;	// Ì¤»ÈÍÑ¤ËÄÉ²Ã¤¹¤ë
+		$tpl_arrBloc = lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt);
+		$cnt++;
+	}
+}
+
+$objPage->tpl_arrBloc = $tpl_arrBloc;
+$objPage->bloc_cnt = count($tpl_arrBloc);
+$objPage->page_id = $page_id;
+
+// ¥Ú¡¼¥¸Ì¾¾Î¤ò¼èÆÀ
+$arrPageData = lfgetPageData(' page_id = ?', array($page_id));
+$objPage->arrPageData = $arrPageData[0];
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+global $GLOBAL_ERR;
+$errCnt = 0;
+if ($GLOBAL_ERR != "") {
+	$arrGlobalErr = explode("\n",$GLOBAL_ERR);
+	$errCnt = count($arrGlobalErr) - 8;
+	if ($errCnt < 0 ) {
+		$errCnt = 0;
+	}
+}
+$objPage->errCnt = $errCnt;
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetLayoutData
+ * ½èÍýÆâÍÆ	¡§ÊÔ½¸²ÄÇ½¤Ê¥Ú¡¼¥¸¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$sel    ¥¥¥ Select¶çÊ¸
+ * °ú¿ô2	¡§$where  ¥¥¥ Where¶çÊ¸
+ * °ú¿ô3	¡§$arrVal ¥¥¥ Where¶ç¤Î¹Ê¹þ¾ò·ïÃÍ
+ * Ìá¤êÃÍ	¡§¥Ú¡¼¥¸¥ì¥¤¥¢¥¦¥È¾ðÊó
+ **************************************************************************************************************/
+function lfgetLayoutData($sel = '' , $from = '', $where = '', $arrVal = ''){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	// SQLÀ¸À®
+
+	$sql = "";
+	$sql .= " select "; 
+	$sql .= "     lay.page_id ";
+	$sql .= "     ,lay.page_name ";
+	$sql .= "     ,lay.url ";
+	$sql .= "     ,lay.author ";
+	$sql .= "     ,lay.description ";
+	$sql .= "     ,lay.keyword ";
+	$sql .= "     ,lay.update_url ";
+	$sql .= "     ,lay.create_date ";
+	$sql .= "     ,lay.update_date ";
+	
+	// Select¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($sel != '') {
+		$sql .= $sel;
+	}
+	
+	$sql .= " from dtb_pagelayout AS lay ";
+	// From¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($from != '') {
+		$sql .= $from;
+	}
+
+	// where¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($where != '') {
+		$sql .= $where;
+	}else{
+		$sql .= " ORDER BY lay.page_id ";
+	}
+	
+	$arrRet = $objDBConn->getAll($sql, $arrVal);
+	
+	return $arrRet;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetBlocData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$where  ¥¥¥ Where¶çÊ¸
+ * °ú¿ô2	¡§$arrVal ¥¥¥ Where¶ç¤Î¹Ê¹þ¾ò·ïÃÍ
+ * Ìá¤êÃÍ	¡§¥Ö¥í¥Ã¥¯¾ðÊó
+ **************************************************************************************************************/
+function lfgetBlocData($where = '', $arrVal = ''){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	// SQLÀ¸À®
+	$sql = "";
+	$sql .= " SELECT ";
+	$sql .= "	bloc_id";
+	$sql .= "	,bloc_name";
+	$sql .= "	,tpl_path";
+	$sql .= "	,filename";
+	$sql .= " 	,update_date";
+	$sql .= " FROM ";
+	$sql .= " 	dtb_bloc";
+
+	// where¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($where != '') {
+		$sql .= " WHERE " . $where;
+	}
+	
+	$sql .= " ORDER BY 	bloc_id";
+	
+	$arrRet = $objDBConn->getAll($sql, $arrVal);
+	
+	return $arrRet;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfSetBlocData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ÎÇÛÎó¤òÀ¸À®¤¹¤ë
+ * °ú¿ô1	¡§$arrBloc    	¥¥¥ Bloc¾ðÊó
+ * °ú¿ô2	¡§$tpl_arrBloc	¥¥¥ ¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ëÇÛÎó
+ * °ú¿ô3	¡§$cnt			¥¥¥ ÇÛÎóÈÖ¹æ
+ * Ìá¤êÃÍ	¡§¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤·¤¿ÇÛÎó
+ **************************************************************************************************************/
+function lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt) {
+	global $arrTarget;
+	
+	$tpl_arrBloc[$cnt]['target_id'] = $arrTarget[$val['target_id']];
+	$tpl_arrBloc[$cnt]['bloc_id'] = $val['bloc_id'];
+	$tpl_arrBloc[$cnt]['bloc_row'] = $val['bloc_row'];
+
+	foreach($arrBloc as $bloc_key => $bloc_val){
+		if ($bloc_val['bloc_id'] == $val['bloc_id']) {
+			$bloc_name = $bloc_val['bloc_name'];
+			break;
+		}
+	}
+	$tpl_arrBloc[$cnt]['name'] = $bloc_name;
+	
+	return $tpl_arrBloc;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfChkBloc
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯ID¤¬ÇÛÎó¤ËÄÉ²Ã¤µ¤ì¤Æ¤¤¤ë¤«¤Î¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô1	¡§$arrBloc    ¥¥¥ Bloc¾ðÊó
+ * °ú¿ô2	¡§$arrChkData ¥¥¥ ¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¥Ç¡¼¥¿ÇÛÎó
+ * Ìá¤êÃÍ	¡§True	¥¥¥ Â¸ºß¤¹¤ë
+ * 			¡¡False	¥¥¥ Â¸ºß¤·¤Ê¤¤
+ **************************************************************************************************************/
+function lfChkBloc($arrBloc, $arrChkData) {
+	foreach($arrChkData as $key => $val){
+		if ($val['bloc_id'] === $arrBloc['bloc_id'] ) {
+			// ÇÛÎó¤ËÂ¸ºß¤¹¤ì¤ÐTrue¤òÊÖ¤¹
+			return true;
+		}
+	}
+	
+	// ÇÛÎó¤ËÂ¸ºß¤·¤Ê¤±¤ì¤ÐFlase¤òÊÖ¤¹
+	return false;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetRowID
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯ID¤¬²¿ÈÖÌÜ¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤«¤òÄ´¤Ù¤ë
+ * °ú¿ô1	¡§$arrUpdData   ¥¥¥ ¹¹¿·¾ðÊó
+ * °ú¿ô2	¡§$arrObj 		¥¥¥ ¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¥Ç¡¼¥¿ÇÛÎó
+ * Ìá¤êÃÍ	¡§½çÈÖ
+ **************************************************************************************************************/
+function lfGetRowID($arrUpdData, $arrObj){
+	$no = 0; // ¥«¥¦¥ó¥ÈÍÑ¡ÊÆ±¤¸¥Ç¡¼¥¿¤¬É¬¤º1·ï¤¢¤ë¤Î¤Ç¡¢½é´üÃÍ¤Ï0¡Ë
+	
+	// ÂÐ¾Ý¥Ç¡¼¥¿¤¬²¿ÈÖÌÜ¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤Î¤«¤ò¼èÆÀ¤¹¤ë¡£
+	foreach ($arrUpdData as $key => $val) {
+		if ($val['target_id'] === $arrObj['target_id'] and $val['top'] <= $arrObj['top']){
+			$no++;
+		}
+	}
+	// ÈÖ¹æ¤òÊÖ¤¹
+	return $no;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetRowID
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯ID¤¬²¿ÈÖÌÜ¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤«¤òÄ´¤Ù¤ë
+ * °ú¿ô1	¡§$arrUpdData   ¥¥¥ ¹¹¿·¾ðÊó
+ * °ú¿ô2	¡§$arrObj 		¥¥¥ ¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¥Ç¡¼¥¿ÇÛÎó
+ * Ìá¤êÃÍ	¡§½çÈÖ
+ **************************************************************************************************************/
+function lfSetPreData($arrPageData){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¹¹¿·SQLÀ¸À®ÍÑ
+	$ret = ""; 						// ¥Ç¡¼¥¿¹¹¿··ë²Ì³ÊÇ¼ÍÑ
+	$arrUpdData = array();			// ¹¹¿·¥Ç¡¼¥¿À¸À®ÍÑ
+	$filename = uniqid("");
+
+	$arrPreData = lfgetPageData(" page_id = ? " , array(0));
+
+	// tpl¥Õ¥¡¥¤¥ë¤Îºï½ü
+	$del_tpl = ROOT_DIR . USER_DIR . "templates/" . $arrPreData[0]['filename'] . '.tpl';
+	if (file_exists($del_tpl)){
+		unlink($del_tpl);	
+	}
+
+	// tpl¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+	copy(ROOT_DIR . $arrPageData[0]['tpl_dir'].$arrPageData[0]['filename'].".tpl", ROOT_DIR . USER_DIR."templates/".$filename.".tpl");
+	
+	// db¥Ç¡¼¥¿¤Î¥³¥Ô¡¼
+	$sql = " update dtb_pagelayout set ";
+	$sql .= "     page_name = (select page_name from dtb_pagelayout where page_id = ?)";
+	$sql .= "     ,header_chk = (select header_chk from dtb_pagelayout where page_id = ?)";
+	$sql .= "     ,footer_chk = (select footer_chk from dtb_pagelayout where page_id = ?)";
+	$sql .= "     ,url = ?";
+	$sql .= "     ,tpl_dir = ?";
+	$sql .= "     ,filename = ?";
+	$sql .= " where page_id = 0";
+	
+	$arrUpdData = array($arrPageData[0]['page_id']
+						,$arrPageData[0]['page_id']
+						,$arrPageData[0]['page_id']
+						,USER_DIR."templates/"
+						,USER_DIR."templates/"
+						,$filename
+						);
+	
+	$objDBConn->query($sql,$arrUpdData);
+}
Index: /temp/tags/eccube-0_9_2beta/html/admin/design/css.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/design/css.php	(revision 3574)
+++ /temp/tags/eccube-0_9_2beta/html/admin/design/css.php	(revision 3574)
@@ -0,0 +1,50 @@
+<?php
+
+require_once("../../require.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/css.tpl';
+		$this->tpl_subnavi 	= 'design/subnavi.tpl';
+		$this->area_row = 30;
+		$this->tpl_subno = "css";
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = 'CSSÊÔ½¸';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$css_path = ROOT_DIR . USER_DIR . "css/contents.css";
+
+// ¥Ç¡¼¥¿¹¹¿·½èÍý
+if ($_POST['mode'] == 'confirm'){
+	// ¥×¥ì¥Ó¥å¡¼ÍÑ¥Æ¥ó¥×¥ì¡¼¥È¤Ë½ñ¤­¹þ¤ß	
+	$fp = fopen($css_path,"w");
+	fwrite($fp, $_POST['css']);
+	fclose($fp);
+	
+	$objPage->tpl_onload="alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+}
+
+// CSS¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+if(file_exists($css_path)){
+	$css_data = file_get_contents($css_path);
+}
+
+// ¥Æ¥­¥¹¥È¥¨¥ê¥¢¤ËÉ½¼¨
+$objPage->css_data = $css_data;
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
Index: /temp/tags/eccube-0_9_2beta/html/admin/design/header.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/design/header.php	(revision 4402)
+++ /temp/tags/eccube-0_9_2beta/html/admin/design/header.php	(revision 4402)
@@ -0,0 +1,92 @@
+<?php
+
+require_once("../../require.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/header.tpl';
+		$this->tpl_subnavi 	= 'design/subnavi.tpl';
+		$this->header_row = 13;
+		$this->footer_row = 13;
+		$this->tpl_subno = "header";
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥Ø¥Ã¥À¡¼¥¥Õ¥Ã¥¿¡¼ÊÔ½¸';
+		$this->tpl_onload = 'comment_start(); comment_end();';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+$division = $_POST['division'];
+$tpl_DIR = ROOT_DIR . INCLUDE_DIR;
+$pre_DIR = ROOT_DIR . INCLUDE_DIR. 'preview/';
+
+// ¥Ç¡¼¥¿¹¹¿·½èÍý
+if ($division != ''){
+	// ¥×¥ì¥Ó¥å¡¼ÍÑ¥Æ¥ó¥×¥ì¡¼¥È¤Ë½ñ¤­¹þ¤ß	
+	$fp = fopen($pre_DIR.$division.'.tpl',"w");
+	fwrite($fp, $_POST[$division]);
+	fclose($fp);
+
+	// ÅÐÏ¿»þ¤Ï¥×¥ì¥Ó¥å¡¼ÍÑ¥Æ¥ó¥×¥ì¡¼¥È¤ò¥³¥Ô¡¼¤¹¤ë
+	if ($_POST['mode'] == 'confirm'){
+		copy($pre_DIR.$division.".tpl", $tpl_DIR.$division.".tpl");
+		// ´°Î»¥á¥Ã¥»¡¼¥¸¡Ê¥×¥ì¥Ó¥å¡¼»þ¤ÏÉ½¼¨¤·¤Ê¤¤¡Ë
+		$objPage->tpl_onload="alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+		
+		// ¥Æ¥­¥¹¥È¥¨¥ê¥¢¤ÎÉý¤ò¸µ¤ËÌá¤¹(½èÍý¤ÎÅý°ì¤Î¤¿¤á)
+		$_POST['header_row'] = "";
+		$_POST['footer_row'] = "";
+	}else if ($_POST['mode'] == 'preview'){
+		if ($division == "header") $objPage->header_prev = "on";
+		if ($division == "footer") $objPage->footer_prev = "on";
+	}
+
+	// ¥Ø¥Ã¥À¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß(¥×¥ì¥Ó¥å¡¼¥Ç¡¼¥¿)
+	$header_data = file_get_contents($pre_DIR . "header.tpl");
+	
+	// ¥Õ¥Ã¥¿¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß(¥×¥ì¥Ó¥å¡¼¥Ç¡¼¥¿)
+	$footer_data = file_get_contents($pre_DIR . "footer.tpl");
+}else{
+	// post¤Ç¥Ç¡¼¥¿¤¬ÅÏ¤µ¤ì¤Ê¤±¤ì¤Ð¿·µ¬ÆÉ¤ß¹þ¤ß¤ÈÈ½ÃÇ¤ò¤·¡¢¥×¥ì¥Ó¥å¡¼ÍÑ¥Ç¡¼¥¿¤òÀµµ¬¤Î¥Ç¡¼¥¿¤Ç¾å½ñ¤­¤¹¤ë
+	if (!is_dir($pre_DIR)) {
+		mkdir($pre_DIR);
+	}
+	copy($tpl_DIR . "header.tpl", $pre_DIR . "header.tpl");
+	copy($tpl_DIR . "footer.tpl", $pre_DIR . "footer.tpl");
+	
+	// ¥Ø¥Ã¥À¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	$header_data = file_get_contents($tpl_DIR . "header.tpl");
+	// ¥Õ¥Ã¥¿¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	$footer_data = file_get_contents($tpl_DIR . "footer.tpl");
+
+}
+
+// ¥Æ¥­¥¹¥È¥¨¥ê¥¢¤ËÉ½¼¨
+$objPage->header_data = $header_data;
+$objPage->footer_data = $footer_data;
+
+if ($_POST['header_row'] != ''){
+	$objPage->header_row = $_POST['header_row'];
+}
+
+if ($_POST['footer_row'] != ''){
+	$objPage->footer_row = $_POST['footer_row'];
+}
+
+// ¥Ö¥é¥¦¥¶¥¿¥¤¥×
+$objPage->browser_type = $_POST['browser_type'];
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
Index: /temp/tags/eccube-0_9_2beta/html/admin/design/main_edit.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/design/main_edit.php	(revision 3738)
+++ /temp/tags/eccube-0_9_2beta/html/admin/design/main_edit.php	(revision 3738)
@@ -0,0 +1,359 @@
+<?php
+
+require_once("../../require.php");
+require_once(ROOT_DIR."data/include/page_layout.inc");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/main_edit.tpl';
+		$this->tpl_subnavi 	= 'design/subnavi.tpl';
+		$this->user_URL	 	= USER_URL;
+		$this->text_row 	= 13;
+		$this->tpl_subno = "main_edit";
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥Ú¡¼¥¸¾ÜºÙÀßÄê';
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Ú¡¼¥¸°ìÍ÷¤ò¼èÆÀ
+$objPage->arrPageList = lfgetPageData();
+
+// ¥Ö¥í¥Ã¥¯ID¤ò¼èÆÀ
+if (isset($_POST['page_id'])) {
+	$page_id = $_POST['page_id'];
+}else if ($_GET['page_id']){
+	$page_id = $_GET['page_id'];
+}else{
+	$page_id = '';
+}
+
+$objPage->page_id = $page_id;
+
+// ¥á¥Ã¥»¡¼¥¸É½¼¨
+if ($_GET['msg'] == "on"){
+	$objPage->tpl_onload="alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+}
+
+// page_id ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿¤Î¼èÆÀ
+if (is_numeric($page_id) and $page_id != '') {
+	$arrPageData = lfgetPageData(" page_id = ? " , array($page_id));
+
+	if ($arrPageData[0]['tpl_dir'] === "") {
+		$objPage->arrErr['page_id_err'] = "¢¨ »ØÄê¤µ¤ì¤¿¥Ú¡¼¥¸¤ÏÊÔ½¸¤Ç¤­¤Þ¤»¤ó¡£";
+		// ²èÌÌ¤ÎÉ½¼¨
+		$objView->assignobj($objPage);
+		$objView->display(MAIN_FRAME);
+		exit;
+	}
+	
+	// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Æ¤¤¤ì¤ÐÆÉ¤ß¹þ¤à
+	$tpl_file = ROOT_DIR . $arrPageData[0]['tpl_dir'] . $arrPageData[0]['filename'] . ".tpl";
+	if (file_exists($tpl_file)){
+		$arrPageData[0]['tpl_data'] = file_get_contents($tpl_file);		
+	}
+	
+	// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍÊÑ¹¹
+	$arrPageData[0]['header_chk'] = sfChangeCheckBox($arrPageData[0]['header_chk'], true);
+	$arrPageData[0]['footer_chk'] = sfChangeCheckBox($arrPageData[0]['footer_chk'], true);
+
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤ò²èÌÌÉ½¼¨ÍÑ¤ËÊÔ½¸
+	$arrPageData[0]['directory'] = str_replace( USER_DIR,'', $arrPageData[0]['php_dir']);
+	
+	$objPage->arrPageData = $arrPageData[0];
+}
+
+// ¥×¥ì¥Ó¥å¡¼½èÍý
+if ($_POST['mode'] == 'preview') {
+	
+	$page_id_old = $page_id;
+	$page_id = 0;
+	$url = uniqid("");
+
+	$_POST['page_id'] = $page_id;
+	$_POST['url'] = $url;
+	
+	$arrPreData = lfgetPageData(" page_id = ? " , array($page_id));
+
+	// tpl¥Õ¥¡¥¤¥ë¤Îºï½ü
+	$del_tpl = ROOT_DIR . USER_DIR . "templates/" . $arrPreData[0]['filename'] . '.tpl';
+	if (file_exists($del_tpl)){
+		unlink($del_tpl);	
+	}
+	
+	// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+	lfEntryPageData($_POST);
+
+	// TPL¥Õ¥¡¥¤¥ëºîÀ®
+	$cre_tpl = ROOT_DIR . USER_DIR . "templates/" . $url . '.tpl';
+	lfCreateFile($cre_tpl);
+	
+	// blocposition ¤òºï½ü
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = 'delete from dtb_blocposition where page_id = 0';
+	$ret = $objDBConn->query($sql);
+	
+	if ($page_id_old != "") {
+		// blocposition ¤òÊ£À½
+		$sql = " insert into dtb_blocposition ";
+		$sql .= " select ";
+		$sql .= "     0,";
+		$sql .= "     target_id,";
+		$sql .= "     bloc_id,";
+		$sql .= "     bloc_row";
+		$sql .= " from dtb_blocposition";
+		$sql .= " where page_id = ?";
+		$ret = $objDBConn->query($sql,array($page_id_old));
+	}
+	
+	$_SESSION['preview'] = "ON";
+	
+	header("location: /preview/index.php");
+}
+
+// ¥Ç¡¼¥¿ÅÐÏ¿½èÍý
+if ($_POST['mode'] == 'confirm') {
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($_POST);
+
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¹¹¿·½èÍý¤ò¹Ô¤¦	
+	if (count($objPage->arrErr) == 0) {
+
+		// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+		lfEntryPageData($_POST);
+		
+		// ¥Ù¡¼¥¹¥Ç¡¼¥¿¤Ç¤Ê¤±¤ì¤Ð¥Õ¥¡¥¤¥ë¤òºï½ü¤·¡¢PHP¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ë
+		if (!lfCheckBaseData($page_id)) {
+			// ¥Õ¥¡¥¤¥ëºï½ü
+			lfDelFile($arrPageData[0]);
+			
+			// PHP¥Õ¥¡¥¤¥ëºîÀ®
+			$cre_php = ROOT_DIR . USER_DIR . $_POST['url'] . ".php";
+			lfCreatePHPFile($cre_php);
+		}
+
+		// TPL¥Õ¥¡¥¤¥ëºîÀ®
+		$cre_tpl = dirname( ROOT_DIR . USER_DIR . "templates/" . $_POST['url']) . "/" . basename($_POST['url']) . '.tpl';
+
+		lfCreateFile($cre_tpl);
+
+		// ÊÔ½¸²ÄÇ½¥Ú¡¼¥¸¤Î¾ì¹ç¤Ë¤Î¤ß½èÍý¤ò¹Ô¤¦
+		if ($arrPageData[0]['edit_flg'] != 2) {
+			// ¿·µ¬ºîÀ®¤·¤¿¾ì¹ç¤Î¤¿¤á¤Ë²þ¤Ë¥Ú¡¼¥¸ID¤ò¼èÆÀ¤¹¤ë
+			$arrPageData = lfgetPageData(" url = ? " , array(USER_URL.$_POST['url'].".php"));
+			$page_id = $arrPageData[0]['page_id'];
+		}
+
+		header("location: ./main_edit.php?page_id=$page_id&msg=on");
+	}else{
+		// ¥¨¥é¡¼¤¬¤¢¤ì¤ÐÆþÎÏ»þ¤Î¥Ç¡¼¥¿¤òÉ½¼¨¤¹¤ë
+		$objPage->arrPageData = $_POST;
+		$objPage->arrPageData['header_chk'] = sfChangeCheckBox(sfChangeCheckBox($_POST['header_chk']), true);
+		$objPage->arrPageData['footer_chk'] = sfChangeCheckBox(sfChangeCheckBox($_POST['footer_chk']), true);
+		$objPage->arrPageData['directory'] = $_POST['url'];
+		$objPage->arrPageData['filename'] = "";
+	}
+}
+
+// ¥Ç¡¼¥¿ºï½ü½èÍý ¥Ù¡¼¥¹¥Ç¡¼¥¿¤Ç¤Ê¤±¤ì¤Ð¥Õ¥¡¥¤¥ë¤òºï½ü
+if ($_POST['mode'] == 'delete' and 	!lfCheckBaseData($page_id)) {
+	lfDelPageData($_POST['page_id']);
+}
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfEntryPageData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¹¹¿·¤¹¤ë
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¹¹¿··ë²Ì
+ **************************************************************************************************************/
+function lfEntryPageData($arrData){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¹¹¿·SQLÀ¸À®ÍÑ
+	$ret = ""; 						// ¥Ç¡¼¥¿¹¹¿··ë²Ì³ÊÇ¼ÍÑ
+	$arrUpdData = array();			// ¹¹¿·¥Ç¡¼¥¿À¸À®ÍÑ
+	$arrChk = array();				// ÇÓÂ¾¥Á¥§¥Ã¥¯ÍÑ
+
+	// ¹¹¿·¥Ç¡¼¥¿À¸À®
+	$arrUpdData = lfGetUpdData($arrData);
+	
+	// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ë¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+	if($arrData['page_id'] !== ''){
+		$arrChk = lfgetPageData(" page_id = ?", array($arrData['page_id']));
+	}
+
+	// page_id ¤¬¶õ ¼ã¤·¤¯¤Ï ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤ÏINSERT¤ò¹Ô¤¦
+	if ($arrData['page_id'] === '' or !isset($arrChk[0])) {
+		// SQLÀ¸À®
+		$sql = " INSERT INTO dtb_pagelayout ";
+		$sql .= " ( ";
+		$sql .= " 	  page_name";
+		$sql .= "	  ,url";
+		$sql .= "	  ,php_dir";
+		$sql .= "	  ,tpl_dir";
+		$sql .= "	  ,filename";
+		$sql .= "	  ,header_chk";
+		$sql .= "	  ,footer_chk";
+		$sql .= "	  ,update_url";
+		$sql .= " ) VALUES ( ?,?,?,?,?,?,?,? )";
+		$sql .= " ";
+	}else{
+		// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤ë¾ì¹ç¤Ë¤Ï¥¢¥Ã¥×¥Ç¡¼¥È¤ò¹Ô¤¦
+		// SQLÀ¸À®
+		$sql = " UPDATE dtb_pagelayout ";
+		$sql .= " SET";
+		$sql .= "	  page_name = ? ";
+		$sql .= "	  ,url = ? ";
+		$sql .= "	  ,php_dir = ? ";
+		$sql .= "	  ,tpl_dir = ? ";
+		$sql .= "	  ,filename = ? ";
+		$sql .= "	  ,header_chk = ? ";
+		$sql .= "	  ,footer_chk = ? ";
+		$sql .= "	  ,update_url = ? ";
+		$sql .= "     ,update_date = now() ";
+		$sql .= " WHERE page_id = ?";
+		$sql .= " ";
+
+		// ¹¹¿·¥Ç¡¼¥¿¤Ë¥Ö¥í¥Ã¥¯ID¤òÄÉ²Ã
+		array_push($arrUpdData, $arrData['page_id']);
+	}
+
+	// SQL¼Â¹Ô
+	$ret = $objDBConn->query($sql,$arrUpdData);
+	
+	return $ret;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetUpdData
+ * ½èÍýÆâÍÆ	¡§DB¤Ø¹¹¿·¤ò¹Ô¤¦¥Ç¡¼¥¿¤òÀ¸À®¤¹¤ë
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¹¹¿·¥Ç¡¼¥¿
+ **************************************************************************************************************/
+function lfGetUpdData($arrData){
+	
+	// ¥Ù¡¼¥¹¥Ç¡¼¥¿¤Î¾ì¹ç¤Ë¤ÏÊÑ¹¹¤·¤Ê¤¤¡£
+	if (lfCheckBaseData($arrData['page_id'])) {
+		$arrPageData = lfgetPageData( ' page_id = ? ' , array($arrData['page_id']));
+
+		$name = $arrPageData[0]['page_name'] ;
+		$url = $arrPageData[0]['url'];
+		$php_dir = $arrPageData[0]['php_dir'];
+		$tpl_dir = $arrPageData[0]['tpl_dir'];
+		$filename = $arrPageData[0]['filename'];
+	}else{
+		$name = $arrData['page_name'] ;
+		$url = USER_URL.$arrData['url'].".php";
+		$php_dir = dirname(USER_DIR.$arrData['url'])."/";
+		$tpl_dir = dirname(USER_DIR."templates/".$arrData['url'])."/";
+		$filename = basename($arrData['url']);
+	}
+
+	// ¹¹¿·¥Ç¡¼¥¿ÇÛÎó¤ÎºîÀ®
+	$arrUpdData = array(
+					$name										// Ì¾¾Î	
+					,$url										// URL
+					,$php_dir									// PHP¥Ç¥£¥ì¥¯¥È¥ê
+					,$tpl_dir									// TPL¥Ç¥£¥ì¥¯¥È¥ê
+					,$filename									// ¥Õ¥¡¥¤¥ëÌ¾
+					,sfChangeCheckBox($arrData['header_chk'])	// ¥Ø¥Ã¥À¡¼»ÈÍÑ
+					,sfChangeCheckBox($arrData['footer_chk'])	// ¥Õ¥Ã¥¿¡¼»ÈÍÑ
+					,$_SERVER['HTTP_REFERER']					// ¹¹¿·URL
+					);
+					
+	return $arrUpdData;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfErrorCheck
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ÆþÎÏ¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¥¨¥é¡¼¾ðÊó
+ **************************************************************************************************************/
+function lfErrorCheck($array) {
+	global $objPage;
+	
+	$objErr = new SC_CheckError($array);
+	$objErr->doFunc(array("Ì¾¾Î", "page_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("URL", "url", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+
+	// URL¥Á¥§¥Ã¥¯
+	if (substr(strrev(trim($array['url'])),0,1) == "/") {
+		$objErr->arrErr['url'] = "¢¨ URL¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+	}
+	
+	$check_url = USER_URL . $array['url'] . ".php";
+	if( strlen($array['url']) > 0 && !ereg( "^https?://+($|[a-zA-Z0-9_~=&\?\.\/-])+$", $check_url ) ) {
+		$objErr->arrErr['url'] = "¢¨ URL¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+	}
+
+	// Æ±°ì¤ÎURL¤¬Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥¨¥é¡¼
+	if(!isset($objErr->arrErr['url']) and $array['url'] !== ''){
+		$arrChk = lfgetPageData(" url = ? " , array(USER_URL . $array['url'].".php"));
+
+		if (count($arrChk[0]) >= 1 and $arrChk[0]['page_id'] != $array['page_id']) {
+			$objErr->arrErr['url'] = '¢¨ Æ±¤¸URL¤Î¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£ÊÌ¤ÎURL¤òÉÕ¤±¤Æ¤¯¤À¤µ¤¤¡£';
+		}
+	}
+	
+	return $objErr->arrErr;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfCreateFile
+ * ½èÍýÆâÍÆ	¡§¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ë
+ * °ú¿ô1	¡§$path¥¥¥¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹
+ * Ìá¤êÃÍ	¡§¤Ê¤·
+ **************************************************************************************************************/
+function lfCreateFile($path){
+	
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë		
+	if (!is_dir(dirname($path))) {
+		mkdir(dirname($path));
+	}
+
+	// ¥Õ¥¡¥¤¥ëºîÀ®
+	$fp = fopen($path,"w");
+	fwrite($fp, $_POST['tpl_data']);
+	fclose($fp);
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfCreatePHPFile
+ * ½èÍýÆâÍÆ	¡§PHP¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ë
+ * °ú¿ô1	¡§$path¥¥¥PHP¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹
+ * Ìá¤êÃÍ	¡§¤Ê¤·
+ **************************************************************************************************************/
+function lfCreatePHPFile($path){
+
+	// phpÊÝÂ¸Àè¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë
+	if (!is_dir(dirname($path))) {
+		mkdir(dirname($path));
+	}
+	
+	// ¥Ù¡¼¥¹¤È¤Ê¤ëPHP¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	if (file_exists(USER_DEF_PHP)){
+		$php_data = file_get_contents(USER_DEF_PHP);		
+	}
+	
+	// require.php¤Î¾ì½ê¤ò½ñ¤­´¹¤¨¤ë
+	$php_data = str_replace("###require###", ROOT_DIR . "html/require.php", $php_data);
+	
+	// php¥Õ¥¡¥¤¥ë¤ÎºîÀ®
+	$fp = fopen($path,"w");
+	fwrite($fp, $php_data);
+	fclose($fp);
+}
Index: /temp/tags/eccube-0_9_2beta/html/admin/design/template.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/design/template.php	(revision 3574)
+++ /temp/tags/eccube-0_9_2beta/html/admin/design/template.php	(revision 3574)
@@ -0,0 +1,328 @@
+<?php
+
+require_once("../../require.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+	var $arrSubnavi = array(
+		'title' => array(
+			1 => 'top',
+			2 => 'product',
+			3 => 'detail',
+			4 => 'mypage' 
+		),
+		'name' =>array(
+			1 => 'TOP¥Ú¡¼¥¸',
+			2 => '¾¦ÉÊ°ìÍ÷¥Ú¡¼¥¸',
+			3 => '¾¦ÉÊ¾ÜºÙ¥Ú¡¼¥¸',
+			4 => 'MY¥Ú¡¼¥¸' 
+		)
+	);
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/template.tpl';
+		$this->tpl_subnavi = 'design/subnavi.tpl';
+		$this->tpl_subno = 'template';
+		$this->tpl_subno_template = $this->arrSubnavi['title'][1];
+		$this->tpl_TemplateName = $this->arrTemplateName['name'][1];
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// GET¤ÎÃÍ¤ò¼õ¤±¼è¤ë
+$get_tpl_subno_template = $_GET['tpl_subno_template'];
+
+// GET¤ÇÃÍ¤¬Á÷¤é¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¤½¤ÎÃÍ¤ò¸µ¤Ë²èÌÌÉ½¼¨¤òÀÚ¤êÂØ¤¨¤ë
+if ($get_tpl_subno_template != ""){
+	// Á÷¤é¤ì¤Æ¤­¤¿ÃÍ¤¬ÇÛÎó¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐTOP¤òÉ½¼¨
+	if (in_array($get_tpl_subno_template,$objPage->arrSubnavi['title'])){
+		$tpl_subno_template = $get_tpl_subno_template;
+	}else{
+		$tpl_subno_template = $objPage->arrSubnavi['title'][1];
+	}
+} else {
+	// GET¤ÇÃÍ¤¬¤Ê¤±¤ì¤ÐPOST¤ÎÃÍ¤ò»ÈÍÑ¤¹¤ë
+	if ($_POST['tpl_subno_template'] != ""){
+		$tpl_subno_template = $_POST['tpl_subno_template'];
+	}else{
+		$tpl_subno_template = $objPage->arrSubnavi['title'][1];
+	}
+}
+$objPage->tpl_subno_template = $tpl_subno_template;
+$key = array_keys($objPage->arrSubnavi['title'], $tpl_subno_template);
+$objPage->template_name = $objPage->arrSubnavi['name'][$key[0]];
+
+// ÅÐÏ¿¤ò²¡¤µ¤ì¤¿¤Ð¤¢¤Ë¤ÏDB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤Ë¹Ô¤¯
+if ($_POST['mode'] == "confirm"){
+	// DB¤Ø¥Ç¡¼¥¿¹¹¿·
+	lfUpdData();
+	
+	// ¥Æ¥ó¥×¥ì¡¼¥È¤Î¾å½ñ¤­
+	lfChangeTemplate();
+	
+	// ´°Î»¥á¥Ã¥»¡¼¥¸
+	$objPage->tpl_onload="alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+
+}
+
+// POSTÃÍ¤Î°ú¤­·Ñ¤®
+$objPage->arrForm = $_POST;
+
+// ²èÁü¼èÆÀ
+$tpl_arrTemplate = array();
+$objPage->arrTemplate = lfgetTemplate();
+
+// ¥Ç¥Õ¥©¥ë¥È¥Á¥§¥Ã¥¯¼èÆÀ
+$objPage->MainImage = $objPage->arrTemplate['check'];
+$objPage->arrTemplate['check'] = array($objPage->arrTemplate['check']=>"check");
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetTemplate
+ * ½èÍýÆâÍÆ	¡§²èÌÌ¤ËÉ½¼¨¤¹¤ë²èÁü¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ	¡§²èÌÌ¤ËÉ½¼¨¤¹¤ë²èÁü(ÇÛÎó)
+ **************************************************************************************************************/
+function lfgetTemplate(){
+	global $objPage;
+	$filepath = "/user_data/templates/";
+	
+	$arrTemplateImage = array();	// ²èÌÌÉ½¼¨²èÁü³ÊÇ¼ÍÑ
+	$Image = "";					// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+	$disp = "";
+	$arrDefcheck = array();			// radio¥Ü¥¿¥ó¤Î¥Ç¥Õ¥©¥ë¥È¥Á¥§¥Ã¥¯³ÊÇ¼ÍÑ
+	
+	// DB¤«¤é¸½ºßÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Ç¡¼¥¿¼èÆÀ
+	$arrDefcheck = lfgetTemplaeBaseData();
+	
+	// ¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+	$objQuery = new SC_Query();
+	$sql = "SELECT template_code,template_name FROM dtb_templates ORDER BY create_date DESC";
+	$arrTemplate = $objQuery->getall($sql);
+	
+	switch($objPage->tpl_subno_template) {
+		// TOP
+		case $objPage->arrSubnavi['title'][1]:
+			$Image = "TopImage.jpg";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$disp = $objPage->arrSubnavi['title'][1];
+			break;
+			
+		// ¾¦ÉÊ°ìÍ÷
+		case $objPage->arrSubnavi['title'][2]:
+			$Image = "ProdImage.jpg";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$disp = $objPage->arrSubnavi['title'][2];
+			break;
+			
+		// ¾¦ÉÊ¾ÜºÙ
+		case $objPage->arrSubnavi['title'][3]:
+			$Image = "DetailImage.jpg";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$disp = $objPage->arrSubnavi['title'][3];
+			break;
+			
+		// MY¥Ú¡¼¥¸
+		case $objPage->arrSubnavi['title'][4]:
+			$Image = "MypageImage.jpg";			//¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$disp = $objPage->arrSubnavi['title'][4];
+			break;
+	}
+
+	// ²èÁüÉ½¼¨ÇÛÎóºîÀ®
+	foreach($arrTemplate as $key => $val){
+		$arrTemplateImage['image'][$val['template_code']] = $filepath . $val['template_code'] . "/" . $Image;
+		$arrTemplateImage['code'][$key] = $val['template_code'];
+	}
+	
+	
+	
+	// ½é´ü¥Á¥§¥Ã¥¯
+	if (isset($arrDefcheck[$disp])){
+		$arrTemplateImage['check'] = $arrDefcheck[$disp];
+	}else{
+		$arrTemplateImage['check'] = 1;
+	}
+	
+	return $arrTemplateImage;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetTemplaeBaseData
+ * ½èÍýÆâÍÆ	¡§DB¤ËÊÝÂ¸¤µ¤ì¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ	¡§DB¤ËÊÝÂ¸¤µ¤ì¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿(ÇÛÎó)
+ **************************************************************************************************************/
+function lfgetTemplaeBaseData(){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	$sql = "SELECT top_tpl AS top, product_tpl AS product, detail_tpl AS detail, mypage_tpl AS mypage FROM dtb_baseinfo";
+	$arrRet = $objDBConn->getAll($sql);
+	
+	return $arrRet[0];
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfUpdData
+ * ½èÍýÆâÍÆ	¡§DB¤Ë¥Ç¡¼¥¿¤òÊÝÂ¸¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ	¡§À®¸ù TRUE¡¢¥¨¥é¡¼ FALSE
+ **************************************************************************************************************/
+function lfUpdData(){
+	global $objPage;
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ(¹¹¿·È½Äê)
+
+	// ¥Ç¡¼¥¿¼èÆÀ	
+	$sql = "SELECT top_tpl AS top, product_tpl AS product, detail_tpl AS detail, mypage_tpl AS mypage FROM dtb_baseinfo";
+	$arrRet = $objDBConn->getAll($sql);
+
+	$chk_tpl = $_POST['check_template'];
+	// ¥Ç¡¼¥¿¤¬¼èÆÀ¤Ç¤­¤Ê¤±¤ì¤ÐINSERT¡¢¤Ç¤­¤ì¤ÐUPDATE
+	if (isset($arrRet[0])){
+		// UPDATE
+		$arrVal = $arrRet[0];
+		
+		// TOP¤òÊÑ¹¹¤·¤¿¾ì¹ç¤Ë¤ÏÁ´²èÌÌÊÑ¹¹
+		if ($objPage->tpl_subno_template == $objPage->arrSubnavi['title'][1]){
+			$arrVal = array($chk_tpl,$chk_tpl,$chk_tpl,$chk_tpl);
+		}else{
+			$arrVal[$objPage->tpl_subno_template] = $chk_tpl;
+		}
+		$sql= "update dtb_baseinfo set top_tpl = ?, product_tpl = ?, detail_tpl = ?, mypage_tpl = ?, update_date = now()";
+	}else{
+		// INSERT
+		$arrVal = array(null,null,null,null);
+		
+		// TOP¤òÊÑ¹¹¤·¤¿¾ì¹ç¤Ë¤ÏÁ´²èÌÌÊÑ¹¹
+		if ($objPage->tpl_subno_template == $objPage->arrSubnavi['title'][1]){
+			$arrVal = array($chk_tpl,$chk_tpl,$chk_tpl,$chk_tpl);
+		}else{
+			$arrVal[$chk_tpl-1] =$chk_tpl;
+		}
+		$sql= "insert into dtb_baseinfo (top_tpl,product_tpl,detail_tpl,mypage_tpl, update_date) values (?,?,?,?,now());";
+	}
+
+	// SQL¼Â¹Ô	
+	$arrRet = $objDBConn->query($sql,$arrVal);
+	
+	return $arrRet;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfChangeTemplate
+ * ½èÍýÆâÍÆ	¡§¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ò¾å½ñ¤­¤¹¤ë
+ * °ú¿ô		¡§¤Ê¤·
+ * Ìá¤êÃÍ	¡§À®¸ù TRUE¡¢¥¨¥é¡¼ FALSE
+ **************************************************************************************************************/
+function lfChangeTemplate(){
+	global $objPage;
+	$tpl_path = USER_DIR . "templates/";
+	$inc_path = ROOT_DIR . USER_DIR . "include/";
+	$css_path = ROOT_DIR . USER_DIR . "css/";
+	
+	$tpl_name = "";
+	$tpl_element = "";
+	
+	$chk_tpl = $_POST['check_template'];
+	
+	// ¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+	$objQuery = new SC_Query();
+	$sql = "SELECT template_code,template_name FROM dtb_templates WHERE template_code = ?";
+	$arrTemplate = $objQuery->getall($sql, array($chk_tpl));	
+	
+	switch($objPage->tpl_subno_template) {
+		// TOP
+		case $objPage->arrSubnavi['title'][1]:
+			$tpl_element = "TopTemplate";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$tpl_name = "top.tpl";
+			break;
+			
+		// ¾¦ÉÊ°ìÍ÷
+		case $objPage->arrSubnavi['title'][2]:
+			$tpl_element = "ProdTemplate";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$tpl_name = "list.tpl";
+			break;
+			
+		// ¾¦ÉÊ¾ÜºÙ
+		case $objPage->arrSubnavi['title'][3]:
+			$tpl_element = "DetailTemplate";			// ¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$tpl_name = "detail.tpl";
+			break;
+			
+		// MY¥Ú¡¼¥¸
+		case $objPage->arrSubnavi['title'][4]:
+			$tpl_element = "MypageTemplate";			//¥¤¥á¡¼¥¸¤ÎÇÛÎóÍ×ÁÇÌ¾³ÊÇ¼ÍÑ
+			$tpl_name = "mypage.tpl";
+			break;
+
+		default:
+			break;
+	}
+	
+	$taget_tpl_path = ROOT_DIR . $tpl_path . $arrTemplate[0]['template_code'] . "/";
+	$save_tpl_path = ROOT_DIR . $tpl_path;
+	
+	// TOP¤òÊÑ¹¹¤·¤¿¾ì¹ç¤Ë¤ÏÁ´²èÌÌÊÑ¹¹
+	if ($objPage->tpl_subno_template == $objPage->arrSubnavi['title'][1]){
+		// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼
+		copy($taget_tpl_path . "top.tpl", $save_tpl_path . "top.tpl");
+		copy($taget_tpl_path . "list.tpl", $save_tpl_path . "list.tpl");
+		copy($taget_tpl_path . "detail.tpl", $save_tpl_path . "detail.tpl");
+
+		// mypage¤Ï¥Õ¥©¥ë¥À¤´¤È¥³¥Ô¡¼
+		lfFolderCopy($taget_tpl_path."mypage/", $save_tpl_path . "mypage/");
+
+		// ¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤Î¥³¥Ô¡¼
+		lfFolderCopy($taget_tpl_path."bloc/", $inc_path . "bloc/");
+		
+		// ¥Ø¥Ã¥À¡¼,¥Õ¥Ã¥¿¡¼¥³¥Ô¡¼
+		copy($taget_tpl_path . "header.tpl", $inc_path . "header.tpl");
+		copy($taget_tpl_path . "footer.tpl", $inc_path . "footer.tpl");
+		
+		// CSS¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+		copy($taget_tpl_path . "contents.css", $css_path . "contents.css");
+
+	// mypage¤Î¾ì¹ç¤Ë¤Ï¥Õ¥©¥ë¥À¤´¤È¥³¥Ô¡¼¤¹¤ë
+	}elseif($objPage->tpl_subno_template == $objPage->arrSubnavi['title'][4]){
+		lfFolderCopy($taget_tpl_path."mypage/", $save_tpl_path."mypage/");
+	}else{
+		// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼
+		copy($taget_tpl_path . $tpl_name, $save_tpl_path . $tpl_name);
+	}
+}
+
+// ¥Õ¥©¥ë¥À¤ò¥³¥Ô¡¼¤¹¤ë
+function lfFolderCopy($taget_path, $save_path){
+
+	// ¥Õ¥©¥ë¥ÀÆâ¤Î¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë
+	$arrMypage=glob($taget_path . "*" );
+	
+	// ¥Õ¥©¥ë¥À¤¬¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë
+	if(!is_dir($save_path)){
+		mkdir($save_path);
+	}
+
+	// ¥Õ¥©¥ë¥ÀÆâ¤òÁ´¤Æ¥³¥Ô¡¼
+	foreach($arrMypage as $key => $val){
+		$matches = array();
+		mb_ereg("^(.*[\/])(.*)",$val, $matches);
+		$data=$matches[2];
+		copy($val, $save_path . $data);
+	}
+}
Index: /temp/tags/eccube-0_9_2beta/html/admin/design/bloc.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/design/bloc.php	(revision 4401)
+++ /temp/tags/eccube-0_9_2beta/html/admin/design/bloc.php	(revision 4401)
@@ -0,0 +1,264 @@
+<?php
+
+require_once("../../require.php");
+
+class LC_Page {
+	var $arrForm;
+	var $arrHidden;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/bloc.tpl';
+		$this->tpl_subnavi = 'design/subnavi.tpl';
+		$this->tpl_subno_edit = 'bloc';
+		$this->text_row = 13;
+		$this->tpl_subno = "bloc";	
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥Ö¥í¥Ã¥¯ÊÔ½¸';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Ö¥í¥Ã¥¯°ìÍ÷¤ò¼èÆÀ
+$objPage->arrBlocList = lfgetBlocData();
+
+// ¥Ö¥í¥Ã¥¯ID¤ò¼èÆÀ
+if (isset($_POST['bloc_id'])) {
+	$bloc_id = $_POST['bloc_id'];
+}else if ($_GET['bloc_id']){
+	$bloc_id = $_GET['bloc_id'];
+}else{
+	$bloc_id = '';
+}
+$objPage->bloc_id = $bloc_id;
+
+// bloc_id ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤Î¼èÆÀ
+if ($bloc_id != '') {
+	$arrBlocData = lfgetBlocData(" bloc_id = ? " , array($bloc_id));
+	$arrBlocData[0]['tpl_path'] = ROOT_DIR . $arrBlocData[0]['tpl_path'];
+
+	// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	$arrBlocData[0]['tpl_data'] = file_get_contents($arrBlocData[0]['tpl_path']);
+	$objPage->arrBlocData = $arrBlocData[0];
+}
+
+// ¥á¥Ã¥»¡¼¥¸É½¼¨
+if ($_GET['msg'] == "on") {
+	// ´°Î»¥á¥Ã¥»¡¼¥¸
+	$objPage->tpl_onload="alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+}
+
+// ¥×¥ì¥Ó¥å¡¼É½¼¨
+if ($_POST['mode'] == "preview") {
+	// ¥×¥ì¥Ó¥å¡¼¥Õ¥¡¥¤¥ëºîÀ®
+	$prev_path = ROOT_DIR . INCLUDE_DIR. 'preview/bloc_preview.tpl';
+	$fp = fopen($prev_path,"w");
+	fwrite($fp, $_POST['bloc_html']);
+	fclose($fp);
+	
+	// ¥×¥ì¥Ó¥å¡¼¥Ç¡¼¥¿É½¼¨
+	$objPage->preview = "on";
+	$objPage->arrBlocData['tpl_data'] = $_POST['bloc_html'];
+	$objPage->arrBlocData['tpl_path'] = $prev_path;
+	$objPage->arrBlocData['bloc_name'] = $_POST['bloc_name'];
+	$objPage->arrBlocData['filename'] = $_POST['filename'];
+	$objPage->text_row = $_POST['html_area_row'];
+}else{
+	$objPage->preview = "off";
+}
+
+// ¥Ç¡¼¥¿ÅÐÏ¿½èÍý
+if ($_POST['mode'] == 'confirm') {
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($_POST);
+
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¹¹¿·½èÍý¤ò¹Ô¤¦	
+	if (count($objPage->arrErr) == 0) {
+	
+		
+		// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+		lfEntryBlocData($_POST);
+		
+		// ¥Õ¥¡¥¤¥ë¤Îºï½ü
+		$del_file=ROOT_DIR . BLOC_DIR . $arrBlocData[0]['filename']. '.tpl';
+		if (file_exists($del_file)) {
+			unlink($del_file);
+		}
+		
+		// ¥Õ¥¡¥¤¥ëºîÀ®
+		$fp = fopen(ROOT_DIR . BLOC_DIR . $_POST['filename'] . '.tpl',"w");
+		fwrite($fp, $_POST['bloc_html']);
+		fclose($fp);
+		
+		$arrBlocData = lfgetBlocData(" filename = ? " , array($_POST['filename']));
+			
+		$bloc_id = $arrBlocData[0]['bloc_id'];	
+		header("location: ./bloc.php?bloc_id=$bloc_id&msg=on");
+	}else{
+		// ¥¨¥é¡¼¤¬¤¢¤ì¤ÐÆþÎÏ»þ¤Î¥Ç¡¼¥¿¤òÉ½¼¨¤¹¤ë
+		$objPage->arrBlocData = $_POST;
+	}
+}
+
+// ¥Ç¡¼¥¿ºï½ü½èÍý
+if ($_POST['mode'] == 'delete') {
+	
+	// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¹¹¿·SQLÀ¸À®ÍÑ
+	$ret = ""; 						// ¥Ç¡¼¥¿¹¹¿··ë²Ì³ÊÇ¼ÍÑ
+	$arrDelData = array();			// ¹¹¿·¥Ç¡¼¥¿À¸À®ÍÑ
+	
+	// ¹¹¿·¥Ç¡¼¥¿À¸À®
+	$arrUpdData = array($arrData['bloc_name'], BLOC_DIR . $arrData['filename'] . '.tpl', $arrData['filename']);
+	
+	// bloc_id ¤¬¶õ¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ïdelete¤ò¼Â¹Ô
+	if ($_POST['bloc_id'] !== '') {
+		// SQLÀ¸À®
+		$sql = " DELETE FROM dtb_bloc WHERE bloc_id = ?";
+		// SQL¼Â¹Ô
+		$ret = $objDBConn->query($sql,array($_POST['bloc_id']));
+		
+		// ¥Ú¡¼¥¸¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¥Ç¡¼¥¿¤âºï½ü¤¹¤ë
+		$sql = "DELETE FROM dtb_blocposition WHERE bloc_id = ?";
+		// SQL¼Â¹Ô
+		$ret = $objDBConn->query($sql,array($_POST['bloc_id']));
+	
+		// ¥Õ¥¡¥¤¥ë¤Îºï½ü
+		$del_file = ROOT_DIR . BLOC_DIR . $arrBlocData[0]['filename']. '.tpl';
+		if(file_exists($del_file)){
+			unlink($del_file);
+		}
+	}
+
+	header("location: ./bloc.php");
+}
+
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfgetBlocData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$where  ¥¥¥ Where¶çÊ¸
+ * °ú¿ô2	¡§$arrVal ¥¥¥ Where¶ç¤Î¹Ê¹þ¾ò·ïÃÍ
+ * Ìá¤êÃÍ	¡§¥Ö¥í¥Ã¥¯¾ðÊó
+ **************************************************************************************************************/
+function lfgetBlocData($where = '', $arrVal = ''){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+	$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+	
+	// SQLÀ¸À®
+	$sql = " SELECT ";
+	$sql .= "	bloc_id";
+	$sql .= "	,bloc_name";
+	$sql .= "	,tpl_path";
+	$sql .= "	,filename";
+	$sql .= " 	,create_date";
+	$sql .= " 	,update_date";
+	$sql .= " 	,php_path";
+	$sql .= " 	,del_flg";
+	$sql .= " FROM ";
+	$sql .= " 	dtb_bloc";
+
+	// where¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+	if ($where != '') {
+		$sql .= " WHERE " . $where;
+	}
+	
+	$sql .= " ORDER BY 	bloc_id";
+	
+	$arrRet = $objDBConn->getAll($sql, $arrVal);
+	
+	return $arrRet;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfEntryBlocData
+ * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¹¹¿·¤¹¤ë
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ¹¹¿·¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¹¹¿··ë²Ì
+ **************************************************************************************************************/
+function lfEntryBlocData($arrData){
+	$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+	$sql = "";						// ¥Ç¡¼¥¿¹¹¿·SQLÀ¸À®ÍÑ
+	$ret = ""; 						// ¥Ç¡¼¥¿¹¹¿··ë²Ì³ÊÇ¼ÍÑ
+	$arrUpdData = array();			// ¹¹¿·¥Ç¡¼¥¿À¸À®ÍÑ
+	$arrChk = array();				// ÇÓÂ¾¥Á¥§¥Ã¥¯ÍÑ
+	
+	// ¹¹¿·¥Ç¡¼¥¿À¸À®
+	$arrUpdData = array($arrData['bloc_name'], BLOC_DIR . $arrData['filename'] . '.tpl', $arrData['filename']);
+	
+	// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ë¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+	if($arrData['bloc_id'] !== ''){
+		$arrChk = lfgetBlocData("bloc_id = ?", array($arrData['bloc_id']));
+	}
+	
+	// bloc_id ¤¬¶õ ¼ã¤·¤¯¤Ï ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤ÏINSERT¤ò¹Ô¤¦
+	if ($arrData['bloc_id'] === '' or !isset($arrChk[0])) {
+		// SQLÀ¸À®
+		$sql = " INSERT INTO dtb_bloc";
+		$sql .= " ( ";
+		$sql .= "     bloc_name ";		// ¥Ö¥í¥Ã¥¯Ì¾¾Î
+		$sql .= "     ,tpl_path ";		// ¥Æ¥ó¥×¥ì¡¼¥ÈÊÝÂ¸Àè
+		$sql .= "     ,filename ";		// ¥Õ¥¡¥¤¥ëÌ¾¾Î
+		$sql .= " ) VALUES ( ?,?,? )";
+		$sql .= " ";
+	}else{
+		// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤ë¾ì¹ç¤Ë¤Ï¥¢¥Ã¥×¥Ç¡¼¥È¤ò¹Ô¤¦
+		// SQLÀ¸À®
+		$sql = " UPDATE dtb_bloc";
+		$sql .= " SET";
+		$sql .= "     bloc_name = ? ";	// ¥Ö¥í¥Ã¥¯Ì¾¾Î
+		$sql .= "     ,tpl_path = ? ";	// ¥Æ¥ó¥×¥ì¡¼¥ÈÊÝÂ¸Àè
+		$sql .= "     ,filename = ? ";	// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÌ¾
+		$sql .= "     ,update_date = now()";
+		$sql .= " WHERE bloc_id = ?";
+		$sql .= " ";
+		
+		// ¹¹¿·¥Ç¡¼¥¿¤Ë¥Ö¥í¥Ã¥¯ID¤òÄÉ²Ã
+		array_push($arrUpdData, $arrData['bloc_id']);
+	}
+	
+	// SQL¼Â¹Ô
+	$ret = $objDBConn->query($sql,$arrUpdData);
+	
+	return $ret;
+
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfErrorCheck
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¹àÌÜ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô1	¡§$arrData  ¥¥¥ ÆþÎÏ¥Ç¡¼¥¿
+ * Ìá¤êÃÍ	¡§¥¨¥é¡¼¾ðÊó
+ **************************************************************************************************************/
+function lfErrorCheck($array) {
+	global $objPage;
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥Ö¥í¥Ã¥¯Ì¾", "bloc_name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥¡¥¤¥ëÌ¾", "filename", STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "MAX_LENGTH_CHECK","ALNUM_CHECK"));
+	
+	// Æ±°ì¤Î¥Õ¥¡¥¤¥ëÌ¾¤¬Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¥¨¥é¡¼
+	if(!isset($objErr->arrErr['filename']) and $array['filename'] !== ''){
+		$arrChk = lfgetBlocData("filename = ?", array($array['filename']));
+		
+		if (count($arrChk[0]) >= 1 and $arrChk[0]['bloc_id'] != $array['bloc_id']) {
+			$objErr->arrErr['filename'] = '¢¨ Æ±¤¸¥Õ¥¡¥¤¥ëÌ¾¤Î¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£ÊÌ¤ÎÌ¾¾Î¤òÉÕ¤±¤Æ¤¯¤À¤µ¤¤¡£';
+		}
+	}
+	
+	return $objErr->arrErr;
+}
Index: /temp/tags/eccube-0_9_2beta/html/admin/order/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/order/index.php	(revision 1448)
+++ /temp/tags/eccube-0_9_2beta/html/admin/order/index.php	(revision 1448)
@@ -0,0 +1,327 @@
+<?php
+require_once("../require.php");
+require_once("./index_csv.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/index.tpl';
+		$this->tpl_subnavi = 'order/subnavi.tpl';
+		$this->tpl_mainno = 'order';		
+		$this->tpl_subno = 'index';
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = '¼õÃí´ÉÍý';
+		global $arrORDERSTATUS;
+		$this->arrORDERSTATUS = $arrORDERSTATUS;
+		global $arrORDERSTATUS_COLOR;
+		$this->arrORDERSTATUS_COLOR = $arrORDERSTATUS_COLOR;
+		global $arrSex;
+		$this->arrSex = $arrSex;
+		global $arrPageMax;
+		$this->arrPageMax = $arrPageMax;
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$objFormParam->setParam($_POST);
+
+$objFormParam->splitParamCheckBoxes('search_order_sex');
+$objFormParam->splitParamCheckBoxes('search_payment_id');
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		switch($key) {
+			case 'search_order_sex':
+			case 'search_payment_id':
+				$objPage->arrHidden[$key] = sfMergeParamCheckBoxes($val);
+				break;
+			default:
+				$objPage->arrHidden[$key] = $val;
+				break;
+		}		
+	}
+}
+
+// ¥Ú¡¼¥¸Á÷¤êÍÑ
+$objPage->arrHidden['search_pageno'] = $_POST['search_pageno'];
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if($_POST['mode'] == 'delete') {
+	if(sfIsInt($_POST['order_id'])) {
+		$objQuery = new SC_Query();
+		$where = "order_id = ?";
+		$sqlval['delete'] = '1';
+		$objQuery->update("dtb_order", $sqlval, $where, array($_POST['order_id']));
+	}	
+}
+
+switch($_POST['mode']) {
+case 'delete':
+case 'csv':
+case 'delete_all':
+case 'search':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	$arrRet = $objFormParam->getHashArray();
+	// ÆþÎÏ¤Ê¤·
+	if (count($objPage->arrErr) == 0) {
+		$where = "delete = 0";
+		foreach ($arrRet as $key => $val) {
+			if($val == "") {
+				continue;
+			}
+			$val = sfManualEscape($val);
+			
+			switch ($key) {
+				case 'search_order_name':
+					$where .= " AND order_name01||order_name02 ILIKE ?";
+					$nonsp_val = ereg_replace("[ ¡¡]+","",$val);
+					$arrval[] = "%$nonsp_val%";
+					break;
+				case 'search_order_kana':
+					$where .= " AND order_kana01||order_kana02 ILIKE ?";
+					$nonsp_val = ereg_replace("[ ¡¡]+","",$val);
+					$arrval[] = "%$nonsp_val%";
+					break;
+				case 'search_order_id1':
+					$where .= " AND order_id >= ?";
+					$arrval[] = $val;
+					break;
+				case 'search_order_id2':
+					$where .= " AND order_id <= ?";
+					$arrval[] = $val;
+					break;
+				case 'search_order_sex':
+					$tmp_where = "";
+					foreach($val as $element) {
+						if($element != "") {
+							if($tmp_where == "") {
+								$tmp_where .= " AND (order_sex = ?";
+							} else {
+								$tmp_where .= " OR order_sex = ?";
+							}
+							$arrval[] = $element;
+						}
+					}
+					
+					if($tmp_where != "") {
+						$tmp_where .= ")";
+						$where .= " $tmp_where ";
+					}					
+					break;
+				case 'search_order_tel':
+					$where .= " AND (order_tel01||order_tel02||order_tel03) ILIKE ?";
+					$nonmark_val = ereg_replace("[()-]+","",$val);
+					$arrval[] = "$nonmark_val%";
+					break;
+				case 'search_order_email':
+					$where .= " AND order_email ILIKE ?";
+					$arrval[] = "%$val%";
+					break;
+				case 'search_payment_id':
+					$tmp_where = "";
+					foreach($val as $element) {
+						if($element != "") {
+							if($tmp_where == "") {
+								$tmp_where .= " AND (payment_id = ?";
+							} else {
+								$tmp_where .= " OR payment_id = ?";
+							}
+							$arrval[] = $element;
+						}
+					}
+					
+					if($tmp_where != "") {
+						$tmp_where .= ")";
+						$where .= " $tmp_where ";
+					}
+					break;
+				case 'search_total1':
+					$where .= " AND total >= ?";
+					$arrval[] = $val;
+					break;
+				case 'search_total2':
+					$where .= " AND total <= ?";
+					$arrval[] = $val;
+					break;
+				case 'search_startyear':
+					$date = sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
+					$where.= " AND update_date >= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_endyear':
+					$date = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday'], true);
+					$where.= " AND update_date <= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_sbirthyear':
+					$date = sfGetTimestamp($_POST['search_sbirthyear'], $_POST['search_sbirthmonth'], $_POST['search_sbirthday']);
+					$where.= " AND order_birth >= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_ebirthyear':
+					$date = sfGetTimestamp($_POST['search_ebirthyear'], $_POST['search_ebirthmonth'], $_POST['search_ebirthday'], true);
+					$where.= " AND order_birth <= ?";
+					$arrval[] = $date;
+					break;
+				case 'search_order_status':
+					$where.= " AND status = ?";
+					$arrval[] = $val;
+					break;
+				default:
+					break;
+			}
+		}
+		
+		$order = "update_date DESC";
+		
+		switch($_POST['mode']) {
+		case 'csv':
+			// ¥ª¥×¥·¥ç¥ó¤Î»ØÄê
+			$option = "ORDER BY $order";
+			
+			// CSV½ÐÎÏ¥¿¥¤¥È¥ë¹Ô¤ÎºîÀ®
+			$arrCsvOutput = sfSwapArray(sfgetCsvOutput(3, " WHERE csv_id = 3 AND status = 1"));
+			
+			if (count($arrCsvOutput) <= 0) break;
+			
+			$arrCsvOutputCols = $arrCsvOutput['col'];
+			$arrCsvOutputTitle = $arrCsvOutput['disp_name'];
+			$head = sfGetCSVList($arrCsvOutputTitle);
+			$data = lfGetCSV("dtb_order", $where, $option, $arrval, $arrCsvOutputCols);
+			
+			// CSV¤òÁ÷¿®¤¹¤ë¡£
+			sfCSVDownload($head.$data);
+			exit;
+			break;
+		case 'delete_all':
+			// ¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü
+			$sqlval['delete'] = 1;
+			$objQuery = new SC_Query();
+			$objQuery->update("dtb_order", $sqlval, $where, $arrval);
+			break;
+		default:
+			// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+			$col = "*";
+			$from = "dtb_order";
+			
+			$objQuery = new SC_Query();
+			// ¹Ô¿ô¤Î¼èÆÀ
+			$linemax = $objQuery->count($from, $where, $arrval);
+			$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+			
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+			if(is_numeric($_POST['search_page_max'])) {	
+				$page_max = $_POST['search_page_max'];
+			} else {
+				$page_max = SEARCH_PMAX;
+			}
+			
+			// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+			$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+			$startno = $objNavi->start_row;
+			$objPage->arrPagenavi = $objNavi->arrPagenavi;		
+			
+			// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+			$objQuery->setlimitoffset($page_max, $startno);
+			// É½¼¨½ç½ø
+			$objQuery->setorder($order);
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$objPage->arrResults = $objQuery->select($col, $from, $where, $arrval);
+		}
+	}
+	break;
+	
+default:
+	break;
+}
+
+$objDate = new SC_Date();
+// ÅÐÏ¿¡¦¹¹¿·Æü¸¡º÷ÍÑ
+$objDate->setStartYear(RELEASE_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrRegistYear = $objDate->getYear();
+// À¸Ç¯·îÆü¸¡º÷ÍÑ
+$objDate->setStartYear(BIRTH_YEAR);
+$objDate->setEndYear(DATE("Y"));
+$objPage->arrBirthYear = $objDate->getYear();
+// ·îÆü¤ÎÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+// ÆþÎÏÃÍ¤Î¼èÆÀ
+$objPage->arrForm = $objFormParam->getFormParamList();
+// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+$arrRet = sfGetPayment();
+$objPage->arrPayment = sfArrKeyValue($arrRet, 'payment_id', 'payment_method');
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¼õÃíÈÖ¹æ1", "search_order_id1", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¼õÃíÈÖ¹æ2", "search_order_id2", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÂÐ±þ¾õ¶·", "search_order_status", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¸ÜµÒÌ¾", "search_order_name", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¸ÜµÒÌ¾(¥«¥Ê)", "search_order_kana", STEXT_LEN, "KVCa", array("KANA_CHECK","MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("À­ÊÌ", "search_order_sex", INT_LEN, "n", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Ç¯Îð1", "search_age1", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("Ç¯Îð2", "search_age2", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "search_order_email", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("TEL", "search_order_tel", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("»ÙÊ§¤¤ÊýË¡", "search_payment_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþ¶â³Û1", "search_total1", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¹ØÆþ¶â³Û2", "search_total2", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("É½¼¨·ï¿ô", "search_page_max", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_startyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_startmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_startday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_endyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_endmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_endday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_sbirthyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_sbirthmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("³«»ÏÆü", "search_sbirthday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_ebirthyear", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_ebirthmonth", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½ªÎ»Æü", "search_ebirthday", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÆÃ¼ì¹àÌÜ¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("¼õÃíÈÖ¹æ1", "¼õÃíÈÖ¹æ2", "search_order_id1", "search_order_id2"), array("GREATER_CHECK"));
+	$objErr->doFunc(array("Ç¯Îð1", "Ç¯Îð2", "search_age1", "search_age2"), array("GREATER_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ¶â³Û1", "¹ØÆþ¶â³Û2", "search_total1", "search_total2"), array("GREATER_CHECK"));
+	$objErr->doFunc(array("³«»ÏÆü", "search_startyear", "search_startmonth", "search_startday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("½ªÎ»Æü", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_startyear", "search_startmonth", "search_startday", "search_endyear", "search_endmonth", "search_endday"), array("CHECK_SET_TERM"));
+	
+	$objErr->doFunc(array("³«»ÏÆü", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("½ªÎ»Æü", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_DATE"));
+	$objErr->doFunc(array("³«»ÏÆü", "½ªÎ»Æü", "search_sbirthyear", "search_sbirthmonth", "search_sbirthday", "search_ebirthyear", "search_ebirthmonth", "search_ebirthday"), array("CHECK_SET_TERM"));
+
+	return $objErr->arrErr;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/order/mail_view.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/order/mail_view.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/order/mail_view.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/mail_view.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if(sfIsInt($_GET['send_id'])) {
+	$objQuery = new SC_Query();
+	$col = "subject, mail_body";
+	$where = "send_id = ?";
+	$arrRet = $objQuery->select($col, "dtb_mail_history", $where, array($_GET['send_id']));
+	$objPage->tpl_subject = $arrRet[0]['subject'];
+	$objPage->tpl_body = $arrRet[0]['mail_body'];
+}
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
Index: /temp/tags/eccube-0_9_2beta/html/admin/order/index_csv.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/order/index_csv.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/order/index_csv.php	(revision 1328)
@@ -0,0 +1,58 @@
+<?php
+require_once(ROOT_DIR."data/include/csv_output.inc");
+/*------  /admin/contents/inpuiry.php ¤«¤é¤â¸Æ¤Ó½Ð¤·¤Þ¤¹¡£(11/18 fukuda) ---*/
+
+// CSV½ÐÎÏ¥Ç¡¼¥¿¤òºîÀ®¤¹¤ë¡£
+function lfGetCSV($from, $where, $option, $arrval, $arrCsvOutputCols = "") {
+	global $arrCVSCOL;
+
+	//$cols = sfGetCommaList($arrCVSCOL);
+	$cols = sfGetCommaList($arrCsvOutputCols);
+	
+	$objQuery = new SC_Query();
+	$objQuery->setoption($option);
+	
+	$list_data = $objQuery->select($cols, $from, $where, $arrval);	
+
+	$max = count($list_data);
+	for($i = 0; $i < $max; $i++) {
+		// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+		$data .= lfMakeCSV($list_data[$i]);
+	}
+	return $data;
+}
+
+// ³Æ¹àÌÜ¤òCSV½ÐÎÏÍÑ¤ËÊÑ´¹¤¹¤ë¡£
+function lfMakeCSV($list) {
+	global $arrPref;
+	global $arrJob;
+	global $arrORDERSTATUS;
+	
+	$line = "";
+	
+	foreach($list as $key => $val) {
+		$tmp = "";
+		switch($key) {
+		case 'order_pref':
+			$tmp = $arrPref[$val];
+			break;
+		case 'order_job':
+			$tmp = $arrJob[$val];
+			break;
+		case 'status':
+			$tmp = $arrORDERSTATUS[$val];
+			break;
+		default:
+			$tmp = $val;
+			break;
+		}
+
+		$tmp = ereg_replace("[\",]", " ", $tmp);
+		$line .= "\"".$tmp."\",";
+	}
+	// Ê¸Ëö¤Î","¤òÊÑ´¹
+	$line = ereg_replace(",$", "\n", $line);
+	return $line;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/order/mail.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/order/mail.php	(revision 2579)
+++ /temp/tags/eccube-0_9_2beta/html/admin/order/mail.php	(revision 2579)
@@ -0,0 +1,112 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/mail.tpl';
+		$this->tpl_subnavi = 'order/subnavi.tpl';
+		$this->tpl_mainno = 'order';		
+		$this->tpl_subno = 'index';
+		$this->tpl_subtitle = '¼õÃí´ÉÍý';
+		global $arrMAILTEMPLATE;
+		$this->arrMAILTEMPLATE = $arrMAILTEMPLATE;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;	
+	}
+}
+
+$objPage->tpl_order_id = $_POST['order_id'];
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+
+switch($_POST['mode']) {
+case 'pre_edit':
+	break;
+case 'return':
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($_POST);
+	break;
+case 'send':
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($_POST);
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = $objFormParam->checkerror();
+	// ¥á¡¼¥ë¤ÎÁ÷¿®
+	if (count($objPage->arrErr) == 0) {
+		// ÃíÊ¸¼õÉÕ¥á¡¼¥ë
+		sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer']);
+	}
+	header("Location: " . URL_SEARCH_ORDER);
+	exit;
+	break;	
+case 'confirm':
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setParam($_POST);
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	// ÆþÎÏÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrHidden = $objFormParam->getHashArray();
+	$objPage->arrErr = $objFormParam->checkerror();
+	// ¥á¡¼¥ë¤ÎÁ÷¿®
+	if (count($objPage->arrErr) == 0) {
+		// ÃíÊ¸¼õÉÕ¥á¡¼¥ë(Á÷¿®¤Ê¤·)
+		$objSendMail = sfSendOrderMail($_POST['order_id'], $_POST['template_id'], $_POST['subject'], $_POST['header'], $_POST['footer'], false);
+		// ³ÎÇ§¥Ú¡¼¥¸¤ÎÉ½¼¨
+		$objPage->tpl_subject = $objSendMail->subject;
+		$objPage->tpl_body = $objSendMail->body;
+		$objPage->tpl_to = $objSendMail->tpl_to;
+		$objPage->tpl_mainpage = 'order/mail_confirm.tpl';
+		
+		$objView->assignobj($objPage);
+		$objView->display(MAIN_FRAME);
+		
+		exit;	
+	}
+	break;
+case 'change':
+	// POSTÃÍ¤Î¼èÆÀ
+	$objFormParam->setValue('template_id', $_POST['template_id']);
+	if(sfIsInt($_POST['template_id'])) {
+		$objQuery = new SC_Query();
+		$where = "template_id = ?";
+		$arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($_POST['template_id']));
+		$objFormParam->setParam($arrRet[0]);
+	}
+	break;
+}
+
+$objQuery = new SC_Query();
+$col = "send_date, subject, template_id, send_id";
+$where = "order_id = ?";
+$objQuery->setorder("send_date DESC");
+
+if(sfIsInt($_POST['order_id'])) {
+	$objPage->arrMailHistory = $objQuery->select($col, "dtb_mail_history", $where, array($_POST['order_id']));
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥È", "template_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¿¥¤¥È¥ë", "subject", STEXT_LEN, "KVa",  array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
+	$objFormParam->addParam("¥Ø¥Ã¥À¡¼", "header", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
+	$objFormParam->addParam("¥Õ¥Ã¥¿¡¼", "footer", LTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
+}
Index: /temp/tags/eccube-0_9_2beta/html/admin/order/status.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/order/status.php	(revision 2685)
+++ /temp/tags/eccube-0_9_2beta/html/admin/order/status.php	(revision 2685)
@@ -0,0 +1,151 @@
+<?php
+require_once("../require.php");
+require_once("./index_csv.php");
+
+//¥¹¥Æ¡¼¥¿¥¹´ÉÍý-°ì³ç°ÜÆ°µ¡Ç½
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/status.tpl';
+		$this->tpl_subnavi = 'order/subnavi.tpl';
+		$this->tpl_mainno = 'order';
+		$this->tpl_subno = 'status';
+		global $arrORDERSTATUS;
+		global $arrORDERSTATUS_COLOR;
+		$this->arrORDERSTATUS = $arrORDERSTATUS;
+		$this->arrORDERSTATUS_COLOR = $arrORDERSTATUS_COLOR;
+		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+//¥¹¥Æ¡¼¥¿¥¹¾ðÊó¡Ê²¾Äê¡Ë
+$objPage->SelectedStatus = $_POST['status'];
+$objPage->arrForm = $_POST;
+					
+//»ÙÊ§ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+
+switch ($_POST['mode']){
+	
+	case 'search':
+	
+		switch($_POST['change_status']){
+				
+				default:
+				break;
+			
+				//¿·µ¬¼õÉÕ
+				case '1':
+					lfStatusMove(1,$_POST['move']);
+				break;
+				
+				//Æþ¶âÂÔ¤Á
+				case '2':
+					lfStatusMove(2,$_POST['move']);
+				break;
+				
+				//¥­¥ã¥ó¥»¥ë
+				case '3':
+					lfStatusMove(3,$_POST['move']);
+				break;
+				
+				//¼è¤ê´ó¤»Ãæ
+				case '4':
+					lfStatusMove(4,$_POST['move']);
+				break;
+				
+				//È¯Á÷ºÑ¤ß
+				case '5':
+					lfStatusMove(5,$_POST['move']);
+				break;
+				
+				//ºï½ü
+				case 'delete':
+					lfStatusMove("delete",$_POST['move']);
+				break;
+			}
+	
+	//¸¡º÷·ë²Ì¤ÎÉ½¼¨
+	lfStatusDisp($_POST['status'],$_POST['search_pageno']);
+	break;
+	
+	default:
+	//¥Ç¥Õ¥©¥ë¥È¤Ç¿·µ¬¼õÉÕ°ìÍ÷É½¼¨
+	lfStatusDisp(1,$_POST['search_pageno']);
+	$objPage->defaultstatus = 1;
+	break;
+	}
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+//¥¹¥Æ¡¼¥¿¥¹°ìÍ÷¤ÎÉ½¼¨
+function lfStatusDisp($status,$pageno){
+	global $objPage;
+	global $objQuery;
+	
+	$select ="*";
+	$from = "dtb_order";
+	$where="delete=0 AND status=?";
+	$order = "order_id DESC";
+	
+	$linemax = $objQuery->count("dtb_order", "delete = 0 AND status=?", array($status));
+	$objPage->tpl_linemax = $linemax;
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	$page_max = ORDER_STATUS_MAX;
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($pageno, $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	$objPage->tpl_pageno = $pageno;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+	
+	//É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	
+	//¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrStatus = $objQuery->select($select, $from, $where, array($status));
+	
+	return $objPage;
+}
+
+//¥¹¥Æ¡¼¥¿¥¹¾ðÊó¤Î¹¹¿·¡Ê°ÜÆ°¡Ë
+function lfStatusMove($status_id,$move){
+	global $objQuery;
+	global $objPage;
+	
+	if ($status_id == 'delete'){
+		$sql="UPDATE dtb_order SET delete=1";
+	}elseif ($status_id == 5){
+		$sql="UPDATE dtb_order SET status=".$status_id.",commit_date=now() ";
+	}else{
+		$sql="UPDATE dtb_order SET status=".$status_id." ";
+	}
+		$sql.="WHERE order_id=?";
+		if (isset($move)){
+			foreach ($move as $val){
+			if ($val != "") {
+				$objQuery->exec($sql, array($val));
+			}
+			$objPage->tpl_onload = "window.alert('ÁªÂò¹àÌÜ¤ò°ÜÆ°¤·¤Þ¤·¤¿¡£');";
+			}
+		}
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/order/edit.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/order/edit.php	(revision 2609)
+++ /temp/tags/eccube-0_9_2beta/html/admin/order/edit.php	(revision 2609)
@@ -0,0 +1,318 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'order/edit.tpl';
+		$this->tpl_subnavi = 'order/subnavi.tpl';
+		$this->tpl_mainno = 'order';		
+		$this->tpl_subno = 'index';
+		$this->tpl_subtitle = '¼õÃí´ÉÍý';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrORDERSTATUS;
+		$this->arrORDERSTATUS = $arrORDERSTATUS;
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objSiteInfo = new SC_SiteInfo();
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¸¡º÷¥Ñ¥é¥á¡¼¥¿¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrSearchHidden[$key] = $val;
+	}
+}
+
+// É½¼¨¥â¡¼¥ÉÈ½Äê
+if(sfIsInt($_GET['order_id'])) {
+	$objPage->disp_mode = true;
+	$order_id = $_GET['order_id'];
+} else {
+	$order_id = $_POST['order_id'];
+}
+$objPage->tpl_order_id = $order_id;
+
+// DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
+lfGetOrderData($order_id);
+
+switch($_POST['mode']) {
+case 'pre_edit':
+case 'order_id':
+	break;
+case 'edit':
+	// POST¾ðÊó¤Ç¾å½ñ¤­
+	$objFormParam->setParam($_POST);
+	
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfCheek($arrInfo);
+		if(count($objPage->arrErr) == 0) {
+			lfRegistData($_POST['order_id']);
+			// DB¤«¤é¼õÃí¾ðÊó¤òºÆÆÉ¹þ
+			lfGetOrderData($order_id);
+			$objPage->tpl_onload = "window.alert('¼õÃíÍúÎò¤òÊÔ½¸¤·¤Þ¤·¤¿¡£');";
+		}
+	}
+	break;
+// ºÆ·×»»
+case 'cheek':
+	// POST¾ðÊó¤Ç¾å½ñ¤­
+	$objFormParam->setParam($_POST);
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($arrRet);
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfCheek($arrInfo);
+	}
+	break;
+default:
+	break;
+}
+
+// »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ
+$objPage->arrPayment = sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
+// ÇÛÁ÷»þ´Ö¤Î¼èÆÀ
+$arrRet = sfGetDelivTime($objFormParam->getValue('payment_id'));
+$objPage->arrDelivTime = sfArrKeyValue($arrRet, 'time_id', 'time');
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objPage->arrInfo = $arrInfo;
+$objView->assignobj($objPage);
+// É½¼¨¥â¡¼¥ÉÈ½Äê
+if(!$objPage->disp_mode) {
+	$objView->display(MAIN_FRAME);
+} else {
+	$objView->display('order/disp.tpl');
+}
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	// ÇÛÁ÷Àè¾ðÊó
+	$objFormParam->addParam("¤ªÌ¾Á°1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ªÌ¾Á°2", "deliv_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê1", "deliv_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Õ¥ê¥¬¥Ê2", "deliv_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ1", "deliv_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("Í¹ÊØÈÖ¹æ2", "deliv_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objFormParam->addParam("ÅÔÆ»ÉÜ¸©", "deliv_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("½»½ê1", "deliv_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("½»½ê2", "deliv_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ1", "deliv_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	$objFormParam->addParam("ÅÅÏÃÈÖ¹æ3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+	// ¼õÃí¾¦ÉÊ¾ðÊó
+	$objFormParam->addParam("ÃÍ°ú¤­", "discount", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("Á÷ÎÁ", "deliv_fee", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("¼ê¿ôÎÁ", "charge", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÍøÍÑ¥Ý¥¤¥ó¥È", "use_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¤ª»ÙÊ§¤¤ÊýË¡", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÇÛÁ÷»þ´ÖID", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÂÐ±þ¾õ¶·", "status", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÇÛÃ£Æü", "deliv_date", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¤ª»ÙÊ§ÊýË¡Ì¾¾Î", "payment_method");
+	$objFormParam->addParam("ÇÛÁ÷»þ´Ö", "deliv_time");
+	
+	// ¼õÃí¾ÜºÙ¾ðÊó
+	$objFormParam->addParam("Ã±²Á", "price", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("¸Ä¿ô", "quantity", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("¾¦ÉÊID", "product_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+	$objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨", "point_rate");
+	$objFormParam->addParam("¾¦ÉÊ¥³¡¼¥É", "product_code");
+	$objFormParam->addParam("¾¦ÉÊÌ¾", "product_name");
+	$objFormParam->addParam("µ¬³Ê1", "classcategory_id1");
+	$objFormParam->addParam("µ¬³Ê2", "classcategory_id2");
+	$objFormParam->addParam("µ¬³ÊÌ¾1", "classcategory_name1");
+	$objFormParam->addParam("µ¬³ÊÌ¾2", "classcategory_name2");
+	$objFormParam->addParam("¥á¥â", "note", MTEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
+	// DBÆÉ¹þÍÑ
+	$objFormParam->addParam("¾®·×", "subtotal");
+	$objFormParam->addParam("¹ç·×", "total");
+	$objFormParam->addParam("»ÙÊ§¤¤¹ç·×", "payment_total");
+	$objFormParam->addParam("²Ã»»¥Ý¥¤¥ó¥È", "add_point");
+	$objFormParam->addParam("¤ªÃÂÀ¸Æü¥Ý¥¤¥ó¥È", "birth_point");
+	$objFormParam->addParam("¾ÃÈñÀÇ¹ç·×", "tax");
+	$objFormParam->addParam("ºÇ½ªÊÝ»ý¥Ý¥¤¥ó¥È", "total_point");
+	$objFormParam->addParam("¸ÜµÒID", "customer_id");
+	$objFormParam->addParam("¸½ºß¤Î¥Ý¥¤¥ó¥È", "point");
+}
+
+function lfGetOrderData($order_id) {
+	global $objFormParam;
+	global $objPage;
+	if(sfIsInt($order_id)) {
+		// DB¤«¤é¼õÃí¾ðÊó¤òÆÉ¤ß¹þ¤à
+		$objQuery = new SC_Query();
+		$where = "order_id = ?";
+		$arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
+		$objFormParam->setParam($arrRet[0]);
+		list($point, $total_point) = sfGetCustomerPoint($order_id, $arrRet[0]['use_point'], $arrRet[0]['add_point']);
+		$objFormParam->setValue('total_point', $total_point);
+		$objFormParam->setValue('point', $point);
+		$objPage->arrDisp = $arrRet[0];
+		// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+		$arrRet = lfGetOrderDetail($order_id);
+		$arrRet = sfSwapArray($arrRet);
+		$objPage->arrDisp = array_merge($objPage->arrDisp, $arrRet);
+		$objFormParam->setParam($arrRet);
+	}
+}
+
+// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+function lfGetOrderDetail($order_id) {
+	$objQuery = new SC_Query();
+	$col = "product_id, classcategory_id1, classcategory_id2, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
+	$where = "order_id = ?";
+	$objQuery->setorder("classcategory_id1, classcategory_id2");
+	$arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
+	return $arrRet;
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	return $objErr->arrErr;
+}
+
+/* ·×»»½èÍý */
+function lfCheek($arrInfo) {
+	global $objFormParam;
+		
+	$arrVal = $objFormParam->getHashArray();
+			
+	// ¾¦ÉÊ¤Î¼ïÎà¿ô
+	$max = count($arrVal['quantity']);
+	$subtotal = 0;
+	$totalpoint = 0;
+	$totaltax = 0;
+	for($i = 0; $i < $max; $i++) {
+		// ¾®·×¤Î·×»»
+		$subtotal += sfPreTax($arrVal['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']) * $arrVal['quantity'][$i];
+		// ¾®·×¤Î·×»»
+		$totaltax += sfTax($arrVal['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']) * $arrVal['quantity'][$i];
+		// ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»»
+		$totalpoint += sfPrePoint($arrVal['price'][$i], $arrVal['point_rate'][$i]) * $arrVal['quantity'][$i];
+	}
+	
+	// ¾ÃÈñÀÇ
+	$arrVal['tax'] = $totaltax;	
+	// ¾®·×
+	$arrVal['subtotal'] = $subtotal;
+	// ¹ç·×
+	$arrVal['total'] = $subtotal - $arrVal['discount'] + $arrVal['deliv_fee'] + $arrVal['charge'];
+	// ¤ª»ÙÊ§¤¤¹ç·×
+	$arrVal['payment_total'] = $arrVal['total'] - ($arrVal['use_point'] * POINT_VALUE);
+	
+	// ²Ã»»¥Ý¥¤¥ó¥È
+	$arrVal['add_point'] = sfGetAddPoint($totalpoint, $arrVal['use_point'], $arrInfo);
+		
+	list($arrVal['point'], $arrVal['total_point']) = sfGetCustomerPoint($_POST['order_id'], $arrVal['use_point'], $arrVal['add_point']);
+		
+	if($arrVal['total'] < 0) {
+		$arrErr['total'] = '¹ç·×³Û¤¬¥Þ¥¤¥Ê¥¹É½¼¨¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤ËÄ´À°¤·¤Æ²¼¤µ¤¤¡£<br />';
+	}
+	
+	if($arrVal['payment_total'] < 0) {
+		$arrErr['payment_total'] = '¤ª»ÙÊ§¤¤¹ç·×³Û¤¬¥Þ¥¤¥Ê¥¹É½¼¨¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤ËÄ´À°¤·¤Æ²¼¤µ¤¤¡£<br />';
+	}
+
+	if($arrVal['total_point'] < 0) {
+		$arrErr['total_point'] = 'ºÇ½ªÊÝ»ý¥Ý¥¤¥ó¥È¤¬¥Þ¥¤¥Ê¥¹É½¼¨¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤ËÄ´À°¤·¤Æ²¼¤µ¤¤¡£<br />';
+	}
+
+	$objFormParam->setParam($arrVal);
+	return $arrErr;
+}
+
+/* DBÅÐÏ¿½èÍý */
+function lfRegistData($order_id) {
+	global $objFormParam;
+	$objQuery = new SC_Query();
+	
+	$objQuery->begin();
+
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	
+	foreach($arrRet as $key => $val) {
+		// ÇÛÎó¤ÏÅÐÏ¿¤·¤Ê¤¤
+		if(!is_array($val)) {
+			$sqlval[$key] = $val;
+		}
+	}
+	
+	unset($sqlval['total_point']);
+	unset($sqlval['point']);
+			
+	$where = "order_id = ?";
+	
+	// ¼õÃí¥¹¥Æ¡¼¥¿¥¹¤ÎÈ½Äê
+	if ($sqlval['status'] == ODERSTATUS_COMMIT) {
+		// ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÈ¯Á÷ºÑ¤ßÆü¤ò¹¹¿·¤¹¤ë
+		$addcol['commit_date'] = "Now()";
+	}
+	
+	// ¼õÃí¥Æ¡¼¥Ö¥ë¤Î¹¹¿·
+	$objQuery->update("dtb_order", $sqlval, $where, array($order_id), $addcol);
+
+	$sql = "";
+	$sql .= " UPDATE";
+	$sql .= "     dtb_order";
+	$sql .= " SET";
+	$sql .= "     payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = ?)";
+	$sql .= "     ,deliv_time = (SELECT time FROM dtb_delivtime WHERE time_id = ? AND deliv_id = (SELECT deliv_id FROM dtb_payment WHERE payment_id = ? ))";
+	$sql .= " WHERE order_id = ?";
+	
+	if ($arrRet['deliv_time_id'] == "") {
+		$deliv_time_id = 0;
+	}else{
+		$deliv_time_id = $arrRet['deliv_time_id'];
+	}
+	$arrUpdData = array($arrRet['payment_id'], $deliv_time_id, $arrRet['payment_id'], $order_id);
+	$objQuery->query($sql, $arrUpdData);
+
+	// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¹¹¿·
+	$arrDetail = $objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2"));
+	$objQuery->delete("dtb_order_detail", $where, array($order_id));
+	
+	$max = count($arrDetail);
+	for($i = 0; $i < $max; $i++) {
+		$sqlval = array();
+		$sqlval['order_id'] = $order_id;
+		$sqlval['product_id']  = $arrDetail[$i]['product_id'];
+		$sqlval['product_code']  = $arrDetail[$i]['product_code'];
+		$sqlval['product_name']  = $arrDetail[$i]['product_name'];
+		$sqlval['price']  = $arrDetail[$i]['price'];
+		$sqlval['quantity']  = $arrDetail[$i]['quantity'];
+		$sqlval['point_rate']  = $arrDetail[$i]['point_rate'];
+		$sqlval['classcategory_id1'] = $arrDetail[$i]['classcategory_id1'];
+		$sqlval['classcategory_id2'] = $arrDetail[$i]['classcategory_id2'];
+		$sqlval['classcategory_name1'] = $arrDetail[$i]['classcategory_name1'];
+		$sqlval['classcategory_name2'] = $arrDetail[$i]['classcategory_name2'];		
+		$objQuery->insert("dtb_order_detail", $sqlval);
+	}
+	$objQuery->commit();
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/home.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/home.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/home.php	(revision 1328)
@@ -0,0 +1,155 @@
+<?php
+
+require_once("./require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'home.tpl';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¸½ºß¤Î²ñ°÷¿ô
+$objPage->customer_cnt = lfGetCustomerCnt($conn);
+
+// ºòÆü¤ÎÇä¾å¹â
+$objPage->order_yesterday_amount = lfGetOrderYesterday($conn, "SUM");
+
+// ºòÆü¤ÎÇä¾å·ï¿ô
+$objPage->order_yesterday_cnt = lfGetOrderYesterday($conn, "COUNT");
+
+// º£·î¤ÎÇä¾å¹â
+$objPage->order_month_amount = lfGetOrderMonth($conn, "SUM");
+
+// º£·î¤ÎÇä¾å·ï¿ô
+$objPage->order_month_cnt = lfGetOrderMonth($conn, "COUNT");
+
+// ¸ÜµÒ¤ÎÎß·×¥Ý¥¤¥ó¥È
+$objPage->customer_point = lfGetTotalCustomerPoint();
+
+//ºòÆü¤Î¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ß¿ô
+$objPage->review_yesterday_cnt = lfGetReviewYesterday($conn);
+
+//¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ßÈóÉ½¼¨¿ô
+$objPage->review_nondisp_cnt = lfGetReviewNonDisp($conn);
+
+// ÉÊÀÚ¤ì¾¦ÉÊ
+$objPage->arrSoldout = lfGetSoldOut();
+
+// ¿·µ¬¼õÉÕ°ìÍ÷
+$objPage->arrNewOrder = lfGetNewOrder();
+
+// ¤ªÃÎ¤é¤»°ìÍ÷¤Î¼èÆÀ
+$objPage->arrInfo = lfGetInfo();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//---------------------------------------------------------
+
+// ²ñ°÷¿ô
+function lfGetCustomerCnt($conn){
+	
+	$sql = "SELECT COUNT(customer_id) FROM dtb_customer WHERE delete = 0 AND status = 2";
+	$return = $conn->getOne($sql);
+	return $return;
+}
+
+// ºòÆü¤ÎÇä¾å¹â¡¦Çä¾å·ï¿ô
+function lfGetOrderYesterday($conn, $method){
+	if ( $method == 'SUM' or $method == 'COUNT'){
+		$sql = "SELECT ".$method."(total) FROM dtb_order
+				 WHERE delete = 0 AND to_char(create_date,'YYYY/MM/DD') = to_char(now() - interval '1 days','YYYY/MM/DD')";
+		$return = $conn->getOne($sql);
+	}
+	return $return;
+}
+
+function lfGetOrderMonth($conn, $method){
+
+	$month = date("Y/m", mktime());
+	
+	if ( $method == 'SUM' or $method == 'COUNT'){
+		$sql = "SELECT ".$method."(total) FROM dtb_order
+				 WHERE delete = 0 AND to_char(create_date,'YYYY/MM') = ? 
+				 AND to_char(create_date,'YYYY/MM/DD') <> to_char(now(),'YYYY/MM/DD')";
+		$return = $conn->getOne($sql, array($month));
+	}
+	return $return;
+}
+
+function lfGetTotalCustomerPoint() {
+	$objQuery = new SC_Query();
+	$col = "SUM(point)";
+	$where = "delete = 0";
+	$from = "dtb_customer";
+	$ret = $objQuery->get($from, $col, $where);
+	return $ret;	
+}
+
+function lfGetReviewYesterday($conn){
+	$sql = "SELECT COUNT (*) FROM dtb_review 
+			 WHERE delete=0 AND to_char(create_date, 'YYYY/MM/DD') = to_char(now() - interval '1 days','YYYY/MM/DD')
+			 AND to_char(create_date,'YYYY/MM/DD') != to_char(now(),'YYYY/MM/DD')";
+	$return = $conn->getOne($sql);
+	return $return;
+}
+
+function lfGetReviewNonDisp($conn){
+	$sql = "SELECT COUNT (*) FROM dtb_review WHERE delete=0 AND status=2";
+	$return = $conn->getOne($sql);
+	return $return;
+}
+
+// ÉÊÀÚ¤ì¾¦ÉÊÈÖ¹æ¤Î¼èÆÀ
+function lfGetSoldOut() {
+	$objQuery = new SC_Query();
+	$where = "product_id IN (SELECT product_id FROM dtb_products_class WHERE stock_unlimited IS NULL AND stock <= 0)";
+	$arrRet = $objQuery->select("product_id, name", "dtb_products", $where);
+	return $arrRet;
+}
+
+// ¿·µ¬¼õÉÕ°ìÍ÷
+function lfGetNewOrder() {
+	$objQuery = new SC_Query();
+	$col = "ord.order_id, customer_id, (ord.order_name01 || ' ' || ord.order_name02) AS name, ord.total, ";
+	$col.= "(SELECT det.product_name FROM dtb_order_detail AS det WHERE ord.order_id = det.order_id LIMIT 1) AS product_name, ";
+	$col.= "(SELECT pay.payment_method FROM dtb_payment AS pay WHERE ord.payment_id = pay.payment_id) AS payment_method, ";	
+	$col.= "to_char(create_date, 'YYYY/MM/DD HH24:MI') AS create_date";
+	$from = "dtb_order AS ord";
+	$where = "delete = 0";
+	$objQuery->setoption("ORDER BY create_date DESC LIMIT 10 OFFSET 0");
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+// ¤ªÃÎ¤é¤»¼èÆÀ
+function lfGetInfo() {
+	// ¹¹¿·¾ðÊó¤òºÇ¿·¤Ë¤¹¤ë
+	$objQuery = new SC_Query();
+	$path = UPDATE_HTTP . "info.txt";
+	$fp = @fopen($path, "rb");
+	
+	$arrRet = array();
+	if(!$fp) {
+		sfErrorHeader(">> " . $path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+	} else {
+		while (!feof($fp)) {
+			$arrRet[] = $arrCSV = fgetcsv($fp, UPDATE_CSV_LINE_MAX);
+		}
+		fclose($fp);
+	}
+	
+	return $arrRet;
+}
+
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/error.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/error.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/error.php	(revision 1328)
@@ -0,0 +1,80 @@
+¡¡
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=EUC-JP" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="./css/contents.css" type="text/css" />
+<script type="text/javascript" src="./js/css.js"></script>
+<title>EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸</title>
+</head>
+
+<body bgcolor="#f3f3f3" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
+<noscript>
+<link rel="stylesheet" href="./css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<!--¢§HEADER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#bfbf9f" height="3" colspan="2"></td></tr>
+	<tr bgcolor="#dedecd">
+		<td height="40" width="365"><a href="./home.php"><img src="./misc/logo.gif" width="365" height="16" alt="EC¥µ¥¤¥È´ÉÍý¼Ô¥Ú¡¼¥¸" border="0" /></a></td>
+		<td width="415" align="right"><a href="./home.php" onmouseover="chgImg('./misc/home_on.gif','home');" onmouseout="chgImg('./misc/home.gif','home');"><img src="./misc/home.gif" width="70" height="20" alt="HOME" border="0" name="home" id="home" /></a><img src="./misc/_.gif" width="3" height="1" alt="" />
+		<a href="#" onmouseover="chgImg('./misc/hp_on.gif','hp');" onmouseout="chgImg('./misc/hp.gif','hp');" target="_blank"><img src="./misc/hp.gif" width="70" height="20" alt="HP¤ò¸«¤ë" border="0" name="hp" id="hp" /></a><img src="./misc/_.gif" width="3" height="1" alt="" />
+		<a href="./index.html" onmouseover="chgImg('./misc/logout_on.gif','logout');" onmouseout="chgImg('./misc/logout.gif','logout');"><img src="./misc/logout.gif" width="70" height="20" alt="¥í¥°¥¢¥¦¥È" border="0" name="logout" id="logout" /></a><img src="./misc/_.gif" width="20" height="1" alt="" /></td>
+	</tr>
+	<tr><td bgcolor="#ffffff" height="1" colspan="3"></td></tr>
+</table>
+<!--¢¥HEADER-->
+
+<!--¢§MAIN NAVI-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td><a href="./basis/index.php" onmouseover="chgImg('./misc/basis_on.gif','basis');" onmouseout="chgImg('./misc/basis.gif','basis');"><img src="./misc/basis.gif" width="108" height="26" alt="´ðËÜ¾ðÊó" border="0" name="basis" id="basis" /></a></td>
+		<td><a href="./product/index.php" onmouseover="chgImg('./misc/product_on.gif','product');" onmouseout="chgImg('./misc/product.gif','product');"><img src="./misc/product.gif" width="108" height="26" alt="¾¦ÉÊ´ÉÍý" border="0" name="product" id="product" /></a></td>
+		<td><a href="./customer/index.php" onmouseover="chgImg('./misc/customer_on.gif','customer');" onmouseout="chgImg('./misc/customer.gif','customer');"><img src="./misc/customer.gif" width="108" height="26" alt="¸ÜµÒ´ÉÍý" border="0" name="customer" id="customer" /></a></td>
+		<td><a href="./order/index.php" onmouseover="chgImg('./misc/order_on.gif','order');" onmouseout="chgImg('./misc/order.gif','order');"><img src="./misc/order.gif" width="108" height="26" alt="¼õÃí´ÉÍý" border="0" name="order" id="order" /></a></td>
+		<td><a href="./sales/index.php" onmouseover="chgImg('./misc/sales_on.gif','sales');" onmouseout="chgImg('./misc/sales.gif','sales');"><img src="./misc/sales.gif" width="108" height="26" alt="Çä¾å´ÉÍý" border="0" name="sales" id="sales" /></a></td>
+		<td><a href="./mail/index.php" onmouseover="chgImg('./misc/mail_on.gif','mail');" onmouseout="chgImg('./misc/mail.gif','mail');"><img src="./misc/mail.gif" width="108" height="26" alt="¥á¡¼¥ëÇÛ¿®" border="0" name="mail" id="mail" /></a></td>
+		<td><a href="./contents/index.php" onmouseover="chgImg('./misc/contents_on.gif','contents');" onmouseout="chgImg('./misc/contents.gif','contents');"><img src="./misc/contents.gif" width="132" height="26" alt="¥³¥ó¥Æ¥ó¥Ä´ÉÍý" border="0" name="contents" id="contents" /></a></td>
+	</tr>
+	<tr><td colspan="7" height="1" bgcolor="#dedecd"></td></tr>
+	<tr><td colspan="7" bgcolor="#ffffff" height="15"></td></tr>
+</table>
+<!--¢¥MAIN NAVI-->
+
+<!--¢§CONTENTS-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr>
+		<td height="350" bgcolor="#ffffff" align="center" valign="top">
+		<form name="form1" id="form1" method="post" action="">
+		<table width="600" border="0" cellspacing="0" cellpadding="0" summary=" ">
+			<tr><td height="30"></td></tr>
+			<tr>
+				<td height="20" class="fs12n"><span class="red">¤ª¼ê¿ô¤Ç¤¹¤¬¡¢²¼µ­¹àÌÜ¤òµ­Æþ¤Þ¤¿¤Ï½¤Àµ¤·¤Æ¤¯¤À¤µ¤¤¡£</span></td>
+			</tr>
+			<tr><td height="15"></td></tr>
+			<tr>
+				<td height="20" class="fs12">¤ªÌ¾Á°¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />
+				ÅÅÏÃÈÖ¹æ¤ÏÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£</td>
+			</tr>
+		</table>
+		<br />
+		<input type="button" name="subm" value="Ìá¤ë" onclick="#" />
+		</form>
+		</td>
+	</tr>
+</table>
+
+<!--¢§FOOTER-->
+<table width="780" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr><td bgcolor="#ffffff" height="60"></td></tr>
+	<tr><td bgcolor="#e5e5df" height="5"></td></tr>
+</table>
+<!--¢¥FOOTER-->
+</div>
+</body>
+</html>
Index: /temp/tags/eccube-0_9_2beta/html/admin/batch/daily.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/batch/daily.php	(revision 3625)
+++ /temp/tags/eccube-0_9_2beta/html/admin/batch/daily.php	(revision 3625)
@@ -0,0 +1,269 @@
+<?php
+
+$daily_php_dir = realpath(dirname( __FILE__));
+require_once($daily_php_dir . "/../require.php");
+
+$term = 0;
+$start = 1;	// ½¸·×´ü´Ö¤Ï¡¢$start¢·$term¤Î´Ö¤È¤Ê¤ë¡£ÄÌ¾ïÁ°ÆüÊ¬¤«¤é¡£
+$command = false;
+
+// ½¸·×ÂÐ¾Ý´ü´Ö¤Î¼èÆÀ¡Ê»ØÄêÆüÊ¬¤µ¤«¤Î¤Ü¤ë)
+if (sfIsInt($argv[1]) && $argv[1] <= 365) {
+	$term = $argv[1];
+	$command = true;
+}
+
+// ½¸·×³«»ÏÆü
+if (sfIsInt($argv[2]) && $argv[2] <= 365) {
+	$start = $argv[2];
+	$command = true;
+}
+
+if($term > 0) {
+	// ½¸·×¤Î³«»Ï
+	lfStartDailyTotal($term, $start, $command);
+}
+
+// ½¸·×¤Î³«»Ï
+function lfStartDailyTotal($term, $start, $command = false) {
+		
+	$now_time = time();
+		
+	// ¥°¥é¥Õ²èÁü¤Îºï½ü
+	$path = GRAPH_DIR . "*.png";
+	system ("rm -rf $path");
+	
+	// ºï½ü¤µ¤ì¤¿¼õÃí¥Ç¡¼¥¿¤Î¼õÃí¾ÜºÙ¾ðÊó¤Îºï½ü
+	$objQuery = new SC_Query();
+	$where = "order_id IN (SELECT order_id FROM dtb_order WHERE delete = 1)";
+	$objQuery->delete("dtb_order_detail", $where);
+	
+	// ºÇ¸å¤Ë¹¹¿·¤µ¤ì¤¿ÆüÉÕ¤ò¼èÆÀ
+	$ret = $objQuery->max("dtb_bat_order_daily", "create_date");
+	list($batch_last) = split("\.", $ret);
+	$pass = $now_time - strtotime($batch_last);
+		
+	// ºÇ¸å¤Î¥Ð¥Ã¥Á¼Â¹Ô¤«¤éLOAD_BATCH_PASSÉÃ·Ð²á¤·¤Æ¤¤¤Ê¤¤¤È¼Â¹Ô¤·¤Ê¤¤¡£
+	if($pass < LOAD_BATCH_PASS) {
+		gfPrintLog("LAST BATCH " . $arrRet[0]['create_date'] . " > " . $batch_pass . " -> EXIT BATCH $batch_date");
+		return;
+	}
+		
+	// ½¸·×
+	for ($i = $start; $i < $term; $i++) {
+		// ´ðËÜ»þ´Ö¤«¤é$iÆüÊ¬¤µ¤«¤Î¤Ü¤ë
+		$tmp_time = $now_time - ($i * 24 * 3600);
+				
+		$batch_date = date("Y/m/d", $tmp_time);
+		gfPrintLog("LOADING BATCH $batch_date");
+					
+		lfBatOrderDaily($tmp_time);
+		lfBatOrderDailyHour($tmp_time);
+		lfBatOrderAge($tmp_time);
+	}
+}
+
+// ¥ê¥¢¥ë¥¿¥¤¥à¤Ç½¸·×¤ò¼Â»Ü¤¹¤ë¡£½¸·×¤¬½ªÎ»¤·¤Æ¤¤¤ë¥ì¥³¡¼¥É¤Ï¼Â»Ü¤·¤Ê¤¤¡£
+/*
+	$sdate:YYYY-MM-DD hh:mm:ss·Á¼°¤ÎÆüÉÕ
+	$edate:YYYY-MM-DD hh:mm:ss·Á¼°¤ÎÆüÉÕ
+*/
+function lfRealTimeDailyTotal($sdate, $edate) {
+	$pass = strtotime($edate) - strtotime($sdate);
+	$loop = intval($pass / 86400);
+	
+	for($i = 0; $i <= $loop; $i++) {
+		$tmp_time = strtotime($sdate) + ($i * 86400);
+		$batch_date = date("Y/m/d H:i:s", $tmp_time);
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("order_date, create_date", "dtb_bat_order_daily", "order_date = ?", array($batch_date));
+		// ¤¹¤Ç¤Ë¥Ð¥Ã¥Á½èÍý¤¬½ªÎ»¤·¤Æ¤¤¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë¡£
+		if(count($arrRet) > 0) {
+			list($create_date) = split("\.", $arrRet[0]['create_date']);
+			list($order_date) = split("\.", $arrRet[0]['order_date']);
+			$create_time = strtotime($create_date);
+			$order_time = strtotime($order_date);
+			// ¥ª¡¼¥À¡¼³«»ÏÆü¤è¤ê°ìÆü°Ê¾å¸å¤Ë½¸·×¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï½¸·×¤·¤Ê¤ª¤µ¤Ê¤¤
+			if($order_time + 86400 < $create_time || $tmp_time > time()) {
+				gfPrintLog("EXIT BATCH $batch_date $tmp_time" . " " . time());
+				continue;
+			}
+		}
+		gfPrintLog("LOADING BATCH $batch_date");
+		lfBatOrderDaily($tmp_time);
+		lfBatOrderDailyHour($tmp_time);
+		lfBatOrderAge($tmp_time);
+	}
+}
+
+// ¥Ð¥Ã¥Á½¸·×ÍÑ¤ÎSQLÊ¸¤ò¼èÆÀ¤¹¤ë¡£
+function lfGetOrderDailySQL() {
+	$sql = "SELECT ";
+	$sql.= "COUNT(*) AS total_order, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE customer_id = 0)) AS nonmember, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE customer_id <> 0 GROUP BY customer_id)) AS member, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 1)) AS men, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 2)) AS women, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 1 AND customer_id <> 0)) AS men_member, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 1 AND customer_id = 0)) AS men_nonmember, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 2 AND customer_id <> 0)) AS women_member, ";
+	$sql.= "SUM((SELECT COUNT(*) WHERE order_sex = 2 AND customer_id = 0)) AS women_nonmember, ";
+	$sql.= "SUM(total) AS total, ";
+	$sql.= "int8(AVG(total)) AS total_average ";
+	$sql.= "FROM dtb_order AS T1 LEFT JOIN dtb_customer AS T2 USING ( customer_id ) ";
+	$sql.= "WHERE T1.delete = 0 AND T1.create_date BETWEEN ? AND ?";		// ¼õÃíºîÀ®Æü¤Ç¸¡º÷¤¹¤ë
+	return $sql;
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(ÆüÊÌ)
+function lfBatOrderDaily($time) {
+	global $arrWDAY;
+	
+	$sql = lfGetOrderDailySQL();
+	
+	// ½¸·×ÂÐ¾ÝÆü¤ò¼èÆÀ¤¹¤ë
+	$date = date("Y-m-d", $time);
+	
+	$start = $date . " 00:00:00";
+	$end = $date . " 23:59:59";
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->getall($sql, array($start, $end));	
+		
+	$sqlval = $arrRet[0];
+	
+	// ¶õÊ¸»ú¤ò"0"¤ËÊÑ´¹
+	foreach($sqlval as $key => $val) {
+		if ($val == "") {
+			$sqlval[$key] = "0";
+		}
+	}
+	
+	$sqlval['order_date'] = $start;
+	$sqlval['year'] = date("Y", $time);
+	$sqlval['month'] = date("m", $time);
+	$sqlval['day'] = date("d", $time);
+	$sqlval['wday'] = date("w", $time);
+	$sqlval['key_day'] = sprintf("%02d/%02d/%02d", substr($sqlval['year'],2), $sqlval['month'], $sqlval['day']);
+	$sqlval['key_month'] = sprintf("%02d/%02d", substr($sqlval['year'],2), $sqlval['month']);
+	$sqlval['key_year'] = sprintf("%d", $sqlval['year']);
+	$sqlval['key_wday'] = sprintf("%s", $arrWDAY[$sqlval['wday']]);
+	
+	$objQuery->delete("dtb_bat_order_daily", "order_date = ?", array($start));
+	$objQuery->insert("dtb_bat_order_daily", $sqlval);
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(»þ´ÖÊÌ) 
+function lfBatOrderDailyHour($time) {
+	
+	$sql = lfGetOrderDailySQL();
+	
+	// ½¸·×ÂÐ¾ÝÆü¤ò¼èÆÀ¤¹¤ë
+	$date = date("Y-m-d", $time);
+	$objQuery = new SC_Query();
+	
+	$start = $date . " 00:00:00";
+	$objQuery->delete("dtb_bat_order_daily_hour", "order_date = ?", array($start));
+	
+	// 1»þ´ÖËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i < 24; $i++) {
+		$sdate = sprintf("%s %02d:00:00", $date, $i);
+		$edate = sprintf("%s %02d:59:59", $date, $i);
+		$arrRet = $objQuery->getall($sql, array($sdate, $edate));
+		$sqlval = $arrRet[0];
+		// ¶õÊ¸»ú¤ò"0"¤ËÊÑ´¹
+		foreach($sqlval as $key => $val) {
+			if ($val == "") {
+				$sqlval[$key] = "0";
+			}
+		}
+		$sqlval['order_date'] = $start;
+		$sqlval['hour'] = "$i";
+		$objQuery->insert("dtb_bat_order_daily_hour", $sqlval);
+	}	
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(Ç¯ÎðÊÌ) 
+function lfBatOrderAge($time) {
+	
+	$age_loop = intval(BAT_ORDER_AGE / 10);
+	
+	// Ç¯Îð¤ÎÈÏ°Ï¤ò»ØÄê¤·¤Æ¥Ç¡¼¥¿Ãê½Ð
+	$sql.= "SELECT COUNT(*) AS order_count, SUM(total) AS total, int8(AVG(total)) AS total_average ";
+	$sql.= "FROM dtb_order ";
+	
+	// ½¸·×ÂÐ¾ÝÆü¤ò¼èÆÀ¤¹¤ë
+	$date = date("Y-m-d", $time);
+	
+	$start = $date . " 00:00:00";
+	$end = $date . " 23:59:59";
+	
+	$objQuery = new SC_Query();
+	$objQuery->delete("dtb_bat_order_daily_age", "order_date = ?", array($start));
+	
+	/* ²ñ°÷½¸·× */
+	
+	$base_where = "WHERE (create_date BETWEEN ? AND ?) AND customer_id <> 0 AND delete = 0 ";
+	$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
+	
+	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i <= $age_loop; $i++) {
+		$start_age = $i * 10;
+		$end_age = $start_age + 9;
+		if($i >= $age_loop) {
+			$end_age = 999;
+		}
+		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 1);
+	}
+	
+	// ÃÂÀ¸ÆüÆþÎÏ¤Ê¤·
+	$where = $base_where . " AND order_birth IS NULL ";
+	lfBatOrderAgeSub($sql . $where, $start, $end, NULL, NULL, 1);
+	
+	/* Èó²ñ°÷½¸·× */
+	
+	$base_where = "WHERE (create_date BETWEEN ? AND ?) AND customer_id = 0 AND delete = 0";
+	$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
+	
+	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i <= $age_loop; $i++) {
+		$start_age = $i * 10;
+		$end_age = $start_age + 9;
+		if($i >= $age_loop) {
+			$end_age = 999;
+		}
+		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 0);
+	}
+	
+	// ÃÂÀ¸ÆüÆþÎÏ¤Ê¤·
+	$where = $base_where . " AND order_birth IS NULL AND delete = 0";
+	lfBatOrderAgeSub($sql . $where, $start, $end, NULL, NULL, 0);	
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(Ç¯ÎðÊÌ) ÅÐÏ¿ÉôÊ¬
+function lfBatOrderAgeSub($sql, $start, $end, $start_age, $end_age, $member) {
+	$objQuery = new SC_Query();
+	
+	if($start_age != NULL || $end_age != NULL) {
+		$arrRet = $objQuery->getall($sql, array($start, $end, $start_age, $end_age));
+	} else {
+		$arrRet = $objQuery->getall($sql, array($start, $end));
+	}
+	$sqlval = $arrRet[0];
+	
+	// ¶õÊ¸»ú¤ò"0"¤ËÊÑ´¹
+	foreach($sqlval as $key => $val) {
+		if ($val == "") {
+			$sqlval[$key] = "0";
+		}
+	}
+		
+	$sqlval['order_date'] = $start;
+	$sqlval['start_age'] = "$start_age";
+	$sqlval['end_age'] = "$end_age";
+	$sqlval['member'] = "$member";
+
+	$objQuery->insert("dtb_bat_order_daily_age", $sqlval);
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/info.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/info.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/info.php	(revision 1328)
@@ -0,0 +1,12 @@
+<?php
+print($_SERVER['HTTPS']);	
+
+$val = "Now()";
+
+if(eregi("now\(\)", $val)) {
+	print("onaji");
+}
+
+phpinfo();
+	
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/template.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/template.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/template.php	(revision 1328)
@@ -0,0 +1,50 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $list_data;
+	var $arrMagazineType;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/template.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "template";
+		$this->tpl_subtitle = '¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if ( $_GET['mode'] == "delete" && sfCheckNumLength($_GET['id'])===true ){
+
+	// ¥á¡¼¥ëÃ´Åö¤Î²èÁü¤¬¤¢¤ì¤Ðºï½ü¤·¤Æ¤ª¤¯
+	$sql = "SELECT charge_image FROM dtb_mailmaga_template WHERE template_id = ?";
+	$result = $conn->getOne($sql, array($_GET["id"]));
+	if (strlen($result) > 0) {
+		@unlink(IMAGE_SAVE_DIR. $result);
+	}
+	
+	// ÅÐÏ¿ºï½ü
+	$sql = "UPDATE dtb_mailmaga_template SET delete = 1 WHERE template_id = ?";
+	$conn->query($sql, array($_GET['id']));
+	sfReload();
+}
+
+
+$sql = "SELECT *, to_char(create_date, 'YYYY/MM/DD HH24:MI') as disp_date FROM dtb_mailmaga_template WHERE delete = 0 ORDER BY create_date DESC";
+$objPage->list_data = $list_data = $conn->getAll($sql);
+$objPage->arrMagazineType = $arrMagazineTypeAll;
+
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/sendmail.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/sendmail.php	(revision 2143)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/sendmail.php	(revision 2143)
@@ -0,0 +1,161 @@
+<?php
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir."/../require.php");
+$conn = new SC_DbConn();
+$objSite = new SC_SiteInfo($conn);
+
+if($_GET['mode'] == 'now') {
+	//----¡¡Ì¤Á÷¿®¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+	$time_data = $conn->getAll( "SELECT send_id FROM dtb_send_history  WHERE complete_count = 0 AND delete = 0 ORDER BY send_id ASC, start_date ASC" );
+} else {
+	$sql = "SELECT send_id FROM dtb_send_history  ";
+	$sql.= "WHERE start_date  BETWEEN current_timestamp + '- 5 minutes' AND current_timestamp + '5 minutes' AND delete = 0 ORDER BY send_id ASC, start_date ASC";
+	//----¡¡30Ê¬Ëè¤ËCron¤¬Á÷¿®»þ´Ö¥Ç¡¼¥¿³ÎÇ§
+	$time_data = $conn->getAll($sql);
+}
+
+$count = count($time_data);
+
+if( $count > 0 ){
+	print("start sending <br />\n");
+} else {
+	print("not found <br />\n");
+	exit;
+}
+
+//---- ¥á¡¼¥ëÁ÷¿®
+for( $i = 0; $i < count( $time_data ); $i++ ) {
+
+	$sql = "SELECT * FROM dtb_send_customer WHERE send_id = ? AND (send_flag = 2 OR send_flag IS NULL)";
+	$list_data[] = $conn->getAll( $sql, array( $time_data[$i]["send_id"] ) );
+	
+	$sql = "SELECT * FROM dtb_send_history WHERE send_id = ?";
+	$mail_data[] = $conn->getAll( $sql, array(  $time_data[$i]["send_id"] ) );
+
+}
+
+//---- Á÷¿®·ë²Ì¥Õ¥é¥°ÍÑSQL
+$sql_flag ="UPDATE dtb_send_customer SET send_flag = ? WHERE send_id = ? AND customer_id = ?";
+$objMail = new GC_SendMail();
+
+//----¡¡¥á¡¼¥ëÀ¸À®¤ÈÁ÷¿®
+for( $i = 0; $i < count( $time_data ); $i++ ) {
+
+	for( $j = 0; $j < count( $list_data[$i] ); $j ++ ) {
+
+		$customerName = "";
+		$mailBody = "";
+		$sendFlag = "";
+
+		//-- ¸ÜµÒÌ¾¤ÎÊÑ´¹
+		$name = trim($list_data[$i][$j]["name"]);
+		
+		if ($name == "") {
+			$name = "¤ªµÒ";
+		}
+		
+		$customerName = htmlspecialchars($name);
+		$subjectBody = ereg_replace( "{name}", $customerName , $mail_data[$i][0]["subject"] );
+		$mailBody = ereg_replace( "{name}", $customerName ,  $mail_data[$i][0]["body"] );
+
+		//-- ¥Æ¥­¥¹¥È¥á¡¼¥ëÇÛ¿®¤Î¾ì¹ç	
+		if( $mail_data[$i][0]["mail_method"] == 2 ) {
+
+			$sendResut = MAIL_SENDING(
+										 $list_data[$i][$j]["email"]				//¡¡¸ÜµÒ°¸Àè
+										,$subjectBody								//¡¡Subject
+										,$mailBody									//¡¡¥á¡¼¥ëËÜÊ¸
+										,$objSite->data["email03"]					//¡¡Á÷¿®¸µ¥á¡¼¥ë¥¢¥É¥ì¥¹
+										,$objSite->data["company_name"]				//¡¡Á÷¿®¸µÌ¾
+										,$objSite->data["email03"]					//¡¡reply_to
+										,$objSite->data["email04"]					//¡¡return_path
+										,$objSite->data["email04"]					//¡¡errors_to
+																			 );
+
+		//--  HTML¥á¡¼¥ëÇÛ¿®¤Î¾ì¹ç	
+		} elseif( $mail_data[$i][0]["mail_method"] == 1 || $mail_data[$i][0]["mail_method"] == 3) {
+			
+			$sendResut = HTML_MAIL_SENDING(
+											 $list_data[$i][$j]["email"]
+											,$subjectBody
+											,$mailBody
+											,$objSite->data["email03"]					//¡¡Á÷¿®¸µ¥á¡¼¥ë¥¢¥É¥ì¥¹
+											,$objSite->data["company_name"]				//¡¡Á÷¿®¸µÌ¾
+											,$objSite->data["email03"]					//¡¡reply_to
+											,$objSite->data["email04"]					//¡¡return_path
+											,$objSite->data["email04"]					//¡¡errors_to
+																	 );
+		}
+
+	
+		//-- Á÷¿®´°Î»¤Ê¤é1¡¢¼ºÇÔ¤Ê¤é0¤ò¥á¡¼¥ëÁ÷¿®·ë²Ì¥Õ¥é¥°¤È¤·¤ÆDB¤ËÁÞÆþ
+		if( ! $sendResut ){
+			 $sendFlag = "-1";
+		} else {
+			$sendFlag = "1";
+			
+			// ´°Î»¤ò1¤³Áý¤ä¤¹
+			$sql = "UPDATE dtb_send_history SET complete_count = complete_count + 1 WHERE send_id = ?";
+			$conn->query( $sql, array($mail_data[$i][0]["send_id"]) );
+		}
+
+		$conn->query( $sql_flag, array( $sendFlag, $mail_data[$i][0]["send_id"], $list_data[$i][$j]["customer_id"] ) );
+		
+		
+
+	}
+
+	//--- ¥á¡¼¥ëÁ´·ïÁ÷¿®´°Î»¸å¤Î½èÍý
+	$completeSql = "UPDATE dtb_send_history SET end_date = now() WHERE send_id = ?";
+	$conn->query( $completeSql, array( $time_data[$i]["send_id"] ) );
+
+	//---¡¡Á÷¿®´°Î»¡¡Êó¹ð¥á¡¼¥ë
+	$compData =  date("YÇ¯m·îdÆüH»þiÊ¬" . "  ²¼µ­¥á¡¼¥ë¤ÎÇÛ¿®¤¬´°Î»¤·¤Þ¤·¤¿¡£" );
+	MAIL_SENDING(
+					 $objSite->data["email03"]	
+					,$compData
+					,$mail_data[$i][0]["body"]
+					,$objSite->data["email03"]					//¡¡Á÷¿®¸µ¥á¡¼¥ë¥¢¥É¥ì¥¹
+					,$objSite->data["company_name"]				//¡¡Á÷¿®¸µÌ¾
+					,$objSite->data["email03"]					//¡¡reply_to
+					,$objSite->data["email04"]					//¡¡return_path
+					,$objSite->data["email04"]					//¡¡errors_to
+				 );
+	
+	if ($_GET['mode'] = "now") {
+		header("Location: /admin/mail/history.php");
+	}
+	echo "complete\n";
+
+}
+
+
+//--- ¥Æ¥­¥¹¥È¥á¡¼¥ëÇÛ¿®
+function MAIL_SENDING( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
+
+
+	$mail_obj = new GC_SendMail();	
+	$mail_obj->setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc );
+		
+	if( $mail_obj->sendMail() ) {
+		return true;
+	}
+	
+}
+
+//--- HTML¥á¡¼¥ëÇÛ¿®
+function HTML_MAIL_SENDING( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
+
+
+	$html_mail_obj = new GC_SendMail();
+	$html_mail_obj->setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc );
+
+			
+	if( $html_mail_obj->sendHtmlMail() ) {
+		return true;	
+	}
+	
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/history.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/history.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/history.php	(revision 1328)
@@ -0,0 +1,62 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/history.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "history";
+		$this->tpl_subtitle = 'ÇÛ¿®ÍúÎò';
+	}
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objDate = new SC_Date();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ºï½ü»þ
+if ( sfCheckNumLength($_GET['send_id']) && ($_GET['mode']=='delete') ){
+	
+	$sql = "UPDATE dtb_send_history SET delete = 1 WHERE send_id = ?";
+	$conn->query($sql, array($_GET['send_id']) );
+	sfReload();
+
+}	
+	$col = "*";
+	$from = "dtb_send_history";
+	
+	$where .= " delete = ?";
+	$arrval[] = 0;
+	
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, SEARCH_PMAX, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+	
+	// É½¼¨½ç½ø
+	$order = "start_date DESC, send_id DESC";
+	$objQuery->setorder($order);
+	
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrDataList = $objQuery->select($col, $from, $where, $arrval);
+	
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/preview.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/preview.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/preview.php	(revision 1328)
@@ -0,0 +1,96 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $body;
+	var $list_data;
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/preview.tpl';
+	}
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objDate = new SC_Date();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+if ( $_POST['body'] ){
+	$objPage->body = $_POST['body'];
+
+// HTML¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¤Î¥×¥ì¥Ó¥å¡¼
+} elseif ($_REQUEST["method"] == "template" && sfCheckNumLength($_REQUEST['id'])) {
+
+	$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?";
+	$result = $conn->getAll($sql, array($_REQUEST["id"]));
+	$objPage->list_data = $result[0];
+	
+	//¥á¡¼¥ëÃ´Åö¼Ì¿¿¤ÎÉ½¼¨
+	$objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+	$objUpFile->addFile("¥á¡¼¥ëÃ´Åö¼Ì¿¿", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+	$objUpFile->setDBFileList($objPage->list_data);
+	// FormÍÑÇÛÎó¤òÅÏ¤¹¡£
+	$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+	
+	// ¥á¥¤¥ó¾¦ÉÊ¤Î¾ðÊó¼èÆÀ
+	$sql = "SELECT name, main_image, point_rate, deliv_fee, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
+	$main = $conn->getAll($sql, array($objPage->list_data["main_product_id"]));
+	$objPage->list_data["main"] = $main[0];
+
+	// ¥µ¥Ö¾¦ÉÊ¤Î¾ðÊó¼èÆÀ
+	$sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
+	$k = 0;
+	$l = 0;
+	for ($i = 1; $i <= 12; $i ++) {
+		if ($l == 4) {
+			$l = 0;
+			$k ++;
+		}
+		$result = "";
+		$j = sprintf("%02d", $i);
+		if ($i > 0 && $i < 5 ) $k = 0;
+		if ($i > 4 && $i < 9 ) $k = 1;
+		if ($i > 8 && $i < 13 ) $k = 2;	
+		
+		if (is_numeric($objPage->list_data["sub_product_id" .$j])) {
+			$result = $conn->getAll($sql, array($objPage->list_data["sub_product_id" .$j]));
+			$objPage->list_data["sub"][$k][$l] = $result[0];
+			$objPage->list_data["sub"][$k]["data_exists"] = "OK";	//Åö³ºÃÊ¤Ë¥Ç¡¼¥¿¤¬£±¤Ä°Ê¾åÂ¸ºß¤¹¤ë¥Õ¥é¥°
+		}
+		$l ++;
+	}
+	$objPage->tpl_mainpage = 'mail/html_template.tpl';
+
+} elseif ( sfCheckNumLength($_GET['send_id']) || sfCheckNumLength($_GET['id'])){
+	if (is_numeric($_GET["send_id"])) {
+		$id = $_GET["send_id"];
+		$sql = "SELECT body, mail_method FROM dtb_send_history WHERE send_id = ?";
+	} else {
+		$sql = "SELECT body, mail_method FROM dtb_mailmaga_template WHERE template_id = ?";
+		$id = $_GET['id'];
+	}
+	$result = $conn->getAll($sql, array($id));
+	
+	
+	if ( $result ){
+		if ( $result[0]["mail_method"] == 2 ){
+			// ¥Æ¥­¥¹¥È·Á¼°¤Î»þ¤Ï¥¿¥°Ê¸»ú¤ò¥¨¥¹¥±¡¼¥×
+			$objPage->escape_flag = 1;
+		}
+		$objPage->body = $result[0]["body"];
+	}
+
+}
+	
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/htmlmail_select.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/htmlmail_select.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/htmlmail_select.php	(revision 1328)
@@ -0,0 +1,131 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	var $arrForm;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/htmlmail_select.tpl';
+		$this->tpl_mainno = 'mail';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+if ($_POST['mode'] == "search") {
+	
+	// POSTÃÍ¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	// ÆþÎÏÊ¸»ú¤Î¶¯À©ÊÑ´¹
+	lfConvertParam();
+	
+	// ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤¡£¸ø³«¾¦ÉÊ¤Ç¤¢¤ë¡£
+	$where = "delete = 0 AND status = 1";
+	
+	/* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
+	foreach ($objPage->arrForm as $key => $val) {
+		if($val == "") {
+			continue;
+		}
+		
+		switch ($key) {
+			case 'search_name':
+				$where .= " AND name ILIKE ?";
+				$arrval[] = "%$val%";
+				break;
+			case 'search_category_id':
+				// »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
+				$arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val);
+				$tmp_where = "";
+				foreach ($arrRet as $val) {
+					if($tmp_where == "") {
+						$tmp_where.= " AND ( category_id = ?";
+					} else {
+						$tmp_where.= " OR category_id = ?";
+					}
+					$arrval[] = $val;
+				}
+				$where.= $tmp_where . " )";
+				break;
+			case 'search_product_code':
+				$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
+				$where .= " OR product_code ILIKE ?";
+				$arrval[] = "%$val%";
+				$arrval[] = "%$val%";
+				break;
+			default:
+				break;
+		}
+	}
+	
+	$order = "update_date DESC";
+	
+	// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+	$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+	$from = "vw_products_nonclass";
+		
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count($from, $where, $arrval);
+	$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	if(is_numeric($_POST['search_page_max'])) {	
+		$page_max = $_POST['search_page_max'];
+	} else {
+		$page_max = SEARCH_PMAX;
+	}
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($page_max, $startno);
+
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+		
+}
+
+$objPage->arrCatList = sfGetCategoryList();
+$objPage->name = $_GET['name'];
+
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam() {
+	global $objPage;
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 */
+	$arrConvList['search_name'] = "KVa";
+	$arrConvList['search_product_code'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($objPage->arrForm[$key])) {
+			$objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
+		}
+	}
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/htmlmail.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/htmlmail.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/htmlmail.php	(revision 1328)
@@ -0,0 +1,365 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	var $arrForm;
+	
+	var $arrTempProduct;
+	var $subProductNum;
+	var $arrFileName;
+	
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/htmlmail.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "template";
+	}
+}
+
+
+class LC_Products{
+	
+	var $conn;
+	var $arrProduct;
+	var $arrProductKey;
+	
+	function LC_Products ($conn=""){
+		
+		$DB_class_name = "SC_DbConn";
+		if ( is_object($conn)){
+			if ( is_a($conn, $DB_class_name)){
+				// $conn¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë
+				$this->conn = $conn;
+			}
+		} else {
+			if (class_exists($DB_class_name)){
+				//$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë
+				$this->conn = new SC_DbConn();			
+			}
+		}
+	}
+	
+	function setProduct($keyname, $id) {
+		
+		if ( sfCheckNumLength($id) ){
+			$result = $this->getProductData($id);
+		}
+		
+		if ( $result && (in_array($keyname, $this->arrProductKey) ) ){
+	
+			$this->arrProduct["${keyname}"] = $result;
+		}
+	}	
+	
+	function getProductData($id){
+		$conn = $this->conn;
+		// ¾¦ÉÊ¾ðÊó¤ò¼èÆÀ¤¹¤ë
+		$sql = "SELECT * FROM dtb_products WHERE product_id = ?";
+		$result = $conn->getAll($sql, array($id));
+		if ( is_array($result) ){
+			$return = $result[0];
+		}
+		return $return;	
+	}
+
+	function getProductImageData($id){
+		$conn = $this->conn;
+		// ¾¦ÉÊ²èÁü¾ðÊó¤ò¼èÆÀ¤¹¤ë
+		$sql = "SELECT main_image FROM dtb_products WHERE product_id = ?";
+		$result = $conn->getAll($sql, array($id));
+		if ( is_array($result) ){
+			$return = $result[0]["main_image"];
+		}
+		return $return;	
+	}
+	function setHiddenList($arrPOST) {
+		foreach($this->arrProductKey as $val) {
+			$key = "temp_" . $val;
+			if($arrPOST[$key] != "") {
+				$this->setProduct($val, $arrPOST[$key]);
+			}
+		}
+	}
+}
+
+// ÅÐÏ¿¥«¥é¥à
+$arrRegist = array(
+					  "subject", "charge_image", "mail_method", "header", "main_title", "main_comment", "main_product_id", "sub_title", "sub_comment"
+					, "sub_product_id01", "sub_product_id02", "sub_product_id03", "sub_product_id04", "sub_product_id05", "sub_product_id06", "sub_product_id07"
+					, "sub_product_id08", "sub_product_id09", "sub_product_id10", "sub_product_id11", "sub_product_id12"
+					);
+					
+// ´ûÂ¸¤ÎÅÐÏ¿ºÑ¤ß¾¦ÉÊ¤«¤é²èÁüÉ½¼¨¤òÉ¬Í×¤È¤¹¤ë¹àÌÜ¥ê¥¹¥È					
+$arrFileList = array(
+						"main_product_id", "sub_product_id01", "sub_product_id02", "sub_product_id03", "sub_product_id04", "sub_product_id05"
+						, "sub_product_id06", "sub_product_id07", "sub_product_id08", "sub_product_id09", "sub_product_id10", "sub_product_id11", "sub_product_id12"
+					);
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+
+// ²èÁü½èÍý¥¯¥é¥¹ÀßÄê
+$objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR);
+$objUpFile->addFile("¥á¡¼¥ëÃ´Åö¼Ì¿¿", 'charge_image', array('jpg'),IMAGE_SIZE, true, HTMLMAIL_IMAGE_WIDTH, HTMLMAIL_IMAGE_HEIGHT);
+
+// POSTÃÍ¤Î°ú·Ñ¤®&ÆþÎÏÃÍ¤ÎÊÑ´¹
+$objPage->arrForm = lfConvData($_POST);
+
+// Hidden¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤­·Ñ¤°
+$objUpFile->setHiddenFileList($_POST);
+
+switch ($_POST['mode']){
+	
+	//²èÁü¥¢¥Ã¥×¥í¡¼¥É
+	case 'upload_image':
+	// ²èÁüÊÝÂ¸½èÍý
+	$objPage->arrErr[$_POST['image_key']] = $objUpFile->makeTempFile($_POST['image_key']);
+	break;
+	
+	//³ÎÇ§
+	case 'confirm':
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	//¥Õ¥¡¥¤¥ëÂ¸ºß¥Á¥§¥Ã¥¯
+	$objPage->arrErr = array_merge((array)$objPage->arrErr, (array)$objUpFile->checkEXISTS());
+		
+	//¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç¡¢³ÎÇ§¥Ú¡¼¥¸¤Ø
+	 if (!$objPage->arrErr){
+		// 	¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë¾ðÊóÇÛÎó¤òÅÏ¤¹¡£
+		$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+		//ºï½üÍ×µá¤Î¤¢¤Ã¤¿²èÁü¤òÉ½¼¨¤·¤Ê¤¤
+		for($i = 1; $i <= HTML_TEMPLATE_SUB_MAX; $i++) {
+			if($_POST['delete_sub'.$i] == "1") {
+				$arrSub['delete'][$i] = "on";
+			}else{
+				$arrSub['delete'][$i] = "";
+			}
+		}
+		$objPage->arrSub = $arrSub;
+		$objPage->tpl_mainpage = 'mail/htmlmail_confirm.tpl';
+	 }
+	break;
+	
+	// ³ÎÇ§¥Ú¡¼¥¸¤«¤é¤ÎÌá¤ê
+	case 'return':
+	break;
+	
+	//¡¡¥Æ¥ó¥×¥ì¡¼¥ÈÅÐÏ¿
+	case 'complete':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvData($_POST);
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);	// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+
+	// ¥¢¥Ã¥×¥í¡¼¥É²èÁü¤ò¥»¡¼¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤Ë°Ü¹Ô
+	$objUpFile->moveTempFile();
+
+	// DBÅÐÏ¿
+	if (is_numeric($objPage->arrForm["template_id"])) {	//¡¡ÊÔ½¸»þ
+		lfUpdateData($arrRegist);
+	} else {
+		ifRegistData($arrRegist);
+	}
+	$objPage->tpl_mainpage = 'mail/htmlmail_complete.tpl';
+	break;
+}
+
+// ¸¡º÷·ë²Ì¤«¤é¤ÎÊÔ½¸»þ
+if ($_GET["mode"] == "edit" && is_numeric($_GET["template_id"])) {
+	$objPage->edit_mode = "on";
+	//¥Æ¥ó¥×¥ì¡¼¥È¾ðÊóÆÉ¤ß¹þ¤ß
+	lfSetRegistData($_GET["template_id"]);
+	// DB¥Ç¡¼¥¿¤«¤é²èÁü¥Õ¥¡¥¤¥ëÌ¾¤ÎÆÉ¹þ
+	$objUpFile->setDBFileList($objPage->arrForm);
+
+}
+
+if ($_GET['mode'] != 'edit'){
+//ÅÐÏ¿¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+$objPage->arrFileName = lfGetProducts();
+}
+
+// HIDDENÍÑ¤ËÇÛÎó¤òÅÏ¤¹¡£
+$objPage->arrHidden = array_merge((array)$objPage->arrHidden, (array)$objUpFile->getHiddenFileList());
+// ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë¾ðÊóÇÛÎó¤òÅÏ¤¹¡£
+$objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-------------------------------------------------------------------------------------------------------------------------
+
+/* ¾¦ÉÊ²èÁü¤ÎÆÉ¤ß¹þ¤ß */
+function lfGetProducts() {
+	global $objQuery;
+	
+	if ($_POST['main_product_id'] != ""){
+	$MainFile = $objQuery->select("main_image, name, product_id", "dtb_products", "product_id=?", array($_POST['main_product_id']));
+	$arrFileName[0] = $MainFile[0];
+	}
+	for($i = 1; $i <= HTML_TEMPLATE_SUB_MAX; $i++) {
+		$sub_keyname = "sub_product_id" . sprintf("%02d", $i);
+		if($_POST[$sub_keyname] != "") {
+			$arrSubFile = $objQuery->select("main_image, name, product_id", "dtb_products", "product_id = ?", array($_POST[$sub_keyname]));
+			$arrFileName[$i] = $arrSubFile[0];
+		}
+	}
+	return $arrFileName;
+}
+
+/* ÅÐÏ¿ºÑ¤ß¥Ç¡¼¥¿ÆÉ¤ß¹þ¤ß */
+function lfSetRegistData($template_id) {
+	global $objQuery;
+	global $objPage;
+	$arrRet = $objQuery->select("*", "dtb_mailmaga_template", "template_id=?", array($template_id));
+	$arrProductid = $arrRet[0];
+	//²èÁü°Ê³°¤Î¾ðÊó¼èÆÀ
+	$objPage->arrForm = $arrRet[0];
+		if ($arrProductid['main_product_id'] != ""){
+			$MainFile = $objQuery->select("main_image, name, product_id", "dtb_products", "product_id=?", array($arrProductid['main_product_id']));
+			$arrFileName[0] = $MainFile[0];
+		}
+	for ($i=1; $i<=HTML_TEMPLATE_SUB_MAX; $i++){
+		if ($arrProductid['sub_product_id'.sprintf("%02d", $i)] != ""){
+			$arrSubFile = $objQuery->select("main_image, name, product_id", "dtb_products", "product_id=?", array($arrProductid['sub_product_id'.sprintf("%02d", $i)]));
+			$arrFileName[$i] = $arrSubFile[0];
+		}
+	}
+	//²èÁü¤Î¾ðÊó¼èÆÀ
+	$objPage->arrFileName = $arrFileName;
+	
+	return $objPage;
+}
+
+// ÊÔ½¸¥Ç¡¼¥¿¼èÆÀ
+function lfGetEditData($id, $arrIdData) {
+	global $conn;
+
+	// DBÅÐÏ¿¾ðÊó
+	$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND delete = 0";
+	$result = $conn->getAll($sql, array($id));
+
+	//¡¡²èÁü¥Õ¥¡¥¤¥ëÌ¾
+	for ($i = 0; $i < count($arrIdData); $i ++) {
+		$data = "";
+		if (is_numeric($result[0][ $arrIdData[$i] ]) ) {
+			$sql = "SELECT name,product_id,main_image FROM dtb_products WHERE product_id = ?";
+			$data = $conn->getAll($sql, array($result[0][ $arrIdData[$i] ]));
+		}
+		$arrFileName[] = $data[0];
+	}
+ 	
+	return array($result[0], $arrFileName);
+}
+
+// ³ÎÇ§¥Ç¡¼¥¿¼èÆÀ
+function lfGetConfirmData($arrPOST, $arrIdData) {
+	global $conn;
+	//¡¡²èÁü¥Õ¥¡¥¤¥ëÌ¾
+	for ($i = 0; $i < count($arrIdData); $i ++) {
+		$data = "";
+		if (is_numeric($arrPOST[ $arrIdData[$i] ]) ) {
+			$sql = "SELECT name,product_id,main_image FROM dtb_products WHERE product_id = ?";
+			$data = $conn->getAll($sql, array($arrPOST[ $arrIdData[$i] ]));
+		}
+		$arrFileName[] = $data[0];
+	}
+ 	return array($arrPOST, $arrFileName);
+}
+
+// ¥Ç¡¼¥¿¥Ù¡¼¥¹ÅÐÏ¿
+function ifRegistData($arrRegist) {
+	global $conn;
+	global $objUpFile;
+
+	foreach ($arrRegist as $data) {
+		if (strlen($_POST[$data]) > 0) {
+			$arrRegistValue[$data] = $_POST[$data];
+		}
+	}
+	$arrRegistValue["creator_id"] = $_SESSION["member_id"];		// ÅÐÏ¿¼ÔID¡Ê´ÉÍý²èÌÌ¡Ë
+	$uploadfile = $objUpFile->getDBFileList();
+	//ºï½üÍ×µá¤Î¤¢¤Ã¤¿¾¦ÉÊ¤òºï½ü¤¹¤ë
+	for ($i = 1; $i <= HTML_TEMPLATE_SUB_MAX; $i++){
+		if ($_POST['delete_sub'.$i] == '1'){
+			$arrRegistValue['sub_product_id'.sprintf("%02d", $i)] = NULL;
+		}
+	}
+	$arrRegistValue = array_merge($arrRegistValue, $uploadfile);
+	$conn->autoExecute("dtb_mailmaga_template", $arrRegistValue);
+}
+
+// ¥Ç¡¼¥¿¹¹¿·
+function lfUpdateData($arrRegist) {
+	global $conn;
+	global $objUpFile;
+
+	foreach ($arrRegist as $data) {
+		if (strlen($_POST[$data]) > 0) {
+			$arrRegistValue[$data] = $_POST[$data];
+		}
+	}
+	$arrRegistValue["creator_id"] = $_SESSION["member_id"];	
+	$arrRegistValue["update_date"] = "NOW()";
+	$uploadfile = $objUpFile->getDBFileList();
+	//ºï½üÍ×µá¤Î¤¢¤Ã¤¿¾¦ÉÊ¤òºï½ü¤¹¤ë
+	for ($i = 1; $i <= HTML_TEMPLATE_SUB_MAX; $i++){
+		if ($_POST['delete_sub'.$i] == '1'){
+			$arrRegistValue['sub_product_id'.sprintf("%02d", $i)] = NULL;
+		}
+	}
+	$arrRegistValue = array_merge($arrRegistValue, $uploadfile);
+	
+	$conn->autoExecute("dtb_mailmaga_template", $arrRegistValue, "template_id = ". addslashes($_POST["template_id"]));
+}
+
+// ÆþÎÏÃÍÊÑ´¹
+function lfConvData( $data ){
+	
+	 // Ê¸»úÎó¤ÎÊÑ´¹¡Êmb_convert_kana¤ÎÊÑ´¹¥ª¥×¥·¥ç¥ó¡Ë							
+	$arrFlag = array(
+					  "header" => "aKV"
+					 ,"subject" => "aKV"
+					 ,"main_title" => "aKV"
+ 					 ,"main_comment" => "aKV"
+ 					 ,"main_product_id" => "aKV"
+ 					 ,"sub_title" => "aKV"
+					 ,"sub_comment" => "aKV"
+				);
+		
+	if ( is_array($data) ){
+		foreach ($arrFlag as $key=>$line) {
+			$data[$key] = mb_convert_kana($data[$key], $line);
+		}
+	}
+
+	return $data;
+}
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥á¡¼¥ë·Á¼°", "mail_method"), array("EXIST_CHECK", "ALNUM_CHECK"));
+	$objErr->doFunc(array("Subject", "subject", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Ø¥Ã¥À¡¼¥Æ¥­¥¹¥È", 'header', LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK") );
+	$objErr->doFunc(array("¥á¥¤¥ó¾¦ÉÊ¥¿¥¤¥È¥ë", 'main_title', STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK") );
+	$objErr->doFunc(array("¥á¥¤¥ó¾¦ÉÊ¥³¥á¥ó¥È", 'main_comment', LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¥¤¥ó¾¦ÉÊ²èÁü", "main_product_id"), array("EXIST_CHECK"));
+	$objErr->doFunc(array("¥µ¥Ö¾¦ÉÊ·²¥¿¥¤¥È¥ë", "sub_title", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥µ¥Ö¾¦ÉÊ·²¥³¥á¥ó¥È", "sub_comment", LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/inc_mailmagazine.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/inc_mailmagazine.php	(revision 2732)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/inc_mailmagazine.php	(revision 2732)
@@ -0,0 +1,261 @@
+<?php
+/**
+ * CSVÇÛ¿®µ¡Ç½¼ÂÁõ¤Î¤¿¤á¡¢¶¦ÄÌÉôÊ¬¤ò³°Éô¥Õ¥¡¥¤¥ë²½¤·¤Þ¤·¤¿¡£<br>
+ * @author hirokazu_fukuda
+ * @version 2005/12/27
+ */
+
+
+//---- ¸¡º÷ÍÑ¹àÌÜÇÛÎó
+$objPage->arrHtmlmail = array( "" => "Î¾Êý",  1 => "HTML", 2 => "TEXT" );
+
+
+//---- ÇÛÎóÆâÍÆÀìÍÑ¹àÌÜ¤ÎÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "template_id",		"convert" => "n" )
+							,array(  "column" => "mail_method",		"convert" => "n" )
+							,array(  "column" => "send_year",		"convert" => "n" )
+							,array(  "column" => "send_month", 		"convert" => "n" )
+							,array(  "column" => "send_day",		"convert" => "n" )
+							,array(  "column" => "send_hour",		"convert" => "n" )
+							,array(  "column" => "send_minutes",	"convert" => "n" )
+							,array(  "column" => "subject",			"convert" => "aKV" )
+							,array(  "column" => "body",			"convert" => "KV" )
+						);
+
+//---- ¥á¥ë¥Þ¥¬²ñ°÷¼ïÊÌ
+$arrCustomerType = array(
+						1 => "²ñ°÷",
+						2 => "Èó²ñ°÷",
+						//3 => "CSVÅÐÏ¿"
+						);
+
+//---- ¸¡º÷¹àÌÜ
+$arrSearchColumn = array(
+							array(  "column" => "name",				"convert" => "aKV"),
+							array(  "column" => "pref",				"convert" => "n" ),
+							array(  "column" => "kana",				"convert" => "CKV"),
+							array(  "column" => "sex",				"convert" => "" ),
+							array(  "column" => "tel",				"convert" => "n" ),
+							array(  "column" => "job",				"convert" => "" ),
+							array(  "column" => "email",			"convert" => "a" ),
+							array(  "column" => "htmlmail",			"convert" => "n" ),
+							array(  "column" => "customer",			"convert" => "" ),
+							array(  "column" => "buy_total_from",	"convert" => "n" ),
+							array(  "column" => "buy_total_to",		"convert" => "n" ),
+							array(  "column" => "buy_times_from",	"convert" => "n" ),
+							array(  "column" => "buy_times_to",		"convert" => "n" ),
+							array(  "column" => "birth_month",		"convert" => "n" ),
+							array(  "column" => "b_start_year",		"convert" => "n" ),
+							array(  "column" => "b_start_month",	"convert" => "n" ),
+							array(  "column" => "b_start_day",		"convert" => "n" ),
+							array(  "column" => "b_end_year",		"convert" => "n" ),
+							array(  "column" => "b_end_month",		"convert" => "n" ),
+							array(  "column" => "b_end_day",		"convert" => "n" ),
+							array(  "column" => "start_year",		"convert" => "n" ),
+							array(  "column" => "start_month",		"convert" => "n" ),
+							array(  "column" => "start_day",		"convert" => "n" ),
+							array(  "column" => "end_year",			"convert" => "n" ),
+							array(  "column" => "end_month",		"convert" => "n" ),
+							array(  "column" => "end_day",			"convert" => "n" ),
+							array(  "column" => "buy_start_year",	"convert" => "n" ),
+							array(  "column" => "buy_start_month",	"convert" => "n" ),
+							array(  "column" => "buy_start_day",	"convert" => "n" ),
+							array(  "column" => "buy_end_year",		"convert" => "n" ),
+							array(  "column" => "buy_end_month",	"convert" => "n" ),
+							array(  "column" => "buy_end_day",		"convert" => "n" ),
+							array(  "column" => "buy_product_code",	"convert" => "aKV" )
+							,array(  "column" => "buy_product_name",	"convert" => "aKV" )
+							,array(  "column" => "category_id",	"convert" => "" )			
+							,array(  "column" => "buy_total_from",	"convert" => "n" )		
+							,array(  "column" => "buy_total_to",	"convert" => "n" )		
+						 );
+
+//--------------------------------------------------------------------------------------------------------------------------------------
+
+//---- HTML¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤¹¤ë¾ì¹ç¡¢¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë¡£	
+function lfGetHtmlTemplateData($id) {
+	
+	global $conn;
+	$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?";
+	$result = $conn->getAll($sql, array($id));
+	$list_data = $result[0];
+
+	// ¥á¥¤¥ó¾¦ÉÊ¤Î¾ðÊó¼èÆÀ
+	$sql = "SELECT name, main_image, point_rate, deliv_fee, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
+	$main = $conn->getAll($sql, array($list_data["main_product_id"]));
+	$list_data["main"] = $main[0];
+
+	// ¥µ¥Ö¾¦ÉÊ¤Î¾ðÊó¼èÆÀ
+	$sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?";
+	$k = 0;
+	$l = 0;
+	for ($i = 1; $i <= 12; $i ++) {
+		if ($l == 4) {
+			$l = 0;
+			$k ++;
+		}
+		$result = "";
+		$j = sprintf("%02d", $i);
+		if ($i > 0 && $i < 5 ) $k = 0;
+		if ($i > 4 && $i < 9 ) $k = 1;
+		if ($i > 8 && $i < 13 ) $k = 2;	
+		
+		if (is_numeric($list_data["sub_product_id" .$j])) {
+			$result = $conn->getAll($sql, array($list_data["sub_product_id" .$j]));
+			$list_data["sub"][$k][$l] = $result[0];
+			$list_data["sub"][$k]["data_exists"] = "OK";	//Åö³ºÃÊ¤Ë¥Ç¡¼¥¿¤¬£±¤Ä°Ê¾åÂ¸ºß¤¹¤ë¥Õ¥é¥°
+		}
+		$l ++;
+	}
+	return $list_data;
+}
+
+//---   ¥Æ¥ó¥×¥ì¡¼¥È¤Î¼ïÎà¤òÊÖ¤¹
+function lfGetTemplateMethod($conn, $templata_id){
+	
+	if ( sfCheckNumLength($template_id) ){
+		$sql = "SELECT mail_method FROM dtb_mailmaga_template WEHRE template_id = ?";
+	}	
+}
+
+//---   hiddenÍ×ÁÇ½ÐÎÏÍÑÇÛÎó¤ÎºîÀ®
+function lfGetHidden( $array ){
+	if ( is_array($array) ){
+		foreach( $array as $key => $val ){
+			if ( is_array( $val )){
+				for ( $i=0; $i<count($val); $i++){
+					$return[ $key.'['.$i.']'] = $val[$i];
+				}				
+			} else {
+				$return[$key] = $val;			
+			}
+		}
+	}
+	return $return;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrSearchColumn) {
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrSearchColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+
+	$new_array = array();
+	foreach ($arrConvList as $key => $val) {
+		if ( strlen($array[$key]) > 0 ){						// ¥Ç¡¼¥¿¤Î¤¢¤ë¤â¤Î¤À¤±ÊÖ¤¹
+			$new_array[$key] = $array[$key];
+			if( strlen($val) > 0) {
+				$new_array[$key] = mb_convert_kana($new_array[$key] ,$val);
+			}
+		}
+	}
+	return $new_array;
+	
+}
+
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array, $flag = '') {
+
+	// flag ¤ÏÅÐÏ¿»þÍÑ
+	
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¸ÜµÒ¥³¡¼¥É", "customer_id", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", "pref", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸ÜµÒÌ¾", "name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¸ÜµÒÌ¾(¥«¥Ê)", "kana", STEXT_LEN), array("KANA_CHECK", "MAX_LENGTH_CHECK"));
+
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", STEXT_LEN) ,array("EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "tel", TEL_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+		
+	$objErr->doFunc(array("¹ØÆþ²ó¿ô(³«»Ï)", "buy_times_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¹ØÆþ²ó¿ô(½ªÎ»)", "buy_times_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	if ((is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && ($array["buy_times_from"] > $array["buy_times_to"]) ) $objErr->arrErr["buy_times_from"] .= "¢¨ ¹ØÆþ²ó¿ô¤Î»ØÄêÈÏ°Ï¤¬ÉÔÀµ¤Ç¤¹¡£";
+	
+	$objErr->doFunc(array("ÃÂÀ¸·î", "birth_month", 2), array("NUM_CHECK","MAX_LENGTH_CHECK"));
+	
+	$objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)", "b_start_year", "b_start_month", "b_start_day",), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÃÂÀ¸Æü(½ªÎ»Æü)", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_DATE"));	
+	$objErr->doFunc(array("ÃÂÀ¸Æü(³«»ÏÆü)","ÃÂÀ¸Æü(½ªÎ»Æü)", "b_start_year", "b_start_month", "b_start_day", "b_end_year", "b_end_month", "b_end_day"), array("CHECK_SET_TERM"));
+	
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)", "start_year", "start_month", "start_day",), array("CHECK_DATE"));
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "end_year", "end_month", "end_day"), array("CHECK_DATE"));	
+	$objErr->doFunc(array("ÅÐÏ¿¡¦¹¹¿·Æü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "start_year", "start_month", "start_day", "end_year", "end_month", "end_day"), array("CHECK_SET_TERM"));
+	
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)", "buy_start_year", "buy_start_month", "buy_start_day",), array("CHECK_DATE"));
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþ(½ªÎ»Æü)", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_DATE"));	
+	$objErr->doFunc(array("ºÇ½ª¹ØÆþÆü(³«»ÏÆü)","ÅÐÏ¿¡¦¹¹¿·Æü(½ªÎ»Æü)", "buy_start_year", "buy_start_month", "buy_start_day", "buy_end_year", "buy_end_month", "buy_end_day"), array("CHECK_SET_TERM"));
+	
+	$objErr->doFunc(array("¹ØÆþ¾¦ÉÊ¥³¡¼¥É", "buy_product_code", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+
+	$objErr->doFunc(array("¹ØÆþ¾¦ÉÊÌ¾", "buy_product_name", STEXT_LEN), array("MAX_LENGTH_CHECK"));
+	
+	$objErr->doFunc(array("¹ØÆþ¶â³Û(³«»Ï)", "buy_total_from", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));	
+	$objErr->doFunc(array("¹ØÆþ¶â³Û(½ªÎ»)", "buy_total_to", INT_LEN), array("NUM_CHECK","MAX_LENGTH_CHECK"));	
+	
+	//¹ØÆþ¶â³Û(from) ¡ä ¹ØÆþ¶â³Û(to) ¤Î¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë
+	if ( (is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && 
+		 ($array["buy_total_from"] > $array["buy_total_to"]) ) {
+		 $objErr->arrErr["buy_total_from"] .= "¢¨ ¹ØÆþ¶â³Û¤Î»ØÄêÈÏ°Ï¤¬ÉÔÀµ¤Ç¤¹¡£";
+	 }
+
+	if ( $flag ){
+		$objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È", "template_id"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("¥á¡¼¥ëÁ÷¿®Ë¡Ë¡", "mail_method"), array("EXIST_CHECK", "NUM_CHECK"));
+		/* ¼«Æ°ÇÛ¿®µ¡Ç½¤Ï¥µ¡¼¥Ð¡¼¤ÎÀßÄê¤¬É¬Í×¤Ê¤¿¤á¡¢ºï½ü
+		
+		$objErr->doFunc(array("ÇÛ¿®Æü¡ÊÇ¯¡Ë","send_year"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü¡Ê·î¡Ë","send_month"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü¡ÊÆü¡Ë","send_day"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü¡Ê»þ¡Ë","send_hour"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü¡ÊÊ¬¡Ë","send_minutes"), array("EXIST_CHECK", "NUM_CHECK"));
+		$objErr->doFunc(array("ÇÛ¿®Æü", "send_year", "send_month", "send_day"), array("CHECK_DATE"));
+		$objErr->doFunc(array("ÇÛ¿®Æü", "send_year", "send_month", "send_day","send_hour", "send_minutes"), array("ALL_EXIST_CHECK"));
+		*/
+		$objErr->doFunc(array("Subject", "subject", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+		$objErr->doFunc(array("ËÜÊ¸", 'body', LLTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));	// HTML¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤·¤Ê¤¤¾ì¹ç
+	}
+	
+	return $objErr->arrErr;
+}
+
+/* ¥Æ¥ó¥×¥ì¡¼¥ÈID¤Èsubject¤ÎÇÛÎó¤òÊÖ¤¹ */ 
+function getTemplateList($conn){
+	global $arrMagazineTypeAll;
+	
+	$sql = "SELECT template_id, subject, mail_method FROM dtb_mailmaga_template WHERE delete = 0 ";
+	if ($_POST["htmlmail"] == 2) {
+		$sql .= " AND mail_method = 2 ";	//TEXT´õË¾¼Ô¤Ø¤ÎTEST¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¥ê¥¹¥È
+	}
+	$sql .= " ORDER BY template_id DESC";
+	$result = $conn->getAll($sql);
+	
+	if ( is_array($result) ){ 
+		foreach( $result as $line ){
+			$return[$line['template_id']] = "¡Ú" . $arrMagazineTypeAll[$line['mail_method']] . "¡Û" . $line['subject'];  
+		}
+	}
+	
+	return $return;
+}
+
+/* ¥Æ¥ó¥×¥ì¡¼¥ÈID¤«¤é¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿¤ò¼èÆÀ */ 
+function getTemplateData($conn, $id){
+	
+	if ( sfCheckNumLength($id) ){
+		$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? ORDER BY template_id DESC";
+		$result = $conn->getAll( $sql, array($id) );
+		if ( is_array($result) ) {
+			$return = $result[0];
+		}
+	}
+	return $return;
+}
+
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/index.php	(revision 3648)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/index.php	(revision 3648)
@@ -0,0 +1,391 @@
+<?php
+
+require_once("../require.php");
+require_once("./inc_mailmagazine.php");
+
+class LC_Page {
+	var $arrSession;
+	var $arrHtmlmail;
+	var $arrNowDate;
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/index.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "index";
+		$this->tpl_pager = ROOT_DIR . 'data/Smarty/templates/admin/pager.tpl';
+		$this->tpl_subtitle = 'ÇÛ¿®ÆâÍÆÀßÄê';
+		
+		global $arrPref;
+		$this->arrPref = $arrPref;
+		global $arrJob;
+		$arrJob["ÉÔÌÀ"] = "ÉÔÌÀ";
+		$this->arrJob = $arrJob;
+		global $arrSex;		
+		$this->arrSex = $arrSex;
+		global $arrPageRows;
+		$this->arrPageRows = $arrPageRows;
+		// ¥Ú¡¼¥¸¥Ê¥ÓÍÑ
+		$this->tpl_pageno = $_POST['search_pageno'];
+		global $arrMAILMAGATYPE;
+		$this->arrMAILMAGATYPE = $arrMAILMAGATYPE;
+		$this->arrHtmlmail[''] = "¤¹¤Ù¤Æ";
+		$this->arrHtmlmail[1] = $arrMAILMAGATYPE[1];
+		$this->arrHtmlmail[2] = $arrMAILMAGATYPE[2];
+		global $arrCustomerType;
+		$this->arrCustomerType = $arrCustomerType;
+	}
+}
+
+class LC_HTMLtemplate {
+	var $list_data;
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objDate = new SC_Date();
+$objPage->objDate = $objDate;
+$objPage->arrTemplate = getTemplateList($conn);
+
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+/*
+	query:ÇÛ¿®ÍúÎò¡Ö³ÎÇ§¡×
+*/
+if ($_GET["mode"] == "query" && sfCheckNumLength($_GET["send_id"])) {
+	// Á÷¿®ÍúÎò¤è¤ê¡¢Á÷¿®¾ò·ï³ÎÇ§²èÌÌ
+	$sql = "SELECT search_data FROM dtb_send_history WHERE send_id = ?";
+	$result = $conn->getOne($sql, array($_GET["send_id"]));
+	$tpl_path = "mail/query.tpl";
+		
+	$list_data = unserialize($result);
+	
+	// ÅÔÆ»ÉÜ¸©¤òÊÑ´¹
+	$list_data['pref_disp'] = $objPage->arrPref[$list_data['pref']];
+	
+	// ÇÛ¿®·Á¼°
+	$list_data['htmlmail_disp'] = $objPage->arrHtmlmail[$list_data['htmlmail']];
+	
+	// À­ÊÌ¤ÎÊÑ´¹
+	if (count($list_data['sex']) > 0) {
+		foreach($list_data['sex'] as $key => $val){
+			$list_data['sex'][$key] = $objPage->arrSex[$val];
+			$sex_disp .= $list_data['sex'][$key] . " ";
+		}
+		$list_data['sex_disp'] = $sex_disp;
+	}
+	
+	// ¿¦¶È¤ÎÊÑ´¹
+	if (count($list_data['job']) > 0) {
+		foreach($list_data['job'] as $key => $val){
+			$list_data['job'][$key] = $objPage->arrJob[$val];
+			$job_disp .= $list_data['job'][$key] . " ";
+		}
+		$list_data['job_disp'] = $job_disp;
+	}
+	
+	// ¥«¥Æ¥´¥êÊÑ´¹
+	$arrCatList = sfGetCategoryList();
+	$list_data['category_name'] = $arrCatList[$list_data['category_id']];
+	
+	$objPage->list_data = $list_data;
+
+	$objView->assignobj($objPage);
+	$objView->display($tpl_path);
+	exit;
+}
+
+if($_POST['mode'] == 'delete') {
+	$objQuery = new SC_Query();
+	$objQuery->delete("dtb_customer_mail", "email = ?", array($_POST['result_email']));
+}
+
+switch($_POST['mode']) {
+/*
+	search:¡Ö¸¡º÷¡×¥Ü¥¿¥ó
+	back:¸¡º÷·ë²Ì²èÌÌ¡ÖÌá¤ë¡×¥Ü¥¿¥ó
+*/
+case 'delete':
+case 'search':
+case 'back':
+	//-- ÆþÎÏÃÍ¥³¥ó¥Ð¡¼¥È
+	$objPage->list_data = lfConvertParam($_POST, $arrSearchColumn);
+	
+	//-- ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->list_data);
+
+	//-- ¸¡º÷³«»Ï
+	if (!is_array($objPage->arrErr)) {
+		$objPage->list_data['name'] = sfManualEscape($objPage->list_data['name']);
+		// hiddenÍ×ÁÇºîÀ®
+		$objPage->arrHidden = lfGetHidden($objPage->list_data);
+
+		//-- ¸¡º÷¥Ç¡¼¥¿¼èÆÀ	
+		$objSelect = new SC_CustomerList($objPage->list_data, "magazine");
+
+		// À¸À®¤µ¤ì¤¿WHEREÊ¸¤ò¼èÆÀ¤¹¤ë		
+		list($where, $arrval) = $objSelect->getWhere();
+		// ¡ÖWHERE¡×ÉôÊ¬¤òºï½ü¤¹¤ë¡£
+		$where = ereg_replace("^WHERE", "", $where);
+
+		// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+		$objQuery = new SC_Query();
+		$from = "dtb_customer_mail LEFT OUTER JOIN dtb_customer USING(email)";
+
+		// ¹Ô¿ô¤Î¼èÆÀ
+		$linemax = $objQuery->count($from, $where, $arrval);
+		$objPage->tpl_linemax = $linemax;				// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+		
+		// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+		$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, SEARCH_PMAX, "fnResultPageNavi", NAVI_PMAX);
+		$objPage->arrPagenavi = $objNavi->arrPagenavi;	
+		$startno = $objNavi->start_row;
+
+		// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+		$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+		// É½¼¨½ç½ø
+		$objQuery->setorder("customer_id DESC");
+		// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+		$col = "customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref,mail_flag";
+		$objPage->arrResults = $objQuery->select($col, $from, $where, $arrval);
+
+		//¸½ºß»þ¹ï¤Î¼èÆÀ
+		$objPage->arrNowDate = lfGetNowDate();
+	}
+	break;
+/*
+	input:¸¡º÷·ë²Ì²èÌÌ¡ÖÇÛ¿®ÆâÍÆÀßÄê¡×¥Ü¥¿¥ó
+*/
+case 'input':
+	//-- ÆþÎÏÃÍ¥³¥ó¥Ð¡¼¥È
+	$objPage->list_data = lfConvertParam($_POST, $arrSearchColumn);
+	//-- ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->list_data);
+	//-- ¥¨¥é¡¼¤Ê¤·
+	if (!is_array($objPage->arrErr)) {
+		//-- ¸½ºß»þ¹ï¤Î¼èÆÀ
+		$objPage->arrNowDate = lfGetNowDate();
+		$objPage->arrHidden = lfGetHidden($objPage->list_data); // hiddenÍ×ÁÇºîÀ®
+		$objPage->tpl_mainpage = 'mail/input.tpl';
+	}
+	break;
+/*
+	template:¥Æ¥ó¥×¥ì¡¼¥ÈÁªÂò
+*/
+case 'template':
+	//-- ÆþÎÏÃÍ¥³¥ó¥Ð¡¼¥È
+	$objPage->list_data = lfConvertParam($_POST, $arrSearchColumn);
+	
+	//-- »þ¹ïÀßÄê¤Î¼èÆÀ
+	$objPage->arrNowDate['year'] = $_POST['send_year'];
+	$objPage->arrNowDate['month'] = $_POST['send_month'];
+	$objPage->arrNowDate['day'] = $_POST['send_day'];
+	$objPage->arrNowDate['hour'] = $_POST['send_hour'];
+	$objPage->arrNowDate['minutes'] = $_POST['send_minutes'];
+	
+	//-- ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->list_data);
+
+	//-- ¸¡º÷³«»Ï
+	if ( ! is_array($objPage->arrErr)) {
+		$objPage->list_data['name'] = sfManualEscape($objPage->list_data['name']);
+		$objPage->arrHidden = lfGetHidden($objPage->list_data); // hiddenÍ×ÁÇºîÀ®
+	
+		$objPage->tpl_mainpage = 'mail/input.tpl';
+		$template_data = getTemplateData($conn, $_POST['template_id']);
+		if ( $template_data ){
+			foreach( $template_data as $key=>$val ){
+				$objPage->list_data[$key] = $val;
+			}
+		}
+
+		//-- HTML¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤¹¤ë¾ì¹ç¤Ï¡¢HTML¥½¡¼¥¹¤òÀ¸À®¤·¤ÆBODY¤ØÁÞÆþ
+		if ( $objPage->list_data["mail_method"] == 3) {
+			$objTemplate = new LC_HTMLtemplate;
+			$objTemplate->list_data = lfGetHtmlTemplateData($_POST['template_id']);
+			$objSiteInfo = new SC_SiteInfo();
+			$objTemplate->arrInfo = $objSiteInfo->data;
+			//¥á¡¼¥ëÃ´Åö¼Ì¿¿¤ÎÉ½¼¨
+			$objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+			$objUpFile->addFile("¥á¡¼¥ëÃ´Åö¼Ì¿¿", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
+			$objUpFile->setDBFileList($objTemplate->list_data);
+			$objTemplate->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL);
+			$objMakeTemplate = new SC_AdminView();
+			$objMakeTemplate->assignobj($objTemplate);		
+			$objPage->list_data["body"] = $objMakeTemplate->fetch("mail/html_template.tpl");
+		}
+	}
+	break;
+/*
+	regist_confirm:¡ÖÆþÎÏÆâÍÆ¤ò³ÎÇ§¡×
+	regist_back:¡Ö¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê²èÌÌ¤ØÌá¤ë¡×
+	regist_complete:¡ÖÅÐÏ¿¡×
+*/	
+case 'regist_confirm':
+case 'regist_back':
+case 'regist_complete':
+	//-- ÆþÎÏÃÍ¥³¥ó¥Ð¡¼¥È
+	$arrCheckColumn = array_merge( $arrSearchColumn, $arrRegistColumn );
+	$objPage->list_data = lfConvertParam($_POST, $arrCheckColumn);
+	
+	//¸½ºß»þ¹ï¤Î¼èÆÀ
+	$objPage->arrNowDate = lfGetNowDate();
+
+	//-- ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->list_data, 1);
+	$objPage->tpl_mainpage = 'mail/input.tpl';
+	$objPage->arrHidden = lfGetHidden($objPage->list_data); // hiddenÍ×ÁÇºîÀ®
+	
+	//-- ¸¡º÷³«»Ï
+	if ( ! is_array($objPage->arrErr)) {
+			$objPage->list_data['name'] = sfManualEscape($objPage->list_data['name']);
+		if ( $_POST['mode'] == 'regist_confirm'){
+			$objPage->tpl_mainpage = 'mail/input_confirm.tpl';
+		} else if( $_POST['mode'] == 'regist_complete' ){
+			lfRegistData($objPage->list_data);
+			header("Location: /admin/mail/sendmail.php?mode=now");
+			exit;			
+		}
+	}
+	break;
+default:
+	break;
+}
+
+// ÇÛ¿®»þ´Ö¤ÎÇ¯¤ò¡¢¡Ö¸½ºßÇ¯¢·¸½ºßÇ¯¡Ü£±¡×¤ÎÈÏ°Ï¤ËÀßÄê
+for ($year=date("Y"); $year<=date("Y") + 1;$year++){
+	$arrYear[$year] = $year;
+}
+$objPage->arrYear = $arrYear;
+
+$objPage->arrCustomerOrderId = lfGetCustomerOrderId($_POST['buy_product_code']);
+
+$objPage->arrCatList = sfGetCategoryList();
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+// ¾¦ÉÊ¥³¡¼¥É¤Ç¸¡º÷¤µ¤ì¤¿¾ì¹ç¤Ë¥Ò¥Ã¥È¤·¤¿¼õÃíÈÖ¹æ¤ò¼èÆÀ¤¹¤ë¡£
+function lfGetCustomerOrderId($keyword) {
+	if($keyword != "") {
+		$col = "customer_id, order_id";
+		$from = "dtb_order LEFT JOIN dtb_order_detail USING(order_id)";
+		$where = "product_code LIKE ? AND delete = 0";
+		$val = sfManualEscape($keyword);
+		$arrVal[] = "%$val%";
+		$objQuery = new SC_Query();
+		$objQuery->setgroupby("customer_id, order_id");
+		$arrRet = $objQuery->select($col, $from, $where, $arrVal);
+		$arrCustomerOrderId = sfArrKeyValues($arrRet, "customer_id", "order_id");
+	}
+	return $arrCustomerOrderId;	
+}
+
+function lfMakeCsvData( $send_id ){
+		
+	global $conn;
+
+	$arrTitle  = array(	 'name01','email');
+				
+	$sql = "SELECT name01,email FROM dtb_send_customer WHERE send_id = ? ORDER BY email";
+	$result = $conn->getAll($sql, array($send_id) );
+	
+	if ( $result ){
+		$return = lfGetCSVData( $result, $arrTitle);
+	}
+	return $return;	
+}
+
+//---- CSV½ÐÎÏÍÑ¥Ç¡¼¥¿¼èÆÀ
+function lfGetCSVData( $array, $arrayIndex){	
+	
+	for ($i=0; $i<count($array); $i++){
+		
+		for ($j=0; $j<count($array[$i]); $j++ ){
+			if ( $j > 0 ) $return .= ",";
+			$return .= "\"";			
+			if ( $arrayIndex ){
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";	
+			} else {
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+			}
+		}
+		$return .= "\n";			
+	}
+	return $return;
+}
+
+//¸½ºß»þ¹ï¤Î¼èÆÀ¡ÊÇÛ¿®»þ´Ö¥Ç¥Õ¥©¥ë¥ÈÃÍ¡Ë
+function lfGetNowDate(){
+	$nowdate = date("Y/n/j/G/i");
+	list($year, $month, $day, $hour, $minute) = split("[/]", $nowdate);
+	$arrNowDate = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minutes' => $minute);
+	foreach ($arrNowDate as $key => $val){
+		switch ($key){
+			case 'minutes':
+			$val = ereg_replace('^[0]','', $val);
+			if ($val < 30){
+			$list_date[$key] = '30';
+			}else{
+			$list_date[$key] = '00';
+			}
+			break;
+			case 'year':
+			case 'month':
+			case 'day':
+			$list_date[$key] = $val;
+			break;
+		}
+	}
+		if ($arrNowDate['minutes'] < 30){
+			$list_date['hour'] = $hour;
+		}else{
+			$list_date['hour'] = $hour + 1;
+		}
+	return $list_date;
+}
+
+// ÇÛ¿®ÆâÍÆ¤ÈÇÛ¿®¥ê¥¹¥È¤ò½ñ¤­¹þ¤à
+function lfRegistData($arrData){
+	
+	global $conn;
+	global $arrSearchColumn;
+		
+	$objSelect = new SC_CustomerList( lfConvertParam($arrData, $arrSearchColumn), "magazine" );
+	$search_data = $conn->getAll($objSelect->getListMailMagazine(), $objSelect->arrVal);
+	$dataCnt = count($search_data);
+	
+	$dtb_send_history = array();
+	$dtb_send_history["send_id"] = $conn->getOne("SELECT NEXTVAL('dtb_send_history_send_id_seq')");
+	$dtb_send_history["mail_method"] = $arrData['mail_method'];
+	$dtb_send_history["subject"] = $arrData['subject'];
+	$dtb_send_history["body"] = $arrData['body'];
+	$dtb_send_history["start_date"] = "now()";
+	$dtb_send_history["creator_id"] = $_SESSION['member_id'];
+	$dtb_send_history["send_count"] = $dataCnt;
+	$arrData['body'] = "";
+	$dtb_send_history["search_data"] = serialize($arrData);
+	$conn->autoExecute("dtb_send_history", $dtb_send_history );		
+	
+	if ( is_array( $search_data ) ){
+		foreach( $search_data as $line ){
+			$dtb_send_customer = array();
+			$dtb_send_customer["customer_id"] = $line["customer_id"];
+			$dtb_send_customer["send_id"] = $dtb_send_history["send_id"];
+			$dtb_send_customer["email"] = $line["email"];
+			
+			$dtb_send_customer["name"] = $line["name01"] . " " . $line["name02"];
+				
+			$conn->autoExecute("dtb_send_customer", $dtb_send_customer );					
+		}	
+	}	
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/admin/mail/template_input.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/admin/mail/template_input.php	(revision 2708)
+++ /temp/tags/eccube-0_9_2beta/html/admin/mail/template_input.php	(revision 2708)
@@ -0,0 +1,126 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	
+	var $arrSession;
+	var $site_info;
+	var $objDate;
+	var $arrForm;
+	var $mode;
+	var $arrMagazineType;
+	var $title;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'mail/template_input.tpl';
+		$this->tpl_mainno = 'mail';
+		$this->tpl_subnavi = 'mail/subnavi.tpl';
+		$this->tpl_subno = "template";
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+$objPage->arrMagazineType = $arrMagazineType;
+$objPage->mode = "regist";
+
+// id¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¤È¤­¤Ï¡ÖÊÔ½¸¡×É½¼¨
+if ( $_REQUEST['template_id'] ){
+	$objPage->title = "ÊÔ½¸";
+} else {
+	$objPage->title = "¿·µ¬ÅÐÏ¿";
+}
+
+// ¥â¡¼¥É¤Ë¤è¤ë½èÍýÊ¬´ô
+if ( $_GET['mode'] == 'edit' && sfCheckNumLength($_GET['template_id'])===true ){
+	
+	// ÊÔ½¸
+	$sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND delete = 0";
+	$result = $conn->getAll($sql, array($_GET['template_id']));
+	$objPage->arrForm = $result[0];
+	
+		
+} elseif ( $_POST['mode'] == 'regist' ) {
+	
+	// ¿·µ¬ÅÐÏ¿
+	$objPage->arrForm = lfConvData( $_POST );
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	
+	if ( ! $objPage->arrErr ){
+		// ¥¨¥é¡¼¤¬Ìµ¤¤¤È¤­¤ÏÅÐÏ¿¡¦ÊÔ½¸
+		lfRegistData( $objPage->arrForm, $_POST['template_id']);	
+		sfReload("mode=complete");	// ¼«Ê¬¤òºÆÆÉ¹þ¤·¤Æ¡¢´°Î»²èÌÌ¤ØÁ«°Ü
+	}
+	
+} elseif ( $_GET['mode'] == 'complete' ) {		
+	
+	// ´°Î»²èÌÌÉ½¼¨
+	$objPage->tpl_mainpage = 'mail/template_complete.tpl';
+	
+} 
+
+
+
+
+
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+
+function lfRegistData( $arrVal, $id = null ){
+	
+	$query = new SC_Query();
+	
+	$sqlval['subject'] = $arrVal['subject'];
+	$sqlval['mail_method'] = $arrVal['mail_method'];
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['body'] = $arrVal['body'];
+	
+	if ( $id ){
+		$query->update("dtb_mailmaga_template", $sqlval, "template_id=".$id );
+	} else {
+		$query->insert("dtb_mailmaga_template", $sqlval);
+	}
+}
+
+
+
+function lfConvData( $data ){
+	
+	 // Ê¸»úÎó¤ÎÊÑ´¹¡Êmb_convert_kana¤ÎÊÑ´¹¥ª¥×¥·¥ç¥ó¡Ë							
+	$arrFlag = array(
+					  "subject" => "KV"
+					 ,"body" => "KV"
+					);
+		
+	if ( is_array($data) ){
+		foreach ($arrFlag as $key=>$line) {
+			$data[$key] = mb_convert_kana($data[$key], $line);
+		}
+	}
+
+	return $data;
+}
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck() {
+	$objErr = new SC_CheckError();
+	
+	$objErr->doFunc(array("¥á¡¼¥ë·Á¼°", "mail_method"), array("EXIST_CHECK", "ALNUM_CHECK"));
+	$objErr->doFunc(array("Subject", "subject", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("ËÜÊ¸", 'body', LLTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+
+	return $objErr->arrErr;
+}
+
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/cart/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/cart/index.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/cart/index.php	(revision 2812)
@@ -0,0 +1,106 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $arrProductsClass;
+	var $tpl_total_pretax;
+	var $tpl_total_tax;
+	var $tpl_total_point;
+	var $tpl_message;
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/cartin/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'cart/index.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = "¥«¥´¤ÎÃæ¤ò¸«¤ë";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCartSess = new SC_CartSession();
+$objSiteSess = new SC_SiteSession();
+$objSiteInfo = $objView->objSiteInfo;
+$objCustomer = new SC_Customer();
+// ´ðËÜ¾ðÊó¤Î¼èÆÀ
+$arrInfo = $objSiteInfo->data;
+
+// ¾¦ÉÊ¹ØÆþÃæ¤Ë¥«¡¼¥ÈÆâÍÆ¤¬ÊÑ¹¹¤µ¤ì¤¿¡£
+if($objCartSess->getCancelPurchase()) {
+	$objPage->tpl_message = "¾¦ÉÊ¹ØÆþÃæ¤Ë¥«¡¼¥ÈÆâÍÆ¤¬ÊÑ¹¹¤µ¤ì¤Þ¤·¤¿¤Î¤Ç¡¢¤ª¼ê¿ô¤Ç¤¹¤¬¹ØÆþ¼êÂ³¤­¤ò¤ä¤êÄ¾¤·¤Æ²¼¤µ¤¤¡£";
+}
+
+switch($_POST['mode']) {
+case 'up':
+	$objCartSess->upQuantity($_POST['cart_no']);
+	sfReload();
+	break;
+case 'down':
+	$objCartSess->downQuantity($_POST['cart_no']);
+	sfReload();
+	break;
+case 'delete':
+	$objCartSess->delProduct($_POST['cart_no']);
+	sfReload();
+	break;
+case 'confirm':
+	// ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
+	$arrRet = $objCartSess->getCartList();
+	$max = count($arrRet);
+	$cnt = 0;
+	for ($i = 0; $i < $max; $i++) {
+		// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+		$arrData = sfGetProductsClass($arrRet[$i]['id']);
+		// DB¤ËÂ¸ºß¤¹¤ë¾¦ÉÊ
+		if($arrData != "") {
+			$cnt++;
+		}
+	}
+	// ¥«¡¼¥È¾¦ÉÊ¤¬1·ï°Ê¾åÂ¸ºß¤¹¤ë¾ì¹ç
+	if($cnt > 0) {
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		$pre_uniqid = $objSiteSess->getUniqId();
+		// ÃíÊ¸°ì»þID¤ÎÈ¯¹Ô
+		$objSiteSess->setUniqId();
+		$uniqid = $objSiteSess->getUniqId();
+		// ¥¨¥é¡¼¥ê¥È¥é¥¤¤Ê¤É¤Ç´û¤Ëuniqid¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï¡¢ÀßÄê¤ò°ú¤­·Ñ¤°
+		if($pre_uniqid != "") {
+			$sqlval['order_temp_id'] = $uniqid;
+			$where = "order_temp_id = ?";
+			$objQuery = new SC_Query();
+			$objQuery->update("dtb_order_temp", $sqlval, $where, array($pre_uniqid));
+		}
+		// ¥«¡¼¥È¤ò¹ØÆþ¥â¡¼¥É¤ËÀßÄê
+		$objCartSess->saveCurrentCart($uniqid);
+		// ¹ØÆþ¥Ú¡¼¥¸¤Ø
+		header("Location: " . sfTrimURL(SSL_URL) . URL_SHOP_TOP);		
+	}
+	break;
+default:
+	break;
+}
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+$objPage->arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer);
+
+$objPage->arrInfo = $arrInfo;
+
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	$objPage->tpl_login = true;
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+	$objPage->tpl_name = $objCustomer->getValue('name01');
+}
+
+// Á÷ÎÁÌµÎÁ¤Þ¤Ç¤Î¶â³Û¤ò·×»»
+$tpl_deliv_free = $objPage->arrInfo['free_rule'] - $objPage->tpl_total_pretax;
+$objPage->tpl_deliv_free = $tpl_deliv_free;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/contact/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/contact/index.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/contact/index.php	(revision 2812)
@@ -0,0 +1,204 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/contact/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'contact/index.tpl';
+		$this->tpl_title = '¤ªÌä¤¤¹ç¤ï¤»(ÆþÎÏ¥Ú¡¼¥¸)';
+		$this->tpl_page_category = 'contact';
+		global $arrPref;
+		$this->arrPref = $arrPref;
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$CONF = sf_getBasisData();			// Å¹ÊÞ´ðËÜ¾ðÊó
+sfDomainSessionStart();	 
+
+$objCustomer = new SC_Customer();
+
+if ($objCustomer->isloginSuccess()){
+	$objPage->arrData = $_SESSION['customer'];
+}
+
+//SSLURLÈ½Äê
+if (SSLURL_CHECK == 1){
+	$ssl_url= sfRmDupSlash(SSL_URL.$_SERVER['REQUEST_URI']);
+	if (!ereg("^https://", $non_ssl_url)){
+		sfDispSiteError(URL_ERROR);
+	}
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+//¥Õ¥©¡¼¥àÃÍÊÑ´¹ÍÑ¥«¥é¥à
+$arrConvertColumn = array(
+							 array(  "column" => "name01",		"convert" => "aKV" ),
+							 array(  "column" => "name02",		"convert" => "aKV" ),
+							 array(  "column" => "kana01",		"convert" => "CKV" ),
+							 array(  "column" => "kana02",		"convert" => "CKV" ),
+							 array(  "column" => "zip01",		"convert" => "n" ),
+							 array(  "column" => "zip02",		"convert" => "n" ),
+							 array(  "column" => "pref",		"convert" => "n" ),
+							 array(  "column" => "addr01",		"convert" => "aKV" ),
+							 array(  "column" => "addr02",		"convert" => "aKV" ),
+							 array(  "column" => "email",		"convert" => "a" ),
+							 array(  "column" => "tel01",		"convert" => "n" ),
+							 array(  "column" => "tel02",		"convert" => "n" ),
+							 array(  "column" => "tel03",		"convert" => "n" ),
+							 array(  "column" => "contents",   "convert" => "aKV")
+					      );
+
+switch ($_POST['mode']){
+	case 'confirm':
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm['email'] = strtolower($_POST['email']);
+	$objPage->arrForm = lfConvertParam($objPage->arrForm,$arrConvertColumn);
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	if ( ! $objPage->arrErr ){
+		// ¥¨¥é¡¼Ìµ¤·¤Ç´°Î»²èÌÌ
+		$objPage->tpl_mainpage = 'contact/confirm.tpl';
+		$objPage->tpl_title = '¤ªÌä¤¤¹ç¤ï¤»(³ÎÇ§¥Ú¡¼¥¸)';
+	} else {
+		foreach ($objPage->arrForm as $key => $val){
+		$objPage->$key = $val;
+		}
+	}
+	break;
+	
+	case 'return':
+	foreach ($_POST as $key => $val){
+		$objPage->$key = $val;
+		}
+	break;
+	
+	case 'complete':
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm['email'] = strtolower($_POST['email']);
+	$objPage->arrForm = lfConvertParam($objPage->arrForm,$arrConvertColumn);
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	if(!$objPage->arrErr) {
+		lfSendMail($CONF, $objPage);
+		//´°Î»¥Ú¡¼¥¸¤Ø°ÜÆ°¤¹¤ë
+		header("location: ./complete.php");
+		exit;
+	} else {
+		sfDispSiteError(CUSTOMER_ERROR);
+	}
+	break;
+	
+	default:
+	break;
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//------------------------------------------------------------------------------------------------------------------------------------------
+
+//¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô
+function lfErrorCheck($array) {
+
+	$objErr = new SC_CheckError($array);
+	$objErr->doFunc(array("¤ªÌ¾Á°(À«)", 'name01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°(Ì¾)", 'name02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê(¥»¥¤)", 'kana01', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê(¥á¥¤)", 'kana02', STEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌä¤¤¹ç¤ï¤»ÆâÍÆ", "contents", MLTEXT_LEN), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email02", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email", "email02") ,array("EQUAL_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03', TEL_ITEM_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+	
+
+	return $objErr->arrErr;
+
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrConvertColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrConvertColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+// ------------  ¥á¡¼¥ëÁ÷¿® ------------ 
+
+function lfSendMail($CONF, $objPage){
+	//¡¡¥Ñ¥¹¥ï¡¼¥ÉÊÑ¹¹¤ªÃÎ¤é¤»¥á¡¼¥ëÁ÷¿®
+	
+	$objMailText = new SC_SiteView();
+	$objSiteInfo = $objView->objSiteInfo;
+	$arrInfo = $objSiteInfo->data;
+	$objPage->tpl_shopname=$arrInfo['shop_name'];
+	$objPage->tpl_infoemail = $arrInfo['email02'];
+	$objMailText->assignobj($objPage);
+	$toCustomerMail = $objMailText->fetch("mail_templates/contact_mail.tpl");
+	$objMail = new GC_SendMail();
+	
+	if ( $objPage->arrForm['email'] ) {
+		$fromMail_name = $objPage->arrForm['name01'] ." ÍÍ";
+		$fromMail_address = $objPage->arrForm['email'];
+	} else {
+		$fromMail_name = $CONF["shop_name"];
+		$fromMail_address = $CONF["email02"];
+	}
+	$subject = sfMakeSubject("¤ªÌä¤¤¹ç¤ï¤»¤¬¤¢¤ê¤Þ¤·¤¿¡£");
+	$objMail->setItem(
+						  $CONF["email02"]					//¡¡°¸Àè
+						, $subject							//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $toCustomerMail					//¡¡ËÜÊ¸
+						, $fromMail_address					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $fromMail_name					//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $fromMail_address					//¡¡reply_to
+						, $CONF["email04"]					//¡¡return_path
+						, $CONF["email04"]					//  Errors_to
+														);
+	$objMail->sendMail();
+	
+	$subject = sfMakeSubject("¤ªÌä¤¤¹ç¤ï¤»¤ò¼õ¤±ÉÕ¤±¤Þ¤·¤¿¡£");
+	$objMail->setItem(
+						  ''								//¡¡°¸Àè
+						, $subject							//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $toCustomerMail					//¡¡ËÜÊ¸
+						, $CONF["email03"]					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $CONF["shop_name"]				//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $CONF["email02"]					//¡¡reply_to
+						, $CONF["email04"]					//¡¡return_path
+						, $CONF["email04"]					//  Errors_to
+														);
+	$objMail->setTo($objPage->arrForm['email'], $objPage->arrForm['name01'] ." ÍÍ");
+	$objMail->sendMail();	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/contact/complete.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/contact/complete.php	(revision 2189)
+++ /temp/tags/eccube-0_9_2beta/html/contact/complete.php	(revision 2189)
@@ -0,0 +1,23 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css[1] = '/css/layout/contact/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'contact/complete.tpl';
+		$this->tpl_title .= '¤ªÌä¤¤¹ç¤ï¤»(´°Î»¥Ú¡¼¥¸)';
+		$this->tpl_mainno = 'contact';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/abouts/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/abouts/index.php	(revision 2189)
+++ /temp/tags/eccube-0_9_2beta/html/abouts/index.php	(revision 2189)
@@ -0,0 +1,25 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/abouts/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'abouts/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'abouts';	
+		$this->tpl_title = 'Åö¥µ¥¤¥È¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/regist/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/regist/index.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/regist/index.php	(revision 2812)
@@ -0,0 +1,193 @@
+<?php
+
+require_once("../require.php");
+
+//---- ¥Ú¡¼¥¸É½¼¨¥¯¥é¥¹
+class LC_Page {
+	
+	var $arrSession;
+	var $tpl_mainpage;
+	var $arrPref;
+
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/regist/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+	}
+}
+
+$objConn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteInfo = $objView->objSiteInfo;
+$objCustomer = new SC_Customer();
+$CONF = sf_getBasisData();
+$arrInfo = $objSiteInfo->data;
+
+//--¡¡ËÜÅÐÏ¿´°Î»¤Î¤¿¤á¤Ë¥á¡¼¥ë¤«¤éÀÜÂ³¤·¤¿¾ì¹ç
+if ($_GET["mode"] == "regist") {
+	
+	//-- ÆþÎÏ¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($_GET);
+	if ($objPage->arrErr) {
+		$objPage->tpl_mainpage = 'regist/error.tpl';
+		$objPage->tpl_css = "/css/layout/regist/error.css";
+		$objPage->tpl_title = '¥¨¥é¡¼';
+
+	} else {
+		//$objPage->tpl_mainpage = 'regist/complete.tpl';
+		//$objPage->tpl_title = ' ²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';
+		$registSecretKey = lfRegistData($_GET);			//ËÜ²ñ°÷ÅÐÏ¿¡Ê¥Õ¥é¥°ÊÑ¹¹¡Ë
+		lfSendRegistMail($registSecretKey);				//ËÜ²ñ°÷ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+
+		// ¥í¥°¥¤¥óºÑ¤ß¤Î¾õÂÖ¤Ë¤¹¤ë¡£
+		$objQuery = new SC_Query();
+		$email = $objQuery->get("dtb_customer", "email", "secret_key = ?", array($registSecretKey));
+		$objCustomer->setLogin($email);
+		header("Location: ./complete.php");
+		exit;
+	}
+
+//--¡¡¤½¤ì°Ê³°¤Î¥¢¥¯¥»¥¹¤ÏÌµ¸ú¤È¤¹¤ë
+} else {
+	$objPage->arrErr["id"] = "Ìµ¸ú¤Ê¥¢¥¯¥»¥¹¤Ç¤¹¡£";
+	$objPage->tpl_mainpage = 'regist/error.tpl';
+	$objPage->tpl_css = "/css/layout/regist/error.css";
+	$objPage->tpl_title = '¥¨¥é¡¼';
+
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//---- ÅÐÏ¿
+function lfRegistData($array) {
+	global $objConn;
+	global $arrInfo;
+	
+	do {
+		$secret = sfGetUniqRandomId("r");
+	} while( ($result = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($secret)) ) != 0);
+
+	$sql = "SELECT email FROM dtb_customer WHERE secret_key = ? AND status = 1";
+	$email = $objConn->getOne($sql, array($array["id"]));
+
+	$objConn->query("BEGIN");
+	$arrRegist["secret_key"] = $secret;	//¡¡ËÜÅÐÏ¿IDÈ¯¹Ô
+	$arrRegist["status"] = 2;
+	$arrRegist["update_date"] = "NOW()";
+	
+	$objQuery = new SC_Query();
+	$where = "secret_key = ? AND status = 1";
+	
+	$arrRet = $objQuery->select("point", "dtb_customer", $where, array($array["id"]));
+	// ²ñ°÷ÅÐÏ¿»þ¤Î²Ã»»¥Ý¥¤¥ó¥È(¹ØÆþ»þ²ñ°÷ÅÐÏ¿¤Î¾ì¹ç¤Ï¡¢¥Ý¥¤¥ó¥È²Ã»»¡Ë
+	$arrRegist['point'] = $arrRet[0]['point'] + addslashes($arrInfo['welcome_point']);
+	
+	$objQuery->update("dtb_customer", $arrRegist, $where, array($array["id"]));
+	
+	$ret = $objQuery->getLastQuery(false);
+	
+	/* ¹ØÆþ»þÅÐÏ¿¤Î¾ì¹ç¡¢¤½¤Î²ó¤Î¹ØÆþ¤ò²ñ°÷¹ØÆþ¤È¤ß¤Ê¤¹¡£ */
+	// ²ñ°÷¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+	$where1 = "secret_key = ? AND status = 2";
+	$customer = $objQuery->select("*", "dtb_customer", $where1, array($secret));
+	// ½é²ó¹ØÆþ¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+//	$where2 = "member_check = 1 AND order_email = ? AND password = ?";
+//	$order_temp_id = $objQuery->get("dtb_order_temp", "order_temp_id", $where2, array($customer[0]['email'], $customer[0]['password']));
+	$order_temp_id = $objQuery->get("dtb_order_temp", "order_temp_id");
+	// ¹ØÆþ¾ðÊó¤Î¹¹¿·
+	if ($order_temp_id != null) {
+		$arrCustomer['customer_id'] = $customer[0]['customer_id'];
+		$where3 = "order_temp_id = ?";
+		$objQuery->update("dtb_order_temp", $arrCustomer, $where3, array($order_temp_id));
+		$objQuery->update("dtb_order", $arrCustomer, $where3, array($order_temp_id));
+	}
+
+	$sql = "SELECT mail_flag FROM dtb_customer_mail WHERE email = ?";
+	$result = $objConn->getOne($sql, array($email));
+	
+	switch($result) {
+	// ²¾HTML
+	case '4':
+		$arrRegistMail["mail_flag"] = 1;
+		break;
+	// ²¾TEXT
+	case '5':
+		$arrRegistMail["mail_flag"] = 2;
+		break;
+	// ²¾¤Ê¤·
+	case '6':
+		$arrRegistMail["mail_flag"] = 3;
+		break;
+	default:
+		$arrRegistMail["mail_flag"] = $result;
+		break;
+	}
+
+	$objConn->autoExecute("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($email). "'");
+	$objConn->query("COMMIT");
+		
+	return $secret;		// ËÜÅÐÏ¿ID¤òÊÖ¤¹
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+
+	$objErr->doFunc(array("²¾ÅÐÏ¿ID", 'id'), array("EXIST_CHECK"));
+	if (! EregI("^[[:alnum:]]+$",$array["id"] )) {
+		$objErr->arrErr["id"] = "Ìµ¸ú¤ÊURL¤Ç¤¹¡£¥á¡¼¥ë¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ëËÜ²ñ°÷ÅÐÏ¿ÍÑURL¤òºÆÅÙ¤´³ÎÇ§¤¯¤À¤µ¤¤¡£";
+	}
+	if (! $objErr->arrErr["id"]) {
+
+		$sql = "SELECT customer_id FROM dtb_customer WHERE secret_key = ? AND status = 1 AND delete = 0";
+		$result = $objConn->getOne($sql, array($array["id"]));
+
+		if (! is_numeric($result)) {
+			$objErr->arrErr["id"] .= "¢¨ ´û¤Ë²ñ°÷ÅÐÏ¿¤¬´°Î»¤·¤Æ¤¤¤ë¤«¡¢Ìµ¸ú¤ÊURL¤Ç¤¹¡£<br>";
+			return $objErr->arrErr;
+
+		}
+	}
+
+	return $objErr->arrErr;
+}
+
+//---- Àµ²ñ°÷ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+function lfSendRegistMail($registSecretKey) {
+	global $objConn;
+	global $CONF;
+
+	//-- À«Ì¾¤ò¼èÆÀ
+	$sql = "SELECT email, name01, name02 FROM dtb_customer WHERE secret_key = ?";
+	$result = $objConn->getAll($sql, array($registSecretKey));
+	$data = $result[0];
+	
+	//--¡¡¥á¡¼¥ëÁ÷¿®
+	$objMailText = new SC_SiteView();
+	$objMailText->assign("CONF", $CONF);
+	$objMailText->assign("name01", $data["name01"]);
+	$objMailText->assign("name02", $data["name02"]);
+	$toCustomerMail = $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
+	$subject = sfMakeSubject('ËÜ²ñ°÷ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
+	$objMail = new GC_SendMail();
+
+	$objMail->setItem(
+						  ''								//¡¡°¸Àè
+						, $subject//"¡Ú" .$CONF["shop_name"]. "¡Û".ENTRY_CUSTOMER_REGIST_SUBJECT 		//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+						, $toCustomerMail					//¡¡ËÜÊ¸
+						, $CONF["email03"]					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+						, $CONF["shop_name"]				//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+						, $CONF["email03"]					//¡¡reply_to
+						, $CONF["email04"]					//¡¡return_path
+						, $CONF["email04"]					//  Errors_to
+					);
+	// °¸Àè¤ÎÀßÄê
+	$name = $data["name01"] . $data["name02"] ." ÍÍ";
+	$objMail->setTo($data["email"], $name);
+	$objMail->sendMail();
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/regist/complete.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/regist/complete.php	(revision 2185)
+++ /temp/tags/eccube-0_9_2beta/html/regist/complete.php	(revision 2185)
@@ -0,0 +1,22 @@
+<?php
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = 'regist/complete.tpl';
+		$this->tpl_css = '/css/layout/regist/complete.css';
+		$this->tpl_title = '²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/index.php	(revision 3715)
+++ /temp/tags/eccube-0_9_2beta/html/index.php	(revision 3715)
@@ -0,0 +1,25 @@
+<?php
+
+require_once("./require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_css = '/css/layout/index.css';						// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . 'html/user_data/templates/top.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+$conn = new SC_DBConn();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "index.php");
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/inquiry/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/inquiry/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/inquiry/index.php	(revision 1328)
@@ -0,0 +1,237 @@
+<?php
+require_once("../admin/require.php");
+
+class LC_Page {
+	var $errmsg;
+	var $arrPref;
+	
+	var $QUESTION;
+	var $question_id;
+	
+	function LC_Page() {
+		$this->tpl_mainpage = 'inquiry/index.tpl';
+		$this->tpl_mainno = 'contents';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSess = new SC_Session();
+
+
+// ÅÔÆ»ÉÜ¸©¥×¥ë¥À¥¦¥óÍÑÇÛÎó
+$objPage->arrPref = $arrPref;	
+
+// CSVÊÝÂ¸¹àÌÜ
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó ¥ª¥×¥·¥ç¥ó°Ê³°
+$arrRegistColumn = array(
+							 array(  "column" => "name01", "convert" => "aKV" ),
+							 array(  "column" => "name02", "convert" => "aKV" ),
+							 array(  "column" => "kana01", "convert" => "CKV" ),
+							 array(  "column" => "kana02", "convert" => "CKV" ),
+							 array(  "column" => "zip01", "convert" => "n" ),
+							 array(  "column" => "zip02", "convert" => "n" ),
+							 array(  "column" => "pref", "convert" => "n" ),
+							 array(  "column" => "addr01", "convert" => "aKV" ),
+							 array(  "column" => "addr02", "convert" => "aKV" ),
+							 array(  "column" => "email", "convert" => "a" ),
+							 array(  "column" => "email02", "convert" => "a" ),
+							 array(  "column" => "tel01", "convert" => "n" ),
+							 array(  "column" => "tel02", "convert" => "n" ),
+							 array(  "column" => "tel03", "convert" => "n" ),
+					);
+
+		
+		
+if ( ( ! $_POST['mode'] == 'confirm' ) && ( ! is_numeric($_REQUEST['question_id']) ) ){
+	echo "ÉÔÀµ¥¢¥¯¥»¥¹";
+	exit;
+}
+
+// ¥Æ¥ó¥×¥ì¡¼¥ÈÅÐÏ¿¹àÌÜ¼èÆÀ
+$sql = "SELECT question_id, question FROM dtb_question WHERE question_id = ?";
+$result = $conn->getAll( $sql, array($_REQUEST['question_id']) );
+$objPage->QUESTION = lfGetArrInput( unserialize( $result[0]['question'] ) );
+
+$objPage->question_id = $_REQUEST['question_id'];
+
+$objPage->arrHidden = sfMakeHiddenArray($_POST);
+unset($objPage->arrHidden['mode']);
+
+if ( (int)$objPage->QUESTION["delete"] !== 0 ){
+
+	$objPage->tpl_mainpage = "inquiry/closed.tpl";
+	
+} elseif( $_POST['mode'] == "confirm" ) {
+	
+	//--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrForm = $_POST;	
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);	
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	$objPage->arrErr = lfGetArrInput($objPage->arrErr);
+		
+	if( ! $objPage->arrErr ) {
+		$objPage->tpl_mainpage = "inquiry/confirm.tpl";
+	}
+	
+
+}elseif( $_POST['mode'] == "return"){
+	$objPage->arrForm = $_POST;
+
+}elseif( $_POST['mode'] == "regist" )  {
+
+	//--¡¡ÆþÎÏÊ¸»ú¡¦ÊÑ´¹¡õ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrForm = $_POST;
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+	$objPage->arrErr = lfGetArrInput($objPage->arrErr);
+
+	
+	if( ! $objPage->arrErr ) {
+	
+		//´°Î»²èÌÌ
+		$objPage->tpl_mainpage = "inquiry/complete.tpl";
+
+		
+		//--------- ¢§ SQL ---------//
+			
+			// ¥Æ¡¼¥Ö¥ë¤ËÆþ¤ì¤ë¤è¤¦¤ËÀ°·Á¤¹¤ë
+			$arrOption = $objPage->arrForm['option'];
+			unset ($objPage->arrForm['email02']);
+			$objPage->arrForm['mail01'] = $objPage->arrForm['email'];
+			unset ($objPage->arrForm['email']);
+			unset ($objPage->arrForm['option']);
+			$objPage->arrForm['question_id'] = $objPage->question_id;
+			$objPage->arrForm['question_name'] = $objPage->QUESTION['title'];
+			for ( $i=0; $i<(count($arrOption)); $i++ ){
+				$tmp = "";
+				if ( is_array($arrOption[$i]) ){
+					for( $j=0; $j<count($arrOption[$i]); $j++){
+						if ( $j>0 ) $tmp .= ",";
+						$tmp .= $arrOption[$i][$j];
+					}
+					$objPage->arrForm['question0'.($i+1)] = $tmp; 
+				} else {
+					$objPage->arrForm['question0'.($i+1)] = $arrOption[$i]; 
+				}
+			}
+			
+			// £Ä£ÂÅÐÏ¿
+			$conn->autoExecute("dtb_question_result", $objPage->arrForm );
+			
+		//--------- ¢¥ SQL ---------//
+
+	}
+}
+
+$objPage->cnt_question = 6;
+$objPage->arrActive = $arrActive;
+$objPage->arrQuestion = $arrQuestion;
+
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->_smarty->register_function("lfArray_Search_key_Smarty","lfArray_Search_key_Smarty");
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+// ------------  ¥¨¥é¡¼¥Á¥§¥Ã¥¯½èÍýÉô ------------  
+function lfErrorCheck($array) {
+
+	$objErr = new SC_CheckError($array);
+
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê(¥»¥¤¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK", "NUM_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email02", MTEXT_LEN) ,array("EXIST_CHECK", "SPTAB_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email", "email02") ,array("EQUAL_CHECK"));
+	
+	$objErr->arrErr["option"] =  array_map( "lfCheckNull", (array)$_POST['option'] );
+	
+	return $objErr->arrErr;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	$new_array = array();
+	foreach ($arrConvList as $key => $val) {
+		$new_array[$key] = $array[$key];
+		if( strlen($val) > 0) {
+			$new_array[$key] = mb_convert_kana($new_array[$key] ,$val);
+		}
+	}
+	
+	// ¥ª¥×¥·¥ç¥óÇÛÎóÍÑ
+	for ($i=0; $i<count($array['option']); $i++){
+		if ( is_array($array['option'][$i]) ){
+			$new_array['option'][$i] = $array['option'][$i];
+		} else {
+			$new_array['option'][$i] = mb_convert_kana($array['option'][$i] ,"aKV");
+		}
+	}
+	
+
+	return $new_array;
+	
+}
+
+function lfGetArrInput( $arr ){
+	// ÃÍ¤¬ÆþÎÏ¤µ¤ì¤¿ÇÛÎó¤Î¤ß¤òÊÖ¤¹
+	
+	if ( is_array($arr)	){
+		foreach ( $arr as $key=>$val ) {
+			if ( is_string($val) && strlen($val) > 0 ){
+				$return[$key] = $val;
+			} elseif ( is_array( $val ) ) {
+				$data = lfGetArrInput ( $val );
+				if ( $data ){
+					$return[$key] = $data;
+				}
+			}
+		}
+	}
+	return $return;
+}
+
+function lfArray_Search_key_Smarty ( $palams ){
+
+	$val = $palams['val'];
+	$arr = $palams['arr']; 
+	
+	$revers_arr = array_flip($arr);
+	return array_search( $val ,$revers_arr );
+
+	
+}
+
+function lfCheckNull ( $val ){
+	
+
+	if ( ( ! is_array( $val ) ) && ( strlen( $val ) < 1 ) ){
+		$return = "1";
+	} elseif ( is_array( $val ) ) {
+		foreach ($val as $line) {
+			$return = lfCheckNull( $line );
+		}
+	}
+	return $return;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/entry/kiyaku.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/entry/kiyaku.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/entry/kiyaku.php	(revision 1328)
@@ -0,0 +1,34 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'entry/kiyaku.tpl';
+		$this->tpl_title="¤´ÍøÍÑµ¬Ìó";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+// µ¬ÌóÆâÍÆ¤Î¼èÆÀ
+$objQuery = new SC_Query();
+$objQuery->setorder("rank DESC");
+$arrRet = $objQuery->select("kiyaku_title, kiyaku_text", "dtb_kiyaku", "delete <> 1");
+
+$max = count($arrRet);
+$objPage->tpl_kiyaku_text = "";
+for ($i = 0; $i < $max; $i++) {
+	$objPage->tpl_kiyaku_text.=$arrRet[$i]['kiyaku_title'] . "\n\n"; 
+	$objPage->tpl_kiyaku_text.=$arrRet[$i]['kiyaku_text'] . "\n\n"; 
+}
+
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/entry/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/entry/index.php	(revision 1953)
+++ /temp/tags/eccube-0_9_2beta/html/entry/index.php	(revision 1953)
@@ -0,0 +1,319 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/entry/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'entry/index.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title .= '²ñ°÷ÅÐÏ¿(ÆþÎÏ¥Ú¡¼¥¸)';			//¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+	}
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$CONF = sf_getBasisData();					// Å¹ÊÞ´ðËÜ¾ðÊó
+$objConn = new SC_DbConn();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
+$objPage->arrPref = $arrPref;
+$objPage->arrJob = $arrJob;
+$objPage->arrReminder = $arrReminder;
+$objPage->arrYear = $objDate->getYear('', 1950);	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+//SSLURLÈ½Äê
+if (SSLURL_CHECK == 1){
+	$ssl_url= sfRmDupSlash(SSL_URL.$_SERVER['REQUEST_URI']);
+	if (!ereg("^https://", $non_ssl_url)){
+		sfDispSiteError(URL_ERROR);
+	}
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$arrRegistColumn = array(
+							 array(  "column" => "name01", "convert" => "aKV" ),
+							 array(  "column" => "name02", "convert" => "aKV" ),
+							 array(  "column" => "kana01", "convert" => "CKV" ),
+							 array(  "column" => "kana02", "convert" => "CKV" ),
+							 array(  "column" => "zip01", "convert" => "n" ),
+							 array(  "column" => "zip02", "convert" => "n" ),
+							 array(  "column" => "pref", "convert" => "n" ),
+							 array(  "column" => "addr01", "convert" => "aKV" ),
+							 array(  "column" => "addr02", "convert" => "aKV" ),
+							 array(  "column" => "email", "convert" => "a" ),
+							 array(  "column" => "email2", "convert" => "a" ),
+							 array(  "column" => "email_mobile", "convert" => "a" ),
+							 array(  "column" => "email_mobile2", "convert" => "a" ),
+							 array(  "column" => "tel01", "convert" => "n" ),
+							 array(  "column" => "tel02", "convert" => "n" ),
+							 array(  "column" => "tel03", "convert" => "n" ),
+							 array(  "column" => "fax01", "convert" => "n" ),
+							 array(  "column" => "fax02", "convert" => "n" ),
+							 array(  "column" => "fax03", "convert" => "n" ),
+							 array(  "column" => "sex", "convert" => "n" ),
+							 array(  "column" => "job", "convert" => "n" ),
+							 array(  "column" => "birth", "convert" => "n" ),
+							 array(  "column" => "reminder", "convert" => "n" ),
+							 array(  "column" => "reminder_answer", "convert" => "aKV"),
+							 array(  "column" => "password", "convert" => "a" ),
+							 array(  "column" => "password02", "convert" => "a" )
+						 );
+
+//---- ÅÐÏ¿½ü³°ÍÑ¥«¥é¥àÇÛÎó
+$arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
+
+
+
+if ($_SERVER["REQUEST_METHOD"] == "POST") {
+
+	//-- POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = $_POST;
+	
+	if($objPage->arrForm['year'] == '----') {
+		$objPage->arrForm['year'] = '';
+	}
+	
+	$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	$objPage->arrForm['email02'] = strtolower($objPage->arrForm['email02']);	// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+		
+	//--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+
+	if ($objPage->arrErr || $_POST["mode"] == "return") {		// ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+		foreach($objPage->arrForm as $key => $val) {
+			$objPage->$key = $val;
+		}
+
+	} else {
+
+		//--¡¡³ÎÇ§
+		if ($_POST["mode"] == "confirm") {
+			foreach($objPage->arrForm as $key => $val) {
+				if ($key != "mode" && $key != "subm") $objPage->list_data[ $key ] = $val;
+			}
+			//¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨
+			$passlen = strlen($objPage->arrForm['password']);
+			$objPage->passlen = lfPassLen($passlen);
+			
+			$objPage->tpl_css = '/css/layout/entry/confirm.css';
+			$objPage->tpl_mainpage = 'entry/confirm.tpl';
+			$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(³ÎÇ§¥Ú¡¼¥¸)';
+
+		}
+
+		//--¡¡²¾ÅÐÏ¿¤È´°Î»²èÌÌ
+		if ($_POST["mode"] == "complete") {
+			$objPage->uniqid = lfRegistData ($objPage->arrForm, $arrRegistColumn, $arrRejectRegistColumn);
+			
+			$objPage->tpl_css = '/css/layout/entry/complete.css';
+			$objPage->tpl_mainpage = 'entry/complete.tpl';
+			$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';
+			
+			//¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+			$objPage->CONF = $CONF;
+			$objPage->to_name01 = $_POST['name01'];
+			$objPage->to_name02 = $_POST['name02'];
+			$objMailText = new SC_SiteView();
+			$objMailText->assignobj($objPage);
+			$subject = sfMakesubject('²ñ°÷ÅÐÏ¿¤Î¤´³ÎÇ§');
+			$toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
+			$objMail = new GC_SendMail();
+			$objMail->setItem(
+								''									//¡¡°¸Àè
+								, $subject							//¡¡¥µ¥Ö¥¸¥§¥¯¥È
+								, $toCustomerMail					//¡¡ËÜÊ¸
+								, $CONF["email03"]					//¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
+								, $CONF["shop_name"]				//¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
+								, $CONF["email03"]					//¡¡reply_to
+								, $CONF["email04"]					//¡¡return_path
+								, $CONF["email04"]					//  Errors_to
+								, $CONF["email01"]					//  Bcc
+																);
+			// °¸Àè¤ÎÀßÄê
+			$name = $_POST["name01"] . $_POST["name02"] ." ÍÍ";
+			$objMail->setTo($_POST["email"], $name);			
+			$objMail->sendMail();
+			
+			// ´°Î»¥Ú¡¼¥¸¤Ë°ÜÆ°¤µ¤»¤ë¡£
+			header("Location: ./complete.php");
+			exit;
+		}
+	}
+}
+
+if($objPage->year == '') {
+	$objPage->year = '----';
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//----------------------------------------------------------------------------------------------------------------------
+
+//---- function·²
+function lfRegistData ($array, $arrRegistColumn, $arrRejectRegistColumn) {
+	global $objConn;
+
+	// ²¾ÅÐÏ¿
+	foreach ($arrRegistColumn as $data) {
+		if (strlen($array[ $data["column"] ]) > 0 && ! in_array($data["column"], $arrRejectRegistColumn)) {
+			$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+		}
+	}
+		
+	// ÃÂÀ¸Æü¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if (strlen($array["year"]) > 0 ) {
+		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+	}
+	
+	// ¥Ñ¥¹¥ï¡¼¥É¤Î°Å¹æ²½
+	$arrRegist["password"] = crypt($arrRegist["password"]);
+	
+	$count = 1;
+	while ($count != 0) {
+		$uniqid = sfGetUniqRandomId("t");
+		$count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
+	}
+	
+	$arrRegist["secret_key"] = $uniqid;	//¡¡²¾ÅÐÏ¿IDÈ¯¹Ô
+	
+	//-- ²¾ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+	$objConn->autoExecute("dtb_customer", $arrRegist);
+	
+	//--¡¡Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¤«¤ÎÈ½Äê
+	$sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
+	$mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
+
+	//--¡¡¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¼Â¹Ô
+	$arrRegistMail["email"] = $arrRegist["email"];	
+	if ($array["mail_flag"] == 1) {
+		$arrRegistMail["mail_flag"] = 4; 
+	} elseif ($array["mail_flag"] == 2) {
+		$arrRegistMail["mail_flag"] = 5; 
+	} else {
+		$arrRegistMail["mail_flag"] = 6; 
+	}
+	
+	// Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¾ì¹ç
+	if ($mailResult == 1) {		
+		$objConn->autoExecute("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");			
+	} else {				//¡¡¿·µ¬ÅÐÏ¿¤Î¾ì¹ç
+		$objConn->autoExecute("dtb_customer_mail", $arrRegistMail);		
+	}
+
+	$objConn->query("COMMIT");
+
+	return $uniqid;
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+function lfConvertParam($array, $arrRegistColumn) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	// ¥«¥é¥àÌ¾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
+	foreach ($arrRegistColumn as $data) {
+		$arrConvList[ $data["column"] ] = $data["convert"];
+	}
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(strlen(($array[$key])) > 0) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤ªÌ¾Á°¡ÊÌ¾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥»¥¤¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("¥Õ¥ê¥¬¥Ê¡Ê¥á¥¤¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK")); 
+	$objErr->doFunc(array("Í¹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
+	$objErr->doFunc(array("ÅÔÆ»ÉÜ¸©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê1", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¤´½»½ê2", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email02", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK","SPTAB_CHECK" , "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', '¥á¡¼¥ë¥¢¥É¥ì¥¹(³ÎÇ§)', "email", "email02") ,array("EQUAL_CHECK"));
+
+	//¸½²ñ°÷¤ÎÈ½Äê ¢ª¡¡¸½²ñ°÷¤â¤·¤¯¤Ï²¾ÅÐÏ¿Ãæ¤Ï¡¢¥á¥¢¥É°ì°Õ¤¬Á°Äó¤Ë¤Ê¤Ã¤Æ¤ë¤Î¤ÇÆ±¤¸¥á¥¢¥É¤ÇÅÐÏ¿ÉÔ²Ä
+	if (strlen($array["email"]) > 0) {
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("email, update_date, delete", "dtb_customer","email ILIKE ? ORDER BY delete", array($array["email"]));
+				
+		if(count($arrRet) > 0) {
+			if($arrRet[0]['delete'] != '1') {
+				// ²ñ°÷¤Ç¤¢¤ë¾ì¹ç
+				$objErr->arrErr["email"] .= "¢¨ ¤¹¤Ç¤Ë²ñ°÷ÅÐÏ¿¤Ç»ÈÍÑ¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£<br />";
+			} else {
+				// Âà²ñ¤·¤¿²ñ°÷¤Ç¤¢¤ë¾ì¹ç
+				$leave_time = sfDBDatetoTime($arrRet[0]['update_date']);
+				$now_time = time();
+				$pass_time = $now_time - $leave_time;
+				// Âà²ñ¤«¤é²¿»þ´Ö-·Ð²á¤·¤Æ¤¤¤ë¤«È½Äê¤¹¤ë¡£
+				$limit_time = ENTRY_LIMIT_HOUR * 3600;						
+				if($pass_time < $limit_time) {
+					$objErr->arrErr["email"] .= "¢¨ Âà²ñ¤«¤é°ìÄê´ü´Ö¤Î´Ö¤Ï¡¢Æ±¤¸¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò»ÈÍÑ¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br />";
+				}
+			}
+		}
+	}
+
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK" ));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK" ));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK" ));
+	$objErr->doFunc(array("¤ªÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03",TEL_ITEM_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ1", 'fax01'), array("SPTAB_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ2", 'fax02'), array("SPTAB_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ3", 'fax03'), array("SPTAB_CHECK"));
+	$objErr->doFunc(array("FAXÈÖ¹æ", "fax01", "fax02", "fax03", TEL_ITEM_LEN) ,array("TEL_CHECK"));
+	$objErr->doFunc(array("¤´À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É(³ÎÇ§)", 'password02', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK"));
+	$objErr->doFunc(array('¥Ñ¥¹¥ï¡¼¥É', '¥Ñ¥¹¥ï¡¼¥É(³ÎÇ§)', "password", "password02") ,array("EQUAL_CHECK"));
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¥Ò¥ó¥È ¼ÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¥Ò¥ó¥È Åú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", "mail_flag") ,array("SELECT_CHECK", "NUM_CHECK"));
+	
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
+	$objErr->doFunc(array("¥á¡¼¥ë¥Þ¥¬¥¸¥ó", 'mail_flag'), array("SELECT_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+//³ÎÇ§¥Ú¡¼¥¸ÍÑ¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨ÍÑ
+
+function lfPassLen($passlen){
+	$ret = "";
+	for ($i=0;$i<$passlen;true){
+	$ret.="*";
+	$i++;
+	}
+	return $ret;
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/entry/complete.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/entry/complete.php	(revision 2192)
+++ /temp/tags/eccube-0_9_2beta/html/entry/complete.php	(revision 2192)
@@ -0,0 +1,24 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = '/css/layout/entry/complete.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		$this->tpl_mainpage = 'entry/complete.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title .= '²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';			//¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//----------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/best5.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/best5.php	(revision 2812)
+++ /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/best5.php	(revision 2812)
@@ -0,0 +1,36 @@
+<?php
+
+class LC_Best5Page {
+	function LC_Best5Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'best5.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_Best5Page();
+$objSubView = new SC_SiteView();
+$objSiteInfo = $objView->objSiteInfo;
+
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objSubPage->arrInfo = $objSiteInfo->data;
+
+//¤ª¤¹¤¹¤á¾¦ÉÊÉ½¼¨
+$objSubPage->arrBestProducts = lfGetRanking();
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+//¤ª¤¹¤¹¤á¾¦ÉÊ¸¡º÷
+function lfGetRanking(){
+	$objQuery = new SC_Query();
+	
+	$col = "A.*, B.name, B.price02_min, B.price01_min, B.main_list_image ";
+	$from = "dtb_best_products AS A INNER JOIN vw_products_allclass AS B ON A.product_id = B.product_id";
+	$where = "status = 1";
+	$order = "rank";
+	$objQuery->setorder($order);
+	$arrBestProducts = $objQuery->select($col, $from, $where);
+	return $arrBestProducts;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/login.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/login.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/login.php	(revision 1328)
@@ -0,0 +1,53 @@
+<?php
+class LC_LoginPage {
+	var $tpl_login_email;
+	function LC_LoginPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'login.tpl';	// ¥á¥¤¥ó
+		$this->tpl_login = false;
+		$this->tpl_disable_logout = false;
+	}
+}
+
+$objSubPage = new LC_LoginPage();
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+
+// ¥í¥°¥¤¥óÈ½Äê
+if($objCustomer->isLoginSuccess()) {
+	$objSubPage->tpl_login = true;
+	$objSubPage->tpl_user_point = $objCustomer->getValue('point');
+	$objSubPage->tpl_name1 = $objCustomer->getValue('name01');
+	$objSubPage->tpl_name2 = $objCustomer->getValue('name02');
+} else {
+	// ¥¯¥Ã¥­¡¼È½Äê
+	$objSubPage->tpl_login_email = $objCookie->getCookie('login_email');
+	if($objSubPage->tpl_login_email != "") {
+		$objSubPage->tpl_login_memory = "1";
+	}
+	
+	// POST¤µ¤ì¤Æ¤­¤¿ID¤¬¤¢¤ë¾ì¹ç¤ÏÍ¥Àè¤¹¤ë¡£
+	if($_POST['login_email'] != "") {
+		$objSubPage->tpl_login_email = $_POST['login_email'];
+	}
+}
+
+$objSubPage->tpl_disable_logout = lfCheckDisableLogout();
+$objSubView = new SC_SiteView();
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+function lfCheckDisableLogout() {
+	global $arrDISABLE_LOGOUT;
+	
+	$nowpage = $_SERVER['PHP_SELF'];
+	
+	foreach($arrDISABLE_LOGOUT as $val) {
+		if($nowpage == $val) {
+			return true;
+		}
+ 	}
+	return false;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/search_products.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/search_products.php	(revision 3381)
+++ /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/search_products.php	(revision 3381)
@@ -0,0 +1,30 @@
+<?php
+
+class LC_SearchProductsPage {
+	function LC_SearchProductsPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'search_products.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_SearchProductsPage();
+$arrSearch = array();	// ¸¡º÷¹àÌÜÉ½¼¨ÍÑ
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+$objSubPage->category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+// ¥«¥Æ¥´¥ê¸¡º÷ÍÑÁªÂò¥ê¥¹¥È
+$arrRet = sfGetCategoryList('', true, '¡¡');
+
+if(is_array($arrRet)) {
+	// Ê¸»ú¥µ¥¤¥º¤òÀ©¸Â¤¹¤ë
+	foreach($arrRet as $key => $val) {
+		$arrRet[$key] = sfCutString($val, SEARCH_CATEGORY_LEN);
+	}
+}
+$objSubPage->arrCatList = $arrRet;
+
+$objSubView = new SC_SiteView();
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/cart.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/cart.php	(revision 3452)
+++ /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/cart.php	(revision 3452)
@@ -0,0 +1,63 @@
+<?php
+
+class LC_CartPage {
+	function LC_CartPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'cart.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_CartPage();
+$objSubView = new SC_SiteView();
+$objCart = new SC_CartSession();
+$objSiteInfo = $objView->objSiteInfo;
+
+if (count($_SESSION[$objCart->key]) > 0){
+	// ¥«¡¼¥È¾ðÊó¤ò¼èÆÀ
+	$arrCartList = $objCart->getCartList();
+	
+	// ¥«¡¼¥ÈÆâ¤Î¾¦ÉÊ£É£Ä°ìÍ÷¤ò¼èÆÀ
+	$arrAllProductID = $objCart->getAllProductID();
+	// ¾¦ÉÊ¤¬1¤Ä°Ê¾åÆþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¾¦ÉÊÌ¾¾Î¤ò¼èÆÀ
+	if (count($arrAllProductID) > 0){
+		$objQuery = new SC_Query();
+		$arrVal = array();
+		$sql = "";
+		$sql = "SELECT name FROM dtb_products WHERE product_id IN ( ?";
+		$arrVal = array($arrAllProductID[0]);
+		for($i = 1 ; $i < count($arrAllProductID) ; $i++){
+			$sql.= " ,? ";
+			array_push($arrVal, $arrAllProductID[$i]);
+		}
+		$sql.= " )";
+		
+		$arrProduct_name = $objQuery->getAll($sql, $arrVal);
+		
+		foreach($arrProduct_name as $key => $val){
+			$arrCartList[$key]['product_name'] = $val['name'];
+		}
+	}
+	// Å¹ÊÞ¾ðÊó¤Î¼èÆÀ
+	$arrInfo = $objSiteInfo->data;
+	// ¹ØÆþ¶â³Û¹ç·×
+	$ProductsTotal = $objCart->getAllProductsTotal($arrInfo);
+	
+	// ¹ç·×¸Ä¿ô
+	$TotalQuantity = $objCart->getTotalQuantity();
+	
+	// Á÷ÎÁÌµÎÁ¤Þ¤Ç¤Î¶â³Û
+	$deliv_free = $arrInfo['free_rule'] - $ProductsTotal;
+	$arrCartList[0]['free_rule'] = $arrInfo['free_rule'];
+	$arrCartList[0]['ProductsTotal'] = $ProductsTotal;
+	$arrCartList[0]['TotalQuantity'] = $TotalQuantity;
+	$arrCartList[0]['deliv_free'] = $deliv_free;
+	
+	
+	$objSubPage->arrCartList = $arrCartList;
+}
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/news.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/news.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/news.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+
+class LC_NewsPage {
+	function LC_NewsPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'news.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_NewsPage();
+$objSubView = new SC_SiteView();
+
+//¿·Ãå¾ðÊó¼èÆÀ
+$objSubPage->arrNews = lfGetNews();
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+function lfGetNews(){
+	$conn = new SC_DBConn();
+	$sql = "SELECT *, to_char(news_date, 'YYYY/MM/DD') as news_date_disp FROM dtb_news WHERE delete = '0' ORDER BY rank DESC";
+	$list_data = $conn->getAll($sql);
+	return $list_data;	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/category.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/category.php	(revision 1347)
+++ /temp/tags/eccube-0_9_2beta/html/frontparts/bloc/category.php	(revision 1347)
@@ -0,0 +1,57 @@
+<?php
+
+class LC_CatPage {
+	function LC_CatPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = ROOT_DIR . BLOC_DIR.'category.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_CatPage();
+$objSubView = new SC_SiteView();
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+$category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+
+// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID
+$objSubPage->tpl_category_id = $category_id;
+$objSubPage = lfGetCatTree($category_id, true, $objSubPage);
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+// ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ
+function lfGetCatTree($parent_category_id, $count_check = false, $objSubPage) {
+	$objQuery = new SC_Query();
+	$col = "*";
+	$from = "dtb_category left join dtb_category_total_count using (category_id)";
+	// ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯
+	if($count_check) {
+		$where = "delete = 0 AND product_count > 0";
+	} else {
+		$where = "delete = 0";
+	}
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, $from, $where);
+	
+	$arrParentID = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id);
+	$arrBrothersID = sfGetBrothersArray($arrRet, 'parent_category_id', 'category_id', $arrParentID);
+	$arrChildrenID = sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $parent_category_id);
+	
+	$objSubPage->root_parent_id = $arrParentID[0];
+	
+	$arrDispID = array_merge($arrBrothersID, $arrChildrenID);
+	
+	foreach($arrRet as $key => $array) {
+		foreach($arrDispID as $val) {
+			if($array['category_id'] == $val) {
+				$arrRet[$key]['display'] = 1;
+				break;
+			}
+		}
+	}
+	
+	$objSubPage->arrTree = $arrRet;
+	return $objSubPage;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/frontparts/login_check.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/frontparts/login_check.php	(revision 2689)
+++ /temp/tags/eccube-0_9_2beta/html/frontparts/login_check.php	(revision 2689)
@@ -0,0 +1,71 @@
+<?php
+
+require_once("../require.php");
+
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'login':
+	$objFormParam->toLower('login_email');
+	$arrErr = $objFormParam->checkError();
+	$arrForm =  $objFormParam->getHashArray();
+	
+	// ¥¯¥Ã¥­¡¼ÊÝÂ¸È½Äê
+	if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
+		$objCookie->setCookie('login_email', $_POST['login_email']);
+	} else {
+		$objCookie->setCookie('login_email', '');
+	}
+	
+	if(count($arrErr) == 0) {
+		if($objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) {
+			header("Location: " . $_POST['url']);
+			exit;
+		} else {
+			$objQuery = new SC_Query;
+			$where = "email ILIKE ? AND status = 1 AND delete = 0";
+			$ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
+			
+			if($ret > 0) {
+				sfDispSiteError(TEMP_LOGIN_ERROR);
+			} else {
+				sfDispSiteError(SITE_LOGIN_ERROR);
+			}
+		}
+	} else {
+		// ÆþÎÏ¥¨¥é¡¼¤Î¾ì¹ç¡¢¸µ¤Î¥¢¥É¥ì¥¹¤ËÌá¤¹¡£
+		header("Location: " . $_POST['url']);
+		exit;
+	}
+	break;
+case 'logout':
+	// ¥í¥°¥¤¥ó¾ðÊó¤Î²òÊü
+	$objCustomer->EndSession();
+	$mypage_url_search = strpos('.'.$_POST['url'], "mypage");
+	//¥Þ¥¤¥Ú¡¼¥¸¥í¥°¥¤¥óÃæ¤Ï¥í¥°¥¤¥ó²èÌÌ¤Ø°Ü¹Ô
+	if ($mypage_url_search == 2){
+	header("Location: /mypage/login.php");
+	}else{
+	header("Location: " . $_POST['url']);	
+	}
+	exit;
+	break;
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("µ­²±¤¹¤ë", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN, "", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/require.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/require.php	(revision 2191)
+++ /temp/tags/eccube-0_9_2beta/html/require.php	(revision 2191)
@@ -0,0 +1,27 @@
+<?php
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir . "/../data/conf/conf.php");	
+require_once($include_dir . "/../data/lib/glib.php");
+require_once($include_dir . "/../data/lib/slib.php");
+require_once($include_dir . "/../data/class/SC_View.php");
+require_once($include_dir . "/../data/class/SC_DbConn.php");
+require_once($include_dir . "/../data/class/SC_Session.php");
+require_once($include_dir . "/../data/class/SC_Query.php");
+require_once($include_dir . "/../data/class/SC_SelectSql.php");
+require_once($include_dir . "/../data/class/SC_CheckError.php");
+require_once($include_dir . "/../data/class/SC_PageNavi.php");
+require_once($include_dir . "/../data/class/SC_Date.php");
+require_once($include_dir . "/../data/class/SC_Image.php");
+require_once($include_dir . "/../data/class/SC_UploadFile.php");
+require_once($include_dir . "/../data/class/SC_SiteInfo.php");
+require_once($include_dir . "/../data/class/GC_SendMail.php");
+require_once($include_dir . "/../data/class/SC_FormParam.php");
+require_once($include_dir . "/../data/class/SC_CartSession.php");
+require_once($include_dir . "/../data/class/SC_SiteSession.php");
+require_once($include_dir . "/../data/class/SC_Customer.php");
+require_once($include_dir . "/../data/class/SC_Cookie.php");
+require_once($include_dir . "/../data/class/SC_Page.php");
+require_once($include_dir . "/../data/class/SC_Pdf.php");
+require_once($include_dir . "/../data/include/page_layout.inc");
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/install/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/install/index.php	(revision 3699)
+++ /temp/tags/eccube-0_9_2beta/html/install/index.php	(revision 3699)
@@ -0,0 +1,547 @@
+<?php
+require_once("../require.php");
+$INSTALL_DIR = realpath(dirname( __FILE__));
+
+class LC_Page {
+	function LC_Page() {
+		$this->arrDB_TYPE = array(
+			1 => 'PostgreSQL',
+			// 2 => 'mySQL'	// Ì¤ÂÐ±þ
+		);
+	}
+}
+
+$objPage = new LC_Page();
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¥³¥ó¥Ñ¥¤¥ë¥Ç¥£¥ì¥¯¥È¥ê¤Î½ñ¹þ¤ß¸¢¸Â¥Á¥§¥Ã¥¯
+$temp_dir = $INSTALL_DIR . '/temp';
+$mode = lfGetFileMode($temp_dir);
+
+if($mode != '777') {
+	sfErrorHeader($temp_dir . "¤Ë¥æ¡¼¥¶½ñ¹þ¤ß¸¢¸Â(777)¤òÉÕÍ¿¤·¤Æ²¼¤µ¤¤¡£", true);
+	exit;
+}
+
+$objView = new SC_InstallView($INSTALL_DIR . '/templates', $INSTALL_DIR . '/temp');
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objWebParam = new SC_FormParam();
+$objDBParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+$objWebParam = lfInitWebParam($objWebParam);
+$objDBParam = lfInitDBParam($objDBParam);
+
+//¥Õ¥©¡¼¥àÇÛÎó¤Î¼èÆÀ
+$objWebParam->setParam($_POST);
+$objDBParam->setParam($_POST);
+
+switch($_POST['mode']) {
+// ¤è¤¦¤³¤½
+case 'welcome':
+	$objPage = lfDispStep0($objPage);
+	break;
+// ¥¢¥¯¥»¥¹¸¢¸Â¤Î¥Á¥§¥Ã¥¯
+case 'step0':
+	$objPage = lfDispStep0_1($objPage);
+	break;	
+// ¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+case 'step0_1':
+	$objPage = lfDispStep1($objPage);
+	break;	
+// WEB¥µ¥¤¥È¤ÎÀßÄê
+case 'step1':
+	//ÆþÎÏÃÍ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckWEBError($objWebParam);
+	if(count($objPage->arrErr) == 0) {
+		$objPage = lfDispStep2($objPage);
+	} else {
+		$objPage = lfDispStep1($objPage);
+	}
+	break;
+// ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÀßÄê
+case 'step2':
+	//ÆþÎÏÃÍ¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$objPage->arrErr = lfCheckDBError($objDBParam);
+	if(count($objPage->arrErr) == 0) {
+		$objPage = lfDispStep3($objPage);
+	} else {
+		$objPage = lfDispStep2($objPage);
+	}
+	break;
+// ¥Æ¡¼¥Ö¥ë¤ÎºîÀ®
+case 'step3':
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objDBParam->getHashArray();
+	// ¥Æ¡¼¥Ö¥ë¤ÎºîÀ®
+	$objPage->arrErr = lfExecuteSQL("./create_table.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+	if(count($objPage->arrErr) == 0) {
+		$objPage->tpl_message.="¡û¡§¥Æ¡¼¥Ö¥ë¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+	} else {
+		$objPage->tpl_message.="¡ß¡§¥Æ¡¼¥Ö¥ë¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+	}
+
+	// ¥Ó¥å¡¼¤ÎºîÀ®
+	if(count($objPage->arrErr) == 0) {
+		// ¥Ó¥å¡¼¤ÎºîÀ®
+		$objPage->arrErr = lfExecuteSQL("./create_view.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥Ó¥å¡¼¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥Ó¥å¡¼¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ½é´ü¥Ç¡¼¥¿¤ÎºîÀ®
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./insert_data.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§½é´ü¥Ç¡¼¥¿¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§½é´ü¥Ç¡¼¥¿¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./column_comment.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ¥Æ¡¼¥Ö¥ë¥³¥á¥ó¥È¤Î½ñ¹þ¤ß
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./table_comment.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥Æ¡¼¥Ö¥ë¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥Æ¡¼¥Ö¥ë¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}
+	
+	if(count($objPage->arrErr) == 0) {
+		// ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÀ¸À®
+		lfMakeConfigFile();
+		$objPage = lfDispStep3($objPage);
+		$objPage->tpl_mode = 'complete';
+	} else {
+		$objPage = lfDispStep3($objPage);
+	}
+	break;
+// ¥Æ¡¼¥Ö¥ëÎàºï½ü
+case 'drop':
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objDBParam->getHashArray();
+	// ¥Ó¥å¡¼¤Îºï½ü
+	$objPage->arrErr = lfExecuteSQL("./drop_view.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+	if(count($objPage->arrErr) == 0) {
+		$objPage->tpl_message.="¡û¡§¥Ó¥å¡¼¤Îºï½ü¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+	} else {
+		$objPage->tpl_message.="¡ß¡§¥Ó¥å¡¼¤Îºï½ü¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+	}
+
+	// ¥Æ¡¼¥Ö¥ë¤Îºï½ü
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./drop_table.sql", $arrRet['db_user'], $arrRet['db_password'], $arrRet['db_server'], $arrRet['db_name']); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥Æ¡¼¥Ö¥ë¤Îºï½ü¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥Æ¡¼¥Ö¥ë¤Îºï½ü¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}
+	$objPage = lfDispStep3($objPage);
+	break;
+// ´°Î»²èÌÌ
+case 'complete':
+	// ¥·¥ç¥Ã¥×¥Þ¥¹¥¿¾ðÊó¤Î½ñ¤­¹þ¤ß
+	$arrRet =  $objDBParam->getHashArray();
+	$dsn = "pgsql://".$arrRet['db_user'].":".$arrRet['db_password']."@".$arrRet['db_server']."/".$arrRet['db_name'];
+	$sqlval['shop_name'] = $objWebParam->getValue('shop_name');
+	$sqlval['email01'] = $objWebParam->getValue('admin_mail');
+	$sqlval['email02'] = $objWebParam->getValue('admin_mail');
+	$sqlval['email03'] = $objWebParam->getValue('admin_mail');
+	$sqlval['email04'] = $objWebParam->getValue('admin_mail');
+	$sqlval['email05'] = $objWebParam->getValue('admin_mail');
+	$sqlval['top_tpl'] = "default1";
+	$sqlval['product_tpl'] = "default1";
+	$sqlval['detail_tpl'] = "default1";
+	$sqlval['mypage_tpl'] = "default1";
+	$objQuery = new SC_Query($dsn);
+	$cnt = $objQuery->count("dtb_baseinfo");
+	if($cnt > 0) {
+		$objQuery->update("dtb_baseinfo", $sqlval);
+	} else {
+		$objQuery->insert("dtb_baseinfo", $sqlval);		
+	}
+	global $GLOBAL_ERR;
+	$GLOBAL_ERR = "";
+	$objPage = lfDispComplete($objPage);
+	break;
+case 'return_step0':
+	$objPage = lfDispStep0($objPage);
+	break;	
+case 'return_step1':
+	$objPage = lfDispStep1($objPage);
+	break;
+case 'return_step2':
+	$objPage = lfDispStep2($objPage);
+	break;
+case 'return_welcome':
+default:
+	$objPage = lfDispWelcome($objPage);
+	break;
+}
+
+//¥Õ¥©¡¼¥àÍÑ¤Î¥Ñ¥é¥á¡¼¥¿¤òÊÖ¤¹
+$objPage->arrForm = $objWebParam->getFormParamList();
+$objPage->arrForm = array_merge($objPage->arrForm, $objDBParam->getFormParamList());
+
+// SiteInfo¤òÆÉ¤ß¹þ¤Þ¤Ê¤¤
+$objView->assignobj($objPage);
+$objView->display('install_frame.tpl');
+//-----------------------------------------------------------------------------------------------------------------------------------
+// ¤è¤¦¤³¤½²èÌÌ¤ÎÉ½¼¨
+function lfDispWelcome($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'welcome.tpl';
+	$objPage->tpl_mode = 'welcome';
+	return $objPage;
+}
+
+// STEP0²èÌÌ¤ÎÉ½¼¨(¥Õ¥¡¥¤¥ë¸¢¸Â¥Á¥§¥Ã¥¯) 
+function lfDispStep0($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'step0.tpl';
+	$objPage->tpl_mode = 'step0';
+	
+	// ¥×¥í¥°¥é¥à¤Ç½ñ¹þ¤ß¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥ì¥¯¥È¥ê
+	$arrWriteFile = array(
+		"html/install.inc",
+		"html/user_data",
+		"html/upload",
+		"data/Smarty/templates_c",		
+		"data/update",
+		"data/logs",
+	);
+	
+	$mess = "";
+	$err_file = false;
+	foreach($arrWriteFile as $val) {
+		$path = "../../" . $val;		
+		if(file_exists($path)) {
+			$mode = lfGetFileMode("../../" . $val);
+			
+			// ¥Ç¥£¥ì¥¯¥È¥ê¤Î¾ì¹ç
+			if(is_dir($path)) {
+				if($mode == "777") {
+					$mess.= ">> ¡û¡§$val($mode) ¤ÏÌäÂê¤¢¤ê¤Þ¤»¤ó¡£<br>";					
+				} else {
+					$mess.= ">> ¡ß¡§$val($mode) ¤Ë¥æ¡¼¥¶½ñ¹þ¤ß¸¢¸Â(777)¤òÉÕÍ¿¤·¤Æ²¼¤µ¤¤¡£<br>";
+					$err_file = true;										
+				}
+			} else {
+				if($mode == "666") {
+					$mess.= ">> ¡û¡§$val($mode) ¤ÏÌäÂê¤¢¤ê¤Þ¤»¤ó¡£<br>";					
+				} else {
+					$mess.= ">> ¡ß¡§$val($mode) ¤Ë¥æ¡¼¥¶½ñ¹þ¤ß¸¢¸Â(666)¤òÉÕÍ¿¤·¤Æ²¼¤µ¤¤¡£<br>";
+					$err_file = true;							
+				}
+			}	
+			
+		} else {
+			$mess.= ">> ¡ß¡§$val ¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£<br>";
+			$err_file = true;
+		}
+	}
+	
+	// ¸¢¸Â¥¨¥é¡¼Åù¤¬È¯À¸¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
+	if(!$err_file) {
+		$path = "../../data/Smarty/templates_c/admin";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../../html/upload/save_image";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../../html/upload/temp_image";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../../html/upload/graph_image";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../../html/upload/csv";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+	}
+	
+	$objPage->mess = $mess;
+	$objPage->err_file = $err_file;
+
+	return $objPage;
+}
+
+
+// STEP0_1²èÌÌ¤ÎÉ½¼¨(¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼) 
+function lfDispStep0_1($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'step0_1.tpl';
+	$objPage->tpl_mode = 'step0_1';
+	// ¥Õ¥¡¥¤¥ë¥³¥Ô¡¼
+	$objPage->copy_mess = lfCopyDir("./user_data/", "../../html/user_data/", $objPage->copy_mess);
+	$objPage->copy_mess = lfCopyDir("./save_image/", "../../html/upload/save_image/", $objPage->copy_mess);	
+	return $objPage;
+}
+
+function lfGetFileMode($path) {
+	$mode = substr(sprintf('%o', fileperms($path)), -3);
+	return $mode;
+}
+
+// STEP1²èÌÌ¤ÎÉ½¼¨
+function lfDispStep1($objPage) {
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objDBParam->getHashArray();
+	$objPage->tpl_mainpage = 'step1.tpl';
+	$objPage->tpl_mode = 'step1';
+	return $objPage;
+}
+
+// STEP2²èÌÌ¤ÎÉ½¼¨
+function lfDispStep2($objPage) {
+	global $objWebParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	$objPage->tpl_mainpage = 'step2.tpl';
+	$objPage->tpl_mode = 'step2';
+	return $objPage;
+}
+
+// STEP3²èÌÌ¤ÎÉ½¼¨
+function lfDispStep3($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'step3.tpl';
+	$objPage->tpl_mode = 'step3';
+	return $objPage;
+}
+
+// ´°Î»²èÌÌ¤ÎÉ½¼¨
+function lfDispComplete($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->tpl_mainpage = 'complete.tpl';
+	$objPage->tpl_mode = 'complete';
+	return $objPage;
+}
+
+// WEB¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+function lfInitWebParam($objWebParam) {
+	
+	$install_dir = realpath(dirname( __FILE__) . "/../../") . "/";
+	$normal_url = "http://" . $_SERVER['HTTP_HOST'] . "/";
+	$secure_url = "http://" . $_SERVER['HTTP_HOST'] . "/";
+	$domain = ereg_replace("^[a-zA-Z0-9_~=&\?\/-]+\.", "", $_SERVER['HTTP_HOST']);
+	$objWebParam->addParam("Å¹Ì¾", "shop_name", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objWebParam->addParam("´ÉÍý¼Ô¥á¡¼¥ë¥¢¥É¥ì¥¹", "admin_mail", MTEXT_LEN, "", array("EXIST_CHECK","EMAIL_CHECK","EMAIL_CHAR_CHECK","MAX_LENGTH_CHECK"));
+	$objWebParam->addParam("¥¤¥ó¥¹¥È¡¼¥ë¥Ç¥£¥ì¥¯¥È¥ê", "install_dir", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $install_dir);
+	$objWebParam->addParam("URL(ÄÌ¾ï)", "normal_url", MTEXT_LEN, "", array("EXIST_CHECK","URL_CHECK","MAX_LENGTH_CHECK"), $normal_url);
+	$objWebParam->addParam("URL(¥»¥­¥å¥¢)", "secure_url", MTEXT_LEN, "", array("EXIST_CHECK","URL_CHECK","MAX_LENGTH_CHECK"), $secure_url);
+	$objWebParam->addParam("¥É¥á¥¤¥ó", "domain", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $domain);	
+	
+	return $objWebParam;
+}
+
+// WEB¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+function lfInitDBParam($objDBParam) {
+	
+	$db_server = "127.0.0.1";
+	$db_name = "eccube_db";
+	$db_user = "eccube_db_user";
+	
+	$objDBParam->addParam("DB¤Î¼ïÎà", "db_type", INT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"));
+	$objDBParam->addParam("DB¥µ¡¼¥Ð", "db_server", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $db_server);
+	$objDBParam->addParam("DBÌ¾", "db_name", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $db_name);
+	$objDBParam->addParam("DB¥æ¡¼¥¶", "db_user", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $db_user);
+	$objDBParam->addParam("DB¥Ñ¥¹¥ï¡¼¥É", "db_password", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"));	
+	return $objDBParam;
+}
+
+// ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯
+function lfCheckWebError($objFormParam) {
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	return $objErr->arrErr;
+}
+
+// ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯
+function lfCheckDBError($objFormParam) {
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	if(count($objErr->arrErr) == 0) {
+		// ÀÜÂ³³ÎÇ§
+		$dsn = "pgsql://".$arrRet['db_user'].":".$arrRet['db_password']."@".$arrRet['db_server']."/".$arrRet['db_name'];
+		// Debug¥â¡¼¥É»ØÄê
+		$options['debug'] = 3;
+		$objDB = DB::connect($dsn, $options);
+		// ÀÜÂ³¥¨¥é¡¼
+		if(PEAR::isError($objDB)) {
+			$objErr->arrErr['all'] = ">> " . $objDB->message . "<br>";
+			// ¥¨¥é¡¼Ê¸¤ò¼èÆÀ¤¹¤ë
+			ereg("\[(.*)\]", $objDB->userinfo, $arrKey);
+			$objErr->arrErr['all'].= $arrKey[0] . "<br>";
+			gfPrintLog($objDB->userinfo, "./temp/install.log");
+		}
+	}
+	return $objErr->arrErr;
+}
+
+// SQLÊ¸¤Î¼Â¹Ô
+function lfExecuteSQL($filepath, $db_user, $db_password, $db_server, $db_name) {
+	$arrErr = array();
+
+	if(!file_exists($filepath)) {
+		$arrErr['all'] = ">> ¥¹¥¯¥ê¥×¥È¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó";
+	} else {
+  		if($fp = fopen($filepath,"r")) {
+			$sql = fread($fp, filesize($filepath));
+			fclose($fp);
+		}
+		$dsn = "pgsql://".$db_user.":".$db_password."@".$db_server."/".$db_name;
+		$objDB = DB::connect($dsn);
+		// ÀÜÂ³¥¨¥é¡¼
+		if(!PEAR::isError($objDB)) {
+			$ret = $objDB->query($sql);
+			if(PEAR::isError($ret)) {
+				$arrErr['all'] = ">> " . $ret->message . "<br>";
+				// ¥¨¥é¡¼Ê¸¤ò¼èÆÀ¤¹¤ë
+				ereg("\[(.*)\]", $ret->userinfo, $arrKey);
+				$arrErr['all'].= $arrKey[0] . "<br>";
+				$objPage->update_mess.=">> ¥Æ¡¼¥Ö¥ë¹½À®¤ÎÊÑ¹¹¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";
+				gfPrintLog($ret->userinfo, "./temp/install.log");
+			}
+		} else {
+			$arrErr['all'] = ">> " . $objDB->message;
+			gfPrintLog($objDB->userinfo, "./temp/install.log");
+		}
+	}
+	return $arrErr;
+}
+
+// ÀßÄê¥Õ¥¡¥¤¥ë¤ÎºîÀ®
+function lfMakeConfigFile() {
+	global $objWebParam;
+	global $objDBParam;
+	
+	$filepath = $objWebParam->getValue('install_dir') . "/html/install.inc";
+	$domain = $objWebParam->getValue('domain');
+	if(!ereg("^\.", $domain)) {
+		$domain = "." . $domain;
+	}
+	
+	$root_dir = $objWebParam->getValue('install_dir');
+	if (!ereg("/$", $root_dir)) {
+		$root_dir = $root_dir . "/";
+	}
+	
+	$config_data = 
+	"<?php\n".
+	"    define ('ECCUBE_INSTALL', 'ON');\n" .
+	"    define ('ROOT_DIR', '" . $root_dir . "');\n" . 
+	"    define ('SITE_URL', '" . $objWebParam->getValue('normal_url') . "');\n" .
+	"    define ('SSL_URL', '" . $objWebParam->getValue('secure_url') . "');\n" .
+	"    define ('DOMAIN_NAME', '" . $domain . "');\n" .
+	"    define ('DB_USER', '" . $objDBParam->getValue('db_user') . "');\n" . 
+	"    define ('DB_PASSWORD', '" . $objDBParam->getValue('db_password') . "');\n" .
+	"    define ('DB_SERVER', '" . $objDBParam->getValue('db_server') . "');\n" .
+	"    define ('DB_NAME', '" . $objDBParam->getValue('db_name') . "');\n" .
+	"?>";
+	
+	if($fp = fopen($filepath,"w")) {
+		fwrite($fp, $config_data);
+		fclose($fp);
+	}
+}
+
+// ¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Î¥Õ¥¡¥¤¥ë¤òºÆµ¢Åª¤Ë¥³¥Ô¡¼
+function lfCopyDir($src, $des, $mess, $override = false){
+	if(!is_dir($src)){
+		return false;
+	}
+
+	$oldmask = umask(0);
+	$mod= stat($src);
+	
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤¬¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë
+	if(!file_exists($des)) {
+		mkdir($des, $mod[2]);
+	}
+	
+	$fileArray=glob( $src."*" );
+	foreach( $fileArray as $key => $data_ ){
+		// CVS´ÉÍý¥Õ¥¡¥¤¥ë¤Ï¥³¥Ô¡¼¤·¤Ê¤¤
+		if(ereg("/CVS/Entries", $data_)) {
+			break;
+		}
+		if(ereg("/CVS/Repository", $data_)) {
+			break;
+		}
+		if(ereg("/CVS/Root", $data_)) {
+			break;
+		}
+		
+		mb_ereg("^(.*[\/])(.*)",$data_, $matches);
+		$data=$matches[2];
+		if( is_dir( $data_ ) ){
+			$mess = lfCopyDir( $data_.'/', $des.$data.'/', $mess);
+		}else{
+			if(!$override && file_exists($des.$data)) {
+				$mess.= $des.$data . "¡§¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤¹\n";
+			} else {
+				if(@copy( $data_, $des.$data)) {
+					$mess.= $des.$data . "¡§¥³¥Ô¡¼À®¸ù\n";
+				} else {
+					$mess.= $des.$data . "¡§¥³¥Ô¡¼¼ºÇÔ\n";
+				}
+			}
+			$mod=stat($data_ );
+		}
+	}
+	umask($oldmask);
+	return $mess;
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/html/install/user_data/css/contents.css
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/install/user_data/css/contents.css	(revision 3488)
+++ /temp/tags/eccube-0_9_2beta/html/install/user_data/css/contents.css	(revision 3488)
@@ -0,0 +1,72 @@
+@charset "euc-jp";
+
+/*FORM*/
+.box3 { width: 33px; }	/*W3*/
+.box6 { width: 54px; }	/*W6*/
+.box10 { width: 82px; }	/*W10*/
+.box12 { width: 96px; }	/*W12*/
+.box18 { width: 138px; }	/*W18*/
+.box19 { width: 145px; }	/*W19*/
+.box20 { width: 152px; }	/*W20*/
+.box30 { width: 222px; }	/*W30*/
+.box33 { width: 243px; }	/*W30*/
+.box40 { width: 292px; }	/*W40*/
+.box47 { width: 341px; }	/*W47*/
+.area40 { width: 302px; height: 134px; }	/*W40¡ßH8*/
+.area45 { width: 337px; height: 290px; }	/*W40¡ßH20*/
+.area46 { width: 337px; height: 134px; }	/*W40¡ßH8*/
+.area50 { width: 372px; height: 290px; }	/*W50¡ßH20*/
+.area55 { width: 407px; height: 290px; }	/*W55¡ßH20*/
+.area65 { width: 444px; height: 290px; }	/*W65¡ßH20*/
+.area68 { width: 498px; height: 134px; }	/*W68¡ßH8*/
+.area80 { width: 572px; height: 134px; }	/*W80¡ßH8*/
+.area80_2 { width: 572px; height: 420px; }	/*W80¡ßH30*/
+.area92 { width: 666px; height: 160px; }	/*W92¡ßH10*/
+.area96 { width: 694px; height: 420px; }	/*W80¡ßH30*/
+.area96_2 { width: 694px; height: 160px; }	/*W80¡ßH10*/
+
+/*LINK*/
+a:link { color: #3a75af; text-decoration: underline; }
+a:visited { color: #3a75af; text-decoration: underline; }
+a:hover { color: #3a75af; text-decoration: none; }
+
+/*OVER*/
+a.over:link{ color:#4a6fa6; text-decoration: none; }
+a.over:visited { color:#4a6fa6; text-decoration: none; }
+a.over:hover { color:#4a6fa6; text-decoration: underline; }
+
+/*COLOR*/
+.white { color: #ffffff; }
+.whitest { color: #ffffff; font-weight: bold; }
+.red { color: #ec0000; }
+.redst { color: #ec0000; font-weight: bold; }
+.blue { color: #3a75af; }
+.bluest { color: #3a75af; font-weight: bold; }
+.black { color: #000000; }
+.blackst { color: #000000; font-weight: bold; }
+.orange { color: #ff6600; }
+.orangest { color: #ff6600; font-weight: bold; }
+
+/*PHOTO*/
+.picture { 
+	border-width: 1px;
+	border-style: solid;
+	border-color: #cccccc;
+}
+
+/*PHOTO*/
+img { 
+	border: 0px;
+}
+
+
+#container #right #contents #right #price{
+border-width: 1px;
+border-style: solid;
+border-color: #ccc;
+padding: 0;
+margin: 0;
+padding: 0;
+width: 295px;
+background: #ecf5ff;
+}
Index: /temp/tags/eccube-0_9_2beta/html/install/user_data/templates/default1/contents.css
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/install/user_data/templates/default1/contents.css	(revision 3534)
+++ /temp/tags/eccube-0_9_2beta/html/install/user_data/templates/default1/contents.css	(revision 3534)
@@ -0,0 +1,72 @@
+@charset "euc-jp";
+
+/*FORM*/
+.box3 { width: 33px; }	/*W3*/
+.box6 { width: 54px; }	/*W6*/
+.box10 { width: 82px; }	/*W10*/
+.box12 { width: 96px; }	/*W12*/
+.box18 { width: 138px; }	/*W18*/
+.box19 { width: 145px; }	/*W19*/
+.box20 { width: 152px; }	/*W20*/
+.box30 { width: 222px; }	/*W30*/
+.box33 { width: 243px; }	/*W30*/
+.box40 { width: 292px; }	/*W40*/
+.box47 { width: 341px; }	/*W47*/
+.area40 { width: 302px; height: 134px; }	/*W40¡ßH8*/
+.area45 { width: 337px; height: 290px; }	/*W40¡ßH20*/
+.area46 { width: 337px; height: 134px; }	/*W40¡ßH8*/
+.area50 { width: 372px; height: 290px; }	/*W50¡ßH20*/
+.area55 { width: 407px; height: 290px; }	/*W55¡ßH20*/
+.area65 { width: 444px; height: 290px; }	/*W65¡ßH20*/
+.area68 { width: 498px; height: 134px; }	/*W68¡ßH8*/
+.area80 { width: 572px; height: 134px; }	/*W80¡ßH8*/
+.area80_2 { width: 572px; height: 420px; }	/*W80¡ßH30*/
+.area92 { width: 666px; height: 160px; }	/*W92¡ßH10*/
+.area96 { width: 694px; height: 420px; }	/*W80¡ßH30*/
+.area96_2 { width: 694px; height: 160px; }	/*W80¡ßH10*/
+
+/*LINK*/
+a:link { color: #3a75af; text-decoration: underline; }
+a:visited { color: #3a75af; text-decoration: underline; }
+a:hover { color: #3a75af; text-decoration: none; }
+
+/*OVER*/
+a.over:link{ color:#4a6fa6; text-decoration: none; }
+a.over:visited { color:#4a6fa6; text-decoration: none; }
+a.over:hover { color:#4a6fa6; text-decoration: underline; }
+
+/*COLOR*/
+.white { color: #ffffff; }
+.whitest { color: #ffffff; font-weight: bold; }
+.red { color: #ec0000; }
+.redst { color: #ec0000; font-weight: bold; }
+.blue { color: #3a75af; }
+.bluest { color: #3a75af; font-weight: bold; }
+.black { color: #000000; }
+.blackst { color: #000000; font-weight: bold; }
+.orange { color: #ff6600; }
+.orangest { color: #ff6600; font-weight: bold; }
+
+/*PHOTO*/
+.picture { 
+	border-width: 1px;
+	border-style: solid;
+	border-color: #cccccc;
+}
+
+/*PHOTO*/
+img { 
+	border: 0px;
+}
+
+
+#container #right #contents #right #price{
+border-width: 1px;
+border-style: solid;
+border-color: #ccc;
+padding: 0;
+margin: 0;
+padding: 0;
+width: 295px;
+background: #ecf5ff;
+}
Index: /temp/tags/eccube-0_9_2beta/html/rss/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/rss/index.php	(revision 3535)
+++ /temp/tags/eccube-0_9_2beta/html/rss/index.php	(revision 3535)
@@ -0,0 +1,77 @@
+<?php
+//¶¦ÄÌÉôÉÊ¤ÎÆÉ¤ß¹þ¤ß
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "rss/index.tpl";
+		$this->encode = "UTF-8";
+		$this->description = "¿·Ãå¾ðÊó";
+	}
+}
+
+$objQuery = new SC_Query();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+//¿·Ãå¾ðÊó¤ò¼èÆÀ
+$arrNews = lfGetNews($objQuery);
+
+//¥­¥ã¥Ã¥·¥å¤·¤Ê¤¤(Ç°¤Î¤¿¤á)
+header("Paragrama: no-cache");
+
+//XML¥Æ¥­¥¹¥È(¤³¤ì¤¬¤Ê¤¤¤ÈÀµ¾ï¤ËRSS¤È¤·¤ÆÇ§¼±¤·¤Æ¤¯¤ì¤Ê¤¤¥Ä¡¼¥ë¤¬¤¢¤ë¤¿¤á)
+header("Content-type: application/xml");
+
+//¿·Ãå¾ðÊó¤ò¥»¥Ã¥È
+$objPage->arrNews = $arrNews;		
+
+//Å¹Ì¾¤ò¥»¥Ã¥È
+$objPage->site_title = $arrNews[0]['shop_name'];
+
+//ÂåÉ½Email¥¢¥É¥ì¥¹¤ò¥»¥Ã¥È
+$objPage->email = $arrNews[0]['email'];
+
+//DESCRIPTION¤ò¥»¥Ã¥È
+$objPage->description = $objPage->description;
+
+//XML¥Õ¥¡¥¤¥ë¤Î¥¨¥ó¥³¡¼¥É¤ò¥»¥Ã¥È
+$objPage->encode = $objPage->encode;
+
+//¥»¥Ã¥È¤·¤¿¥Ç¡¼¥¿¤ò¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ë½ÐÎÏ
+$objView->assignobj($objPage);
+
+//²èÌÌÉ½¼¨
+$objView->display($objPage->tpl_mainpage, true);
+
+//******************************************************************************************/
+/*
+ * ´Ø¿ôÌ¾:lfGetNews
+ * ÀâÌÀ¡¡:¿·Ãå¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô£±:$objQuery		DBÁàºî¥¯¥é¥¹
+ * Ìá¤êÃÍ:$arrNews		¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹
+ */
+function lfGetNews($objQuery){
+	$col = "";
+	$col .= "     news_id ";								//¿·Ãå¾ðÊóID
+	$col .= "     ,news_title ";								//¿·Ãå¾ðÊó¥¿¥¤¥È¥ë
+	$col .= "     ,news_comment ";							//¿·Ãå¾ðÊóËÜÊ¸
+	$col .= "     ,to_char(news_date, 'YYYY') AS YEAR ";	//ÆüÉÕ(Ç¯)
+	$col .= "     ,to_char(news_date, 'MM') AS MONTH ";		//ÆüÉÕ(·î)
+	$col .= "     ,to_char(news_date, 'DD') AS DAY ";		//ÆüÉÕ(Æü)
+	$col .= "     ,to_char(news_date, 'HH24') AS HOUR ";	//ÆüÉÕ(»þ´Ö)
+	$col .= "     ,to_char(news_date, 'MI') AS MINUTE ";	//ÆüÉÕ(Ê¬)
+	$col .= "     ,to_char(news_date, 'SS') AS SECOND ";		//ÆüÉÕ(ÉÃ)
+	$col .= "     ,news_url ";								//¿·Ãå¾ðÊóURL
+	$col .= "     ,news_select ";							//¿·Ãå¾ðÊó¤Î¶èÊ¬(1:URL¡¢2:ËÜÊ¸)
+	$col .= "     ,(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name  ";	//Å¹Ì¾
+	$col .= "     ,(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";			//ÂåÉ½Email¥¢¥É¥ì¥¹
+	$from = "dtb_news";
+	$where = "delete = '0'";
+	$order = "rank DESC";
+	$objQuery->setorder($order);
+	$arrNews = $objQuery->select($col,$from,$where);
+	return $arrNews;
+}
+    
+?>
Index: /temp/tags/eccube-0_9_2beta/html/input_zip.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/input_zip.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/input_zip.php	(revision 1328)
@@ -0,0 +1,75 @@
+<?php
+require_once("./require.php");
+
+class LC_Page {
+	var $tpl_state;
+	var $tpl_city;
+	var $tpl_town;
+	var $tpl_onload;
+	var $tpl_message;
+	function CPage() {
+		$this->tpl_message = "½»½ê¤ò¸¡º÷¤·¤Æ¤¤¤Þ¤¹¡£";
+	}
+}
+
+$conn = new SC_DBconn(ZIP_DSN);
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+$arrErr = fnErrorCheck();
+
+// ÆþÎÏ¥¨¥é¡¼¤Î¾ì¹ç¤Ï½ªÎ»
+if(count($arrErr) > 0) {
+	$objPage->tpl_start = "window.close();";
+}
+
+// Í¹ÊØÈÖ¹æ¸¡º÷Ê¸ºîÀ®
+$zipcode = $_GET['zip1'].$_GET['zip2'];
+$zipcode = mb_convert_kana($zipcode ,"n");
+$sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
+
+$data_list = $conn->getAll($sqlse, array($zipcode));
+
+// ¥¤¥ó¥Ç¥Ã¥¯¥¹¤ÈÃÍ¤òÈ¿Å¾¤µ¤»¤ë¡£
+$arrREV_PREF = array_flip($arrPref);
+
+$objPage->tpl_state = $arrREV_PREF[$data_list[0]['state']];
+$objPage->tpl_city = $data_list[0]['city'];
+$town =  $data_list[0]['town'];
+/*
+	ÁíÌ³¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
+	°Ê²¼¤Î¤è¤¦¤ÊÊ¸»úÎó¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç	ÂÐºö¤¹¤ë¡£
+	¡¦¡Ê£±¢·£±£¹ÃúÌÜ¡Ë
+	¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
+*/
+$town = ereg_replace("¡Ê.*¡Ë$","",$town);
+$town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
+$objPage->tpl_town = $town;
+
+// Í¹ÊØÈÖ¹æ¤¬È¯¸«¤µ¤ì¤¿¾ì¹ç
+if(count($data_list) > 0) {
+	$func = "fnPutAddress('" . $_GET['input1'] . "','" . $_GET['input2']. "');";
+	$objPage->tpl_onload = "$func";
+	$objPage->tpl_start = "window.close();";
+} else {
+	$objPage->tpl_message = "³ºÅö¤¹¤ë½»½ê¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£";
+}
+
+/* ¥Ú¡¼¥¸¤ÎÉ½¼¨¡¡*/
+$objView->assignobj($objPage);
+$objView->display("input_zip.tpl");
+
+/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
+function fnErrorCheck() {
+	// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸ÇÛÎó¤Î½é´ü²½
+	$objErr = new SC_CheckError();
+	
+	// Í¹ÊØÈÖ¹æ
+	$objErr->doFunc( array("Í¹ÊØÈÖ¹æ1",'zip1',ZIP01_LEN ) ,array( "NUM_COUNT_CHECK" ) );
+	$objErr->doFunc( array("Í¹ÊØÈÖ¹æ2",'zip2',ZIP02_LEN ) ,array( "NUM_COUNT_CHECK" ) );
+	
+	return $objErr->arrErr;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/html/__default.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/__default.php	(revision 3743)
+++ /temp/tags/eccube-0_9_2beta/html/__default.php	(revision 3743)
@@ -0,0 +1,22 @@
+<?php
+require_once("###require###");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_css = '/css/layout/contact/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage);
+
+// ²èÌÌ¤ÎÉ½¼¨
+ $objView->assignobj($objPage);
+ $objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/order/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/order/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/order/index.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '/css/layout/order/index.css';		// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'order/index.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_page_category = 'order';	
+		$this->tpl_title = 'ÆÃÄê¾¦¼è°úË¡¤Ë´Ø¤¹¤ëË¡Î§';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$arrRet = $objQuery->getall("SELECT * FROM dtb_baseinfo",array());
+$objPage->arrRet = $arrRet[0];
+$objPage->arrPref = $arrPref;
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /temp/tags/eccube-0_9_2beta/html/js/dragdrop.js
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/js/dragdrop.js	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/js/dragdrop.js	(revision 1328)
@@ -0,0 +1,196 @@
+var obj;
+var offsetX;
+var offsetY;
+var arrObj;
+var objParam;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Param() {
+	this.ITEM_MAX = 3;		
+}
+
+// ¥µ¥¤¥º´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Size() {
+	this.id = '';
+	this.left = 0;
+	this.top = 0;
+	this.width = 0;
+	this.height = 0;
+	this.obj;
+};
+
+// ¥ª¥ó¥í¡¼¥É½èÍý
+onload=function () {
+	// ¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
+	objParam = new SC_Param();
+	
+	// WIN-IE
+	if (document.all) {
+		objlist = document.all.tags("div");
+	// WIN-NN,WIN-FF   
+	} else if (document.getElementsByTagName) {
+		objlist = document.getElementsByTagName("div");
+	} else {
+		return;
+	}
+	
+	arrObj = new Array();
+	for (i = 0; i < objlist.length; i++) {
+		id = objlist[i].id;
+		arrObj[id] = new SC_Size();
+		arrObj[id].id = id;
+		arrObj[id].obj = objlist[id];
+		arrObj[id].left = objlist[id].style.left;
+		arrObj[id].top = objlist[id].style.top;
+		arrObj[id].width = objlist[id].style.width;
+		arrObj[id].height = objlist[id].style.height;
+		arrObj[id].left = Number(arrObj[id].left.replace(/px/, ''));
+		arrObj[id].top = Number(arrObj[id].top.replace(/px/, ''));
+		arrObj[id].width = Number(arrObj[id].width.replace(/px/, ''));
+		arrObj[id].height = Number(arrObj[id].height.replace(/px/, ''));
+		arrObj[id].right = Number(arrObj[id].left) + Number(arrObj[id].width);
+		arrObj[id].bottom =Number(arrObj[id].top) + Number(arrObj[id].height);
+	}
+	
+	// MouseDown¥¤¥Ù¥ó¥È½èÍý¤ÎÆþ¤ìÂØ¤¨
+	objlist['item0'].onmousedown = onMouseDown;
+	objlist['item1'].onmousedown = onMouseDown;
+	objlist['item2'].onmousedown = onMouseDown;
+	
+	document.onmousemove = onMouseMove;
+	document.onmouseup = onMouseUp;
+}
+
+// MouseDown¥¤¥Ù¥ó¥È
+function onMouseDown(e) {
+   obj = this;
+   // WIN-IE
+   if (document.all) {
+      offsetX = event.offsetX + 2;
+      offsetY = event.offsetY + 2;
+   // WIN-NN,WIN-FF
+   } else if (obj.getElementsByTagName) {
+      offsetX = e.pageX - parseInt(obj.style.left);
+      offsetY = e.pageY - parseInt(obj.style.top);
+   }
+   return false;
+}
+
+// MouseMove¥¤¥Ù¥ó¥È
+function onMouseMove(e) {
+	if (!obj) {
+		return true;
+	}	
+	// WIN-IE
+	if (document.all) {
+		x = event.clientX - offsetX;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(x <= 0) {
+			x = 0;
+		}
+		left_max = document.body.clientWidth - arrObj[obj.id].width;
+		if(x >= left_max) {
+			x =left_max;			
+		}
+		obj.style.left = x;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		y = event.clientY - offsetY;
+		if(y <= 0) {
+			y = 0;
+		}
+		top_max = document.body.clientHeight - arrObj[obj.id].height;
+		if(y >= top_max) {
+			y =top_max;			
+		}
+		obj.style.top = y;		
+	// WIN-NN,WIN-FF
+	} else if (obj.getElementsByTagName) {
+		x = e.pageX - offsetX;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(x <= 0) {
+			x = 0;
+		}
+		left_max = window.innerWidth - arrObj[obj.id].width;
+		if(x >= left_max) {
+			x =left_max;			
+		}
+		obj.style.left = x;
+		
+		y = e.pageY - offsetY;
+		// ²èÌÌ³°¤Ë½Ð¤Ê¤¤¤è¤¦¤ËÀ©¸æ¤¹¤ë¡¡
+		if(y <= 0) {
+			y = 0;
+			obj.style.top = 0;
+		}
+		top_max = window.innerHeight - arrObj[obj.id].height;
+		if(y >= top_max) {
+			y =top_max;			
+		}
+		obj.style.top = y;
+	}
+	
+	if(isInFlame('flame0', obj)) {
+		document.getElementById('td1').style.backgroundColor = '#fffadd';
+	} else {
+		document.getElementById('td1').style.backgroundColor = '#ffffff';
+	}
+	return false;
+}
+
+// MouseUp¥¤¥Ù¥ó¥È
+function onMouseUp(e) {
+	if (!obj) {
+		return true;
+	}
+	
+	if(!isInFlame('flame0', obj)) {
+		// WIN-IE
+		if (document.all) {
+			// ºÇ½é¤Î°ÌÃÖ¤ËÌá¤¹
+			obj.style.left = arrObj[obj.id].left;
+			obj.style.top = arrObj[obj.id].top;
+		// WIN-NN,WIN-FF
+		} else if (obj.getElementsByTagName) {
+			// ºÇ½é¤Î°ÌÃÖ¤ËÌá¤¹
+			obj.style.left = arrObj[obj.id].left;
+			obj.style.top = arrObj[obj.id].top;
+		}
+	}	
+	document.getElementById('td1').style.backgroundColor = '#ffffff';	
+	obj = null;
+}
+
+// ¥Õ¥ì¡¼¥àÆâ¤Ë¥¢¥¤¥Æ¥à¤¬Â¸ºß¤¹¤ë¤«È½Äê¤¹¤ë¡¡
+function isInFlame(flame_id, item) {
+	top_val = item.style.top;
+	top_val = Number(top_val.replace(/px/, ''));
+	bottom_val = top_val + arrObj[item.id].height;
+	left_val = item.style.left;
+	left_val = Number(left_val.replace(/px/, ''))
+	right_val = left_val + arrObj[item.id].width;		
+	if(
+		top_val > arrObj[flame_id].top &&
+		bottom_val < arrObj[flame_id].bottom &&
+		left_val > arrObj[flame_id].left &&
+		right_val < arrObj[flame_id].right
+		) {
+		return true;
+	}
+	return false;
+}
+
+// Á÷¿®Á°¤Î½èÍý
+function preSubmit() {
+	for(i = 0; i < 3; i++) {
+		id = 'item' + i;
+		obj = arrObj[id].obj;
+		if(isInFlame ('flame0', obj)) {
+			document.form1[obj.id].value = "in";
+		} else {
+			document.form1[obj.id].value = "out";
+		}
+	}
+}
+
+
+
Index: /temp/tags/eccube-0_9_2beta/html/js/site.js
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/js/site.js	(revision 2287)
+++ /temp/tags/eccube-0_9_2beta/html/js/site.js	(revision 2287)
@@ -0,0 +1,345 @@
+// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+function fnIsopener() {
+    var ua = navigator.userAgent;
+    if( !!window.opener ) {
+        if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) {
+            return !window.opener.closed;
+        } else {
+        	return typeof window.opener.document == 'object';
+        }
+	} else {
+		return false;
+	}
+}
+
+// Í¹ÊØÈÖ¹æÆþÎÏ¸Æ¤Ó½Ð¤·
+function fnCallAddress(php_url, tagname1, tagname2, input1, input2) {
+	zip1 = document.form1[tagname1].value;
+	zip2 = document.form1[tagname2].value;
+	
+	if(zip1.length == 3 && zip2.length == 4) {
+		url = php_url + "?zip1=" + zip1 + "&zip2=" + zip2 + "&input1=" + input1 + "&input2=" + input2;
+		window.open(url,"nomenu","width=500,height=350,scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+	} else {
+		alert("Í¹ÊØÈÖ¹æ¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£");
+	}
+}
+
+// Í¹ÊØÈÖ¹æ¤«¤é¸¡º÷¤·¤¿½»½ê¤òÅÏ¤¹¡£
+function fnPutAddress(input1, input2) {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		if(document.form1['state'].value != "") {
+			// ¹àÌÜ¤ËÃÍ¤òÆþÎÏ¤¹¤ë¡£
+			state_id = document.form1['state'].value;
+			town = document.form1['city'].value + document.form1['town'].value;
+			window.opener.document.form1[input1].selectedIndex = state_id;
+			window.opener.document.form1[input2].value = town;
+		}
+	} else {
+		window.close();
+	}		
+}
+
+function fnOpenNoMenu(URL) {
+	window.open(URL,"nomenu","scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+}
+
+function fnOpenWindow(URL,name,width,height) {
+	window.open(URL,name,"width="+width+",height="+height+",scrollbars=yes,resizable=no,toolbar=no,location=no,directories=no,status=no");
+}
+
+// ¥Õ¥©¡¼¥«¥¹¤òÅö¤Æ¤ë
+function fnSetFocus(name) {
+	if(document.form1[name]) {
+		document.form1[name].focus();
+	}
+}
+
+// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤Ë¹àÌÜ¤ò³ä¤êÅö¤Æ¤ë¡£
+function fnSetSelect(name1, name2, val) {
+	sele1 = document.form1[name1]; 
+	sele2 = document.form1[name2];
+	
+	if(sele1 && sele2) {
+		index=sele1.selectedIndex;
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤Î¥¯¥ê¥¢	
+		count=sele2.options.length
+		for(i = count; i >= 0; i--) {
+			sele2.options[i]=null;
+		}
+		
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ËÃÍ¤ò³ä¤êÅö¤Æ¤ë
+		len = lists[index].length
+		for(i = 0; i < len; i++) {
+			sele2.options[i]=new Option(lists[index][i], vals[index][i]);
+			if(val != "" && vals[index][i] == val) {
+				sele2.options[i].selected = true;
+			}
+		}
+	}
+}
+
+// Enter¥­¡¼ÆþÎÏ¤ò¥­¥ã¥ó¥»¥ë¤¹¤ë¡£(IE¤ËÂÐ±þ)
+function fnCancelEnter()
+{
+	if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
+		if (window.event.keyCode == 13)
+		{
+			return false;
+		}
+	}
+	return true;
+}
+
+// ¥â¡¼¥É¤È¥­¡¼¤ò»ØÄê¤·¤ÆSUBMIT¤ò¹Ô¤¦¡£
+function fnModeSubmit(mode, keyname, keyid) {
+	switch(mode) {
+	case 'delete_category':
+		if(!window.confirm('ÁªÂò¤·¤¿¥«¥Æ¥´¥ê¤È¥«¥Æ¥´¥êÆâ¤Î¤¹¤Ù¤Æ¤Î¥«¥Æ¥´¥ê¤òºï½ü¤·¤Þ¤¹')){
+			return;
+		}
+		break;
+	case 'delete':
+		if(!window.confirm('°ìÅÙºï½ü¤·¤¿¥Ç¡¼¥¿¤Ï¡¢¸µ¤ËÌá¤»¤Þ¤»¤ó¡£\nºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«¡©')){
+			return;
+		}
+		break;
+	case 'confirm':
+		if(!window.confirm('ÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«')){
+			return;
+		}
+		break;
+	case 'delete_all':
+		if(!window.confirm('¸¡º÷·ë²Ì¤ò¤¹¤Ù¤Æºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«')){
+			return;
+		}
+		break;
+	default:
+		break;
+	}
+	document.form1['mode'].value = mode;
+	if(keyname != "" && keyid != "") {
+		document.form1[keyname].value = keyid;
+	}
+	document.form1.submit();
+
+}
+
+function fnFormModeSubmit(form, mode, keyname, keyid) {
+	switch(mode) {
+	case 'delete':
+		if(!window.confirm('°ìÅÙºï½ü¤·¤¿¥Ç¡¼¥¿¤Ï¡¢¸µ¤ËÌá¤»¤Þ¤»¤ó¡£\nºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«¡©')){
+			return;
+		}
+		break;
+	case 'confirm':
+		if(!window.confirm('ÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«')){
+			return;
+		}
+		break;		
+	default:
+		break;
+	}
+	document.forms[form]['mode'].value = mode;
+	if(keyname != "" && keyid != "") {
+		document.forms[form][keyname].value = keyid;
+	}
+	document.forms[form].submit();
+}
+
+function fnSetFormSubmit(form, key, val) {
+	document.forms[form][key].value = val;
+	document.forms[form].submit();
+	return false;
+}
+
+function fnChangeAction(url) {
+	document.form1.action = url;
+}
+
+// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë
+function fnNaviPage(pageno) {
+	document.form1['pageno'].value = pageno;
+	document.form1.submit();
+}
+
+function fnSearchPageNavi(pageno) {
+	document.form1['pageno'].value = pageno;
+	document.form1['mode'].value = 'search';
+	document.form1.submit();
+	}
+
+	function fnSubmit(){
+	document.form1.submit();
+}
+
+// ¥Ý¥¤¥ó¥ÈÆþÎÏÀ©¸Â
+function fnCheckInputPoint() {
+	if(document.form1['point_check']) {
+		list = new Array(
+						'use_point'
+						);
+	
+		if(!document.form1['point_check'][0].checked) {
+			color = "#dddddd";
+			flag = true;
+		} else {
+			color = "";
+			flag = false;
+		}
+		
+		len = list.length
+		for(i = 0; i < len; i++) {
+			if(document.form1[list[i]]) {
+				document.form1[list[i]].disabled = flag;
+				document.form1[list[i]].style.backgroundColor = color;
+			}
+		}
+	}
+}
+
+// ÊÌ¤Î¤ªÆÏ¤±ÀèÆþÎÏÀ©¸Â
+function fnCheckInputDeliv() {
+	if(document.form1['deliv_check']) {
+		list = new Array(
+						'deliv_name01',
+						'deliv_name02',
+						'deliv_kana01',
+						'deliv_kana02',
+						'deliv_pref',
+						'deliv_zip01',
+						'deliv_zip02',
+						'deliv_addr01',
+						'deliv_addr02',
+						'deliv_tel01',
+						'deliv_tel02',
+						'deliv_tel03'
+						);
+	
+		if(!document.form1['deliv_check'].checked) {
+			fnChangeDisabled(list, '#dddddd');
+		} else {
+			fnChangeDisabled(list, '');
+		}
+	}
+}
+
+
+// ¹ØÆþ»þ²ñ°÷ÅÐÏ¿ÆþÎÏÀ©¸Â
+function fnCheckInputMember() {
+	if(document.form1['member_check']) {
+		list = new Array(
+						'password',
+						'password_confirm',
+						'reminder',
+						'reminder_answer'
+						);
+
+		if(!document.form1['member_check'].checked) {
+			fnChangeDisabled(list, '#dddddd');
+		} else {
+			fnChangeDisabled(list, '');
+		}
+	}
+}
+
+// ºÇ½é¤ËÀßÄê¤µ¤ì¤Æ¤¤¤¿¿§¤òÊÝÂ¸¤·¤Æ¤ª¤¯
+var g_savecolor = new Array();
+
+function fnChangeDisabled(list, color) {
+	len = list.length;
+	
+	for(i = 0; i < len; i++) {
+		if(document.form1[list[i]]) {
+			if(color == "") {
+				// Í­¸ú¤Ë¤¹¤ë
+				document.form1[list[i]].disabled = false;
+				document.form1[list[i]].style.backgroundColor = g_savecolor[list[i]];
+			} else {
+				// Ìµ¸ú¤Ë¤¹¤ë
+				document.form1[list[i]].disabled = true;
+				g_savecolor[list[i]] = document.form1[list[i]].style.backgroundColor;
+				document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0";	
+			}			
+		}
+	}
+}
+
+
+// ¥í¥°¥¤¥ó»þ¤ÎÆþÎÏ¥Á¥§¥Ã¥¯
+function fnCheckLogin(formname) {
+	var lstitem = new Array();
+	
+	if(formname == 'login_mypage'){
+	lstitem[0] = 'mypage_login_email';
+	lstitem[1] = 'mypage_login_pass';
+	}else{
+	lstitem[0] = 'login_email';
+	lstitem[1] = 'login_pass';
+	}
+	var max = lstitem.length;
+	var errflg = false;
+	var cnt = 0;
+	
+	//¡¡É¬¿Ü¹àÌÜ¤Î¥Á¥§¥Ã¥¯
+	for(cnt = 0; cnt < max; cnt++) {
+		if(document.forms[formname][lstitem[cnt]].value == "") {
+			errflg = true;
+			break;
+		}
+	}
+	
+	// É¬¿Ü¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç	
+	if(errflg == true) {
+		alert('¥á¡¼¥ë¥¢¥É¥ì¥¹/¥Ñ¥¹¥ï¡¼¥É¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£');
+		return false;
+	}
+}
+	
+// »þ´Ö¤Î·×Â¬
+function fnPassTime(){
+	end_time = new Date();
+	time = end_time.getTime() - start_time.getTime();
+	alert((time/1000));
+}
+start_time = new Date();
+
+//¿Æ¥¦¥£¥ó¥É¥¦¤Î¥Ú¡¼¥¸¤òÊÑ¹¹¤¹¤ë¡£
+function fnUpdateParent(url) {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		window.opener.location.href = url;
+	} else {
+		window.close();
+	}		
+}
+
+//ÆÃÄê¤Î¥­¡¼¤òSUBMIT¤¹¤ë¡£
+function fnKeySubmit(keyname, keyid) {
+	if(keyname != "" && keyid != "") {
+		document.form1[keyname].value = keyid;
+	}
+	document.form1.submit();
+}
+
+//Ê¸»ú¿ô¤ò¥«¥¦¥ó¥È¤¹¤ë¡£
+//°ú¿ô?¡§¥Õ¥©¡¼¥àÌ¾¾Î
+//°ú¿ô?¡§Ê¸»ú¿ô¥«¥¦¥ó¥ÈÂÐ¾Ý
+//°ú¿ô?¡§¥«¥¦¥ó¥È·ë²Ì³ÊÇ¼ÂÐ¾Ý
+function fnCharCount(form,sch,cnt) {
+	document.forms[form][cnt].value= document.forms[form][sch].value.length;
+}
+
+
+// ¥Æ¥­¥¹¥È¥¨¥ê¥¢¤Î¥µ¥¤¥º¤òÊÑ¹¹¤¹¤ë
+function ChangeSize(button, TextArea, Max, Min, row_tmp){
+	
+	if(TextArea.rows <= Min){
+		TextArea.rows=Max; button.value="¾®¤µ¤¯¤¹¤ë"; row_tmp.value=Max;
+	}else{
+		TextArea.rows =Min; button.value="Âç¤­¤¯¤¹¤ë"; row_tmp.value=Min;
+	}
+}
+
Index: /temp/tags/eccube-0_9_2beta/html/js/layout_design.js
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/js/layout_design.js	(revision 4420)
+++ /temp/tags/eccube-0_9_2beta/html/js/layout_design.js	(revision 4420)
@@ -0,0 +1,655 @@
+// ¥µ¥¤¥º´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+function SC_Size() {
+	this.id = '';				// ID
+	this.left = 0;				// ÇÛÃÖ¤¹¤ëY¼´ºÂÉ¸
+	this.top = 0;				// ÇÛÃÖ¤¹¤ëX¼´ºÂÉ¸
+	this.width = 0;				// ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÉý
+	this.height = 0;			// ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹â¤µ
+	this.target_id = '';		// ÇÛÃÖ¾ì½ê¡Êº¸¥Ê¥Ó¤È¤«¡Ë
+	this.margin = 10;			// ¾å¤Î¥ª¥Ö¥¸¥§¥¯¥È¤È¤ÎÉý
+	this.obj;
+};
+
+// ÊÑ¿ôÀë¸À
+var defUnused = 500;	// Ì¤»ÈÍÑÎÎ°è¤Î¥Ç¥Õ¥©¥ë¥È¤Î¹â¤µ
+var defNavi   = 400;	// º¸±¦¥Ê¥Ó¤Î¥Ç¥Õ¥©¥ë¥È¤Î¹â¤µ
+var defMainNavi  = 100;	// ¥á¥¤¥ó¾å²¼¤Î¥Ç¥Õ¥©¥ë¥È¤Î¹â¤µ
+var defMain   = 200;	// ¥á¥¤¥ó¤Î¥Ç¥Õ¥©¥ë¥È¤Î¹â¤µ
+
+var NowMaxHeight = 0;		// ¸½ºß¤ÎºÇÂç¤Î¹â¤µ
+var MainHeight = 200;
+
+var marginUnused 	= 688;	// Ì¤»ÈÍÑÎÎ°è¤Îº¸¥Þ¡¼¥¸¥ó
+var marginLeftNavi  = 180;	// º¸¥Ê¥Ó¤Îº¸¥Þ¡¼¥¸¥ó
+var marginRightNavi = 512;	// ±¦¥Ê¥Ó¤Îº¸¥Þ¡¼¥¸¥ó
+var marginMain		= 348;	// ¥á¥¤¥ó¾å²¼¤Îº¸¥Þ¡¼¥¸¥ó
+var marginMainFootTop= 595;	// ¥á¥¤¥ó²¼¤Î¾å¥Þ¡¼¥¸¥ó
+
+var gDragged = "";			// ¥É¥é¥Ã¥°Ãæ¥ª¥Ö¥¸¥§¥¯¥È
+var gDropTarget = "";		// ¥É¥é¥Ã¥°³«»Ï»þ¤ÎDropTarget
+
+var arrObj = new Object();	// ¥Ö¥í¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È³ÊÇ¼ÍÑ
+
+var mouseFlg = false;
+
+var all_elms;				// div¥¿¥°¥ª¥Ö¥¸¥§¥¯¥È³ÊÇ¼ÍÑ
+
+// ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º
+var scrX;
+var scrY;
+
+// ¥¤¥Ù¥ó¥È¤Î´ØÏ¢ÉÕ¤±¤ò¹Ô¤¦
+function addEvent( elm, evtType, fn, useCapture) {
+
+    if (elm.addEventListener) {
+        elm.addEventListener(evtType, fn, useCapture);
+        return true;
+
+    }
+    else if (elm.attachEvent) {
+
+        var r = elm.attachEvent('on' + evtType, fn);
+        return r;
+
+    }
+    else {
+        elm['on'+evtType] = fn;
+
+    }
+    
+}
+
+
+// ¥¤¥Ù¥ó¥È¤Î´ØÏ¢ÉÕ¤±¤ò²ò½ü
+function removeEvent( elm, evtType, fn, useCapture) {
+
+    if (elm.removeEventListener) {
+
+        elm.removeEventListener(evtType, fn, useCapture);
+        return true;
+
+    }
+    else if (elm.detachEvent) {
+
+        var r = elm.detachEvent('on' + evtType, fn);
+        return r;
+
+    }
+    else {
+
+        elm['on'+evtType] = fn;
+
+    }
+   
+}
+
+// ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤òÊÑ¹¹
+function setCursor ( elm, curtype ) {
+	elm.style.cursor = curtype;
+}
+
+// ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆ©ÌÀÅÙ¤òÊÑ¹¹   
+function setOpacity(node,val) {
+
+    if (node.filters) {
+		node.filters["alpha"].opacity = val*100;
+    } else if (node.style.opacity) {
+        node.style.opacity = val;
+    }
+}
+
+// Zindex¤òÊÑ¹¹¤¹¤ë¡ÊÁ°ÌÌÉ½¼¨ÀÚÂØ¡Ë
+function setZindex(node, val) {
+	node.style.zIndex = val;
+//	alert(val);
+}
+
+// ÃÍ¤ò¼èÆÀ
+function getAttrValue ( elm, attrname ) {
+	//alert(elm.nodeValue);
+	
+	//alert(typeof(elm.attributes[ attrname ]));
+	
+	//alert(elm.attributes[ attrname ].nodeValue);
+	
+	if (typeof(elm.attributes[ attrname ]) != 'undefined') {
+	    return elm.attributes[ attrname ].nodeValue;
+	}
+	
+}
+
+// ÃÍ¤ò¥»¥Ã¥È
+function setAttrValue ( elm, attrname, val ) {
+    elm.attributes[ attrname ].nodeValue = val;
+}
+
+// ¥ª¥Ö¥¸¥§¥¯¥È¤ÎXºÂÉ¸¤ò¼èÆÀ
+function getX ( elm ) {
+//   return parseInt(elm.style.left);
+	return parseInt(elm.offsetLeft);
+}
+
+// ¥ª¥Ö¥¸¥§¥¯¥È¤ÎYºÂÉ¸¤ò¼èÆÀ
+function getY ( elm ) {
+	return parseInt(elm.offsetTop);
+//    return parseInt(elm.style.top);
+}
+
+// XºÂÉ¸¤ò¼èÆÀ
+function getEventX ( evt ) {
+    return evt.clientX ? evt.clientX : evt.pageX;
+}
+
+// YºÂÉ¸¤ò¼èÆÀ
+function getEventY ( evt ) {
+    return evt.clientY ? evt.clientY : evt.pageY;
+}
+
+// ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÉý¤ò¼èÆÀ
+function getWidth ( elm ) {
+    return parseInt( elm.style.width );
+}
+
+// ¥ª¥Ö¥¸¥§¥¯¥È¤Î¹â¤µ¤ò¼èÆÀ
+function getHeight ( elm ) {
+//    return parseInt( elm.style.height );
+    return parseInt( elm.offsetHeight );
+}
+
+// ¥Ú¡¼¥¸¤Î²Ä»ëÎÎ°è¤ÎXºÂÉ¸¤ò¼èÆÀ¤¹¤ë
+function getPageScrollX()
+{
+	var x = 0;
+
+	if (document.body && document.body.scrollLeft != null) {
+		x = document.body.scrollLeft;
+	} else if (document.documentElement && document.documentElement.scrollLeft != null) {
+		x = document.documentElement.scrollLeft;
+	} else if (window.scrollX != null) {
+		x = window.scrollX;
+	} else if (window.pageXOffset != null) {
+		x = window.pageXOffset;
+	}
+	
+	return x;
+}
+
+// ¥Ú¡¼¥¸¤Î²Ä»ëÎÎ°è¤ÎYºÂÉ¸¤ò¼èÆÀ¤¹¤ë
+function getPageScrollY()
+{
+	var y = 0;
+	
+	if (document.body && document.body.scrollTop != null) {
+		y = document.body.scrollTop;
+	} else if (document.documentElement && document.documentElement.scrollTop != null) {
+		y = document.documentElement.scrollTop;
+	} else if (window.scrollY != null) {
+		y = window.scrollY;
+	} else if (window.pageYOffset != null) {
+		y = window.pageYOffset;
+	}
+	
+	return y;
+}
+
+
+// ¥ª¥Ö¥¸¥§¥¯¥È¤ÎºÂÉ¸¤ò¥»¥Ã¥È
+function moveElm ( elm, x, y ) {
+    elm.style.left = x + 'px';
+    elm.style.top = y + 'px';
+}
+
+// ¥Þ¥¦¥¹¥À¥¦¥ó¥¤¥Ù¥ó¥È
+function onMouseDown (evt) {
+
+    var target = evt.target ? evt.target : evt.srcElement;
+    var x = getEventX ( evt );
+    var y = getEventY ( evt );
+
+    //
+    // Save Information to Globals
+    //
+  	if (mouseFlg == false) {
+    
+	    gDragged = target;
+	
+	    gDeltaX = x - getX(gDragged);
+	    gDeltaY = y - getY(gDragged);
+	
+	    gDraggedId = getAttrValue ( gDragged, 'did' );
+	    setCursor ( gDragged, 'move' );
+	
+	    gOrgX = getX ( gDragged );
+	    gOrgY = getY ( gDragged );
+	    gtarget_id = getAttrValue ( gDragged, 'target_id' );
+	
+	    //
+	    // Set
+	    //
+	   
+	    // ¥É¥é¥Ã¥°Ãæ¤ÏÈ¾Æ©ÌÀ
+	    setOpacity ( gDragged, 0.6 );
+	
+	    // ¥É¥é¥Ã¥°Ãæ¤ÏºÇÁ°ÌÌÉ½¼¨
+	    setZindex ( gDragged , 2);
+	    
+	    addEvent ( document, 'mousemove', onMouseMove, false );
+	    addEvent ( document, 'mouseup', onMouseUp, false );
+
+	    // ¥É¥é¥Ã¥°¤ò³«»Ï¤·¤¿¤È¤­¤Ï¹â¤µ¤ò°ìÅÙ½é´ü²½¤¹¤ë¡£
+	    NowMaxHeight = defNavi;
+	    	    
+	    mouseFlg = true;
+	}
+}
+
+
+// ¥Þ¥¦¥¹¥à¡¼¥Ö¥¤¥Ù¥ó¥È
+function onMouseMove(evt) {
+
+	// ¸½ºß¤ÎºÂÉ¸¤ò¼èÆÀ
+	var x = getEventX ( evt ) + document.body.scrollLeft;					// ¥Þ¥¦¥¹ºÂÉ¸ X
+	var y = getEventY ( evt ) + document.body.scrollTop;					// ¥Þ¥¦¥¹ºÂÉ¸ Y
+    var nowleft = getEventX ( evt ) - gDeltaX;	// ¥ª¥Ö¥¸¥§¥¯¥ÈºÂÉ¸ LEFT
+    var nowtop = getEventY ( evt ) - gDeltaY;	// ¥ª¥Ö¥¸¥§¥¯¥ÈºÂÉ¸ TOP
+
+    // ¥ª¥Ö¥¸¥§¥¯¥È¤ò°ÜÆ°
+    moveElm ( gDragged, nowleft, nowtop );
+	
+    for ( var i = 0; i < all_elms.length; i++ ) {
+    	// drop_target¾å¤Ë¤­¤¿¾ì¹ç¤Ë¤Î¤ß½èÍý¤ò¹Ô¤¦
+	    if ( isEventOnElm ( evt, all_elms[i].id ) ) {	    
+            if ( all_elms[i].attributes['tid'] ) {
+	            var tid = getAttrValue ( all_elms[i], 'tid' );
+	            
+	            // ÇØ·Ê¿§¤ÎÊÑ¹¹ Ì¤»ÈÍÑÎÎ°è¤ÏÊÑ¹¹¤·¤Ê¤¤
+	            all_elms[i].style.background="#ffffdd";
+	            
+				// target_id ¤Î½ñ¤­´¹¤¨
+		        setAttrValue ( gDragged, 'target_id', tid );
+
+				//objCheckLine.style.top = parseInt(nowtop) + parseInt(gDragged.style.height) / 2 + 'px';
+				//objCheckLine.style.top = y;
+
+				// ÇÛÎó¤ÎºÆºîÀ®
+				fnCreateArr(1, y, x);
+				// ÇÛÎó¤ÎÊÂ¤ÓÂØ¤¨
+				fnChangeObj(tid);
+		    }
+		}else{
+			if ( all_elms[i].attributes['tid'] && all_elms[i].style.background!="#ffffff") {
+				// ÇØ·Ê¿§¤ÎÊÑ¹¹
+				all_elms[i].style.background="#ffffff";
+			}
+		}
+    }
+}
+
+// ¥Þ¥¦¥¹¥¢¥Ã¥×¥¤¥Ù¥ó¥È       
+function onMouseUp(evt) {
+	// ¥¤¥Ù¥ó¥È¤Î´ØÏ¢ÉÕ¤±²ò½ü
+	if (mouseFlg == true) {
+	    removeEvent ( document, 'mousemove', onMouseMove, false );
+	    removeEvent ( document, 'mouseup', onMouseUp, false );
+	    mouseFlg = false;
+	}
+
+    if ( !isOnDropTarget (evt) ) {
+		// ¸µ¤Î°ÌÃÖ¤ËÌá¤¹
+        moveElm ( gDragged, gOrgX, gOrgY );
+        setAttrValue ( gDragged, 'target_id', gtarget_id );
+
+		// ÇÛÎó¤ÎºÆºîÀ®
+		fnCreateArr(1, gOrgY, gOrgX);
+    }
+    
+    // hiddenÍ×ÁÇ¤Î½ñ¤­´¹¤¨
+	var did = getAttrValue( gDragged, 'did' );
+	var target_id = "target_id_"+did;
+	document.form1[target_id].value = getAttrValue( gDragged, 'target_id' );
+	
+	// È¾Æ©ÌÀ¡¢¥Þ¥¦¥¹¥Ý¥¤¥ó¥¿¡¢ºÇÁ°ÌÌ½èÍý¤òÌá¤¹
+    setOpacity( gDragged, 1);
+    setCursor ( gDragged, 'move' );
+    setZindex ( gDragged , 1);
+    
+    // ÊÂ¤ÓÂØ¤¨
+	fnSortObj();
+	
+	// ÇØ·Ê¿§¤òÌá¤¹
+	for ( var i = 0; i < all_elms.length; i++ ) {
+    	// drop_target¾å¤Ë¤­¤¿¾ì¹ç¤Ë¤Î¤ß½èÍý¤ò¹Ô¤¦
+	    if ( isEventOnElm ( evt, all_elms[i].id ) && all_elms[i].attributes['tid']) {
+			// ÇØ·Ê¿§¤ÎÊÑ¹¹
+			all_elms[i].style.background="#ffffff";
+		}
+    }
+}
+
+// DropTarget¾å¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤¬Íè¤¿¤«¤òÈ½ÃÇ¤¹¤ë
+function isOnDropTarget ( evt ) {
+   
+    for ( var i=0; i<all_elms.length; i++ ) {
+        if ( isEventOnElm ( evt, all_elms[i].id ) ) {
+            if ( all_elms[i].attributes['tid'] ) {
+                return true;
+            }
+        }
+    }
+    return false;
+}
+function isEventOnElm (evt, drop_target_id) {
+
+	if (drop_target_id == '') {
+		return '';
+	}
+
+    var evtX = getEventX(evt) + getPageScrollX();
+    var evtY = getEventY(evt) + getPageScrollY();
+    
+    var drop_target = document.getElementById( drop_target_id );
+
+	drp_left = getX( drop_target );
+	drp_top = getY( drop_target );
+
+    var x = drp_left;
+    var y = drp_top;
+
+	var width = getWidth ( drop_target );
+	var height = getHeight ( drop_target );
+    
+//	alert(evtX +" / "+ x +" / "+ evtY +" / "+ y +" / "+ width +" / "+ height);
+
+    return evtX > x && evtY > y && evtX < x + width && evtY < y + height;
+}
+
+// ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÊÂ¤ÓÂØ¤¨¤ò¹Ô¤¦
+function fnSortObj(){
+	fnSetTargetHeight();
+    for ( var cnt = 0; cnt < all_elms.length; cnt++ ) {
+
+		// class¤¬ drop_target ¤Î¾ì¹ç¤Î¤ß½èÍý¤ò¹Ô¤¦
+        if ( getAttrValue ( all_elms[cnt], 'class' ) == 'drop_target' ) {
+        	var tid = getAttrValue ( all_elms[cnt], 'tid' );
+			
+			// ÇÛÎó¤ÎÊÂ¤ÓÂØ¤¨
+			fnChangeObj(tid);
+			
+			// ÇÛÃÖ
+			fnSetObj( tid, cnt );
+        }
+	}
+}
+
+// ÇÛÎó¤ÎºîÀ®
+function fnCreateArr( addEvt , top , left ){
+
+	var arrObjtmp = new Object();
+	arrObjtmp['LeftNavi'] = Array();
+	arrObjtmp['RightNavi'] = Array();
+	arrObjtmp['MainHead'] = Array();
+	arrObjtmp['MainFoot'] = Array();
+	arrObjtmp['Unused'] = Array();
+
+	for ( var i = 0; i < all_elms.length; i++ ) {
+ 
+
+		// class¤¬ dragged_elm ¤Î¾ì¹ç¤Î¤ß½èÍý¤ò¹Ô¤¦
+		if ( getAttrValue ( all_elms[i], 'class' ) == 'dragged_elm' ) {
+        
+			// ¥Þ¥¦¥¹¥À¥¦¥ó¥¤¥Ù¥ó¥È¤È´ØÏ¢ÉÕ¤±¤ò¹Ô¤¦
+			if (addEvt == 0) {
+	        	addEvent ( all_elms[i], 'mousedown', onMouseDown, false );
+			}
+
+			var target_id = getAttrValue ( all_elms[i], 'target_id' );	
+			var len = arrObjtmp[target_id].length;
+			var did = getAttrValue ( all_elms[i], 'did' );
+			
+			arrObjtmp[target_id][len] = new SC_Size();
+			arrObjtmp[target_id][len].id = did;
+			arrObjtmp[target_id][len].obj = all_elms[i];
+			arrObjtmp[target_id][len].width = getWidth( all_elms[i] );
+			arrObjtmp[target_id][len].height = getHeight( all_elms[i] );
+
+			// ¥É¥é¥Ã¥°Ãæ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤¬Â¸ºß¤¹¤ì¤Ð¡¢¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¤À¤±¥Þ¥¦¥¹¥Ý¥¤¥ó¥¿¤ÎºÂÉ¸¤ò»ØÄê¤¹¤ë¡£
+			if (gDragged != "") {
+				if (did != getAttrValue ( gDragged, 'did' )) {
+					// top ¤Ï¾ï¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤ÎÃæ¿´¤ò¼èÆÀ¤¹¤ë¤è¤¦¤Ë¤¹¤ë
+					arrObjtmp[target_id][len].top = (parseInt(getY( all_elms[i] )) + arrObjtmp[target_id][len].height / 2 );
+					arrObjtmp[target_id][len].left = getX( all_elms[i] );
+				}else {
+					arrObjtmp[target_id][len].top = top;
+					arrObjtmp[target_id][len].left = left;
+				}
+			} else {
+				// top ¤Ï¾ï¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤ÎÃæ¿´¤ò¼èÆÀ¤¹¤ë¤è¤¦¤Ë¤¹¤ë
+				arrObjtmp[target_id][len].top = i;
+				arrObjtmp[target_id][len].left = getX( all_elms[i] );
+			}
+		}
+    }
+    
+    arrObj = arrObjtmp;
+}
+
+// ÇÛÎó¤ÎÊÂ¤ÓÂØ¤¨ (¥Ð¥Ö¥ë¥½¡¼¥È¤ÇÊÂ¤ÓÂØ¤¨¤ò¹Ô¤¦) 
+function fnChangeObj( tid ){
+	for ( var i = 0; i < arrObj[tid].length-1; i++ ) {
+    	for ( var j = arrObj[tid].length-1; j > i; j-- ) {
+			if ( arrObj[tid][j].top < arrObj[tid][i].top ) {
+				var arrTemp = new Array();
+				arrTemp = arrObj[tid][j];
+				arrObj[tid][j] = arrObj[tid][i];
+				arrObj[tid][i] = arrTemp;
+			}
+		}
+	}
+}
+
+// ÇÛÃÖ
+function fnSetObj( tid, cnt ){
+	var target_height = 0;
+	
+	drp_left = getX(all_elms[cnt]); //all_elms[cnt].offsetLeft;
+	drp_top = getY(all_elms[cnt]); //all_elms[cnt].offsetTop;
+
+	for ( var j = 0; j < arrObj[tid].length; j++ ) {
+		// ÇÛÃÖ¤¹¤ëºÂÉ¸¤Î¼èÆÀ
+	    var left = parseInt(drp_left) + parseInt(all_elms[cnt].style.width) / 2 - parseInt(arrObj[tid][j].width) / 2;
+	    if (j == 0){
+	    	var top = drp_top + arrObj[tid][j].margin;
+	    }else{
+	    	var top = arrObj[tid][j-1].top + arrObj[tid][j].margin + arrObj[tid][j-1].height
+	    }
+
+		// ºÂÉ¸¤òÊÝ»ý
+		arrObj[tid][j].top = top;
+		arrObj[tid][j].left = left;
+
+		// ÇÛÃÖ¤ò¹Ô¤¦
+		moveElm ( arrObj[tid][j].obj, left ,top);
+
+		// ¹â¤µ·×»»
+		target_height = target_height + arrObj[tid][j].margin + arrObj[tid][j].height;
+
+		// hidden¤ÎÃÍ¤ò½ñ¤­´¹¤¨
+		var top_id = "top_" + arrObj[tid][j].id;
+		document.form1[top_id].value = top;
+
+	}
+}
+
+// ¥É¥í¥Ã¥×¥¿¡¼¥²¥Ã¥È¤Î¹â¤µÄ´À°
+function fnSetTargetHeight(){
+
+	var NaviHeight = defNavi;
+	var MainHeadHeight = defMainNavi;
+	var MainFootHeight = defMainNavi;
+	var UnusedHeight = defUnused;
+
+	// ¹â¤µ·×»»
+    for ( var cnt = 0; cnt < all_elms.length; cnt++ ) {
+		var target_height = 0;
+    
+		// class¤¬ drop_target ¤Î¾ì¹ç¤Î¤ß½èÍý¤ò¹Ô¤¦
+        if ( getAttrValue ( all_elms[cnt], 'class' ) == 'drop_target' ) {
+        	var tid = getAttrValue ( all_elms[cnt], 'tid' );
+
+			for ( var j = 0; j < arrObj[tid].length; j++ ) {
+				target_height = target_height + arrObj[tid][j].margin + arrObj[tid][j].height;
+			}
+
+			// ²¼¤ÎÉý
+			target_height = target_height + 20;
+
+			// º¸±¦¥Ê¥Ó¡¢Ì¤»ÈÍÑÎÎ°è¤Î¹â¤µ¤òÊÝ»ý
+			if (tid == 'LeftNavi' || tid == 'RightNavi' || tid == 'Unused') {
+				if (NaviHeight < target_height) {
+					NaviHeight = target_height;
+				}
+			}
+
+			// ¥á¥¤¥ó¾åÉôÎÎ°è¤Î¹â¤µ¤òÊÝ»ý
+			if (tid == 'MainHead') {
+				if (target_height > defMainNavi) {
+					MainHeadHeight = target_height;
+				}
+			}
+
+			// ¥á¥¤¥ó²¼ÉôÎÎ°è¤Î¹â¤µ¤òÊÝ»ý
+			if (tid == 'MainFoot') {
+				if (target_height > defMainNavi) {
+					MainFootHeight = target_height;
+				}
+			}	
+        }
+	}
+
+	// ¥á¥¤¥óÎÎ°è¤Î¹â¤µ¤òÊÝ»ý
+//	alert(NaviHeight+"/"+MainHeadHeight+"/"+MainFootHeight);
+	MainHeight = NaviHeight - ( MainHeadHeight + MainFootHeight );
+	if (MainHeight < defMain) {
+		MainHeight = defMain;
+	}
+
+	// ¥á¥¤¥óÉôÊ¬¤Î¤Û¤¦¤¬Âç¤­¤¤¾ì¹ç¤Ë¤Ïº¸±¦¥Ê¥Ó¤âÂç¤­¤¯¤¹¤ë
+	if (NaviHeight < MainHeadHeight + MainFootHeight + MainHeight) {
+		NaviHeight = MainHeadHeight + MainFootHeight + MainHeight;	
+	}
+	// ÊÑ¹¹
+    for ( var cnt = 0; cnt < all_elms.length; cnt++ ) {
+    	var target_height = 0;
+
+		// class¤¬ drop_target ¤Î¾ì¹ç¤Î¤ß½èÍý¤ò¹Ô¤¦
+        if ( getAttrValue ( all_elms[cnt], 'class' ) == 'drop_target' ) {
+        	var tid = getAttrValue ( all_elms[cnt], 'tid' );
+        	
+        	// tid¤Ë¤è¤Ã¤Æ½èÍý¤òÊ¬¤±¤ë
+			if (tid == 'LeftNavi' || tid == 'RightNavi') {
+				target_height = NaviHeight;
+			}else if (tid == 'MainHead' ) {
+				target_height = MainHeadHeight;
+			}else if (tid == 'MainFoot') {
+				target_height = MainFootHeight;
+			}else if (tid == 'Unused'){
+				target_height = NaviHeight+100;
+			}
+
+			all_elms[cnt].style.height = target_height;
+		}
+	}
+	
+	// ¥á¥¤¥ó¥Æ¡¼¥Ö¥ë¤Î¹â¤µ¤âÊÑ¹¹
+    for (var i = 0; i < all_td.length; i++) {
+    	name = getAttrValue ( all_td[i], 'name' );
+		if (name == 'Main') {
+			all_td[i].height = MainHeight-2;
+		}
+    }
+}
+
+//¥¦¥¤¥ó¥É¥¦¥µ¥¤¥º¼èÆÀ
+function GetWindowSize(type){
+    var ua = navigator.userAgent;       										// ¥æ¡¼¥¶¡¼¥¨¡¼¥¸¥§¥ó¥È
+    var nWidth, nHeight;                  										// ¥µ¥¤¥º
+    var nHit = ua.indexOf("MSIE");     											// ¹çÃ×¤·¤¿ÉôÊ¬¤ÎÀèÆ¬Ê¸»ú¤ÎÅº¤¨»ú
+    var bIE = (nHit >=  0);                										// IE ¤«¤É¤¦¤«
+    var bVer6 = (bIE && ua.substr(nHit+5, 1) == "6");  							// ¥Ð¡¼¥¸¥ç¥ó¤¬ 6 ¤«¤É¤¦¤«
+    var bStd = (document.compatMode && document.compatMode=="CSS1Compat");		// É¸½à¥â¡¼¥É¤«¤É¤¦¤«
+
+	switch(type){
+		case "width":
+			if(bIE){
+				if (bVer6 && bStd) {
+					return document.documentElement.clientWidth;
+				} else {
+					return document.body.clientWidth;
+				}
+			}else if(document.layers){
+				return(innerWidth);
+			}else{
+				return(-1);
+			}
+		break;
+		case "height":
+			if(bIE){
+				if (bVer6 && bStd) {
+					return document.documentElement.clientHeight;
+				} else {
+					return document.body.clientHeight;
+				}
+				return(document.body.clientHeight);
+			}else if(document.layers){
+				return(innerHeight);
+			}else{
+				return(-1);
+			}
+		break;
+		default:
+			return(-1);
+		break;
+	}
+}
+
+// ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤¬ÊÑ¹¹¤Ë¤Ê¤Ã¤¿¤È¤­¤ÏÁ´¤Æ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤â°ÜÆ°¤¹¤ë
+function fnMoveObject() {
+
+    // ¥¦¥£¥ó¥É¥¦¤ÎÉýÊÑ¹¹ÈæÎ¨¤ò¼èÆÀ
+	var moveX = GetWindowSize("width") - scrX;
+	var BlankX = ( GetWindowSize("width") - 878 ) / 2
+	
+	for ( var i = 0; i < all_elms.length; i++) {
+		if (all_elms[i].style.left != "" ) {
+
+			var elm_class = getAttrValue ( all_elms[i], 'class' );
+
+			if (elm_class == 'drop_target') {
+				var tid = getAttrValue ( all_elms[i], 'tid' );
+				
+				if (tid == 'LeftNavi') {
+					LeftMargin = marginLeftNavi;
+				}else if (tid == 'RightNavi') {
+					LeftMargin = marginRightNavi;
+				}else if (tid == 'MainHead' || tid == 'MainFoot') {
+					LeftMargin = marginMain;
+				}else{
+					LeftMargin = marginUnused;
+				}
+
+				if (BlankX > 0) {
+					all_elms[i].style.left = BlankX + LeftMargin + 'px';
+				}else{
+					all_elms[i].style.left = LeftMargin + 'px';
+				}
+			}
+		}
+	}
+	
+	scrX = GetWindowSize("width");
+	scrY = GetWindowSize("height");
+	
+	fnSortObj();
+}
+// ²èÌÌ¤Î¥í¡¼¥É¥¤¥Ù¥ó¥È¤Ë´ØÏ¢ÉÕ¤±
+addEvent ( window, 'load', init, false );
Index: /temp/tags/eccube-0_9_2beta/html/js/admin.js
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/js/admin.js	(revision 2291)
+++ /temp/tags/eccube-0_9_2beta/html/js/admin.js	(revision 2291)
@@ -0,0 +1,407 @@
+
+// ´ÉÍý¼Ô¥á¥ó¥Ð¡¼¤òÄÉ²Ã¤¹¤ë¡£
+function fnRegistMember() {
+	// É¬¿Ü¹àÌÜ¤ÎÌ¾Á°¡¢¥í¥°¥¤¥óID¡¢¥Ñ¥¹¥ï¡¼¥É¡¢¸¢¸Â
+	var lstitem = new Array();
+	lstitem[0] = 'name';
+	lstitem[1] = 'login_id';
+	lstitem[2] = 'password';
+	lstitem[3] = 'authority';
+	
+	var max = lstitem.length;
+	var errflg = false;
+	var cnt = 0;
+	
+	//¡¡É¬¿Ü¹àÌÜ¤Î¥Á¥§¥Ã¥¯
+	for(cnt = 0; cnt < max; cnt++) {
+		if(document.form1[lstitem[cnt]].value == "") {
+			errflg = true;
+			break;
+		}
+	}
+	
+	// É¬¿Ü¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç	
+	if(errflg == true) {
+		alert('É¬¿Ü¹àÌÜ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£');
+		return false;
+	} else {
+		if(window.confirm('ÆâÍÆ¤òÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+			return true;
+		} else {  
+			return false;
+		}
+	}
+}
+
+//¿Æ¥¦¥£¥ó¥É¥¦¤Î¥Ú¡¼¥¸¤òÊÑ¹¹¤¹¤ë¡£
+function fnUpdateParent(url) {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		window.opener.location.href = url;
+	} else {
+		window.close();
+	}		
+}
+
+// ¿Æ¥¦¥£¥ó¥É¥¦¤ò¥Ý¥¹¥È¤µ¤»¤ë¡£
+function fnSubmitParent() {
+	// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+	if(fnIsopener()) {
+		window.opener.document.form1.submit();
+	} else {
+		window.close();
+	}		
+}
+
+//»ØÄê¤µ¤ì¤¿id¤Îºï½ü¤ò¹Ô¤¦¥Ú¡¼¥¸¤ò¼Â¹Ô¤¹¤ë¡£
+function fnDeleteMember(id, pageno) {
+	url = "./delete.php?id=" + id + "&pageno=" + pageno;
+	if(window.confirm('ÅÐÏ¿ÆâÍÆ¤òºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		location.href = url;
+	}
+}
+
+// ¥é¥¸¥ª¥Ü¥¿¥ó¥Á¥§¥Ã¥¯¾õÂÖ¤òÊÝÂ¸
+var lstsave = "";
+
+// ¥é¥¸¥ª¥Ü¥¿¥ó¤Î¥Á¥§¥Ã¥¯¾õÂÖ¤ò¼èÆÀ¤¹¤ë¡£
+function fnGetRadioChecked() {
+	var max;
+	var cnt;
+	var names = "";
+	var startname = "";
+	var ret;
+	max = document.form1.elements.length;
+	lstsave = Array(max);
+	for(cnt = 0; cnt < max; cnt++) {
+		if(document.form1.elements[cnt].type == 'radio') {
+			name = document.form1.elements[cnt].name;
+			/* radio¥Ü¥¿¥ó¤ÏÆ±¤¸Ì¾Á°¤¬£²²óÂ³¤±¤Æ¸¡½Ð¤µ¤ì¤ë¤Î¤Ç¡¢
+			   ºÇ½é¤ÎÌ¾Á°¤Î¸¡½Ð¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎÈ½Äê */
+			// 1²óÌÜ¤Î¸¡½Ð
+			if(startname != name) {
+				startname = name;	
+				ret = document.form1.elements[cnt].checked;
+				if(ret == true){
+					// ²ÔÆ¯¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¡£
+					lstsave[name] = 1;
+				}	
+			// 2²óÌÜ¤Î¸¡½Ð
+			} else {
+				ret = document.form1.elements[cnt].checked;
+				if(ret == true){
+					// Èó²ÔÆ¯¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¡£
+					lstsave[name] = 0;
+				}
+			}
+		}
+	}
+}
+
+// ¥é¥¸¥ª¥Ü¥¿¥ó¤ËÊÑ¹¹¤¬¤¢¤Ã¤¿¤«È½Äê¤¹¤ë¡£
+function fnChangeRadio(name, no, id, pageno) {
+	// ºÇ½é¤Î¼èÆÀ¾õÂÖ¤«¤éÊÑ¹¹¤¢¤ê¤Î¾ì¹ç
+	if(lstsave[name] != no) {
+		// DBÈ¿±Ç¥Ú¡¼¥¸¼Â¹Ô
+		url = "./check.php?id=" + id + "&no=" + no + "&pageno=" + pageno;
+		location.href = url;
+	}
+}
+
+// ´ÉÍý¼Ô¥á¥ó¥Ð¡¼¥Ú¡¼¥¸¤ÎÀÚÂØ
+function fnMemberPage(pageno) {
+	location.href = "./index.php?pageno=" + pageno;
+}
+
+// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë
+function fnNaviSearchPage(pageno, mode) {
+	document.form1['search_pageno'].value = pageno;
+	document.form1['mode'].value = mode;
+	document.form1.submit();
+}
+
+// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë(form2)
+function fnNaviSearchPage2(pageno) {
+	document.form2['search_pageno'].value = pageno;
+	document.form2['mode'].value = 'search';
+	document.form2.submit();
+}
+
+// ÃÍ¤òÂåÆþ¤·¤Æ»ØÄê¥Ú¡¼¥¸¤Ësubmit
+function fnSetvalAndSubmit( fname, key, val ) {
+	fm = document[fname];
+	fm[key].value = val;
+	fm.submit();
+}
+
+// ¹àÌÜ¤ËÆþ¤Ã¤¿ÃÍ¤ò¥¯¥ê¥¢¤¹¤ë¡£
+function fnClearText(name) {
+	document.form1[name].value = "";
+}
+
+// ¥«¥Æ¥´¥ê¤ÎÄÉ²Ã
+function fnAddCat(cat_id) {
+	if(window.confirm('¥«¥Æ¥´¥ê¤òÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		document.form1['mode'].value = 'edit';
+		document.form1['cat_id'].value = cat_id;
+	}
+}
+
+// ¥«¥Æ¥´¥ê¤ÎÊÔ½¸
+function fnEditCat(parent_id, cat_id) {
+	document.form1['mode'].value = 'pre_edit';
+	document.form1['parent_id'].value = parent_id;
+	document.form1['edit_cat_id'].value = cat_id;
+	document.form1.submit();
+}
+
+// ÁªÂò¥«¥Æ¥´¥ê¤Î¥Á¥§¥Ã¥¯
+function fnCheckCat(obj) {
+	val = obj[obj.selectedIndex].value;
+	if (val == ""){
+		alert ("¿Æ¥«¥Æ¥´¥ê¤ÏÁªÂò¤Ç¤­¤Þ¤»¤ó");
+		obj.selectedIndex = 0;
+	}
+}
+
+// ³ÎÇ§¥Ú¡¼¥¸¤«¤éÅÐÏ¿¥Ú¡¼¥¸¤ØÌá¤ë
+function fnReturnPage() {
+	document.form1['mode'].value = 'return';
+	document.form1.submit();
+}
+
+// µ¬³ÊÊ¬ÎàÅÐÏ¿¤Ø°ÜÆ°
+function fnClassCatPage(class_id) {
+	location.href =  "./classcategory.php?class_id=" + class_id;
+}
+
+function fnSetFormValue(name, val) {
+	document.form1[name].value = val;
+}
+
+function fnListCheck(list) {
+	len = list.length;
+	for(cnt = 0; cnt < len; cnt++) {
+		document.form1[list[cnt]].checked = true;
+	}
+}
+
+function fnAllCheck() {
+	cnt = 1;
+	name = "check:" + cnt;
+	while (document.form1[name]) {
+		document.form1[name].checked = true;
+		cnt++;
+		name = "check:" + cnt;
+	}
+}
+
+function fnAllUnCheck() {
+	cnt = 1;
+	name = "check:" + cnt;
+	while (document.form1[name]) {
+		document.form1[name].checked = false;
+		cnt++;
+		name = "check:" + cnt;
+	}
+}
+
+//»ØÄê¤µ¤ì¤¿id¤Îºï½ü¤ò¹Ô¤¦¥Ú¡¼¥¸¤ò¼Â¹Ô¤¹¤ë¡£
+function fnDelete(url) {
+	if(window.confirm('ÅÐÏ¿ÆâÍÆ¤òºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		location.href = url;
+	}
+}
+
+//ÇÛÁ÷ÎÁ¶â¤ò¼«Æ°ÆþÎÏ
+function fnSetDelivFee(max) {
+	for(cnt = 1; cnt <= max; cnt++) {
+		name = "fee" + cnt;
+		document.form1[name].value = document.form1['fee_all'].value;
+	}
+}
+
+// ºß¸Ë¿ôÀ©¸ÂÈ½Äê
+function fnCheckStockLimit(icolor) {
+	if(document.form1['stock_unlimited']) {
+		list = new Array(
+			'stock'
+			);
+		if(document.form1['stock_unlimited'].checked) {
+			fnChangeDisabled(list, icolor);
+			document.form1['stock'].value = "";
+		} else {
+			fnChangeDisabled(list, '');
+		}
+	}
+}
+
+// ºß¸Ë¿ôÀ©¸ÂÈ½Äê
+function fnCheckStockNoLimit(no, icolor) {
+	$check_key = "stock_unlimited:"+no;
+	$input_key = "stock:"+no;
+	
+	list = new Array($input_key	);
+	if(document.form1[$check_key].checked) {
+		fnChangeDisabled(list, icolor);
+		document.form1[$input_key].value = "";
+	} else {
+		fnChangeDisabled(list, '');
+	}
+}
+
+// ¹ØÆþÀ©¸Â¿ôÈ½Äê
+function fnCheckSaleLimit(icolor) {
+	list = new Array(
+		'sale_limit'
+		);	
+	if(document.form1['sale_unlimited'].checked) {
+		fnChangeDisabled(list, icolor);
+		document.form1['sale_limit'].value = "";
+	} else {
+		fnChangeDisabled(list, '');
+	}
+}
+
+// ºß¸Ë¿ôÈ½Äê
+function fnCheckAllStockLimit(max, icolor) {
+	for(no = 1; no <= max; no++) {
+		$check_key = "stock_unlimited:"+no;
+		$input_key = "stock:"+no;
+		
+		list = new Array($input_key);
+	
+		if(document.form1[$check_key].checked) {
+			fnChangeDisabled(list, icolor);
+			document.form1[$input_key].value = "";
+		} else {
+			fnChangeDisabled(list, '');
+		}
+	}
+}
+
+// Form»ØÄê¤ÎSubmit 
+function fnFormSubmit(form) {
+	document.forms[form].submit();
+}
+
+// ³ÎÇ§¥á¥Ã¥»¡¼¥¸
+function fnConfirm() {
+	if(window.confirm('¤³¤ÎÆâÍÆ¤ÇÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		return true;
+	}
+	return false;
+}
+
+//ºï½ü³ÎÇ§¥á¥Ã¥»¡¼¥¸
+function fnDeleteConfirm() {
+	if(window.confirm('ºï½ü¤·¤Æ¤âµ¹¤·¤¤¤Ç¤·¤ç¤¦¤«')){
+		return true;
+	}
+	return false;
+}
+
+//¥á¥ë¥Þ¥¬·Á¼°ÊÑ¹¹³ÎÇ§¥á¥Ã¥»¡¼¥¸
+function fnmerumagaupdateConfirm() {
+	if(window.confirm("´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£\n¥á¥ë¥Þ¥¬¤Î¼ïÎà¤¬ÊÑ¹¹¤µ¤ì¤Þ¤¹¡£µ¹¤·¤¤¤Ç¤¹¤«¡©")){
+		return true;
+	}
+	return false;
+}
+
+// ¥Õ¥©¡¼¥à¤ËÂåÆþ¤·¤Æ¤«¤é¥µ¥Ö¥ß¥Ã¥È¤¹¤ë¡£
+function fnInsertValAndSubmit( fm, ele, val, msg ){
+	
+	if ( msg ){
+		ret = window.confirm(msg);
+	} else {
+		ret = true;
+	}
+	if( ret ){
+		fm[ele].value = val;
+		fm.submit();
+		return false;
+	}
+	return false;
+}
+
+// ¼«Ê¬°Ê³°¤ÎÍ×ÁÇ¤òÍ­¸ú¡¦Ìµ¸ú¤Ë¤¹¤ë
+function fnSetDisabled ( f_name, e_name, flag ) {
+	fm = document[f_name];
+	
+	//¡¡É¬¿Ü¹àÌÜ¤Î¥Á¥§¥Ã¥¯
+	for(cnt = 0; cnt < fm.elements.length; cnt++) {
+		if( fm[cnt].name != e_name && fm[cnt].name != 'subm' && fm[cnt].name != 'mode') {
+			fm[cnt].disabled = flag;
+			if ( flag == true ){
+				fm[cnt].style.backgroundColor = "#cccccc";
+			} else {
+				fm[cnt].style.backgroundColor = "#ffffff";
+			}
+		}
+	}
+}
+
+
+//¥ê¥¹¥È¥Ü¥Ã¥¯¥¹Æâ¤Î¹àÌÜ¤ò°ÜÆ°¤¹¤ë
+function fnMoveCat(sel1, sel2, mode_name) {
+	var fm = document.form1;
+	for(i = 0; i < fm[sel1].length; i++) {
+		if(fm[sel1].options[i].selected) {
+			if(fm[sel2].value != "") {
+				fm[sel2].value += "-" + fm[sel1].options[i].value;
+			} else {
+				fm[sel2].value = fm[sel1].options[i].value;
+			}
+		}
+	}
+	fm["mode"].value = mode_name;
+	fm.submit();
+}
+
+//¥ê¥¹¥È¥Ü¥Ã¥¯¥¹Æâ¤Î¹àÌÜ¤òºï½ü¤¹¤ë
+function fnDelListContents(sel1, sel2, mode_name) {
+	fm = document.form1;
+	for(j = 0; j < fm[sel1].length; j++) {
+		if(fm[sel1].options[i].selected) {
+			fm[sel2].value = fm[sel2].value.replace(fm[sel1].options[i].value, "");
+		}
+	}
+	
+	fm["mode"].value = mode_name;
+	fm.submit();
+}
+
+//°ì¹ÔÌÜ¤Î²Á³Ê¤ò°Ê²¼¤Î¹Ô¤Ë¥³¥Ô¡¼¤¹¤ë
+function fnCopyValue(length, icolor) {
+	fm = document.form1;
+	for(i = 1; i <= length; i++) {
+		fm['product_code:' + i].value = fm['product_code:1'].value;
+		fm['stock:' + i].value = fm['stock:1'].value;
+		fm['price01:' + i].value = fm['price01:1'].value;
+		fm['price02:' + i].value = fm['price02:1'].value;
+		fm['stock_unlimited:' + i].checked = fm['stock_unlimited:1'].checked;
+		fm['stock:' + i].disabled = fm['stock:1'].disabled;		
+		fm['stock:' + i].style.backgroundColor = fm['stock:1'].style.backgroundColor;
+	}	
+}
+
+// ¥¿¥°¤ÎÉ½¼¨ÈóÉ½¼¨ÀÚ¤êÂØ¤¨
+function fnDispChange(disp_id, inner_id, disp_flg){
+	disp_state = document.getElementById(disp_id).style.display;
+	
+	if (disp_state == "") {
+		document.form1[disp_flg].value="none";
+		document.getElementById(disp_id).style.display="none";
+		document.getElementById(inner_id).innerHTML = "<<É½¼¨";
+	}else{
+		document.form1[disp_flg].value="";
+		document.getElementById(disp_id).style.display="";
+		document.getElementById(inner_id).innerHTML = ">>ÈóÉ½¼¨"; 
+	}
+	
+}
+
+
+
+	
Index: /temp/tags/eccube-0_9_2beta/html/js/css.js
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/js/css.js	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/js/css.js	(revision 1328)
@@ -0,0 +1,83 @@
+gCssUA = navigator.userAgent.toUpperCase();
+gCssBrw = navigator.appName.toUpperCase();
+
+with (document) {
+		write("<style type=\"text/css\"><!--");
+
+
+//WIN-IE
+	if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
+		write(".fs10 {font-size: 62.5%; line-height: 150%; letter-spacing:1px;}");
+		write(".fs12 {font-size: 75%; line-height: 150%; letter-spacing:1.5px;}");
+		write(".fs14 {font-size: 87.5%; line-height: 150%; letter-spacing:2px;}");
+		write(".fs18 {font-size: 117.5%; line-height: 130%; letter-spacing:2.5px;}");
+		write(".fs22 {font-size: 137.5%; line-height: 130%; letter-spacing:3px;}");
+		write(".fs24 {font-size: 150%; line-height: 130%; letter-spacing:3px;}");
+		write(".fs30 {font-size: 187.5%; line-height: 125%; letter-spacing:3.5px;}");
+		write(".fs10n {font-size: 62.5%; letter-spacing:1px;}");
+		write(".fs12n {font-size: 75%; letter-spacing:1.5px;}");
+		write(".fs14n {font-size: 87.5%; letter-spacing:2px;}");
+		write(".fs18n {font-size: 117.5%; letter-spacing:2.5px;}");
+		write(".fs22n {font-size: 137.5%; letter-spacing:1px;}");
+		write(".fs24n {font-size: 150%; letter-spacing:1px;}");
+		write(".fs30n {font-size: 187.5%; letter-spacing:1px;}");
+		write(".fs12st {font-size: 75%; line-height: 150%; letter-spacing:1.5px; font-weight: bold;}");
+	}
+
+//WIN-NN
+	if (gCssUA.indexOf("WIN") != -1 && gCssBrw.indexOf("NETSCAPE") != -1) {
+		write(".fs10 {font-size:72%; line-height:130%;}");
+		write(".fs12 {font-size: 75%; line-height: 150%;}");
+		write(".fs14 {font-size: 87.5%; line-height: 140%;}");
+		write(".fs18 {font-size: 117.5%; line-height: 130%;}");
+		write(".fs22 {font-size: 137.5%; line-height: 130%;}");
+		write(".fs24 {font-size: 150%; line-height: 130%;}");
+		write(".fs30 {font-size: 187.5%; line-height: 120%;}");
+		write(".fs10n {font-size:72%;}");
+		write(".fs12n {font-size: 75%;}");
+		write(".fs14n {font-size: 87.5%;}");
+		write(".fs18n {font-size: 117.5%;}");
+		write(".fs22n {font-size: 137.5%;}");
+		write(".fs24n {font-size: 150%;}");
+		write(".fs30n {font-size: 187.5%;}");
+		write(".fs12st {font-size: 75%; line-height: 150%; font-weight: bold;}");
+	}
+
+//WIN-NN4.x
+	if ( navigator.appName == "Netscape" && navigator.appVersion.substr(0,2) == "4." ) {
+		write(".fs10 {font-size:90%; line-height: 130%;}");
+		write(".fs12 {font-size: 100%; line-height: 140%;}");
+		write(".fs14 {font-size: 110%; line-height: 135%;}");
+		write(".fs18 {font-size: 130%; line-height: 175%;}");
+		write(".fs24 {font-size: 190%; line-height: 240%;}");
+		write(".fs30 {font-size: 240%; line-height: 285%;}");
+		write(".fs10n {font-size:90%;}");
+		write(".fs12n {font-size: 100%;}");
+		write(".fs14n {font-size: 110%;}");
+		write(".fs18n {font-size: 130%;}");
+		write(".fs24n {font-size: 190%;}");
+		write(".fs30n {font-size: 240%;}");
+		write(".fs12st {font-size: 100%; line-height: 140%; font-weight: bold;}");
+	}
+
+//MAC
+	if (gCssUA.indexOf("MAC") != -1) {
+		write(".fs10 {font-size: 10px; line-height: 14px;}");
+		write(".fs12 {font-size: 12px; line-height: 18px;}");
+		write(".fs14 {font-size: 14px; line-height: 18px;}");
+		write(".fs18 {font-size: 18px; line-height: 23px;}");
+		write(".fs22 {font-size: 22px; line-height: 27px;}");
+		write(".fs24 {font-size: 24px; line-height: 30px;}");
+		write(".fs30 {font-size: 30px; line-height: 35px;}");
+		write(".fs10n {font-size: 10px;}");
+		write(".fs12n {font-size: 12px;}");
+		write(".fs14n {font-size: 14px;}");
+		write(".fs18n {font-size: 18px;}");
+		write(".fs22n {font-size: 22px;}");
+		write(".fs24n {font-size: 24px;}");
+		write(".fs30n {font-size: 30px;}");
+		write(".fs12st {font-size: 12px; line-height: 18px; font-weight: bold;}");
+	}
+
+	write("--></style>");
+}
Index: /temp/tags/eccube-0_9_2beta/html/js/win_op.js
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/js/win_op.js	(revision 2739)
+++ /temp/tags/eccube-0_9_2beta/html/js/win_op.js	(revision 2739)
@@ -0,0 +1,38 @@
+<!--
+	function win01(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=no,resizable=no,toolbar=no,location=no,directories=no,status=no");
+		WIN.focus();
+	}
+// -->
+	
+<!--
+	function win02(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
+		WIN.focus();
+	}
+// -->
+
+<!--
+	function win03(URL,Winname,Wwidth,Wheight){
+		var WIN;
+		WIN = window.open(URL,Winname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no");
+		WIN.focus();
+	}
+// -->
+
+<!--
+	function ChangeParent()
+	{
+		window.opener.location.href="../contact/index.php";
+	}
+//-->
+
+
+<!--//
+function CloseChild()
+{
+	window.close();
+}
+//-->
Index: /temp/tags/eccube-0_9_2beta/html/js/flash.js
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/js/flash.js	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/html/js/flash.js	(revision 1328)
@@ -0,0 +1,99 @@
+
+// **************  ÀßÄêÉôÊ¬ *******************
+
+	// Flash¥Õ¥¡¥¤¥ë¤Ø¤ÎÁêÂÐ¥Ñ¥¹
+	var flashFilePath = "swf/index.swf";
+
+	// Flash²£Éý
+	var flashWidth = "400";
+
+	// Flash½ÄÉý
+	var flashHeight = "279";
+
+	// Flash¤ÎÉ¬Í×¥Ð¡¼¥¸¥ç¥ó
+	var reqVersion = 6;
+
+	// Flash¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤¤¤È¤­¤ËÉ½¼¨¤¹¤ë¥á¥Ã¥»¡¼¥¸
+	var noFlashMsg =
+		"<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" summary=\" \">"
+		+"<tr><td colspan=\"3\"><img src=\"./img/flash/image_flash01.jpg\" width=\"400\" height=\"174\" alt=\"\"></td></tr>"
+		+"<tr>"
+		+"<td><img src=\"./img/flash/image_flash02.jpg\" width=\"140\" height=\"22\" alt=\"\"></td>"
+		+"<td><a href=\"http://www.macromedia.com/shockwave/download/download.cgi?P5_Language=Japanese&Lang=Japanese&P1_Prod_Version=ShockwaveFlash&amp;Lang=Japanese\" target=\"_blank\"><img src=\"./img/flash/download.gif\" width=\"205\" height=\"22\" alt=\"\" border=\"0\"></a></td>"
+		+"<td><img src=\"./img/flash/image_flash03.jpg\" width=\"55\" height=\"22\" alt=\"\"></td></tr>"
+		+"</tr>"
+		+"<tr><td colspan=\"3\"><img src=\"./img/flash/image_flash04.jpg\" width=\"400\" height=\"84\" alt=\"\"></td></tr>"
+		+"</table>";
+
+
+// ************** ¥á¥¤¥ó *********************
+
+	var maxVersion = 7;
+	var actualVersion = 0;
+	var jsVersion = 1.0;
+	var noflashflag;
+	var flash2Installed = false;
+	var flash3Installed = false;
+	var flash4Installed = false;
+	var flash5Installed = false;
+	var flash6Installed = false;
+	var flash7Installed = false;
+	var rightVersion = false;
+	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
+	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
+	jsVersion = 1.1;
+
+	if(isIE && isWin){
+		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
+		document.write('on error resume next \n');
+		document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
+		document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
+		document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
+		document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
+		document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
+		document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');  
+		document.write('</SCR' + 'IPT\> \n');
+	}
+
+
+
+
+	function detectFlash() {
+		
+		if (navigator.plugins) {
+			if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
+				var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+				var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
+				var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
+				flash2Installed = flashVersion == 2;
+				flash3Installed = flashVersion == 3;
+				flash4Installed = flashVersion == 4;
+				flash5Installed = flashVersion == 5;
+				flash6Installed = flashVersion == 6;
+				flash6Installed = flashVersion >= 7;
+			}
+		}
+
+		for (var i = 2; i <= maxVersion; i++) {  
+			if (eval("flash" + i + "Installed") == true) actualVersion = i;
+		}
+
+		if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;
+
+		if (actualVersion >= reqVersion) {
+			rightVersion = true;
+			document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"" + flashWidth + "\" height=\"" + flashHeight + "\">");
+			document.write("<param name=\"movie\" value=\"" + flashFilePath + "\">");
+			document.write("<param name=\"quality\" value=\"high\">");
+			document.write("<param name=\"bgcolor\" value=\"#ffffff\">");
+			document.write("<param name=\"loop\" value=\"false\">");
+			document.write("<embed src=\"" + flashFilePath + "\" quality=\"high\" bgcolor=\"#ffffff\" loop=\"false\"  width=\"" + flashWidth + "\" height=\"" + flashHeight + "\" type=\"application/x-shockwave-flash\" pluginspage=\"http://wsww.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" Name=\"opening\"></embed>");
+			document.write("</object>");
+		} else {
+			document.write(noFlashMsg);
+		}
+	}
+
+
+
+	detectFlash();
Index: /temp/tags/eccube-0_9_2beta/html/js/navi.js
===================================================================
--- /temp/tags/eccube-0_9_2beta/html/js/navi.js	(revision 3234)
+++ /temp/tags/eccube-0_9_2beta/html/js/navi.js	(revision 3234)
@@ -0,0 +1,35 @@
+	var preLoadFlag = "false";
+
+	function preLoadImg(){
+		arrImgList = new Array (
+			"/img/header/basis_on.jpg","/img/header/product_on.jpg","/img/header/customer_on.jpg","/img/header/order_on.jpg",
+			"/img/header/sales_on.jpg","/img/header/mail_on.jpg","/img/header/contents_on.jpg",
+			"/img/header/mainpage_on.gif","/img/header/seitecheck_on.gif","/img/header/logout_on.gif",
+			"/img/contents/btn_search_on.jpg","/img/contents/btn_regist_on.jpg",
+			"/img/contents/btn_csv_on.jpg","/img/contents/arrow_left.jpg","/img/contents/arrow_right.jpg"
+		);
+		arrPreLoad = new Array();
+		for (i in arrImgList) {
+			arrPreLoad[i] = new Image();
+			arrPreLoad[i].src = arrImgList[i];
+		}
+		preLoadFlag = "true";
+	}
+
+	function chgImg(fileName,imgName){
+		if (preLoadFlag == "true") {
+			document.images[imgName].src = fileName;
+		}
+	}
+	
+	function chgImgImageSubmit(fileName,imgObj){
+	imgObj.src = fileName;
+	}
+	
+	// ¥µ¥Ö¥Ê¥Ó¤ÎÉ½¼¨ÀÚÂØ
+	function naviStyleChange(ids, bcColor, color){
+		document.getElementById(ids).style.backgroundColor = bcColor;
+	}	
+
+
+	
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_Image.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_Image.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_Image.php	(revision 1328)
@@ -0,0 +1,49 @@
+<?php
+
+//---- ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë²Ã¹©¥¯¥é¥¹(thumb.php¤È¥»¥Ã¥È¤Ç»ÈÍÑ¤¹¤ë)
+class SC_Image {
+	
+	var $tmp_dir;
+		
+	function SC_Image($tmp_dir) {
+		// ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëÆÉ¹þ
+		$include_dir = realpath(dirname( __FILE__));
+		require_once($include_dir . "/../lib/thumb.php");
+		if(!ereg("/$", $tmp_dir)) {
+			$this->tmp_dir = $tmp_dir . "/";
+		} else {
+			$this->tmp_dir = $tmp_dir;
+		}
+	}
+	
+	//--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®(¥µ¥à¥Í¥¤¥ë²èÁüÀ¸À®ÍÑ)
+	function makeTempImage($keyname, $max_width, $max_height) {
+		// °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
+		$mainname = uniqid("").".";
+		// ³ÈÄ¥»Ò°Ê³°¤òÃÖ¤­´¹¤¨¤ë¡£
+		$newFileName = ereg_replace("^.*\.",$mainname, $_FILES[$keyname]['name']);
+		$result  = MakeThumb($_FILES[$keyname]['tmp_name'], $this->tmp_dir , $max_width, $max_height, $newFileName);
+		gfDebugLog($result);
+		return $newFileName;
+	}
+
+	//--- ¥Õ¥¡¥¤¥ë¤ò»ØÄêÊÝÂ¸DIR¤Ø°ÜÆ°
+	function moveTempImage($filename, $save_dir) {
+		// ¥³¥Ô¡¼¸µ¥Õ¥¡¥¤¥ë¡¢¥³¥Ô¡¼Àè¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ë¤Î¤ß¼Â¹Ô¤¹¤ë
+		if(file_exists($this->tmp_dir.$filename) && file_exists($save_dir)) {
+			if(copy($this->tmp_dir . $filename , $save_dir."/".$filename)) {
+				unlink( $this->tmp_dir . $filename );
+			}
+		} else {
+			gfDebugLog($this->tmp_dir.$filename."¤Î°ÜÆ°¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+		}
+	}
+
+	//---- »ØÄê¥Õ¥¡¥¤¥ë¤òºï½ü	
+	function deleteImage($filename, $dir) {
+		if(file_exists($dir."/".$filename)) {
+			unlink($dir."/".$filename);
+		}
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_Session.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_Session.php	(revision 1817)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_Session.php	(revision 1817)
@@ -0,0 +1,87 @@
+<?php
+/* ¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_Session {
+	var $login_id;		// ¥í¥°¥¤¥ó¥æ¡¼¥¶Ì¾
+	var $authority;		// ¥æ¡¼¥¶¸¢¸Â
+	var $cert;			// Ç§¾ÚÊ¸»úÎó(Ç§¾ÚÀ®¸ù¤ÎÈ½Äê¤Ë»ÈÍÑ)
+	var $sid;			// ¥»¥Ã¥·¥ç¥óID
+	var $member_id;		// ¥í¥°¥¤¥ó¥æ¡¼¥¶¤Î¼ç¥­¡¼
+
+	/* ¥³¥ó¥¹¥È¥é¥¯¥¿ */
+	function SC_Session() {
+		// ¥»¥Ã¥·¥ç¥ó³«»Ï
+		sfDomainSessionStart();
+
+		// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊÝÂ¸
+		if(isset($_SESSION['cert'])) {
+			$this->sid = session_id();
+			$this->cert = $_SESSION['cert'];
+			$this->login_id = $_SESSION['login_id'];
+			$this->authority = $_SESSION['authority'];	// ´ÉÍý¼Ô:0, °ìÈÌ:1, ±ÜÍ÷:2
+			$this->member_id = $_SESSION['member_id'];
+			// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+			gfPrintLog("access : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid);
+		} else {
+			// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+			gfPrintLog("access error.");
+		}
+	}
+	/* Ç§¾ÚÀ®¸ù¤ÎÈ½Äê */
+	function IsSuccess() {
+		global $arrPERMISSION;
+		if($this->cert == CERT_STRING) {
+			if(isset($arrPERMISSION[$_SERVER['PHP_SELF']])) {
+				// ¿ôÃÍ¤¬¼«Ê¬¤Î¸¢¸Â°Ê¾å¤Î¤â¤Î¤Ç¤Ê¤¤¤È¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤¡£
+				if($arrPERMISSION[$_SERVER['PHP_SELF']] < $this->authority) {			
+					return AUTH_ERROR;
+				} 
+			}
+			return SUCCESS;
+		}
+		
+		return ACCESS_ERROR;
+	}
+	
+	/* ¥»¥Ã¥·¥ç¥ó¤Î½ñ¤­¹þ¤ß */
+	function SetSession($key, $val) {
+		$_SESSION[$key] = $val;
+	}
+	
+	/* ¥»¥Ã¥·¥ç¥ó¤ÎÆÉ¤ß¹þ¤ß */
+	function GetSession($key) {
+		return $_SESSION[$key];
+	}
+	
+	/* ¥»¥Ã¥·¥ç¥óID¤Î¼èÆÀ */
+	function GetSID() {
+		return $this->sid;
+	}
+	
+	/* ¥»¥Ã¥·¥ç¥ó¤ÎÇË´þ */
+	function EndSession() {
+		// ¥Ç¥Õ¥©¥ë¥È¤Ï¡¢¡ÖPHPSESSID¡×
+		$sname = session_name();
+		// ¥»¥Ã¥·¥ç¥óÊÑ¿ô¤òÁ´¤Æ²ò½ü¤¹¤ë
+		$_SESSION = array();
+		// ¥»¥Ã¥·¥ç¥ó¤òÀÚÃÇ¤¹¤ë¤Ë¤Ï¥»¥Ã¥·¥ç¥ó¥¯¥Ã¥­¡¼¤âºï½ü¤¹¤ë¡£
+		// Note: ¥»¥Ã¥·¥ç¥ó¾ðÊó¤À¤±¤Ç¤Ê¤¯¥»¥Ã¥·¥ç¥ó¤òÇË²õ¤¹¤ë¡£
+		if (isset($_COOKIE[$sname])) {
+			setcookie($sname, '', time()-42000, '/');
+		}
+		// ºÇ½ªÅª¤Ë¡¢¥»¥Ã¥·¥ç¥ó¤òÇË²õ¤¹¤ë
+		session_destroy();
+		// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+		gfPrintLog("logout : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid);
+	}
+	
+	// ´ØÏ¢¥»¥Ã¥·¥ç¥ó¤Î¤ßÇË´þ¤¹¤ë¡£
+	function logout() {
+		unset($_SESSION['cert']);
+		unset($_SESSION['login_id']);
+		unset($_SESSION['authority']);
+		unset($_SESSION['member_id']);
+		// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+		gfPrintLog("logout : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid);
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_UploadFile.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_UploadFile.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_UploadFile.php	(revision 1328)
@@ -0,0 +1,274 @@
+<?php
+
+$SC_UPLOADFILE_DIR = realpath(dirname( __FILE__));
+require_once($SC_UPLOADFILE_DIR . "/../lib/gdthumb.php");	
+
+/* ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹ */
+class SC_UploadFile {
+	var $temp_dir;
+	var $save_dir;
+	var $keyname;	// ¥Õ¥¡¥¤¥ëinput¥¿¥°¤Îname
+	var $width;		// ²£¥µ¥¤¥º
+	var $height;	// ½Ä¥µ¥¤¥º
+	var $arrExt;	// »ØÄê¤¹¤ë³ÈÄ¥»Ò
+	var $temp_file;	// ÊÝÂ¸¤µ¤ì¤¿¥Õ¥¡¥¤¥ëÌ¾
+	var $save_file; // DB¤«¤éÆÉ¤ß½Ð¤·¤¿¥Õ¥¡¥¤¥ëÌ¾
+	var $disp_name;	// ¹àÌÜÌ¾
+	var $size;		// À©¸Â¥µ¥¤¥º
+	var $necessary; // É¬¿Ü¤Î¾ì¹ç:true
+	var $image;		// ²èÁü¤Î¾ì¹ç:true
+	
+	// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+	function SC_UploadFile($temp_dir, $save_dir) {
+		$this->temp_dir = $temp_dir;
+		$this->save_dir = $save_dir;
+		$this->file_max = 0;
+	}
+
+	// ¥Õ¥¡¥¤¥ë¾ðÊóÄÉ²Ã
+	function addFile($disp_name, $keyname, $arrExt, $size, $necessary=false, $width=0, $height=0, $image=true) {
+		$this->disp_name[] = $disp_name;
+		$this->keyname[] = $keyname;
+		$this->width[] = $width;
+		$this->height[] = $height;
+		$this->arrExt[] = $arrExt;
+		$this->size[] = $size;
+		$this->necessary[] = $necessary;
+		$this->image[] = $image;
+	}
+	// ¥µ¥à¥Í¥¤¥ë²èÁü¤ÎºîÀ®
+	function makeThumb($src_file, $width, $height) {
+		// °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
+		$uniqname = date("mdHi") . "_" . uniqid("");
+		
+		$dst_file = $this->temp_dir . $uniqname;
+		
+		$objThumb = new gdthumb();
+		$ret = $objThumb->Main($src_file, $width, $height, $dst_file);
+		
+		if($ret[0] != 1) {
+			// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ÎÉ½¼¨
+			print($ret[1]);
+			exit;
+		}
+		
+		return basename($ret[1]);
+	}
+		
+	// ¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤òÊÝÂ¸¤¹¤ë¡£
+	function makeTempFile($keyname) {
+		$objErr = new SC_CheckError();
+		$cnt = 0;
+		if(!($_FILES[$keyname]['size'] > 0)) {
+			$objErr->arrErr[$keyname] = "¢¨ " . $this->disp_name[$cnt] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		} else {
+			foreach($this->keyname as $val) {
+				// °ìÃ×¤·¤¿¥­¡¼¤Î¥Õ¥¡¥¤¥ë¤Ë¾ðÊó¤òÊÝÂ¸¤¹¤ë¡£
+				if ($val == $keyname) {
+					// ³ÈÄ¥»Ò¥Á¥§¥Ã¥¯
+					$objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->arrExt[$cnt]), array("FILE_EXT_CHECK"));
+					// ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¥Á¥§¥Ã¥¯
+					$objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array("FILE_SIZE_CHECK"));
+					// ¥¨¥é¡¼¤¬¤Ê¤¤¾ì¹ç
+					if(!isset($objErr->arrErr[$keyname])) {
+						// ²èÁü¥Õ¥¡¥¤¥ë¤Î¾ì¹ç
+						if($this->image[$cnt]) {
+							$this->temp_file[$cnt] = $this->makeThumb($_FILES[$keyname]['tmp_name'], $this->width[$cnt], $this->height[$cnt]);
+						// ²èÁü¥Õ¥¡¥¤¥ë°Ê³°¤Î¾ì¹ç
+						} else {
+							// °ì°Õ¤Ê¥Õ¥¡¥¤¥ëÌ¾¤òºîÀ®¤¹¤ë¡£
+							$uniqname = date("mdHi") . "_" . uniqid("").".";
+							$this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']);
+							$result  = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir. "/". $this->temp_file[$cnt]);
+							gfPrintLog($_FILES[$keyname]['name']." -> ".$this->temp_dir. "/". $this->temp_file[$cnt]);
+						}
+					}
+				}
+				$cnt++;
+			}
+		}
+		return $objErr->arrErr[$keyname];
+	}
+		
+	// ²èÁü¤òºï½ü¤¹¤ë¡£
+	function deleteFile($keyname) {
+		$objImage = new SC_Image($this->temp_dir);
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if ($val == $keyname) {
+				// °ì»þ¥Õ¥¡¥¤¥ë¤Î¾ì¹çºï½ü¤¹¤ë¡£
+				if($this->temp_file[$cnt] != "") {
+					$objImage->deleteImage($this->temp_file[$cnt], $this->save_dir);
+				}
+				$this->temp_file[$cnt] = "";
+				$this->save_file[$cnt] = "";
+			}
+			$cnt++;
+		}
+	}
+	
+	// °ì»þ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤ò¼èÆÀ¤¹¤ë¡£
+	function getTempFilePath($keyname) {
+		$cnt = 0;
+		$filepath = "";
+		foreach($this->keyname as $val) {
+			if ($val == $keyname) {
+				if($this->temp_file[$cnt] != "") {
+					$filepath = $this->temp_dir . "/" . $this->temp_file[$cnt];
+				}
+			}
+			$cnt++;
+		}
+		return $filepath;
+	}
+	
+	// °ì»þ¥Õ¥¡¥¤¥ë¤òÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê¤Ë°Ü¤¹
+	function moveTempFile() {
+		$cnt = 0;
+		$objImage = new SC_Image($this->temp_dir);
+		
+		foreach($this->keyname as $val) {
+			if($this->temp_file[$cnt] != "") {
+													
+				$objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir);
+				// ¤¹¤Ç¤ËÊÝÂ¸¥Õ¥¡¥¤¥ë¤¬¤¢¤Ã¤¿¾ì¹ç¤Ïºï½ü¤¹¤ë¡£
+				if($this->save_file[$cnt] != "" && !ereg("^sub/", $this->save_file[$cnt])) {
+					$objImage->deleteImage($this->save_file[$cnt], $this->save_dir);
+				}
+			}
+			$cnt++;
+		}
+	}
+	
+	// HIDDENÍÑ¤Î¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤òÊÖ¤¹
+	function getHiddenFileList() {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($this->temp_file[$cnt] != "") {
+				$arrRet["temp_" . $val] = $this->temp_file[$cnt];
+			}
+			if($this->save_file[$cnt] != "") {
+				$arrRet["save_" . $val] = $this->save_file[$cnt];
+			}
+			$cnt++; 
+		}
+		return $arrRet;
+	}
+	
+	// HIDDEN¤ÇÁ÷¤é¤ì¤Æ¤­¤¿¥Õ¥¡¥¤¥ëÌ¾¤ò¼èÆÀ¤¹¤ë
+	function setHiddenFileList($arrPOST) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			$key = "temp_" . $val;
+			if($arrPOST[$key] != "") {
+				$this->temp_file[$cnt] = $arrPOST[$key];
+			}
+			$key = "save_" . $val;
+			if($arrPOST[$key] != "") {
+				$this->save_file[$cnt] = $arrPOST[$key];
+			}
+			$cnt++;
+		}
+	}
+	
+	// ¥Õ¥©¡¼¥à¤ËÅÏ¤¹ÍÑ¤Î¥Õ¥¡¥¤¥ë¾ðÊóÇÛÎó¤òÊÖ¤¹
+	function getFormFileList($temp_url, $save_url) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($this->temp_file[$cnt] != "") {
+				// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¥Á¥§¥Ã¥¯(¥Ñ¥¹¤Î¥¹¥é¥Ã¥·¥å/¤¬Ï¢Â³¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£)
+				if(ereg("/$", $temp_url)) {
+					$arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt];
+				} else {
+					$arrRet[$val]['filepath'] = $temp_url . "/" . $this->temp_file[$cnt];
+				}
+			} elseif ($this->save_file[$cnt] != "") {
+				// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¥Á¥§¥Ã¥¯(¥Ñ¥¹¤Î¥¹¥é¥Ã¥·¥å/¤¬Ï¢Â³¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£)
+				if(ereg("/$", $save_url)) {
+					$arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt];
+				} else {
+					$arrRet[$val]['filepath'] = $save_url . "/" . $this->save_file[$cnt];
+				}
+			}
+			if($arrRet[$val]['filepath'] != "") {
+				// ¥Õ¥¡¥¤¥ë²£Éý
+				$arrRet[$val]['width'] = $this->width[$cnt];
+				// ¥Õ¥¡¥¤¥ë½ÄÉý
+				$arrRet[$val]['height'] = $this->height[$cnt];
+				// É½¼¨Ì¾
+				$arrRet[$val]['disp_name'] = $this->disp_name[$cnt];
+			}
+			$cnt++;
+		}
+		return $arrRet;
+	}
+	
+	// DBÊÝÂ¸ÍÑ¤Î¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤òÊÖ¤¹
+	function getDBFileList() {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($this->temp_file[$cnt] != "") {
+				$arrRet[$val] = $this->temp_file[$cnt];
+			} else  {
+				$arrRet[$val] = $this->save_file[$cnt];
+			}
+			$cnt++;
+		}
+		return $arrRet;
+	}
+	
+	// DB¤ÇÊÝÂ¸¤µ¤ì¤¿¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë
+	function setDBFileList($arrVal) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($arrVal[$val] != "") {
+				$this->save_file[$cnt] = $arrVal[$val];
+			}
+			$cnt++; 
+		}
+	}
+	
+	// ²èÁü¤ò¥»¥Ã¥È¤¹¤ë
+	function setDBImageList($arrVal) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($arrVal[$val] != "" && $val == 'tv_products_image') {
+				$this->save_file[$cnt] = $arrVal[$val];
+			}
+			$cnt++; 
+		}
+	}
+	
+	// DB¾å¤Î¥Õ¥¡¥¤¥ë¤ÎÆâºï½üÍ×µá¤¬¤¢¤Ã¤¿¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë¡£ 
+	function deleteDBFile($arrVal) {
+		$objImage = new SC_Image($this->temp_dir);
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($arrVal[$val] != "") {
+				if($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal[$val])) {
+					$objImage->deleteImage($arrVal[$val], $this->save_dir);
+				}
+			}
+			$cnt++; 
+		}
+	}
+	
+	// É¬¿ÜÈ½Äê
+	function checkEXISTS($keyname = "") {
+		$cnt = 0;
+		$arrRet = array();
+		foreach($this->keyname as $val) {
+			if($val == $keyname || $keyname == "") {
+				// É¬¿Ü¤Ç¤¢¤ì¤Ð¥¨¥é¡¼¥Á¥§¥Ã¥¯
+				if ($this->necessary[$cnt] == true) {
+					if($this->save_file[$cnt] == "" && $this->temp_file[$cnt] == "") {
+						$arrRet[$val] = "¢¨ " . $this->disp_name[$cnt] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br>";
+					}
+				}
+			}
+			$cnt++;
+		}
+		return $arrRet;
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_FormParam.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_FormParam.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_FormParam.php	(revision 1328)
@@ -0,0 +1,343 @@
+<?php
+
+/* ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹ */
+class SC_FormParam {
+
+	var $param;	
+	var $disp_name;
+	var $keyname;
+	var $length;
+	var $convert;
+	var $arrCheck;
+	var $default;	// ²¿¤âÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¤È¤­¤ËÉ½¼¨¤¹¤ëÃÍ
+	var $input_db;	// DB¤Ë¤½¤Î¤Þ¤ÞÁÞÆþ²ÄÇ½¤«ÈÝ¤«
+	var $html_disp_name;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_FormParam() {
+		$this->check_dir = IMAGE_SAVE_DIR;
+	}
+	
+	// ¥Ñ¥é¥á¡¼¥¿¤ÎÄÉ²Ã
+	function addParam($disp_name, $keyname, $length="", $convert="", $arrCheck=array(), $default="", $input_db="true") {
+		$this->disp_name[] = $disp_name;
+		$this->keyname[] = $keyname;
+		$this->length[] = $length;
+		$this->convert[] = $convert;
+		$this->arrCheck[] = $arrCheck;
+		$this->default[] = $default;
+		$this->input_db[] = $input_db;
+	}
+	
+	// ¥Ñ¥é¥á¡¼¥¿¤ÎÆþÎÏ
+	// $arrVal	:$arrVal['keyname']¡¦¡¦¤ÎÇÛÎó¤ò°ìÃ×¤·¤¿¥­¡¼¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ë³ÊÇ¼¤¹¤ë
+	// $seq		:true¤Î¾ì¹ç¡¢$arrVal[0]¢·¤ÎÇÛÎó¤òÅÐÏ¿½ç¤Ë¥¤¥ó¥¹¥¿¥ó¥¹¤Ë³ÊÇ¼¤¹¤ë
+	function setParam($arrVal, $seq = false) {
+		$cnt = 0;
+		if(!$seq){
+			foreach($this->keyname as $val) {
+				if(isset($arrVal[$val])) {
+					$this->setValue($val, $arrVal[$val]);
+				}
+			}		
+		} else {
+			foreach($this->keyname as $val) {
+				$this->param[$cnt] = $arrVal[$cnt];
+				$cnt++;
+			}
+		}
+	}
+	
+	// ²èÌÌÉ½¼¨ÍÑ¥¿¥¤¥È¥ëÀ¸À®
+	function setHtmlDispNameArray() {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			$find = false;
+			foreach($this->arrCheck[$cnt] as $val) {
+				if($val == "EXIST_CHECK") {
+					$find = true;
+				}
+			}
+			
+			if($find) {
+				$this->html_disp_name[$cnt] = $this->disp_name[$cnt] . "<span class='red'>(¢¨ É¬¿Ü)</span>";					
+			} else {
+				$this->html_disp_name[$cnt] = $this->disp_name[$cnt];
+			}								
+			$cnt++;
+		}
+	}
+	
+	// ²èÌÌÉ½¼¨ÍÑ¥¿¥¤¥È¥ë¼èÆÀ
+	function getHtmlDispNameArray() {
+		return $this->html_disp_name;
+	}
+		
+	// Ê£¿ôÎó¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ
+	function setParamList($arrVal, $keyname) {
+		// DB¤Î·ï¿ô¤ò¼èÆÀ¤¹¤ë¡£
+		$count = count($arrVal);
+		$no = 1;
+		for($cnt = 0; $cnt < $count; $cnt++) {
+			$key = $keyname.$no;
+			if($arrVal[$cnt][$keyname] != "") {
+				$this->setValue($key, $arrVal[$cnt][$keyname]);
+			}
+			$no++;
+		}
+	}
+	
+	function setDBDate($db_date, $year_key = 'year', $month_key = 'month', $day_key = 'day') {
+		list($y, $m, $d) = split("[- ]", $db_date);
+		$this->setValue($year_key, $y);
+		$this->setValue($month_key, $m);
+		$this->setValue($day_key, $d);
+	}
+	
+	// ¥­¡¼¤ËÂÐ±þ¤·¤¿ÃÍ¤ò¥»¥Ã¥È¤¹¤ë¡£
+	function setValue($key, $param) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $key) {
+				$this->param[$cnt] = $param;
+				break;
+			}
+			$cnt++;
+		}
+	}
+	
+	function toLower($key) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $key) {
+				$this->param[$cnt] = strtolower($this->param[$cnt]);
+				break;
+			}
+			$cnt++;
+		}
+	}
+	
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	function checkError($br = true, $keyname = "") {
+		// Ï¢ÁÛÇÛÎó¤Î¼èÆÀ
+		$arrRet = $this->getHashArray($keyname);
+		$objErr = new SC_CheckError($arrRet);
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			foreach($this->arrCheck[$cnt] as $func) {
+				switch($func) {
+				case 'EXIST_CHECK':
+				case 'NUM_CHECK':
+				case 'EMAIL_CHECK':
+				case 'EMAIL_CHAR_CHECK':
+				case 'ALNUM_CHECK':
+				case 'KANA_CHECK':
+				case 'URL_CHECK':
+				case 'SPTAB_CHECK':
+				case 'ZERO_CHECK':
+				case 'ALPHA_CHECK':
+				case 'ZERO_START':
+				case 'FIND_FILE':
+				case 'NO_SPTAB':
+				case 'DIR_CHECK':
+				case 'DOMAIN_CHECK':
+				
+					if(!is_array($this->param[$cnt])) {
+						$objErr->doFunc(array($this->disp_name[$cnt], $val), array($func));
+					} else {
+						$max = count($this->param[$cnt]);
+						for($i = 0; $i < $max; $i++) {
+							$objSubErr = new SC_CheckError($this->param[$cnt]);
+							$objSubErr->doFunc(array($this->disp_name[$cnt], $i), array($func));
+							if(count($objSubErr->arrErr) > 0) {
+								foreach($objSubErr->arrErr as $mess) {
+									if($mess != "") {
+										$objErr->arrErr[$val] = $mess;
+									}
+								}
+							}
+						}
+					}
+					break;
+				case 'MAX_LENGTH_CHECK':
+				case 'NUM_COUNT_CHECK':
+					if(!is_array($this->param[$cnt])) {
+						$objErr->doFunc(array($this->disp_name[$cnt], $val, $this->length[$cnt]), array($func));
+					} else {
+						$max = count($this->param[$cnt]);
+						for($i = 0; $i < $max; $i++) {
+							$objSubErr = new SC_CheckError($this->param[$cnt]);
+							$objSubErr->doFunc(array($this->disp_name[$cnt], $i, $this->length[$cnt]), array($func));
+							if(count($objSubErr->arrErr) > 0) {
+								foreach($objSubErr->arrErr as $mess) {
+									if($mess != "") {
+										$objErr->arrErr[$val] = $mess;
+									}
+								}
+							}
+						}
+					}
+					break;
+				// ¾®Ê¸»ú¤ËÊÑ´¹
+				case 'CHANGE_LOWER':
+					$this->param[$cnt] = strtolower($this->param[$cnt]);
+					break;
+				// ¥Õ¥¡¥¤¥ë¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+				case 'FILE_EXISTS':
+					if($this->param[$cnt] != "" && !file_exists($this->check_dir . $this->param[$cnt])) {
+						$objErr->arrErr[$val] = "¢¨ " . $this->disp_name[$cnt] . "¤Î¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤»¤ó¡£<br>";					
+					}
+					break;
+				default:
+					$objErr->arrErr[$val] = "¢¨¢¨¡¡¥¨¥é¡¼¥Á¥§¥Ã¥¯·Á¼°($func)¤Ë¤ÏÂÐ±þ¤·¤Æ¤¤¤Þ¤»¤ó¡¡¢¨¢¨ <br>";
+					break;
+				}
+			}
+			
+			if (isset($objErr->arrErr[$val]) && !$br) {
+				$objErr->arrErr[$val] = ereg_replace("<br>$", "", $objErr->arrErr[$val]);
+			}
+			$cnt++;
+		}
+		return $objErr->arrErr;
+	}
+	
+	// ÆþÎÏÊ¸»ú¤ÎÊÑ´¹
+	function convParam() {
+		/*
+		 *	Ê¸»úÎó¤ÎÊÑ´¹
+		 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+		 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+		 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+		 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+		 *  a :  ¡ÖÁ´³Ñ¡×±Ñ»ú¤ò¡ÖÈ¾³Ñ¡×±Ñ»ú¤ËÊÑ´¹
+		 */
+		$cnt = 0;
+		foreach ($this->keyname as $val) {
+			if(!is_array($this->param[$cnt])) {
+				if($this->convert[$cnt] != "") {
+					$this->param[$cnt] = mb_convert_kana($this->param[$cnt] ,$this->convert[$cnt]);
+				}
+			} else {
+				$max = count($this->param[$cnt]);
+				for($i = 0; $i < $max; $i++) {
+					if($this->convert[$cnt] != "") {
+						$this->param[$cnt][$i] = mb_convert_kana($this->param[$cnt][$i] ,$this->convert[$cnt]);
+					}
+				}
+			}
+			$cnt++;
+		}
+	}
+	
+	// Ï¢ÁÛÇÛÎó¤ÎºîÀ®
+	function getHashArray($keyname = "") {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($keyname == "" || $keyname == $val) {
+				$arrRet[$val] = $this->param[$cnt];
+				$cnt++;
+			}
+		}
+		return $arrRet;
+	}
+	
+	// DB³ÊÇ¼ÍÑÇÛÎó¤ÎºîÀ®
+	function getDbArray() {
+		$cnt = 0;
+		foreach ($this->keyname as $val) {
+			if ($this->input_db[$cnt]) {
+				$arrRet[$val] = $this->param[$cnt];
+			}
+			$cnt++;
+		}
+		return $arrRet;
+	}
+	
+	// ÇÛÎó¤Î½Ä²£¤òÆþ¤ìÂØ¤¨¤ÆÊÖ¤¹
+	function getSwapArray($arrKey) {
+		foreach($arrKey as $keyname) {
+			$arrVal = $this->getValue($keyname);
+			$max = count($arrVal);
+			for($i = 0; $i < $max; $i++) {
+				$arrRet[$i][$keyname] = $arrVal[$i];
+			}
+		}
+		return $arrRet;
+	}
+	
+	// ¹àÌÜÌ¾°ìÍ÷¤Î¼èÆÀ
+	function getTitleArray() {
+		return $this->disp_name;
+	}
+	
+	// ¹àÌÜ¿ô¤òÊÖ¤¹
+	function getCount() {
+		$count = count($this->keyname);
+		return $count;
+	}
+	
+	// ¥Õ¥©¡¼¥à¤ËÅÏ¤¹ÍÑ¤Î¥Ñ¥é¥á¡¼¥¿¤òÊÖ¤¹
+	function getFormParamList() {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			// ¥­¡¼Ì¾
+			$arrRet[$val]['keyname'] = $this->keyname[$cnt];
+			// Ê¸»ú¿ôÀ©¸Â
+			$arrRet[$val]['length'] = $this->length[$cnt];
+			// ÆþÎÏÃÍ
+			$arrRet[$val]['value'] = $this->param[$cnt];
+			
+			if($this->default[$cnt] != "" && $this->param[$cnt] == "") {
+				$arrRet[$val]['value'] = $this->default[$cnt];
+			}
+					
+			$cnt++;
+		}
+		return $arrRet;
+	}
+	
+	// ¥­¡¼Ì¾¤Î°ìÍ÷¤òÊÖ¤¹
+	function getKeyList() {
+		foreach($this->keyname as $val) {
+			$arrRet[] = $val;
+		}
+		return $arrRet;
+	}
+	
+	// ¥­¡¼Ì¾¤È°ìÃ×¤·¤¿ÃÍ¤òÊÖ¤¹
+	function getValue($keyname) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $keyname) {
+				$ret = $this->param[$cnt];
+				break;
+			}
+			$cnt++;
+		}
+		return $ret;
+	}
+	
+	function splitCheckBoxes($keyname) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $keyname) {
+				$this->param[$cnt] = sfSplitCheckBoxes($this->param[$cnt]);
+			}
+			$cnt++;
+		}
+	}
+	
+	function splitParamCheckBoxes($keyname) {
+		$cnt = 0;
+		foreach($this->keyname as $val) {
+			if($val == $keyname) {
+				if(!is_array($this->param[$cnt])) {
+					$this->param[$cnt] = split("-", $this->param[$cnt]);
+				}
+			}
+			$cnt++;
+		}
+	}	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_CheckError.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_CheckError.php	(revision 3696)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_CheckError.php	(revision 3696)
@@ -0,0 +1,697 @@
+<?php
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] SC_CheckError
+ * [³µÍ×] ¥¨¥é¡¼¥Á¥§¥Ã¥¯¥¯¥é¥¹
+ *----------------------------------------------------------------------
+ */
+class SC_CheckError {
+	var $arrErr;
+	var $arrParam;
+	
+	// ¥Á¥§¥Ã¥¯ÂÐ¾Ý¤ÎÃÍ¤¬´Þ¤Þ¤ì¤ëÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë¡£
+	function SC_CheckError($array = "") {
+		if($array != "") {
+			$this->arrParam = $array;
+		} else {
+			$this->arrParam = $_POST;
+		}
+
+	}
+	
+	function doFunc($value, $arrFunc) {
+		foreach ( $arrFunc as $key ) {
+			$this->$key($value);
+		}
+	}
+	
+	/* HTML¤Î¥¿¥°¤ò¥Á¥§¥Ã¥¯¤¹¤ë */
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý value[2] = µö²Ä¤¹¤ë¥¿¥°¤¬³ÊÇ¼¤µ¤ì¤¿ÇÛÎó
+	function HTML_TAG_CHECK($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		
+		// ´Þ¤Þ¤ì¤Æ¤¤¤ë¥¿¥°¤òÃê½Ð¤¹¤ë
+		preg_match_all("/<([\/]?[a-z]+)/", $this->arrParam[$value[1]], $arrTag);
+
+		foreach($arrTag[1] as $val) {
+			$find = false;
+			
+			foreach($value[2] as $tag) {
+				if(eregi("^" . $tag . "$", $val)) {
+					$find = true;
+				} else {
+				}
+			}
+			
+			if(!$find) {
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ëµö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤¥¿¥°[" . strtoupper($val) . "]¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£<br />";
+				return;
+			}		
+		}		
+	}
+
+	/*¡¡É¬¿ÜÆþÎÏ¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý
+	function EXIST_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) == 0 ){					
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý
+	function SPTAB_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) != 0 && ereg("^[ ¡¡\t\r\n]+$", $this->arrParam[$value[1]])){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ë¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¡¢²þ¹Ô¤Î¤ß¤ÎÆþÎÏ¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý
+	function NO_SPTAB( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) != 0 && mb_ereg("[¡¡ \t\r\n]+", $this->arrParam[$value[1]])){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ë¥¹¥Ú¡¼¥¹¡¢¥¿¥Ö¡¢²þ¹Ô¤Ï´Þ¤á¤Ê¤¤¤Ç²¼¤µ¤¤¡£<br />";
+		}
+	}
+	
+	/* ¥¼¥í¤Ç³«»Ï¤µ¤ì¤Æ¤¤¤ë¿ôÃÍ¤ÎÈ½Äê */
+	function ZERO_START($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) != 0 && ereg("^[0]+[0-9]+$", $this->arrParam[$value[1]])){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ë0¤Ç»Ï¤Þ¤ë¿ôÃÍ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£<br />";
+		}
+	}
+	
+	/*¡¡É¬¿ÜÁªÂò¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý 
+	function SELECT_CHECK( $value ) {			// ¥×¥ë¥À¥¦¥ó¤Ê¤É¤ÇÁªÂò¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) == 0 ){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+
+	/*¡¡Æ±°ìÀ­¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾1 value[1] = ¹àÌÜÌ¾2 value[2] = È½ÄêÂÐ¾ÝÊ¸»úÎó1  value[3] = È½ÄêÂÐ¾ÝÊ¸»úÎó2
+	function EQUAL_CHECK( $value ) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if( $this->arrParam[$value[2]] != $this->arrParam[$value[3]]) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤È" . $value[1] . "¤¬°ìÃ×¤·¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡ÃÍ¤¬°Û¤Ê¤ë¤³¤È¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾1 value[1] = ¹àÌÜÌ¾2 value[2] = È½ÄêÂÐ¾ÝÊ¸»úÎó1  value[3] = È½ÄêÂÐ¾ÝÊ¸»úÎó2
+	function DIFFERENT_CHECK( $value ) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if( $this->arrParam[$value[2]] == $this->arrParam[$value[3]]) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤È" . $value[1] . "¤Ï¡¢Æ±¤¸ÃÍ¤ò»ÈÍÑ¤Ç¤­¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡ÃÍ¤ÎÂç¤­¤µ¤òÈæ³Ó¤¹¤ë value[2] < value[3]¤Ç¤Ê¤±¤ì¤Ð¥¨¥é¡¼¡¡*/
+	// value[0] = ¹àÌÜÌ¾1 value[1] = ¹àÌÜÌ¾2 value[2] = È½ÄêÂÐ¾ÝÊ¸»úÎó1  value[3] = È½ÄêÂÐ¾ÝÊ¸»úÎó2
+	function GREATER_CHECK($value) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[3]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if($this->arrParam[$value[2]] != "" && $this->arrParam[$value[3]] != "" && ($this->arrParam[$value[2]] > $this->arrParam[$value[3]])) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤Ï" . $value[1] . "¤è¤êÂç¤­¤¤ÃÍ¤òÆþÎÏ¤Ç¤­¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	
+	/*¡¡ºÇÂçÊ¸»ú¿ôÀ©¸Â¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó  value[2] = ºÇÂçÊ¸»ú¿ô(È¾³Ñ¤âÁ´³Ñ¤â1Ê¸»ú¤È¤·¤Æ¿ô¤¨¤ë)
+	function MAX_LENGTH_CHECK( $value ) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if( mb_strlen($this->arrParam[$value[1]]) > $value[2] ) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï" . $value[2] . "»ú°Ê²¼¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+	
+	
+
+	/*¡¡ºÇ¾®Ê¸»ú¿ôÀ©¸Â¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó value[2] = ºÇ¾®Ê¸»ú¿ô(È¾³Ñ¤âÁ´³Ñ¤â1Ê¸»ú¤È¤·¤Æ¿ô¤¨¤ë)
+	function MIN_LENGTH_CHECK( $value ) {		// ÆþÎÏ¤¬»ØÄêÊ¸»ú¿ôÌ¤Ëþ¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+		// Ê¸»ú¿ô¤Î¼èÆÀ		
+		if( mb_strlen($this->arrParam[$value[1]]) < $value[2] ) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï" . $value[2] . "»ú°Ê¾å¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+	
+	/*¡¡ºÇÂçÊ¸»ú¿ôÀ©¸Â¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó  value[2] = ºÇÂç¿ô
+	function MAX_CHECK( $value ) {		// ÆþÎÏ¤¬ºÇÂç¿ô°Ê¾å¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		// Ê¸»ú¿ô¤Î¼èÆÀ			
+		if($this->arrParam[$value[1]] > $value[2] ) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï" . $value[2] . "°Ê²¼¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+	
+		
+	/*¡¡¿ô»ú¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó 
+	function NUM_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬¿ô»ú°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) > 0 && !EregI("^[[:digit:]]+$", $this->arrParam[$value[1]])) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¿ô»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+	
+		/*¡¡¾®¿ôÅÀ¤ò´Þ¤à¿ô»ú¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó 
+	function NUM_POINT_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬¿ô»ú°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) > 0 && !EregI("^[[:digit:]]+[\.]?[[:digit:]]+$", $this->arrParam[$value[1]])) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¿ô»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+		
+	function ALPHA_CHECK($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($this->arrParam[$value[1]]) > 0 && !EregI("^[[:alpha:]]+$", $this->arrParam[$value[1]])) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤ÏÈ¾³Ñ±Ñ»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+	
+	/* ÅÅÏÃÈÖ¹æ¤ÎÈ½Äê ¡Ê¿ô»ú¥Á¥§¥Ã¥¯¤ÈÊ¸»ú¿ô¥Á¥§¥Ã¥¯¤ò¼Â»Ü¤¹¤ë¡£)
+		value[0] : ¹àÌÜÌ¾
+		value[1] : ÅÅÈÖ1¹àÌÜÌÜ
+		value[2] : ÅÅÈÖ2¹àÌÜÌÜ
+		value[3] : ÅÅÈÖ3¹àÌÜÌÜ
+		value[4] : Ê¸»ú¿ôÀ©¸Â
+	*/
+	function TEL_CHECK($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		
+		$cnt = 0;
+		
+		for($i = 1; $i <= 3; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) > 0) {
+				$cnt++;
+			}
+		}
+		
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬Ëþ¤¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤òÈ½Äê(°ìÉô¤À¤±ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¾õÂÖ)
+		if($cnt > 0 && $cnt < 3) {
+			$this->arrErr[$value[1]] .= "¢¨ " . $value[0] . "¤Ï¤¹¤Ù¤Æ¤Î¹àÌÜ¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+					
+		for($i = 1; $i <= 3; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) > 0 && strlen($this->arrParam[$value[$i]]) > $value[4]) {
+				$this->arrErr[$value[1]] .= "¢¨ " . $value[0] . $i . "¤Ï" . $value[4] . "»ú°ÊÆâ¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+			} else if (strlen($this->arrParam[$value[$i]]) > 0 && !EregI("^[[:digit:]]+$", $this->arrParam[$value[$i]])) {
+				$this->arrErr[$value[1]] .= "¢¨ " . $value[0] . $i . "¤Ï¿ô»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+			}
+		}
+	}
+	
+	/* ´ØÏ¢¹àÌÜ¤¬´°Á´¤ËËþ¤¿¤µ¤ì¤Æ¤¤¤ë¤«È½Äê 
+		value[0]		: ¹àÌÜÌ¾
+		value[1]		: È½ÄêÂÐ¾ÝÍ×ÁÇÌ¾
+	*/
+	function FULL_EXIST_CHECK($value) {
+		$max = count($value);
+			
+		// ´û¤Ë³ºÅö¹àÌÜ¤Ë¥¨¥é¡¼¤¬¤¢¤ë¾ì¹ç¤Ï¡¢È½Äê¤·¤Ê¤¤¡£
+		for($i = 1; $i < $max; $i++) {
+			if(isset($this->arrErr[$value[$i]])) {
+				return;
+			}
+		}
+		
+		$blank = false;
+		
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬¥Ö¥é¥ó¥¯¤Ç¤Ê¤¤¤«¡¢¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë¡£
+		for($i = 1; $i < $max; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) <= 0) {
+				$blank = true;
+			}
+		}
+		
+		if($blank) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+		
+	/* ´ØÏ¢¹àÌÜ¤¬¤¹¤Ù¤ÆËþ¤¿¤µ¤ì¤Æ¤¤¤ë¤«È½Äê 
+		value[0]		: ¹àÌÜÌ¾
+		value[1]		: È½ÄêÂÐ¾ÝÍ×ÁÇÌ¾
+	*/
+	function ALL_EXIST_CHECK($value) {
+		$max = count($value);
+			
+		// ´û¤Ë³ºÅö¹àÌÜ¤Ë¥¨¥é¡¼¤¬¤¢¤ë¾ì¹ç¤Ï¡¢È½Äê¤·¤Ê¤¤¡£
+		for($i = 1; $i < $max; $i++) {
+			if(isset($this->arrErr[$value[$i]])) {
+				return;
+			}
+		}
+		
+		$blank = false;
+		$input = false;
+		
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬¥Ö¥é¥ó¥¯¤Ç¤Ê¤¤¤«¡¢¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë¡£
+		for($i = 1; $i < $max; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) <= 0) {
+				$blank = true;
+			} else {
+				$input = true;
+			}
+		}
+		
+		if($blank && $input) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¤¹¤Ù¤Æ¤Î¹àÌÜ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}
+	
+		/* ´ØÏ¢¹àÌÜ¤¬¤É¤ì¤«°ì¤ÄËþ¤¿¤µ¤ì¤Æ¤¤¤ë¤«È½Äê 
+		value[0]		: ¹àÌÜÌ¾
+		value[1]		: È½ÄêÂÐ¾ÝÍ×ÁÇÌ¾
+	*/
+	function ONE_EXIST_CHECK($value) {
+		$max = count($value);
+			
+		// ´û¤Ë³ºÅö¹àÌÜ¤Ë¥¨¥é¡¼¤¬¤¢¤ë¾ì¹ç¤Ï¡¢È½Äê¤·¤Ê¤¤¡£
+		for($i = 1; $i < $max; $i++) {
+			if(isset($this->arrErr[$value[$i]])) {
+				return;
+			}
+		}
+		
+		$input = false;
+		
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬¥Ö¥é¥ó¥¯¤Ç¤Ê¤¤¤«¡¢¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë¡£
+		for($i = 1; $i < $max; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) > 0) {
+				$input = true;
+			}
+		}
+		
+		if(!$input) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/* ¾å°Ì¤Î¹àÌÜ¤¬Ëþ¤¿¤µ¤ì¤Æ¤¤¤ë¤«È½Äê
+		value[0]		: ¹àÌÜÌ¾
+		value[1]		: È½ÄêÂÐ¾ÝÍ×ÁÇÌ¾
+	*/
+	function TOP_EXIST_CHECK($value) {
+		$max = count($value);
+			
+		// ´û¤Ë³ºÅö¹àÌÜ¤Ë¥¨¥é¡¼¤¬¤¢¤ë¾ì¹ç¤Ï¡¢È½Äê¤·¤Ê¤¤¡£
+		for($i = 1; $i < $max; $i++) {
+			if(isset($this->arrErr[$value[$i]])) {
+				return;
+			}
+		}
+		
+		$blank = false;
+		$error = false;
+				
+		// ¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬¥Ö¥é¥ó¥¯¤Ç¤Ê¤¤¤«¡¢¤¹¤Ù¤Æ¤Î¹àÌÜ¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¨¥é¡¼¤È¤¹¤ë¡£
+		for($i = 1; $i < $max; $i++) {
+			if(strlen($this->arrParam[$value[$i]]) <= 0) {
+				$blank = true;
+			} else {
+				if($blank) {
+					$error = true;
+				}
+			}
+		}
+		
+		if($error) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤ÏÀèÆ¬¤Î¹àÌÜ¤«¤é½çÈÖ¤ËÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}
+	
+	
+	/*¡¡¥«¥¿¥«¥Ê¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó 
+	function KANA_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬¥«¥Ê°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && ! ereg("^(\xA5[\xA1-\xF6]|\xA1\xBC|\xA1\xA6|\xA1\xA1|\x20)+$", $this->arrParam[$value[1]] ) ) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¥«¥¿¥«¥Ê¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+
+	/*¡¡±Ñ¿ô»ú¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó 
+	function ALNUM_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬±Ñ¿ô»ú°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+		if( strlen($this->arrParam[$value[1]]) > 0 && ! EregI("^[[:alnum:]]+$", $this->arrParam[$value[1]] ) ) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï±Ñ¿ô»ú¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";	
+		}
+	}
+
+	/*¡¡É¬¿ÜÁªÂò¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý
+	function ZERO_CHECK( $value ) {				// ÆþÎÏÃÍ¤Ç0¤¬µö¤µ¤ì¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		
+		if($this->arrParam[$value[1]] == "0" ){						
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï1°Ê¾å¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+
+	/*¡¡·å¿ô¤ÎÈ½Äê¡¡¡ÊºÇ¾®ºÇÂç¡Ë*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó value[2] = ºÇ¾®·å¿ô value[3] = ºÇÂç·å¿ô
+	function NUM_RANGE_CHECK( $value ) {		// ÆþÎÏÊ¸»ú¤Î·å¿ôÈ½Äê¡¡¢ª¡¡ºÇ¾®·å¿ô¡ãÆþÎÏÊ¸»úÎó¡ãºÇÂç·å¿ô
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										 
+		// $this->arrParam[$value[0]] = mb_convert_kana($this->arrParam[$value[0]], "n");										
+		$count = strlen($this->arrParam[$value[1]]);
+		if( ( $count > 0 ) && $value[2] > $count || $value[3] < $count ) {  
+			$this->arrErr[$value[1]] =  "¢¨ $value[0]¤Ï$value[2]·å¡Á$value[3]·å¤ÇÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}
+
+	/*¡¡·å¿ô¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó value[2] = ·å¿ô 
+	function NUM_COUNT_CHECK( $value ) {		// ÆþÎÏÊ¸»ú¤Î·å¿ôÈ½Äê¡¡¢ª¡¡ÆþÎÏÊ¸»úÎó = ·å¿ô¡¡°Ê³°¤ÏNG¤Î¾ì¹ç
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		$count = strlen($this->arrParam[$value[1]]);
+		if(($count > 0) && $count != $value[2] ) {  
+			$this->arrErr[$value[1]] =  "¢¨ $value[0]¤Ï$value[2]·å¤ÇÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}				
+	
+	/*¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹·Á¼°¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý¥á¡¼¥ë¥¢¥É¥ì¥¹
+	function EMAIL_CHECK( $value ){				//¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÀµµ¬É½¸½¤ÇÈ½Äê¤¹¤ë
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && !ereg("^[^@]+@[^.]+\..+", $this->arrParam[$value[1]])) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Î·Á¼°¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+		}
+	}		
+		
+	/*¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ë»ÈÍÑ¤Ç¤­¤ëÊ¸»ú¤ÎÈ½Äê¡¡*/
+	//  value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý¥á¡¼¥ë¥¢¥É¥ì¥¹
+	function EMAIL_CHAR_CHECK( $value ){				//¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ë»ÈÍÑ¤¹¤ëÊ¸»ú¤òÀµµ¬É½¸½¤ÇÈ½Äê¤¹¤ë
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && !ereg("^[a-zA-Z0-9_\.@\+\?-]+$",$this->arrParam[$value[1]]) ) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ë»ÈÍÑ¤¹¤ëÊ¸»ú¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}		
+	
+	/*¡¡URL·Á¼°¤ÎÈ½Äê¡¡*/
+	//  value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝURL
+	function URL_CHECK( $value ){				//¡¡URL¤òÀµµ¬É½¸½¤ÇÈ½Äê¤¹¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Çhttp://¤¬¤¢¤Ã¤Æ¤âOK
+	 	if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+        if( strlen($this->arrParam[$value[1]]) > 0 && !ereg( "^https?://+($|[a-zA-Z0-9_~=&\?\.\/-])+$", $this->arrParam[$value[1]] ) ) {
+            $this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤òÀµ¤·¤¯ÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";     
+        }
+    }
+  	    
+	/*¡¡³ÈÄ¥»Ò¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý value[2]=array(³ÈÄ¥»Ò)	
+	function FILE_EXT_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if($_FILES[$value[1]]['name'] != "" ) {										
+			$errFlag = 1;
+			$array_ext = explode(".", $_FILES[$value[1]]['name']);
+			$ext = $array_ext[ count ( $array_ext ) - 1 ];
+			$ext = strtolower($ext);
+			
+			$strExt = "";
+			
+			foreach ( $value[2] as $checkExt ){
+				if ( $ext == $checkExt) {
+					$errFlag = 0;
+				}
+				
+				if($strExt == "") {
+					$strExt.= $checkExt;
+				} else {
+					$strExt.= "¡¦$checkExt";
+				}
+			}
+		}
+		if ($errFlag == 1) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Çµö²Ä¤µ¤ì¤Æ¤¤¤ë·Á¼°¤Ï¡¢" . $strExt . "¤Ç¤¹¡£<br />";
+		}
+	}
+	
+	/* ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë */
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý  value[2] = »ØÄê¥Ç¥£¥ì¥¯¥È¥ê
+	function FIND_FILE( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		
+		if($value[2] != "") {
+			$dir = $value[2];
+		} else {
+			$dir = IMAGE_SAVE_DIR;
+		}
+		
+		$path = $dir . "/" . $this->arrParam[$value[1]];
+		$path = ereg_replace("//", "/", $path);
+				
+		if($this->arrParam[$value[1]] != "" && !file_exists($path)){
+			$this->arrErr[$value[1]] = "¢¨ " . $path . "¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	/*¡¡¥Õ¥¡¥¤¥ë¤¬¾å¤²¤é¤ì¤¿¤«³ÎÇ§¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý  value[2] = »ØÄê¥µ¥¤¥º¡ÊKB)
+	function FILE_EXIST_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}											
+		if(!($_FILES[$value[1]]['size'] != "" && $_FILES[$value[1]]['size'] > 0)){
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤ò¥¢¥Ã¥×¥í¡¼¥É¤·¤Æ²¼¤µ¤¤¡£<br />";
+		}
+	}
+	
+	/*¡¡¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý  value[2] = »ØÄê¥µ¥¤¥º¡ÊKB)
+	function FILE_SIZE_CHECK( $value ) {			// ¼õ¤±¼è¤ê¤¬¤Ê¤¤¾ì¹ç¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}											
+		if( $_FILES[$value[1]]['size'] > $value[2] *  1024 ){
+			$byte = "KB";
+			if( $value[2] >= 1000 ) {
+				$value[2] = $value[2] / 1000; 
+				$byte = "MB";
+			}
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Î¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤Ï" . $value[2] . $byte . "°Ê²¼¤Î¤â¤Î¤ò»ÈÍÑ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+	}
+
+	/*¡¡¥Õ¥¡¥¤¥ëÌ¾¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾ÝÊ¸»úÎó
+	function FILE_NAME_CHECK( $value ) {				// ÆþÎÏÊ¸»ú¤¬±Ñ¿ô»ú,"_","-"°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if( strlen($_FILES[$value[1]]['name']) > 0 && ! EregI("^[[:alnum:]_\.-]+$", $_FILES[$value[1]]['name']) ) { 
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Î¥Õ¥¡¥¤¥ëÌ¾¤ËÆüËÜ¸ì¤ä¥¹¥Ú¡¼¥¹¤Ï»ÈÍÑ¤·¤Ê¤¤¤Ç²¼¤µ¤¤¡£<br />";	
+		}
+	}
+	
+	//ÆüÉÕ¥Á¥§¥Ã¥¯
+	// value[0] = ¹àÌÜÌ¾
+	// value[1] = YYYY
+	// value[2] = MM
+	// value[3] = DD
+	function CHECK_DATE($value) {						
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+		// ¾¯¤Ê¤¯¤È¤â¤É¤ì¤«°ì¤Ä¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¡£
+		if($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0 || $this->arrParam[$value[3]] > 0) {
+			// Ç¯·îÆü¤Î¤É¤ì¤«¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+			if(!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0)) {
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¤¹¤Ù¤Æ¤Î¹àÌÜ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+			} else if ( ! checkdate($this->arrParam[$value[2]], $this->arrParam[$value[3]], $this->arrParam[$value[1]])) {						
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />";
+			}
+		}
+	}
+	
+	//ÆüÉÕ¥Á¥§¥Ã¥¯
+	// value[0] = ¹àÌÜÌ¾
+	// value[1] = YYYY
+	// value[2] = MM
+	// value[3] = DD
+	// value[4] = HH
+	function CHECK_DATE2($value) {						
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}										
+		// ¾¯¤Ê¤¯¤È¤â¤É¤ì¤«°ì¤Ä¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤ë¡£
+		if($this->arrParam[$value[1]] > 0 || $this->arrParam[$value[2]] > 0 || $this->arrParam[$value[3]] > 0 || $this->arrParam[$value[4]] > 0) {
+			// Ç¯·îÆü»þ¤Î¤É¤ì¤«¤¬ÆþÎÏ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+			if(!(strlen($this->arrParam[$value[1]]) > 0 && strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]]) > 0)) {
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï¤¹¤Ù¤Æ¤Î¹àÌÜ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡£<br />";
+			} else if ( ! checkdate($this->arrParam[$value[2]], $this->arrParam[$value[3]], $this->arrParam[$value[1]])) {						
+				$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />";
+			}
+		}
+	}
+
+	/*-----------------------------------------------------------------*/
+	/*	CHECK_SET_TERM
+	/*	Ç¯·îÆü¤ËÊÌ¤ì¤¿2¤Ä¤Î´ü´Ö¤ÎÂÅÅöÀ­¤ò¥Á¥§¥Ã¥¯¤·¡¢À°¹çÀ­¤È´ü´Ö¤òÊÖ¤¹
+	/*¡¡°ú¿ô (³«»ÏÇ¯,³«»Ï·î,³«»ÏÆü,½ªÎ»Ç¯,½ªÎ»·î,½ªÎ»Æü)
+	/*¡¡ÌáÃÍ array(£±¡¤£²¡¤£³¡Ë
+	/*  		£±¡¥³«»ÏÇ¯·îÆü (YYYYMMDD 000000)
+	/*			£²¡¥½ªÎ»Ç¯·îÆü (YYYYMMDD 235959)
+	/*			£³¡¥¥¨¥é¡¼ ( 0 = OK, 1 = NG )
+	/*-----------------------------------------------------------------*/
+	// value[0] = ¹àÌÜÌ¾1
+	// value[1] = ¹àÌÜÌ¾2
+	// value[2] = start_year
+	// value[3] = start_month
+	// value[4] = start_day
+	// value[5] = end_year
+	// value[6] = end_month
+	// value[7] = end_day
+	function CHECK_SET_TERM ($value) {
+
+		// ´ü´Ö»ØÄê
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[5]])) {
+			return;
+		}	
+		$error = 0;
+		if ( (strlen($this->arrParam[$value[2]]) > 0 || strlen($this->arrParam[$value[3]]) > 0 || strlen($this->arrParam[$value[4]] ) > 0) && ! checkdate($this->arrParam[$value[3]], $this->arrParam[$value[4]], $this->arrParam[$value[2]]) ) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤òÀµ¤·¤¯»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+		if ( (strlen($this->arrParam[$value[5]]) > 0 || strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]] ) > 0) && ! checkdate($this->arrParam[$value[6]], $this->arrParam[$value[7]], $this->arrParam[$value[5]]) ) {
+			$this->arrErr[$value[5]] = "¢¨ " . $value[1] . "¤òÀµ¤·¤¯»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+		if ( (strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]] ) > 0) &&  (strlen($this->arrParam[$value[5]]) > 0 || strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]] ) > 0) ){
+
+			$date1 = $this->arrParam[$value[2]] .sprintf("%02d", $this->arrParam[$value[3]]) .sprintf("%02d",$this->arrParam[$value[4]]) ."000000";
+			$date2 = $this->arrParam[$value[5]] .sprintf("%02d", $this->arrParam[$value[6]]) .sprintf("%02d",$this->arrParam[$value[7]]) ."235959";
+			
+			if (($this->arrErr[$value[2]] == "" && $this->arrErr[$value[5]] == "") && $date1 > $date2) {
+				$this->arrErr[$value[2]] = "¢¨ " .$value[0]. "¤È" .$value[1]. "¤Î´ü´Ö»ØÄê¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+			}
+		}
+	}
+	
+	/*-----------------------------------------------------------------*/
+	/*	CHECK_SET_TERM2
+	/*	Ç¯·îÆü»þ¤ËÊÌ¤ì¤¿2¤Ä¤Î´ü´Ö¤ÎÂÅÅöÀ­¤ò¥Á¥§¥Ã¥¯¤·¡¢À°¹çÀ­¤È´ü´Ö¤òÊÖ¤¹
+	/*¡¡°ú¿ô (³«»ÏÇ¯,³«»Ï·î,³«»ÏÆü,³«»Ï»þ´Ö,½ªÎ»Ç¯,½ªÎ»·î,½ªÎ»Æü,½ªÎ»»þ´Ö)
+	/*¡¡ÌáÃÍ array(£±¡¤£²¡¤£³¡Ë
+	/*  		£±¡¥³«»ÏÇ¯·îÆü (YYYYMMDDHH 0000)
+	/*			£²¡¥½ªÎ»Ç¯·îÆü (YYYYMMDDHH 0059)
+	/*			£³¡¥¥¨¥é¡¼ ( 0 = OK, 1 = NG )
+	/*-----------------------------------------------------------------*/
+	// value[0] = ¹àÌÜÌ¾1
+	// value[1] = ¹àÌÜÌ¾2
+	// value[2] = start_year
+	// value[3] = start_month
+	// value[4] = start_day
+	// value[5] = start_hour
+	// value[6] = end_year
+	// value[7] = end_month
+	// value[8] = end_day
+	// value[9] = end_hour
+	function CHECK_SET_TERM2 ($value) {
+
+		// ´ü´Ö»ØÄê
+		if(isset($this->arrErr[$value[2]]) || isset($this->arrErr[$value[6]])) {
+			return;
+		}	
+		$error = 0;
+		if ( (strlen($this->arrParam[$value[2]]) > 0 || strlen($this->arrParam[$value[3]]) > 0 || strlen($this->arrParam[$value[4]] ) > 0 || strlen($this->arrParam[$value[5]]) > 0) && ! checkdate($this->arrParam[$value[3]], $this->arrParam[$value[4]], $this->arrParam[$value[2]]) ) {
+			$this->arrErr[$value[2]] = "¢¨ " . $value[0] . "¤òÀµ¤·¤¯»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+		if ( (strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]]) > 0 || strlen($this->arrParam[$value[8]] ) > 0 || strlen($this->arrParam[$value[9]] ) > 0) && ! checkdate($this->arrParam[$value[7]], $this->arrParam[$value[8]], $this->arrParam[$value[6]]) ) {
+			$this->arrErr[$value[6]] = "¢¨ " . $value[1] . "¤òÀµ¤·¤¯»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+		}
+		if ( (strlen($this->arrParam[$value[2]]) > 0 && strlen($this->arrParam[$value[3]]) > 0 && strlen($this->arrParam[$value[4]] ) > 0 && strlen($this->arrParam[$value[5]] ) > 0) &&  (strlen($this->arrParam[$value[6]]) > 0 || strlen($this->arrParam[$value[7]]) > 0 || strlen($this->arrParam[$value[8]] ) > 0 || strlen($this->arrParam[$value[9]] ) > 0) ){
+
+			$date1 = $this->arrParam[$value[2]] .sprintf("%02d", $this->arrParam[$value[3]]) .sprintf("%02d",$this->arrParam[$value[4]]) .sprintf("%02d",$this->arrParam[$value[5]])."0000";
+			$date2 = $this->arrParam[$value[6]] .sprintf("%02d", $this->arrParam[$value[7]]) .sprintf("%02d",$this->arrParam[$value[8]]) .sprintf("%02d",$this->arrParam[$value[9]])."0000";
+			
+			if (($this->arrErr[$value[2]] == "" && $this->arrErr[$value[6]] == "") && $date1 > $date2) {
+				$this->arrErr[$value[2]] = "¢¨ " .$value[0]. "¤È" .$value[1]. "¤Î´ü´Ö»ØÄê¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+			}
+			if($date1 == $date2) {
+				$this->arrErr[$value[2]] = "¢¨ " .$value[0]. "¤È" .$value[1]. "¤Î´ü´Ö»ØÄê¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+			}
+			
+		}
+	}	
+	//¥Ç¥£¥ì¥¯¥È¥êÂ¸ºß¥Á¥§¥Ã¥¯
+	function DIR_CHECK ($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(!is_dir($this->arrParam[$value[1]])) {
+			$this->arrErr[$value[1]] = "¢¨ »ØÄê¤·¤¿" . $value[0] . "¤ÏÂ¸ºß¤·¤Þ¤»¤ó¡£<br />";
+		}
+	}
+	
+	//¥Ç¥£¥ì¥¯¥È¥êÂ¸ºß¥Á¥§¥Ã¥¯
+	function DOMAIN_CHECK ($value) {
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && !ereg("^\.[^.]+\..+", $this->arrParam[$value[1]])) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Î·Á¼°¤¬ÉÔÀµ¤Ç¤¹¡£<br />";
+		}
+	}	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_PageNavi.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_PageNavi.php	(revision 2251)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_PageNavi.php	(revision 2251)
@@ -0,0 +1,117 @@
+<?php
+/* ¢¨»ÈÍÑ¾ò·ï¢¨
+	¡¦form¥¿¥°¤Ë°Ê²¼¤òÄÉ²Ã¤¹¤ë¡£
+		<input type="hidden" name="pageno" value="<!--{$tpl_pageno}-->">
+	¡¦¥½¡¼¥¹¤ÎºÇ½é¤Ë°Ê²¼¤òµ­½Ò¤¹¤ë¡£
+		$objPage->tpl_pageno = $_POST['pageno'];
+	¡¦$func_name¤Ë»ØÄê¤¹¤ëJavaScript¤ÎÎã
+		// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë
+		function fnNaviPage(pageno) {
+			document.form1['pageno'].value = pageno;
+			document.form1.submit();
+		}		
+*/
+class SC_PageNavi {
+	var $now_page;		// ¸½ºß¤Î¥Ú¡¼¥¸ÈÖ¹æ
+	var $max_page;		// ºÇ½ª¤Î¥Ú¡¼¥¸ÈÖ¹æ
+	var $start_row;		// ³«»Ï¥ì¥³¡¼¥É
+	var $strnavi;		// ¥Ú¡¼¥¸Á÷¤êÊ¸»úÎó
+	var $arrPagenavi = array();	// ¥Ú¡¼¥¸
+
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX) {
+		$this->arrPagenavi['mode'] = 'search';
+
+		//¸½ºß¥Ú¡¼¥¸($now_page)¤¬Àµ¤·¤¤¿ôÃÍ¤Ç¤Ê¤¤¾ì¹ç
+		if (!eregi("^[[:digit:]]+$", $now_page) || $now_page < 1 || $now_page == "") {
+			$this->now_page = 1;
+		} else {
+			$this->now_page = $now_page;
+		}
+		$this->arrPagenavi['now_page'] = $this->now_page;
+
+		// ºÇ½ª¥Ú¡¼¥¸¤Î·×»»
+		$this->max_page = ceil($all_row/$page_row);
+
+		// ºÇ½ª¥Ú¡¼¥¸¤è¤ê¤â¸½ºß¥Ú¡¼¥¸¤¬Âç¤­¤¤¾ì¹ç¤Ï¡¢ºÇ½é¤ËÌá¤¹¡£
+		if($this->max_page < $this->now_page) {
+			$this->now_page = 1;
+		}
+
+		$this->start_row = ($this->now_page - 1) * $page_row;
+	
+		// ³«»Ï¹Ô¤¬ÉÔÀµ¤Ê¾ì¹ç
+		if (!($this->start_row < $all_row && $this->start_row >= 0)) {
+			$this->start_row = 0;
+		}
+
+		if($all_row > 1) {
+
+			//¡ÖÁ°¤Ø¡×¡Ö¼¡¤Ø¡×¤ÎÀßÄê
+			if ($this->now_page > 1) {
+				$before="<a href=\"". $_SERVER['PHP_SELF']. "\" onclick=\"$func_name('" .(($this->now_page) - 1). "'); return false;\"><<Á°¤Ø</a> ";
+				$this->arrPagenavi['before'] = ($this->now_page) - 1;
+			}else{
+				$this->arrPagenavi['before'] = $this->now_page;
+			}
+			
+			if ($this->now_page < $this->max_page) {
+				$next="<a href=\"". $_SERVER['PHP_SELF']. "\" onclick=\"$func_name('" .(($this->now_page) + 1) ."'); return false;\">¼¡¤Ø>></a> ";
+				$this->arrPagenavi['next'] = ($this->now_page) + 1;
+			}else{
+				$this->arrPagenavi['next'] = $this->now_page;
+			}
+			
+			// É½¼¨¤¹¤ëºÇÂç¥Ê¥Ó¿ô¤ò·è¤á¤ë¡£
+			if($navi_max == "" || $navi_max > $this->max_page) {
+				// À©¸Â¥Ê¥Ó¿ô¤Î»ØÄê¤¬¤Ê¤¤¡£¥Ú¡¼¥¸ºÇÂç¿ô¤¬À©¸Â¥Ê¥Ó¿ô¤è¤ê¾¯¤Ê¤¤¡£
+				$disp_max = $this->max_page;
+			} else {
+				// ¸½ºß¤Î¥Ú¡¼¥¸¡ÜÀ©¸Â¥Ê¥Ó¿ô¤¬É½¼¨¤µ¤ì¤ë¡£
+				$disp_max = $this->now_page + $navi_max - 1;
+				// ¥Ú¡¼¥¸ºÇÂç¿ô¤òÄ¶¤¨¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¥Ú¡¼¥¸ºÇÂç¿ô¤Ë¹ç¤ï¤»¤ë¡£
+				if($disp_max > $this->max_page) {
+					$disp_max = $this->max_page;
+				}
+			}
+
+			// É½¼¨¤¹¤ëºÇ¾®¥Ê¥Ó¿ô¤ò·è¤á¤ë¡£
+			if($navi_max == "" || $navi_max > $this->now_page) {
+				// À©¸Â¥Ê¥Ó¿ô¤Î»ØÄê¤¬¤Ê¤¤¡£¸½ºß¥Ú¡¼¥¸ÈÖ¹æ¤¬À©¸Â¥Ê¥Ó¿ô¤è¤ê¾¯¤Ê¤¤¡£
+				$disp_min = 1;
+			} else {
+				// ¸½ºß¤Î¥Ú¡¼¥¸-À©¸Â¥Ê¥Ó¿ô¤¬É½¼¨¤µ¤ì¤ë¡£
+				$disp_min = $this->now_page - $navi_max + 1;
+			}
+			
+			$this->arrPagenavi['arrPageno'] = array();
+			for ($i=$disp_min; $i <= $disp_max; $i++) {
+				if($i != $disp_max) {
+					$sep = " | ";
+				} else {
+					$sep = "";
+				}
+				
+				if ($i == $this->now_page) {
+					$page_number .= "<strong>$i</strong> ";
+				} else {
+					$page_number.="<a href=\"". $_SERVER['PHP_SELF']. "\" onclick=\"$func_name('$i'); return false;\">$i</a> ";
+				}
+				
+				$page_number.=$sep;
+				
+				$this->arrPagenavi['arrPageno'][$i] = $i;
+			}
+			
+			if ($before || $next) {
+				$this->strnavi = $before .$page_number .$next;
+			}
+		}else{
+			$this->arrPagenavi['arrPageno'][0] = 1;
+			$this->arrPagenavi['before'] = 1;
+			$this->arrPagenavi['next'] = 1;
+		}
+	}
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_CartSession.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_CartSession.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_CartSession.php	(revision 1328)
@@ -0,0 +1,281 @@
+<?php
+/* ¥«¡¼¥È¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_CartSession {
+	var $key;
+	var $key_tmp;	// ¥æ¥Ë¡¼¥¯ID¤ò»ØÄê¤¹¤ë¡£
+	
+	/* ¥³¥ó¥¹¥È¥é¥¯¥¿ */
+	function SC_CartSession($key = 'cart') {
+		sfDomainSessionStart();
+		$this->key = $key;
+	}
+	
+	// ¾¦ÉÊ¹ØÆþ½èÍýÃæ¤Î¥í¥Ã¥¯
+	function saveCurrentCart($key_tmp) {
+		$this->key_tmp = "savecart_" . $key_tmp;
+		// ¤¹¤Ç¤Ë¾ðÊó¤¬¤Ê¤±¤ì¤Ð¸½¾õ¤Î¥«¡¼¥È¾ðÊó¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		if(count($_SESSION[$this->key_tmp]) == 0) {
+			$_SESSION[$this->key_tmp] = $_SESSION[$this->key];
+		}
+		// 1À¤Âå¸Å¤¤¥³¥Ô¡¼¾ðÊó¤Ï¡¢ºï½ü¤·¤Æ¤ª¤¯
+		foreach($_SESSION as $key => $val) {
+			if($key != $this->key_tmp && ereg("^savecart_", $key)) {
+				unset($_SESSION[$key]);
+			}
+		}
+	}
+
+	// ¾¦ÉÊ¹ØÆþÃæ¤ÎÊÑ¹¹¤¬¤¢¤Ã¤¿¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	function getCancelPurchase() {
+		$ret = $_SESSION[$this->key]['cancel_purchase'];
+		$_SESSION[$this->key]['cancel_purchase'] = false;
+		return $ret;
+	}
+	
+	// ¹ØÆþ½èÍýÃæ¤Ë¾¦ÉÊ¤ËÊÑ¹¹¤¬¤Ê¤«¤Ã¤¿¤«¤òÈ½Äê
+	function checkChangeCart() {
+		$change = false;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if ($_SESSION[$this->key][$i]['quantity'] != $_SESSION[$this->key_tmp][$i]['quantity']) {
+				$change = true;
+				break;
+			}
+			if ($_SESSION[$this->key][$i]['id'] != $_SESSION[$this->key_tmp][$i]['id']) {
+				$change = true;
+				break;
+			}
+		}
+		if ($change) {
+			// °ì»þ¥«¡¼¥È¤Î¥¯¥ê¥¢
+			unset($_SESSION[$this->key_tmp]);
+			$_SESSION[$this->key]['cancel_purchase'] = true;
+		} else {
+			$_SESSION[$this->key]['cancel_purchase'] = false;
+		}
+		return $_SESSION[$this->key]['cancel_purchase'];
+	}
+	
+	// ¼¡¤Ë³ä¤êÅö¤Æ¤ë¥«¡¼¥È¤ÎID¤ò¼èÆÀ¤¹¤ë
+	function getNextCartID() {
+		$max = count($_SESSION[$this->key]);
+		for($i = 0; $i < $max; $i++) {
+			$arrRet[] = $_SESSION[$this->key][$i]['cart_no'];
+		}
+		return (max($arrRet) + 1);		
+	}
+			
+	// ¾¦ÉÊ¤´¤È¤Î¹ç·×²Á³Ê
+	function getProductTotal($arrInfo, $id) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['id'] == $id) {
+				// ÀÇ¹þ¤ß¹ç·×
+				$price = $_SESSION[$this->key][$i]['price'];
+				$quantity = $_SESSION[$this->key][$i]['quantity'];
+				$pre_tax = sfPreTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+				$total = $pre_tax * $quantity;
+				return $total;
+			}
+		}
+		return 0;
+	}
+	
+	// ÃÍ¤Î¥»¥Ã¥È
+	function setProductValue($id, $key, $val) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['id'] == $id) {
+				$_SESSION[$this->key][$i][$key] = $val;
+			}
+		}
+	}
+		
+	// ¥«¡¼¥ÈÆâ¾¦ÉÊ¤ÎºÇÂçÍ×ÁÇÈÖ¹æ¤ò¼èÆÀ¤¹¤ë¡£
+	function getMax() {
+		$cnt = 0;
+		$pos = 0;
+		$max = 0;
+		if (count($_SESSION[$this->key]) > 0){
+			foreach($_SESSION[$this->key] as $key => $val) {
+				if (is_numeric($key)) {
+					if($max < $key) {
+						$max = $key;
+					}
+				}
+			}
+		}
+		return ($max);
+	}
+	
+	// ¥«¡¼¥ÈÆâ¾¦ÉÊ¿ô¤Î¹ç·×
+	function getTotalQuantity() {
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$total+= $_SESSION[$this->key][$i]['quantity'];
+		}
+		return $total;
+	}
+	
+
+	// Á´¾¦ÉÊ¤Î¹ç·×²Á³Ê
+	function getAllProductsTotal($arrInfo) {
+		// ÀÇ¹þ¤ß¹ç·×
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$price = $_SESSION[$this->key][$i]['price'];
+			$quantity = $_SESSION[$this->key][$i]['quantity'];
+			$pre_tax = sfPreTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+			$total+= ($pre_tax * $quantity);
+		}
+		return $total;
+	}
+
+	// Á´¾¦ÉÊ¤Î¹ç·×ÀÇ¶â
+	function getAllProductsTax($arrInfo) {
+		// ÀÇ¹ç·×
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$price = $_SESSION[$this->key][$i]['price'];
+			$quantity = $_SESSION[$this->key][$i]['quantity'];
+			$tax = sfTax($price, $arrInfo['tax'], $arrInfo['tax_rule']);
+			$total+= ($tax * $quantity);
+		}
+		return $total;
+	}
+	
+	// Á´¾¦ÉÊ¤Î¹ç·×¥Ý¥¤¥ó¥È
+	function getAllProductsPoint() {
+		// ¥Ý¥¤¥ó¥È¹ç·×
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$price = $_SESSION[$this->key][$i]['price'];
+			$quantity = $_SESSION[$this->key][$i]['quantity'];
+			$point_rate = $_SESSION[$this->key][$i]['point_rate'];
+			$id = $_SESSION[$this->key][$i]['id'][0];
+			$point = sfPrePoint($price, $point_rate, POINT_RULE, $id);
+			$total+= ($point * $quantity);
+		}
+		return $total;
+	}
+	
+	// ¥«¡¼¥È¤Ø¤Î¾¦ÉÊÄÉ²Ã
+	function addProduct($id, $quantity) {
+		$find = false;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			
+			if($_SESSION[$this->key][$i]['id'] == $id) {
+				$val = $_SESSION[$this->key][$i]['quantity'] + $quantity;
+				if(strlen($val) <= INT_LEN) {
+					$_SESSION[$this->key][$i]['quantity']+= $quantity;
+				}
+				$find = true;
+			}
+		}
+		if(!$find) {
+			$_SESSION[$this->key][$max+1]['id'] = $id;
+			$_SESSION[$this->key][$max+1]['quantity'] = $quantity;
+			$_SESSION[$this->key][$max+1]['cart_no'] = $this->getNextCartID();
+		}
+	}
+	
+	// ¥­¡¼¤¬°ìÃ×¤·¤¿¾¦ÉÊ¤Îºï½ü
+	function delProductKey($keyname, $val) {
+		$max = count($_SESSION[$this->key]);
+		for($i = 0; $i < $max; $i++) {
+			if($_SESSION[$this->key][$i][$keyname] == $val) {
+				unset($_SESSION[$this->key][$i]);
+			}
+		}
+	}
+	
+	function setValue($key, $val) {
+		$_SESSION[$this->key][$key] = $val;
+	}
+	
+	function getValue($key) {
+		return $_SESSION[$this->key][$key];
+	}
+	
+	function getCartList() {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] != "") {
+				$arrRet[] = $_SESSION[$this->key][$i];
+			}
+		}
+		return $arrRet;
+	}
+	
+	// ¥«¡¼¥ÈÆâ¤Ë¤¢¤ë¾¦ÉÊ£É£Ä¤òÁ´¤Æ¼èÆÀ¤¹¤ë
+	function getAllProductID() {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] != "") {
+				$arrRet[] = $_SESSION[$this->key][$i]['id'][0];
+			}
+		}
+		return $arrRet;
+	}
+	
+	function delAllProducts() {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			unset($_SESSION[$this->key][$i]);
+		}
+	}
+	
+	// ¾¦ÉÊ¤Îºï½ü
+	function delProduct($cart_no) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) {
+				unset($_SESSION[$this->key][$i]);
+			}
+		}
+	}
+	
+	// ¸Ä¿ô¤ÎÁý²Ã
+	function upQuantity($cart_no) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) {
+				if(strlen($_SESSION[$this->key][$i]['quantity'] + 1) <= INT_LEN) {
+					$_SESSION[$this->key][$i]['quantity']++;
+				}
+			}
+		}
+	}
+	
+	// ¸Ä¿ô¤Î¸º¾¯
+	function downQuantity($cart_no) {
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) {
+				if($_SESSION[$this->key][$i]['quantity'] > 1) {
+					$_SESSION[$this->key][$i]['quantity']--;
+				}
+			}
+		}
+	}
+	
+	// Á´¾¦ÉÊ¤Î¹ç·×Á÷ÎÁ
+	function getAllProductsDelivFee() {
+		// ¥Ý¥¤¥ó¥È¹ç·×
+		$total = 0;
+		$max = $this->getMax();
+		for($i = 0; $i <= $max; $i++) {
+			$deliv_fee = $_SESSION[$this->key][$i]['deliv_fee'];
+			$quantity = $_SESSION[$this->key][$i]['quantity'];
+			$total+= ($deliv_fee * $quantity);
+		}
+		return $total;
+	}	
+	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_CustomerList.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_CustomerList.php	(revision 2702)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_CustomerList.php	(revision 2702)
@@ -0,0 +1,299 @@
+<?php
+
+/*  [Ì¾¾Î] SC_CustomerList
+ *  [³µÍ×] ²ñ°÷¸¡º÷ÍÑ¥¯¥é¥¹
+ */
+class SC_CustomerList extends SC_SelectSql {
+
+	var $arrColumnCSV;
+	
+	function SC_CustomerList($array, $mode = '') {
+		parent::SC_SelectSql($array);
+		
+		if($mode == "") {
+			// ²ñ°÷ËÜÅÐÏ¿²ñ°÷¤Çºï½ü¤·¤Æ¤¤¤Ê¤¤²ñ°÷
+			$this->setWhere("status = 2 AND delete = 0 ");		
+			// ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à
+			$regdate_col = 'dtb_customer.update_date';
+		}
+		
+		if($mode == "customer") {
+			// ´ÉÍý¼Ô¥Ú¡¼¥¸¸ÜµÒ¸¡º÷¤Î¾ì¹ç²¾ÅÐÏ¿²ñ°÷¤â¸¡º÷
+			$this->setWhere( "(status = 1 OR status = 2) AND delete = 0 ");		
+			// ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à
+			$regdate_col = 'dtb_customer.update_date';
+		}
+				
+		// ¥á¡¼¥ë¥Þ¥¬¥¸¥ó¤Î¾ì¹ç		
+		if($mode == "magazine") {
+			$this->setWhere("(delete = 0 OR delete IS NULL)");
+			$this->setWhere("status = 2");
+			
+			/*¡¡²ñ°÷¤Î¤ßÂÐ¾Ý¤È¤¹¤ë
+			if(is_array($this->arrSql['customer'])) {
+				$tmp_where = "";
+				foreach($this->arrSql['customer'] as $val) {
+					if($tmp_where != "") {
+						$tmp_where.= " OR ";
+					}					
+					switch($val) {
+					// ²ñ°÷
+					case '1':
+						$tmp_where.= "status = 2";
+						break;
+					// ¥á¥ë¥Þ¥¬ÅÐÏ¿
+					case '2':
+						$tmp_where.= "customer_id IS NULL";
+						break;
+					// CSVÅÐÏ¿
+					case '3':
+						$tmp_where.= "customer_id IS NULL";
+						break;
+					default:
+						$tmp_where = "";
+						break;
+					}
+				}
+				if($tmp_where != "") {
+					$tmp_where = "(" . $tmp_where . ")";
+				}
+				$this->setWhere($tmp_where);
+			}
+			*/
+			// ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à
+			$regdate_col = 'dtb_customer_mail.create_date';
+		}
+				
+		// ¸ÜµÒID
+		if ( strlen($this->arrSql['customer_id']) > 0 ) {
+			$this->setWhere( "customer_id =  ?" );
+			$this->arrVal[] = $this->arrSql['customer_id'];
+		}
+		
+		// Ì¾Á°
+		if ( strlen($this->arrSql['name']) > 0 ) {
+			$this->setWhere("(name01 || name02 LIKE ?)" );
+			$searchName = $this->addSearchStr($this->arrSql['name']);
+			$this->arrVal[] = mb_ereg_replace("[ ¡¡]+","",$searchName);
+		}
+
+		//¡¡Ì¾Á°¡Ê¥«¥Ê¡Ë
+		if ( strlen($this->arrSql['kana']) > 0 ) {
+			$this->setWhere("(kana01 || kana02 LIKE ?)");
+			$searchKana = $this->addSearchStr($this->arrSql['kana']);
+			$this->arrVal[] = mb_ereg_replace("[ ¡¡]+","",$searchKana);
+		}
+		
+		//¡¡ÅÔÆ»ÉÜ¸©
+		if ( strlen($this->arrSql['pref']) > 0 ) {
+			$this->setWhere( "pref = ?" );
+			$this->arrVal[] = $this->arrSql['pref'];
+		}
+
+		//¡¡ÅÅÏÃÈÖ¹æ
+		if ( is_numeric( $this->arrSql['tel'] ) ) {
+			$this->setWhere( "(tel01 || tel02 || tel03 LIKE ?)" );
+			$searchTel = $this->addSearchStr($this->arrSql['tel']);
+			$this->arrVal[] = ereg_replace("-", "", $searchTel);
+		}
+		
+		//¡¡À­ÊÌ
+		if ( is_array( $this->arrSql['sex'] ) ){
+			$arrSexVal = $this->setItemTerm( $this->arrSql['sex'] ,"sex" );
+			foreach ($arrSexVal as $data) {
+				$this->arrVal[] = $data;
+			}
+		}
+
+		//¡¡¿¦¶È
+		if ( is_array( $this->arrSql['job'] ) ){
+			if ( in_array("ÉÔÌÀ", $this->arrSql['job'] ) ) {
+				$arrJobVal = $this->setItemTermWithNull( $this->arrSql['job'] ,"job" );
+			} else {
+				$arrJobVal = $this->setItemTerm( $this->arrSql['job'] ,"job" );
+			}
+			if (is_array($arrJobVal)) {
+				foreach ($arrJobVal as $data) {
+					$this->arrVal[] = $data;
+				}
+			}
+		}
+
+		//¡¡E-MAIL
+		if (strlen($this->arrSql['email']) > 0) {
+			//¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊ£¿ô¤Î¾ò·ï»ØÄê²ÄÇ½¤Ë
+			$this->arrSql['email'] = explode(",", $this->arrSql['email']);
+			$sql_where = "";
+			foreach($this->arrSql['email'] as $val) {
+				$val = trim($val);
+				//¸¡º÷¾ò·ï¤ò´Þ¤Þ¤Ê¤¤
+				if($this->arrSql['not_emailinc'] == '1') {
+					if($sql_where == "") {
+						$sql_where .= "email NOT ILIKE ? ";
+					} else {
+						$sql_where .= "AND email NOT ILIKE ? ";
+					}
+				} else {				
+					if($sql_where == "") {
+						$sql_where .= "email ILIKE ? ";
+					} else {
+						$sql_where .= "OR email ILIKE ? ";
+					}
+				}
+				$searchEmail = $this->addSearchStr($val);
+				$this->arrVal[] = $searchEmail;
+			}
+			$this->setWhere($sql_where);
+		}
+		//¡¡HTML-mail
+		if ( $mode == 'magazine' ){
+			if ( strlen($this->arrSql['htmlmail']) > 0 ) {
+				$this->setWhere( " mail_flag = ? ");
+				$this->arrVal[] = $this->arrSql['htmlmail'];
+			} else {
+				$this->setWhere( " (mail_flag = 1 or mail_flag = 2) ");
+			}
+		}
+		
+		// ¹ØÆþ¶â³Û»ØÄê
+		if( is_numeric( $this->arrSql["buy_total_from"] ) || is_numeric( $this->arrSql["buy_total_to"] ) ) {
+			$arrBuyTotal = $this->selectRange($this->arrSql["buy_total_from"], $this->arrSql["buy_total_to"], "buy_total");
+			foreach ($arrBuyTotal as $data1) {
+				$this->arrVal[] = $data1;
+			}
+		}
+
+		// ¹ØÆþ²ó¿ô»ØÄê
+		if( is_numeric( $this->arrSql["buy_times_from"] ) || is_numeric( $this->arrSql["buy_times_to"] ) ) {
+			$arrBuyTimes = $this->selectRange($this->arrSql["buy_times_from"], $this->arrSql["buy_times_to"], "buy_times");
+			foreach ($arrBuyTimes as $data2) {
+				$this->arrVal[] = $data2;
+			}
+		}
+		
+		// ÃÂÀ¸Æü´ü´Ö»ØÄê
+		if ( (strlen($this->arrSql['b_start_year']) > 0 && strlen($this->arrSql['b_start_month']) > 0 && strlen($this->arrSql['b_start_day']) > 0) ||
+			  strlen($this->arrSql['b_end_year']) > 0 && strlen($this->arrSql['b_end_month']) > 0 && strlen($this->arrSql['b_end_day']) > 0) {
+
+			$arrBirth = $this->selectTermRange($this->arrSql['b_start_year'], $this->arrSql['b_start_month'], $this->arrSql['b_start_day']
+					  , $this->arrSql['b_end_year'], $this->arrSql['b_end_month'], $this->arrSql['b_end_day'], "birth");
+			if (is_array($arrBirth)) {
+				foreach ($arrBirth as $data3) {
+					$this->arrVal[] = $data3;
+				}
+			}
+		}
+				
+		// ÃÂÀ¸·î¤Î¸¡º÷
+		if (is_numeric($this->arrSql["birth_month"])) {
+			$this->setWhere(" EXTRACT(month from birth) = ?");  
+			$this->arrVal[] = $this->arrSql["birth_month"];
+		}
+			
+		// ÅÐÏ¿´ü´Ö»ØÄê
+		if ( (strlen($this->arrSql['start_year']) > 0 && strlen($this->arrSql['start_month']) > 0 && strlen($this->arrSql['start_day']) > 0 ) || 
+				(strlen($this->arrSql['end_year']) > 0 && strlen($this->arrSql['end_month']) >0 && strlen($this->arrSql['end_day']) > 0) ) {
+
+			$arrRegistTime = $this->selectTermRange($this->arrSql['start_year'], $this->arrSql['start_month'], $this->arrSql['start_day']
+							, $this->arrSql['end_year'], $this->arrSql['end_month'], $this->arrSql['end_day'], $regdate_col);
+			if (is_array($arrRegistTime)) {
+				foreach ($arrRegistTime as $data4) {
+					$this->arrVal[] = $data4;
+				}
+			}
+		}
+			
+		// ºÇ½ª¹ØÆþÆü»ØÄê
+		if ( (strlen($this->arrSql['buy_start_year']) > 0 && strlen($this->arrSql['buy_start_month']) > 0 && strlen($this->arrSql['buy_start_day']) > 0 ) || 
+				(strlen($this->arrSql['buy_end_year']) > 0 && strlen($this->arrSql['buy_end_month']) >0 && strlen($this->arrSql['buy_end_day']) > 0) ) {
+			$arrRegistTime = $this->selectTermRange($this->arrSql['buy_start_year'], $this->arrSql['buy_start_month'], $this->arrSql['buy_start_day']
+							, $this->arrSql['buy_end_year'], $this->arrSql['buy_end_month'], $this->arrSql['buy_end_day'], "last_buy_date");
+			if (is_array($arrRegistTime)) {
+				foreach ($arrRegistTime as $data4) {
+					$this->arrVal[] = $data4;
+				}
+			}
+		}
+		
+		//¹ØÆþ¾¦ÉÊ¥³¡¼¥É
+		if ( strlen($this->arrSql['buy_product_code']) > 0 ) {
+			$this->setWhere( "customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_code LIKE ? ))");
+			$search_buyproduct_code = $this->addSearchStr($this->arrSql['buy_product_code']);
+			$this->arrVal[] = $search_buyproduct_code;
+		}
+
+		//¹ØÆþ¾¦ÉÊÌ¾¾Î
+		if ( strlen($this->arrSql['buy_product_name']) > 0 ) {
+			$this->setWhere( "customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_name LIKE ? ))");
+			$search_buyproduct_name = $this->addSearchStr($this->arrSql['buy_product_name']);
+			$this->arrVal[] = $search_buyproduct_name;
+		}
+		
+		//¥«¥Æ¥´¥ê¡¼¤òÁªÂò¤·¤Æ¤¤¤ë¾ì¹ç¤Î¤ß¹Ê¹þ¸¡º÷¤ò¹Ô¤¦
+		if ( strlen($this->arrSql['category_id']) != ""){
+			//¥«¥Æ¥´¥ê¡¼¤Ç¹Ê¹þ¸¡º÷¤ò¹Ô¤¦SQLÊ¸À¸À®
+			list($tmp_where, $tmp_arrval) = sfGetCatWhere(sfManualEscape($this->arrSql['category_id']));
+
+			//¥«¥Æ¥´¥ê¡¼¤Ç¹Ê¹þ¤ß¤¬²ÄÇ½¤Î¾ì¹ç
+			if($tmp_where != "") {
+				$this->setWhere( " customer_id IN (SELECT distinct customer_id FROM dtb_order WHERE order_id IN (SELECT distinct order_id FROM dtb_order_detail WHERE product_id IN (SELECT product_id FROM dtb_products WHERE ".$tmp_where." ))) ");
+				$this->arrVal = array_merge($this->arrVal, $tmp_arrval);
+			}
+		}
+		//¡¡·ÈÂÓÅÅÏÃÈÖ¹æ
+		if ( is_numeric( $this->arrSql['cell'] ) ) {
+			$this->setWhere( "(cell01 || cell02 || cell03 LIKE ?)" );
+			$searchTel = $this->addSearchStr($this->arrSql['cell']);
+			$this->arrVal[] = ereg_replace("-", "", $searchTel);
+		}
+		
+		$this->setOrder( "customer_id DESC" );
+	}
+
+	// ¸¡º÷ÍÑSQL
+	function getList() {
+		$this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref,status FROM dtb_customer ";
+		return $this->getSql(0);	
+	}
+
+	function getListMailMagazine() {
+		$this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref, mail_flag FROM dtb_customer_mail LEFT OUTER JOIN dtb_customer USING(email)";
+		return $this->getSql(0);	
+	}
+	
+	function getListMailMagazineCount() {
+		$this->select = "SELECT COUNT(*) FROM dtb_customer_mail LEFT OUTER JOIN dtb_customer USING(email)";
+		return $this->getSql(0);	
+	}
+	//¹ØÆþ¾¦ÉÊ¥³¡¼¥É¸¡º÷ÍÑSQL
+	function getBuyList(){
+		$this->select = "SELECT A.customer_id, A.name01, A.name02, A.kana01, A.kana02, A.sex, A.email, A.tel01, A.tel02, A.tel03, A.pref, A.mail_flag, B.order_email, B.order_id, C.product_code 
+						FROM (dtb_customer LEFT OUTER JOIN dtb_customer_mail USING (email)) AS A LEFT OUTER JOIN dtb_order AS B ON 
+						A.email=B.order_email LEFT OUTER JOIN dtb_order_detail AS C ON B.order_id = C.order_id";
+	}
+
+	//¡¡¸¡º÷Áí¿ô¥«¥¦¥ó¥ÈÍÑSQL
+	function getListCount() {
+		$this->select = "SELECT COUNT (customer_id) FROM dtb_customer ";	
+		return $this->getSql(1);
+	}
+
+	//¡¡CSV¥À¥¦¥ó¥í¡¼¥ÉÍÑSQL
+	function getListCSV($arrColumnCSV) {
+		$this->arrColumnCSV = $arrColumnCSV;
+		$i = 0;
+		foreach ($this->arrColumnCSV as $val) {
+			if ($i != 0) $state .= ", ";
+			$state .= $val["sql"];
+			$i ++;
+		}
+
+		$this->select = "SELECT " .$state. " FROM dtb_customer ";
+		return $this->getSql(2);	
+	}
+	
+	function getWhere() {
+		return array($this->where, $this->arrVal);
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_SelectSql.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_SelectSql.php	(revision 2686)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_SelectSql.php	(revision 2686)
@@ -0,0 +1,226 @@
+<?php
+
+/* ---- SQLÊ¸¤òºî¤ë¥¯¥é¥¹ ---- */
+class SC_SelectSql {
+	
+	var $sql;
+	
+	var $select;	
+	var $where;
+	var $order;
+	var $group;
+	var $limit;
+	var $offset;
+	var $arrSql;
+	var $arrVal;
+
+	//--¡¡¥³¥ó¥¹¥È¥é¥¯¥¿¡£
+	function SC_SelectSql($array = "") {
+		if (is_array($array)) {
+			$this->arrSql = $array;
+		}
+	}
+
+	//-- SQLÊ¬À¸À®
+	function getSql( $mode = "" ){
+		$this->sql = $this->select ." ". $this->where ." ". $this->group ." ";
+						
+		// $mode == 1 ¤Ï limit & offsetÌµ¤·						
+		if ( $mode != 1 ){
+			$this->sql .= $this->order . " " .$this->limit ." ". $this->offset;	
+		} elseif ($mode == 2) {
+			$this->sql .= $this->order;
+		}
+		return $this->sql;	
+	}
+
+		// ¸¡º÷ÍÑ
+	function addSearchStr($val) {
+		$return = sfManualEscape($val);
+		$return = "%" .$return. "%";
+		return $return;
+	}
+	
+	//-- ÈÏ°Ï¸¡º÷¡Ê¡û¡¡¢·¡¡¡û¡¡¤Þ¤Ç¡Ë
+	function selectRange($from, $to, $column) {
+
+		// ¤¢¤ëÃ±°Ì¤Î¤ß¸¡º÷($from = $to)
+		if(  $from == $to ) {
+			$this->setWhere( $column ." = ?" );
+			$return = array($from);
+		//¡¡¢·$to¤Þ¤Ç¸¡º÷
+		} elseif(  strlen($from) == 0 && strlen($to) > 0 ) {
+			$this->setWhere( $column ." <= ? "); 
+			$return = array($to);
+		//¡¡¢·$from°Ê¾å¤ò¸¡º÷
+		} elseif(  strlen($from) > 0 && strlen($to) == 0 ) {
+			$this->setWhere( $column ." >= ? ");
+			$return = array($from);
+		//¡¡$from¢·$to¤Î¸¡º÷
+		} else {
+			$this->setWhere( $column ."	BETWEEN ? AND ?" ); 
+			$return = array($from, $to);
+		}
+		return $return;
+	}
+
+	//--¡¡´ü´Ö¸¡º÷¡Ê¡ûÇ¯¡û·î¡ûÆü¤«¢·¡ûÇ¯¡û·î¡ûÆü¤Þ¤Ç¡Ë
+	function selectTermRange($from_year, $from_month, $from_day, $to_year, $to_month, $to_day, $column) {
+
+		// FROM
+		$date1 = $from_year . "/" . $from_month . "/" . $from_day;
+		
+		// TO
+		$date2 = $to_year . "/" . $to_month . "/" . $to_day;
+		
+		// ³«»Ï´ü´Ö¤À¤±»ØÄê¤Î¾ì¹ç
+		if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) &&	( $to_year == "" ) && ( $to_month == "" ) && ( $to_day == "" ) ) {
+			$this->setWhere( $column ." >= '" . $date1 . "'");
+		}
+
+		//¡¡³«»Ï¢·½ªÎ»
+		if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) && 
+			( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) {
+			$this->setWhere( $column ." >= '" . $date1 ."' AND ". $column . " < date('" . $date2 . "')+1" );
+		}
+
+		// ½ªÎ»´ü´Ö¤À¤±»ØÄê¤Î¾ì¹ç
+		if( ( $from_year == "" ) && ( $from_month == "" ) && ( $from_day == "" ) && ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) {
+			$this->setWhere( $column ." < date('" . $date2 . "')+1");
+		}
+		return $return;
+	}	
+
+	// checkbox¤Ê¤É¤ÇÆ±°ì¥«¥é¥àÆâ¤ÇÃ±°ì¡¢¤â¤·¤¯¤ÏÊ£¿ôÁªÂò»è¤¬Í­¤ë¾ì¹ç¡¡Îã: AND ( sex = xxx OR sex = xxx OR sex = xxx  ) AND ... 
+	function setItemTerm( $arr, $ItemStr ) {
+
+		foreach( $arr as $data ) {
+	
+			if( count( $arr ) > 1 ) {
+				if( ! is_null( $data ) ) $item .= $ItemStr . " = ? OR ";	
+			} else {
+				if( ! is_null( $data ) ) $item = $ItemStr . " = ?";	
+			}
+			$return[] = $data;
+		}
+
+		if( count( $arr ) > 1 )  $item = "( " . rtrim( $item, " OR " ) . " )";
+		$this->setWhere( $item );
+		return $return;
+	}
+
+	//¡¡NULLÃÍ¤¬É¬Í×¤Ê¾ì¹ç
+	function setItemTermWithNull( $arr, $ItemStr ) {
+
+		$item = " ${ItemStr} IS NULL ";
+		
+		if ( $arr ){
+			foreach( $arr as $data ) {	
+				if ($data != "ÉÔÌÀ") {
+					$item .= " OR ${ItemStr} = ?";
+					$return[] = $data;
+				}
+			}
+		}
+		
+	 	$item = "( ${item} ) ";
+		$this->setWhere( $item );
+		return $return;
+	}
+	// NULL¤â¤·¤¯¤Ï''¤Ç¸¡º÷¤¹¤ë¾ì¹ç
+	function setItemTermWithNullAndSpace( $arr, $ItemStr ) {
+		$count = count($arr);
+		$item = " ${ItemStr} IS NULL OR ${ItemStr} = '' ";
+		$i = 1;
+		if ( $arr ){
+			foreach( $arr as $data ) {	
+				if ($i == $count) break;
+				$item .= " OR ${ItemStr} = ?";	
+				$return[] = $data;
+				$i ++;
+			}
+		}
+	 	$item = "( ${item} ) ";
+		$this->setWhere( $item );
+		return $return;
+	}
+	
+
+
+	/* Ê£¿ô¤Î¥«¥é¥à¤ÇOR¤ÇÍ¥Àè¸¡º÷¤¹¤ë¾ì¹ç¡¡Îã¡§¡¡AND ( item_flag1 = xxx OR item_flag2 = xxx OR item_flag3 = xxx  ) AND ... 
+
+		ÇÛÎó¤Î¹½Â¤Îã¡¡
+		if ( $_POST['show_site1'] ) $arrShowsite_1 = array( "column" => "show_site1",
+															"value"  => $_POST['show_site1'] );
+
+	*/
+	function setWhereByOR( $arrWhere ){
+
+		$count = count( $arrWhere );
+
+		for( $i = 0; $i < $count; $i++ ) {
+
+			if( isset( $arrWhere[$i]["value"] ) ) $statement .= $arrWhere[$i]["column"] ." = '" . addslashes( $arrWhere[$i]["value"] ) ."' OR "  ;
+		}
+
+		$statement = "( " . rtrim( $statement, " OR " ) . " )";
+
+		if( $this->where ) {
+
+			$this->where .= " AND " . $statement;
+
+		} else {
+
+			$this->where = "WHERE " . $statement;
+		}
+	}
+
+	function setWhere($where){
+		if ($where != "") {		
+			if( $this->where ) {
+	
+				$this->where .= " AND " . $where;
+	
+			} else {
+	
+				$this->where = "WHERE " . $where;
+			}
+		}
+	}
+
+	function setOrder($order){
+		
+			$this->order =  "ORDER BY " . $order;
+		
+	}
+
+	function setGroup( $group ) {
+		
+		$this->group =  "GROUP BY " . $group;
+		
+	}
+
+	
+	function setLimitOffset( $limit, $offset ){
+
+		if ( is_numeric($limit) and is_numeric($offset) ){
+
+			$this->limit = " LIMIT " .$limit;
+			$this->offset = " OFFSET " .$offset;
+		}	
+	}
+	
+	function clearSql(){
+		$this->select = "";
+		$this->where = "";
+		$this->group = "";
+		$this->order = "";
+		$this->limit = "";
+		$this->offset = "";
+	}
+	
+	function setSelect($sql) {
+		$this->select = $sql;
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_Customer.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_Customer.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_Customer.php	(revision 1328)
@@ -0,0 +1,131 @@
+<?php
+/*  [Ì¾¾Î] SC_Customer
+ *  [³µÍ×] ²ñ°÷´ÉÍý¥¯¥é¥¹
+ */
+class SC_Customer {
+	
+	var $conn;
+	var $email;
+	var $customer_data;		// ²ñ°÷¾ðÊó   
+		
+	function SC_Customer( $conn = '', $email = '', $pass = '' ) {
+		// ¥»¥Ã¥·¥ç¥ó³«»Ï
+		/* startSession¤«¤é°ÜÆ° 2005/11/04 ÃæÀî */
+		sfDomainSessionStart();
+		
+		// DBÀÜÂ³¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+		$DB_class_name = "SC_DbConn";
+		if ( is_object($conn)){
+			if ( is_a($conn, $DB_class_name)){
+				// $conn¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë
+				$this->conn = $conn;
+			}
+		} else {
+			if (class_exists($DB_class_name)){
+				//$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë
+				$this->conn = new SC_DbConn();			
+			}
+		}
+			
+		if ( is_object($this->conn) ) { 
+			// Àµ¾ï¤ËDB¤ËÀÜÂ³¤Ç¤­¤ë
+			if ( $email ){
+				// email¤«¤é¸ÜµÒ¾ðÊó¤ò¼èÆÀ¤¹¤ë
+				// $this->setCustomerDataFromEmail( $email );
+			}
+		} else {
+			echo "DBÀÜÂ³¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤Ë¼ºÇÔ¤·¤Æ¤¤¤Þ¤¹";
+			exit;
+		}
+		
+		if ( strlen($email) > 0 && strlen($pass) > 0 ){
+			$this->getCustomerDataFromEmailPass( $email, $pass );
+		}
+	}
+	
+	function getCustomerDataFromEmailPass( $pass, $email ) {
+		// ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß
+		$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND delete = 0 AND status = 2";
+		$result = $this->conn->getAll($sql, array($email));
+		$data = $result[0];
+		
+		// ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ì¤Ð¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë¥»¥Ã¥È¤·¤Ætrue¤òÊÖ¤¹
+		if ( crypt($pass,$data['password'] ) == $data['password'] ){
+			$this->customer_data = $data;
+			$this->startSession();
+			return true;
+		}
+		return false;
+	}
+	
+	// ¥Ñ¥¹¥ï¡¼¥É¤ò³ÎÇ§¤»¤º¤Ë¥í¥°¥¤¥ó
+	function setLogin($email) {
+		// ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß
+		$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND delete = 0 AND status = 2";
+		$result = $this->conn->getAll($sql, array($email));
+		$data = $result[0];
+		$this->customer_data = $data;
+		$this->startSession();
+	}
+	
+	// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾ðÊó¤Ë¹¹¿·¤¹¤ë
+	function updateSession() {
+		$sql = "SELECT * FROM dtb_customer WHERE customer_id = ? AND delete = 0";
+		$customer_id = $this->getValue('customer_id');
+		$arrRet = $this->conn->getAll($sql, array($customer_id));
+		$this->customer_data = $arrRet[0];
+		$_SESSION['customer'] = $this->customer_data;
+	}
+		
+	// ¥í¥°¥¤¥ó¾ðÊó¤ò¥»¥Ã¥·¥ç¥ó¤ËÅÐÏ¿¤·¡¢¥í¥°¤Ë½ñ¤­¹þ¤à
+	function startSession() {
+		sfDomainSessionStart();
+		$_SESSION['customer'] = $this->customer_data;
+		// ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊÝÂ¸
+		gfPrintLog("access : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH );
+	}
+
+	// ¥í¥°¥¢¥¦¥È¡¡$_SESSION['customer']¤ò²òÊü¤·¡¢¥í¥°¤Ë½ñ¤­¹þ¤à
+	function EndSession() {
+		// $_SESSION['customer']¤Î²òÊü
+		unset($_SESSION['customer']);
+		// ¥í¥°¤Ëµ­Ï¿¤¹¤ë
+		gfPrintLog("logout : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH );
+	}
+	
+	// ¥í¥°¥¤¥ó¤ËÀ®¸ù¤·¤Æ¤¤¤ë¤«È½Äê¤¹¤ë¡£
+	function isLoginSuccess() {
+		// ¥í¥°¥¤¥ó»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÈDB¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬°ìÃ×¤·¤Æ¤¤¤ë¾ì¹ç
+		if(sfIsInt($_SESSION['customer']['customer_id'])) {
+			$objQuery = new SC_Query();
+			$email = $objQuery->get("dtb_customer", "email", "customer_id = ?", array($_SESSION['customer']['customer_id']));
+			if($email == $_SESSION['customer']['email']) {
+				return true;
+			}
+		}
+		return false;
+	}
+		
+	// ¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ
+	function getValue($keyname) {
+		return $_SESSION['customer'][$keyname];
+	}
+	
+	// ¥Ñ¥é¥á¡¼¥¿¤Î¥»¥Ã¥È
+	function setValue($keyname, $val) {
+		$_SESSION['customer'][$keyname] = $val;
+	}
+	
+	// ÃÂÀ¸Æü·î¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎÈ½Äê
+	function isBirthMonth() {
+		$arrRet = split("[- :/]", $_SESSION['customer']['birth']);
+		$birth_month = intval($arrRet[1]);
+		$now_month = intval(date("m"));
+		
+		if($birth_month == $now_month) {
+			return true;
+		}
+		return false;
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_DbConn.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_DbConn.php	(revision 3524)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_DbConn.php	(revision 3524)
@@ -0,0 +1,160 @@
+<?php
+$current_dir = realpath(dirname(__FILE__));
+require_once($current_dir . "/../module/DB.php");
+
+$objDbConn = "";
+
+class SC_DbConn{
+
+	var $conn;
+	var $result; 
+	var $includePath;
+	var $error_mail_to;
+	var $error_mail_title;
+	var $dsn;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_DbConn($dsn = ""){
+		global $objDbConn;
+		// ´û¤ËÀÜÂ³¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤ÏÀÜÂ³¤·¤Ê¤¤
+		if(!isset($objDbConn->connection)) {
+			if($dsn != "") {
+				$objDbConn = DB::connect($dsn);
+				$this->dsn = $dsn;
+			} else {
+				$objDbConn = DB::connect(DEFAULT_DSN);
+				$this->dsn = DEFAULT_DSN;
+			}
+		}
+		$this->conn = $objDbConn;
+		$this->error_mail_to = DB_ERROR_MAIL_TO;
+		$this->error_mail_title = DB_ERROR_MAIL_SUBJECT;
+	}
+	
+	// ¥¯¥¨¥ê¤Î¼Â¹Ô
+	function query($n ,$arr = "", $ignore_err = false){
+		if ( $arr ) {
+			$result = $this->conn->query($n, $arr);	
+		} else {
+			$result = $this->conn->query($n);
+		}
+	
+		if ($this->conn->isError($result) && !$ignore_err){
+			$this->send_err_mail ($result, $n);
+		}
+		
+		$this->result = $result;
+		return $this->result;
+	}
+
+	// °ì·ï¤Î¤ß¼èÆÀ
+	function getOne($n, $arr = ""){
+		
+		if ( $arr ) {
+			$result = $this->conn->getOne($n, $arr);
+		} else {
+			$result = $this->conn->getOne($n);
+		}		
+		if ($this->conn->isError($result)){
+			$this->send_err_mail ($result ,$n);
+		}
+		$this->result = $result;
+		return $this->result;
+	}
+	
+	function getRow($n, $arr = ""){
+		
+		if ( $arr ) {
+			$result = $this->conn->getRow($n, $arr);
+		} else {
+			$result = $this->conn->getRow($n);
+		}		
+		if ($this->conn->isError($result)){
+			$this->send_err_mail ($result ,$n);
+		}
+		$this->result = $result;
+		return $this->result;
+	}
+
+	// SELECTÊ¸¤Î¼Â¹Ô·ë²Ì¤òÁ´¤Æ¼èÆÀ
+	function getAll($n, $arr = ""){
+		if(PEAR::isError($this->conn)) {
+			sfErrorHeader("DB¤Ø¤ÎÀÜÂ³¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£:" . $this->dsn);
+			return 0;
+		}		
+		
+		if ( $arr ){
+			$result = $this->conn->getAll($n, $arr, DB_FETCHMODE_ASSOC);
+		} else {
+			$result = $this->conn->getAll($n, DB_FETCHMODE_ASSOC);
+		}
+		
+		if ($this->conn->isError($result)){
+			$this->send_err_mail ($result, $n);
+		}
+		$this->result = $result;
+		
+		return $this->result;
+	}	
+	
+	function autoExecute($table_name, $fields_values, $sql_where = null){
+	
+		if ( $sql_where ) {
+			$result = $this->conn->autoExecute( $table_name, $fields_values, DB_AUTOQUERY_UPDATE, $sql_where);
+		} else {
+			$result = $this->conn->autoExecute( $table_name, $fields_values, DB_AUTOQUERY_INSERT);
+		}
+		
+		if ($this->conn->isError($result)){
+			$this->send_err_mail ($result, $n);
+		}
+		$this->result = $result;
+		return $this->result;
+	}
+	
+	
+	function prepare($n){
+		global $sql;
+		$sql = $n;		
+		$result = $this->conn->prepare($n);
+		$this->result = $result;
+		return $this->result;
+	}
+	
+	function execute($n, $obj){
+		global $sql;
+		$sql = $n;
+		$result = $this->conn->execute($n, $obj);
+		$this->result = $result;
+		return $this->result;
+	}	
+	
+	function reset(){
+		$this->conn->disconnect();
+	}
+
+	function send_err_mail( $result, $sql ){
+		
+		if ($_SERVER['HTTPS'] == "on") {
+			$url = "https://";
+		} else {
+			$url = "http://";
+		}
+		$url.= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+		
+		$errmsg = $url."\n\n";
+		$errmsg.= $sql . "\n";
+		$errmsg.= $result->message . "\n\n";
+		$errmsg.= $result->userinfo . "\n\n";
+		print_r($errmsg);
+		/*
+		ob_start();
+		$errmsg .= ob_get_contents();
+		ob_end_clean();	
+		*/
+		//mb_send_mail($this->error_mail_to, $this->error_mail_title, "${errmsg}\n".date("Y/m/d H:i:s"));		
+		exit();
+	}
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/GC_Thumb.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/GC_Thumb.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/GC_Thumb.php	(revision 1328)
@@ -0,0 +1,58 @@
+<?php
+require_once("../lib/thumb.php");
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] GC_Thumb
+ * [³µÍ×] ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë²Ã¹©¥¯¥é¥¹(thumb.php¤È¥»¥Ã¥È¤Ç»ÈÍÑ¤¹¤ë)
+ * [°ú¿ô] -
+ * [ÌáÃÍ] -
+ * [°ÍÂ¸] thumb.php
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+
+Class GC_Thumb {
+
+	var $tempPath;
+
+	function GC_Thumb($tempFilePath = "") {
+		$this->tempPath	 = $_SERVER['DOCUMENT_ROOT'] . $tempFilePath;
+	}
+
+	//--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®(¥µ¥à¥Í¥¤¥ë²èÁüÀ¸À®ÍÑ)
+	function makeImageTempFile($fileName, $phpFileName, $max_width,$max_height) {
+		// °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
+		$mainname = uniqid("").".";
+		// ³ÈÄ¥»Ò°Ê³°¤òÃÖ¤­´¹¤¨¤ë¡£
+		$newFileName = ereg_replace("^.*\.",$mainname,$fileName);
+		$result  = MakeThumb( $phpFileName, $this->tempPath, $max_width, $max_height, $newFileName );
+		return $newFileName;
+	}
+
+	//--- °ì»þ¥Õ¥¡¥¤¥ëÀ¸À®
+	function makeTempFile($fileName, $phpFileName) {
+		$newFileNname = str_replace("'", "¡Ç", $fileName );
+		$newFileNname = date("siU") . $newFileNname;
+		copy( $phpFileName, $this->tempPath . $newFileNname );
+		return $newFileNname;	
+	}
+
+	//--- ¥Õ¥¡¥¤¥ë¤ò»ØÄêÊÝÂ¸DIR¤Ø°ÜÆ°
+	function fileMove($fileName, $dirName) {
+		if(copy( $this->tempPath . $fileName , $_SERVER['DOCUMENT_ROOT'] . $dirName . $fileName)) {
+			unlink( $this->tempPath . $fileName );
+		}
+	}
+
+	//---- °ì»þDIR¤Î¥Õ¥¡¥¤¥ë¤ò°ì³çºï½ü	
+	function execDeleteTempFile() {
+		chdir( $this->tempPath );
+		$delFile = glob( "*.*" );
+		if( is_array($delFile) ) foreach( $delFile as $val ) @unlink( $val );
+	}
+
+	//---- »ØÄê¥Õ¥¡¥¤¥ë¤òºï½ü	
+	function fileDelete($fileName, $dirName) {
+		unlink( $_SERVER['DOCUMENT_ROOT'] . $dirName . $fileName );
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_Query.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_Query.php	(revision 3686)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_Query.php	(revision 3686)
@@ -0,0 +1,356 @@
+<?php
+class SC_Query {
+	var $option;
+	var $where;
+	var $conn;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_Query($dsn = "") {
+		$this->conn = new SC_DBconn($dsn);
+		$this->where = "";
+		return $this->conn;
+	}
+	
+	// COUNTÊ¸¤Î¼Â¹Ô
+	function count($table, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT COUNT(*) FROM $table";
+		} else {
+			$sqlse = "SELECT COUNT(*) FROM $table WHERE $where";
+		}
+		// ¥«¥¦¥ó¥ÈÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sqlse, $arrval);
+		return $ret;
+	}
+	
+	function select($col, $table, $where = "", $arrval = array()){
+		$sqlse = $this->getsql($col, $table, $where);
+		$ret = $this->conn->getAll($sqlse, $arrval);
+		return $ret;
+	}
+
+	function getLastQuery($disp = true) {
+		$sql = $this->conn->conn->last_query;
+		if($disp) { 
+			print($sql.";<br />\n");
+		}
+		return $sql;
+	}
+
+	function commit() {
+		$this->conn->query("COMMIT");
+	}
+	
+	function begin() {
+		$this->conn->query("BEGIN");
+	}
+	
+	function rollback() {
+		$this->conn->query("ROLLBACK");
+	}
+	
+	function exec($str, $arrval = array()) {
+		$this->conn->query($str, $arrval);
+	}
+	
+	function autoselect($col, $table, $arrwhere = array(), $arrcon = array()) {
+		$strw = "";			
+		$find = false;
+		foreach ($arrwhere as $key => $val) {
+			if(strlen($val) > 0) {
+				if(strlen($strw) <= 0) {
+					$strw .= $key ." LIKE ?";
+				} else if(strlen($arrcon[$key]) > 0) {
+					$strw .= " ". $arrcon[$key]. " " . $key ." LIKE ?";
+				} else {
+					$strw .= " AND " . $key ." LIKE ?";
+				}
+				
+				$arrval[] = $val;
+			}
+		}
+		
+		if(strlen($strw) > 0) {
+			$sqlse = "SELECT $col FROM $table WHERE $strw ".$this->option;
+		} else {
+			$sqlse = "SELECT $col FROM $table ".$this->option;
+		}
+		$ret = $this->conn->getAll($sqlse, $arrval);
+		return $ret;
+	}
+	
+	function getall($sql, $arrval = array()) {
+		$ret = $this->conn->getAll($sql, $arrval);
+		return $ret;
+	}
+
+	function getsql($col, $table, $where) {
+		if($where != "") {
+			// °ú¿ô¤Î$where¤òÍ¥Àè¤·¤Æ¼Â¹Ô¤¹¤ë¡£
+			$sqlse = "SELECT $col FROM $table WHERE $where " . $this->groupby . " " . $this->order . " " . $this->option;
+		} else {
+			if($this->where != "") {
+					$sqlse = "SELECT $col FROM $table WHERE $this->where " . $this->groupby . " " . $this->order . " " . $this->option;
+				} else {
+					$sqlse = "SELECT $col FROM $table " . $this->groupby . " " . $this->order . " " . $this->option;
+			}
+		}
+		return $sqlse;
+	}
+			
+	function setoption($str) {
+		$this->option = $str;
+	}
+	
+	function setlimitoffset($limit, $offset = 0) {
+		if (is_numeric($limit) && is_numeric($offset)){
+			$this->option.= " LIMIT " . $limit;
+			$this->option.= " OFFSET " . $offset;
+		}
+	}
+	
+	function setgroupby($str) {
+		$this->groupby = "GROUP BY " . $str;
+	}
+	
+	function andwhere($str) {
+		if($this->where != "") {
+			$this->where .= " AND " . $str;
+		} else {
+			$this->where = $str;
+		}
+	}
+	
+	function orwhere($str) {
+		if($this->where != "") {
+			$this->where .= " OR " . $str;
+		} else {
+			$this->where = $str;
+		}
+	}
+		
+	function setwhere($str) {
+		$this->where = $str;
+	}
+	
+	function setorder($str) {
+		$this->order = "ORDER BY " . $str;
+	}
+	
+		
+	function setlimit($limit){
+		if ( is_numeric($limit)){
+			$this->option = " LIMIT " .$limit;
+		}	
+	}
+	
+	function setoffset($offset) {
+		if ( is_numeric($offset)){
+			$this->offset = " OFFSET " .$offset;
+		}	
+	}
+	
+	
+	// INSERTÊ¸¤ÎÀ¸À®¡¦¼Â¹Ô
+	// $table	:¥Æ¡¼¥Ö¥ëÌ¾
+	// $sqlval	:ÎóÌ¾ => ÃÍ¤Î³ÊÇ¼¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó
+	function insert($table, $sqlval) {
+		$strcol = '';
+		$strval = '';
+		$find = false;
+		foreach ($sqlval as $key => $val) {
+				$strcol .= $key . ',';
+				if(eregi("^Now\(\)$", $val)) {
+					$strval .= 'Now(),';
+				} else {
+					$strval .= '?,';
+					if($val != ""){
+						$arrval[] = $val;
+					} else {
+						$arrval[] = NULL;
+					}
+				}
+				$find = true;
+		}
+		if(!$find) {
+			return false;
+		}
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strcol = ereg_replace(",$","",$strcol);
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strval = ereg_replace(",$","",$strval);
+		$sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")";
+		
+		// INSERTÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->query($sqlin, $arrval);
+		
+		return $ret;		
+	}
+	
+		// INSERTÊ¸¤ÎÀ¸À®¡¦¼Â¹Ô
+	// $table	:¥Æ¡¼¥Ö¥ëÌ¾
+	// $sqlval	:ÎóÌ¾ => ÃÍ¤Î³ÊÇ¼¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó
+	function fast_insert($table, $sqlval) {
+		$strcol = '';
+		$strval = '';
+		$find = false;
+		
+		foreach ($sqlval as $key => $val) {
+				$strcol .= $key . ',';
+				if($val != ""){
+					$eval = pg_escape_string($val);
+					$strval .= "'$eval',";
+				} else {
+					$strval .= "NULL,";
+				}
+				$find = true;
+		}
+		if(!$find) {
+			return false;
+		}
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strcol = ereg_replace(",$","",$strcol);
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strval = ereg_replace(",$","",$strval);
+		$sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")";
+		
+		// INSERTÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->query($sqlin);
+		
+		return $ret;		
+	}
+	
+	
+	// UPDATEÊ¸¤ÎÀ¸À®¡¦¼Â¹Ô
+	// $table	:¥Æ¡¼¥Ö¥ëÌ¾
+	// $sqlval	:ÎóÌ¾ => ÃÍ¤Î³ÊÇ¼¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó
+	// $where	:WHEREÊ¸»úÎó
+	function update($table, $sqlval, $where = "", $arradd = "", $addcol = "") {
+		$strcol = '';
+		$strval = '';
+		$find = false;
+		foreach ($sqlval as $key => $val) {
+			if(eregi("^Now\(\)$", $val)) {
+				$strcol .= $key . '= Now(),';
+			} else {
+				$strcol .= $key . '= ?,';
+				if($val != ""){
+					$arrval[] = $val;
+				} else {
+					$arrval[] = NULL;
+				}
+			}
+			$find = true;
+		}
+		if(!$find) {
+			return false;
+		}
+		
+		if($addcol != "") {
+			foreach($addcol as $key => $val) {
+				$strcol .= "$key = $val,";
+			}
+		}
+				
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strcol = ereg_replace(",$","",$strcol);
+		// Ê¸Ëö¤Î","¤òºï½ü
+		$strval = ereg_replace(",$","",$strval);
+		
+		if($where != "") {
+			$sqlup = "UPDATE $table SET $strcol WHERE $where";
+		} else {
+			$sqlup = "UPDATE $table SET $strcol";
+		}
+		
+		if(is_array($arradd)) {
+			// ¥×¥ì¡¼¥¹¥Û¥ë¥À¡¼ÍÑ¤ËÇÛÎó¤òÄÉ²Ã
+			foreach($arradd as $val) {
+				$arrval[] = $val;
+			}
+		}
+		
+		// INSERTÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->query($sqlup, $arrval);
+		return $ret;		
+	}
+
+	// MAXÊ¸¤Î¼Â¹Ô
+	function max($table, $col, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT MAX($col) FROM $table";
+		} else {
+			$sqlse = "SELECT MAX($col) FROM $table WHERE $where";
+		}
+		// MAXÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sqlse, $arrval);
+		return $ret;
+	}
+	
+	// MINÊ¸¤Î¼Â¹Ô
+	function min($table, $col, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT MIN($col) FROM $table";
+		} else {
+			$sqlse = "SELECT MIN($col) FROM $table WHERE $where";
+		}
+		// MINÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sqlse, $arrval);
+		return $ret;
+	}
+	
+	// ÆÃÄê¤Î¥«¥é¥à¤ÎÃÍ¤ò¼èÆÀ
+	function get($table, $col, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT $col FROM $table";
+		} else {
+			$sqlse = "SELECT $col FROM $table WHERE $where";
+		}
+		// SQLÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sqlse, $arrval);
+		return $ret;
+	}
+	
+	function getone($sql, $arrval = array()) {
+		// SQLÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getOne($sql, $arrval);
+		return $ret;
+		
+	}
+		
+	// °ì¹Ô¤ò¼èÆÀ
+	function getrow($table, $col, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlse = "SELECT $col FROM $table";
+		} else {
+			$sqlse = "SELECT $col FROM $table WHERE $where";
+		}
+		// SQLÊ¸¤Î¼Â¹Ô
+		$ret = $this->conn->getRow($sqlse, $arrval);
+		
+		return $ret;
+	}
+		
+	// ¥ì¥³¡¼¥É¤Îºï½ü
+	function delete($table, $where = "", $arrval = array()) {
+		if(strlen($where) <= 0) {
+			$sqlde = "DELETE FROM $table";
+		} else {
+			$sqlde = "DELETE FROM $table WHERE $where";
+		}
+		$ret = $this->conn->query($sqlde, $arrval);
+		return $ret;
+	}
+	
+	function nextval($table, $colname) {
+		$seqtable = $table . "_" . $colname . "_seq";
+		$ret = $this->conn->getOne("SELECT NEXTVAL('$seqtable')");
+		return $ret;
+	}
+	
+	function query($n ,$arr = "", $ignore_err = false){
+		$result = $this->conn->query($n, $arr, $ignore_err);
+		return $result;
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_SiteSession.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_SiteSession.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_SiteSession.php	(revision 1328)
@@ -0,0 +1,64 @@
+<?php
+/* ¥«¡¼¥È¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_SiteSession {
+	/* ¥³¥ó¥¹¥È¥é¥¯¥¿ */
+	function SC_SiteSession() {
+		sfDomainSessionStart();
+		// Á°¥Ú¡¼¥¸¤Ç¤ÎÅÐÏ¿À®¸ùÈ½Äê¤ò°ú¤­·Ñ¤°
+		$_SESSION['site']['pre_regist_success'] = $_SESSION['site']['regist_success'];
+		$_SESSION['site']['regist_success'] = false;
+		$_SESSION['site']['pre_page'] = $_SESSION['site']['now_page'];
+		$_SESSION['site']['now_page'] = $_SERVER['PHP_SELF'];
+	}
+	
+	/* Á°¥Ú¡¼¥¸¤¬ÀµÅö¤Ç¤¢¤ë¤«¤ÎÈ½Äê */
+	function isPrePage() {
+		if($_SESSION['site']['pre_page'] != "" && $_SESSION['site']['now_page'] != "") {
+			if($_SESSION['site']['pre_regist_success'] || $_SESSION['site']['pre_page'] == $_SESSION['site']['now_page']) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	function setNowPage($path) {
+		$_SESSION['site']['now_page'] = $path;
+	}
+	
+	/* ÃÍ¤Î¼èÆÀ */
+	function getValue($keyname) {
+		return $_SESSION['site'][$keyname];
+	}
+	
+	/* ¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ */
+	function getUniqId() {
+		return $_SESSION['site']['uniqid'];
+	}
+	
+	/* ¥æ¥Ë¡¼¥¯ID¤Î¥»¥Ã¥È */
+	function setUniqId() {
+		// Í½Â¬¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¥é¥ó¥À¥àÊ¸»úÎó¤òÉÕÍ¿¤¹¤ë¡£
+		$_SESSION['site']['uniqid'] = sfGetUniqRandomId();
+	}
+	
+	/* ¥æ¥Ë¡¼¥¯ID¤Î¥Á¥§¥Ã¥¯ */
+	function checkUniqId() {
+		if($_POST['uniqid'] != "") {
+			if($_POST['uniqid'] != $_SESSION['site']['uniqid']) {
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	/* ¥æ¥Ë¡¼¥¯ID¤Î²ò½ü */
+	function unsetUniqId() {
+		$_SESSION['site']['uniqid'] = "";
+	}
+	
+	/* ÅÐÏ¿À®¸ù¤òµ­Ï¿ */
+	function setRegistFlag() {
+		$_SESSION['site']['regist_success'] = true;
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_Cookie.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_Cookie.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_Cookie.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+/*¡¡Æü»þÉ½¼¨ÍÑ¥¯¥é¥¹ */
+class SC_Cookie {
+	
+	var $expire;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_Cookie($day = 365) {
+		// Í­¸ú´ü¸Â
+		$this->expire = time() + ($day * 24 * 3600);
+	}
+	
+	// ¥¯¥Ã¥­¡¼½ñ¤­¹þ¤ß
+	function setCookie($key, $val) {
+		setcookie($key, $val, $this->expire, "/", DOMAIN_NAME);
+	}
+	
+	// ¥¯¥Ã¥­¡¼¼èÆÀ
+	function getCookie($key) {
+		return $_COOKIE[$key];
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_Pdf.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_Pdf.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_Pdf.php	(revision 1328)
@@ -0,0 +1,529 @@
+<?php
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] GC_Pdf
+ * [³µÍ×] Pdf¥Õ¥¡¥¤¥ë¤òÉ½¼¨¤¹¤ë¡£(PDFLibÉ¬¿Ü)
+ *----------------------------------------------------------------------
+ */
+
+// ¥°¥ê¥Ã¥É¤ÈÊ¸»ú¤Î´Ö³Ö 
+define("GRID_SPACE", 4);
+
+class SC_Pdf {
+	var $arrText;
+	var $arrImage;
+	var $license_key;
+	var $block_option;
+	var $src_code;
+	var $dst_code;
+	var $pdiwarning;
+	var $pdfpath;
+	var $page_close;
+			
+	function SC_Pdf($width = 595, $height = 842, $fontsize = 10) {
+		$this->license_key = "B600602-010400-714251-5851C1";
+		$this->src_code = "EUC-JP";
+		// UTF-8¤Ç¤Ê¤¤¤È¥Ö¥í¥Ã¥¯Æâ¤Ç²þ¹Ô¤Ç¤­¤Ê¤¤¡£
+		$this->dst_code = "UTF-8";
+		// PDF BLOCK¤Î¥×¥í¥Ñ¥Æ¥£
+		$this->block_option = "encoding=UniJIS-UCS2-H textformat=utf8 fontname=HeiseiMin-W3 textflow=true";
+		// ·Ù¹ðÉ½¼¨
+		$this->pdiwarning = "true";	
+		// ¥Ú¡¼¥¸¥µ¥¤¥ºÀßÄê
+		$this->width = $width;
+		$this->height = $height;
+		// PDF½é´ü²½
+		$this->pdf = PDF_new();
+		PDF_set_parameter($this->pdf, "license", $this->license_key);
+		PDF_set_parameter($this->pdf, "pdiwarning", $this->pdiwarning);
+		// ¥É¥­¥å¥á¥ó¥È³«»Ï
+		PDF_begin_document($this->pdf, NULL, NULL);
+		// ¥Ú¡¼¥¸¤Î¾õÂÖ
+		$this->page_open = false;
+		// ¥Æ¡¼¥Ö¥ë¤Î¿§ÀßÄê
+		$this->setTableColor();
+		// ¥Õ¥©¥ó¥È¥µ¥¤¥º¤ÎÀßÄê
+		$this->fontsize = $fontsize;
+		// ¥°¥ê¥Ã¥ÉÉÁ²è¤ÎÆÃ¼ì»ØÄê
+		$this->arrLines = array();
+		// ¥Æ¡¼¥Ö¥ë¥¿¥¤¥È¥ë¤Î¥¹¥¿¥¤¥ë
+		$this->arrHeaderColSize = array();
+		$this->arrHeaderAlign = array();
+		// ¥Æ¡¼¥Ö¥ëÊäÀµÃÍ
+		$this->table_left = 0;
+		// ¥¿¥¤¥È¥ë¹Ô¤Î½ÐÎÏ
+		$this->title_enable = true;
+		// ¥°¥ê¥Ã¥É¤Î½ÐÎÏ
+		$this->grid_enable = true;
+	}
+	
+	// ¥¿¥¤¥È¥ë¤ò½ÐÎÏ¤¹¤ë¤«ÈÝ¤«
+	function setTitleEnable($flag) {
+		$this->title_enable = $flag;
+	}
+	
+	// ¥°¥ê¥Ã¥É¤ò½ÐÎÏ¤¹¤ë¤«ÈÝ¤«
+	function setGridEnable($flag) {
+		$this->grid_enable = $flag;
+	}
+		
+		
+	// ¥­¡¼¡§¥Ö¥í¥Ã¥¯Ì¾¡¢ÃÍ¡§É½¼¨¥Æ¥­¥¹¥È¤Î¥Ï¥Ã¥·¥åÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë¡£
+	function setTextBlock($list) {
+		unset($this->arrText);
+		$this->arrText[] = $list;
+	}
+	
+	// ¥­¡¼¡§¥Ö¥í¥Ã¥¯Ì¾¡¢ÃÍ¡§¥Õ¥¡¥¤¥ë¥Ñ¥¹¤Î¥Ï¥Ã¥·¥åÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë¡£
+	// ¢¨¥Ñ¥¹¤Ï¥É¥­¥å¥á¥ó¥È¥ë¡¼¥È°Ê²¼
+	function setImageBlock($list) {
+		unset($this->arrImage);
+		$this->arrImage[] = $list;
+	}
+	
+	// É½¼¨ÇØ·Ê¤È¤Ê¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¥Ñ¥¹
+	// ¢¨¥Ñ¥¹¤Ï¥É¥­¥å¥á¥ó¥È¥ë¡¼¥È°Ê²¼
+	function setTemplate($pdfpath) {
+		if(file_exists($pdfpath)) {
+			$this->pdfpath = $pdfpath;
+		} else {
+			print("»ØÄê¤·¤¿PDF¥Æ¥ó¥×¥ì¡¼¥È¤ÏÂ¸ºß¤·¤Þ¤»¤ó¡§".$pdfpath);
+			exit;
+		}
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë°ÌÃÖÊäÀµÃÍ
+	function setTableLeft($table_left) {
+		$this->table_left = $table_left;
+	}
+	
+	// ¥°¥ê¥Ã¥ÉÉÁ²è¤ÎÆÃ¼ì»ØÄê
+	function setGridLines($list) {
+		$this->arrLines = $list;
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¥¿¥¤¥È¥ë¤Î¥¹¥¿¥¤¥ëÀßÄê
+	function setTableHeaderStyle($arrColSize, $arrAlign) {
+		$this->arrHeaderColSize = $arrColSize;
+		$this->arrHeaderAlign = $arrAlign;
+	}
+	
+	// ¥Ö¥í¥Ã¥¯¥Ç¡¼¥¿¤Î½ñ¤­¹þ¤ß(close¤¹¤ë¤È¼¡²ó¿·µ¬¥Ú¡¼¥¸)
+	function writeBlock() {
+		// ¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤¹¤ë
+		if(!file_exists($this->pdfpath)) {
+			return;
+		}
+		// ´ûÂ¸PDF¤Î¥É¥­¥å¥á¥ó¥È¤ò¼èÆÀ
+		$doc = pdf_open_pdi($this->pdf, $this->pdfpath, NULL, 0 );
+		// ´ûÂ¸PDF¤Î¥É¥­¥å¥á¥ó¥È¤«¤é»ØÄê¥Ú¡¼¥¸¤ò¼èÆÀ
+		$page = pdf_open_pdi_page($this->pdf, $doc, 1, NULL );
+		// ¥Ú¡¼¥¸¤ò³«¤¯
+		$this->openPage();
+		
+		// ´ûÂ¸PDF¤Î¥Ú¡¼¥¸¤ò³ä¤êÅö¤Æ¤ë
+		PDF_fit_pdi_page($this->pdf, $page, 0, 0, "adjustpage");
+		
+		// ¥Æ¥­¥¹¥È¥Ö¥í¥Ã¥¯¤Î½ñ¤­¹þ¤ß
+		$max = count($this->arrText);
+		for($i = 0;$i < $max; $i++) {
+			foreach($this->arrText[$i] as $key => $val) {
+				if($val != "") {
+					// Ê¸»ú¥³¡¼¥É¤ÎÊÑ´¹
+					mb_convert_variables($this->dst_code, $this->src_code, $val);
+					// ½ñ¤­¹þ¤ß
+					$ret = PDF_fill_textblock($this->pdf, $page, $key, $val, $this->block_option);
+				}
+			}
+		}
+		
+		// ¥¤¥á¡¼¥¸¥Ö¥í¥Ã¥¯¤Î½ñ¤­¹þ¤ß
+		$max = count($this->arrImage);
+		for($i = 0;$i < $max; $i++) {
+			foreach($this->arrImage[$i] as $key => $val) {
+				if($val != "") {
+					$img = PDF_load_image($this->pdf, "auto", $val, NULL );
+					$ret = PDF_fill_imageblock($this->pdf, $page, $key, $img, NULL);
+				}
+			}
+		}
+		
+		// ³ä¤êÅö¤Æ¤¿¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+		PDF_close_pdi_page($this->pdf, $page);
+		// ³ä¤êÅö¤Æ¤¿¥É¥­¥å¥á¥ó¥È¤òÊÄ¤¸¤ë
+		PDF_close_pdi($this->pdf, $doc);
+	}
+	
+	// ¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+	function closePage() {
+		if($this->page_open) {
+			// ¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+			PDF_end_page_ext($this->pdf, NULL);
+			$this->page_open = false;
+		}		
+	}
+	
+	// ¥Ú¡¼¥¸¤ò³«¤¯
+	function openPage() {
+		if(!$this->page_open) {
+			// ¿·¤·¤¤¥Ú¡¼¥¸¤ò³«¤¯	
+			PDF_begin_page_ext($this->pdf, $this->width, $this->height, NULL);
+			$this->page_open = true;
+		}
+	}
+	
+	// ¿·¤·¤¤¥Ú¡¼¥¸¤ò³«¤¯
+	function newPage() {
+		PDF_end_page_ext($this->pdf, NULL);
+		PDF_begin_page_ext($this->pdf, $this->width, $this->height, NULL);
+	}
+	
+	// ¥¢¥¯¥Æ¥£¥Ö¤Ê¥Ú¡¼¥¸¤Î¥µ¥¤¥º¤ò¼èÆÀ¤¹¤ë
+	function getSize() {
+		$this->openPage();
+		$x = PDF_get_value($this->pdf, 'pagewidth', 0);
+		$y = PDF_get_value($this->pdf, 'pageheight', 0);
+		return array($x, $y);
+	}
+	
+	// ºÂÉ¸¤òÆþ¤ìÂØ¤¨¤Æ¼èÆÀ¤¹¤ë(º¸²¼(0,0)¤òº¸¾å(0,0)¤ËÊÑ´¹)
+	function posTopDown($x, $y) {
+		$width = 0;
+		$height = 0;
+		list($width, $height) = $this->getSize();
+		// xºÂÉ¸¤Ï¡¢ÊÑ¹¹¤ÎÉ¬Í×¤Ê¤·
+		$pdf_x = $x;
+		$pdf_y = $height - $y;
+		return array($pdf_x, $pdf_y);
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¥«¥é¡¼¤ÎÀßÄê
+	function setTableColor($frame_color = "000000", $title_color = "F0F0F0", $line_color = "D1DEFE", $last_color = "FDCBFE") {
+		$this->frame_color = $frame_color;
+		$this->title_color = $title_color;
+		$this->line_color = $line_color;
+		$this->last_color = $last_color;
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¤Î¥°¥ê¥Ã¥É¤òÉ½¼¨¤¹¤ë¡£
+	function writeGrid($x, $y, $arrCol, $line_max, $last_color_flg = true) {
+		// ¥Æ¡¼¥Ö¥ëÉý
+		$max = count($arrCol);
+		$width = 0;
+		for($i = 0; $i < $max; $i++) {
+			$width += $arrCol[$i];
+		}
+		
+		if($this->title_enable) { 
+			// ¥¿¥¤¥È¥ë¥°¥ê¥Ã¥ÉÉÁ²è
+			$this->writeFrameRect($x, $y + GRID_SPACE, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->title_color, $this->frame_color);
+		}
+		
+		// ¥°¥ê¥Ã¥ÉÆÃ¼ì»ØÄê¤¢¤ê
+		if(count($this->arrLines) > 0) {
+			$count = count($this->arrLines);
+			$pos = 0;
+			for($i = 0; $i < $count; $i++) {
+				if(($i % 2) != 0) {
+					// ¹Ô¤Î´Ö³Ö
+					$down = ($pos + 1) * $this->fontsize * 1.5;
+					// ÉÁ²è¤¹¤ë½ÄÉý¤òµá¤á¤ë
+					$height = ($this->fontsize + GRID_SPACE) * $this->arrLines[$i] + ($this->arrLines[$i] - 1);
+					// ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è
+					$this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $height, $this->line_color);
+				}
+				$pos += $this->arrLines[$i];	
+			}						
+		} else {
+			for($i = 1; $i <= $line_max; $i++) {
+				if(($i % 2) == 0) {
+					// ¹Ô¤Î´Ö³Ö
+					$down = $i * $this->fontsize * 1.5;
+					// ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è
+					$this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->line_color);
+				}
+			}
+			// ºÇ½ª¹Ô¤Ë¿§¤ò¤Ä¤±¤ë¾ì¹ç
+			if($last_color_flg) {
+				// ¹Ô¤Î´Ö³Ö
+				$down = $line_max * $this->fontsize * 1.5;
+				// ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è
+				$this->writeRect($x, $y + GRID_SPACE + $down, $width + GRID_SPACE, $this->fontsize + GRID_SPACE, $this->last_color);
+			}
+		}
+	}
+	
+	// ¥°¥ê¥Ã¥ÉÍÑ¤Î¥¢¥ó¥À¡¼¥é¥¤¥ó¤ò°ú¤¯
+	/*
+		$x			:¥Æ¡¼¥Ö¥ë³«»Ï°ÌÃÖX¼´
+		$y			:¥Æ¡¼¥Ö¥ë³«»Ï°ÌÃÖY¼´
+		$arrCol		:¥«¥é¥à¥µ¥¤¥º¤ÎÇÛÎó
+		$line		:¥¢¥ó¥À¡¼¥é¥¤¥ó¤ò°ú¤¯¹Ô
+		$start_col	:¥¢¥ó¥À¡¼¥é¥¤¥ó³«»Ï¥«¥é¥à(0:³«»Ï¥«¥é¥à)
+	 */
+	function writeUnderLine($x, $y, $arrCol, $line, $start_col = 0) {
+		// ¥Æ¡¼¥Ö¥ëÉý
+		$max = count($arrCol);
+		$width = 0;
+		for($i = 0; $i < $max; $i++) {
+			$width += $arrCol[$i];
+		}
+		
+		$start_x = 0;
+		for($i = 0; $i < $start_col; $i++) {
+			$start_x += $arrCol[$i];
+		}
+		
+		// ¥¢¥ó¥À¡¼¥é¥¤¥ó¤ÎYºÂÉ¸¤òµá¤á¤ë
+		$down = ($line + 1) * $this->fontsize * 1.5;
+		// ¹Ô¥°¥ê¥Ã¥ÉÉÁ²è
+		$sx = $x + $start_x + GRID_SPACE + $this->table_left;
+		$sy = $y + GRID_SPACE + $down - 1;
+		$ex = $x + $width + GRID_SPACE;
+		$ey = $sy;
+				
+		$this->writeLine($sx, $sy, $ex, $ey);		
+	}
+	
+	// ¿¿¤óÃæ²£°ÌÃÖ¤òµá¤á¤ë
+	function getXCenter($width) {
+		$page_width = 0;
+		$page_height = 0;
+		list($page_width, $page_height) = $this->getSize();
+		$x = ($page_width - $width) / 2;
+		return $x;
+	}
+	
+	// ¼«Æ°Ãæ±û¤è¤»
+	function writeTableCenter($table, $y, $arrCol, $arrAlign, $line_max = 256, $start_no = 1, $last_color_flg = false) {
+		// ¥Æ¡¼¥Ö¥ë¥µ¥¤¥º¼èÆÀ
+		$width = 0;
+		foreach($arrCol as $val) {
+			$width += $val;
+		}
+		// Ãæ±û¤è¤»°ÌÃÖ¼èÆÀ
+		$x = $this->getXCenter($width) + $this->table_left;
+		list($ret_x, $ret_y) = $this->writeTable($table, $x, $y, $arrCol, $arrAlign, $line_max, $start_no, $last_color_flg);
+		// X¼´¤ÎºÂÉ¸¤òÊÖ¤¹
+		return array($ret_x, $ret_y);
+	}
+	
+	// ¥Ç¡¼¥¿¤Î½ñ¤­¹þ¤ß(close¤¹¤ë¤È¼¡²ó¿·µ¬¥Ú¡¼¥¸)
+	// $start_no:1¹ÔÌÜ(¥¿¥¤¥È¥ë)¤ò0¤È¤¹¤ë¡£
+	// $line_max:¥¿¥¤¥È¥ë¤ò´Þ¤Þ¤Ê¤¤¹Ô¿ô
+	function writeTable($table, $x, $y, $arrCol, $arrAlign, $line_max = 256, $start_no = 1, $last_color_flg = false) {
+		$this->openPage();
+		
+		$table = ereg_replace("\n$", "", $table);
+				
+		$arrRet = split("\n", $table);
+								
+		if($line_max > (count($arrRet) - $start_no)) {
+			$line_max = count($arrRet) - $start_no;
+		}
+		
+		// ¥¿¥¤¥È¥ëÍ­¸ú
+		if($this->grid_enable) {
+			// ¥°¥ê¥Ã¥É¤ÎÉÁ²è
+			$this->writeGrid($x, $y, $arrCol, $line_max, $last_color_flg);
+		}
+		
+		// Unicode¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤È¤·¤ÆUTF-8¤òÀßÄê
+		PDF_set_parameter($this->pdf, "textformat", "utf8");
+		
+		// ¥¿¥¤¥È¥ëÍ­¸ú
+		if($this->title_enable) {
+			if(count($this->arrHeaderColSize) > 0 && count($this->arrHeaderAlign) > 0 ) {
+				list($linecol, $aligncol, $width) = $this->getTableOption($this->arrHeaderColSize, $this->arrHeaderAlign);
+			} else {
+				list($linecol, $aligncol, $width) = $this->getTableOption($arrCol, $arrAlign);
+			}	
+						
+			// ¥¿¥¤¥È¥ë¹Ô¤Î½ñ¤­¹þ¤ß
+			$option = "ruler {" . $linecol . "} ";
+			$option.= "tabalignment {" . $aligncol . "} ";
+			$fontsize =  $this->fontsize;
+			$option.= "hortabmethod ruler leading=150% fontname=HeiseiKakuGo-W5 fontsize=$fontsize encoding=UniJIS-UCS2-H";
+			
+			$this->writeTableData($table, $x, $y, $width, 0, 0, $option);
+		}
+		
+		list($linecol, $aligncol, $width) = $this->getTableOption($arrCol, $arrAlign);
+		
+		// ¥Ç¡¼¥¿¹Ô¤Î½ñ¤­¹þ¤ß
+		$option = "ruler {" . $linecol . "} ";
+		$option.= "tabalignment {" . $aligncol . "} ";
+		$option.= "hortabmethod ruler leading=150% fontname=HeiseiMin-W3 fontsize=$this->fontsize encoding=UniJIS-UCS2-H";
+		
+		if($start_no <= 0) {
+			$start_no = 1;
+			$end_no = $line_max;
+		} else {
+			$end_no = $start_no + $line_max - 1;
+		}
+		
+		$y += $this->fontsize * 1.5;
+		
+		list($ret_x, $ret_y) = $this->writeTableData($table, $x, $y, $width, $start_no, $end_no, $option);
+		
+		return array($ret_x, $ret_y);
+	}
+	
+	function getTableOption($arrCol, $arrAlign) {
+		// ¥«¥é¥à¥µ¥¤¥º
+		$max = count($arrCol);
+		$width = 0;
+		for($i = 0; $i < $max; $i++) {
+			$width += $arrCol[$i];
+			$linecol.= $width . " ";
+		}
+		
+		// ¥«¥é¥à°ÌÃÖ
+		$max = count($arrAlign);
+		for($i = 0; $i < $max; $i++) {
+			$aligncol.= $arrAlign[$i] . " ";
+		}
+		
+		return array($linecol, $aligncol, $width);
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¥Ç¡¼¥¿¤Î½ñ¤­¹þ¤ß
+	function writeTableData($table, $x, $y, $table_width, $start_no, $end_no, $option) {
+		$arrLine = split("\n", $table);
+		for($i = $start_no; $i <= $end_no; $i++) {
+			$line.=$arrLine[$i] . "\n";
+		}
+				
+		// ¥Æ¡¼¥Ö¥ë°ÌÃÖ¤òµá¤á¤ë
+		list($pdf_x, $pdf_y) = $this->posTopDown($x, $y);
+						
+		// ¥Æ¡¼¥Ö¥ë¹â¤µ¤òµá¤á¤ë
+		$table_height = $this->fontsize * 1.5 * ($end_no - $start_no + 1);
+		// ¥Æ¡¼¥Ö¥ë±¦²¼¤ÎyºÂÉ¸¤òµá¤á¤ë
+		$end_y = $pdf_y - $table_height;
+		if($end_y < 0) {
+			$end_y = 0;
+		}
+		$enc_table = mb_convert_encoding($line, "utf-8", "euc-jp");
+				
+		$tf = PDF_create_textflow($this->pdf, $enc_table, $option);
+
+		PDF_fit_textflow($this->pdf, $tf, $pdf_x, $pdf_y, $pdf_x + $table_width, $end_y, NULL);
+		PDF_delete_textflow($this->pdf, $tf);
+		
+		// ¥Æ¡¼¥Ö¥ëº¸²¼ºÂÉ¸¤òÊÖ¤¹
+		return array($x, $y + $table_height);		
+	}
+		
+	// ¿§¤ÎÀßÄê
+	function setColor($rgb) {
+		if($rgb != "") {
+			list($r, $g, $b) = sfGetPdfRgb($rgb);
+			PDF_setcolor($this->pdf, "fillstroke", "rgb", $r, $g, $b, 0);	
+		}
+	}
+	
+	// Ã»·Á¤òÉÁ²è
+	function writeRect($x, $y, $width, $height, $rgb = "") {
+		$this->openPage();
+		list($pdf_x, $pdf_y) = $this->posTopDown($x, $y);
+		$this->setColor($rgb);
+		PDF_rect($this->pdf, $pdf_x,$pdf_y,$width,-$height);
+		PDF_fill($this->pdf);
+	}
+	
+	// ÏÈÉÕ¤ÎÃ»·Á¤òÉÁ²è
+	function writeFrameRect($x, $y, $width, $height, $rgb, $frgb) {
+		$this->openPage();
+		list($pdf_x, $pdf_y) = $this->posTopDown($x, $y);
+		$this->setColor($frgb);
+		PDF_rect($this->pdf, $pdf_x,$pdf_y,$width,-$height);
+		PDF_fill($this->pdf);
+		
+		$this->setColor($rgb);
+		PDF_rect($this->pdf, $pdf_x+1,$pdf_y-1,$width-2,-$height+2);
+		PDF_fill($this->pdf);		
+	}
+	
+	// Ä¾Àþ¤òÉÁ²è
+	function writeLine($sx, $sy, $ex, $ey, $rgb = "000000") {
+		$this->openPage();
+		list($pdf_sx, $pdf_sy) = $this->posTopDown($sx, $sy);
+		list($pdf_ex, $pdf_ey) = $this->posTopDown($ex, $ey);
+		$this->setColor($rgb);
+		PDF_setlinewidth($this->pdf, 1.0);
+		PDF_moveto($this->pdf, $pdf_sx, $pdf_sy);
+		PDF_lineto($this->pdf, $pdf_ex, $pdf_ey);
+		PDF_stroke($this->pdf);
+	}
+		
+	// ¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É
+	function output($filekey = "") {
+		if(isset($this->pdf)) {
+			// ¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+			$this->closePage();
+			// PDF¤Î½ªÎ»
+			PDF_end_document($this->pdf, NULL);
+			// ½ÐÎÏÍÑ¥Ç¡¼¥¿¤Î¼èÆÀ 
+			$buf = PDF_get_buffer($this->pdf);
+			$filename = $filekey . date("ymdHis").".pdf";
+						
+			header("Content-disposition: attachment; filename=$filename");
+			header("Content-type: application/octet-stream; name=$filename");
+					
+			/*
+			 * session_start()¤ò»öÁ°¤Ë¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë¾ì¹ç¤Ë½ÐÎÏ¤µ¤ì¤ë°Ê²¼¤Î¥Ø¥Ã¥À¤Ï¡¢
+			 * URLÄ¾ÀÜ¸Æ¤Ó½Ð¤·»þ¤Ë¥¨¥é¡¼¤òÈ¯À¸¤µ¤»¤ë¤Î¤Ç¶õ¤Ë¤·¤Æ¤ª¤¯¡£
+			 *
+			 * Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
+			 * Progma: no-cache
+			 *
+			 */
+			header("Cache-Control: ");
+			header("Pragma: ");
+			print $buf;
+			
+			// PDF²òÊü
+			PDF_delete($this->pdf);
+		} else {
+			print("PDF¤¬À¸À®¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+		}
+		exit;		
+	}
+	
+	// ¥Õ¥¡¥¤¥ë¤ÎÉ½¼¨
+	function display() {
+		if(isset($this->pdf)) {
+			// ¥Ú¡¼¥¸¤òÊÄ¤¸¤ë
+			$this->closePage();
+			// PDF¤Î½ªÎ»
+			PDF_end_document($this->pdf, NULL);
+			
+			// ½ÐÎÏÍÑ¥Ç¡¼¥¿¤Î¼èÆÀ 
+			$buf = PDF_get_buffer($this->pdf);
+			$len = strlen($buf);
+			header("Content-type: application/pdf");
+			header("Content-Length: $len");
+			header("Content-Disposition: inline; filename=". date("YmdHis").".pdf");
+								
+			/*
+			 * session_start()¤ò»öÁ°¤Ë¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë¾ì¹ç¤Ë½ÐÎÏ¤µ¤ì¤ë°Ê²¼¤Î¥Ø¥Ã¥À¤Ï¡¢
+			 * URLÄ¾ÀÜ¸Æ¤Ó½Ð¤·»þ¤Ë¥¨¥é¡¼¤òÈ¯À¸¤µ¤»¤ë¤Î¤Ç¶õ¤Ë¤·¤Æ¤ª¤¯¡£
+			 *
+			 * Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
+			 * Progma: no-cache
+			 *
+			 */
+			header("Cache-Control: ");
+			header("Pragma: ");
+			print $buf;
+			
+			// PDF²òÊü
+			PDF_delete($this->pdf);
+		} else {
+			print("PDF¤¬À¸À®¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+		}
+		exit;
+	}
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_View.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_View.php	(revision 3549)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_View.php	(revision 3549)
@@ -0,0 +1,155 @@
+<?php
+$SC_VIEW_PHP_DIR = realpath(dirname(__FILE__));
+require_once($SC_VIEW_PHP_DIR . "/../module/Smarty/libs/Smarty.class.php");
+
+class SC_View {
+	
+    var $_smarty;
+	var $objSiteInfo; // ¥µ¥¤¥È¾ðÊó
+	
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+    function SC_View($siteinfo = true) {
+		global $SC_VIEW_PHP_DIR;
+
+    	$this->_smarty = new Smarty;
+		$this->_smarty->left_delimiter = '<!--{';
+		$this->_smarty->right_delimiter = '}-->';
+		$this->_smarty->register_modifier("sfDispDBDate","sfDispDBDate");
+		$this->_smarty->register_modifier("sfConvSendDateToDisp","sfConvSendDateToDisp");
+		$this->_smarty->register_modifier("sfConvSendWdayToDisp","sfConvSendWdayToDisp");
+		$this->_smarty->register_modifier("sfGetVal", "sfGetVal");
+		$this->_smarty->register_function("sfSetErrorStyle","sfSetErrorStyle");
+		$this->_smarty->register_function("sfGetErrorColor","sfGetErrorColor");
+		$this->_smarty->register_function("srTrim", "sfTrim");
+		$this->_smarty->register_function("sfPreTax", "sfPreTax");
+		$this->_smarty->register_function("sfPrePoint", "sfPrePoint");
+		$this->_smarty->register_function("sfGetChecked", "sfGetChecked");
+		$this->_smarty->register_function("sfTrimURL", "sfTrimURL");
+		$this->_smarty->register_function("sfMultiply", "sfMultiply");
+		$this->_smarty->register_function("sfPutBR", "sfPutBR");
+		$this->_smarty->register_function("sfRmDupSlash", "sfRmDupSlash");
+		$this->_smarty->register_function("sfCutString", "sfCutString");
+		$this->_smarty->plugins_dir=array("plugins", $SC_VIEW_PHP_DIR . "/../smarty_extends");
+		$this->_smarty->register_function("sf_mb_convert_encoding","sf_mb_convert_encoding");
+		$this->_smarty->register_function("sf_mktime","sf_mktime");
+		$this->_smarty->register_function("sf_date","sf_date");		
+
+		if(ADMIN_MODE == '1') {		
+			$this->time_start = time();
+		}
+
+		// ¥µ¥¤¥È¾ðÊó¤ò¼èÆÀ¤¹¤ë
+		if($siteinfo) {
+			if(!defined('LOAD_SITEINFO')) {
+				$this->objSiteInfo = new SC_SiteInfo();
+				$arrInfo['arrSiteInfo'] = $this->objSiteInfo->data;
+				
+				// ÅÔÆ»ÉÜ¸©Ì¾¤òÊÑ´¹
+				global $arrPref;
+				$arrInfo['arrSiteInfo']['pref'] = $arrPref[$arrInfo['arrSiteInfo']['pref']];
+				
+	 			// ¥µ¥¤¥È¾ðÊó¤ò³ä¤êÅö¤Æ¤ë
+				foreach ($arrInfo as $key => $value){
+					$this->_smarty->assign($key, $value);
+				}
+				
+				define('LOAD_SITEINFO', 1);
+			}
+		}
+	}
+    
+    // ¥Æ¥ó¥×¥ì¡¼¥È¤ËÃÍ¤ò³ä¤êÅö¤Æ¤ë
+    function assign($val1, $val2) {
+        $this->_smarty->assign($val1, $val2);
+    }
+    
+    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤ò¼èÆÀ
+    function fetch($template) {
+        return $this->_smarty->fetch($template);
+    }
+    
+    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤òÉ½¼¨
+    function display($template, $no_error = false) {
+		if(!$no_error) {
+			global $GLOBAL_ERR;
+			if(!defined('OUTPUT_ERR')) {
+				print($GLOBAL_ERR);
+				define('OUTPUT_ERR','ON');
+			}
+		}
+		$this->_smarty->display($template);
+		if(ADMIN_MODE == '1') {
+			$time_end = time();
+			$time = $time_end - $this->time_start;
+			print("½èÍý»þ´Ö:" . $time . "ÉÃ");
+		}
+	}
+  	
+  	// ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
+  	function assignobj($obj) {
+		$data = get_object_vars($obj);
+		
+		foreach ($data as $key => $value){
+			$this->_smarty->assign($key, $value);
+		}
+  	}
+  	
+  	// Ï¢ÁÛÇÛÎóÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
+  	function assignarray($array) {
+  		foreach ($array as $key => $val) {
+  			$this->_smarty->assign($key, $val);
+  		}
+  	}
+
+	/* ¥µ¥¤¥È½é´üÀßÄê */
+	function initpath() {
+		global $SC_VIEW_PHP_DIR;
+		
+		$array['tpl_mainnavi'] = $SC_VIEW_PHP_DIR . '/../Smarty/templates/frontparts/mainnavi.tpl';
+		$array['tpl_root_id'] = sfGetRootId();
+		$this->assignarray($array);
+	}
+}
+
+class SC_AdminView extends SC_View{
+    function SC_AdminView() {
+    	parent::SC_View(false);
+		$this->_smarty->template_dir = TEMPLATE_ADMIN_DIR;
+		$this->_smarty->compile_dir = COMPILE_ADMIN_DIR;
+		$this->initpath();
+	}
+
+	function printr($data){
+		print_r($data);
+	}
+}
+
+class SC_SiteView extends SC_View{
+    function SC_SiteView() {
+    	parent::SC_View();
+		$this->_smarty->template_dir = TEMPLATE_DIR;
+		$this->_smarty->compile_dir = COMPILE_DIR;
+		$this->initpath();
+		
+		// PHP5¤Ç¤Ïsession¤ò¥¹¥¿¡¼¥È¤¹¤ëÁ°¤Ë¥Ø¥Ã¥À¡¼¾ðÊó¤òÁ÷¿®¤·¤Æ¤¤¤ë¤È·Ù¹ð¤¬½Ð¤ë¤¿¤á¡¢Àè¤Ë¥»¥Ã¥·¥ç¥ó¤ò¥¹¥¿¡¼¥È¤¹¤ë¤è¤¦¤ËÊÑ¹¹
+		sfDomainSessionStart();
+	}
+}
+
+class SC_UserView extends SC_SiteView{
+    function SC_UserView($template_dir, $compile_dir = COMPILE_DIR) {
+    	parent::SC_SiteView();
+		$this->_smarty->template_dir = $template_dir;
+		$this->_smarty->compile_dir = $compile_dir;
+	}
+}
+
+class SC_InstallView extends SC_View{
+    function SC_InstallView($template_dir, $compile_dir = COMPILE_DIR) {
+    	parent::SC_View(false);
+		$this->_smarty->template_dir = $template_dir;
+		$this->_smarty->compile_dir = $compile_dir;
+	}
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_PageLayout.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_PageLayout.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_PageLayout.php	(revision 1328)
@@ -0,0 +1,59 @@
+<?php
+class SC_PageLayout {
+	
+    var $arrPageData;		// ¥Ú¡¼¥¸¥Ç¡¼¥¿³ÊÇ¼ÍÑ
+    var $arrPageList;		// ¥Ú¡¼¥¸¥Ç¡¼¥¿³ÊÇ¼ÍÑ
+	
+    // ¥³¥ó¥¹¥È¥é¥¯¥¿
+    function SC_PageLayout() {
+		$this->arrPageList = $this->getPageData();
+	}
+    
+	/**************************************************************************************************************
+	 * ´Ø¿ôÌ¾	¡§getPageData
+	 * ½èÍýÆâÍÆ	¡§¥Ö¥í¥Ã¥¯¾ðÊó¤ò¼èÆÀ¤¹¤ë
+	 * °ú¿ô1	¡§$where  ¥¥¥ Where¶çÊ¸
+	 * °ú¿ô2	¡§$arrVal ¥¥¥ Where¶ç¤Î¹Ê¹þ¾ò·ïÃÍ
+	 * Ìá¤êÃÍ	¡§¥Ö¥í¥Ã¥¯¾ðÊó
+	 **************************************************************************************************************/
+	function getPageData($where = '', $arrVal = ''){
+		$objDBConn = new SC_DbConn;		// DBÁàºî¥ª¥Ö¥¸¥§¥¯¥È
+		$sql = "";						// ¥Ç¡¼¥¿¼èÆÀSQLÀ¸À®ÍÑ
+		$arrRet = array();				// ¥Ç¡¼¥¿¼èÆÀÍÑ
+		
+		// SQLÀ¸À®
+		$sql .= " SELECT";
+		$sql .= " page_id";				// ¥Ú¡¼¥¸ID
+		$sql .= " ,page_name";			// Ì¾¾Î
+		$sql .= " ,url";				// URL
+		$sql .= " ,php_dir";			// phpÊÝÂ¸Àè¥Ç¥£¥ì¥¯¥È¥ê
+		$sql .= " ,tpl_dir";			// tplÊÝÂ¸Àè¥Ç¥£d¥ì¥¯¥È¥ê
+		$sql .= " ,filename";			// ¥Õ¥¡¥¤¥ëÌ¾¾Î
+		$sql .= " ,header_chk ";		// ¥Ø¥Ã¥À¡¼»ÈÍÑFLG
+		$sql .= " ,footer_chk ";		// ¥Õ¥Ã¥¿¡¼»ÈÍÑFLG
+		$sql .= " ,author";				// author¥¿¥°
+		$sql .= " ,description";		// description¥¿¥°
+		$sql .= " ,keyword";			// keyword¥¿¥°
+		$sql .= " ,update_url";			// ¹¹¿·URL
+		$sql .= " ,create_date";		// ¥Ç¡¼¥¿ºîÀ®Æü
+		$sql .= " ,update_date";		// ¥Ç¡¼¥¿¹¹¿·Æü
+		$sql .= " FROM ";
+		$sql .= "     dtb_pagelayout";
+		
+		// where¶ç¤Î»ØÄê¤¬¤¢¤ì¤ÐÄÉ²Ã	
+		if ($where != '') {
+			$sql .= " WHERE " . $where;
+		}
+		
+		$sql .= " ORDER BY 	page_id";
+		
+		$arrRet = $objDBConn->getAll($sql, $arrVal);
+		
+		$this->arrPageData = $arrRet;
+		
+		return $arrRet;
+	}
+
+
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_Page.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_Page.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_Page.php	(revision 1328)
@@ -0,0 +1,8 @@
+<?php
+class SC_Page {
+	var $tpl_main_page;
+	function SC_Page() {
+		$this->tpl_main_page = '';
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_Date.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_Date.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_Date.php	(revision 1328)
@@ -0,0 +1,127 @@
+<?php
+
+/*¡¡Æü»þÉ½¼¨ÍÑ¥¯¥é¥¹ */
+class SC_Date {
+	var $start_year;
+	var $month;
+	var $day;
+	var $end_year;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_Date($start_year='', $end_year='') {
+		if ( $start_year ) 	$this->setStartYear($start_year);	
+		if ( $end_year )	$this->setEndYear($end_year);
+	}
+	
+	function setStartYear($year){
+		$this->start_year = $year;
+	}
+
+	function setEndYear($endYear) {
+		$this->end_year = $endYear;	
+	}
+	
+	function setMonth($month){
+		$this->month = $month;			
+	}
+	
+	function setDay ($day){
+		$this->day = $day;
+	}
+			
+	function getYear($year = '', $default = ''){
+		if ( $year ) $this->setStartYear($year);
+		
+		$year = $this->start_year;
+		if ( ! $year ) $year = DATE("Y");
+		
+		$end_year = $this->end_year;
+		if ( ! $end_year ) $end_year = (DATE("Y") + 3);
+		
+		$year_array = array();
+		
+		for ($i=$year; $i<=($end_year); $i++){		
+			$year_array[$year] = $i;
+			if($year == $default) {
+				$year_array['----'] = "----";
+			}
+			$year++;
+		}
+		return $year_array;
+	}
+	
+	function getZeroYear($year = ''){
+		if ( $year ) $this->setStartYear($year);
+		
+		$year = $this->start_year;
+		if ( ! $year ) $year = DATE("Y");
+		
+		$end_year = $this->end_year;
+		if ( ! $end_year ) $end_year = (DATE("Y") + 3);
+		
+		$year_array = array();
+		
+		for ($i=$year; $i<=($end_year); $i++){
+			$key = substr($i, -2);
+			$year_array[$key] = $key;
+		}
+		return $year_array;
+	}
+	
+	function getZeroMonth(){
+	
+		$month_array = array();
+		for ($i=1; $i <= 12; $i++){
+			$val = sprintf("%02d", $i);
+			$month_array[$val] = $val;
+		}
+		return $month_array;
+	}	
+	
+	
+	function getMonth(){
+	
+		$month_array = array();
+		for ($i=0; $i < 12; $i++){		
+			$month_array[$i + 1 ] = $i + 1;
+		}
+		return $month_array;
+	}	
+	
+	function getDay(){	
+		
+		$day_array = array();
+		for ($i=0; $i < 31; $i++){		
+			$day_array[ $i + 1 ] = $i + 1;
+		}
+		
+		return $day_array;
+	}
+
+	function getHour(){	
+		
+		$day_array = array();
+		for ($i=0; $i<=23; $i++){		
+			$hour_array[$i] = $i;
+		}
+		
+		return $hour_array;
+	}
+
+	function getMinutes(){	
+		
+		$minutes_array = array();
+		for ($i=0; $i<=59; $i++){		
+			$minutes_array[$i] = $i;
+		}
+		
+		return $minutes_array;
+	}
+	
+	function getMinutesInterval(){	
+		
+		$minutes_array = array("00"=>"00", "30"=>"30");		
+		return $minutes_array;
+	}	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/SC_SiteInfo.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/SC_SiteInfo.php	(revision 2240)
+++ /temp/tags/eccube-0_9_2beta/data/class/SC_SiteInfo.php	(revision 2240)
@@ -0,0 +1,31 @@
+<?php
+/* ¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_SiteInfo {
+	
+	var $conn;
+	var $data;
+	
+	function SC_SiteInfo($conn = ''){
+		$DB_class_name = "SC_DbConn";
+		if ( is_object($conn)){
+			if ( is_a($conn, $DB_class_name)){
+				// $conn¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë
+				$this->conn = $conn;
+			}
+		} else {
+			if (class_exists($DB_class_name)){
+				//$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë
+				$this->conn = new SC_DbConn();			
+			}
+		}
+		
+		if ( is_object($this->conn)){
+			$conn = $this->conn;
+			$sql = "SELECT * FROM dtb_baseinfo";
+			$data = $conn->getAll($sql);
+			$this->data = $data[0];
+		}
+	}
+	
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/class/GC_SendMail.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/class/GC_SendMail.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/class/GC_SendMail.php	(revision 1328)
@@ -0,0 +1,97 @@
+<?php
+
+//--- ¥Æ¥­¥¹¥È/HTML¡¡¥á¡¼¥ëÁ÷¿®
+class GC_SendMail {
+
+	var	$html;			//	HTML ¥á¡¼¥ë¥Ø¥Ã¥À¡¼
+	var $to;			//	Á÷¿®Àè
+	var $subject;		//	ÂêÌ¾
+	var $body;			//	ËÜÊ¸
+	var $header;		//	¥Ø¥Ã¥À¡¼
+	var $return_path;	//¡¡return path
+	var $mailer;
+
+	/*	¥Ø¥Ã¥ÀÅù¤ò³ÊÇ¼
+		 $to			-> Á÷¿®Àè¥á¡¼¥ë¥¢¥É¥ì¥¹
+		 $subject		-> ¥á¡¼¥ë¤Î¥¿¥¤¥È¥ë
+		 $body			-> ¥á¡¼¥ëËÜÊ¸
+		 $fromaddress	-> Á÷¿®¸µ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹
+		 $header		-> ¥Ø¥Ã¥À¡¼
+		 $from_name		-> Á÷¿®¸µ¤ÎÌ¾Á°¡ÊÁ´³ÑOK¡Ë
+		 $reply_to		-> reply_toÀßÄê
+		 $return_path	-> return-path¥¢¥É¥ì¥¹ÀßÄê¡Ê¥¨¥é¡¼¥á¡¼¥ëÊÖÁ÷ÍÑ¡Ë
+		 $cc			-> ¥«¡¼¥Ü¥ó¥³¥Ô¡¼
+		 $bcc			-> ¥Ö¥é¥¤¥ó¥É¥«¡¼¥Ü¥ó¥³¥Ô¡¼
+	*/	
+	
+	
+	function setTo($to, $to_name = "") {
+		if($to_name != "") {
+			$name = ereg_replace("<","¡ã", $to_name);
+			$name = ereg_replace(">","¡ä", $name);
+			$name = mb_encode_mimeheader($name);
+			$this->to = $name . "<" . $to . ">";
+		} else {
+			$this->to = $to;
+		}
+	}
+		
+	function setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
+		
+		$this->to			 = $to;
+		$this->subject		 = $subject;
+		$this->body			 = $body;
+		// ¥Ø¥Ã¥À¡¼¤ËÆüËÜ¸ì¤ò»ÈÍÑ¤¹¤ë¾ì¹ç¤ÏMb_encode_mimeheader¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£
+		$from_name = ereg_replace("<","¡ã", $from_name);
+		$from_name = ereg_replace(">","¡ä", $from_name);
+				
+		$this->header		 = "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n";
+		$this->header		.= "Reply-To: ". $reply_to . "\n";
+		$this->header		.= "Cc: " . $cc. "\n";
+		$this->header		.= "Bcc: " . $bcc . "\n";
+		$this->header		.= "Errors-To: ". $errors_to ."\n";
+		$this->return_path   = $return_path;
+	}
+
+	
+	function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
+			
+		$this->to			 = $to;
+		$this->subject		 = Mb_encode_mimeheader($subject);
+		$this->body			 = mb_convert_encoding( $body, "iso-2022-jp", "EUC-JP");
+		$this->header		 = "Mime-Version: 1.0\n";
+		$this->header		.= "Content-Type: text/html; charset=iso-2022-jp\n";
+		$this->header		.= "Content-Transfer-Encoding: 7bit\n";
+		$this->header		.= "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n";
+		$this->header		.= "Reply-To: ". $reply_to . "\n";
+		$this->header		.= "Cc: " . $cc. "\n";
+		$this->header		.= "Bcc: " . $bcc . "\n";
+		$this->header		.= "Errors-To: ". $errors_to ."\n";
+		$this->return_path   = $return_path;
+	}
+
+	//	¥á¡¼¥ëÁ÷¿®¤ò¼Â¹Ô¤¹¤ë
+	function sendMail() {
+
+		Mb_language( "Japanese" );
+		
+		//¡¡¥á¡¼¥ëÁ÷¿®
+		if( mb_send_mail( $this->to, $this->subject, $this->body, $this->header, "-f" . $this->return_path ) ) {
+			return true;
+		}
+		return false;
+	}
+
+	function sendHtmlMail() {
+
+		Mb_language( "Japanese" );	
+		
+		//¡¡¥á¡¼¥ëÁ÷¿®
+		if( mail( $this->to, $this->subject, $this->body, $this->header, "-f" . $this->return_path ) ) {
+			return true;
+		}
+		return false;
+	}
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/conf/conf.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/conf/conf.php	(revision 3364)
+++ /temp/tags/eccube-0_9_2beta/data/conf/conf.php	(revision 3364)
@@ -0,0 +1,748 @@
+<?php
+
+$CONF_PHP_PATH = realpath( dirname( __FILE__) );
+require_once($CONF_PHP_PATH ."/../../html/install.inc");
+require_once($CONF_PHP_PATH ."/core.php" );
+
+//--------------------------------------------------------------------------------------------------------
+/** ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑ **/
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑ¥Õ¥¡¥¤¥ë³ÊÇ¼¾ì½ê
+define("UPDATE_HTTP", "http://ec-cube.lockon.co.jp/share/");
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑCSV1¹ÔÊÕ¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("UPDATE_CSV_LINE_MAX", 4096);
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑCSV¥«¥é¥à¿ô
+define("UPDATE_CSV_COL_MAX", 13);
+//--------------------------------------------------------------------------------------------------------
+
+//¥Ð¥Ã¥Á¤ò¼Â¹Ô¤¹¤ëºÇÃ»¤Î´Ö³Ö(ÉÃ)
+define("LOAD_BATCH_PASS", 3600);
+
+define("CLOSE_DAY", 31);	// Äù¤áÆü¤Î»ØÄê(ËöÆü¤Î¾ì¹ç¤Ï¡¢31¤ò»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£)
+
+//°ìÈÌ¥µ¥¤¥È¥¨¥é¡¼
+define("FAVORITE_ERROR", 13);
+
+//¤ª¤¹¤¹¤á¾¦ÉÊ¿ô
+define ("RECOMMEND_PRODUCT_MAX", 4);
+
+/** ¥°¥é¥Õ´ØÏ¢ **/
+	
+define("LIB_DIR", ROOT_DIR . "data/lib/");						// ¥é¥¤¥Ö¥é¥ê¤Î¥Ñ¥¹
+define("TTF_DIR", ROOT_DIR . "data/fonts/");					// ¥Õ¥©¥ó¥È¤Î¥Ñ¥¹
+define("GRAPH_DIR", ROOT_DIR . "html/upload/graph_image/");		// ¥°¥é¥Õ³ÊÇ¼¥Ç¥£¥ì¥¯¥È¥ê
+define("GRAPH_URL", "/upload/graph_image/");					// ¥°¥é¥ÕURL
+define("GRAPH_PIE_MAX", 10);									// ±ß¥°¥é¥ÕºÇÂçÉ½¼¨¿ô
+define("GRAPH_LABEL_MAX", 40);									// ¥°¥é¥Õ¤Î¥é¥Ù¥ë¤ÎÊ¸»ú¿ô
+
+/** ¥Ñ¥¹´ØÏ¢ **/
+
+define("PDF_DIR", ROOT_DIR . "data/pdf/");	// PDF³ÊÇ¼¥Ç¥£¥ì¥¯¥È¥ê
+
+/** Çä¾å¤²½¸·× **/
+
+define("BAT_ORDER_AGE", 70);		// ²¿ºÐ¤Þ¤Ç½¸·×¤ÎÂÐ¾Ý¤È¤¹¤ë¤«
+define("PRODUCTS_TOTAL_MAX", 15);	// ¾¦ÉÊ½¸·×¤Ç²¿°Ì¤Þ¤ÇÉ½¼¨¤¹¤ë¤«
+
+/** ¥Ç¥Õ¥©¥ë¥ÈÃÍ **/
+define("DEFAULT_PRODUCT_DISP", 2);	// 1:¸ø³« 2:Èó¸ø³«
+
+/** ¥ª¥×¥·¥ç¥óÀßÄê **/
+define("DELIV_FREE_AMOUNT", 0);				// Á÷ÎÁÌµÎÁ¹ØÆþ¸Ä¿ô¡Ê0¤Î¾ì¹ç¤Ï¡¢²¿¸ÄÇã¤Ã¤Æ¤âÌµÎÁ¤Ë¤Ê¤é¤Ê¤¤)
+define("INPUT_DELIV_FEE", 1);				// ÇÛÁ÷ÎÁ¤ÎÀßÄê²èÌÌÉ½¼¨(Í­¸ú:1 Ìµ¸ú:0)
+define("OPTION_PRODUCT_DELIV_FEE", 0);		// ¾¦ÉÊ¤´¤È¤ÎÁ÷ÎÁÀßÄê(Í­¸ú:1 Ìµ¸ú:0)
+define("OPTION_DELIV_FEE", 1);				// ÇÛÁ÷¶È¼Ô¤´¤È¤ÎÇÛÁ÷ÎÁ¤ò²Ã»»¤¹¤ë(Í­¸ú:1 Ìµ¸ú:0)
+define("OPTION_RECOMMEND", 1);		// ¤ª¤¹¤¹¤á¾¦ÉÊÅÐÏ¿(Í­¸ú:1 Ìµ¸ú:0)
+define("OPTION_CLASS_REGIST", 1);	// ¾¦ÉÊµ¬³ÊÅÐÏ¿(Í­¸ú:1 Ìµ¸ú:0)
+
+define("TV_IMAGE_WIDTH",170);		//TVÏ¢Æ°¾¦ÉÊ²èÁü²£
+define("TV_IMAGE_HEIGHT",95);		//TVÏ¢Æ°¾¦ÉÊ²èÁü½Ä
+define("TV_PRODUCTS_MAX",10);		//TVÏ¢Æ°¾¦ÉÊºÇÂçÅÐÏ¿¿ô
+
+/** ¥ª¥×¥·¥ç¥óÀßÄê **/
+
+
+
+//²ñ°÷ÅÐÏ¿ÊÑ¹¹(¥Þ¥¤¥Ú¡¼¥¸)¥Ñ¥¹¥ï¡¼¥ÉÍÑ
+define("DEFAULT_PASSWORD", "UAhgGR3L");
+//ÊÌ¤Î¤ªÆÏ¤±ÀèºÇÂçÅÐÏ¿¿ô
+define("DELIV_ADDR_MAX", 20);
+//¥Þ¥¤¥Ú¡¼¥¸¤ªÆÏ¤±ÀèURL
+define("MYPAGE_DELIVADDR_URL", "/mypage/delivery.php");
+//±ÜÍ÷ÍúÎòÊÝÂ¸¿ô
+define("CUSTOMER_READING_MAX",30);
+//SSLURLÈ½Äê
+define("SSLURL_CHECK", 0);
+//´ÉÍý²èÌÌ¥¹¥Æ¡¼¥¿¥¹°ìÍ÷É½¼¨·ï¿ô
+define("ORDER_STATUS_MAX", 50);
+//¥Õ¥í¥ó¥È¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ßºÇÂç¿ô
+define("REVIEW_REGIST_MAX", 5);
+
+/*
+ * ¥µ¥¤¥ÈÄêµÁÄê¿ô
+ */
+/* ¥·¥¹¥Æ¥à´ØÏ¢ */
+define ("LOGIN_FRAME", "login_frame.tpl");				// ¥í¥°¥¤¥ó²èÌÌ¥Õ¥ì¡¼¥à
+define ("MAIN_FRAME", "main_frame.tpl");				// ´ÉÍý²èÌÌ¥Õ¥ì¡¼¥à
+define ("SITE_FRAME", "site_frame.tpl");				// °ìÈÌ¥µ¥¤¥È²èÌÌ¥Õ¥ì¡¼¥à
+define ("CERT_STRING", "7WDhcBTF");						// Ç§¾ÚÊ¸»úÎó
+define ("ADMIN_ID", "1");								// ´ÉÍý¥æ¡¼¥¶ID(¥á¥ó¥Æ¥Ê¥ó¥¹ÍÑÉ½¼¨¤µ¤ì¤Ê¤¤¡£)
+define ("DUMMY_PASS", "########");						// ¥À¥ß¡¼¥Ñ¥¹¥ï¡¼¥É
+define ("UNLIMITED", "++");								// ºß¸Ë¿ô¡¢ÈÎÇäÀ©¸ÂÌµ¸Â¤ò¼¨¤¹¡£
+define ("BIRTH_YEAR", 1901);							// À¸Ç¯·îÆüÅÐÏ¿³«»ÏÇ¯
+define ("RELEASE_YEAR", 2005);							// ËÜ¥·¥¹¥Æ¥à¤Î²ÔÆ¯³«»ÏÇ¯
+define ("CREDIT_ADD_YEAR", 10);							// ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É¤Î´ü¸Â¡Ü²¿Ç¯
+define ("PARENT_CAT_MAX", 12);							// ¿Æ¥«¥Æ¥´¥ê¤Î¥«¥Æ¥´¥êID¤ÎºÇÂç¿ô¡Ê¤³¤ì°Ê²¼¤Ï¿Æ¥«¥Æ¥´¥ê¤È¤¹¤ë¡£)
+define ("NUMBER_MAX", 1000000000);						// GETÃÍÊÑ¹¹¤Ê¤É¤Î¤¤¤¿¤º¤é¤òËÉ¤°¤¿¤áºÇÂç¿ôÀ©¸Â¤òÀß¤±¤ë¡£
+define ("POINT_RULE", 2);								// ¥Ý¥¤¥ó¥È¤Î·×»»¥ë¡¼¥ë(1:»Í¼Î¸ÞÆþ¡¢2:ÀÚ¤ê¼Î¤Æ¡¢3:ÀÚ¤ê¾å¤²)
+define ("POINT_VALUE", 1);								// 1¥Ý¥¤¥ó¥ÈÅö¤¿¤ê¤ÎÃÍÃÊ(±ß)
+define ("ADMIN_MODE", 0);								// ´ÉÍý¥â¡¼¥É 1:Í­¸ú¡¡0:Ìµ¸ú(Ç¼ÉÊ»þ)
+
+define ("FORGOT_MAIL", 0);								// ¥Ñ¥¹¥ï¡¼¥ÉËº¤ì¤Î³ÎÇ§¥á¡¼¥ë¤òÁ÷ÉÕ¤¹¤ë¤«ÈÝ¤«¡£(0:Á÷¿®¤·¤Ê¤¤¡¢1:Á÷¿®¤¹¤ë)
+define ("HTML_TEMPLATE_SUB_MAX", 12);					// ÅÐÏ¿¤Ç¤­¤ë¥µ¥Ö¾¦ÉÊ¤Î¿ô
+define ("LINE_LIMIT_SIZE", 60);							// Ê¸»ú¿ô¤¬Â¿¤¹¤®¤ë¤È¤­¤Ë¶¯À©²þ¹Ô¤¹¤ë¥µ¥¤¥º(È¾³Ñ)
+define ("BIRTH_MONTH_POINT", 0);						// ÃÂÀ¸Æü·î¥Ý¥¤¥ó¥È
+define ("INPUT_DELIV_FEE", true);						// ÇÛÁ÷ÎÁ¤ÎÀßÄê²èÌÌ(true:¤¢¤ê¡¢false:¤Ê¤·)
+
+/* ¥¯¥ì¥¸¥Ã¥È¥í¡¼¥ó(¥»¥ó¥È¥é¥ë¥Õ¥¡¥¤¥Ê¥ó¥¹) */
+define ("CF_HOMEADDR", "https://cf.ufit.ne.jp/dotcredit");					// ¥Û¡¼¥à¥¢¥É¥ì¥¹
+define ("CF_STORECODE", "361901000000000");									// ²ÃÌÁÅ¹¥³¡¼¥É(¥Ï¥¤¥Õ¥ó¤Ê¤·¤Ç¡Ë
+// define ("CF_HOMEADDR", "https://cf.ufit.ne.jp/dotcredittest");				// ¥Û¡¼¥à¥¢¥É¥ì¥¹(¥Æ¥¹¥ÈÍÑ)
+// define ("CF_STORECODE", "111111111111111");									// ²ÃÌÁÅ¹¥³¡¼¥É(¥Æ¥¹¥ÈÍÑ)
+
+define ("CF_SIMULATE", "/simulate/simulate.cgi");							// ¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·
+// define ("CF_RETURNURL", SSL_URL . "shopping/loan.php");						// Ìá¤êÀè ¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó¤Ï¼¡´ü³«È¯
+// define ("CF_CANCELURL", SSL_URL . "shopping/loan_cancel.php");				// Ìá¤êÀè ¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó¤Ï¼¡´ü³«È¯
+define ("CF_CONTINUE", "1");												// ¸Æ¤Ó½Ð¤·¶èÊ¬(0:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó¤Î¤ß¡¢1:¥·¥å¥ß¥ì¡¼¥·¥ç¥ó+¿½¹þ)
+define ("CF_LABOR", "0");													// ÌòÌ³Í­Ìµ¶èÊ¬(0:Ìµ¡¢1:Í­)
+define ("CF_RESULT", "1");													// ·ë²Ì±þÅú(1:·ë²Ì¤¢¤ê¡¢2:·ë²Ì¤Ê¤·)
+
+/* ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É(¥Ù¥ê¥È¥é¥ó¥¹) */
+define ("CGI_DIR", ROOT_DIR . "cgi-bin/");									// ¥â¥¸¥å¡¼¥ë³ÊÇ¼¥Ç¥£¥ì¥¯¥È¥ê
+define ("CGI_FILE", "mauthonly.cgi");										// ¥³¥¢CGI
+
+// ¥ë¡¼¥È¥«¥Æ¥´¥êID
+define ("ROOT_CATEGORY_1", 2);
+define ("ROOT_CATEGORY_2", 3);
+define ("ROOT_CATEGORY_3", 4);
+define ("ROOT_CATEGORY_4", 5);
+define ("ROOT_CATEGORY_5", 6);
+define ("ROOT_CATEGORY_6", 7);
+define ("ROOT_CATEGORY_7", 8);
+
+// ¤ª»ÙÊ§¤¤ÊýË¡ÆÃ¼ìID
+define ("PAYMENT_DAIBIKI_ID",1);		// Âå¶â°ú´¹
+define ("PAYMENT_GINFURI_ID", 2);		// ¶ä¹Ô¿¶¹þ
+define ("PAYMENT_KAKITOME_ID", 3);		// ¸½¶â½ñÎ±
+define ("PAYMENT_CREDIT_ID",4);			// ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É
+define ("PAYMENT_LOAN_ID", 5);			// ¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó
+define ("PAYMENT_CONVENIENCE_ID", 6);	// ¥³¥ó¥Ó¥Ë·èºÑ
+
+define("LARGE_IMAGE_WIDTH",  500);						// ³ÈÂç²èÁü²£
+define("LARGE_IMAGE_HEIGHT", 500);						// ³ÈÂç²èÁü½Ä
+define("SMALL_IMAGE_WIDTH",  130);						// °ìÍ÷²èÁü²£
+define("SMALL_IMAGE_HEIGHT", 130);						// °ìÍ÷²èÁü½Ä
+define("NORMAL_IMAGE_WIDTH",  260);						// ÄÌ¾ï²èÁü²£
+define("NORMAL_IMAGE_HEIGHT", 260);						// ÄÌ¾ï²èÁü½Ä
+define("NORMAL_SUBIMAGE_WIDTH", 130);					// ÄÌ¾ï¥µ¥Ö²èÁü²£
+define("NORMAL_SUBIMAGE_HEIGHT", 130);					// ÄÌ¾ï¥µ¥Ö²èÁü½Ä
+define("LARGE_SUBIMAGE_WIDTH", 500);					// ³ÈÂç¥µ¥Ö²èÁü²£
+define("LARGE_SUBIMAGE_HEIGHT", 500);					// ³ÈÂç¥µ¥Ö²èÁü½Ä
+define("DISP_IMAGE_WIDTH",  65);						// °ìÍ÷É½¼¨²èÁü²£
+define("DISP_IMAGE_HEIGHT", 65);						// °ìÍ÷É½¼¨²èÁü½Ä
+define("OTHER_IMAGE1_WIDTH", 500);						// ¤½¤ÎÂ¾¤Î²èÁü1
+define("OTHER_IMAGE1_HEIGHT", 500);						// ¤½¤ÎÂ¾¤Î²èÁü1
+define("HTMLMAIL_IMAGE_WIDTH",  110);					// HTML¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¥á¡¼¥ëÃ´Åö²èÁü²£
+define("HTMLMAIL_IMAGE_HEIGHT", 120);					//  HTML¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¥á¡¼¥ëÃ´Åö²èÁü½Ä
+
+define("IMAGE_SIZE", 100);								// ²èÁü¥µ¥¤¥ºÀ©¸Â(KB)
+define("CSV_SIZE", 2000);								// CSV¥µ¥¤¥ºÀ©¸Â(KB)
+define("PDF_SIZE", 5000);								// PDF¥µ¥¤¥ºÀ©¸Â(KB):¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ëÅù
+define("LEVEL_MAX", 5);									// ¥«¥Æ¥´¥ê¤ÎºÇÂç³¬ÁØ
+define("CATEGORY_MAX", 1000);							// ºÇÂç¥«¥Æ¥´¥êÅÐÏ¿¿ô
+
+/* É½¼¨´ØÏ¢ */
+define ("ADMIN_TITLE", "EC¥µ¥¤¥È´ÉÍý¥Ú¡¼¥¸");			// ´ÉÍý¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+define ("SELECT_RGB", "#ffffdf");						// ÊÔ½¸»þ¶¯Ä´É½¼¨¿§
+define ("DISABLED_RGB", "#C9C9C9");						// ÆþÎÏ¹àÌÜÌµ¸ú»þ¤ÎÉ½¼¨¿§
+define ("ERR_COLOR", "#ffe8e8");						// ¥¨¥é¡¼»þÉ½¼¨¿§
+define ("CATEGORY_HEAD", ">");							// ¿Æ¥«¥Æ¥´¥êÉ½¼¨Ê¸»ú
+define ("START_BIRTH_YEAR", 1901);						// À¸Ç¯·îÆüÁªÂò³«»ÏÇ¯
+
+/* ¥·¥¹¥Æ¥à¥Ñ¥¹ */
+define ("LOG_PATH", ROOT_DIR . "data/logs/site.log");							// ¥í¥°¥Õ¥¡¥¤¥ë
+define ("CUSTOMER_LOG_PATH", ROOT_DIR . "data/logs/customer.log");				// ²ñ°÷¥í¥°¥¤¥ó ¥í¥°¥Õ¥¡¥¤¥ë
+define ("TEMPLATE_ADMIN_DIR", ROOT_DIR . "data/Smarty/templates/admin");		// SMARTY¥Æ¥ó¥×¥ì¡¼¥È
+define ("TEMPLATE_DIR", ROOT_DIR . "data/Smarty/templates");					// SMARTY¥Æ¥ó¥×¥ì¡¼¥È
+define ("COMPILE_ADMIN_DIR", ROOT_DIR . "data/Smarty/templates_c/admin");		// SMARTY¥³¥ó¥Ñ¥¤¥ë
+define ("COMPILE_DIR", ROOT_DIR . "data/Smarty/templates_c");					// SMARTY¥³¥ó¥Ñ¥¤¥ë
+
+define ("TEMPLATE_FTP_DIR", ROOT_DIR . "html/user_data/templates/");			// SMARTY¥Æ¥ó¥×¥ì¡¼¥È(FTPµö²Ä)
+define ("COMPILE_FTP_DIR", ROOT_DIR . "data/Smarty/templates_c/user_data/");	// SMARTY¥³¥ó¥Ñ¥¤¥ë
+
+define ("IMAGE_TEMP_DIR", ROOT_DIR . "html/upload/temp_image/");				// ²èÁü°ì»þÊÝÂ¸
+define ("IMAGE_SAVE_DIR", ROOT_DIR . "html/upload/save_image/");				// ²èÁüÊÝÂ¸Àè
+define ("IMAGE_TEMP_URL", "/upload/temp_image/");								// ²èÁü°ì»þÊÝÂ¸URL
+define ("IMAGE_SAVE_URL", "/upload/save_image/");								// ²èÁüÊÝÂ¸ÀèURL
+define ("CSV_TEMP_DIR", ROOT_DIR. "html/upload/csv/");							// ¥¨¥ó¥³¡¼¥ÉCSV¤Î°ì»þÊÝÂ¸Àè
+define ("NO_IMAGE_URL", "/misc/dummy.gif");										// ²èÁü¤¬¤Ê¤¤¾ì¹ç¤ËÉ½¼¨
+
+/* URL¥Ñ¥¹ */
+define ("URL_SYSTEM_TOP", "/admin/system/index.php");		// ¥·¥¹¥Æ¥à´ÉÍý¥È¥Ã¥×
+define ("URL_CLASS_REGIST", "/admin/products/class.php");	// µ¬³ÊÅÐÏ¿
+define ("URL_INPUT_ZIP", "/input_zip.php");			// Í¹ÊØÈÖ¹æÆþÎÏ
+define ("URL_DELIVERY_TOP", "/admin/basis/delivery.php");	// ÇÛÁ÷¶È¼ÔÅÐÏ¿
+define ("URL_PAYMENT_TOP", "/admin/basis/payment.php");		// »ÙÊ§¤¤ÊýË¡ÅÐÏ¿
+define ("URL_HOME", "/admin/home.php");						// ¥Û¡¼¥à
+define ("URL_LOGIN", "/admin/index.php");					// ¥í¥°¥¤¥ó¥Ú¡¼¥¸
+define ("URL_SEARCH_TOP", "/admin/products/index.php");		// ¾¦ÉÊ¸¡º÷¥Ú¡¼¥¸
+define ("URL_ORDER_EDIT", "/admin/order/edit.php");			// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_SEARCH_ORDER", "/admin/order/index.php");		// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_ORDER_MAIL", "/admin/order/mail.php");			// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_LOGOUT", "/admin/logout.php");					// ¥í¥°¥¢¥¦¥È¥Ú¡¼¥¸
+define ("URL_SYSTEM_CSV", "/admin/system/member_csv.php");	// ¥·¥¹¥Æ¥à´ÉÍýCSV½ÐÎÏ¥Ú¡¼¥¸
+define ("URL_SYSTEM_TOP", "/admin/system/index.php");		// ¥·¥¹¥Æ¥à´ÉÍýTOP¥Ú¡¼¥¸
+define ("URL_ADMIN_CSS", "/admin/css/");					// ´ÉÍý¥Ú¡¼¥¸ÍÑCSSÊÝ´É¥Ç¥£¥ì¥¯¥È¥ê
+
+/* Ç§¾Ú¥¨¥é¡¼ */
+define ("SUCCESS", 0);			// ¥¢¥¯¥»¥¹À®¸ù
+define ("LOGIN_ERROR", 1);		// ¥í¥°¥¤¥ó¼ºÇÔ
+define ("ACCESS_ERROR", 2);		// ¥¢¥¯¥»¥¹¼ºÇÔ¡Ê¥¿¥¤¥à¥¢¥¦¥ÈÅù¡Ë
+define ("AUTH_ERROR", 3);		// ¥¢¥¯¥»¥¹¸¢¸Â°ãÈ¿
+
+/* É½¼¨¿ôÀ©¸Â */
+define ("PRODUCTS_LIST_MAX", 15);	// ¾¦ÉÊ°ìÍ÷É½¼¨¿ô
+define ("MEMBER_PMAX", 10);			// ¥á¥ó¥Ð¡¼´ÉÍý¥Ú¡¼¥¸É½¼¨¹Ô¿ô
+define ("SEARCH_PMAX", 10);			// ¸¡º÷¥Ú¡¼¥¸É½¼¨¹Ô¿ô
+define ("NAVI_PMAX", 5);			// ¥Ú¡¼¥¸ÈÖ¹æ¤ÎºÇÂçÉ½¼¨¸Ä¿ô
+define ("PRODUCTSUB_MAX", 5);		// ¾¦ÉÊ¥µ¥Ö¾ðÊóºÇÂç¿ô
+define ("DELIVTIME_MAX", 16);		// ÇÛÁ÷»þ´Ö¤ÎºÇÂçÉ½¼¨¿ô
+define ("DELIVFEE_MAX", 47);		// ÇÛÁ÷ÎÁ¶â¤ÎºÇÂçÉ½¼¨¿ô
+
+/* Ê¸»ú¿ôÀ©¸Â */
+define ("STEXT_LEN", 50);		// Ã»¤¤¹àÌÜ¤ÎÊ¸»ú¿ô¡ÊÌ¾Á°¤Ê¤É)
+define ("SMTEXT_LEN", 100);
+define ("MTEXT_LEN", 200);		// Ä¹¤¤¹àÌÜ¤ÎÊ¸»ú¿ô¡Ê½»½ê¤Ê¤É¡Ë
+define ("MLTEXT_LEN", 1000);	// Ä¹ÃæÊ¸¤ÎÊ¸»ú¿ô¡ÊÌä¤¤¹ç¤ï¤»¤Ê¤É¡Ë
+define ("LTEXT_LEN", 3000);		// Ä¹Ê¸¤ÎÊ¸»ú¿ô
+define ("LLTEXT_LEN", 99999);	// Ä¶Ä¹Ê¸¤ÎÊ¸»ú¿ô¡Ê¥á¥ë¥Þ¥¬¤Ê¤É¡Ë
+define ("URL_LEN", 300);		// URL¤ÎÊ¸»úÄ¹
+define("ID_MAX_LEN", 15);		// ID¡¦¥Ñ¥¹¥ï¡¼¥É¤ÎÊ¸»ú¿ôÀ©¸Â
+define("ID_MIN_LEN", 4);		// ID¡¦¥Ñ¥¹¥ï¡¼¥É¤ÎÊ¸»ú¿ôÀ©¸Â
+define("PRICE_LEN", 8);			// ¶â³Û·å¿ô
+define("PERCENTAGE_LEN", 3);	// Î¨·å¿ô
+define("AMOUNT_LEN", 6);		// ºß¸Ë¿ô¡¢ÈÎÇäÀ©¸Â¿ô
+define("ZIP01_LEN", 3);			// Í¹ÊØÈÖ¹æ1
+define("ZIP02_LEN", 4);			// Í¹ÊØÈÖ¹æ2
+define("TEL_ITEM_LEN", 6);		// ÅÅÏÃÈÖ¹æ³Æ¹àÌÜÀ©¸Â
+define("TEL_LEN", 12);			// ÅÅÏÃÈÖ¹æÁí¿ô
+define("PASSWORD_LEN1", 4);		// ¥Ñ¥¹¥ï¡¼¥É1
+define("PASSWORD_LEN2", 10);	// ¥Ñ¥¹¥ï¡¼¥É2
+define("INT_LEN", 8);			// ¸¡ºº¿ôÃÍÍÑ·å¿ô(INT)
+define("CREDIT_NO_LEN", 4);		// ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É¤ÎÊ¸»ú¿ô
+define("SEARCH_CATEGORY_LEN", 18);	// ¸¡º÷¥«¥Æ¥´¥êºÇÂçÉ½¼¨Ê¸»ú¿ô(byte)
+
+/** ¥Õ¥í¥ó¥È¥Ú¡¼¥¸ **/
+
+/* ¥·¥¹¥Æ¥à´ØÏ¢ */
+define ("SALE_LIMIT_MAX", 10);		// ¹ØÆþÀ©¸Â¤Ê¤·¤Î¾ì¹ç¤ÎºÇÂç¹ØÆþ¸Ä¿ô
+define ("SITE_TITLE", "£Å£Ã-£Ã£Õ£Â£Å  ¥Æ¥¹¥È¥µ¥¤¥È");	// HTML¥¿¥¤¥È¥ë
+define ("COOKIE_EXPIRE", 365);		// ¥¯¥Ã¥­¡¼ÊÝ»ý´ü¸Â(Æü)
+define ("FREE_DIAL", "0120-339337");
+
+/* °ìÈÌ¥µ¥¤¥È¥¨¥é¡¼ */
+define ("PRODUCT_NOT_FOUND", 1);	// »ØÄê¾¦ÉÊ¥Ú¡¼¥¸¤¬¤Ê¤¤
+define ("CART_EMPTY", 2);			// ¥«¡¼¥ÈÆâ¤¬¶õ
+define ("PAGE_ERROR", 3);			// ¥Ú¡¼¥¸¿ä°Ü¥¨¥é¡¼
+define ("CART_ADD_ERROR", 4);		// ¹ØÆþ½èÍýÃæ¤Î¥«¡¼¥È¾¦ÉÊÄÉ²Ã¥¨¥é¡¼
+define ("CANCEL_PURCHASE", 5);		// Â¾¤Ë¤â¹ØÆþ¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿¾ì¹ç
+define ("CATEGORY_NOT_FOUND", 6);	// »ØÄê¥«¥Æ¥´¥ê¥Ú¡¼¥¸¤¬¤Ê¤¤
+define ("SITE_LOGIN_ERROR", 7);		// ¥í¥°¥¤¥ó¤Ë¼ºÇÔ
+define ("CUSTOMER_ERROR", 8);		// ²ñ°÷ÀìÍÑ¥Ú¡¼¥¸¤Ø¤Î¥¢¥¯¥»¥¹¥¨¥é¡¼
+define ("SOLD_OUT", 9);				// ¹ØÆþ»þ¤ÎÇä¤êÀÚ¤ì¥¨¥é¡¼
+define ("CART_NOT_FOUND", 10);		// ¥«¡¼¥ÈÆâ¾¦ÉÊ¤ÎÆÉ¹þ¥¨¥é¡¼
+define ("LACK_POINT", 11);			// ¥Ý¥¤¥ó¥È¤ÎÉÔÂ­
+define ("TEMP_LOGIN_ERROR", 12);	// ²¾ÅÐÏ¿¼Ô¤¬¥í¥°¥¤¥ó¤Ë¼ºÇÔ
+define ("URL_ERROR", 13);			// URL¥¨¥é¡¼
+define ("EXTRACT_ERROR", 14);		//¥Õ¥¡¥¤¥ë²òÅà¥¨¥é¡¼
+define ("FTP_DOWNLOAD_ERROR", 15);	//FTP¥À¥¦¥ó¥í¡¼¥É¥¨¥é¡¼
+define ("FTP_LOGIN_ERROR", 16);		//FTP¥í¥°¥¤¥ó¥¨¥é¡¼
+define ("FTP_CONNECT_ERROR", 17);	//FTPÀÜÂ³¥¨¥é¡¼
+define ("CREATE_DB_ERROR", 18);		//DBºîÀ®¥¨¥é¡¼
+define ("DB_IMPORT_ERROR", 19);		//DB¥¤¥ó¥Ý¡¼¥È¥¨¥é¡¼
+define ("FILE_NOT_FOUND", 20);		//ÀßÄê¥Õ¥¡¥¤¥ëÂ¸ºß¥¨¥é¡¼
+define ("WRITE_FILE_ERROR", 21);	//¥Õ¥¡¥¤¥ë½ñ¤­¹þ¤ß¥¨¥é¡¼
+
+/* É½¼¨´ØÏ¢ */
+define ("SEPA_CATNAVI", " > ");	// ¥«¥Æ¥´¥ê¶èÀÚ¤êÊ¸»ú
+define ("SEPA_CATLIST", " | ");	// ¥«¥Æ¥´¥ê¶èÀÚ¤êÊ¸»ú
+
+/* URL */
+define ("URL_SITE_TOP", "/index.php");					// ¥µ¥¤¥È¥È¥Ã¥×
+define ("URL_CART_TOP", "/cart/index.php");				// ¥«¡¼¥È¥È¥Ã¥×
+define ("URL_SHOP_CONFIRM", "/shopping/confirm.php");	// ¹ØÆþ³ÎÇ§¥Ú¡¼¥¸
+define ("URL_SHOP_PAYMENT", "/shopping/payment.php");	// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸
+define ("URL_SHOP_TOP", "/shopping/index.php");			// ²ñ°÷¾ðÊóÆþÎÏ
+define ("URL_SHOP_COMPLETE", "/shopping/complete.php");	// ¹ØÆþ´°Î»²èÌÌ
+define ("URL_SHOP_CREDIT", "/shopping/card.php");		// ¥«¡¼¥É·èºÑ²èÌÌ
+define ("URL_SHOP_LOAN", "/shopping/loan.php");			// ¥í¡¼¥ó·èºÑ²èÌÌ
+define ("URL_SHOP_CONVENIENCE", "/shopping/convenience.php");	// ¥³¥ó¥Ó¥Ë·èºÑ²èÌÌ
+define ("URL_PRODUCTS_TOP","/products/top.php");		// ¾¦ÉÊ¥È¥Ã¥×
+define ("LIST_P_HTML", "/products/list-p");				// ¾¦ÉÊ°ìÍ÷(HTML½ÐÎÏ)
+define ("LIST_C_HTML", "/products/list.php?mode=search&category_id=");				// ¾¦ÉÊ°ìÍ÷(HTML½ÐÎÏ)
+define ("DETAIL_P_HTML", "/products/detail.php?product_id=");			// ¾¦ÉÊ¾ÜºÙ(HTML½ÐÎÏ)
+
+/*
+ * ¥µ¥¤¥ÈÄêµÁÊÑ¿ô
+ */
+ 
+// ¥¢¥¯¥»¥¹¸¢¸Â
+// 0:´ÉÍý¼Ô¤Î¤ß¥¢¥¯¥»¥¹²ÄÇ½
+// 1:°ìÈÌ°Ê¾å¤¬¥¢¥¯¥»¥¹²ÄÇ½
+$arrPERMISSION[URL_SYSTEM_TOP] = 0;
+$arrPERMISSION["/admin/system/delete.php"] = 0;
+$arrPERMISSION["/admin/system/index.php"] = 0;
+$arrPERMISSION["/admin/system/input.php"] = 0;
+$arrPERMISSION["/admin/system/master.php"] = 0;
+$arrPERMISSION["/admin/system/master_delete.php"] = 0;
+$arrPERMISSION["/admin/system/master_rank.php"] = 0;
+$arrPERMISSION["/admin/system/mastercsv.php"] = 0;
+$arrPERMISSION["/admin/system/rank.php"] = 0;
+$arrPERMISSION["/admin/entry/index.php"] = 1;
+$arrPERMISSION["/admin/entry/delete.php"] = 1;
+$arrPERMISSION["/admin/entry/inputzip.php"] = 1;
+$arrPERMISSION["/admin/search/delete_note.php"] = 1;
+
+// ¥í¥°¥¢¥¦¥ÈÉÔ²Ä¥Ú¡¼¥¸
+$arrDISABLE_LOGOUT = array(
+	1 => "/shopping/deliv.php",
+	2 => "/shopping/payment.php",
+	3 => "/shopping/confirm.php",
+	4 => "/shopping/card.php",
+	5 => "/shopping/loan.php",
+);
+
+// ¥á¥ó¥Ð¡¼´ÉÍý-¸¢¸Â
+$arrAUTHORITY[0] = "´ÉÍý¼Ô";
+// $arrAUTHORITY[1] = "°ìÈÌ";
+// $arrAUTHORITY[2] = "±ÜÍ÷";
+
+// ¥á¥ó¥Ð¡¼´ÉÍý-²ÔÆ¯¾õ¶·
+$arrWORK[0] = "Èó²ÔÆ¯";
+$arrWORK[1] = "²ÔÆ¯";
+
+// ¾¦ÉÊÅÐÏ¿-É½¼¨
+$arrDISP[1] = "¸ø³«";
+$arrDISP[2] = "Èó¸ø³«";
+
+// ¾¦ÉÊÅÐÏ¿-µ¬³Ê
+$arrCLASS[1] = "µ¬³ÊÌµ¤·";
+$arrCLASS[2] = "µ¬³ÊÍ­¤ê";
+
+// ¸¡º÷¥é¥ó¥¯
+$arrSRANK[1] = 1;
+$arrSRANK[2] = 2;
+$arrSRANK[3] = 3;
+$arrSRANK[4] = 4;
+$arrSRANK[5] = 5;
+
+// ¾¦ÉÊÅÐÏ¿-¥¹¥Æ¡¼¥¿¥¹
+$arrSTATUS[1] = "NEW";
+$arrSTATUS[2] = "»Ä¤ê¤ï¤º¤«";
+$arrSTATUS[3] = "¥Ý¥¤¥ó¥È£²ÇÜ";
+$arrSTATUS[4] = "¥ª¥¹¥¹¥á";
+$arrSTATUS[5] = "¸ÂÄêÉÊ";
+
+// ¾¦ÉÊÅÐÏ¿-¥¹¥Æ¡¼¥¿¥¹²èÁü
+$arrSTATUS_IMAGE[1] = "/img/right_product/icon01.gif";
+$arrSTATUS_IMAGE[2] = "/img/right_product/icon02.gif";
+$arrSTATUS_IMAGE[3] = "/img/right_product/icon03.gif";
+$arrSTATUS_IMAGE[4] = "/img/right_product/icon04.gif";
+$arrSTATUS_IMAGE[5] = "/img/right_product/icon05.gif";
+
+// ÆþÎÏµö²Ä¤¹¤ë¥¿¥°
+$arrAllowedTag = array(
+	"table",
+	"tr",
+	"td",
+	"a",
+	"b",
+	"blink",
+	"br",
+	"center",
+	"font",
+	"h",
+	"hr",
+	"img",
+	"li",
+	"strong",
+	"p",
+	"div",
+	"i",
+	"u",
+	"s",
+	"/table",
+	"/tr",
+	"/td",
+	"/a",
+	"/b",
+	"/blink",
+	"/br",
+	"/center",
+	"/font",
+	"/h",
+	"/hr",
+	"/img",
+	"/li",
+	"/strong",
+	"/p",
+	"/div",
+	"/i",
+	"/u",
+	"/s"
+);
+
+// £±¥Ú¡¼¥¸É½¼¨¹Ô¿ô
+$arrPageMax = array(
+	10 => "10",
+	20 => "20",
+	30 => "30",
+	40 => "40",
+	50 => "50",
+	60 => "60",
+	70 => "70",
+	80 => "80",
+	90 => "90",
+	100 => "100",
+);	
+	
+// ¥á¥ë¥Þ¥¬¼ïÊÌ
+$arrMagazineType["1"] = "HTML";
+$arrMagazineType["2"] = "¥Æ¥­¥¹¥È";
+
+$arrMagazineTypeAll = $arrMagazineType;
+$arrMagazineTypeAll["3"] = "HTML¥Æ¥ó¥×¥ì¡¼¥È";
+
+
+/* ¥á¥ë¥Þ¥¬¼ïÊÌ */
+$arrMAILMAGATYPE = array(
+	1 => "HTML¥á¡¼¥ë",
+	2 => "¥Æ¥­¥¹¥È¥á¡¼¥ë",
+	3 => "´õË¾¤·¤Ê¤¤"
+);
+
+/* ¤ª¤¹¤¹¤á¥ì¥Ù¥ë */
+$arrRECOMMEND = array(
+	5 => "¡ú¡ú¡ú¡ú¡ú",
+	4 => "¡ú¡ú¡ú¡ú",
+	3 => "¡ú¡ú¡ú",
+	2 => "¡ú¡ú",
+	1 => "¡ú"
+);
+
+$arrTAXRULE = array(
+	1 => "»Í¼Î¸ÞÆþ",
+	2 => "ÀÚ¤ê¼Î¤Æ",
+	3 => "ÀÚ¤ê¾å¤²"
+);
+
+
+// ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¤Î¼ïÎà
+$arrMAILTEMPLATE = array(
+	 1 => "ÃíÊ¸¼õÉÕ¥á¡¼¥ë"
+	,2 => "ÃíÊ¸¥­¥ã¥ó¥»¥ë¼õÉÕ¥á¡¼¥ë"
+	,3 => "¼è¤ê´ó¤»³ÎÇ§¥á¡¼¥ë"
+);
+
+// ³Æ¥Æ¥ó¥×¥ì¡¼¥È¤Î¥Ñ¥¹
+$arrMAILTPLPATH = array(
+	1 => "mail_templates/order_mail.tpl",
+	2 => "mail_templates/order_mail.tpl",
+	3 => "mail_templates/order_mail.tpl",
+	4 => "mail_templates/contact_mail.tpl",
+);
+
+// ¼õÃí¥¹¥Æ¡¼¥¿¥¹ÊÑ¹¹¤ÎºÝ¤Ë¥Ý¥¤¥ó¥ÈÅù¤ò²Ã»»¤¹¤ë¥¹¥Æ¡¼¥¿¥¹ÈÖ¹æ¡ÊÈ¯Á÷ºÑ¤ß¡Ë
+define("ODERSTATUS_COMMIT", 5);
+
+/* ÅÔÆ»ÉÜ¸©ÇÛÎó */
+$arrPref = array(
+					1 => "ËÌ³¤Æ»",
+					2 => "ÀÄ¿¹¸©",
+					3 => "´ä¼ê¸©",
+					4 => "µÜ¾ë¸©",
+					5 => "½©ÅÄ¸©",
+					6 => "»³·Á¸©",
+					7 => "Ê¡Åç¸©",
+					8 => "°ñ¾ë¸©",
+					9 => "ÆÊÌÚ¸©",
+					10 => "·²ÇÏ¸©",
+					11 => "ºë¶Ì¸©",
+					12 => "ÀéÍÕ¸©",
+					13 => "ÅìµþÅÔ",
+					14 => "¿ÀÆàÀî¸©",
+					15 => "¿·³ã¸©",
+					16 => "ÉÙ»³¸©",
+					17 => "ÀÐÀî¸©",
+					18 => "Ê¡°æ¸©",
+					19 => "»³Íü¸©",
+					20 => "Ä¹Ìî¸©",
+					21 => "´ôÉì¸©",
+					22 => "ÀÅ²¬¸©",
+					23 => "°¦ÃÎ¸©",
+					24 => "»°½Å¸©",
+					25 => "¼¢²ì¸©",
+					26 => "µþÅÔÉÜ",
+					27 => "ÂçºåÉÜ",
+					28 => "Ê¼¸Ë¸©",
+					29 => "ÆàÎÉ¸©",
+					30 => "ÏÂ²Î»³¸©",
+					31 => "Ä»¼è¸©",
+					32 => "Åçº¬¸©",
+					33 => "²¬»³¸©",
+					34 => "¹­Åç¸©",
+					35 => "»³¸ý¸©",
+					36 => "ÆÁÅç¸©",
+					37 => "¹áÀî¸©",
+					38 => "°¦É²¸©",
+					39 => "¹âÃÎ¸©",
+					40 => "Ê¡²¬¸©",
+					41 => "º´²ì¸©",
+					42 => "Ä¹ºê¸©",
+					43 => "·§ËÜ¸©",
+					44 => "ÂçÊ¬¸©",
+					45 => "µÜºê¸©",
+					46 => "¼¯»ùÅç¸©",
+					47 => "²­Æì¸©"
+				);
+				
+/* ¿¦¶ÈÇÛÎó */
+$arrJob = array(
+					1 => "²ñ¼Ò°÷",
+					2 => "¶µ¿¦",
+					3 => "¸øÌ³°÷",
+					4 => "ÀìÌç¶È¡¦µ»½Ñ¿¦",
+					5 => "¥µ¡¼¥Ó¥¹¶È",
+					6 => "¼«±Ä¶È",
+					7 => "³ØÀ¸",
+					8 => "¼çÉØ",
+					9 => "¤½¤ÎÂ¾"
+				);
+
+/* ¥Ñ¥¹¥ï¡¼¥É¤ÎÅú¤¨ÇÛÎó */
+$arrReminder = array(
+						1 => "Êì¿Æ¤ÎµìÀ«¤Ï¡©",
+						2 => "¤ªµ¤¤ËÆþ¤ê¤Î¥Þ¥ó¥¬¤Ï¡©",
+						3 => "Âç¹¥¤­¤Ê¥Ú¥Ã¥È¤ÎÌ¾Á°¤Ï¡©",
+						4 => "½éÎø¤Î¿Í¤ÎÌ¾Á°¤Ï¡©",
+						5 => "ÌÌÇò¤«¤Ã¤¿±Ç²è¤Ï¡©",
+						6 => "Âº·É¤·¤Æ¤¤¤¿ÀèÀ¸¤ÎÌ¾Á°¤Ï¡©",
+						7 => "¹¥¤­¤Ê¿©¤ÙÊª¤Ï¡©"
+					);
+/*¡¡À­ÊÌÇÛÎó¡¡*/
+$arrSex = array(
+					1 => "ÃËÀ­",
+					2 => "½÷À­"
+				);
+
+/*¡¡1¹Ô¿ô¡¡*/		
+$arrPageRows = array(
+						10 => 10,
+						20 => 20,
+						30 => 30,
+						40 => 40,
+						50 => 50,
+						60 => 60,
+						70 => 70,
+						80 => 80,
+						90 => 90,
+						100 => 100,
+					);
+		
+/* ¼õÃí¥¹¥Æ¡¼¥¿¥¹ */
+$arrORDERSTATUS = array(
+	1 => "¿·µ¬¼õÉÕ",
+	2 => "Æþ¶âÂÔ¤Á",
+	3 => "¥­¥ã¥ó¥»¥ë",
+	4 => "¼è¤ê´ó¤»Ãæ",
+	5 => "È¯Á÷ºÑ¤ß"
+);
+
+// ¼õÃí¥¹¥Æ¡¼¥¿¥¹ÊÑ¹¹¤ÎºÝ¤Ë¥Ý¥¤¥ó¥ÈÅù¤ò²Ã»»¤¹¤ë¥¹¥Æ¡¼¥¿¥¹ÈÖ¹æ¡ÊÈ¯Á÷ºÑ¤ß¡Ë
+define("ODERSTATUS_COMMIT", 5);
+
+/* ¾¦ÉÊ¼ïÊÌ¤ÎÉ½¼¨¿§ */
+$arrPRODUCTSTATUS_COLOR = array(
+	1 => "#FFFFFF",
+	2 => "#C9C9C9",
+	3 => "#DDE6F2"
+);
+
+$arrORDERSTATUS_COLOR = array(
+	1 => "#FFFFFF",
+	2 => "#FFDE9B",
+	3 => "#C9C9C9",
+	4 => "#FFD9D9",
+	5 => "#BFDFFF"
+);
+
+// ÍËÆü
+$arrWDAY = array(
+	0 => "Æü",
+	1 => "·î",
+	2 => "²Ð",
+	3 => "¿å",
+	4 => "ÌÚ",
+	5 => "¶â",
+	6 => "ÅÚ"
+);			
+		
+/* ¿·Ãå¾ðÊó´ÉÍý²èÌÌ */
+define ("ADMIN_NEWS_STARTYEAR", 2005);	// ³«»ÏÇ¯(À¾Îñ)
+
+/* ²ñ°÷ÅÐÏ¿ */
+define("ENTRY_CUSTOMER_TEMP_SUBJECT", "²ñ°÷²¾ÅÐÏ¿¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£");
+define("ENTRY_CUSTOMER_REGIST_SUBJECT", "ËÜ²ñ°÷ÅÐÏ¿¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£");
+define("ENTRY_LIMIT_HOUR", 1);		//ºÆÆþ²ñÀ©¸Â»þ´Ö¡ÊÃ±°Ì: »þ´Ö)
+
+// ¥ª¥¹¥¹¥á¾¦ÉÊÉ½¼¨¿ô
+define("RECOMMEND_NUM", 8);			// ¥ª¥¹¥¹¥á¾¦ÉÊ
+define ("BEST_MAX", 5);				// ¥Ù¥¹¥È¾¦ÉÊ¤ÎºÇÂçÅÐÏ¿¿ô
+define ("BEST_MIN", 3);				// ¥Ù¥¹¥È¾¦ÉÊ¤ÎºÇ¾®ÅÐÏ¿¿ô¡ÊÅÐÏ¿¿ô¤¬Ëþ¤¿¤Ê¤¤¾ì¹ç¤ÏÉ½¼¨¤·¤Ê¤¤¡£)
+
+//È¯Á÷ÆüÌÜ°Â
+$arrDELIVERYDATE = array(
+	1 => "Â¨Æü",
+	2 => "1¡Á2Æü¸å",
+	3 => "3¡Á4Æü¸å",
+	4 => "1½µ´Ö°Ê¹ß",
+	5 => "2½µ´Ö°Ê¹ß",
+	6 => "3½µ´Ö°Ê¹ß",
+	7 => "1¥ö·î°Ê¹ß",
+	8 => "2¥ö·î°Ê¹ß",
+	9 => "¤ª¼è¤ê´ó¤»(¾¦ÉÊÆþ²Ù¸å)"
+);
+
+/* ÇÛÃ£²ÄÇ½¤ÊÆüÉÕ°Ê¹ß¤Î¥×¥ë¥À¥¦¥óÉ½¼¨ºÇÂçÆü¿ô */
+define("DELIV_DATE_END_MAX", 21);
+
+/* ¹ØÆþ»þ¶¯À©²ñ°÷ÅÐÏ¿ */
+define("PURCHASE_CUSTOMER_REGIST", 0);	//1:Í­¸ú¡¡0:Ìµ¸ú
+
+/* ¾¦ÉÊ¥ê¥¹¥ÈÉ½¼¨·ï¿ô */
+$arrPRODUCTLISTMAX = array(
+	15 => '15·ï',
+	30 => '30·ï',
+	50 => '50·ï'
+);
+
+/* ¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹¡¡É½¼¨·ï¿ô */
+define("RELATED_PRODUCTS_MAX", 3);
+
+/*--------- ¢§¥³¥ó¥Ó¥Ë·èºÑÍÑ ---------*/
+
+//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+$arrCONVENIENCE = array(
+	1 => '¥»¥Ö¥ó¥¤¥ì¥Ö¥ó',
+	2 => '¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È',
+	3 => '¥µ¡¼¥¯¥ëK¥µ¥ó¥¯¥¹',
+	4 => '¥í¡¼¥½¥ó¡¦¥»¥¤¥³¡¼¥Þ¡¼¥È',
+	5 => '¥ß¥Ë¥¹¥È¥Ã¥×¡¦¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¦¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢',
+);
+
+//³Æ¼ï¥³¥ó¥Ó¥ËÍÑ¥á¥Ã¥»¡¼¥¸
+$arrCONVENIMESSAGE = array(
+	1 => "¾åµ­URL¤«¤é¿¶¹þÉ¼¤ò°õºþ¡¢¤â¤·¤¯¤Ï¿¶¹þÉ¼ÈÖ¹æ¤ò»æ¤Ë¹µ¤¨¤Æ¡¢Á´¹ñ¤Î¥»¥Ö¥ó¥¤¥ì¥Ö¥ó¤Ë¤Æ¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£",
+	2 => "´ë¶È¥³¡¼¥É¡¢¼õÉÕÈÖ¹æ¤ò»æ¤Ê¤É¤Ë¹µ¤¨¤Æ¡¢Á´¹ñ¤Î¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È¤Ë¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£",
+	3 => "¾åµ­URL¤«¤é¿¶¹þÉ¼¤ò°õºþ¡¢¤â¤·¤¯¤Ï¥±¡¼¥¿¥¤·èºÑÈÖ¹æ¤ò»æ¤Ê¤É¤Ë¹µ¤¨¤Æ¡¢Á´¹ñ¤Î¥µ¡¼¥¯¥ëK¥µ¥ó¥¯¥¹¤Ë¤Æ¤ª»ÙÊ§¤¯¤À¤µ¤¤¡£",
+	4 => "¿¶¹þÉ¼ÈÖ¹æ¤ò»æ¤Ë¹µ¤¨¤Æ¡¢Á´¹ñ¤Î¥í¡¼¥½¥ó¤Þ¤¿¤Ï¥»¥¤¥³¡¼¥Þ¡¼¥È¤Ë¤Æ¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£",
+	5 => "¾åµ­URL¤«¤é¿¶¹þÉ¼¤ò°õºþ¤·¡¢Á´¹ñ¤Î¥ß¥Ë¥¹¥È¥Ã¥×¡¦¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¦¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢¤Ë¤Æ¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£"
+);
+
+//»ÙÊ§´ü¸Â
+define("CV_PAYMENT_LIMIT", 14);
+
+/*--------- ¢¥¥³¥ó¥Ó¥Ë·èºÑÍÑ ---------*/
+
+//¥­¥ã¥ó¥Ú¡¼¥óÅÐÏ¿ºÇÂç¿ô
+define("CAMPAIGN_REGIST_MAX", 20);
+
+//DB¤Î¼ïÎà
+$arrDB = array(
+	1 => 'PostgreSQL',
+	2 => 'MySQL'
+);
+
+// ¥Æ¥ó¥×¥ì¡¼¥È
+$arrTemplate = array(
+	1 => array(
+			"TopImage" 		 	=> "/img/template/top_l1.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top1.tpl",
+			"ProdImage" 		=> "/img/template/prod_l1.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product1.tpl",
+			"DetailImage" 		=> "/img/template/detail_l1.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail1.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l1.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage1.tpl"
+		),
+	2 => array(
+			"TopImage" 			=> "/img/template/top_l2.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top2.tpl",
+			"ProdImage" 		=> "/img/template/prod_l2.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product2.tpl",
+			"DetailImage"  		=> "/img/template/detail_l2.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail2.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l2.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage2.tpl"
+		),
+	3 => array(
+			"TopImage" 			=> "/img/template/top_l3.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top3.tpl",
+			"ProdImage" 		=> "/img/template/prod_l3.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product3.tpl",
+			"DetailImage" 		=> "/img/template/detail_l3.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail3.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l3.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage3.tpl"
+		),
+	4 => array(
+			"TopImage" 			=> "/img/template/top_l4.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top4.tpl",
+			"ProdImage" 		=> "/img/template/prod_l4.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product4.tpl",
+			"DetailImage" 		=> "/img/template/detail_l4.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail4.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l4.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage4.tpl"
+		),
+	5 => array(
+			"TopImage" 			=> "/img/template/top_l5.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top5.tpl",
+			"ProdImage" 		=> "/img/template/prod_l5.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product5.tpl",
+			"DetailImage" 		=> "/img/template/detail_l5.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail5.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l5.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage5.tpl"
+		),
+	6 => array(
+			"TopImage" 			=> "/img/template/top_l6.gif",
+			"TopTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/top6.tpl",
+			"ProdImage" 		=> "/img/template/prod_l6.gif",
+			"ProdTemplate" 		=> ROOT_DIR."data/Smarty/templates/sample/product6.tpl",
+			"DetailImage" 		=> "/img/template/detail_l6.gif",
+			"DetailTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/detail6.tpl",
+			"MypageImage" 		=> "/img/template/mypage_l6.gif",
+			"MypageTemplate" 	=> ROOT_DIR."data/Smarty/templates/sample/mypage6.tpl"
+		)
+);
+
+// ¥Ö¥í¥Ã¥¯ÇÛÃÖ
+$arrTarget = array(
+	1 => "LeftNavi",
+	2 => "MainHead",
+	3 => "RightNavi",
+	4 => "MainFoot",
+	5 => "Unused"
+);
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/conf/core.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/conf/core.php	(revision 2203)
+++ /temp/tags/eccube-0_9_2beta/data/conf/core.php	(revision 2203)
@@ -0,0 +1,37 @@
+<?php
+
+///////////////////////////////////////////////////////////
+/*
+	¥µ¥¤¥È¤´¤È¤ËÉ¬¤ºÊÑ¹¹¤¹¤ëÀßÄê
+*/
+///////////////////////////////////////////////////////////
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("USER_DIR", "html/user_data/");
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("INCLUDE_DIR", USER_DIR."include/");
+
+// ¥Ö¥í¥Ã¥¯¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("BLOC_DIR", "html/user_data/include/bloc/");
+
+// ¥æ¡¼¥¶¡¼ºîÀ®²èÌÌ¤Î¥Ç¥Õ¥©¥ë¥ÈPHP¥Õ¥¡¥¤¥ë
+define("USER_DEF_PHP", ROOT_DIR."html/__default.php");
+
+// ¤½¤ÎÂ¾²èÌÌ¤Î¥Ç¥Õ¥©¥ë¥È¥Ú¡¼¥¸¥ì¥¤¥¢¥¦¥È
+define("DEF_LAYOUT", "products/list.php");
+
+// DB¥¨¥é¡¼¥á¡¼¥ëÁ÷¿®Àè
+define ("DB_ERROR_MAIL_TO", "error-ml@lockon.co.jp");
+
+// DB¥¨¥é¡¼¥á¡¼¥ë·ïÌ¾
+define ("DB_ERROR_MAIL_SUBJECT", "OS_TEST_ERROR");
+
+// ¥µ¥¤¥ÈÍÑDB
+define ("DEFAULT_DSN", "pgsql://" . DB_USER . ":" . DB_PASSWORD . "@" . DB_SERVER . "/" . DB_NAME);
+
+// Í¹ÊØÈÖ¹æÀìÍÑDB
+define ("ZIP_DSN", DEFAULT_DSN);
+
+define ("USER_URL", SITE_URL."user_data/");					// ¥æ¡¼¥¶¡¼ºîÀ®¥Ú¡¼¥¸Åù	
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/ibase.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/ibase.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/ibase.php	(revision 1328)
@@ -0,0 +1,1071 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's interbase extension
+ * for interacting with Interbase and Firebird databases
+ *
+ * While this class works with PHP 4, PHP's InterBase extension is
+ * unstable in PHP 4.  Use PHP 5.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's interbase extension
+ * for interacting with Interbase and Firebird databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * While this class works with PHP 4, PHP's InterBase extension is
+ * unstable in PHP 4.  Use PHP 5.
+ *
+ * NOTICE:  limitQuery() only works for Firebird.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @since      Class became stable in Release 1.7.0
+ */
+class DB_ibase extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'ibase';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'ibase';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * NOTE: only firebird supports limit.
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => false,
+        'new_link'      => false,
+        'numrows'       => 'emulate',
+        'pconnect'      => true,
+        'prepare'       => true,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        -104 => DB_ERROR_SYNTAX,
+        -150 => DB_ERROR_ACCESS_VIOLATION,
+        -151 => DB_ERROR_ACCESS_VIOLATION,
+        -155 => DB_ERROR_NOSUCHTABLE,
+        -157 => DB_ERROR_NOSUCHFIELD,
+        -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        -170 => DB_ERROR_MISMATCH,
+        -171 => DB_ERROR_MISMATCH,
+        -172 => DB_ERROR_INVALID,
+        // -204 =>  // Covers too many errors, need to use regex on msg
+        -205 => DB_ERROR_NOSUCHFIELD,
+        -206 => DB_ERROR_NOSUCHFIELD,
+        -208 => DB_ERROR_INVALID,
+        -219 => DB_ERROR_NOSUCHTABLE,
+        -297 => DB_ERROR_CONSTRAINT,
+        -303 => DB_ERROR_INVALID,
+        -413 => DB_ERROR_INVALID_NUMBER,
+        -530 => DB_ERROR_CONSTRAINT,
+        -551 => DB_ERROR_ACCESS_VIOLATION,
+        -552 => DB_ERROR_ACCESS_VIOLATION,
+        // -607 =>  // Covers too many errors, need to use regex on msg
+        -625 => DB_ERROR_CONSTRAINT_NOT_NULL,
+        -803 => DB_ERROR_CONSTRAINT,
+        -804 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        -904 => DB_ERROR_CONNECT_FAILED,
+        -922 => DB_ERROR_NOSUCHDB,
+        -923 => DB_ERROR_CONNECT_FAILED,
+        -924 => DB_ERROR_CONNECT_FAILED
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * The number of rows affected by a data manipulation query
+     * @var integer
+     * @access private
+     */
+    var $affected = 0;
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The prepared statement handle from the most recently executed statement
+     *
+     * {@internal  Mainly here because the InterBase/Firebird API is only
+     * able to retrieve data from result sets if the statemnt handle is
+     * still in scope.}}
+     *
+     * @var resource
+     */
+    var $last_stmt;
+
+    /**
+     * Is the given prepared statement a data manipulation query?
+     * @var array
+     * @access private
+     */
+    var $manip_query = array();
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_ibase()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's ibase driver supports the following extra DSN options:
+     *   + buffers    The number of database buffers to allocate for the
+     *                 server-side cache.
+     *   + charset    The default character set for a database.
+     *   + dialect    The default SQL dialect for any statement
+     *                 executed within a connection.  Defaults to the
+     *                 highest one supported by client libraries.
+     *                 Functional only with InterBase 6 and up.
+     *   + role       Functional only with InterBase 5 and up.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('interbase')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+        if ($this->dbsyntax == 'firebird') {
+            $this->features['limit'] = 'alter';
+        }
+
+        $params = array(
+            $dsn['hostspec']
+                    ? ($dsn['hostspec'] . ':' . $dsn['database'])
+                    : $dsn['database'],
+            $dsn['username'] ? $dsn['username'] : null,
+            $dsn['password'] ? $dsn['password'] : null,
+            isset($dsn['charset']) ? $dsn['charset'] : null,
+            isset($dsn['buffers']) ? $dsn['buffers'] : null,
+            isset($dsn['dialect']) ? $dsn['dialect'] : null,
+            isset($dsn['role'])    ? $dsn['role'] : null,
+        );
+
+        $connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect';
+
+        $this->connection = @call_user_func_array($connect_function, $params);
+        if (!$this->connection) {
+            return $this->ibaseRaiseError(DB_ERROR_CONNECT_FAILED);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @ibase_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @ibase_query($this->connection, $query);
+
+        if (!$result) {
+            return $this->ibaseRaiseError();
+        }
+        if ($this->autocommit && $ismanip) {
+            @ibase_commit($this->connection);
+        }
+        if ($ismanip) {
+            $this->affected = $result;
+            return DB_OK;
+        } else {
+            $this->affected = 0;
+            return $result;
+        }
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * Only works with Firebird.
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        if ($this->dsn['dbsyntax'] == 'firebird') {
+            $query = preg_replace('/^([\s(])*SELECT/i',
+                                  "SELECT FIRST $count SKIP $from", $query);
+        }
+        return $query;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal ibase result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            return $this->ibaseRaiseError(DB_ERROR_NOT_CAPABLE);
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            if (function_exists('ibase_fetch_assoc')) {
+                $arr = @ibase_fetch_assoc($result);
+            } else {
+                $arr = get_object_vars(ibase_fetch_object($result));
+            }
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @ibase_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @ibase_free_result($result);
+    }
+
+    // }}}
+    // {{{ freeQuery()
+
+    function freeQuery($query)
+    {
+        @ibase_free_query($query);
+        return true;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (is_integer($this->affected)) {
+            return $this->affected;
+        }
+        return $this->ibaseRaiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @ibase_num_fields($result);
+        if (!$cols) {
+            return $this->ibaseRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ prepare()
+
+    /**
+     * Prepares a query for multiple execution with execute().
+     *
+     * prepare() requires a generic query as string like <code>
+     *    INSERT INTO numbers VALUES (?, ?, ?)
+     * </code>.  The <kbd>?</kbd> characters are placeholders.
+     *
+     * Three types of placeholders can be used:
+     *   + <kbd>?</kbd>  a quoted scalar value, i.e. strings, integers
+     *   + <kbd>!</kbd>  value is inserted 'as is'
+     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
+     *                     inserted into the query (i.e. saving binary
+     *                     data in a db)
+     *
+     * Use backslashes to escape placeholder characters if you don't want
+     * them to be interpreted as placeholders.  Example: <code>
+     *    "UPDATE foo SET col=? WHERE col='over \& under'"
+     * </code>
+     *
+     * @param string $query query to be prepared
+     * @return mixed DB statement resource on success. DB_Error on failure.
+     */
+    function prepare($query)
+    {
+        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
+                               PREG_SPLIT_DELIM_CAPTURE);
+        $token    = 0;
+        $types    = array();
+        $newquery = '';
+
+        foreach ($tokens as $key => $val) {
+            switch ($val) {
+                case '?':
+                    $types[$token++] = DB_PARAM_SCALAR;
+                    break;
+                case '&':
+                    $types[$token++] = DB_PARAM_OPAQUE;
+                    break;
+                case '!':
+                    $types[$token++] = DB_PARAM_MISC;
+                    break;
+                default:
+                    $tokens[$key] = preg_replace('/\\\([&?!])/', "\\1", $val);
+                    $newquery .= $tokens[$key] . '?';
+            }
+        }
+
+        $newquery = substr($newquery, 0, -1);
+        $this->last_query = $query;
+        $newquery = $this->modifyQuery($newquery);
+        $stmt = @ibase_prepare($this->connection, $newquery);
+        $this->prepare_types[(int)$stmt] = $types;
+        $this->manip_query[(int)$stmt]   = DB::isManip($query);
+        return $stmt;
+    }
+
+    // }}}
+    // {{{ execute()
+
+    /**
+     * Executes a DB statement prepared with prepare().
+     *
+     * @param resource  $stmt  a DB statement resource returned from prepare()
+     * @param mixed  $data  array, string or numeric data to be used in
+     *                      execution of the statement.  Quantity of items
+     *                      passed must match quantity of placeholders in
+     *                      query:  meaning 1 for non-array items or the
+     *                      quantity of elements in the array.
+     * @return object  a new DB_Result or a DB_Error when fail
+     * @see DB_ibase::prepare()
+     * @access public
+     */
+    function &execute($stmt, $data = array())
+    {
+        $data = (array)$data;
+        $this->last_parameters = $data;
+
+        $types =& $this->prepare_types[(int)$stmt];
+        if (count($types) != count($data)) {
+            $tmp =& $this->raiseError(DB_ERROR_MISMATCH);
+            return $tmp;
+        }
+
+        $i = 0;
+        foreach ($data as $key => $value) {
+            if ($types[$i] == DB_PARAM_MISC) {
+                /*
+                 * ibase doesn't seem to have the ability to pass a
+                 * parameter along unchanged, so strip off quotes from start
+                 * and end, plus turn two single quotes to one single quote,
+                 * in order to avoid the quotes getting escaped by
+                 * ibase and ending up in the database.
+                 */
+                $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
+                $data[$key] = str_replace("''", "'", $data[$key]);
+            } elseif ($types[$i] == DB_PARAM_OPAQUE) {
+                $fp = @fopen($data[$key], 'rb');
+                if (!$fp) {
+                    $tmp =& $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
+                    return $tmp;
+                }
+                $data[$key] = fread($fp, filesize($data[$key]));
+                fclose($fp);
+            }
+            $i++;
+        }
+
+        array_unshift($data, $stmt);
+
+        $res = call_user_func_array('ibase_execute', $data);
+        if (!$res) {
+            $tmp =& $this->ibaseRaiseError();
+            return $tmp;
+        }
+        /* XXX need this?
+        if ($this->autocommit && $this->manip_query[(int)$stmt]) {
+            @ibase_commit($this->connection);
+        }*/
+        $this->last_stmt = $stmt;
+        if ($this->manip_query[(int)$stmt]) {
+            $tmp = DB_OK;
+        } else {
+            $tmp =& new DB_result($this, $res);
+        }
+        return $tmp;
+    }
+
+    /**
+     * Frees the internal resources associated with a prepared query
+     *
+     * @param resource $stmt           the prepared statement's PHP resource
+     * @param bool     $free_resource  should the PHP resource be freed too?
+     *                                  Use false if you need to get data
+     *                                  from the result set later.
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_ibase::prepare()
+     */
+    function freePrepared($stmt, $free_resource = true)
+    {
+        if (!is_resource($stmt)) {
+            return false;
+        }
+        if ($free_resource) {
+            @ibase_free_query($stmt);
+        }
+        unset($this->prepare_tokens[(int)$stmt]);
+        unset($this->prepare_types[(int)$stmt]);
+        unset($this->manip_query[(int)$stmt]);
+        return true;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        $this->autocommit = $onoff ? 1 : 0;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        return @ibase_commit($this->connection);
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        return @ibase_rollback($this->connection);
+    }
+
+    // }}}
+    // {{{ transactionInit()
+
+    function transactionInit($trans_args = 0)
+    {
+        return $trans_args
+                ? @ibase_trans($trans_args, $this->connection)
+                : @ibase_trans();
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_ibase::createSequence(), DB_ibase::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $sqn = strtoupper($this->getSequenceName($seq_name));
+        $repeat = 0;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result =& $this->query("SELECT GEN_ID(${sqn}, 1) "
+                                   . 'FROM RDB$GENERATORS '
+                                   . "WHERE RDB\$GENERATOR_NAME='${sqn}'");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result)) {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $result;
+                }
+            } else {
+                $repeat = 0;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        $result->free();
+        return $arr[0];
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_ibase::nextID(), DB_ibase::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $sqn = strtoupper($this->getSequenceName($seq_name));
+        $this->pushErrorHandling(PEAR_ERROR_RETURN);
+        $result = $this->query("CREATE GENERATOR ${sqn}");
+        $this->popErrorHandling();
+
+        return $result;
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_ibase::nextID(), DB_ibase::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DELETE FROM RDB$GENERATORS '
+                            . "WHERE RDB\$GENERATOR_NAME='"
+                            . strtoupper($this->getSequenceName($seq_name))
+                            . "'");
+    }
+
+    // }}}
+    // {{{ _ibaseFieldFlags()
+
+    /**
+     * Get the column's flags
+     *
+     * Supports "primary_key", "unique_key", "not_null", "default",
+     * "computed" and "blob".
+     *
+     * @param string $field_name  the name of the field
+     * @param string $table_name  the name of the table
+     *
+     * @return string  the flags
+     *
+     * @access private
+     */
+    function _ibaseFieldFlags($field_name, $table_name)
+    {
+        $sql = 'SELECT R.RDB$CONSTRAINT_TYPE CTYPE'
+               .' FROM RDB$INDEX_SEGMENTS I'
+               .'  JOIN RDB$RELATION_CONSTRAINTS R ON I.RDB$INDEX_NAME=R.RDB$INDEX_NAME'
+               .' WHERE I.RDB$FIELD_NAME=\'' . $field_name . '\''
+               .'  AND UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\'';
+
+        $result = @ibase_query($this->connection, $sql);
+        if (!$result) {
+            return $this->ibaseRaiseError();
+        }
+
+        $flags = '';
+        if ($obj = @ibase_fetch_object($result)) {
+            @ibase_free_result($result);
+            if (isset($obj->CTYPE)  && trim($obj->CTYPE) == 'PRIMARY KEY') {
+                $flags .= 'primary_key ';
+            }
+            if (isset($obj->CTYPE)  && trim($obj->CTYPE) == 'UNIQUE') {
+                $flags .= 'unique_key ';
+            }
+        }
+
+        $sql = 'SELECT R.RDB$NULL_FLAG AS NFLAG,'
+               .'  R.RDB$DEFAULT_SOURCE AS DSOURCE,'
+               .'  F.RDB$FIELD_TYPE AS FTYPE,'
+               .'  F.RDB$COMPUTED_SOURCE AS CSOURCE'
+               .' FROM RDB$RELATION_FIELDS R '
+               .'  JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME'
+               .' WHERE UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\''
+               .'  AND R.RDB$FIELD_NAME=\'' . $field_name . '\'';
+
+        $result = @ibase_query($this->connection, $sql);
+        if (!$result) {
+            return $this->ibaseRaiseError();
+        }
+        if ($obj = @ibase_fetch_object($result)) {
+            @ibase_free_result($result);
+            if (isset($obj->NFLAG)) {
+                $flags .= 'not_null ';
+            }
+            if (isset($obj->DSOURCE)) {
+                $flags .= 'default ';
+            }
+            if (isset($obj->CSOURCE)) {
+                $flags .= 'computed ';
+            }
+            if (isset($obj->FTYPE)  && $obj->FTYPE == 261) {
+                $flags .= 'blob ';
+            }
+        }
+
+        return trim($flags);
+    }
+
+    // }}}
+    // {{{ ibaseRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_ibase::errorNative(), DB_ibase::errorCode()
+     */
+    function &ibaseRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            $errno = $this->errorCode($this->errorNative());
+        }
+        $tmp =& $this->raiseError($errno, null, null, null, @ibase_errmsg());
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code.  NULL if there is no error code.
+     *
+     * @since Method available since Release 1.7.0
+     */
+    function errorNative()
+    {
+        if (function_exists('ibase_errcode')) {
+            return @ibase_errcode();
+        }
+        if (preg_match('/^Dynamic SQL Error SQL error code = ([0-9-]+)/i',
+                       @ibase_errmsg(), $m)) {
+            return (int)$m[1];
+        }
+        return null;
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Maps native error codes to DB's portable ones
+     *
+     * @param int $nativecode  the error code returned by the DBMS
+     *
+     * @return int  the portable DB error code.  Return DB_ERROR if the
+     *               current driver doesn't have a mapping for the
+     *               $nativecode submitted.
+     *
+     * @since Method available since Release 1.7.0
+     */
+    function errorCode($nativecode = null)
+    {
+        if (isset($this->errorcode_map[$nativecode])) {
+            return $this->errorcode_map[$nativecode];
+        }
+
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/generator .* is not defined/'
+                    => DB_ERROR_SYNTAX,  // for compat. w ibase_errcode()
+                '/table.*(not exist|not found|unknown)/i'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/table .* already exists/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/unsuccessful metadata update .* failed attempt to store duplicate value/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/unsuccessful metadata update .* not found/i'
+                    => DB_ERROR_NOT_FOUND,
+                '/validation error for column .* value "\*\*\* null/i'
+                    => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/violation of [\w ]+ constraint/i'
+                    => DB_ERROR_CONSTRAINT,
+                '/conversion error from string/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/no permission for/i'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/arithmetic exception, numeric overflow, or string truncation/i'
+                    => DB_ERROR_INVALID,
+            );
+        }
+
+        $errormsg = @ibase_errmsg();
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @ibase_query($this->connection,
+                               "SELECT * FROM $result WHERE 1=0");
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->ibaseRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @ibase_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $info = @ibase_field_info($id, $i);
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func($info['name']),
+                'type'  => $info['type'],
+                'len'   => $info['length'],
+                'flags' => ($got_string)
+                            ? $this->_ibaseFieldFlags($info['name'], $result)
+                            : '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @ibase_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT DISTINCT R.RDB$RELATION_NAME FROM '
+                       . 'RDB$RELATION_FIELDS R WHERE R.RDB$SYSTEM_FLAG=0';
+            case 'views':
+                return 'SELECT DISTINCT RDB$VIEW_NAME from RDB$VIEW_RELATIONS';
+            case 'users':
+                return 'SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/storage.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/storage.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/storage.php	(revision 1328)
@@ -0,0 +1,504 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Provides an object interface to a table row
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <stig@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB class so it can be extended from
+ */
+require_once 'DB.php';
+
+/**
+ * Provides an object interface to a table row
+ *
+ * It lets you add, delete and change rows using objects rather than SQL
+ * statements.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <stig@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_storage extends PEAR
+{
+    // {{{ properties
+
+    /** the name of the table (or view, if the backend database supports
+        updates in views) we hold data from */
+    var $_table = null;
+
+    /** which column(s) in the table contains primary keys, can be a
+        string for single-column primary keys, or an array of strings
+        for multiple-column primary keys */
+    var $_keycolumn = null;
+
+    /** DB connection handle used for all transactions */
+    var $_dbh = null;
+
+    /** an assoc with the names of database fields stored as properties
+        in this object */
+    var $_properties = array();
+
+    /** an assoc with the names of the properties in this object that
+        have been changed since they were fetched from the database */
+    var $_changes = array();
+
+    /** flag that decides if data in this object can be changed.
+        objects that don't have their table's key column in their
+        property lists will be flagged as read-only. */
+    var $_readonly = false;
+
+    /** function or method that implements a validator for fields that
+        are set, this validator function returns true if the field is
+        valid, false if not */
+    var $_validator = null;
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * Constructor
+     *
+     * @param $table string the name of the database table
+     *
+     * @param $keycolumn mixed string with name of key column, or array of
+     * strings if the table has a primary key of more than one column
+     *
+     * @param $dbh object database connection object
+     *
+     * @param $validator mixed function or method used to validate
+     * each new value, called with three parameters: the name of the
+     * field/column that is changing, a reference to the new value and
+     * a reference to this object
+     *
+     */
+    function DB_storage($table, $keycolumn, &$dbh, $validator = null)
+    {
+        $this->PEAR('DB_Error');
+        $this->_table = $table;
+        $this->_keycolumn = $keycolumn;
+        $this->_dbh = $dbh;
+        $this->_readonly = false;
+        $this->_validator = $validator;
+    }
+
+    // }}}
+    // {{{ _makeWhere()
+
+    /**
+     * Utility method to build a "WHERE" clause to locate ourselves in
+     * the table.
+     *
+     * XXX future improvement: use rowids?
+     *
+     * @access private
+     */
+    function _makeWhere($keyval = null)
+    {
+        if (is_array($this->_keycolumn)) {
+            if ($keyval === null) {
+                for ($i = 0; $i < sizeof($this->_keycolumn); $i++) {
+                    $keyval[] = $this->{$this->_keycolumn[$i]};
+                }
+            }
+            $whereclause = '';
+            for ($i = 0; $i < sizeof($this->_keycolumn); $i++) {
+                if ($i > 0) {
+                    $whereclause .= ' AND ';
+                }
+                $whereclause .= $this->_keycolumn[$i];
+                if (is_null($keyval[$i])) {
+                    // there's not much point in having a NULL key,
+                    // but we support it anyway
+                    $whereclause .= ' IS NULL';
+                } else {
+                    $whereclause .= ' = ' . $this->_dbh->quote($keyval[$i]);
+                }
+            }
+        } else {
+            if ($keyval === null) {
+                $keyval = @$this->{$this->_keycolumn};
+            }
+            $whereclause = $this->_keycolumn;
+            if (is_null($keyval)) {
+                // there's not much point in having a NULL key,
+                // but we support it anyway
+                $whereclause .= ' IS NULL';
+            } else {
+                $whereclause .= ' = ' . $this->_dbh->quote($keyval);
+            }
+        }
+        return $whereclause;
+    }
+
+    // }}}
+    // {{{ setup()
+
+    /**
+     * Method used to initialize a DB_storage object from the
+     * configured table.
+     *
+     * @param $keyval mixed the key[s] of the row to fetch (string or array)
+     *
+     * @return int DB_OK on success, a DB error if not
+     */
+    function setup($keyval)
+    {
+        $whereclause = $this->_makeWhere($keyval);
+        $query = 'SELECT * FROM ' . $this->_table . ' WHERE ' . $whereclause;
+        $sth = $this->_dbh->query($query);
+        if (DB::isError($sth)) {
+            return $sth;
+        }
+        $row = $sth->fetchRow(DB_FETCHMODE_ASSOC);
+        if (DB::isError($row)) {
+            return $row;
+        }
+        if (!$row) {
+            return $this->raiseError(null, DB_ERROR_NOT_FOUND, null, null,
+                                     $query, null, true);
+        }
+        foreach ($row as $key => $value) {
+            $this->_properties[$key] = true;
+            $this->$key = $value;
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ insert()
+
+    /**
+     * Create a new (empty) row in the configured table for this
+     * object.
+     */
+    function insert($newpk)
+    {
+        if (is_array($this->_keycolumn)) {
+            $primarykey = $this->_keycolumn;
+        } else {
+            $primarykey = array($this->_keycolumn);
+        }
+        settype($newpk, "array");
+        for ($i = 0; $i < sizeof($primarykey); $i++) {
+            $pkvals[] = $this->_dbh->quote($newpk[$i]);
+        }
+
+        $sth = $this->_dbh->query("INSERT INTO $this->_table (" .
+                                  implode(",", $primarykey) . ") VALUES(" .
+                                  implode(",", $pkvals) . ")");
+        if (DB::isError($sth)) {
+            return $sth;
+        }
+        if (sizeof($newpk) == 1) {
+            $newpk = $newpk[0];
+        }
+        $this->setup($newpk);
+    }
+
+    // }}}
+    // {{{ toString()
+
+    /**
+     * Output a simple description of this DB_storage object.
+     * @return string object description
+     */
+    function toString()
+    {
+        $info = strtolower(get_class($this));
+        $info .= " (table=";
+        $info .= $this->_table;
+        $info .= ", keycolumn=";
+        if (is_array($this->_keycolumn)) {
+            $info .= "(" . implode(",", $this->_keycolumn) . ")";
+        } else {
+            $info .= $this->_keycolumn;
+        }
+        $info .= ", dbh=";
+        if (is_object($this->_dbh)) {
+            $info .= $this->_dbh->toString();
+        } else {
+            $info .= "null";
+        }
+        $info .= ")";
+        if (sizeof($this->_properties)) {
+            $info .= " [loaded, key=";
+            $keyname = $this->_keycolumn;
+            if (is_array($keyname)) {
+                $info .= "(";
+                for ($i = 0; $i < sizeof($keyname); $i++) {
+                    if ($i > 0) {
+                        $info .= ",";
+                    }
+                    $info .= $this->$keyname[$i];
+                }
+                $info .= ")";
+            } else {
+                $info .= $this->$keyname;
+            }
+            $info .= "]";
+        }
+        if (sizeof($this->_changes)) {
+            $info .= " [modified]";
+        }
+        return $info;
+    }
+
+    // }}}
+    // {{{ dump()
+
+    /**
+     * Dump the contents of this object to "standard output".
+     */
+    function dump()
+    {
+        foreach ($this->_properties as $prop => $foo) {
+            print "$prop = ";
+            print htmlentities($this->$prop);
+            print "<br />\n";
+        }
+    }
+
+    // }}}
+    // {{{ &create()
+
+    /**
+     * Static method used to create new DB storage objects.
+     * @param $data assoc. array where the keys are the names
+     *              of properties/columns
+     * @return object a new instance of DB_storage or a subclass of it
+     */
+    function &create($table, &$data)
+    {
+        $classname = strtolower(get_class($this));
+        $obj =& new $classname($table);
+        foreach ($data as $name => $value) {
+            $obj->_properties[$name] = true;
+            $obj->$name = &$value;
+        }
+        return $obj;
+    }
+
+    // }}}
+    // {{{ loadFromQuery()
+
+    /**
+     * Loads data into this object from the given query.  If this
+     * object already contains table data, changes will be saved and
+     * the object re-initialized first.
+     *
+     * @param $query SQL query
+     *
+     * @param $params parameter list in case you want to use
+     * prepare/execute mode
+     *
+     * @return int DB_OK on success, DB_WARNING_READ_ONLY if the
+     * returned object is read-only (because the object's specified
+     * key column was not found among the columns returned by $query),
+     * or another DB error code in case of errors.
+     */
+// XXX commented out for now
+/*
+    function loadFromQuery($query, $params = null)
+    {
+        if (sizeof($this->_properties)) {
+            if (sizeof($this->_changes)) {
+                $this->store();
+                $this->_changes = array();
+            }
+            $this->_properties = array();
+        }
+        $rowdata = $this->_dbh->getRow($query, DB_FETCHMODE_ASSOC, $params);
+        if (DB::isError($rowdata)) {
+            return $rowdata;
+        }
+        reset($rowdata);
+        $found_keycolumn = false;
+        while (list($key, $value) = each($rowdata)) {
+            if ($key == $this->_keycolumn) {
+                $found_keycolumn = true;
+            }
+            $this->_properties[$key] = true;
+            $this->$key = &$value;
+            unset($value); // have to unset, or all properties will
+                           // refer to the same value
+        }
+        if (!$found_keycolumn) {
+            $this->_readonly = true;
+            return DB_WARNING_READ_ONLY;
+        }
+        return DB_OK;
+    }
+ */
+
+    // }}}
+    // {{{ set()
+
+    /**
+     * Modify an attriute value.
+     */
+    function set($property, $newvalue)
+    {
+        // only change if $property is known and object is not
+        // read-only
+        if ($this->_readonly) {
+            return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
+                                     null, null, null, true);
+        }
+        if (@isset($this->_properties[$property])) {
+            if (empty($this->_validator)) {
+                $valid = true;
+            } else {
+                $valid = @call_user_func($this->_validator,
+                                         $this->_table,
+                                         $property,
+                                         $newvalue,
+                                         $this->$property,
+                                         $this);
+            }
+            if ($valid) {
+                $this->$property = $newvalue;
+                if (empty($this->_changes[$property])) {
+                    $this->_changes[$property] = 0;
+                } else {
+                    $this->_changes[$property]++;
+                }
+            } else {
+                return $this->raiseError(null, DB_ERROR_INVALID, null,
+                                         null, "invalid field: $property",
+                                         null, true);
+            }
+            return true;
+        }
+        return $this->raiseError(null, DB_ERROR_NOSUCHFIELD, null,
+                                 null, "unknown field: $property",
+                                 null, true);
+    }
+
+    // }}}
+    // {{{ &get()
+
+    /**
+     * Fetch an attribute value.
+     *
+     * @param string attribute name
+     *
+     * @return attribute contents, or null if the attribute name is
+     * unknown
+     */
+    function &get($property)
+    {
+        // only return if $property is known
+        if (isset($this->_properties[$property])) {
+            return $this->$property;
+        }
+        $tmp = null;
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ _DB_storage()
+
+    /**
+     * Destructor, calls DB_storage::store() if there are changes
+     * that are to be kept.
+     */
+    function _DB_storage()
+    {
+        if (sizeof($this->_changes)) {
+            $this->store();
+        }
+        $this->_properties = array();
+        $this->_changes = array();
+        $this->_table = null;
+    }
+
+    // }}}
+    // {{{ store()
+
+    /**
+     * Stores changes to this object in the database.
+     *
+     * @return DB_OK or a DB error
+     */
+    function store()
+    {
+        foreach ($this->_changes as $name => $foo) {
+            $params[] = &$this->$name;
+            $vars[] = $name . ' = ?';
+        }
+        if ($vars) {
+            $query = 'UPDATE ' . $this->_table . ' SET ' .
+                implode(', ', $vars) . ' WHERE ' .
+                $this->_makeWhere();
+            $stmt = $this->_dbh->prepare($query);
+            $res = $this->_dbh->execute($stmt, $params);
+            if (DB::isError($res)) {
+                return $res;
+            }
+            $this->_changes = array();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ remove()
+
+    /**
+     * Remove the row represented by this object from the database.
+     *
+     * @return mixed DB_OK or a DB error
+     */
+    function remove()
+    {
+        if ($this->_readonly) {
+            return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
+                                     null, null, null, true);
+        }
+        $query = 'DELETE FROM ' . $this->_table .' WHERE '.
+            $this->_makeWhere();
+        $res = $this->_dbh->query($query);
+        if (DB::isError($res)) {
+            return $res;
+        }
+        foreach ($this->_properties as $prop => $foo) {
+            unset($this->$prop);
+        }
+        $this->_properties = array();
+        $this->_changes = array();
+        return DB_OK;
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/mysql.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/mysql.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/mysql.php	(revision 1328)
@@ -0,0 +1,1034 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's mysql extension
+ * for interacting with MySQL databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's mysql extension
+ * for interacting with MySQL databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_mysql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'mysql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'mysql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => '4.2.0',
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        1004 => DB_ERROR_CANNOT_CREATE,
+        1005 => DB_ERROR_CANNOT_CREATE,
+        1006 => DB_ERROR_CANNOT_CREATE,
+        1007 => DB_ERROR_ALREADY_EXISTS,
+        1008 => DB_ERROR_CANNOT_DROP,
+        1022 => DB_ERROR_ALREADY_EXISTS,
+        1044 => DB_ERROR_ACCESS_VIOLATION,
+        1046 => DB_ERROR_NODBSELECTED,
+        1048 => DB_ERROR_CONSTRAINT,
+        1049 => DB_ERROR_NOSUCHDB,
+        1050 => DB_ERROR_ALREADY_EXISTS,
+        1051 => DB_ERROR_NOSUCHTABLE,
+        1054 => DB_ERROR_NOSUCHFIELD,
+        1061 => DB_ERROR_ALREADY_EXISTS,
+        1062 => DB_ERROR_ALREADY_EXISTS,
+        1064 => DB_ERROR_SYNTAX,
+        1091 => DB_ERROR_NOT_FOUND,
+        1100 => DB_ERROR_NOT_LOCKED,
+        1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        1142 => DB_ERROR_ACCESS_VIOLATION,
+        1146 => DB_ERROR_NOSUCHTABLE,
+        1216 => DB_ERROR_CONSTRAINT,
+        1217 => DB_ERROR_CONSTRAINT,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The database specified in the DSN
+     *
+     * It's a fix to allow calls to different databases in the same script.
+     *
+     * @var string
+     * @access private
+     */
+    var $_db = '';
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_mysql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's mysql driver supports the following extra DSN options:
+     *   + new_link      If set to true, causes subsequent calls to connect()
+     *                    to return a new connection link instead of the
+     *                    existing one.  WARNING: this is not portable to
+     *                    other DBMS's. Available since PEAR DB 1.7.0.
+     *   + client_flags  Any combination of MYSQL_CLIENT_* constants.
+     *                    Only used if PHP is at version 4.3.0 or greater.
+     *                    Available since PEAR DB 1.7.0.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('mysql')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $params = array();
+        if ($dsn['protocol'] && $dsn['protocol'] == 'unix') {
+            $params[0] = ':' . $dsn['socket'];
+        } else {
+            $params[0] = $dsn['hostspec'] ? $dsn['hostspec']
+                         : 'localhost';
+            if ($dsn['port']) {
+                $params[0] .= ':' . $dsn['port'];
+            }
+        }
+        $params[] = $dsn['username'] ? $dsn['username'] : null;
+        $params[] = $dsn['password'] ? $dsn['password'] : null;
+
+        if (!$persistent) {
+            if (isset($dsn['new_link'])
+                && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
+            {
+                $params[] = true;
+            } else {
+                $params[] = false;
+            }
+        }
+        if (version_compare(phpversion(), '4.3.0', '>=')) {
+            $params[] = isset($dsn['client_flags'])
+                        ? $dsn['client_flags'] : null;
+        }
+
+        $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect';
+
+        $ini = ini_get('track_errors');
+        $php_errormsg = '';
+        if ($ini) {
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+        } else {
+            ini_set('track_errors', 1);
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+            ini_set('track_errors', $ini);
+        }
+
+        if (!$this->connection) {
+            if (($err = @mysql_error()) != '') {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null, 
+                                         $err);
+            } else {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        }
+
+        if ($dsn['database']) {
+            if (!@mysql_select_db($dsn['database'], $this->connection)) {
+                return $this->mysqlRaiseError();
+            }
+            $this->_db = $dsn['database'];
+        }
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @mysql_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * Generally uses mysql_query().  If you want to use
+     * mysql_unbuffered_query() set the "result_buffering" option to 0 using
+     * setOptions().  This option was added in Release 1.7.0.
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        if ($this->_db) {
+            if (!@mysql_select_db($this->_db, $this->connection)) {
+                return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
+        }
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @mysql_query('SET AUTOCOMMIT=0', $this->connection);
+                $result = @mysql_query('BEGIN', $this->connection);
+                if (!$result) {
+                    return $this->mysqlRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        if (!$this->options['result_buffering']) {
+            $result = @mysql_unbuffered_query($query, $this->connection);
+        } else {
+            $result = @mysql_query($query, $this->connection);
+        }
+        if (!$result) {
+            return $this->mysqlRaiseError();
+        }
+        if (is_resource($result)) {
+            return $result;
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal mysql result pointer to the next available result
+     *
+     * This method has not been implemented yet.
+     *
+     * @param a valid sql result resource
+     *
+     * @return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@mysql_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @mysql_fetch_array($result, MYSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @mysql_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            /*
+             * Even though this DBMS already trims output, we do this because
+             * a field might have intentional whitespace at the end that
+             * gets removed by DB_PORTABILITY_RTRIM under another driver.
+             */
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @mysql_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @mysql_num_fields($result);
+        if (!$cols) {
+            return $this->mysqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @mysql_num_rows($result);
+        if ($rows === null) {
+            return $this->mysqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            if ($this->_db) {
+                if (!@mysql_select_db($this->_db, $this->connection)) {
+                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+                }
+            }
+            $result = @mysql_query('COMMIT', $this->connection);
+            $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mysqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            if ($this->_db) {
+                if (!@mysql_select_db($this->_db, $this->connection)) {
+                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+                }
+            }
+            $result = @mysql_query('ROLLBACK', $this->connection);
+            $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mysqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            return @mysql_affected_rows($this->connection);
+        } else {
+            return 0;
+        }
+     }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_mysql::createSequence(), DB_mysql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        do {
+            $repeat = 0;
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("UPDATE ${seqname} ".
+                                   'SET id=LAST_INSERT_ID(id+1)');
+            $this->popErrorHandling();
+            if ($result === DB_OK) {
+                // COMMON CASE
+                $id = @mysql_insert_id($this->connection);
+                if ($id != 0) {
+                    return $id;
+                }
+                // EMPTY SEQ TABLE
+                // Sequence table must be empty for some reason, so fill
+                // it and return 1 and obtain a user-level lock
+                $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                if ($result == 0) {
+                    // Failed to get the lock
+                    return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
+                }
+
+                // add the default value
+                $result = $this->query("REPLACE INTO ${seqname} (id) VALUES (0)");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+
+                // Release the lock
+                $result = $this->getOne('SELECT RELEASE_LOCK('
+                                        . "'${seqname}_lock')");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                // We know what the result will be, so no need to try again
+                return 1;
+
+            } elseif ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE)
+            {
+                // ONDEMAND TABLE CREATION
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                } else {
+                    $repeat = 1;
+                }
+
+            } elseif (DB::isError($result) &&
+                      $result->getCode() == DB_ERROR_ALREADY_EXISTS)
+            {
+                // BACKWARDS COMPAT
+                // see _BCsequence() comment
+                $result = $this->_BCsequence($seqname);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                $repeat = 1;
+            }
+        } while ($repeat);
+
+        return $this->raiseError($result);
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_mysql::nextID(), DB_mysql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $res = $this->query('CREATE TABLE ' . $seqname
+                            . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'
+                            . ' PRIMARY KEY(id))');
+        if (DB::isError($res)) {
+            return $res;
+        }
+        // insert yields value 1, nextId call will generate ID 2
+        $res = $this->query("INSERT INTO ${seqname} (id) VALUES (0)");
+        if (DB::isError($res)) {
+            return $res;
+        }
+        // so reset to zero
+        return $this->query("UPDATE ${seqname} SET id = 0");
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_mysql::nextID(), DB_mysql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ _BCsequence()
+
+    /**
+     * Backwards compatibility with old sequence emulation implementation
+     * (clean up the dupes)
+     *
+     * @param string $seqname  the sequence name to clean up
+     *
+     * @return bool  true on success.  A DB_Error object on failure.
+     *
+     * @access private
+     */
+    function _BCsequence($seqname)
+    {
+        // Obtain a user-level lock... this will release any previous
+        // application locks, but unlike LOCK TABLES, it does not abort
+        // the current transaction and is much less frequently used.
+        $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
+        if (DB::isError($result)) {
+            return $result;
+        }
+        if ($result == 0) {
+            // Failed to get the lock, can't do the conversion, bail
+            // with a DB_ERROR_NOT_LOCKED error
+            return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
+        }
+
+        $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
+        if (DB::isError($highest_id)) {
+            return $highest_id;
+        }
+        // This should kill all rows except the highest
+        // We should probably do something if $highest_id isn't
+        // numeric, but I'm at a loss as how to handle that...
+        $result = $this->query('DELETE FROM ' . $seqname
+                               . " WHERE id <> $highest_id");
+        if (DB::isError($result)) {
+            return $result;
+        }
+
+        // If another thread has been waiting for this lock,
+        // it will go thru the above procedure, but will have no
+        // real effect
+        $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')");
+        if (DB::isError($result)) {
+            return $result;
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * MySQL can't handle the backtick character (<kbd>`</kbd>) in
+     * table or column names.
+     *
+     * @param string $str  identifier name to be quoted
+     *
+     * @return string  quoted identifier string
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        return '`' . $str . '`';
+    }
+
+    // }}}
+    // {{{ quote()
+
+    /**
+     * @deprecated  Deprecated in release 1.6.0
+     */
+    function quote($str)
+    {
+        return $this->quoteSmart($str);
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function escapeSimple($str)
+    {
+        if (function_exists('mysql_real_escape_string')) {
+            return @mysql_real_escape_string($str, $this->connection);
+        } else {
+            return @mysql_escape_string($str);
+        }
+    }
+
+    // }}}
+    // {{{ modifyQuery()
+
+    /**
+     * Changes a query string for various DBMS specific reasons
+     *
+     * This little hack lets you know how many rows were deleted
+     * when running a "DELETE FROM table" query.  Only implemented
+     * if the DB_PORTABILITY_DELETE_COUNT portability option is on.
+     *
+     * @param string $query  the query string to modify
+     *
+     * @return string  the modified query string
+     *
+     * @access protected
+     * @see DB_common::setOption()
+     */
+    function modifyQuery($query)
+    {
+        if ($this->options['portability'] & DB_PORTABILITY_DELETE_COUNT) {
+            // "DELETE FROM table" gives 0 affected rows in MySQL.
+            // This little hack lets you know how many rows were deleted.
+            if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
+                $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
+                                      'DELETE FROM \1 WHERE 1=1', $query);
+            }
+        }
+        return $query;
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        if (DB::isManip($query)) {
+            return $query . " LIMIT $count";
+        } else {
+            return $query . " LIMIT $from, $count";
+        }
+    }
+
+    // }}}
+    // {{{ mysqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_mysql::errorNative(), DB_common::errorCode()
+     */
+    function mysqlRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
+                $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
+                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
+                $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
+            } else {
+                // Doing this in case mode changes during runtime.
+                $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
+                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
+                $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
+            }
+            $errno = $this->errorCode(mysql_errno($this->connection));
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 @mysql_errno($this->connection) . ' ** ' .
+                                 @mysql_error($this->connection));
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code
+     */
+    function errorNative()
+    {
+        return @mysql_errno($this->connection);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @mysql_list_fields($this->dsn['database'],
+                                     $result, $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->mysqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @mysql_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $case_func(@mysql_field_table($id, $i)),
+                'name'  => $case_func(@mysql_field_name($id, $i)),
+                'type'  => @mysql_field_type($id, $i),
+                'len'   => @mysql_field_len($id, $i),
+                'flags' => @mysql_field_flags($id, $i),
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @mysql_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SHOW TABLES';
+            case 'users':
+                return 'SELECT DISTINCT User FROM mysql.user';
+            case 'databases':
+                return 'SHOW DATABASES';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/ifx.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/ifx.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/ifx.php	(revision 1328)
@@ -0,0 +1,681 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's ifx extension
+ * for interacting with Informix databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's ifx extension
+ * for interacting with Informix databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * More info on Informix errors can be found at:
+ * http://www.informix.com/answers/english/ierrors.htm
+ *
+ * TODO:
+ *   - set needed env Informix vars on connect
+ *   - implement native prepare/execute
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_ifx extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'ifx';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'ifx';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => 'emulate',
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        '-201'    => DB_ERROR_SYNTAX,
+        '-206'    => DB_ERROR_NOSUCHTABLE,
+        '-217'    => DB_ERROR_NOSUCHFIELD,
+        '-236'    => DB_ERROR_VALUE_COUNT_ON_ROW,
+        '-239'    => DB_ERROR_CONSTRAINT,
+        '-253'    => DB_ERROR_SYNTAX,
+        '-292'    => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '-310'    => DB_ERROR_ALREADY_EXISTS,
+        '-316'    => DB_ERROR_ALREADY_EXISTS,
+        '-319'    => DB_ERROR_NOT_FOUND,
+        '-329'    => DB_ERROR_NODBSELECTED,
+        '-346'    => DB_ERROR_CONSTRAINT,
+        '-386'    => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '-391'    => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '-554'    => DB_ERROR_SYNTAX,
+        '-691'    => DB_ERROR_CONSTRAINT,
+        '-692'    => DB_ERROR_CONSTRAINT,
+        '-703'    => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '-1204'   => DB_ERROR_INVALID_DATE,
+        '-1205'   => DB_ERROR_INVALID_DATE,
+        '-1206'   => DB_ERROR_INVALID_DATE,
+        '-1209'   => DB_ERROR_INVALID_DATE,
+        '-1210'   => DB_ERROR_INVALID_DATE,
+        '-1212'   => DB_ERROR_INVALID_DATE,
+        '-1213'   => DB_ERROR_INVALID_NUMBER,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The number of rows affected by a data manipulation query
+     * @var integer
+     * @access private
+     */
+    var $affected = 0;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_ifx()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('informix') &&
+            !PEAR::loadExtension('Informix'))
+        {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $dbhost = $dsn['hostspec'] ? '@' . $dsn['hostspec'] : '';
+        $dbname = $dsn['database'] ? $dsn['database'] . $dbhost : '';
+        $user = $dsn['username'] ? $dsn['username'] : '';
+        $pw = $dsn['password'] ? $dsn['password'] : '';
+
+        $connect_function = $persistent ? 'ifx_pconnect' : 'ifx_connect';
+
+        $this->connection = @$connect_function($dbname, $user, $pw);
+        if (!is_resource($this->connection)) {
+            return $this->ifxRaiseError(DB_ERROR_CONNECT_FAILED);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @ifx_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $this->affected   = null;
+        if (preg_match('/(SELECT)/i', $query)) {    //TESTME: Use !DB::isManip()?
+            // the scroll is needed for fetching absolute row numbers
+            // in a select query result
+            $result = @ifx_query($query, $this->connection, IFX_SCROLL);
+        } else {
+            if (!$this->autocommit && $ismanip) {
+                if ($this->transaction_opcount == 0) {
+                    $result = @ifx_query('BEGIN WORK', $this->connection);
+                    if (!$result) {
+                        return $this->ifxRaiseError();
+                    }
+                }
+                $this->transaction_opcount++;
+            }
+            $result = @ifx_query($query, $this->connection);
+        }
+        if (!$result) {
+            return $this->ifxRaiseError();
+        }
+        $this->affected = @ifx_affected_rows($result);
+        // Determine which queries should return data, and which
+        // should return an error code only.
+        if (preg_match('/(SELECT)/i', $query)) {
+            return $result;
+        }
+        // XXX Testme: free results inside a transaction
+        // may cause to stop it and commit the work?
+
+        // Result has to be freed even with a insert or update
+        @ifx_free_result($result);
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal ifx result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            return $this->affected;
+        } else {
+            return 0;
+        }
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if (($rownum !== null) && ($rownum < 0)) {
+            return null;
+        }
+        if ($rownum === null) {
+            /*
+             * Even though fetch_row() should return the next row  if
+             * $rownum is null, it doesn't in all cases.  Bug 598.
+             */
+            $rownum = 'NEXT';
+        } else {
+            // Index starts at row 1, unlike most DBMS's starting at 0.
+            $rownum++;
+        }
+        if (!$arr = @ifx_fetch_row($result, $rownum)) {
+            return null;
+        }
+        if ($fetchmode !== DB_FETCHMODE_ASSOC) {
+            $i=0;
+            $order = array();
+            foreach ($arr as $val) {
+                $order[$i++] = $val;
+            }
+            $arr = $order;
+        } elseif ($fetchmode == DB_FETCHMODE_ASSOC &&
+                  $this->options['portability'] & DB_PORTABILITY_LOWERCASE)
+        {
+            $arr = array_change_key_case($arr, CASE_LOWER);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        if (!$cols = @ifx_num_fields($result)) {
+            return $this->ifxRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @ifx_free_result($result);
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = true)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            $result = @ifx_query('COMMIT WORK', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->ifxRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            $result = @ifx_query('ROLLBACK WORK', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->ifxRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ ifxRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_ifx::errorNative(), DB_ifx::errorCode()
+     */
+    function ifxRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            $errno = $this->errorCode(ifx_error());
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 $this->errorNative());
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code and message produced by the last query
+     *
+     * @return string  the DBMS' error code and message
+     */
+    function errorNative()
+    {
+        return @ifx_error() . ' ' . @ifx_errormsg();
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Maps native error codes to DB's portable ones.
+     *
+     * Requires that the DB implementation's constructor fills
+     * in the <var>$errorcode_map</var> property.
+     *
+     * @param  string  $nativecode  error code returned by the database
+     * @return int a portable DB error code, or DB_ERROR if this DB
+     * implementation has no mapping for the given error code.
+     */
+    function errorCode($nativecode)
+    {
+        if (ereg('SQLCODE=(.*)]', $nativecode, $match)) {
+            $code = $match[1];
+            if (isset($this->errorcode_map[$code])) {
+                return $this->errorcode_map[$code];
+            }
+        }
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' if <var>$result</var> is a table name.
+     *
+     * If analyzing a query result and the result has duplicate field names,
+     * an error will be raised saying
+     * <samp>can't distinguish duplicate field names</samp>.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.6.0
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @ifx_query("SELECT * FROM $result WHERE 1=0",
+                             $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->ifxRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        $flds = @ifx_fieldproperties($id);
+        $count = @ifx_num_fields($id);
+
+        if (count($flds) != $count) {
+            return $this->raiseError("can't distinguish duplicate field names");
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $i   = 0;
+        $res = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        foreach ($flds as $key => $value) {
+            $props = explode(';', $value);
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func($key),
+                'type'  => $props[0],
+                'len'   => $props[1],
+                'flags' => $props[4] == 'N' ? 'not_null' : '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+            $i++;
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @ifx_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT tabname FROM systables WHERE tabid >= 100';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/pgsql.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/pgsql.php	(revision 2475)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/pgsql.php	(revision 2475)
@@ -0,0 +1,1097 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's pgsql extension
+ * for interacting with PostgreSQL databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Rui Hirokawa <hirokawa@php.net>
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once DB_PHP_DIR . '/DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's pgsql extension
+ * for interacting with PostgreSQL databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Rui Hirokawa <hirokawa@php.net>
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_pgsql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'pgsql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'pgsql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => '4.3.0',
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => true,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The number of rows affected by a data manipulation query
+     * @var integer
+     */
+    var $affected = 0;
+
+    /**
+     * The current row being looked at in fetchInto()
+     * @var array
+     * @access private
+     */
+    var $row = array();
+
+    /**
+     * The number of rows in a given result set
+     * @var array
+     * @access private
+     */
+    var $_num_rows = array();
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_pgsql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's pgsql driver supports the following extra DSN options:
+     *   + connect_timeout  How many seconds to wait for a connection to
+     *                       be established.  Available since PEAR DB 1.7.0.
+     *   + new_link         If set to true, causes subsequent calls to
+     *                       connect() to return a new connection link
+     *                       instead of the existing one.  WARNING: this is
+     *                       not portable to other DBMS's.  Available only
+     *                       if PHP is >= 4.3.0 and PEAR DB is >= 1.7.0.
+     *   + options          Command line options to be sent to the server.
+     *                       Available since PEAR DB 1.6.4.
+     *   + service          Specifies a service name in pg_service.conf that
+     *                       holds additional connection parameters.
+     *                       Available since PEAR DB 1.7.0.
+     *   + sslmode          How should SSL be used when connecting?  Values:
+     *                       disable, allow, prefer or require.
+     *                       Available since PEAR DB 1.7.0.
+     *   + tty              This was used to specify where to send server
+     *                       debug output.  Available since PEAR DB 1.6.4.
+     *
+     * Example of connecting to a new link via a socket:
+     * <code>
+     * require_once 'DB.php';
+     * 
+     * $dsn = 'pgsql://user:pass@unix(/tmp)/dbname?new_link=true';
+     * $options = array(
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     * 
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     *
+     * @link http://www.postgresql.org/docs/current/static/libpq.html#LIBPQ-CONNECT
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('pgsql')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $protocol = $dsn['protocol'] ? $dsn['protocol'] : 'tcp';
+
+        $params = array('');
+        if ($protocol == 'tcp') {
+            if ($dsn['hostspec']) {
+                $params[0] .= 'host=' . $dsn['hostspec'];
+            }
+            if ($dsn['port']) {
+                $params[0] .= ' port=' . $dsn['port'];
+            }
+        } elseif ($protocol == 'unix') {
+            // Allow for pg socket in non-standard locations.
+            if ($dsn['socket']) {
+                $params[0] .= 'host=' . $dsn['socket'];
+            }
+            if ($dsn['port']) {
+                $params[0] .= ' port=' . $dsn['port'];
+            }
+        }
+        if ($dsn['database']) {
+            $params[0] .= ' dbname=\'' . addslashes($dsn['database']) . '\'';
+        }
+        if ($dsn['username']) {
+            $params[0] .= ' user=\'' . addslashes($dsn['username']) . '\'';
+        }
+        if ($dsn['password']) {
+            $params[0] .= ' password=\'' . addslashes($dsn['password']) . '\'';
+        }
+        if (!empty($dsn['options'])) {
+            $params[0] .= ' options=' . $dsn['options'];
+        }
+        if (!empty($dsn['tty'])) {
+            $params[0] .= ' tty=' . $dsn['tty'];
+        }
+        if (!empty($dsn['connect_timeout'])) {
+            $params[0] .= ' connect_timeout=' . $dsn['connect_timeout'];
+        }
+        if (!empty($dsn['sslmode'])) {
+            $params[0] .= ' sslmode=' . $dsn['sslmode'];
+        }
+        if (!empty($dsn['service'])) {
+            $params[0] .= ' service=' . $dsn['service'];
+        }
+
+        if (isset($dsn['new_link'])
+            && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
+        {
+            if (version_compare(phpversion(), '4.3.0', '>=')) {
+                $params[] = PGSQL_CONNECT_FORCE_NEW;
+            }
+        }
+
+        $connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';
+
+        $ini = ini_get('track_errors');
+        $php_errormsg = '';
+        if ($ini) {
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+        } else {
+            ini_set('track_errors', 1);
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+            ini_set('track_errors', $ini);
+        }
+
+        if (!$this->connection) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     $php_errormsg);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @pg_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @pg_exec($this->connection, 'begin;');
+                if (!$result) {
+                    return $this->pgsqlRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        $result = @pg_exec($this->connection, $query);
+        if (!$result) {
+            return $this->pgsqlRaiseError();
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        if ($ismanip) {
+            $this->affected = @pg_affected_rows($result);
+            return DB_OK;
+        } elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|SHOW)\s/si', $query)) {
+            /* PostgreSQL commands:
+               ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
+               CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
+               GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
+               REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
+               UNLISTEN, UPDATE, VACUUM
+            */
+            $this->row[(int)$result] = 0; // reset the row counter.
+            $numrows = $this->numRows($result);
+            if (is_object($numrows)) {
+                return $numrows;
+            }
+            $this->_num_rows[(int)$result] = $numrows;
+            $this->affected = 0;
+            return $result;
+        } else {
+            $this->affected = 0;
+            return DB_OK;
+        }
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal pgsql result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        $result_int = (int)$result;
+        $rownum = ($rownum !== null) ? $rownum : $this->row[$result_int];
+        if ($rownum >= $this->_num_rows[$result_int]) {
+            return null;
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @pg_fetch_array($result, $rownum, PGSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @pg_fetch_row($result, $rownum);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        $this->row[$result_int] = ++$rownum;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        if (is_resource($result)) {
+            unset($this->row[(int)$result]);
+            unset($this->_num_rows[(int)$result]);
+            $this->affected = 0;
+            return @pg_freeresult($result);
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ quote()
+
+    /**
+     * @deprecated  Deprecated in release 1.6.0
+     * @internal
+     */
+    function quote($str)
+    {
+        return $this->quoteSmart($str);
+    }
+
+    // }}}
+    // {{{ quoteSmart()
+
+    /**
+     * Formats input so it can be safely used in a query
+     *
+     * @param mixed $in  the data to be formatted
+     *
+     * @return mixed  the formatted data.  The format depends on the input's
+     *                 PHP type:
+     *                 + null = the string <samp>NULL</samp>
+     *                 + boolean = string <samp>TRUE</samp> or <samp>FALSE</samp>
+     *                 + integer or double = the unquoted number
+     *                 + other (including strings and numeric strings) =
+     *                   the data escaped according to MySQL's settings
+     *                   then encapsulated between single quotes
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteSmart($in)
+    {
+        if (is_int($in) || is_double($in)) {
+            return $in;
+        } elseif (is_bool($in)) {
+            return $in ? 'TRUE' : 'FALSE';
+        } elseif (is_null($in)) {
+            return 'NULL';
+        } else {
+            return "'" . $this->escapeSimple($in) . "'";
+        }
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * {@internal PostgreSQL treats a backslash as an escape character,
+     * so they are escaped as well.
+     *
+     * Not using pg_escape_string() yet because it requires PostgreSQL
+     * to be at version 7.2 or greater.}}
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function escapeSimple($str)
+    {
+        return str_replace("'", "''", str_replace('\\', '\\\\', $str));
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @pg_numfields($result);
+        if (!$cols) {
+            return $this->pgsqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @pg_numrows($result);
+        if ($rows === null) {
+            return $this->pgsqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            // (disabled) hack to shut up error messages from libpq.a
+            //@fclose(@fopen("php://stderr", "w"));
+            $result = @pg_exec($this->connection, 'end;');
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->pgsqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            $result = @pg_exec($this->connection, 'abort;');
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->pgsqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        return $this->affected;
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_pgsql::createSequence(), DB_pgsql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $repeat = false;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result =& $this->query("SELECT NEXTVAL('${seqname}')");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = true;
+                $this->pushErrorHandling(PEAR_ERROR_RETURN);
+                $result = $this->createSequence($seq_name);
+                $this->popErrorHandling();
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } else {
+                $repeat = false;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        $result->free();
+        return $arr[0];
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_pgsql::nextID(), DB_pgsql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $result = $this->query("CREATE SEQUENCE ${seqname}");
+        return $result;
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_pgsql::nextID(), DB_pgsql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP SEQUENCE '
+                            . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        return "$query LIMIT $count OFFSET $from";
+    }
+
+    // }}}
+    // {{{ pgsqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_pgsql::errorNative(), DB_pgsql::errorCode()
+     */
+    function pgsqlRaiseError($errno = null)
+    {
+        $native = $this->errorNative();
+        if ($errno === null) {
+            $errno = $this->errorCode($native);
+        }
+        return $this->raiseError($errno, null, null, null, $native);
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error message produced by the last query
+     *
+     * {@internal Error messages are used instead of error codes 
+     * in order to support older versions of PostgreSQL.}}
+     *
+     * @return string  the DBMS' error message
+     */
+    function errorNative()
+    {
+        return @pg_errormessage($this->connection);
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from the database's text error message.
+     *
+     * @param  string  $errormsg  error message returned from the database
+     * @return integer  an error number from a DB error constant
+     */
+    function errorCode($errormsg)
+    {
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/(relation|sequence|table).*does not exist|class .* not found/i'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/index .* does not exist/'
+                    => DB_ERROR_NOT_FOUND,
+                '/column .* does not exist/i'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/relation .* already exists/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/(divide|division) by zero$/i'
+                    => DB_ERROR_DIVZERO,
+                '/pg_atoi: error in .*: can\'t parse /i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/invalid input syntax for( type)? (integer|numeric)/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/value .* is out of range for type \w*int/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/integer out of range/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/value too long for type character/i'
+                    => DB_ERROR_INVALID,
+                '/attribute .* not found|relation .* does not have attribute/i'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/column .* specified in USING clause does not exist in (left|right) table/i'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/parser: parse error at or near/i'
+                    => DB_ERROR_SYNTAX,
+                '/syntax error at/'
+                    => DB_ERROR_SYNTAX,
+                '/column reference .* is ambiguous/i'
+                    => DB_ERROR_SYNTAX,
+                '/permission denied/'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/violates not-null constraint/'
+                    => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/violates [\w ]+ constraint/'
+                    => DB_ERROR_CONSTRAINT,
+                '/referential integrity violation/'
+                    => DB_ERROR_CONSTRAINT,
+                '/more expressions than target columns/i'
+                    => DB_ERROR_VALUE_COUNT_ON_ROW,
+            );
+        }
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        // Fall back to DB_ERROR if there was no mapping.
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @pg_exec($this->connection, "SELECT * FROM $result LIMIT 0");
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->pgsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @pg_numfields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func(@pg_fieldname($id, $i)),
+                'type'  => @pg_fieldtype($id, $i),
+                'len'   => @pg_fieldsize($id, $i),
+                'flags' => $got_string
+                           ? $this->_pgFieldFlags($id, $i, $result)
+                           : '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @pg_freeresult($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ _pgFieldFlags()
+
+    /**
+     * Get a column's flags
+     *
+     * Supports "not_null", "default_value", "primary_key", "unique_key"
+     * and "multiple_key".  The default value is passed through
+     * rawurlencode() in case there are spaces in it.
+     *
+     * @param int $resource   the PostgreSQL result identifier
+     * @param int $num_field  the field number
+     *
+     * @return string  the flags
+     *
+     * @access private
+     */
+    function _pgFieldFlags($resource, $num_field, $table_name)
+    {
+        $field_name = @pg_fieldname($resource, $num_field);
+
+        $result = @pg_exec($this->connection, "SELECT f.attnotnull, f.atthasdef
+                                FROM pg_attribute f, pg_class tab, pg_type typ
+                                WHERE tab.relname = typ.typname
+                                AND typ.typrelid = f.attrelid
+                                AND f.attname = '$field_name'
+                                AND tab.relname = '$table_name'");
+        if (@pg_numrows($result) > 0) {
+            $row = @pg_fetch_row($result, 0);
+            $flags  = ($row[0] == 't') ? 'not_null ' : '';
+
+            if ($row[1] == 't') {
+                $result = @pg_exec($this->connection, "SELECT a.adsrc
+                                    FROM pg_attribute f, pg_class tab, pg_type typ, pg_attrdef a
+                                    WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
+                                    AND f.attrelid = a.adrelid AND f.attname = '$field_name'
+                                    AND tab.relname = '$table_name' AND f.attnum = a.adnum");
+                $row = @pg_fetch_row($result, 0);
+                $num = preg_replace("/'(.*)'::\w+/", "\\1", $row[0]);
+                $flags .= 'default_' . rawurlencode($num) . ' ';
+            }
+        } else {
+            $flags = '';
+        }
+        $result = @pg_exec($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
+                                FROM pg_attribute f, pg_class tab, pg_type typ, pg_index i
+                                WHERE tab.relname = typ.typname
+                                AND typ.typrelid = f.attrelid
+                                AND f.attrelid = i.indrelid
+                                AND f.attname = '$field_name'
+                                AND tab.relname = '$table_name'");
+        $count = @pg_numrows($result);
+
+        for ($i = 0; $i < $count ; $i++) {
+            $row = @pg_fetch_row($result, $i);
+            $keys = explode(' ', $row[2]);
+
+            if (in_array($num_field + 1, $keys)) {
+                $flags .= ($row[0] == 't' && $row[1] == 'f') ? 'unique_key ' : '';
+                $flags .= ($row[1] == 't') ? 'primary_key ' : '';
+                if (count($keys) > 1)
+                    $flags .= 'multiple_key ';
+            }
+        }
+
+        return trim($flags);
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT c.relname AS "Name"'
+                        . ' FROM pg_class c, pg_user u'
+                        . ' WHERE c.relowner = u.usesysid'
+                        . " AND c.relkind = 'r'"
+                        . ' AND NOT EXISTS'
+                        . ' (SELECT 1 FROM pg_views'
+                        . '  WHERE viewname = c.relname)'
+                        . " AND c.relname !~ '^(pg_|sql_)'"
+                        . ' UNION'
+                        . ' SELECT c.relname AS "Name"'
+                        . ' FROM pg_class c'
+                        . " WHERE c.relkind = 'r'"
+                        . ' AND NOT EXISTS'
+                        . ' (SELECT 1 FROM pg_views'
+                        . '  WHERE viewname = c.relname)'
+                        . ' AND NOT EXISTS'
+                        . ' (SELECT 1 FROM pg_user'
+                        . '  WHERE usesysid = c.relowner)'
+                        . " AND c.relname !~ '^pg_'";
+            case 'schema.tables':
+                return "SELECT schemaname || '.' || tablename"
+                        . ' AS "Name"'
+                        . ' FROM pg_catalog.pg_tables'
+                        . ' WHERE schemaname NOT IN'
+                        . " ('pg_catalog', 'information_schema', 'pg_toast')";
+            case 'views':
+                // Table cols: viewname | viewowner | definition
+                return 'SELECT viewname from pg_views WHERE schemaname'
+                        . " NOT IN ('information_schema', 'pg_catalog')";
+            case 'users':
+                // cols: usename |usesysid|usecreatedb|usetrace|usesuper|usecatupd|passwd  |valuntil
+                return 'SELECT usename FROM pg_user';
+            case 'databases':
+                return 'SELECT datname FROM pg_database';
+            case 'functions':
+            case 'procedures':
+                return 'SELECT proname FROM pg_proc WHERE proowner <> 1';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/sybase.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/sybase.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/sybase.php	(revision 1328)
@@ -0,0 +1,907 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's sybase extension
+ * for interacting with Sybase databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Ant?io Carlos Ven?cio J?ior <floripa@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's sybase extension
+ * for interacting with Sybase databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * WARNING:  This driver may fail with multiple connections under the
+ * same user/pass/host and different databases.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Ant?io Carlos Ven?cio J?ior <floripa@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_sybase extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'sybase';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'sybase';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The database specified in the DSN
+     *
+     * It's a fix to allow calls to different databases in the same script.
+     *
+     * @var string
+     * @access private
+     */
+    var $_db = '';
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_sybase()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's sybase driver supports the following extra DSN options:
+     *   + appname       The application name to use on this connection.
+     *                   Available since PEAR DB 1.7.0.
+     *   + charset       The character set to use on this connection.
+     *                   Available since PEAR DB 1.7.0.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('sybase') &&
+            !PEAR::loadExtension('sybase_ct'))
+        {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $dsn['hostspec'] = $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost';
+        $dsn['password'] = !empty($dsn['password']) ? $dsn['password'] : false;
+        $dsn['charset'] = isset($dsn['charset']) ? $dsn['charset'] : false;
+        $dsn['appname'] = isset($dsn['appname']) ? $dsn['appname'] : false;
+
+        $connect_function = $persistent ? 'sybase_pconnect' : 'sybase_connect';
+
+        if ($dsn['username']) {
+            $this->connection = @$connect_function($dsn['hostspec'],
+                                                   $dsn['username'],
+                                                   $dsn['password'],
+                                                   $dsn['charset'],
+                                                   $dsn['appname']);
+        } else {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     'The DSN did not contain a username.');
+        }
+
+        if (!$this->connection) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     @sybase_get_last_message());
+        }
+
+        if ($dsn['database']) {
+            if (!@sybase_select_db($dsn['database'], $this->connection)) {
+                return $this->raiseError(DB_ERROR_NODBSELECTED,
+                                         null, null, null,
+                                         @sybase_get_last_message());
+            }
+            $this->_db = $dsn['database'];
+        }
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @sybase_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        if (!@sybase_select_db($this->_db, $this->connection)) {
+            return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+        }
+        $query = $this->modifyQuery($query);
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @sybase_query('BEGIN TRANSACTION', $this->connection);
+                if (!$result) {
+                    return $this->sybaseRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        $result = @sybase_query($query, $this->connection);
+        if (!$result) {
+            return $this->sybaseRaiseError();
+        }
+        if (is_resource($result)) {
+            return $result;
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        return $ismanip ? DB_OK : $result;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal sybase result pointer to the next available result
+     *
+     * @param a valid sybase result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@sybase_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            if (function_exists('sybase_fetch_assoc')) {
+                $arr = @sybase_fetch_assoc($result);
+            } else {
+                if ($arr = @sybase_fetch_array($result)) {
+                    foreach ($arr as $key => $value) {
+                        if (is_int($key)) {
+                            unset($arr[$key]);
+                        }
+                    }
+                }
+            }
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @sybase_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @sybase_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @sybase_num_fields($result);
+        if (!$cols) {
+            return $this->sybaseRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @sybase_num_rows($result);
+        if ($rows === false) {
+            return $this->sybaseRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            $result = @sybase_affected_rows($this->connection);
+        } else {
+            $result = 0;
+        }
+        return $result;
+     }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_sybase::createSequence(), DB_sybase::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        if (!@sybase_select_db($this->_db, $this->connection)) {
+            return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+        }
+        $repeat = 0;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("INSERT INTO $seqname (vapor) VALUES (0)");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                ($result->getCode() == DB_ERROR || $result->getCode() == DB_ERROR_NOSUCHTABLE))
+            {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } elseif (!DB::isError($result)) {
+                $result =& $this->query("SELECT @@IDENTITY FROM $seqname");
+                $repeat = 0;
+            } else {
+                $repeat = false;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $result = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        return $result[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_sybase::nextID(), DB_sybase::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->query('CREATE TABLE '
+                            . $this->getSequenceName($seq_name)
+                            . ' (id numeric(10, 0) IDENTITY NOT NULL,'
+                            . ' vapor int NULL)');
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_sybase::nextID(), DB_sybase::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            if (!@sybase_select_db($this->_db, $this->connection)) {
+                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $result = @sybase_query('COMMIT', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->sybaseRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            if (!@sybase_select_db($this->_db, $this->connection)) {
+                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $result = @sybase_query('ROLLBACK', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->sybaseRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ sybaseRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_sybase::errorNative(), DB_sybase::errorCode()
+     */
+    function sybaseRaiseError($errno = null)
+    {
+        $native = $this->errorNative();
+        if ($errno === null) {
+            $errno = $this->errorCode($native);
+        }
+        return $this->raiseError($errno, null, null, null, $native);
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error message produced by the last query
+     *
+     * @return string  the DBMS' error message
+     */
+    function errorNative()
+    {
+        return @sybase_get_last_message();
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from the database's text error message.
+     *
+     * @param  string  $errormsg  error message returned from the database
+     * @return integer  an error number from a DB error constant
+     */
+    function errorCode($errormsg)
+    {
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/Incorrect syntax near/'
+                    => DB_ERROR_SYNTAX,
+                '/^Unclosed quote before the character string [\"\'].*[\"\']\./'
+                    => DB_ERROR_SYNTAX,
+                '/Implicit conversion (from datatype|of NUMERIC value)/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/Cannot drop the table [\"\'].+[\"\'], because it doesn\'t exist in the system catalogs\./'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/Only the owner of object [\"\'].+[\"\'] or a user with System Administrator \(SA\) role can run this command\./'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/^.+ permission denied on object .+, database .+, owner .+/'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/^.* permission denied, database .+, owner .+/'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/[^.*] not found\./'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/There is already an object named/'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/Invalid column name/'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/does not allow null values/'
+                    => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/Command has been aborted/'
+                    => DB_ERROR_CONSTRAINT,
+                '/^Cannot drop the index .* because it doesn\'t exist/i'
+                    => DB_ERROR_NOT_FOUND,
+                '/^There is already an index/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/^There are fewer columns in the INSERT statement than values specified/i'
+                    => DB_ERROR_VALUE_COUNT_ON_ROW,
+            );
+        }
+
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.6.0
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            if (!@sybase_select_db($this->_db, $this->connection)) {
+                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $id = @sybase_query("SELECT * FROM $result WHERE 1=0",
+                                $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->sybaseRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @sybase_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $f = @sybase_fetch_field($id, $i);
+            // column_source is often blank
+            $res[$i] = array(
+                'table' => $got_string
+                           ? $case_func($result)
+                           : $case_func($f->column_source),
+                'name'  => $case_func($f->name),
+                'type'  => $f->type,
+                'len'   => $f->max_length,
+                'flags' => '',
+            );
+            if ($res[$i]['table']) {
+                $res[$i]['flags'] = $this->_sybase_field_flags(
+                        $res[$i]['table'], $res[$i]['name']);
+            }
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @sybase_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ _sybase_field_flags()
+
+    /**
+     * Get the flags for a field
+     *
+     * Currently supports:
+     *  + <samp>unique_key</samp>    (unique index, unique check or primary_key)
+     *  + <samp>multiple_key</samp>  (multi-key index)
+     *
+     * @param string  $table   the table name
+     * @param string  $column  the field name
+     *
+     * @return string  space delimited string of flags.  Empty string if none.
+     *
+     * @access private
+     */
+    function _sybase_field_flags($table, $column)
+    {
+        static $tableName = null;
+        static $flags = array();
+
+        if ($table != $tableName) {
+            $flags = array();
+            $tableName = $table;
+
+            // get unique/primary keys
+            $res = $this->getAll("sp_helpindex $table", DB_FETCHMODE_ASSOC);
+
+            if (!isset($res[0]['index_description'])) {
+                return '';
+            }
+
+            foreach ($res as $val) {
+                $keys = explode(', ', trim($val['index_keys']));
+
+                if (sizeof($keys) > 1) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'multiple_key');
+                    }
+                }
+
+                if (strpos($val['index_description'], 'unique')) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'unique_key');
+                    }
+                }
+            }
+
+        }
+
+        if (array_key_exists($column, $flags)) {
+            return(implode(' ', $flags[$column]));
+        }
+
+        return '';
+    }
+
+    // }}}
+    // {{{ _add_flag()
+
+    /**
+     * Adds a string to the flags array if the flag is not yet in there
+     * - if there is no flag present the array is created
+     *
+     * @param array  $array  reference of flags array to add a value to
+     * @param mixed  $value  value to add to the flag array
+     *
+     * @return void
+     *
+     * @access private
+     */
+    function _add_flag(&$array, $value)
+    {
+        if (!is_array($array)) {
+            $array = array($value);
+        } elseif (!in_array($value, $array)) {
+            array_push($array, $value);
+        }
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return "SELECT name FROM sysobjects WHERE type = 'U'"
+                       . ' ORDER BY name';
+            case 'views':
+                return "SELECT name FROM sysobjects WHERE type = 'V'";
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/fbsql.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/fbsql.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/fbsql.php	(revision 1328)
@@ -0,0 +1,770 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's fbsql extension
+ * for interacting with FrontBase databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Frank M. Kromann <frank@frontbase.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's fbsql extension
+ * for interacting with FrontBase databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Frank M. Kromann <frank@frontbase.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @since      Class functional since Release 1.7.0
+ */
+class DB_fbsql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'fbsql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'fbsql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+         22 => DB_ERROR_SYNTAX,
+         85 => DB_ERROR_ALREADY_EXISTS,
+        108 => DB_ERROR_SYNTAX,
+        116 => DB_ERROR_NOSUCHTABLE,
+        124 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        215 => DB_ERROR_NOSUCHFIELD,
+        217 => DB_ERROR_INVALID_NUMBER,
+        226 => DB_ERROR_NOSUCHFIELD,
+        231 => DB_ERROR_INVALID,
+        239 => DB_ERROR_TRUNCATED,
+        251 => DB_ERROR_SYNTAX,
+        266 => DB_ERROR_NOT_FOUND,
+        357 => DB_ERROR_CONSTRAINT_NOT_NULL,
+        358 => DB_ERROR_CONSTRAINT,
+        360 => DB_ERROR_CONSTRAINT,
+        361 => DB_ERROR_CONSTRAINT,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_fbsql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('fbsql')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $params = array(
+            $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost',
+            $dsn['username'] ? $dsn['username'] : null,
+            $dsn['password'] ? $dsn['password'] : null,
+        );
+
+        $connect_function = $persistent ? 'fbsql_pconnect' : 'fbsql_connect';
+
+        $ini = ini_get('track_errors');
+        $php_errormsg = '';
+        if ($ini) {
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+        } else {
+            ini_set('track_errors', 1);
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+            ini_set('track_errors', $ini);
+        }
+
+        if (!$this->connection) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     $php_errormsg);
+        }
+
+        if ($dsn['database']) {
+            if (!@fbsql_select_db($dsn['database'], $this->connection)) {
+                return $this->fbsqlRaiseError();
+            }
+        }
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @fbsql_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @fbsql_query("$query;", $this->connection);
+        if (!$result) {
+            return $this->fbsqlRaiseError();
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        if (DB::isManip($query)) {
+            return DB_OK;
+        }
+        return $result;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal fbsql result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return @fbsql_next_result($result);
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@fbsql_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @fbsql_fetch_array($result, FBSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @fbsql_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @fbsql_free_result($result);
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff=false)
+    {
+        if ($onoff) {
+            $this->query("SET COMMIT TRUE");
+        } else {
+            $this->query("SET COMMIT FALSE");
+        }
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        @fbsql_commit();
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        @fbsql_rollback();
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @fbsql_num_fields($result);
+        if (!$cols) {
+            return $this->fbsqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @fbsql_num_rows($result);
+        if ($rows === null) {
+            return $this->fbsqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            $result = @fbsql_affected_rows($this->connection);
+        } else {
+            $result = 0;
+        }
+        return $result;
+     }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_fbsql::createSequence(), DB_fbsql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        do {
+            $repeat = 0;
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query('SELECT UNIQUE FROM ' . $seqname);
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $result;
+                }
+            } else {
+                $repeat = 0;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->fbsqlRaiseError();
+        }
+        $result->fetchInto($tmp, DB_FETCHMODE_ORDERED);
+        return $tmp[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_fbsql::nextID(), DB_fbsql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $res = $this->query('CREATE TABLE ' . $seqname
+                            . ' (id INTEGER NOT NULL,'
+                            . ' PRIMARY KEY(id))');
+        if ($res) {
+            $res = $this->query('SET UNIQUE = 0 FOR ' . $seqname);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_fbsql::nextID(), DB_fbsql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name)
+                            . ' RESTRICT');
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        if (DB::isManip($query)) {
+            return preg_replace('/^([\s(])*SELECT/i',
+                                "\\1SELECT TOP($count)", $query);
+        } else {
+            return preg_replace('/([\s(])*SELECT/i',
+                                "\\1SELECT TOP($from, $count)", $query);
+        }
+    }
+
+    // }}}
+    // {{{ quoteSmart()
+
+    /**
+     * Formats input so it can be safely used in a query
+     *
+     * @param mixed $in  the data to be formatted
+     *
+     * @return mixed  the formatted data.  The format depends on the input's
+     *                 PHP type:
+     *                 + null = the string <samp>NULL</samp>
+     *                 + boolean = string <samp>TRUE</samp> or <samp>FALSE</samp>
+     *                 + integer or double = the unquoted number
+     *                 + other (including strings and numeric strings) =
+     *                   the data escaped according to FrontBase's settings
+     *                   then encapsulated between single quotes
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteSmart($in)
+    {
+        if (is_int($in) || is_double($in)) {
+            return $in;
+        } elseif (is_bool($in)) {
+            return $in ? 'TRUE' : 'FALSE';
+        } elseif (is_null($in)) {
+            return 'NULL';
+        } else {
+            return "'" . $this->escapeSimple($in) . "'";
+        }
+    }
+
+    // }}}
+    // {{{ fbsqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_fbsql::errorNative(), DB_common::errorCode()
+     */
+    function fbsqlRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            $errno = $this->errorCode(fbsql_errno($this->connection));
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 @fbsql_error($this->connection));
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code
+     */
+    function errorNative()
+    {
+        return @fbsql_errno($this->connection);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @fbsql_list_fields($this->dsn['database'],
+                                     $result, $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->fbsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @fbsql_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $case_func(@fbsql_field_table($id, $i)),
+                'name'  => $case_func(@fbsql_field_name($id, $i)),
+                'type'  => @fbsql_field_type($id, $i),
+                'len'   => @fbsql_field_len($id, $i),
+                'flags' => @fbsql_field_flags($id, $i),
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @fbsql_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT "table_name" FROM information_schema.tables'
+                       . ' t0, information_schema.schemata t1'
+                       . ' WHERE t0.schema_pk=t1.schema_pk AND'
+                       . ' "table_type" = \'BASE TABLE\''
+                       . ' AND "schema_name" = current_schema';
+            case 'views':
+                return 'SELECT "table_name" FROM information_schema.tables'
+                       . ' t0, information_schema.schemata t1'
+                       . ' WHERE t0.schema_pk=t1.schema_pk AND'
+                       . ' "table_type" = \'VIEW\''
+                       . ' AND "schema_name" = current_schema';
+            case 'users':
+                return 'SELECT "user_name" from information_schema.users'; 
+            case 'functions':
+                return 'SELECT "routine_name" FROM'
+                       . ' information_schema.psm_routines'
+                       . ' t0, information_schema.schemata t1'
+                       . ' WHERE t0.schema_pk=t1.schema_pk'
+                       . ' AND "routine_kind"=\'FUNCTION\''
+                       . ' AND "schema_name" = current_schema';
+            case 'procedures':
+                return 'SELECT "routine_name" FROM'
+                       . ' information_schema.psm_routines'
+                       . ' t0, information_schema.schemata t1'
+                       . ' WHERE t0.schema_pk=t1.schema_pk'
+                       . ' AND "routine_kind"=\'PROCEDURE\''
+                       . ' AND "schema_name" = current_schema';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/odbc.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/odbc.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/odbc.php	(revision 1328)
@@ -0,0 +1,883 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's odbc extension
+ * for interacting with databases via ODBC connections
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's odbc extension
+ * for interacting with databases via ODBC connections
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * More info on ODBC errors could be found here:
+ * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_err_odbc_5stz.asp
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_odbc extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'odbc';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'sql92';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * NOTE: The feature set of the following drivers are different than
+     * the default:
+     *   + solid: 'transactions' = true
+     *   + navision: 'limit' = false
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => false,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        '01004' => DB_ERROR_TRUNCATED,
+        '07001' => DB_ERROR_MISMATCH,
+        '21S01' => DB_ERROR_VALUE_COUNT_ON_ROW,
+        '21S02' => DB_ERROR_MISMATCH,
+        '22001' => DB_ERROR_INVALID,
+        '22003' => DB_ERROR_INVALID_NUMBER,
+        '22005' => DB_ERROR_INVALID_NUMBER,
+        '22008' => DB_ERROR_INVALID_DATE,
+        '22012' => DB_ERROR_DIVZERO,
+        '23000' => DB_ERROR_CONSTRAINT,
+        '23502' => DB_ERROR_CONSTRAINT_NOT_NULL,
+        '23503' => DB_ERROR_CONSTRAINT,
+        '23504' => DB_ERROR_CONSTRAINT,
+        '23505' => DB_ERROR_CONSTRAINT,
+        '24000' => DB_ERROR_INVALID,
+        '34000' => DB_ERROR_INVALID,
+        '37000' => DB_ERROR_SYNTAX,
+        '42000' => DB_ERROR_SYNTAX,
+        '42601' => DB_ERROR_SYNTAX,
+        'IM001' => DB_ERROR_UNSUPPORTED,
+        'S0000' => DB_ERROR_NOSUCHTABLE,
+        'S0001' => DB_ERROR_ALREADY_EXISTS,
+        'S0002' => DB_ERROR_NOSUCHTABLE,
+        'S0011' => DB_ERROR_ALREADY_EXISTS,
+        'S0012' => DB_ERROR_NOT_FOUND,
+        'S0021' => DB_ERROR_ALREADY_EXISTS,
+        'S0022' => DB_ERROR_NOSUCHFIELD,
+        'S1009' => DB_ERROR_INVALID,
+        'S1090' => DB_ERROR_INVALID,
+        'S1C00' => DB_ERROR_NOT_CAPABLE,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * The number of rows affected by a data manipulation query
+     * @var integer
+     * @access private
+     */
+    var $affected = 0;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_odbc()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's odbc driver supports the following extra DSN options:
+     *   + cursor  The type of cursor to be used for this connection.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('odbc')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+        switch ($this->dbsyntax) {
+            case 'access':
+            case 'db2':
+            case 'solid':
+                $this->features['transactions'] = true;
+                break;
+            case 'navision':
+                $this->features['limit'] = false;
+        }
+
+        /*
+         * This is hear for backwards compatibility. Should have been using
+         * 'database' all along, but prior to 1.6.0RC3 'hostspec' was used.
+         */
+        if ($dsn['database']) {
+            $odbcdsn = $dsn['database'];
+        } elseif ($dsn['hostspec']) {
+            $odbcdsn = $dsn['hostspec'];
+        } else {
+            $odbcdsn = 'localhost';
+        }
+
+        $connect_function = $persistent ? 'odbc_pconnect' : 'odbc_connect';
+
+        if (empty($dsn['cursor'])) {
+            $this->connection = @$connect_function($odbcdsn, $dsn['username'],
+                                                   $dsn['password']);
+        } else {
+            $this->connection = @$connect_function($odbcdsn, $dsn['username'],
+                                                   $dsn['password'],
+                                                   $dsn['cursor']);
+        }
+
+        if (!is_resource($this->connection)) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     $this->errorNative());
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $err = @odbc_close($this->connection);
+        $this->connection = null;
+        return $err;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @odbc_exec($this->connection, $query);
+        if (!$result) {
+            return $this->odbcRaiseError(); // XXX ERRORMSG
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        if (DB::isManip($query)) {
+            $this->affected = $result; // For affectedRows()
+            return DB_OK;
+        }
+        $this->affected = 0;
+        return $result;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal odbc result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return @odbc_next_result($result);
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        $arr = array();
+        if ($rownum !== null) {
+            $rownum++; // ODBC first row is 1
+            if (version_compare(phpversion(), '4.2.0', 'ge')) {
+                $cols = @odbc_fetch_into($result, $arr, $rownum);
+            } else {
+                $cols = @odbc_fetch_into($result, $rownum, $arr);
+            }
+        } else {
+            $cols = @odbc_fetch_into($result, $arr);
+        }
+        if (!$cols) {
+            return null;
+        }
+        if ($fetchmode !== DB_FETCHMODE_ORDERED) {
+            for ($i = 0; $i < count($arr); $i++) {
+                $colName = @odbc_field_name($result, $i+1);
+                $a[$colName] = $arr[$i];
+            }
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+                $a = array_change_key_case($a, CASE_LOWER);
+            }
+            $arr = $a;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @odbc_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @odbc_num_fields($result);
+        if (!$cols) {
+            return $this->odbcRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (empty($this->affected)) {  // In case of SELECT stms
+            return 0;
+        }
+        $nrows = @odbc_num_rows($this->affected);
+        if ($nrows == -1) {
+            return $this->odbcRaiseError();
+        }
+        return $nrows;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * Not all ODBC drivers support this functionality.  If they don't
+     * a DB_Error object for DB_ERROR_UNSUPPORTED is returned.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $nrows = @odbc_num_rows($result);
+        if ($nrows == -1) {
+            return $this->odbcRaiseError(DB_ERROR_UNSUPPORTED);
+        }
+        if ($nrows === false) {
+            return $this->odbcRaiseError();
+        }
+        return $nrows;
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * Use 'mssql' as the dbsyntax in the DB DSN only if you've unchecked
+     * "Use ANSI quoted identifiers" when setting up the ODBC data source.
+     *
+     * @param string $str  identifier name to be quoted
+     *
+     * @return string  quoted identifier string
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        switch ($this->dsn['dbsyntax']) {
+            case 'access':
+                return '[' . $str . ']';
+            case 'mssql':
+            case 'sybase':
+                return '[' . str_replace(']', ']]', $str) . ']';
+            case 'mysql':
+            case 'mysqli':
+                return '`' . $str . '`';
+            default:
+                return '"' . str_replace('"', '""', $str) . '"';
+        }
+    }
+
+    // }}}
+    // {{{ quote()
+
+    /**
+     * @deprecated  Deprecated in release 1.6.0
+     * @internal
+     */
+    function quote($str)
+    {
+        return $this->quoteSmart($str);
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_odbc::createSequence(), DB_odbc::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $repeat = 0;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("update ${seqname} set id = id + 1");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = 1;
+                $this->pushErrorHandling(PEAR_ERROR_RETURN);
+                $result = $this->createSequence($seq_name);
+                $this->popErrorHandling();
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                $result = $this->query("insert into ${seqname} (id) values(0)");
+            } else {
+                $repeat = 0;
+            }
+        } while ($repeat);
+
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+
+        $result = $this->query("select id from ${seqname}");
+        if (DB::isError($result)) {
+            return $result;
+        }
+
+        $row = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        if (DB::isError($row || !$row)) {
+            return $row;
+        }
+
+        return $row[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_odbc::nextID(), DB_odbc::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->query('CREATE TABLE '
+                            . $this->getSequenceName($seq_name)
+                            . ' (id integer NOT NULL,'
+                            . ' PRIMARY KEY(id))');
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_odbc::nextID(), DB_odbc::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        if (!@odbc_autocommit($this->connection, $onoff)) {
+            return $this->odbcRaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if (!@odbc_commit($this->connection)) {
+            return $this->odbcRaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if (!@odbc_rollback($this->connection)) {
+            return $this->odbcRaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ odbcRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_odbc::errorNative(), DB_common::errorCode()
+     */
+    function odbcRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            switch ($this->dbsyntax) {
+                case 'access':
+                    if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
+                        $this->errorcode_map['07001'] = DB_ERROR_NOSUCHFIELD;
+                    } else {
+                        // Doing this in case mode changes during runtime.
+                        $this->errorcode_map['07001'] = DB_ERROR_MISMATCH;
+                    }
+
+                    $native_code = odbc_error($this->connection);
+
+                    // S1000 is for "General Error."  Let's be more specific.
+                    if ($native_code == 'S1000') {
+                        $errormsg = odbc_errormsg($this->connection);
+                        static $error_regexps;
+                        if (!isset($error_regexps)) {
+                            $error_regexps = array(
+                                '/includes related records.$/i'  => DB_ERROR_CONSTRAINT,
+                                '/cannot contain a Null value/i' => DB_ERROR_CONSTRAINT_NOT_NULL,
+                            );
+                        }
+                        foreach ($error_regexps as $regexp => $code) {
+                            if (preg_match($regexp, $errormsg)) {
+                                return $this->raiseError($code,
+                                        null, null, null,
+                                        $native_code . ' ' . $errormsg);
+                            }
+                        }
+                        $errno = DB_ERROR;
+                    } else {
+                        $errno = $this->errorCode($native_code);
+                    }
+                    break;
+                default:
+                    $errno = $this->errorCode(odbc_error($this->connection));
+            }
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 $this->errorNative());
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code and message produced by the last query
+     *
+     * @return string  the DBMS' error code and message
+     */
+    function errorNative()
+    {
+        if (!is_resource($this->connection)) {
+            return @odbc_error() . ' ' . @odbc_errormsg();
+        }
+        return @odbc_error($this->connection) . ' ' . @odbc_errormsg($this->connection);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.7.0
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @odbc_exec($this->connection, "SELECT * FROM $result");
+            if (!$id) {
+                return $this->odbcRaiseError();
+            }
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->odbcRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @odbc_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $col = $i + 1;
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func(@odbc_field_name($id, $col)),
+                'type'  => @odbc_field_type($id, $col),
+                'len'   => @odbc_field_len($id, $col),
+                'flags' => '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @odbc_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * Thanks to symbol1@gmail.com and Philippe.Jausions@11abacus.com.
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the list of objects requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     * @since Method available since Release 1.7.0
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'databases':
+                if (!function_exists('odbc_data_source')) {
+                    return null;
+                }
+                $res = @odbc_data_source($this->connection, SQL_FETCH_FIRST);
+                if (is_array($res)) {
+                    $out = array($res['server']);
+                    while($res = @odbc_data_source($this->connection,
+                                                   SQL_FETCH_NEXT))
+                    {
+                        $out[] = $res['server'];
+                    }
+                    return $out;
+                } else {
+                    return $this->odbcRaiseError();
+                }
+                break;
+            case 'tables':
+            case 'schema.tables':
+                $keep = 'TABLE';
+                break;
+            case 'views':
+                $keep = 'VIEW';
+                break;
+            default:
+                return null;
+        }
+
+        /*
+         * Removing non-conforming items in the while loop rather than
+         * in the odbc_tables() call because some backends choke on this:
+         *     odbc_tables($this->connection, '', '', '', 'TABLE')
+         */
+        $res  = @odbc_tables($this->connection);
+        if (!$res) {
+            return $this->odbcRaiseError();
+        }
+        $out = array();
+        while ($row = odbc_fetch_array($res)) {
+            if ($row['TABLE_TYPE'] != $keep) {
+                continue;
+            }
+            if ($type == 'schema.tables') {
+                $out[] = $row['TABLE_SCHEM'] . '.' . $row['TABLE_NAME'];
+            } else {
+                $out[] = $row['TABLE_NAME'];
+            }
+        }
+        return $out;
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/common.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/common.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/common.php	(revision 1328)
@@ -0,0 +1,2157 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Contains the DB_common base class
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the PEAR class so it can be extended from
+ */
+require_once 'PEAR.php';
+
+/**
+ * DB_common is the base class from which each database driver class extends
+ *
+ * All common methods are declared here.  If a given DBMS driver contains
+ * a particular method, that method will overload the one here.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_common extends PEAR
+{
+    // {{{ properties
+
+    /**
+     * The current default fetch mode
+     * @var integer
+     */
+    var $fetchmode = DB_FETCHMODE_ORDERED;
+
+    /**
+     * The name of the class into which results should be fetched when
+     * DB_FETCHMODE_OBJECT is in effect
+     *
+     * @var string
+     */
+    var $fetchmode_object_class = 'stdClass';
+
+    /**
+     * Was a connection present when the object was serialized()?
+     * @var bool
+     * @see DB_common::__sleep(), DB_common::__wake()
+     */
+    var $was_connected = null;
+
+    /**
+     * The most recently executed query
+     * @var string
+     */
+    var $last_query = '';
+
+    /**
+     * Run-time configuration options
+     *
+     * The 'optimize' option has been deprecated.  Use the 'portability'
+     * option instead.
+     *
+     * @var array
+     * @see DB_common::setOption()
+     */
+    var $options = array(
+        'result_buffering' => 500,
+        'persistent' => false,
+        'ssl' => false,
+        'debug' => 0,
+        'seqname_format' => '%s_seq',
+        'autofree' => false,
+        'portability' => DB_PORTABILITY_NONE,
+        'optimize' => 'performance',  // Deprecated.  Use 'portability'.
+    );
+
+    /**
+     * The parameters from the most recently executed query
+     * @var array
+     * @since Property available since Release 1.7.0
+     */
+    var $last_parameters = array();
+
+    /**
+     * The elements from each prepared statement
+     * @var array
+     */
+    var $prepare_tokens = array();
+
+    /**
+     * The data types of the various elements in each prepared statement
+     * @var array
+     */
+    var $prepare_types = array();
+
+    /**
+     * The prepared queries
+     * @var array
+     */
+    var $prepared_queries = array();
+
+
+    // }}}
+    // {{{ DB_common
+
+    /**
+     * This constructor calls <kbd>$this->PEAR('DB_Error')</kbd>
+     *
+     * @return void
+     */
+    function DB_common()
+    {
+        $this->PEAR('DB_Error');
+    }
+
+    // }}}
+    // {{{ __sleep()
+
+    /**
+     * Automatically indicates which properties should be saved
+     * when PHP's serialize() function is called
+     *
+     * @return array  the array of properties names that should be saved
+     */
+    function __sleep()
+    {
+        if ($this->connection) {
+            // Don't disconnect(), people use serialize() for many reasons
+            $this->was_connected = true;
+        } else {
+            $this->was_connected = false;
+        }
+        if (isset($this->autocommit)) {
+            return array('autocommit',
+                         'dbsyntax',
+                         'dsn',
+                         'features',
+                         'fetchmode',
+                         'fetchmode_object_class',
+                         'options',
+                         'was_connected',
+                   );
+        } else {
+            return array('dbsyntax',
+                         'dsn',
+                         'features',
+                         'fetchmode',
+                         'fetchmode_object_class',
+                         'options',
+                         'was_connected',
+                   );
+        }
+    }
+
+    // }}}
+    // {{{ __wakeup()
+
+    /**
+     * Automatically reconnects to the database when PHP's unserialize()
+     * function is called
+     *
+     * The reconnection attempt is only performed if the object was connected
+     * at the time PHP's serialize() function was run.
+     *
+     * @return void
+     */
+    function __wakeup()
+    {
+        if ($this->was_connected) {
+            $this->connect($this->dsn, $this->options);
+        }
+    }
+
+    // }}}
+    // {{{ __toString()
+
+    /**
+     * Automatic string conversion for PHP 5
+     *
+     * @return string  a string describing the current PEAR DB object
+     *
+     * @since Method available since Release 1.7.0
+     */
+    function __toString()
+    {
+        $info = strtolower(get_class($this));
+        $info .=  ': (phptype=' . $this->phptype .
+                  ', dbsyntax=' . $this->dbsyntax .
+                  ')';
+        if ($this->connection) {
+            $info .= ' [connected]';
+        }
+        return $info;
+    }
+
+    // }}}
+    // {{{ toString()
+
+    /**
+     * DEPRECATED:  String conversion method
+     *
+     * @return string  a string describing the current PEAR DB object
+     *
+     * @deprecated Method deprecated in Release 1.7.0
+     */
+    function toString()
+    {
+        return $this->__toString();
+    }
+
+    // }}}
+    // {{{ quoteString()
+
+    /**
+     * DEPRECATED: Quotes a string so it can be safely used within string
+     * delimiters in a query
+     *
+     * @param string $string  the string to be quoted
+     *
+     * @return string  the quoted string
+     *
+     * @see DB_common::quoteSmart(), DB_common::escapeSimple()
+     * @deprecated Method deprecated some time before Release 1.2
+     */
+    function quoteString($string)
+    {
+        $string = $this->quote($string);
+        if ($string{0} == "'") {
+            return substr($string, 1, -1);
+        }
+        return $string;
+    }
+
+    // }}}
+    // {{{ quote()
+
+    /**
+     * DEPRECATED: Quotes a string so it can be safely used in a query
+     *
+     * @param string $string  the string to quote
+     *
+     * @return string  the quoted string or the string <samp>NULL</samp>
+     *                  if the value submitted is <kbd>null</kbd>.
+     *
+     * @see DB_common::quoteSmart(), DB_common::escapeSimple()
+     * @deprecated Deprecated in release 1.6.0
+     */
+    function quote($string = null)
+    {
+        return ($string === null) ? 'NULL'
+                                  : "'" . str_replace("'", "''", $string) . "'";
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * Delimiting style depends on which database driver is being used.
+     *
+     * NOTE: just because you CAN use delimited identifiers doesn't mean
+     * you SHOULD use them.  In general, they end up causing way more
+     * problems than they solve.
+     *
+     * Portability is broken by using the following characters inside
+     * delimited identifiers:
+     *   + backtick (<kbd>`</kbd>) -- due to MySQL
+     *   + double quote (<kbd>"</kbd>) -- due to Oracle
+     *   + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access
+     *
+     * Delimited identifiers are known to generally work correctly under
+     * the following drivers:
+     *   + mssql
+     *   + mysql
+     *   + mysqli
+     *   + oci8
+     *   + odbc(access)
+     *   + odbc(db2)
+     *   + pgsql
+     *   + sqlite
+     *   + sybase (must execute <kbd>set quoted_identifier on</kbd> sometime
+     *     prior to use)
+     *
+     * InterBase doesn't seem to be able to use delimited identifiers
+     * via PHP 4.  They work fine under PHP 5.
+     *
+     * @param string $str  the identifier name to be quoted
+     *
+     * @return string  the quoted identifier
+     *
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        return '"' . str_replace('"', '""', $str) . '"';
+    }
+
+    // }}}
+    // {{{ quoteSmart()
+
+    /**
+     * Formats input so it can be safely used in a query
+     *
+     * The output depends on the PHP data type of input and the database
+     * type being used.
+     *
+     * @param mixed $in  the data to be formatted
+     *
+     * @return mixed  the formatted data.  The format depends on the input's
+     *                 PHP type:
+     * <ul>
+     *  <li>
+     *    <kbd>input</kbd> -> <samp>returns</samp>
+     *  </li>
+     *  <li>
+     *    <kbd>null</kbd> -> the string <samp>NULL</samp>
+     *  </li>
+     *  <li>
+     *    <kbd>integer</kbd> or <kbd>double</kbd> -> the unquoted number
+     *  </li>
+     *  <li>
+     *    <kbd>bool</kbd> -> output depends on the driver in use
+     *    Most drivers return integers: <samp>1</samp> if
+     *    <kbd>true</kbd> or <samp>0</samp> if
+     *    <kbd>false</kbd>.
+     *    Some return strings: <samp>TRUE</samp> if
+     *    <kbd>true</kbd> or <samp>FALSE</samp> if
+     *    <kbd>false</kbd>.
+     *    Finally one returns strings: <samp>T</samp> if
+     *    <kbd>true</kbd> or <samp>F</samp> if
+     *    <kbd>false</kbd>. Here is a list of each DBMS,
+     *    the values returned and the suggested column type:
+     *    <ul>
+     *      <li>
+     *        <kbd>dbase</kbd> -> <samp>T/F</samp>
+     *        (<kbd>Logical</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>fbase</kbd> -> <samp>TRUE/FALSE</samp>
+     *        (<kbd>BOOLEAN</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>ibase</kbd> -> <samp>1/0</samp>
+     *        (<kbd>SMALLINT</kbd>) [1]
+     *      </li>
+     *      <li>
+     *        <kbd>ifx</kbd> -> <samp>1/0</samp>
+     *        (<kbd>SMALLINT</kbd>) [1]
+     *      </li>
+     *      <li>
+     *        <kbd>msql</kbd> -> <samp>1/0</samp>
+     *        (<kbd>INTEGER</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>mssql</kbd> -> <samp>1/0</samp>
+     *        (<kbd>BIT</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>mysql</kbd> -> <samp>1/0</samp>
+     *        (<kbd>TINYINT(1)</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>mysqli</kbd> -> <samp>1/0</samp>
+     *        (<kbd>TINYINT(1)</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>oci8</kbd> -> <samp>1/0</samp>
+     *        (<kbd>NUMBER(1)</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>odbc</kbd> -> <samp>1/0</samp>
+     *        (<kbd>SMALLINT</kbd>) [1]
+     *      </li>
+     *      <li>
+     *        <kbd>pgsql</kbd> -> <samp>TRUE/FALSE</samp>
+     *        (<kbd>BOOLEAN</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>sqlite</kbd> -> <samp>1/0</samp>
+     *        (<kbd>INTEGER</kbd>)
+     *      </li>
+     *      <li>
+     *        <kbd>sybase</kbd> -> <samp>1/0</samp>
+     *        (<kbd>TINYINT(1)</kbd>)
+     *      </li>
+     *    </ul>
+     *    [1] Accommodate the lowest common denominator because not all
+     *    versions of have <kbd>BOOLEAN</kbd>.
+     *  </li>
+     *  <li>
+     *    other (including strings and numeric strings) ->
+     *    the data with single quotes escaped by preceeding
+     *    single quotes, backslashes are escaped by preceeding
+     *    backslashes, then the whole string is encapsulated
+     *    between single quotes
+     *  </li>
+     * </ul>
+     *
+     * @see DB_common::escapeSimple()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteSmart($in)
+    {
+        if (is_int($in) || is_double($in)) {
+            return $in;
+        } elseif (is_bool($in)) {
+            return $in ? 1 : 0;
+        } elseif (is_null($in)) {
+            return 'NULL';
+        } else {
+            return "'" . $this->escapeSimple($in) . "'";
+        }
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * In SQLite, this makes things safe for inserts/updates, but may
+     * cause problems when performing text comparisons against columns
+     * containing binary data. See the
+     * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function escapeSimple($str)
+    {
+        return str_replace("'", "''", $str);
+    }
+
+    // }}}
+    // {{{ provides()
+
+    /**
+     * Tells whether the present driver supports a given feature
+     *
+     * @param string $feature  the feature you're curious about
+     *
+     * @return bool  whether this driver supports $feature
+     */
+    function provides($feature)
+    {
+        return $this->features[$feature];
+    }
+
+    // }}}
+    // {{{ setFetchMode()
+
+    /**
+     * Sets the fetch mode that should be used by default for query results
+     *
+     * @param integer $fetchmode    DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC
+     *                               or DB_FETCHMODE_OBJECT
+     * @param string $object_class  the class name of the object to be returned
+     *                               by the fetch methods when the
+     *                               DB_FETCHMODE_OBJECT mode is selected.
+     *                               If no class is specified by default a cast
+     *                               to object from the assoc array row will be
+     *                               done.  There is also the posibility to use
+     *                               and extend the 'DB_row' class.
+     *
+     * @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT
+     */
+    function setFetchMode($fetchmode, $object_class = 'stdClass')
+    {
+        switch ($fetchmode) {
+            case DB_FETCHMODE_OBJECT:
+                $this->fetchmode_object_class = $object_class;
+            case DB_FETCHMODE_ORDERED:
+            case DB_FETCHMODE_ASSOC:
+                $this->fetchmode = $fetchmode;
+                break;
+            default:
+                return $this->raiseError('invalid fetchmode mode');
+        }
+    }
+
+    // }}}
+    // {{{ setOption()
+
+    /**
+     * Sets run-time configuration options for PEAR DB
+     *
+     * Options, their data types, default values and description:
+     * <ul>
+     * <li>
+     * <var>autofree</var> <kbd>boolean</kbd> = <samp>false</samp>
+     *      <br />should results be freed automatically when there are no
+     *            more rows?
+     * </li><li>
+     * <var>result_buffering</var> <kbd>integer</kbd> = <samp>500</samp>
+     *      <br />how many rows of the result set should be buffered?
+     *      <br />In mysql: mysql_unbuffered_query() is used instead of
+     *            mysql_query() if this value is 0.  (Release 1.7.0)
+     *      <br />In oci8: this value is passed to ocisetprefetch().
+     *            (Release 1.7.0)
+     * </li><li>
+     * <var>debug</var> <kbd>integer</kbd> = <samp>0</samp>
+     *      <br />debug level
+     * </li><li>
+     * <var>persistent</var> <kbd>boolean</kbd> = <samp>false</samp>
+     *      <br />should the connection be persistent?
+     * </li><li>
+     * <var>portability</var> <kbd>integer</kbd> = <samp>DB_PORTABILITY_NONE</samp>
+     *      <br />portability mode constant (see below)
+     * </li><li>
+     * <var>seqname_format</var> <kbd>string</kbd> = <samp>%s_seq</samp>
+     *      <br />the sprintf() format string used on sequence names.  This
+     *            format is applied to sequence names passed to
+     *            createSequence(), nextID() and dropSequence().
+     * </li><li>
+     * <var>ssl</var> <kbd>boolean</kbd> = <samp>false</samp>
+     *      <br />use ssl to connect?
+     * </li>
+     * </ul>
+     *
+     * -----------------------------------------
+     *
+     * PORTABILITY MODES
+     *
+     * These modes are bitwised, so they can be combined using <kbd>|</kbd>
+     * and removed using <kbd>^</kbd>.  See the examples section below on how
+     * to do this.
+     *
+     * <samp>DB_PORTABILITY_NONE</samp>
+     * turn off all portability features
+     *
+     * This mode gets automatically turned on if the deprecated
+     * <var>optimize</var> option gets set to <samp>performance</samp>.
+     *
+     *
+     * <samp>DB_PORTABILITY_LOWERCASE</samp>
+     * convert names of tables and fields to lower case when using
+     * <kbd>get*()</kbd>, <kbd>fetch*()</kbd> and <kbd>tableInfo()</kbd>
+     *
+     * This mode gets automatically turned on in the following databases
+     * if the deprecated option <var>optimize</var> gets set to
+     * <samp>portability</samp>:
+     * + oci8
+     *
+     *
+     * <samp>DB_PORTABILITY_RTRIM</samp>
+     * right trim the data output by <kbd>get*()</kbd> <kbd>fetch*()</kbd>
+     *
+     *
+     * <samp>DB_PORTABILITY_DELETE_COUNT</samp>
+     * force reporting the number of rows deleted
+     *
+     * Some DBMS's don't count the number of rows deleted when performing
+     * simple <kbd>DELETE FROM tablename</kbd> queries.  This portability
+     * mode tricks such DBMS's into telling the count by adding
+     * <samp>WHERE 1=1</samp> to the end of <kbd>DELETE</kbd> queries.
+     *
+     * This mode gets automatically turned on in the following databases
+     * if the deprecated option <var>optimize</var> gets set to
+     * <samp>portability</samp>:
+     * + fbsql
+     * + mysql
+     * + mysqli
+     * + sqlite
+     *
+     *
+     * <samp>DB_PORTABILITY_NUMROWS</samp>
+     * enable hack that makes <kbd>numRows()</kbd> work in Oracle
+     *
+     * This mode gets automatically turned on in the following databases
+     * if the deprecated option <var>optimize</var> gets set to
+     * <samp>portability</samp>:
+     * + oci8
+     *
+     *
+     * <samp>DB_PORTABILITY_ERRORS</samp>
+     * makes certain error messages in certain drivers compatible
+     * with those from other DBMS's
+     *
+     * + mysql, mysqli:  change unique/primary key constraints
+     *   DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
+     *
+     * + odbc(access):  MS's ODBC driver reports 'no such field' as code
+     *   07001, which means 'too few parameters.'  When this option is on
+     *   that code gets mapped to DB_ERROR_NOSUCHFIELD.
+     *   DB_ERROR_MISMATCH -> DB_ERROR_NOSUCHFIELD
+     *
+     * <samp>DB_PORTABILITY_NULL_TO_EMPTY</samp>
+     * convert null values to empty strings in data output by get*() and
+     * fetch*().  Needed because Oracle considers empty strings to be null,
+     * while most other DBMS's know the difference between empty and null.
+     *
+     *
+     * <samp>DB_PORTABILITY_ALL</samp>
+     * turn on all portability features
+     *
+     * -----------------------------------------
+     *
+     * Example 1. Simple setOption() example
+     * <code>
+     * $db->setOption('autofree', true);
+     * </code>
+     *
+     * Example 2. Portability for lowercasing and trimming
+     * <code>
+     * $db->setOption('portability',
+     *                 DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_RTRIM);
+     * </code>
+     *
+     * Example 3. All portability options except trimming
+     * <code>
+     * $db->setOption('portability',
+     *                 DB_PORTABILITY_ALL ^ DB_PORTABILITY_RTRIM);
+     * </code>
+     *
+     * @param string $option option name
+     * @param mixed  $value value for the option
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::$options
+     */
+    function setOption($option, $value)
+    {
+        if (isset($this->options[$option])) {
+            $this->options[$option] = $value;
+
+            /*
+             * Backwards compatibility check for the deprecated 'optimize'
+             * option.  Done here in case settings change after connecting.
+             */
+            if ($option == 'optimize') {
+                if ($value == 'portability') {
+                    switch ($this->phptype) {
+                        case 'oci8':
+                            $this->options['portability'] =
+                                    DB_PORTABILITY_LOWERCASE |
+                                    DB_PORTABILITY_NUMROWS;
+                            break;
+                        case 'fbsql':
+                        case 'mysql':
+                        case 'mysqli':
+                        case 'sqlite':
+                            $this->options['portability'] =
+                                    DB_PORTABILITY_DELETE_COUNT;
+                            break;
+                    }
+                } else {
+                    $this->options['portability'] = DB_PORTABILITY_NONE;
+                }
+            }
+
+            return DB_OK;
+        }
+        return $this->raiseError("unknown option $option");
+    }
+
+    // }}}
+    // {{{ getOption()
+
+    /**
+     * Returns the value of an option
+     *
+     * @param string $option  the option name you're curious about
+     *
+     * @return mixed  the option's value
+     */
+    function getOption($option)
+    {
+        if (isset($this->options[$option])) {
+            return $this->options[$option];
+        }
+        return $this->raiseError("unknown option $option");
+    }
+
+    // }}}
+    // {{{ prepare()
+
+    /**
+     * Prepares a query for multiple execution with execute()
+     *
+     * Creates a query that can be run multiple times.  Each time it is run,
+     * the placeholders, if any, will be replaced by the contents of
+     * execute()'s $data argument.
+     *
+     * Three types of placeholders can be used:
+     *   + <kbd>?</kbd>  scalar value (i.e. strings, integers).  The system
+     *                   will automatically quote and escape the data.
+     *   + <kbd>!</kbd>  value is inserted 'as is'
+     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
+     *                   inserted into the query (i.e. saving binary
+     *                   data in a db)
+     *
+     * Example 1.
+     * <code>
+     * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
+     * $data = array(
+     *     "John's text",
+     *     "'it''s good'",
+     *     'filename.txt'
+     * );
+     * $res = $db->execute($sth, $data);
+     * </code>
+     *
+     * Use backslashes to escape placeholder characters if you don't want
+     * them to be interpreted as placeholders:
+     * <pre>
+     *    "UPDATE foo SET col=? WHERE col='over \& under'"
+     * </pre>
+     *
+     * With some database backends, this is emulated.
+     *
+     * {@internal ibase and oci8 have their own prepare() methods.}}
+     *
+     * @param string $query  the query to be prepared
+     *
+     * @return mixed  DB statement resource on success. A DB_Error object
+     *                 on failure.
+     *
+     * @see DB_common::execute()
+     */
+    function prepare($query)
+    {
+        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
+                               PREG_SPLIT_DELIM_CAPTURE);
+        $token     = 0;
+        $types     = array();
+        $newtokens = array();
+
+        foreach ($tokens as $val) {
+            switch ($val) {
+                case '?':
+                    $types[$token++] = DB_PARAM_SCALAR;
+                    break;
+                case '&':
+                    $types[$token++] = DB_PARAM_OPAQUE;
+                    break;
+                case '!':
+                    $types[$token++] = DB_PARAM_MISC;
+                    break;
+                default:
+                    $newtokens[] = preg_replace('/\\\([&?!])/', "\\1", $val);
+            }
+        }
+
+        $this->prepare_tokens[] = &$newtokens;
+        end($this->prepare_tokens);
+
+        $k = key($this->prepare_tokens);
+        $this->prepare_types[$k] = $types;
+        $this->prepared_queries[$k] = implode(' ', $newtokens);
+
+        return $k;
+    }
+
+    // }}}
+    // {{{ autoPrepare()
+
+    /**
+     * Automaticaly generates an insert or update query and pass it to prepare()
+     *
+     * @param string $table         the table name
+     * @param array  $table_fields  the array of field names
+     * @param int    $mode          a type of query to make:
+     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
+     * @param string $where         for update queries: the WHERE clause to
+     *                               append to the SQL statement.  Don't
+     *                               include the "WHERE" keyword.
+     *
+     * @return resource  the query handle
+     *
+     * @uses DB_common::prepare(), DB_common::buildManipSQL()
+     */
+    function autoPrepare($table, $table_fields, $mode = DB_AUTOQUERY_INSERT,
+                         $where = false)
+    {
+        $query = $this->buildManipSQL($table, $table_fields, $mode, $where);
+        if (DB::isError($query)) {
+            return $query;
+        }
+        return $this->prepare($query);
+    }
+
+    // }}}
+    // {{{ autoExecute()
+
+    /**
+     * Automaticaly generates an insert or update query and call prepare()
+     * and execute() with it
+     *
+     * @param string $table         the table name
+     * @param array  $fields_values the associative array where $key is a
+     *                               field name and $value its value
+     * @param int    $mode          a type of query to make:
+     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
+     * @param string $where         for update queries: the WHERE clause to
+     *                               append to the SQL statement.  Don't
+     *                               include the "WHERE" keyword.
+     *
+     * @return mixed  a new DB_result object for successful SELECT queries
+     *                 or DB_OK for successul data manipulation queries.
+     *                 A DB_Error object on failure.
+     *
+     * @uses DB_common::autoPrepare(), DB_common::execute()
+     */
+    function autoExecute($table, $fields_values, $mode = DB_AUTOQUERY_INSERT,
+                         $where = false)
+    {
+        $sth = $this->autoPrepare($table, array_keys($fields_values), $mode,
+                                  $where);
+        if (DB::isError($sth)) {
+            return $sth;
+        }
+        $ret =& $this->execute($sth, array_values($fields_values));
+        $this->freePrepared($sth);
+        return $ret;
+
+    }
+
+    // }}}
+    // {{{ buildManipSQL()
+
+    /**
+     * Produces an SQL query string for autoPrepare()
+     *
+     * Example:
+     * <pre>
+     * buildManipSQL('table_sql', array('field1', 'field2', 'field3'),
+     *               DB_AUTOQUERY_INSERT);
+     * </pre>
+     *
+     * That returns
+     * <samp>
+     * INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?)
+     * </samp>
+     *
+     * NOTES:
+     *   - This belongs more to a SQL Builder class, but this is a simple
+     *     facility.
+     *   - Be carefull! If you don't give a $where param with an UPDATE
+     *     query, all the records of the table will be updated!
+     *
+     * @param string $table         the table name
+     * @param array  $table_fields  the array of field names
+     * @param int    $mode          a type of query to make:
+     *                               DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
+     * @param string $where         for update queries: the WHERE clause to
+     *                               append to the SQL statement.  Don't
+     *                               include the "WHERE" keyword.
+     *
+     * @return string  the sql query for autoPrepare()
+     */
+    function buildManipSQL($table, $table_fields, $mode, $where = false)
+    {
+        if (count($table_fields) == 0) {
+            return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+        $first = true;
+        switch ($mode) {
+            case DB_AUTOQUERY_INSERT:
+                $values = '';
+                $names = '';
+                foreach ($table_fields as $value) {
+                    if ($first) {
+                        $first = false;
+                    } else {
+                        $names .= ',';
+                        $values .= ',';
+                    }
+                    $names .= $value;
+                    $values .= '?';
+                }
+                return "INSERT INTO $table ($names) VALUES ($values)";
+            case DB_AUTOQUERY_UPDATE:
+                $set = '';
+                foreach ($table_fields as $value) {
+                    if ($first) {
+                        $first = false;
+                    } else {
+                        $set .= ',';
+                    }
+                    $set .= "$value = ?";
+                }
+                $sql = "UPDATE $table SET $set";
+                if ($where) {
+                    $sql .= " WHERE $where";
+                }
+                return $sql;
+            default:
+                return $this->raiseError(DB_ERROR_SYNTAX);
+        }
+    }
+
+    // }}}
+    // {{{ execute()
+
+    /**
+     * Executes a DB statement prepared with prepare()
+     *
+     * Example 1.
+     * <code>
+     * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
+     * $data = array(
+     *     "John's text",
+     *     "'it''s good'",
+     *     'filename.txt'
+     * );
+     * $res =& $db->execute($sth, $data);
+     * </code>
+     *
+     * @param resource $stmt  a DB statement resource returned from prepare()
+     * @param mixed    $data  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  a new DB_result object for successful SELECT queries
+     *                 or DB_OK for successul data manipulation queries.
+     *                 A DB_Error object on failure.
+     *
+     * {@internal ibase and oci8 have their own execute() methods.}}
+     *
+     * @see DB_common::prepare()
+     */
+    function &execute($stmt, $data = array())
+    {
+        $realquery = $this->executeEmulateQuery($stmt, $data);
+        if (DB::isError($realquery)) {
+            return $realquery;
+        }
+        $result = $this->simpleQuery($realquery);
+
+        if ($result === DB_OK || DB::isError($result)) {
+            return $result;
+        } else {
+            $tmp =& new DB_result($this, $result);
+            return $tmp;
+        }
+    }
+
+    // }}}
+    // {{{ executeEmulateQuery()
+
+    /**
+     * Emulates executing prepared statements if the DBMS not support them
+     *
+     * @param resource $stmt  a DB statement resource returned from execute()
+     * @param mixed    $data  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  a string containing the real query run when emulating
+     *                 prepare/execute.  A DB_Error object on failure.
+     *
+     * @access protected
+     * @see DB_common::execute()
+     */
+    function executeEmulateQuery($stmt, $data = array())
+    {
+        $stmt = (int)$stmt;
+        $data = (array)$data;
+        $this->last_parameters = $data;
+
+        if (count($this->prepare_types[$stmt]) != count($data)) {
+            $this->last_query = $this->prepared_queries[$stmt];
+            return $this->raiseError(DB_ERROR_MISMATCH);
+        }
+
+        $realquery = $this->prepare_tokens[$stmt][0];
+
+        $i = 0;
+        foreach ($data as $value) {
+            if ($this->prepare_types[$stmt][$i] == DB_PARAM_SCALAR) {
+                $realquery .= $this->quoteSmart($value);
+            } elseif ($this->prepare_types[$stmt][$i] == DB_PARAM_OPAQUE) {
+                $fp = @fopen($value, 'rb');
+                if (!$fp) {
+                    return $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
+                }
+                $realquery .= $this->quoteSmart(fread($fp, filesize($value)));
+                fclose($fp);
+            } else {
+                $realquery .= $value;
+            }
+
+            $realquery .= $this->prepare_tokens[$stmt][++$i];
+        }
+
+        return $realquery;
+    }
+
+    // }}}
+    // {{{ executeMultiple()
+
+    /**
+     * Performs several execute() calls on the same statement handle
+     *
+     * $data must be an array indexed numerically
+     * from 0, one execute call is done for every "row" in the array.
+     *
+     * If an error occurs during execute(), executeMultiple() does not
+     * execute the unfinished rows, but rather returns that error.
+     *
+     * @param resource $stmt  query handle from prepare()
+     * @param array    $data  numeric array containing the
+     *                         data to insert into the query
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::prepare(), DB_common::execute()
+     */
+    function executeMultiple($stmt, $data)
+    {
+        foreach ($data as $value) {
+            $res =& $this->execute($stmt, $value);
+            if (DB::isError($res)) {
+                return $res;
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freePrepared()
+
+    /**
+     * Frees the internal resources associated with a prepared query
+     *
+     * @param resource $stmt           the prepared statement's PHP resource
+     * @param bool     $free_resource  should the PHP resource be freed too?
+     *                                  Use false if you need to get data
+     *                                  from the result set later.
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_common::prepare()
+     */
+    function freePrepared($stmt, $free_resource = true)
+    {
+        $stmt = (int)$stmt;
+        if (isset($this->prepare_tokens[$stmt])) {
+            unset($this->prepare_tokens[$stmt]);
+            unset($this->prepare_types[$stmt]);
+            unset($this->prepared_queries[$stmt]);
+            return true;
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ modifyQuery()
+
+    /**
+     * Changes a query string for various DBMS specific reasons
+     *
+     * It is defined here to ensure all drivers have this method available.
+     *
+     * @param string $query  the query string to modify
+     *
+     * @return string  the modified query string
+     *
+     * @access protected
+     * @see DB_mysql::modifyQuery(), DB_oci8::modifyQuery(),
+     *      DB_sqlite::modifyQuery()
+     */
+    function modifyQuery($query)
+    {
+        return $query;
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * It is defined here to assure that all implementations
+     * have this method defined.
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        return $query;
+    }
+
+    // }}}
+    // {{{ query()
+
+    /**
+     * Sends a query to the database server
+     *
+     * The query string can be either a normal statement to be sent directly
+     * to the server OR if <var>$params</var> are passed the query can have
+     * placeholders and it will be passed through prepare() and execute().
+     *
+     * @param string $query   the SQL query or the statement to prepare
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  a new DB_result object for successful SELECT queries
+     *                 or DB_OK for successul data manipulation queries.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_result, DB_common::prepare(), DB_common::execute()
+     */
+    function &query($query, $params = array())
+    {
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+            $ret =& $this->execute($sth, $params);
+            $this->freePrepared($sth, false);
+            return $ret;
+        } else {
+            $this->last_parameters = array();
+            $result = $this->simpleQuery($query);
+            if ($result === DB_OK || DB::isError($result)) {
+                return $result;
+            } else {
+                $tmp =& new DB_result($this, $result);
+                return $tmp;
+            }
+        }
+    }
+
+    // }}}
+    // {{{ limitQuery()
+
+    /**
+     * Generates and executes a LIMIT query
+     *
+     * @param string $query   the query
+     * @param intr   $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  a new DB_result object for successful SELECT queries
+     *                 or DB_OK for successul data manipulation queries.
+     *                 A DB_Error object on failure.
+     */
+    function &limitQuery($query, $from, $count, $params = array())
+    {
+        $query = $this->modifyLimitQuery($query, $from, $count, $params);
+        if (DB::isError($query)){
+            return $query;
+        }
+        $result =& $this->query($query, $params);
+        if (is_a($result, 'DB_result')) {
+            $result->setOption('limit_from', $from);
+            $result->setOption('limit_count', $count);
+        }
+        return $result;
+    }
+
+    // }}}
+    // {{{ getOne()
+
+    /**
+     * Fetches the first column of the first row from a query result
+     *
+     * Takes care of doing the query and freeing the results when finished.
+     *
+     * @param string $query   the SQL query
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return mixed  the returned value of the query.
+     *                 A DB_Error object on failure.
+     */
+    function &getOne($query, $params = array())
+    {
+        $params = (array)$params;
+        // modifyLimitQuery() would be nice here, but it causes BC issues
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if (DB::isError($res)) {
+            return $res;
+        }
+
+        $err = $res->fetchInto($row, DB_FETCHMODE_ORDERED);
+        $res->free();
+
+        if ($err !== DB_OK) {
+            return $err;
+        }
+
+        return $row[0];
+    }
+
+    // }}}
+    // {{{ getRow()
+
+    /**
+     * Fetches the first row of data returned from a query result
+     *
+     * Takes care of doing the query and freeing the results when finished.
+     *
+     * @param string $query   the SQL query
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     * @param int $fetchmode  the fetch mode to use
+     *
+     * @return array  the first row of results as an array.
+     *                 A DB_Error object on failure.
+     */
+    function &getRow($query, $params = array(),
+                     $fetchmode = DB_FETCHMODE_DEFAULT)
+    {
+        // compat check, the params and fetchmode parameters used to
+        // have the opposite order
+        if (!is_array($params)) {
+            if (is_array($fetchmode)) {
+                if ($params === null) {
+                    $tmp = DB_FETCHMODE_DEFAULT;
+                } else {
+                    $tmp = $params;
+                }
+                $params = $fetchmode;
+                $fetchmode = $tmp;
+            } elseif ($params !== null) {
+                $fetchmode = $params;
+                $params = array();
+            }
+        }
+        // modifyLimitQuery() would be nice here, but it causes BC issues
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if (DB::isError($res)) {
+            return $res;
+        }
+
+        $err = $res->fetchInto($row, $fetchmode);
+
+        $res->free();
+
+        if ($err !== DB_OK) {
+            return $err;
+        }
+
+        return $row;
+    }
+
+    // }}}
+    // {{{ getCol()
+
+    /**
+     * Fetches a single column from a query result and returns it as an
+     * indexed array
+     *
+     * @param string $query   the SQL query
+     * @param mixed  $col     which column to return (integer [column number,
+     *                         starting at 0] or string [column name])
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return array  the results as an array.  A DB_Error object on failure.
+     *
+     * @see DB_common::query()
+     */
+    function &getCol($query, $col = 0, $params = array())
+    {
+        $params = (array)$params;
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if (DB::isError($res)) {
+            return $res;
+        }
+
+        $fetchmode = is_int($col) ? DB_FETCHMODE_ORDERED : DB_FETCHMODE_ASSOC;
+
+        if (!is_array($row = $res->fetchRow($fetchmode))) {
+            $ret = array();
+        } else {
+            if (!array_key_exists($col, $row)) {
+                $ret =& $this->raiseError(DB_ERROR_NOSUCHFIELD);
+            } else {
+                $ret = array($row[$col]);
+                while (is_array($row = $res->fetchRow($fetchmode))) {
+                    $ret[] = $row[$col];
+                }
+            }
+        }
+
+        $res->free();
+
+        if (DB::isError($row)) {
+            $ret = $row;
+        }
+
+        return $ret;
+    }
+
+    // }}}
+    // {{{ getAssoc()
+
+    /**
+     * Fetches an entire query result and returns it as an
+     * associative array using the first column as the key
+     *
+     * If the result set contains more than two columns, the value
+     * will be an array of the values from column 2-n.  If the result
+     * set contains only two columns, the returned value will be a
+     * scalar with the value of the second column (unless forced to an
+     * array with the $force_array parameter).  A DB error code is
+     * returned on errors.  If the result set contains fewer than two
+     * columns, a DB_ERROR_TRUNCATED error is returned.
+     *
+     * For example, if the table "mytable" contains:
+     *
+     * <pre>
+     *  ID      TEXT       DATE
+     * --------------------------------
+     *  1       'one'      944679408
+     *  2       'two'      944679408
+     *  3       'three'    944679408
+     * </pre>
+     *
+     * Then the call getAssoc('SELECT id,text FROM mytable') returns:
+     * <pre>
+     *   array(
+     *     '1' => 'one',
+     *     '2' => 'two',
+     *     '3' => 'three',
+     *   )
+     * </pre>
+     *
+     * ...while the call getAssoc('SELECT id,text,date FROM mytable') returns:
+     * <pre>
+     *   array(
+     *     '1' => array('one', '944679408'),
+     *     '2' => array('two', '944679408'),
+     *     '3' => array('three', '944679408')
+     *   )
+     * </pre>
+     *
+     * If the more than one row occurs with the same value in the
+     * first column, the last row overwrites all previous ones by
+     * default.  Use the $group parameter if you don't want to
+     * overwrite like this.  Example:
+     *
+     * <pre>
+     * getAssoc('SELECT category,id,name FROM mytable', false, null,
+     *          DB_FETCHMODE_ASSOC, true) returns:
+     *
+     *   array(
+     *     '1' => array(array('id' => '4', 'name' => 'number four'),
+     *                  array('id' => '6', 'name' => 'number six')
+     *            ),
+     *     '9' => array(array('id' => '4', 'name' => 'number four'),
+     *                  array('id' => '6', 'name' => 'number six')
+     *            )
+     *   )
+     * </pre>
+     *
+     * Keep in mind that database functions in PHP usually return string
+     * values for results regardless of the database's internal type.
+     *
+     * @param string $query        the SQL query
+     * @param bool   $force_array  used only when the query returns
+     *                              exactly two columns.  If true, the values
+     *                              of the returned array will be one-element
+     *                              arrays instead of scalars.
+     * @param mixed  $params       array, string or numeric data to be used in
+     *                              execution of the statement.  Quantity of
+     *                              items passed must match quantity of
+     *                              placeholders in query:  meaning 1
+     *                              placeholder for non-array parameters or
+     *                              1 placeholder per array element.
+     * @param int   $fetchmode     the fetch mode to use
+     * @param bool  $group         if true, the values of the returned array
+     *                              is wrapped in another array.  If the same
+     *                              key value (in the first column) repeats
+     *                              itself, the values will be appended to
+     *                              this array instead of overwriting the
+     *                              existing values.
+     *
+     * @return array  the associative array containing the query results.
+     *                A DB_Error object on failure.
+     */
+    function &getAssoc($query, $force_array = false, $params = array(),
+                       $fetchmode = DB_FETCHMODE_DEFAULT, $group = false)
+    {
+        $params = (array)$params;
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if (DB::isError($res)) {
+            return $res;
+        }
+        if ($fetchmode == DB_FETCHMODE_DEFAULT) {
+            $fetchmode = $this->fetchmode;
+        }
+        $cols = $res->numCols();
+
+        if ($cols < 2) {
+            $tmp =& $this->raiseError(DB_ERROR_TRUNCATED);
+            return $tmp;
+        }
+
+        $results = array();
+
+        if ($cols > 2 || $force_array) {
+            // return array values
+            // XXX this part can be optimized
+            if ($fetchmode == DB_FETCHMODE_ASSOC) {
+                while (is_array($row = $res->fetchRow(DB_FETCHMODE_ASSOC))) {
+                    reset($row);
+                    $key = current($row);
+                    unset($row[key($row)]);
+                    if ($group) {
+                        $results[$key][] = $row;
+                    } else {
+                        $results[$key] = $row;
+                    }
+                }
+            } elseif ($fetchmode == DB_FETCHMODE_OBJECT) {
+                while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
+                    $arr = get_object_vars($row);
+                    $key = current($arr);
+                    if ($group) {
+                        $results[$key][] = $row;
+                    } else {
+                        $results[$key] = $row;
+                    }
+                }
+            } else {
+                while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
+                    // we shift away the first element to get
+                    // indices running from 0 again
+                    $key = array_shift($row);
+                    if ($group) {
+                        $results[$key][] = $row;
+                    } else {
+                        $results[$key] = $row;
+                    }
+                }
+            }
+            if (DB::isError($row)) {
+                $results = $row;
+            }
+        } else {
+            // return scalar values
+            while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
+                if ($group) {
+                    $results[$row[0]][] = $row[1];
+                } else {
+                    $results[$row[0]] = $row[1];
+                }
+            }
+            if (DB::isError($row)) {
+                $results = $row;
+            }
+        }
+
+        $res->free();
+
+        return $results;
+    }
+
+    // }}}
+    // {{{ getAll()
+
+    /**
+     * Fetches all of the rows from a query result
+     *
+     * @param string $query      the SQL query
+     * @param mixed  $params     array, string or numeric data to be used in
+     *                            execution of the statement.  Quantity of
+     *                            items passed must match quantity of
+     *                            placeholders in query:  meaning 1
+     *                            placeholder for non-array parameters or
+     *                            1 placeholder per array element.
+     * @param int    $fetchmode  the fetch mode to use:
+     *                            + DB_FETCHMODE_ORDERED
+     *                            + DB_FETCHMODE_ASSOC
+     *                            + DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED
+     *                            + DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED
+     *
+     * @return array  the nested array.  A DB_Error object on failure.
+     */
+    function &getAll($query, $params = array(),
+                     $fetchmode = DB_FETCHMODE_DEFAULT)
+    {
+        // compat check, the params and fetchmode parameters used to
+        // have the opposite order
+        if (!is_array($params)) {
+            if (is_array($fetchmode)) {
+                if ($params === null) {
+                    $tmp = DB_FETCHMODE_DEFAULT;
+                } else {
+                    $tmp = $params;
+                }
+                $params = $fetchmode;
+                $fetchmode = $tmp;
+            } elseif ($params !== null) {
+                $fetchmode = $params;
+                $params = array();
+            }
+        }
+
+        if (sizeof($params) > 0) {
+            $sth = $this->prepare($query);
+
+            if (DB::isError($sth)) {
+                return $sth;
+            }
+
+            $res =& $this->execute($sth, $params);
+            $this->freePrepared($sth);
+        } else {
+            $res =& $this->query($query);
+        }
+
+        if ($res === DB_OK || DB::isError($res)) {
+            return $res;
+        }
+
+        $results = array();
+        while (DB_OK === $res->fetchInto($row, $fetchmode)) {
+            if ($fetchmode & DB_FETCHMODE_FLIPPED) {
+                foreach ($row as $key => $val) {
+                    $results[$key][] = $val;
+                }
+            } else {
+                $results[] = $row;
+            }
+        }
+
+        $res->free();
+
+        if (DB::isError($row)) {
+            $tmp =& $this->raiseError($row);
+            return $tmp;
+        }
+        return $results;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Determines the number of rows in a query result
+     *
+     * @param resource $result  the query result idenifier produced by PHP
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function numRows($result)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ getSequenceName()
+
+    /**
+     * Generates the name used inside the database for a sequence
+     *
+     * The createSequence() docblock contains notes about storing sequence
+     * names.
+     *
+     * @param string $sqn  the sequence's public name
+     *
+     * @return string  the sequence's name in the backend
+     *
+     * @access protected
+     * @see DB_common::createSequence(), DB_common::dropSequence(),
+     *      DB_common::nextID(), DB_common::setOption()
+     */
+    function getSequenceName($sqn)
+    {
+        return sprintf($this->getOption('seqname_format'),
+                       preg_replace('/[^a-z0-9_.]/i', '_', $sqn));
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::dropSequence(),
+     *      DB_common::getSequenceName()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * The name of a given sequence is determined by passing the string
+     * provided in the <var>$seq_name</var> argument through PHP's sprintf()
+     * function using the value from the <var>seqname_format</var> option as
+     * the sprintf()'s format argument.
+     *
+     * <var>seqname_format</var> is set via setOption().
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_common::nextID()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_common::nextID()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ raiseError()
+
+    /**
+     * Communicates an error and invoke error callbacks, etc
+     *
+     * Basically a wrapper for PEAR::raiseError without the message string.
+     *
+     * @param mixed   integer error code, or a PEAR error object (all
+     *                 other parameters are ignored if this parameter is
+     *                 an object
+     * @param int     error mode, see PEAR_Error docs
+     * @param mixed   if error mode is PEAR_ERROR_TRIGGER, this is the
+     *                 error level (E_USER_NOTICE etc).  If error mode is
+     *                 PEAR_ERROR_CALLBACK, this is the callback function,
+     *                 either as a function name, or as an array of an
+     *                 object and method name.  For other error modes this
+     *                 parameter is ignored.
+     * @param string  extra debug information.  Defaults to the last
+     *                 query and native error code.
+     * @param mixed   native error code, integer or string depending the
+     *                 backend
+     *
+     * @return object  the PEAR_Error object
+     *
+     * @see PEAR_Error
+     */
+    function &raiseError($code = DB_ERROR, $mode = null, $options = null,
+                         $userinfo = null, $nativecode = null)
+    {
+        // The error is yet a DB error object
+        if (is_object($code)) {
+            // because we the static PEAR::raiseError, our global
+            // handler should be used if it is set
+            if ($mode === null && !empty($this->_default_error_mode)) {
+                $mode    = $this->_default_error_mode;
+                $options = $this->_default_error_options;
+            }
+            $tmp = PEAR::raiseError($code, null, $mode, $options,
+                                    null, null, true);
+            return $tmp;
+        }
+
+        if ($userinfo === null) {
+            $userinfo = $this->last_query;
+        }
+
+        if ($nativecode) {
+            $userinfo .= ' [nativecode=' . trim($nativecode) . ']';
+        } else {
+            $userinfo .= ' [DB Error: ' . DB::errorMessage($code) . ']';
+        }
+
+        $tmp = PEAR::raiseError(null, $code, $mode, $options, $userinfo,
+                                'DB_Error', true);
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return mixed  the DBMS' error code.  A DB_Error object on failure.
+     */
+    function errorNative()
+    {
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Maps native error codes to DB's portable ones
+     *
+     * Uses the <var>$errorcode_map</var> property defined in each driver.
+     *
+     * @param string|int $nativecode  the error code returned by the DBMS
+     *
+     * @return int  the portable DB error code.  Return DB_ERROR if the
+     *               current driver doesn't have a mapping for the
+     *               $nativecode submitted.
+     */
+    function errorCode($nativecode)
+    {
+        if (isset($this->errorcode_map[$nativecode])) {
+            return $this->errorcode_map[$nativecode];
+        }
+        // Fall back to DB_ERROR if there was no mapping.
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ errorMessage()
+
+    /**
+     * Maps a DB error code to a textual message
+     *
+     * @param integer $dbcode  the DB error code
+     *
+     * @return string  the error message corresponding to the error code
+     *                  submitted.  FALSE if the error code is unknown.
+     *
+     * @see DB::errorMessage()
+     */
+    function errorMessage($dbcode)
+    {
+        return DB::errorMessage($this->errorcode_map[$dbcode]);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * The format of the resulting array depends on which <var>$mode</var>
+     * you select.  The sample output below is based on this query:
+     * <pre>
+     *    SELECT tblFoo.fldID, tblFoo.fldPhone, tblBar.fldId
+     *    FROM tblFoo
+     *    JOIN tblBar ON tblFoo.fldId = tblBar.fldId
+     * </pre>
+     *
+     * <ul>
+     * <li>
+     *
+     * <kbd>null</kbd> (default)
+     *   <pre>
+     *   [0] => Array (
+     *       [table] => tblFoo
+     *       [name] => fldId
+     *       [type] => int
+     *       [len] => 11
+     *       [flags] => primary_key not_null
+     *   )
+     *   [1] => Array (
+     *       [table] => tblFoo
+     *       [name] => fldPhone
+     *       [type] => string
+     *       [len] => 20
+     *       [flags] =>
+     *   )
+     *   [2] => Array (
+     *       [table] => tblBar
+     *       [name] => fldId
+     *       [type] => int
+     *       [len] => 11
+     *       [flags] => primary_key not_null
+     *   )
+     *   </pre>
+     *
+     * </li><li>
+     *
+     * <kbd>DB_TABLEINFO_ORDER</kbd>
+     *
+     *   <p>In addition to the information found in the default output,
+     *   a notation of the number of columns is provided by the
+     *   <samp>num_fields</samp> element while the <samp>order</samp>
+     *   element provides an array with the column names as the keys and
+     *   their location index number (corresponding to the keys in the
+     *   the default output) as the values.</p>
+     *
+     *   <p>If a result set has identical field names, the last one is
+     *   used.</p>
+     *
+     *   <pre>
+     *   [num_fields] => 3
+     *   [order] => Array (
+     *       [fldId] => 2
+     *       [fldTrans] => 1
+     *   )
+     *   </pre>
+     *
+     * </li><li>
+     *
+     * <kbd>DB_TABLEINFO_ORDERTABLE</kbd>
+     *
+     *   <p>Similar to <kbd>DB_TABLEINFO_ORDER</kbd> but adds more
+     *   dimensions to the array in which the table names are keys and
+     *   the field names are sub-keys.  This is helpful for queries that
+     *   join tables which have identical field names.</p>
+     *
+     *   <pre>
+     *   [num_fields] => 3
+     *   [ordertable] => Array (
+     *       [tblFoo] => Array (
+     *           [fldId] => 0
+     *           [fldPhone] => 1
+     *       )
+     *       [tblBar] => Array (
+     *           [fldId] => 2
+     *       )
+     *   )
+     *   </pre>
+     *
+     * </li>
+     * </ul>
+     *
+     * The <samp>flags</samp> element contains a space separated list
+     * of extra information about the field.  This data is inconsistent
+     * between DBMS's due to the way each DBMS works.
+     *   + <samp>primary_key</samp>
+     *   + <samp>unique_key</samp>
+     *   + <samp>multiple_key</samp>
+     *   + <samp>not_null</samp>
+     *
+     * Most DBMS's only provide the <samp>table</samp> and <samp>flags</samp>
+     * elements if <var>$result</var> is a table name.  The following DBMS's
+     * provide full information from queries:
+     *   + fbsql
+     *   + mysql
+     *
+     * If the 'portability' option has <samp>DB_PORTABILITY_LOWERCASE</samp>
+     * turned on, the names of tables and fields will be lowercased.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                string containing the name of a table.
+     *                                While this also accepts a query result
+     *                                resource identifier, this behavior is
+     *                                deprecated.
+     * @param int  $mode   either unused or one of the tableInfo modes:
+     *                     <kbd>DB_TABLEINFO_ORDERTABLE</kbd>,
+     *                     <kbd>DB_TABLEINFO_ORDER</kbd> or
+     *                     <kbd>DB_TABLEINFO_FULL</kbd> (which does both).
+     *                     These are bitwise, so the first two can be
+     *                     combined using <kbd>|</kbd>.
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::setOption()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        /*
+         * If the DB_<driver> class has a tableInfo() method, that one
+         * overrides this one.  But, if the driver doesn't have one,
+         * this method runs and tells users about that fact.
+         */
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ getTables()
+
+    /**
+     * Lists the tables in the current database
+     *
+     * @return array  the list of tables.  A DB_Error object on failure.
+     *
+     * @deprecated Method deprecated some time before Release 1.2
+     */
+    function getTables()
+    {
+        return $this->getListOf('tables');
+    }
+
+    // }}}
+    // {{{ getListOf()
+
+    /**
+     * Lists internal database information
+     *
+     * @param string $type  type of information being sought.
+     *                       Common items being sought are:
+     *                       tables, databases, users, views, functions
+     *                       Each DBMS's has its own capabilities.
+     *
+     * @return array  an array listing the items sought.
+     *                 A DB DB_Error object on failure.
+     */
+    function getListOf($type)
+    {
+        $sql = $this->getSpecialQuery($type);
+        if ($sql === null) {
+            $this->last_query = '';
+            return $this->raiseError(DB_ERROR_UNSUPPORTED);
+        } elseif (is_int($sql) || DB::isError($sql)) {
+            // Previous error
+            return $this->raiseError($sql);
+        } elseif (is_array($sql)) {
+            // Already the result
+            return $sql;
+        }
+        // Launch this query
+        return $this->getCol($sql);
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        return $this->raiseError(DB_ERROR_UNSUPPORTED);
+    }
+
+    // }}}
+    // {{{ _rtrimArrayValues()
+
+    /**
+     * Right-trims all strings in an array
+     *
+     * @param array $array  the array to be trimmed (passed by reference)
+     *
+     * @return void
+     *
+     * @access protected
+     */
+    function _rtrimArrayValues(&$array)
+    {
+        foreach ($array as $key => $value) {
+            if (is_string($value)) {
+                $array[$key] = rtrim($value);
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _convertNullArrayValuesToEmpty()
+
+    /**
+     * Converts all null values in an array to empty strings
+     *
+     * @param array  $array  the array to be de-nullified (passed by reference)
+     *
+     * @return void
+     *
+     * @access protected
+     */
+    function _convertNullArrayValuesToEmpty(&$array)
+    {
+        foreach ($array as $key => $value) {
+            if (is_null($value)) {
+                $array[$key] = '';
+            }
+        }
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/msql.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/msql.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/msql.php	(revision 1328)
@@ -0,0 +1,810 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's msql extension
+ * for interacting with Mini SQL databases
+ *
+ * PHP's mSQL extension did weird things with NULL values prior to PHP
+ * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
+ * those versions.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's msql extension
+ * for interacting with Mini SQL databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * PHP's mSQL extension did weird things with NULL values prior to PHP
+ * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
+ * those versions.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @since      Class not functional until Release 1.7.0
+ */
+class DB_msql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'msql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'msql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => false,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * The query result resource created by PHP
+     *
+     * Used to make affectedRows() work.  Only contains the result for
+     * data manipulation queries.  Contains false for other queries.
+     *
+     * @var resource
+     * @access private
+     */
+    var $_result;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_msql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * Example of how to connect:
+     * <code>
+     * require_once 'DB.php';
+     * 
+     * // $dsn = 'msql://hostname/dbname';  // use a TCP connection
+     * $dsn = 'msql:///dbname';             // use a socket
+     * $options = array(
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     * 
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('msql')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $params = array();
+        if ($dsn['hostspec']) {
+            $params[] = $dsn['port']
+                        ? $dsn['hostspec'] . ',' . $dsn['port']
+                        : $dsn['hostspec'];
+        }
+
+        $connect_function = $persistent ? 'msql_pconnect' : 'msql_connect';
+
+        $ini = ini_get('track_errors');
+        $php_errormsg = '';
+        if ($ini) {
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+        } else {
+            ini_set('track_errors', 1);
+            $this->connection = @call_user_func_array($connect_function,
+                                                      $params);
+            ini_set('track_errors', $ini);
+        }
+
+        if (!$this->connection) {
+            if (($err = @msql_error()) != '') {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $err);
+            } else {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        }
+
+        if (!@msql_select_db($dsn['database'], $this->connection)) {
+            return $this->msqlRaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @msql_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @msql_query($query, $this->connection);
+        if (!$result) {
+            return $this->msqlRaiseError();
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        if (DB::isManip($query)) {
+            $this->_result = $result;
+            return DB_OK;
+        } else {
+            $this->_result = false;
+            return $result;
+        }
+    }
+
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal msql result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * PHP's mSQL extension did weird things with NULL values prior to PHP
+     * 4.3.11 and 5.0.4.  Make sure your version of PHP meets or exceeds
+     * those versions.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@msql_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @msql_fetch_array($result, MSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @msql_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @msql_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @msql_num_fields($result);
+        if (!$cols) {
+            return $this->msqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @msql_num_rows($result);
+        if ($rows === false) {
+            return $this->msqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ affected()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (!$this->_result) {
+            return 0;
+        }
+        return msql_affected_rows($this->_result);
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_msql::createSequence(), DB_msql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $repeat = false;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result =& $this->query("SELECT _seq FROM ${seqname}");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = true;
+                $this->pushErrorHandling(PEAR_ERROR_RETURN);
+                $result = $this->createSequence($seq_name);
+                $this->popErrorHandling();
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } else {
+                $repeat = false;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        $result->free();
+        return $arr[0];
+    }
+
+    // }}}
+    // {{{ createSequence()
+
+    /**
+     * Creates a new sequence
+     *
+     * Also creates a new table to associate the sequence with.  Uses
+     * a separate table to ensure portability with other drivers.
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_msql::nextID(), DB_msql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $res = $this->query('CREATE TABLE ' . $seqname
+                            . ' (id INTEGER NOT NULL)');
+        if (DB::isError($res)) {
+            return $res;
+        }
+        $res = $this->query("CREATE SEQUENCE ON ${seqname}");
+        return $res;
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_msql::nextID(), DB_msql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * mSQL does not support delimited identifiers
+     *
+     * @param string $str  the identifier name to be quoted
+     *
+     * @return object  a DB_Error object
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.7.0
+     */
+    function quoteIdentifier($str)
+    {
+        return $this->raiseError(DB_ERROR_UNSUPPORTED);
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.7.0
+     */
+    function escapeSimple($str)
+    {
+        return addslashes($str);
+    }
+
+    // }}}
+    // {{{ msqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_msql::errorNative(), DB_msql::errorCode()
+     */
+    function msqlRaiseError($errno = null)
+    {
+        $native = $this->errorNative();
+        if ($errno === null) {
+            $errno = $this->errorCode($native);
+        }
+        return $this->raiseError($errno, null, null, null, $native);
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error message produced by the last query
+     *
+     * @return string  the DBMS' error message
+     */
+    function errorNative()
+    {
+        return @msql_error();
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from the database's text error message
+     *
+     * @param string $errormsg  the error message returned from the database
+     *
+     * @return integer  the error number from a DB_ERROR* constant
+     */
+    function errorCode($errormsg)
+    {
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/^Access to database denied/i'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/^Bad index name/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/^Bad order field/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Bad type for comparison/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Can\'t perform LIKE on/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Can\'t use TEXT fields in LIKE comparison/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Couldn\'t create temporary table/i'
+                    => DB_ERROR_CANNOT_CREATE,
+                '/^Error creating table file/i'
+                    => DB_ERROR_CANNOT_CREATE,
+                '/^Field .* cannot be null$/i'
+                    => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/^Index (field|condition) .* cannot be null$/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Invalid date format/i'
+                    => DB_ERROR_INVALID_DATE,
+                '/^Invalid time format/i'
+                    => DB_ERROR_INVALID,
+                '/^Literal value for .* is wrong type$/i'
+                    => DB_ERROR_INVALID_NUMBER,
+                '/^No Database Selected/i'
+                    => DB_ERROR_NODBSELECTED,
+                '/^No value specified for field/i'
+                    => DB_ERROR_VALUE_COUNT_ON_ROW,
+                '/^Non unique value for unique index/i'
+                    => DB_ERROR_CONSTRAINT,
+                '/^Out of memory for temporary table/i'
+                    => DB_ERROR_CANNOT_CREATE,
+                '/^Permission denied/i'
+                    => DB_ERROR_ACCESS_VIOLATION,
+                '/^Reference to un-selected table/i'
+                    => DB_ERROR_SYNTAX,
+                '/^syntax error/i'
+                    => DB_ERROR_SYNTAX,
+                '/^Table .* exists$/i'
+                    => DB_ERROR_ALREADY_EXISTS,
+                '/^Unknown database/i'
+                    => DB_ERROR_NOSUCHDB,
+                '/^Unknown field/i'
+                    => DB_ERROR_NOSUCHFIELD,
+                '/^Unknown (index|system variable)/i'
+                    => DB_ERROR_NOT_FOUND,
+                '/^Unknown table/i'
+                    => DB_ERROR_NOSUCHTABLE,
+                '/^Unqualified field/i'
+                    => DB_ERROR_SYNTAX,
+            );
+        }
+
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::setOption()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @msql_query("SELECT * FROM $result",
+                              $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @msql_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $tmp = @msql_fetch_field($id);
+
+            $flags = '';
+            if ($tmp->not_null) {
+                $flags .= 'not_null ';
+            }
+            if ($tmp->unique) {
+                $flags .= 'unique_key ';
+            }
+            $flags = trim($flags);
+
+            $res[$i] = array(
+                'table' => $case_func($tmp->table),
+                'name'  => $case_func($tmp->name),
+                'type'  => $tmp->type,
+                'len'   => msql_field_len($id, $i),
+                'flags' => $flags,
+            );
+
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @msql_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtain a list of a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return array  the array containing the list of objects requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'databases':
+                $id = @msql_list_dbs($this->connection);
+                break;
+            case 'tables':
+                $id = @msql_list_tables($this->dsn['database'],
+                                        $this->connection);
+                break;
+            default:
+                return null;
+        }
+        if (!$id) {
+            return $this->msqlRaiseError();
+        }
+        $out = array();
+        while ($row = @msql_fetch_row($id)) {
+            $out[] = $row[0];
+        }
+        return $out;
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/dbase.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/dbase.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/dbase.php	(revision 1328)
@@ -0,0 +1,510 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's dbase extension
+ * for interacting with dBase databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's dbase extension
+ * for interacting with dBase databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_dbase extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'dbase';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'dbase';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => false,
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => false,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => false,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * A means of emulating result resources
+     * @var array
+     */
+    var $res_row = array();
+
+    /**
+     * The quantity of results so far
+     *
+     * For emulating result resources.
+     *
+     * @var integer
+     */
+    var $result = 0;
+
+    /**
+     * Maps dbase data type id's to human readable strings
+     *
+     * The human readable values are based on the output of PHP's
+     * dbase_get_header_info() function.
+     *
+     * @var array
+     * @since Property available since Release 1.7.0
+     */
+    var $types = array(
+        'C' => 'character',
+        'D' => 'date',
+        'L' => 'boolean',
+        'M' => 'memo',
+        'N' => 'number',
+    );
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_dbase()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database and create it if it doesn't exist
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's dbase driver supports the following extra DSN options:
+     *   + mode    An integer specifying the read/write mode to use
+     *              (0 = read only, 1 = write only, 2 = read/write).
+     *              Available since PEAR DB 1.7.0.
+     *   + fields  An array of arrays that PHP's dbase_create() function needs
+     *              to create a new database.  This information is used if the
+     *              dBase file specified in the "database" segment of the DSN
+     *              does not exist.  For more info, see the PHP manual's
+     *              {@link http://php.net/dbase_create dbase_create()} page.
+     *              Available since PEAR DB 1.7.0.
+     *
+     * Example of how to connect and establish a new dBase file if necessary:
+     * <code>
+     * require_once 'DB.php';
+     *
+     * $dsn = array(
+     *     'phptype'  => 'dbase',
+     *     'database' => '/path/and/name/of/dbase/file',
+     *     'mode'     => 2,
+     *     'fields'   => array(
+     *         array('a', 'N', 5, 0),
+     *         array('b', 'C', 40),
+     *         array('c', 'C', 255),
+     *         array('d', 'C', 20),
+     *     ),
+     * );
+     * $options = array(
+     *     'debug'       => 2,
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     *
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('dbase')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        /*
+         * Turn track_errors on for entire script since $php_errormsg
+         * is the only way to find errors from the dbase extension.
+         */
+        ini_set('track_errors', 1);
+        $php_errormsg = '';
+
+        if (!file_exists($dsn['database'])) {
+            $this->dsn['mode'] = 2;
+            if (empty($dsn['fields']) || !is_array($dsn['fields'])) {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         'the dbase file does not exist and '
+                                         . 'it could not be created because '
+                                         . 'the "fields" element of the DSN '
+                                         . 'is not properly set');
+            }
+            $this->connection = @dbase_create($dsn['database'],
+                                              $dsn['fields']);
+            if (!$this->connection) {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         'the dbase file does not exist and '
+                                         . 'the attempt to create it failed: '
+                                         . $php_errormsg);
+            }
+        } else {
+            if (!isset($this->dsn['mode'])) {
+                $this->dsn['mode'] = 0;
+            }
+            $this->connection = @dbase_open($dsn['database'],
+                                            $this->dsn['mode']);
+            if (!$this->connection) {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @dbase_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ &query()
+
+    function &query($query = null)
+    {
+        // emulate result resources
+        $this->res_row[(int)$this->result] = 0;
+        $tmp =& new DB_result($this, $this->result++);
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum === null) {
+            $rownum = $this->res_row[(int)$result]++;
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @dbase_get_record_with_names($this->connection, $rownum);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @dbase_get_record($this->connection, $rownum);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($foo)
+    {
+        return @dbase_numfields($this->connection);
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($foo)
+    {
+        return @dbase_numrecords($this->connection);
+    }
+
+    // }}}
+    // {{{ quoteSmart()
+
+    /**
+     * Formats input so it can be safely used in a query
+     *
+     * @param mixed $in  the data to be formatted
+     *
+     * @return mixed  the formatted data.  The format depends on the input's
+     *                 PHP type:
+     *                 + null = the string <samp>NULL</samp>
+     *                 + boolean = <samp>T</samp> if true or
+     *                   <samp>F</samp> if false.  Use the <kbd>Logical</kbd>
+     *                   data type.
+     *                 + integer or double = the unquoted number
+     *                 + other (including strings and numeric strings) =
+     *                   the data with single quotes escaped by preceeding
+     *                   single quotes then the whole string is encapsulated
+     *                   between single quotes
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteSmart($in)
+    {
+        if (is_int($in) || is_double($in)) {
+            return $in;
+        } elseif (is_bool($in)) {
+            return $in ? 'T' : 'F';
+        } elseif (is_null($in)) {
+            return 'NULL';
+        } else {
+            return "'" . $this->escapeSimple($in) . "'";
+        }
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about the current database
+     *
+     * @param mixed $result  THIS IS UNUSED IN DBASE.  The current database
+     *                       is examined regardless of what is provided here.
+     * @param int   $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.7.0
+     */
+    function tableInfo($result = null, $mode = null)
+    {
+        if (function_exists('dbase_get_header_info')) {
+            $id = @dbase_get_header_info($this->connection);
+            if (!$id && $php_errormsg) {
+                return $this->raiseError(DB_ERROR,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        } else {
+            /*
+             * This segment for PHP 4 is loosely based on code by
+             * Hadi Rusiah <deegos@yahoo.com> in the comments on
+             * the dBase reference page in the PHP manual.
+             */
+            $db = @fopen($this->dsn['database'], 'r');
+            if (!$db) {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+
+            $id = array();
+            $i  = 0;
+
+            $line = fread($db, 32);
+            while (!feof($db)) {
+                $line = fread($db, 32);
+                if (substr($line, 0, 1) == chr(13)) {
+                    break;
+                } else {
+                    $pos = strpos(substr($line, 0, 10), chr(0));
+                    $pos = ($pos == 0 ? 10 : $pos);
+                    $id[$i] = array(
+                        'name'   => substr($line, 0, $pos),
+                        'type'   => $this->types[substr($line, 11, 1)],
+                        'length' => ord(substr($line, 16, 1)),
+                        'precision' => ord(substr($line, 17, 1)),
+                    );
+                }
+                $i++;
+            }
+
+            fclose($db);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $res   = array();
+        $count = count($id);
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $this->dsn['database'],
+                'name'  => $case_func($id[$i]['name']),
+                'type'  => $id[$i]['type'],
+                'len'   => $id[$i]['length'],
+                'flags' => ''
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        return $res;
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/mysqli.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/mysqli.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/mysqli.php	(revision 1328)
@@ -0,0 +1,1076 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's mysqli extension
+ * for interacting with MySQL databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's mysqli extension
+ * for interacting with MySQL databases
+ *
+ * This is for MySQL versions 4.1 and above.  Requires PHP 5.
+ *
+ * Note that persistent connections no longer exist.
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @since      Class functional since Release 1.6.3
+ */
+class DB_mysqli extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'mysqli';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'mysqli';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => false,
+        'prepare'       => false,
+        'ssl'           => true,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        1004 => DB_ERROR_CANNOT_CREATE,
+        1005 => DB_ERROR_CANNOT_CREATE,
+        1006 => DB_ERROR_CANNOT_CREATE,
+        1007 => DB_ERROR_ALREADY_EXISTS,
+        1008 => DB_ERROR_CANNOT_DROP,
+        1022 => DB_ERROR_ALREADY_EXISTS,
+        1044 => DB_ERROR_ACCESS_VIOLATION,
+        1046 => DB_ERROR_NODBSELECTED,
+        1048 => DB_ERROR_CONSTRAINT,
+        1049 => DB_ERROR_NOSUCHDB,
+        1050 => DB_ERROR_ALREADY_EXISTS,
+        1051 => DB_ERROR_NOSUCHTABLE,
+        1054 => DB_ERROR_NOSUCHFIELD,
+        1061 => DB_ERROR_ALREADY_EXISTS,
+        1062 => DB_ERROR_ALREADY_EXISTS,
+        1064 => DB_ERROR_SYNTAX,
+        1091 => DB_ERROR_NOT_FOUND,
+        1100 => DB_ERROR_NOT_LOCKED,
+        1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        1142 => DB_ERROR_ACCESS_VIOLATION,
+        1146 => DB_ERROR_NOSUCHTABLE,
+        1216 => DB_ERROR_CONSTRAINT,
+        1217 => DB_ERROR_CONSTRAINT,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The database specified in the DSN
+     *
+     * It's a fix to allow calls to different databases in the same script.
+     *
+     * @var string
+     * @access private
+     */
+    var $_db = '';
+
+    /**
+     * Array for converting MYSQLI_*_FLAG constants to text values
+     * @var    array
+     * @access public
+     * @since  Property available since Release 1.6.5
+     */
+    var $mysqli_flags = array(
+        MYSQLI_NOT_NULL_FLAG        => 'not_null',
+        MYSQLI_PRI_KEY_FLAG         => 'primary_key',
+        MYSQLI_UNIQUE_KEY_FLAG      => 'unique_key',
+        MYSQLI_MULTIPLE_KEY_FLAG    => 'multiple_key',
+        MYSQLI_BLOB_FLAG            => 'blob',
+        MYSQLI_UNSIGNED_FLAG        => 'unsigned',
+        MYSQLI_ZEROFILL_FLAG        => 'zerofill',
+        MYSQLI_AUTO_INCREMENT_FLAG  => 'auto_increment',
+        MYSQLI_TIMESTAMP_FLAG       => 'timestamp',
+        MYSQLI_SET_FLAG             => 'set',
+        // MYSQLI_NUM_FLAG             => 'numeric',  // unnecessary
+        // MYSQLI_PART_KEY_FLAG        => 'multiple_key',  // duplicatvie
+        MYSQLI_GROUP_FLAG           => 'group_by'
+    );
+
+    /**
+     * Array for converting MYSQLI_TYPE_* constants to text values
+     * @var    array
+     * @access public
+     * @since  Property available since Release 1.6.5
+     */
+    var $mysqli_types = array(
+        MYSQLI_TYPE_DECIMAL     => 'decimal',
+        MYSQLI_TYPE_TINY        => 'tinyint',
+        MYSQLI_TYPE_SHORT       => 'int',
+        MYSQLI_TYPE_LONG        => 'int',
+        MYSQLI_TYPE_FLOAT       => 'float',
+        MYSQLI_TYPE_DOUBLE      => 'double',
+        // MYSQLI_TYPE_NULL        => 'DEFAULT NULL',  // let flags handle it
+        MYSQLI_TYPE_TIMESTAMP   => 'timestamp',
+        MYSQLI_TYPE_LONGLONG    => 'bigint',
+        MYSQLI_TYPE_INT24       => 'mediumint',
+        MYSQLI_TYPE_DATE        => 'date',
+        MYSQLI_TYPE_TIME        => 'time',
+        MYSQLI_TYPE_DATETIME    => 'datetime',
+        MYSQLI_TYPE_YEAR        => 'year',
+        MYSQLI_TYPE_NEWDATE     => 'date',
+        MYSQLI_TYPE_ENUM        => 'enum',
+        MYSQLI_TYPE_SET         => 'set',
+        MYSQLI_TYPE_TINY_BLOB   => 'tinyblob',
+        MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob',
+        MYSQLI_TYPE_LONG_BLOB   => 'longblob',
+        MYSQLI_TYPE_BLOB        => 'blob',
+        MYSQLI_TYPE_VAR_STRING  => 'varchar',
+        MYSQLI_TYPE_STRING      => 'char',
+        MYSQLI_TYPE_GEOMETRY    => 'geometry',
+    );
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_mysqli()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's mysqli driver supports the following extra DSN options:
+     *   + When the 'ssl' $option passed to DB::connect() is true:
+     *     + key      The path to the key file.
+     *     + cert     The path to the certificate file.
+     *     + ca       The path to the certificate authority file.
+     *     + capath   The path to a directory that contains trusted SSL
+     *                 CA certificates in pem format.
+     *     + cipher   The list of allowable ciphers for SSL encryption.
+     *
+     * Example of how to connect using SSL:
+     * <code>
+     * require_once 'DB.php';
+     * 
+     * $dsn = array(
+     *     'phptype'  => 'mysqli',
+     *     'username' => 'someuser',
+     *     'password' => 'apasswd',
+     *     'hostspec' => 'localhost',
+     *     'database' => 'thedb',
+     *     'key'      => 'client-key.pem',
+     *     'cert'     => 'client-cert.pem',
+     *     'ca'       => 'cacert.pem',
+     *     'capath'   => '/path/to/ca/dir',
+     *     'cipher'   => 'AES',
+     * );
+     * 
+     * $options = array(
+     *     'ssl' => true,
+     * );
+     * 
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('mysqli')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $ini = ini_get('track_errors');
+        ini_set('track_errors', 1);
+        $php_errormsg = '';
+
+        if ($this->getOption('ssl') === true) {
+            $init = mysqli_init();
+            mysqli_ssl_set(
+                $init,
+                empty($dsn['key'])    ? null : $dsn['key'],
+                empty($dsn['cert'])   ? null : $dsn['cert'],
+                empty($dsn['ca'])     ? null : $dsn['ca'],
+                empty($dsn['capath']) ? null : $dsn['capath'],
+                empty($dsn['cipher']) ? null : $dsn['cipher']
+            );
+            if ($this->connection = @mysqli_real_connect(
+                    $init,
+                    $dsn['hostspec'],
+                    $dsn['username'],
+                    $dsn['password'],
+                    $dsn['database'],
+                    $dsn['port'],
+                    $dsn['socket']))
+            {
+                $this->connection = $init;
+            }
+        } else {
+            $this->connection = @mysqli_connect(
+                $dsn['hostspec'],
+                $dsn['username'],
+                $dsn['password'],
+                $dsn['database'],
+                $dsn['port'],
+                $dsn['socket']
+            );
+        }
+
+        ini_set('track_errors', $ini);
+
+        if (!$this->connection) {
+            if (($err = @mysqli_connect_error()) != '') {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $err);
+            } else {
+                return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                         null, null, null,
+                                         $php_errormsg);
+            }
+        }
+
+        if ($dsn['database']) {
+            $this->_db = $dsn['database'];
+        }
+
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @mysqli_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        if ($this->_db) {
+            if (!@mysqli_select_db($this->connection, $this->_db)) {
+                return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
+            }
+        }
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=0');
+                $result = @mysqli_query($this->connection, 'BEGIN');
+                if (!$result) {
+                    return $this->mysqliRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        $result = @mysqli_query($this->connection, $query);
+        if (!$result) {
+            return $this->mysqliRaiseError();
+        }
+        if (is_object($result)) {
+            return $result;
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal mysql result pointer to the next available result.
+     *
+     * This method has not been implemented yet.
+     *
+     * @param resource $result a valid sql result resource
+     * @return false
+     * @access public
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@mysqli_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @mysqli_fetch_array($result, MYSQLI_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @mysqli_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            /*
+             * Even though this DBMS already trims output, we do this because
+             * a field might have intentional whitespace at the end that
+             * gets removed by DB_PORTABILITY_RTRIM under another driver.
+             */
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @mysqli_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @mysqli_num_fields($result);
+        if (!$cols) {
+            return $this->mysqliRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @mysqli_num_rows($result);
+        if ($rows === null) {
+            return $this->mysqliRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            if ($this->_db) {
+                if (!@mysqli_select_db($this->connection, $this->_db)) {
+                    return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
+                }
+            }
+            $result = @mysqli_query($this->connection, 'COMMIT');
+            $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mysqliRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            if ($this->_db) {
+                if (!@mysqli_select_db($this->connection, $this->_db)) {
+                    return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
+                }
+            }
+            $result = @mysqli_query($this->connection, 'ROLLBACK');
+            $result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mysqliRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            return @mysqli_affected_rows($this->connection);
+        } else {
+            return 0;
+        }
+     }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_mysqli::createSequence(), DB_mysqli::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        do {
+            $repeat = 0;
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query('UPDATE ' . $seqname
+                                   . ' SET id = LAST_INSERT_ID(id + 1)');
+            $this->popErrorHandling();
+            if ($result === DB_OK) {
+                // COMMON CASE
+                $id = @mysqli_insert_id($this->connection);
+                if ($id != 0) {
+                    return $id;
+                }
+
+                // EMPTY SEQ TABLE
+                // Sequence table must be empty for some reason,
+                // so fill it and return 1
+                // Obtain a user-level lock
+                $result = $this->getOne('SELECT GET_LOCK('
+                                        . "'${seqname}_lock', 10)");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                if ($result == 0) {
+                    return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
+                }
+
+                // add the default value
+                $result = $this->query('REPLACE INTO ' . $seqname
+                                       . ' (id) VALUES (0)');
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+
+                // Release the lock
+                $result = $this->getOne('SELECT RELEASE_LOCK('
+                                        . "'${seqname}_lock')");
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                // We know what the result will be, so no need to try again
+                return 1;
+
+            } elseif ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE)
+            {
+                // ONDEMAND TABLE CREATION
+                $result = $this->createSequence($seq_name);
+
+                // Since createSequence initializes the ID to be 1,
+                // we do not need to retrieve the ID again (or we will get 2)
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                } else {
+                    // First ID of a newly created sequence is 1
+                    return 1;
+                }
+
+            } elseif (DB::isError($result) &&
+                      $result->getCode() == DB_ERROR_ALREADY_EXISTS)
+            {
+                // BACKWARDS COMPAT
+                // see _BCsequence() comment
+                $result = $this->_BCsequence($seqname);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+                $repeat = 1;
+            }
+        } while ($repeat);
+
+        return $this->raiseError($result);
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_mysqli::nextID(), DB_mysqli::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $res = $this->query('CREATE TABLE ' . $seqname
+                            . ' (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'
+                            . ' PRIMARY KEY(id))');
+        if (DB::isError($res)) {
+            return $res;
+        }
+        // insert yields value 1, nextId call will generate ID 2
+        return $this->query("INSERT INTO ${seqname} (id) VALUES (0)");
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_mysql::nextID(), DB_mysql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ _BCsequence()
+
+    /**
+     * Backwards compatibility with old sequence emulation implementation
+     * (clean up the dupes)
+     *
+     * @param string $seqname  the sequence name to clean up
+     *
+     * @return bool  true on success.  A DB_Error object on failure.
+     *
+     * @access private
+     */
+    function _BCsequence($seqname)
+    {
+        // Obtain a user-level lock... this will release any previous
+        // application locks, but unlike LOCK TABLES, it does not abort
+        // the current transaction and is much less frequently used.
+        $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)");
+        if (DB::isError($result)) {
+            return $result;
+        }
+        if ($result == 0) {
+            // Failed to get the lock, can't do the conversion, bail
+            // with a DB_ERROR_NOT_LOCKED error
+            return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
+        }
+
+        $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
+        if (DB::isError($highest_id)) {
+            return $highest_id;
+        }
+
+        // This should kill all rows except the highest
+        // We should probably do something if $highest_id isn't
+        // numeric, but I'm at a loss as how to handle that...
+        $result = $this->query('DELETE FROM ' . $seqname
+                               . " WHERE id <> $highest_id");
+        if (DB::isError($result)) {
+            return $result;
+        }
+
+        // If another thread has been waiting for this lock,
+        // it will go thru the above procedure, but will have no
+        // real effect
+        $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')");
+        if (DB::isError($result)) {
+            return $result;
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * MySQL can't handle the backtick character (<kbd>`</kbd>) in
+     * table or column names.
+     *
+     * @param string $str  identifier name to be quoted
+     *
+     * @return string  quoted identifier string
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        return '`' . $str . '`';
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @see DB_common::quoteSmart()
+     * @since Method available since Release 1.6.0
+     */
+    function escapeSimple($str)
+    {
+        return @mysqli_real_escape_string($this->connection, $str);
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        if (DB::isManip($query)) {
+            return $query . " LIMIT $count";
+        } else {
+            return $query . " LIMIT $from, $count";
+        }
+    }
+
+    // }}}
+    // {{{ mysqliRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_mysqli::errorNative(), DB_common::errorCode()
+     */
+    function mysqliRaiseError($errno = null)
+    {
+        if ($errno === null) {
+            if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
+                $this->errorcode_map[1022] = DB_ERROR_CONSTRAINT;
+                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT_NOT_NULL;
+                $this->errorcode_map[1062] = DB_ERROR_CONSTRAINT;
+            } else {
+                // Doing this in case mode changes during runtime.
+                $this->errorcode_map[1022] = DB_ERROR_ALREADY_EXISTS;
+                $this->errorcode_map[1048] = DB_ERROR_CONSTRAINT;
+                $this->errorcode_map[1062] = DB_ERROR_ALREADY_EXISTS;
+            }
+            $errno = $this->errorCode(mysqli_errno($this->connection));
+        }
+        return $this->raiseError($errno, null, null, null,
+                                 @mysqli_errno($this->connection) . ' ** ' .
+                                 @mysqli_error($this->connection));
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code
+     */
+    function errorNative()
+    {
+        return @mysqli_errno($this->connection);
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::setOption()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @mysqli_query($this->connection,
+                                "SELECT * FROM $result LIMIT 0");
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_a($id, 'mysqli_result')) {
+            return $this->mysqliRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @mysqli_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $tmp = @mysqli_fetch_field($id);
+
+            $flags = '';
+            foreach ($this->mysqli_flags as $const => $means) {
+                if ($tmp->flags & $const) {
+                    $flags .= $means . ' ';
+                }
+            }
+            if ($tmp->def) {
+                $flags .= 'default_' . rawurlencode($tmp->def);
+            }
+            $flags = trim($flags);
+
+            $res[$i] = array(
+                'table' => $case_func($tmp->table),
+                'name'  => $case_func($tmp->name),
+                'type'  => isset($this->mysqli_types[$tmp->type])
+                                    ? $this->mysqli_types[$tmp->type]
+                                    : 'unknown',
+                'len'   => $tmp->max_length,
+                'flags' => $flags,
+            );
+
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @mysqli_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SHOW TABLES';
+            case 'users':
+                return 'SELECT DISTINCT User FROM mysql.user';
+            case 'databases':
+                return 'SHOW DATABASES';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/mssql.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/mssql.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/mssql.php	(revision 1328)
@@ -0,0 +1,914 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's mssql extension
+ * for interacting with Microsoft SQL Server databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's mssql extension
+ * for interacting with Microsoft SQL Server databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_mssql extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'mssql';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'mssql';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'emulate',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    // XXX Add here error codes ie: 'S100E' => DB_ERROR_SYNTAX
+    var $errorcode_map = array(
+        110   => DB_ERROR_VALUE_COUNT_ON_ROW,
+        155   => DB_ERROR_NOSUCHFIELD,
+        170   => DB_ERROR_SYNTAX,
+        207   => DB_ERROR_NOSUCHFIELD,
+        208   => DB_ERROR_NOSUCHTABLE,
+        245   => DB_ERROR_INVALID_NUMBER,
+        515   => DB_ERROR_CONSTRAINT_NOT_NULL,
+        547   => DB_ERROR_CONSTRAINT,
+        1913  => DB_ERROR_ALREADY_EXISTS,
+        2627  => DB_ERROR_CONSTRAINT,
+        2714  => DB_ERROR_ALREADY_EXISTS,
+        3701  => DB_ERROR_NOSUCHTABLE,
+        8134  => DB_ERROR_DIVZERO,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * The quantity of transactions begun
+     *
+     * {@internal  While this is private, it can't actually be designated
+     * private in PHP 5 because it is directly accessed in the test suite.}}
+     *
+     * @var integer
+     * @access private
+     */
+    var $transaction_opcount = 0;
+
+    /**
+     * The database specified in the DSN
+     *
+     * It's a fix to allow calls to different databases in the same script.
+     *
+     * @var string
+     * @access private
+     */
+    var $_db = null;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_mssql()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('mssql') && !PEAR::loadExtension('sybase')
+            && !PEAR::loadExtension('sybase_ct'))
+        {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        $params = array(
+            $dsn['hostspec'] ? $dsn['hostspec'] : 'localhost',
+            $dsn['username'] ? $dsn['username'] : null,
+            $dsn['password'] ? $dsn['password'] : null,
+        );
+        if ($dsn['port']) {
+            $params[0] .= ((substr(PHP_OS, 0, 3) == 'WIN') ? ',' : ':')
+                        . $dsn['port'];
+        }
+
+        $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect';
+
+        $this->connection = @call_user_func_array($connect_function, $params);
+
+        if (!$this->connection) {
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     @mssql_get_last_message());
+        }
+        if ($dsn['database']) {
+            if (!@mssql_select_db($dsn['database'], $this->connection)) {
+                return $this->raiseError(DB_ERROR_NODBSELECTED,
+                                         null, null, null,
+                                         @mssql_get_last_message());
+            }
+            $this->_db = $dsn['database'];
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @mssql_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        if (!@mssql_select_db($this->_db, $this->connection)) {
+            return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+        }
+        $query = $this->modifyQuery($query);
+        if (!$this->autocommit && $ismanip) {
+            if ($this->transaction_opcount == 0) {
+                $result = @mssql_query('BEGIN TRAN', $this->connection);
+                if (!$result) {
+                    return $this->mssqlRaiseError();
+                }
+            }
+            $this->transaction_opcount++;
+        }
+        $result = @mssql_query($query, $this->connection);
+        if (!$result) {
+            return $this->mssqlRaiseError();
+        }
+        // Determine which queries that should return data, and which
+        // should return an error code only.
+        return $ismanip ? DB_OK : $result;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal mssql result pointer to the next available result
+     *
+     * @param a valid fbsql result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return @mssql_next_result($result);
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@mssql_data_seek($result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @mssql_fetch_array($result, MSSQL_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @mssql_fetch_row($result);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @mssql_free_result($result);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @mssql_num_fields($result);
+        if (!$cols) {
+            return $this->mssqlRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @mssql_num_rows($result);
+        if ($rows === false) {
+            return $this->mssqlRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        // XXX if $this->transaction_opcount > 0, we should probably
+        // issue a warning here.
+        $this->autocommit = $onoff ? true : false;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        if ($this->transaction_opcount > 0) {
+            if (!@mssql_select_db($this->_db, $this->connection)) {
+                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $result = @mssql_query('COMMIT TRAN', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mssqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        if ($this->transaction_opcount > 0) {
+            if (!@mssql_select_db($this->_db, $this->connection)) {
+                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $result = @mssql_query('ROLLBACK TRAN', $this->connection);
+            $this->transaction_opcount = 0;
+            if (!$result) {
+                return $this->mssqlRaiseError();
+            }
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if (DB::isManip($this->last_query)) {
+            $res = @mssql_query('select @@rowcount', $this->connection);
+            if (!$res) {
+                return $this->mssqlRaiseError();
+            }
+            $ar = @mssql_fetch_row($res);
+            if (!$ar) {
+                $result = 0;
+            } else {
+                @mssql_free_result($res);
+                $result = $ar[0];
+            }
+        } else {
+            $result = 0;
+        }
+        return $result;
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_mssql::createSequence(), DB_mssql::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        if (!@mssql_select_db($this->_db, $this->connection)) {
+            return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+        }
+        $repeat = 0;
+        do {
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("INSERT INTO $seqname (vapor) VALUES (0)");
+            $this->popErrorHandling();
+            if ($ondemand && DB::isError($result) &&
+                ($result->getCode() == DB_ERROR || $result->getCode() == DB_ERROR_NOSUCHTABLE))
+            {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } elseif (!DB::isError($result)) {
+                $result =& $this->query("SELECT @@IDENTITY FROM $seqname");
+                $repeat = 0;
+            } else {
+                $repeat = false;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $result = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        return $result[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_mssql::nextID(), DB_mssql::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->query('CREATE TABLE '
+                            . $this->getSequenceName($seq_name)
+                            . ' ([id] [int] IDENTITY (1, 1) NOT NULL,'
+                            . ' [vapor] [int] NULL)');
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_mssql::nextID(), DB_mssql::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ quoteIdentifier()
+
+    /**
+     * Quotes a string so it can be safely used as a table or column name
+     *
+     * @param string $str  identifier name to be quoted
+     *
+     * @return string  quoted identifier string
+     *
+     * @see DB_common::quoteIdentifier()
+     * @since Method available since Release 1.6.0
+     */
+    function quoteIdentifier($str)
+    {
+        return '[' . str_replace(']', ']]', $str) . ']';
+    }
+
+    // }}}
+    // {{{ mssqlRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_mssql::errorNative(), DB_mssql::errorCode()
+     */
+    function mssqlRaiseError($code = null)
+    {
+        $message = @mssql_get_last_message();
+        if (!$code) {
+            $code = $this->errorNative();
+        }
+        return $this->raiseError($this->errorCode($code, $message),
+                                 null, null, null, "$code - $message");
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code
+     */
+    function errorNative()
+    {
+        $res = @mssql_query('select @@ERROR as ErrorCode', $this->connection);
+        if (!$res) {
+            return DB_ERROR;
+        }
+        $row = @mssql_fetch_row($res);
+        return $row[0];
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from mssql's native codes.
+     *
+     * If <var>$nativecode</var> isn't known yet, it will be looked up.
+     *
+     * @param  mixed  $nativecode  mssql error code, if known
+     * @return integer  an error number from a DB error constant
+     * @see errorNative()
+     */
+    function errorCode($nativecode = null, $msg = '')
+    {
+        if (!$nativecode) {
+            $nativecode = $this->errorNative();
+        }
+        if (isset($this->errorcode_map[$nativecode])) {
+            if ($nativecode == 3701
+                && preg_match('/Cannot drop the index/i', $msg))
+            {
+                return DB_ERROR_NOT_FOUND;
+            }
+            return $this->errorcode_map[$nativecode];
+        } else {
+            return DB_ERROR;
+        }
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            if (!@mssql_select_db($this->_db, $this->connection)) {
+                return $this->mssqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
+            $id = @mssql_query("SELECT * FROM $result WHERE 1=0",
+                               $this->connection);
+            $got_string = true;
+        } elseif (isset($result->result)) {
+            /*
+             * Probably received a result object.
+             * Extract the result resource identifier.
+             */
+            $id = $result->result;
+            $got_string = false;
+        } else {
+            /*
+             * Probably received a result resource identifier.
+             * Copy it.
+             * Deprecated.  Here for compatibility only.
+             */
+            $id = $result;
+            $got_string = false;
+        }
+
+        if (!is_resource($id)) {
+            return $this->mssqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = @mssql_num_fields($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            $res[$i] = array(
+                'table' => $got_string ? $case_func($result) : '',
+                'name'  => $case_func(@mssql_field_name($id, $i)),
+                'type'  => @mssql_field_type($id, $i),
+                'len'   => @mssql_field_length($id, $i),
+                // We only support flags for table
+                'flags' => $got_string
+                           ? $this->_mssql_field_flags($result,
+                                                       @mssql_field_name($id, $i))
+                           : '',
+            );
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        // free the result only if we were called on a table
+        if ($got_string) {
+            @mssql_free_result($id);
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ _mssql_field_flags()
+
+    /**
+     * Get a column's flags
+     *
+     * Supports "not_null", "primary_key",
+     * "auto_increment" (mssql identity), "timestamp" (mssql timestamp),
+     * "unique_key" (mssql unique index, unique check or primary_key) and
+     * "multiple_key" (multikey index)
+     *
+     * mssql timestamp is NOT similar to the mysql timestamp so this is maybe
+     * not useful at all - is the behaviour of mysql_field_flags that primary
+     * keys are alway unique? is the interpretation of multiple_key correct?
+     *
+     * @param string $table   the table name
+     * @param string $column  the field name
+     *
+     * @return string  the flags
+     *
+     * @access private
+     * @author Joern Barthel <j_barthel@web.de>
+     */
+    function _mssql_field_flags($table, $column)
+    {
+        static $tableName = null;
+        static $flags = array();
+
+        if ($table != $tableName) {
+
+            $flags = array();
+            $tableName = $table;
+
+            // get unique and primary keys
+            $res = $this->getAll("EXEC SP_HELPINDEX[$table]", DB_FETCHMODE_ASSOC);
+
+            foreach ($res as $val) {
+                $keys = explode(', ', $val['index_keys']);
+
+                if (sizeof($keys) > 1) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'multiple_key');
+                    }
+                }
+
+                if (strpos($val['index_description'], 'primary key')) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'primary_key');
+                    }
+                } elseif (strpos($val['index_description'], 'unique')) {
+                    foreach ($keys as $key) {
+                        $this->_add_flag($flags[$key], 'unique_key');
+                    }
+                }
+            }
+
+            // get auto_increment, not_null and timestamp
+            $res = $this->getAll("EXEC SP_COLUMNS[$table]", DB_FETCHMODE_ASSOC);
+
+            foreach ($res as $val) {
+                $val = array_change_key_case($val, CASE_LOWER);
+                if ($val['nullable'] == '0') {
+                    $this->_add_flag($flags[$val['column_name']], 'not_null');
+                }
+                if (strpos($val['type_name'], 'identity')) {
+                    $this->_add_flag($flags[$val['column_name']], 'auto_increment');
+                }
+                if (strpos($val['type_name'], 'timestamp')) {
+                    $this->_add_flag($flags[$val['column_name']], 'timestamp');
+                }
+            }
+        }
+
+        if (array_key_exists($column, $flags)) {
+            return(implode(' ', $flags[$column]));
+        }
+        return '';
+    }
+
+    // }}}
+    // {{{ _add_flag()
+
+    /**
+     * Adds a string to the flags array if the flag is not yet in there
+     * - if there is no flag present the array is created
+     *
+     * @param array  &$array  the reference to the flag-array
+     * @param string $value   the flag value
+     *
+     * @return void
+     *
+     * @access private
+     * @author Joern Barthel <j_barthel@web.de>
+     */
+    function _add_flag(&$array, $value)
+    {
+        if (!is_array($array)) {
+            $array = array($value);
+        } elseif (!in_array($value, $array)) {
+            array_push($array, $value);
+        }
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return "SELECT name FROM sysobjects WHERE type = 'U'"
+                       . ' ORDER BY name';
+            case 'views':
+                return "SELECT name FROM sysobjects WHERE type = 'V'";
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/sqlite.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/sqlite.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/sqlite.php	(revision 1328)
@@ -0,0 +1,942 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's sqlite extension
+ * for interacting with SQLite databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Urs Gehrig <urs@circle.ch>
+ * @author     Mika Tuupola <tuupola@appelsiini.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's sqlite extension
+ * for interacting with SQLite databases
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * NOTICE:  This driver needs PHP's track_errors ini setting to be on.
+ * It is automatically turned on when connecting to the database.
+ * Make sure your scripts don't turn it off.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Urs Gehrig <urs@circle.ch>
+ * @author     Mika Tuupola <tuupola@appelsiini.net>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_sqlite extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'sqlite';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'sqlite';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => false,
+        'numrows'       => true,
+        'pconnect'      => true,
+        'prepare'       => false,
+        'ssl'           => false,
+        'transactions'  => false,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     *
+     * {@internal  Error codes according to sqlite_exec.  See the online
+     * manual at http://sqlite.org/c_interface.html for info.
+     * This error handling based on sqlite_exec is not yet implemented.}}
+     *
+     * @var array
+     */
+    var $errorcode_map = array(
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * SQLite data types
+     *
+     * @link http://www.sqlite.org/datatypes.html
+     *
+     * @var array
+     */
+    var $keywords = array (
+        'BLOB'      => '',
+        'BOOLEAN'   => '',
+        'CHARACTER' => '',
+        'CLOB'      => '',
+        'FLOAT'     => '',
+        'INTEGER'   => '',
+        'KEY'       => '',
+        'NATIONAL'  => '',
+        'NUMERIC'   => '',
+        'NVARCHAR'  => '',
+        'PRIMARY'   => '',
+        'TEXT'      => '',
+        'TIMESTAMP' => '',
+        'UNIQUE'    => '',
+        'VARCHAR'   => '',
+        'VARYING'   => '',
+    );
+
+    /**
+     * The most recent error message from $php_errormsg
+     * @var string
+     * @access private
+     */
+    var $_lasterror = '';
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_sqlite()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * PEAR DB's sqlite driver supports the following extra DSN options:
+     *   + mode  The permissions for the database file, in four digit
+     *            chmod octal format (eg "0600").
+     *
+     * Example of connecting to a database in read-only mode:
+     * <code>
+     * require_once 'DB.php';
+     * 
+     * $dsn = 'sqlite:///path/and/name/of/db/file?mode=0400';
+     * $options = array(
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     * 
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('sqlite')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        if ($dsn['database']) {
+            if (!file_exists($dsn['database'])) {
+                if (!touch($dsn['database'])) {
+                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
+                }
+                if (!isset($dsn['mode']) ||
+                    !is_numeric($dsn['mode']))
+                {
+                    $mode = 0644;
+                } else {
+                    $mode = octdec($dsn['mode']);
+                }
+                if (!chmod($dsn['database'], $mode)) {
+                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
+                }
+                if (!file_exists($dsn['database'])) {
+                    return $this->sqliteRaiseError(DB_ERROR_NOT_FOUND);
+                }
+            }
+            if (!is_file($dsn['database'])) {
+                return $this->sqliteRaiseError(DB_ERROR_INVALID);
+            }
+            if (!is_readable($dsn['database'])) {
+                return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
+            }
+        } else {
+            return $this->sqliteRaiseError(DB_ERROR_ACCESS_VIOLATION);
+        }
+
+        $connect_function = $persistent ? 'sqlite_popen' : 'sqlite_open';
+
+        // track_errors must remain on for simpleQuery()
+        ini_set('track_errors', 1);
+        $php_errormsg = '';
+
+        if (!$this->connection = @$connect_function($dsn['database'])) {
+            return $this->raiseError(DB_ERROR_NODBSELECTED,
+                                     null, null, null,
+                                     $php_errormsg);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        $ret = @sqlite_close($this->connection);
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * NOTICE:  This method needs PHP's track_errors ini setting to be on.
+     * It is automatically turned on when connecting to the database.
+     * Make sure your scripts don't turn it off.
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $ismanip = DB::isManip($query);
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+
+        $php_errormsg = '';
+
+        $result = @sqlite_query($query, $this->connection);
+        $this->_lasterror = $php_errormsg ? $php_errormsg : '';
+
+        $this->result = $result;
+        if (!$this->result) {
+            return $this->sqliteRaiseError(null);
+        }
+
+        // sqlite_query() seems to allways return a resource
+        // so cant use that. Using $ismanip instead
+        if (!$ismanip) {
+            $numRows = $this->numRows($result);
+            if (is_object($numRows)) {
+                // we've got PEAR_Error
+                return $numRows;
+            }
+            return $result;
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal sqlite result pointer to the next available result
+     *
+     * @param resource $result  the valid sqlite result resource
+     *
+     * @return bool  true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            if (!@sqlite_seek($this->result, $rownum)) {
+                return null;
+            }
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $arr = @sqlite_fetch_array($result, SQLITE_ASSOC);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $arr = @sqlite_fetch_array($result, SQLITE_NUM);
+        }
+        if (!$arr) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            /*
+             * Even though this DBMS already trims output, we do this because
+             * a field might have intentional whitespace at the end that
+             * gets removed by DB_PORTABILITY_RTRIM under another driver.
+             */
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult(&$result)
+    {
+        // XXX No native free?
+        if (!is_resource($result)) {
+            return false;
+        }
+        $result = null;
+        return true;
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @sqlite_num_fields($result);
+        if (!$cols) {
+            return $this->sqliteRaiseError();
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows()
+     */
+    function numRows($result)
+    {
+        $rows = @sqlite_num_rows($result);
+        if ($rows === null) {
+            return $this->sqliteRaiseError();
+        }
+        return $rows;
+    }
+
+    // }}}
+    // {{{ affected()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        return @sqlite_changes($this->connection);
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_sqlite::nextID(), DB_sqlite::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_sqlite::nextID(), DB_sqlite::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $query   = 'CREATE TABLE ' . $seqname .
+                   ' (id INTEGER UNSIGNED PRIMARY KEY) ';
+        $result  = $this->query($query);
+        if (DB::isError($result)) {
+            return($result);
+        }
+        $query   = "CREATE TRIGGER ${seqname}_cleanup AFTER INSERT ON $seqname
+                    BEGIN
+                        DELETE FROM $seqname WHERE id<LAST_INSERT_ROWID();
+                    END ";
+        $result  = $this->query($query);
+        if (DB::isError($result)) {
+            return($result);
+        }
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_sqlite::createSequence(), DB_sqlite::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+
+        do {
+            $repeat = 0;
+            $this->pushErrorHandling(PEAR_ERROR_RETURN);
+            $result = $this->query("INSERT INTO $seqname (id) VALUES (NULL)");
+            $this->popErrorHandling();
+            if ($result === DB_OK) {
+                $id = @sqlite_last_insert_rowid($this->connection);
+                if ($id != 0) {
+                    return $id;
+                }
+            } elseif ($ondemand && DB::isError($result) &&
+                      $result->getCode() == DB_ERROR_NOSUCHTABLE)
+            {
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                } else {
+                    $repeat = 1;
+                }
+            }
+        } while ($repeat);
+
+        return $this->raiseError($result);
+    }
+
+    // }}}
+    // {{{ getDbFileStats()
+
+    /**
+     * Get the file stats for the current database
+     *
+     * Possible arguments are dev, ino, mode, nlink, uid, gid, rdev, size,
+     * atime, mtime, ctime, blksize, blocks or a numeric key between
+     * 0 and 12.
+     *
+     * @param string $arg  the array key for stats()
+     *
+     * @return mixed  an array on an unspecified key, integer on a passed
+     *                arg and false at a stats error
+     */
+    function getDbFileStats($arg = '')
+    {
+        $stats = stat($this->dsn['database']);
+        if ($stats == false) {
+            return false;
+        }
+        if (is_array($stats)) {
+            if (is_numeric($arg)) {
+                if (((int)$arg <= 12) & ((int)$arg >= 0)) {
+                    return false;
+                }
+                return $stats[$arg ];
+            }
+            if (array_key_exists(trim($arg), $stats)) {
+                return $stats[$arg ];
+            }
+        }
+        return $stats;
+    }
+
+    // }}}
+    // {{{ escapeSimple()
+
+    /**
+     * Escapes a string according to the current DBMS's standards
+     *
+     * In SQLite, this makes things safe for inserts/updates, but may
+     * cause problems when performing text comparisons against columns
+     * containing binary data. See the
+     * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
+     *
+     * @param string $str  the string to be escaped
+     *
+     * @return string  the escaped string
+     *
+     * @since Method available since Release 1.6.1
+     * @see DB_common::escapeSimple()
+     */
+    function escapeSimple($str)
+    {
+        return @sqlite_escape_string($str);
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        return "$query LIMIT $count OFFSET $from";
+    }
+
+    // }}}
+    // {{{ modifyQuery()
+
+    /**
+     * Changes a query string for various DBMS specific reasons
+     *
+     * This little hack lets you know how many rows were deleted
+     * when running a "DELETE FROM table" query.  Only implemented
+     * if the DB_PORTABILITY_DELETE_COUNT portability option is on.
+     *
+     * @param string $query  the query string to modify
+     *
+     * @return string  the modified query string
+     *
+     * @access protected
+     * @see DB_common::setOption()
+     */
+    function modifyQuery($query)
+    {
+        if ($this->options['portability'] & DB_PORTABILITY_DELETE_COUNT) {
+            if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
+                $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
+                                      'DELETE FROM \1 WHERE 1=1', $query);
+            }
+        }
+        return $query;
+    }
+
+    // }}}
+    // {{{ sqliteRaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_sqlite::errorNative(), DB_sqlite::errorCode()
+     */
+    function sqliteRaiseError($errno = null)
+    {
+        $native = $this->errorNative();
+        if ($errno === null) {
+            $errno = $this->errorCode($native);
+        }
+
+        $errorcode = @sqlite_last_error($this->connection);
+        $userinfo = "$errorcode ** $this->last_query";
+
+        return $this->raiseError($errno, null, null, $userinfo, $native);
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error message produced by the last query
+     *
+     * {@internal This is used to retrieve more meaningfull error messages
+     * because sqlite_last_error() does not provide adequate info.}}
+     *
+     * @return string  the DBMS' error message
+     */
+    function errorNative()
+    {
+        return $this->_lasterror;
+    }
+
+    // }}}
+    // {{{ errorCode()
+
+    /**
+     * Determines PEAR::DB error code from the database's text error message
+     *
+     * @param string $errormsg  the error message returned from the database
+     *
+     * @return integer  the DB error number
+     */
+    function errorCode($errormsg)
+    {
+        static $error_regexps;
+        if (!isset($error_regexps)) {
+            $error_regexps = array(
+                '/^no such table:/' => DB_ERROR_NOSUCHTABLE,
+                '/^no such index:/' => DB_ERROR_NOT_FOUND,
+                '/^(table|index) .* already exists$/' => DB_ERROR_ALREADY_EXISTS,
+                '/PRIMARY KEY must be unique/i' => DB_ERROR_CONSTRAINT,
+                '/is not unique/' => DB_ERROR_CONSTRAINT,
+                '/columns .* are not unique/i' => DB_ERROR_CONSTRAINT,
+                '/uniqueness constraint failed/' => DB_ERROR_CONSTRAINT,
+                '/may not be NULL/' => DB_ERROR_CONSTRAINT_NOT_NULL,
+                '/^no such column:/' => DB_ERROR_NOSUCHFIELD,
+                '/column not present in both tables/i' => DB_ERROR_NOSUCHFIELD,
+                '/^near ".*": syntax error$/' => DB_ERROR_SYNTAX,
+                '/[0-9]+ values for [0-9]+ columns/i' => DB_ERROR_VALUE_COUNT_ON_ROW,
+            );
+        }
+        foreach ($error_regexps as $regexp => $code) {
+            if (preg_match($regexp, $errormsg)) {
+                return $code;
+            }
+        }
+        // Fall back to DB_ERROR if there was no mapping.
+        return DB_ERROR;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table
+     *
+     * @param string         $result  a string containing the name of a table
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     * @since Method available since Release 1.7.0
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $id = @sqlite_array_query($this->connection,
+                                      "PRAGMA table_info('$result');",
+                                      SQLITE_ASSOC);
+            $got_string = true;
+        } else {
+            $this->last_query = '';
+            return $this->raiseError(DB_ERROR_NOT_CAPABLE, null, null, null,
+                                     'This DBMS can not obtain tableInfo' .
+                                     ' from result sets');
+        }
+
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $count = count($id);
+        $res   = array();
+
+        if ($mode) {
+            $res['num_fields'] = $count;
+        }
+
+        for ($i = 0; $i < $count; $i++) {
+            if (strpos($id[$i]['type'], '(') !== false) {
+                $bits = explode('(', $id[$i]['type']);
+                $type = $bits[0];
+                $len  = rtrim($bits[1],')');
+            } else {
+                $type = $id[$i]['type'];
+                $len  = 0;
+            }
+
+            $flags = '';
+            if ($id[$i]['pk']) {
+                $flags .= 'primary_key ';
+            }
+            if ($id[$i]['notnull']) {
+                $flags .= 'not_null ';
+            }
+            if ($id[$i]['dflt_value'] !== null) {
+                $flags .= 'default_' . rawurlencode($id[$i]['dflt_value']);
+            }
+            $flags = trim($flags);
+
+            $res[$i] = array(
+                'table' => $case_func($result),
+                'name'  => $case_func($id[$i]['name']),
+                'type'  => $type,
+                'len'   => $len,
+                'flags' => $flags,
+            );
+
+            if ($mode & DB_TABLEINFO_ORDER) {
+                $res['order'][$res[$i]['name']] = $i;
+            }
+            if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+            }
+        }
+
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     * @param array  $args  SQLITE DRIVER ONLY: a private array of arguments
+     *                       used by the getSpecialQuery().  Do not use
+     *                       this directly.
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type, $args = array())
+    {
+        if (!is_array($args)) {
+            return $this->raiseError('no key specified', null, null, null,
+                                     'Argument has to be an array.');
+        }
+
+        switch ($type) {
+            case 'master':
+                return 'SELECT * FROM sqlite_master;';
+            case 'tables':
+                return "SELECT name FROM sqlite_master WHERE type='table' "
+                       . 'UNION ALL SELECT name FROM sqlite_temp_master '
+                       . "WHERE type='table' ORDER BY name;";
+            case 'schema':
+                return 'SELECT sql FROM (SELECT * FROM sqlite_master '
+                       . 'UNION ALL SELECT * FROM sqlite_temp_master) '
+                       . "WHERE type!='meta' "
+                       . 'ORDER BY tbl_name, type DESC, name;';
+            case 'schemax':
+            case 'schema_x':
+                /*
+                 * Use like:
+                 * $res = $db->query($db->getSpecialQuery('schema_x',
+                 *                   array('table' => 'table3')));
+                 */
+                return 'SELECT sql FROM (SELECT * FROM sqlite_master '
+                       . 'UNION ALL SELECT * FROM sqlite_temp_master) '
+                       . "WHERE tbl_name LIKE '{$args['table']}' "
+                       . "AND type!='meta' "
+                       . 'ORDER BY type DESC, name;';
+            case 'alter':
+                /*
+                 * SQLite does not support ALTER TABLE; this is a helper query
+                 * to handle this. 'table' represents the table name, 'rows'
+                 * the news rows to create, 'save' the row(s) to keep _with_
+                 * the data.
+                 *
+                 * Use like:
+                 * $args = array(
+                 *     'table' => $table,
+                 *     'rows'  => "id INTEGER PRIMARY KEY, firstname TEXT, surname TEXT, datetime TEXT",
+                 *     'save'  => "NULL, titel, content, datetime"
+                 * );
+                 * $res = $db->query( $db->getSpecialQuery('alter', $args));
+                 */
+                $rows = strtr($args['rows'], $this->keywords);
+
+                $q = array(
+                    'BEGIN TRANSACTION',
+                    "CREATE TEMPORARY TABLE {$args['table']}_backup ({$args['rows']})",
+                    "INSERT INTO {$args['table']}_backup SELECT {$args['save']} FROM {$args['table']}",
+                    "DROP TABLE {$args['table']}",
+                    "CREATE TABLE {$args['table']} ({$args['rows']})",
+                    "INSERT INTO {$args['table']} SELECT {$rows} FROM {$args['table']}_backup",
+                    "DROP TABLE {$args['table']}_backup",
+                    'COMMIT',
+                );
+
+                /*
+                 * This is a dirty hack, since the above query will not get
+                 * executed with a single query call so here the query method
+                 * will be called directly and return a select instead.
+                 */
+                foreach ($q as $query) {
+                    $this->query($query);
+                }
+                return "SELECT * FROM {$args['table']};";
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB/oci8.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB/oci8.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB/oci8.php	(revision 1328)
@@ -0,0 +1,1117 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * The PEAR DB driver for PHP's oci8 extension
+ * for interacting with Oracle databases
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     James L. Pine <jlp@valinux.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the DB_common class so it can be extended from
+ */
+require_once 'DB/common.php';
+
+/**
+ * The methods PEAR DB uses to interact with PHP's oci8 extension
+ * for interacting with Oracle databases
+ *
+ * Definitely works with versions 8 and 9 of Oracle.
+ *
+ * These methods overload the ones declared in DB_common.
+ *
+ * Be aware...  OCIError() only appears to return anything when given a
+ * statement, so functions return the generic DB_ERROR instead of more
+ * useful errors that have to do with feedback from the database.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     James L. Pine <jlp@valinux.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_oci8 extends DB_common
+{
+    // {{{ properties
+
+    /**
+     * The DB driver type (mysql, oci8, odbc, etc.)
+     * @var string
+     */
+    var $phptype = 'oci8';
+
+    /**
+     * The database syntax variant to be used (db2, access, etc.), if any
+     * @var string
+     */
+    var $dbsyntax = 'oci8';
+
+    /**
+     * The capabilities of this DB implementation
+     *
+     * The 'new_link' element contains the PHP version that first provided
+     * new_link support for this DBMS.  Contains false if it's unsupported.
+     *
+     * Meaning of the 'limit' element:
+     *   + 'emulate' = emulate with fetch row by number
+     *   + 'alter'   = alter the query
+     *   + false     = skip rows
+     *
+     * @var array
+     */
+    var $features = array(
+        'limit'         => 'alter',
+        'new_link'      => '5.0.0',
+        'numrows'       => 'subquery',
+        'pconnect'      => true,
+        'prepare'       => true,
+        'ssl'           => false,
+        'transactions'  => true,
+    );
+
+    /**
+     * A mapping of native error codes to DB error codes
+     * @var array
+     */
+    var $errorcode_map = array(
+        1    => DB_ERROR_CONSTRAINT,
+        900  => DB_ERROR_SYNTAX,
+        904  => DB_ERROR_NOSUCHFIELD,
+        913  => DB_ERROR_VALUE_COUNT_ON_ROW,
+        921  => DB_ERROR_SYNTAX,
+        923  => DB_ERROR_SYNTAX,
+        942  => DB_ERROR_NOSUCHTABLE,
+        955  => DB_ERROR_ALREADY_EXISTS,
+        1400 => DB_ERROR_CONSTRAINT_NOT_NULL,
+        1401 => DB_ERROR_INVALID,
+        1407 => DB_ERROR_CONSTRAINT_NOT_NULL,
+        1418 => DB_ERROR_NOT_FOUND,
+        1476 => DB_ERROR_DIVZERO,
+        1722 => DB_ERROR_INVALID_NUMBER,
+        2289 => DB_ERROR_NOSUCHTABLE,
+        2291 => DB_ERROR_CONSTRAINT,
+        2292 => DB_ERROR_CONSTRAINT,
+        2449 => DB_ERROR_CONSTRAINT,
+    );
+
+    /**
+     * The raw database connection created by PHP
+     * @var resource
+     */
+    var $connection;
+
+    /**
+     * The DSN information for connecting to a database
+     * @var array
+     */
+    var $dsn = array();
+
+
+    /**
+     * Should data manipulation queries be committed automatically?
+     * @var bool
+     * @access private
+     */
+    var $autocommit = true;
+
+    /**
+     * Stores the $data passed to execute() in the oci8 driver
+     *
+     * Gets reset to array() when simpleQuery() is run.
+     *
+     * Needed in case user wants to call numRows() after prepare/execute
+     * was used.
+     *
+     * @var array
+     * @access private
+     */
+    var $_data = array();
+
+    /**
+     * The result or statement handle from the most recently executed query
+     * @var resource
+     */
+    var $last_stmt;
+
+    /**
+     * Is the given prepared statement a data manipulation query?
+     * @var array
+     * @access private
+     */
+    var $manip_query = array();
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor calls <kbd>$this->DB_common()</kbd>
+     *
+     * @return void
+     */
+    function DB_oci8()
+    {
+        $this->DB_common();
+    }
+
+    // }}}
+    // {{{ connect()
+
+    /**
+     * Connect to the database server, log in and open the database
+     *
+     * Don't call this method directly.  Use DB::connect() instead.
+     *
+     * If PHP is at version 5.0.0 or greater:
+     *   + Generally, oci_connect() or oci_pconnect() are used.
+     *   + But if the new_link DSN option is set to true, oci_new_connect()
+     *     is used.
+     *
+     * When using PHP version 4.x, OCILogon() or OCIPLogon() are used.
+     *
+     * PEAR DB's oci8 driver supports the following extra DSN options:
+     *   + charset       The character set to be used on the connection.
+     *                    Only used if PHP is at version 5.0.0 or greater
+     *                    and the Oracle server is at 9.2 or greater.
+     *                    Available since PEAR DB 1.7.0.
+     *   + new_link      If set to true, causes subsequent calls to
+     *                    connect() to return a new connection link
+     *                    instead of the existing one.  WARNING: this is
+     *                    not portable to other DBMS's.
+     *                    Available since PEAR DB 1.7.0.
+     *
+     * @param array $dsn         the data source name
+     * @param bool  $persistent  should the connection be persistent?
+     *
+     * @return int  DB_OK on success. A DB_Error object on failure.
+     */
+    function connect($dsn, $persistent = false)
+    {
+        if (!PEAR::loadExtension('oci8')) {
+            return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
+        }
+
+        $this->dsn = $dsn;
+        if ($dsn['dbsyntax']) {
+            $this->dbsyntax = $dsn['dbsyntax'];
+        }
+
+        if (function_exists('oci_connect')) {
+            if (isset($dsn['new_link'])
+                && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
+            {
+                $connect_function = 'oci_new_connect';
+            } else {
+                $connect_function = $persistent ? 'oci_pconnect'
+                                    : 'oci_connect';
+            }
+
+            // Backwards compatibility with DB < 1.7.0
+            if (empty($dsn['database']) && !empty($dsn['hostspec'])) {
+                $db = $dsn['hostspec'];
+            } else {
+                $db = $dsn['database'];
+            }
+
+            $char = empty($dsn['charset']) ? null : $dsn['charset'];
+            $this->connection = @$connect_function($dsn['username'],
+                                                   $dsn['password'],
+                                                   $db,
+                                                   $char);
+            $error = OCIError();
+            if (!empty($error) && $error['code'] == 12541) {
+                // Couldn't find TNS listener.  Try direct connection.
+                $this->connection = @$connect_function($dsn['username'],
+                                                       $dsn['password'],
+                                                       null,
+                                                       $char);
+            }
+        } else {
+            $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon';
+            if ($dsn['hostspec']) {
+                $this->connection = @$connect_function($dsn['username'],
+                                                       $dsn['password'],
+                                                       $dsn['hostspec']);
+            } elseif ($dsn['username'] || $dsn['password']) {
+                $this->connection = @$connect_function($dsn['username'],
+                                                       $dsn['password']);
+            }
+        }
+
+        if (!$this->connection) {
+            $error = OCIError();
+            $error = (is_array($error)) ? $error['message'] : null;
+            return $this->raiseError(DB_ERROR_CONNECT_FAILED,
+                                     null, null, null,
+                                     $error);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ disconnect()
+
+    /**
+     * Disconnects from the database server
+     *
+     * @return bool  TRUE on success, FALSE on failure
+     */
+    function disconnect()
+    {
+        if (function_exists('oci_close')) {
+            $ret = @oci_close($this->connection);
+        } else {
+            $ret = @OCILogOff($this->connection);
+        }
+        $this->connection = null;
+        return $ret;
+    }
+
+    // }}}
+    // {{{ simpleQuery()
+
+    /**
+     * Sends a query to the database server
+     *
+     * To determine how many rows of a result set get buffered using
+     * ocisetprefetch(), see the "result_buffering" option in setOptions().
+     * This option was added in Release 1.7.0.
+     *
+     * @param string  the SQL query string
+     *
+     * @return mixed  + a PHP result resrouce for successful SELECT queries
+     *                + the DB_OK constant for other successful queries
+     *                + a DB_Error object on failure
+     */
+    function simpleQuery($query)
+    {
+        $this->_data = array();
+        $this->last_parameters = array();
+        $this->last_query = $query;
+        $query = $this->modifyQuery($query);
+        $result = @OCIParse($this->connection, $query);
+        if (!$result) {
+            return $this->oci8RaiseError();
+        }
+        if ($this->autocommit) {
+            $success = @OCIExecute($result,OCI_COMMIT_ON_SUCCESS);
+        } else {
+            $success = @OCIExecute($result,OCI_DEFAULT);
+        }
+        if (!$success) {
+            return $this->oci8RaiseError($result);
+        }
+        $this->last_stmt = $result;
+        if (DB::isManip($query)) {
+            return DB_OK;
+        } else {
+            @ocisetprefetch($result, $this->options['result_buffering']);
+            return $result;
+        }
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Move the internal oracle result pointer to the next available result
+     *
+     * @param a valid oci8 result resource
+     *
+     * @access public
+     *
+     * @return true if a result is available otherwise return false
+     */
+    function nextResult($result)
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Places a row from the result set into the given array
+     *
+     * Formating of the array and the data therein are configurable.
+     * See DB_result::fetchInto() for more information.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::fetchInto() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result    the query result resource
+     * @param array    $arr       the referenced array to put the data in
+     * @param int      $fetchmode how the resulting array should be indexed
+     * @param int      $rownum    the row number to fetch (0 = first row)
+     *
+     * @return mixed  DB_OK on success, NULL when the end of a result set is
+     *                 reached or on failure
+     *
+     * @see DB_result::fetchInto()
+     */
+    function fetchInto($result, &$arr, $fetchmode, $rownum = null)
+    {
+        if ($rownum !== null) {
+            return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+        }
+        if ($fetchmode & DB_FETCHMODE_ASSOC) {
+            $moredata = @OCIFetchInto($result,$arr,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS);
+            if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE &&
+                $moredata)
+            {
+                $arr = array_change_key_case($arr, CASE_LOWER);
+            }
+        } else {
+            $moredata = OCIFetchInto($result,$arr,OCI_RETURN_NULLS+OCI_RETURN_LOBS);
+        }
+        if (!$moredata) {
+            return null;
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
+            $this->_rtrimArrayValues($arr);
+        }
+        if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
+            $this->_convertNullArrayValuesToEmpty($arr);
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ freeResult()
+
+    /**
+     * Deletes the result set and frees the memory occupied by the result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::free() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_result::free()
+     */
+    function freeResult($result)
+    {
+        return @OCIFreeStatement($result);
+    }
+
+    /**
+     * Frees the internal resources associated with a prepared query
+     *
+     * @param resource $stmt           the prepared statement's resource
+     * @param bool     $free_resource  should the PHP resource be freed too?
+     *                                  Use false if you need to get data
+     *                                  from the result set later.
+     *
+     * @return bool  TRUE on success, FALSE if $result is invalid
+     *
+     * @see DB_oci8::prepare()
+     */
+    function freePrepared($stmt, $free_resource = true)
+    {
+        if (!is_resource($stmt)) {
+            return false;
+        }
+        if ($free_resource) {
+            @ocifreestatement($stmt);
+        }
+        if (isset($this->prepare_types[(int)$stmt])) {
+            unset($this->prepare_types[(int)$stmt]);
+            unset($this->manip_query[(int)$stmt]);
+        } else {
+            return false;
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Gets the number of rows in a result set
+     *
+     * Only works if the DB_PORTABILITY_NUMROWS portability option
+     * is turned on.
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numRows() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     *
+     * @see DB_result::numRows(), DB_common::setOption()
+     */
+    function numRows($result)
+    {
+        // emulate numRows for Oracle.  yuck.
+        if ($this->options['portability'] & DB_PORTABILITY_NUMROWS &&
+            $result === $this->last_stmt)
+        {
+            $countquery = 'SELECT COUNT(*) FROM ('.$this->last_query.')';
+            $save_query = $this->last_query;
+            $save_stmt = $this->last_stmt;
+
+            if (count($this->_data)) {
+                $smt = $this->prepare('SELECT COUNT(*) FROM ('.$this->last_query.')');
+                $count = $this->execute($smt, $this->_data);
+            } else {
+                $count =& $this->query($countquery);
+            }
+
+            if (DB::isError($count) ||
+                DB::isError($row = $count->fetchRow(DB_FETCHMODE_ORDERED)))
+            {
+                $this->last_query = $save_query;
+                $this->last_stmt = $save_stmt;
+                return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+            }
+            return $row[0];
+        }
+        return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Gets the number of columns in a result set
+     *
+     * This method is not meant to be called directly.  Use
+     * DB_result::numCols() instead.  It can't be declared "protected"
+     * because DB_result is a separate object.
+     *
+     * @param resource $result  PHP's query result resource
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     *
+     * @see DB_result::numCols()
+     */
+    function numCols($result)
+    {
+        $cols = @OCINumCols($result);
+        if (!$cols) {
+            return $this->oci8RaiseError($result);
+        }
+        return $cols;
+    }
+
+    // }}}
+    // {{{ prepare()
+
+    /**
+     * Prepares a query for multiple execution with execute().
+     *
+     * With oci8, this is emulated.
+     *
+     * prepare() requires a generic query as string like <code>
+     *    INSERT INTO numbers VALUES (?, ?, ?)
+     * </code>.  The <kbd>?</kbd> characters are placeholders.
+     *
+     * Three types of placeholders can be used:
+     *   + <kbd>?</kbd>  a quoted scalar value, i.e. strings, integers
+     *   + <kbd>!</kbd>  value is inserted 'as is'
+     *   + <kbd>&</kbd>  requires a file name.  The file's contents get
+     *                     inserted into the query (i.e. saving binary
+     *                     data in a db)
+     *
+     * Use backslashes to escape placeholder characters if you don't want
+     * them to be interpreted as placeholders.  Example: <code>
+     *    "UPDATE foo SET col=? WHERE col='over \& under'"
+     * </code>
+     *
+     * @param string $query  the query to be prepared
+     *
+     * @return mixed  DB statement resource on success. DB_Error on failure.
+     *
+     * @see DB_oci8::execute()
+     */
+    function prepare($query)
+    {
+        $tokens   = preg_split('/((?<!\\\)[&?!])/', $query, -1,
+                               PREG_SPLIT_DELIM_CAPTURE);
+        $binds    = count($tokens) - 1;
+        $token    = 0;
+        $types    = array();
+        $newquery = '';
+
+        foreach ($tokens as $key => $val) {
+            switch ($val) {
+                case '?':
+                    $types[$token++] = DB_PARAM_SCALAR;
+                    unset($tokens[$key]);
+                    break;
+                case '&':
+                    $types[$token++] = DB_PARAM_OPAQUE;
+                    unset($tokens[$key]);
+                    break;
+                case '!':
+                    $types[$token++] = DB_PARAM_MISC;
+                    unset($tokens[$key]);
+                    break;
+                default:
+                    $tokens[$key] = preg_replace('/\\\([&?!])/', "\\1", $val);
+                    if ($key != $binds) {
+                        $newquery .= $tokens[$key] . ':bind' . $token;
+                    } else {
+                        $newquery .= $tokens[$key];
+                    }
+            }
+        }
+
+        $this->last_query = $query;
+        $newquery = $this->modifyQuery($newquery);
+        if (!$stmt = @OCIParse($this->connection, $newquery)) {
+            return $this->oci8RaiseError();
+        }
+        $this->prepare_types[(int)$stmt] = $types;
+        $this->manip_query[(int)$stmt] = DB::isManip($query);
+        return $stmt;
+    }
+
+    // }}}
+    // {{{ execute()
+
+    /**
+     * Executes a DB statement prepared with prepare().
+     *
+     * To determine how many rows of a result set get buffered using
+     * ocisetprefetch(), see the "result_buffering" option in setOptions().
+     * This option was added in Release 1.7.0.
+     *
+     * @param resource  $stmt  a DB statement resource returned from prepare()
+     * @param mixed  $data  array, string or numeric data to be used in
+     *                      execution of the statement.  Quantity of items
+     *                      passed must match quantity of placeholders in
+     *                      query:  meaning 1 for non-array items or the
+     *                      quantity of elements in the array.
+     *
+     * @return mixed  returns an oic8 result resource for successful SELECT
+     *                queries, DB_OK for other successful queries.
+     *                A DB error object is returned on failure.
+     *
+     * @see DB_oci8::prepare()
+     */
+    function &execute($stmt, $data = array())
+    {
+        $data = (array)$data;
+        $this->last_parameters = $data;
+        $this->_data = $data;
+
+        $types =& $this->prepare_types[(int)$stmt];
+        if (count($types) != count($data)) {
+            $tmp =& $this->raiseError(DB_ERROR_MISMATCH);
+            return $tmp;
+        }
+
+        $i = 0;
+        foreach ($data as $key => $value) {
+            if ($types[$i] == DB_PARAM_MISC) {
+                /*
+                 * Oracle doesn't seem to have the ability to pass a
+                 * parameter along unchanged, so strip off quotes from start
+                 * and end, plus turn two single quotes to one single quote,
+                 * in order to avoid the quotes getting escaped by
+                 * Oracle and ending up in the database.
+                 */
+                $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
+                $data[$key] = str_replace("''", "'", $data[$key]);
+            } elseif ($types[$i] == DB_PARAM_OPAQUE) {
+                $fp = @fopen($data[$key], 'rb');
+                if (!$fp) {
+                    $tmp =& $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
+                    return $tmp;
+                }
+                $data[$key] = fread($fp, filesize($data[$key]));
+                fclose($fp);
+            }
+            if (!@OCIBindByName($stmt, ':bind' . $i, $data[$key], -1)) {
+                $tmp = $this->oci8RaiseError($stmt);
+                return $tmp;
+            }
+            $i++;
+        }
+        if ($this->autocommit) {
+            $success = @OCIExecute($stmt, OCI_COMMIT_ON_SUCCESS);
+        } else {
+            $success = @OCIExecute($stmt, OCI_DEFAULT);
+        }
+        if (!$success) {
+            $tmp = $this->oci8RaiseError($stmt);
+            return $tmp;
+        }
+        $this->last_stmt = $stmt;
+        if ($this->manip_query[(int)$stmt]) {
+            $tmp = DB_OK;
+        } else {
+            @ocisetprefetch($stmt, $this->options['result_buffering']);
+            $tmp =& new DB_result($this, $stmt);
+        }
+        return $tmp;
+    }
+
+    // }}}
+    // {{{ autoCommit()
+
+    /**
+     * Enables or disables automatic commits
+     *
+     * @param bool $onoff  true turns it on, false turns it off
+     *
+     * @return int  DB_OK on success.  A DB_Error object if the driver
+     *               doesn't support auto-committing transactions.
+     */
+    function autoCommit($onoff = false)
+    {
+        $this->autocommit = (bool)$onoff;;
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ commit()
+
+    /**
+     * Commits the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function commit()
+    {
+        $result = @OCICommit($this->connection);
+        if (!$result) {
+            return $this->oci8RaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ rollback()
+
+    /**
+     * Reverts the current transaction
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     */
+    function rollback()
+    {
+        $result = @OCIRollback($this->connection);
+        if (!$result) {
+            return $this->oci8RaiseError();
+        }
+        return DB_OK;
+    }
+
+    // }}}
+    // {{{ affectedRows()
+
+    /**
+     * Determines the number of rows affected by a data maniuplation query
+     *
+     * 0 is returned for queries that don't manipulate data.
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function affectedRows()
+    {
+        if ($this->last_stmt === false) {
+            return $this->oci8RaiseError();
+        }
+        $result = @OCIRowCount($this->last_stmt);
+        if ($result === false) {
+            return $this->oci8RaiseError($this->last_stmt);
+        }
+        return $result;
+    }
+
+    // }}}
+    // {{{ modifyQuery()
+
+    /**
+     * Changes a query string for various DBMS specific reasons
+     *
+     * "SELECT 2+2" must be "SELECT 2+2 FROM dual" in Oracle.
+     *
+     * @param string $query  the query string to modify
+     *
+     * @return string  the modified query string
+     *
+     * @access protected
+     */
+    function modifyQuery($query)
+    {
+        if (preg_match('/^\s*SELECT/i', $query) &&
+            !preg_match('/\sFROM\s/i', $query)) {
+            $query .= ' FROM dual';
+        }
+        return $query;
+    }
+
+    // }}}
+    // {{{ modifyLimitQuery()
+
+    /**
+     * Adds LIMIT clauses to a query string according to current DBMS standards
+     *
+     * @param string $query   the query to modify
+     * @param int    $from    the row to start to fetching (0 = the first row)
+     * @param int    $count   the numbers of rows to fetch
+     * @param mixed  $params  array, string or numeric data to be used in
+     *                         execution of the statement.  Quantity of items
+     *                         passed must match quantity of placeholders in
+     *                         query:  meaning 1 placeholder for non-array
+     *                         parameters or 1 placeholder per array element.
+     *
+     * @return string  the query string with LIMIT clauses added
+     *
+     * @access protected
+     */
+    function modifyLimitQuery($query, $from, $count, $params = array())
+    {
+        // Let Oracle return the name of the columns instead of
+        // coding a "home" SQL parser
+
+        if (count($params)) {
+            $result = $this->prepare("SELECT * FROM ($query) "
+                                     . 'WHERE NULL = NULL');
+            $tmp =& $this->execute($result, $params);
+        } else {
+            $q_fields = "SELECT * FROM ($query) WHERE NULL = NULL";
+
+            if (!$result = @OCIParse($this->connection, $q_fields)) {
+                $this->last_query = $q_fields;
+                return $this->oci8RaiseError();
+            }
+            if (!@OCIExecute($result, OCI_DEFAULT)) {
+                $this->last_query = $q_fields;
+                return $this->oci8RaiseError($result);
+            }
+        }
+
+        $ncols = OCINumCols($result);
+        $cols  = array();
+        for ( $i = 1; $i <= $ncols; $i++ ) {
+            $cols[] = '"' . OCIColumnName($result, $i) . '"';
+        }
+        $fields = implode(', ', $cols);
+        // XXX Test that (tip by John Lim)
+        //if (preg_match('/^\s*SELECT\s+/is', $query, $match)) {
+        //    // Introduce the FIRST_ROWS Oracle query optimizer
+        //    $query = substr($query, strlen($match[0]), strlen($query));
+        //    $query = "SELECT /* +FIRST_ROWS */ " . $query;
+        //}
+
+        // Construct the query
+        // more at: http://marc.theaimsgroup.com/?l=php-db&m=99831958101212&w=2
+        // Perhaps this could be optimized with the use of Unions
+        $query = "SELECT $fields FROM".
+                 "  (SELECT rownum as linenum, $fields FROM".
+                 "      ($query)".
+                 '  WHERE rownum <= '. ($from + $count) .
+                 ') WHERE linenum >= ' . ++$from;
+        return $query;
+    }
+
+    // }}}
+    // {{{ nextId()
+
+    /**
+     * Returns the next free id in a sequence
+     *
+     * @param string  $seq_name  name of the sequence
+     * @param boolean $ondemand  when true, the seqence is automatically
+     *                            created if it does not exist
+     *
+     * @return int  the next id number in the sequence.
+     *               A DB_Error object on failure.
+     *
+     * @see DB_common::nextID(), DB_common::getSequenceName(),
+     *      DB_oci8::createSequence(), DB_oci8::dropSequence()
+     */
+    function nextId($seq_name, $ondemand = true)
+    {
+        $seqname = $this->getSequenceName($seq_name);
+        $repeat = 0;
+        do {
+            $this->expectError(DB_ERROR_NOSUCHTABLE);
+            $result =& $this->query("SELECT ${seqname}.nextval FROM dual");
+            $this->popExpect();
+            if ($ondemand && DB::isError($result) &&
+                $result->getCode() == DB_ERROR_NOSUCHTABLE) {
+                $repeat = 1;
+                $result = $this->createSequence($seq_name);
+                if (DB::isError($result)) {
+                    return $this->raiseError($result);
+                }
+            } else {
+                $repeat = 0;
+            }
+        } while ($repeat);
+        if (DB::isError($result)) {
+            return $this->raiseError($result);
+        }
+        $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
+        return $arr[0];
+    }
+
+    /**
+     * Creates a new sequence
+     *
+     * @param string $seq_name  name of the new sequence
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::createSequence(), DB_common::getSequenceName(),
+     *      DB_oci8::nextID(), DB_oci8::dropSequence()
+     */
+    function createSequence($seq_name)
+    {
+        return $this->query('CREATE SEQUENCE '
+                            . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ dropSequence()
+
+    /**
+     * Deletes a sequence
+     *
+     * @param string $seq_name  name of the sequence to be deleted
+     *
+     * @return int  DB_OK on success.  A DB_Error object on failure.
+     *
+     * @see DB_common::dropSequence(), DB_common::getSequenceName(),
+     *      DB_oci8::nextID(), DB_oci8::createSequence()
+     */
+    function dropSequence($seq_name)
+    {
+        return $this->query('DROP SEQUENCE '
+                            . $this->getSequenceName($seq_name));
+    }
+
+    // }}}
+    // {{{ oci8RaiseError()
+
+    /**
+     * Produces a DB_Error object regarding the current problem
+     *
+     * @param int $errno  if the error is being manually raised pass a
+     *                     DB_ERROR* constant here.  If this isn't passed
+     *                     the error information gathered from the DBMS.
+     *
+     * @return object  the DB_Error object
+     *
+     * @see DB_common::raiseError(),
+     *      DB_oci8::errorNative(), DB_oci8::errorCode()
+     */
+    function oci8RaiseError($errno = null)
+    {
+        if ($errno === null) {
+            $error = @OCIError($this->connection);
+            return $this->raiseError($this->errorCode($error['code']),
+                                     null, null, null, $error['message']);
+        } elseif (is_resource($errno)) {
+            $error = @OCIError($errno);
+            return $this->raiseError($this->errorCode($error['code']),
+                                     null, null, null, $error['message']);
+        }
+        return $this->raiseError($this->errorCode($errno));
+    }
+
+    // }}}
+    // {{{ errorNative()
+
+    /**
+     * Gets the DBMS' native error code produced by the last query
+     *
+     * @return int  the DBMS' error code.  FALSE if the code could not be
+     *               determined
+     */
+    function errorNative()
+    {
+        if (is_resource($this->last_stmt)) {
+            $error = @OCIError($this->last_stmt);
+        } else {
+            $error = @OCIError($this->connection);
+        }
+        if (is_array($error)) {
+            return $error['code'];
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * Returns information about a table or a result set
+     *
+     * NOTE: only supports 'table' and 'flags' if <var>$result</var>
+     * is a table name.
+     *
+     * NOTE: flags won't contain index information.
+     *
+     * @param object|string  $result  DB_result object from a query or a
+     *                                 string containing the name of a table.
+     *                                 While this also accepts a query result
+     *                                 resource identifier, this behavior is
+     *                                 deprecated.
+     * @param int            $mode    a valid tableInfo mode
+     *
+     * @return array  an associative array with the information requested.
+     *                 A DB_Error object on failure.
+     *
+     * @see DB_common::tableInfo()
+     */
+    function tableInfo($result, $mode = null)
+    {
+        if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
+            $case_func = 'strtolower';
+        } else {
+            $case_func = 'strval';
+        }
+
+        $res = array();
+
+        if (is_string($result)) {
+            /*
+             * Probably received a table name.
+             * Create a result resource identifier.
+             */
+            $result = strtoupper($result);
+            $q_fields = 'SELECT column_name, data_type, data_length, '
+                        . 'nullable '
+                        . 'FROM user_tab_columns '
+                        . "WHERE table_name='$result' ORDER BY column_id";
+
+            $this->last_query = $q_fields;
+
+            if (!$stmt = @OCIParse($this->connection, $q_fields)) {
+                return $this->oci8RaiseError(DB_ERROR_NEED_MORE_DATA);
+            }
+            if (!@OCIExecute($stmt, OCI_DEFAULT)) {
+                return $this->oci8RaiseError($stmt);
+            }
+
+            $i = 0;
+            while (@OCIFetch($stmt)) {
+                $res[$i] = array(
+                    'table' => $case_func($result),
+                    'name'  => $case_func(@OCIResult($stmt, 1)),
+                    'type'  => @OCIResult($stmt, 2),
+                    'len'   => @OCIResult($stmt, 3),
+                    'flags' => (@OCIResult($stmt, 4) == 'N') ? 'not_null' : '',
+                );
+                if ($mode & DB_TABLEINFO_ORDER) {
+                    $res['order'][$res[$i]['name']] = $i;
+                }
+                if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                    $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+                }
+                $i++;
+            }
+
+            if ($mode) {
+                $res['num_fields'] = $i;
+            }
+            @OCIFreeStatement($stmt);
+
+        } else {
+            if (isset($result->result)) {
+                /*
+                 * Probably received a result object.
+                 * Extract the result resource identifier.
+                 */
+                $result = $result->result;
+            }
+
+            $res = array();
+
+            if ($result === $this->last_stmt) {
+                $count = @OCINumCols($result);
+                if ($mode) {
+                    $res['num_fields'] = $count;
+                }
+                for ($i = 0; $i < $count; $i++) {
+                    $res[$i] = array(
+                        'table' => '',
+                        'name'  => $case_func(@OCIColumnName($result, $i+1)),
+                        'type'  => @OCIColumnType($result, $i+1),
+                        'len'   => @OCIColumnSize($result, $i+1),
+                        'flags' => '',
+                    );
+                    if ($mode & DB_TABLEINFO_ORDER) {
+                        $res['order'][$res[$i]['name']] = $i;
+                    }
+                    if ($mode & DB_TABLEINFO_ORDERTABLE) {
+                        $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
+                    }
+                }
+            } else {
+                return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+            }
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ getSpecialQuery()
+
+    /**
+     * Obtains the query string needed for listing a given type of objects
+     *
+     * @param string $type  the kind of objects you want to retrieve
+     *
+     * @return string  the SQL query string or null if the driver doesn't
+     *                  support the object type requested
+     *
+     * @access protected
+     * @see DB_common::getListOf()
+     */
+    function getSpecialQuery($type)
+    {
+        switch ($type) {
+            case 'tables':
+                return 'SELECT table_name FROM user_tables';
+            case 'synonyms':
+                return 'SELECT synonym_name FROM user_synonyms';
+            default:
+                return null;
+        }
+    }
+
+    // }}}
+
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/DB.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/DB.php	(revision 2475)
+++ /temp/tags/eccube-0_9_2beta/data/module/DB.php	(revision 2475)
@@ -0,0 +1,1392 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Database independent query interface
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/DB
+ */
+
+/**
+ * Obtain the PEAR class so it can be extended from
+ */
+require_once 'PEAR.php';
+
+if(!defined('DB_PHP_DIR')) {
+	$DB_PHP_DIR = realpath(dirname( __FILE__));
+	define("DB_PHP_DIR", $DB_PHP_DIR);	
+}
+
+// {{{ constants
+// {{{ error codes
+
+/**#@+
+ * One of PEAR DB's portable error codes.
+ * @see DB_common::errorCode(), DB::errorMessage()
+ *
+ * {@internal If you add an error code here, make sure you also add a textual
+ * version of it in DB::errorMessage().}}
+ */
+
+/**
+ * The code returned by many methods upon success
+ */
+define('DB_OK', 1);
+
+/**
+ * Unkown error
+ */
+define('DB_ERROR', -1);
+
+/**
+ * Syntax error
+ */
+define('DB_ERROR_SYNTAX', -2);
+
+/**
+ * Tried to insert a duplicate value into a primary or unique index
+ */
+define('DB_ERROR_CONSTRAINT', -3);
+
+/**
+ * An identifier in the query refers to a non-existant object
+ */
+define('DB_ERROR_NOT_FOUND', -4);
+
+/**
+ * Tried to create a duplicate object
+ */
+define('DB_ERROR_ALREADY_EXISTS', -5);
+
+/**
+ * The current driver does not support the action you attempted
+ */
+define('DB_ERROR_UNSUPPORTED', -6);
+
+/**
+ * The number of parameters does not match the number of placeholders
+ */
+define('DB_ERROR_MISMATCH', -7);
+
+/**
+ * A literal submitted did not match the data type expected
+ */
+define('DB_ERROR_INVALID', -8);
+
+/**
+ * The current DBMS does not support the action you attempted
+ */
+define('DB_ERROR_NOT_CAPABLE', -9);
+
+/**
+ * A literal submitted was too long so the end of it was removed
+ */
+define('DB_ERROR_TRUNCATED', -10);
+
+/**
+ * A literal number submitted did not match the data type expected
+ */
+define('DB_ERROR_INVALID_NUMBER', -11);
+
+/**
+ * A literal date submitted did not match the data type expected
+ */
+define('DB_ERROR_INVALID_DATE', -12);
+
+/**
+ * Attempt to divide something by zero
+ */
+define('DB_ERROR_DIVZERO', -13);
+
+/**
+ * A database needs to be selected
+ */
+define('DB_ERROR_NODBSELECTED', -14);
+
+/**
+ * Could not create the object requested
+ */
+define('DB_ERROR_CANNOT_CREATE', -15);
+
+/**
+ * Could not drop the database requested because it does not exist
+ */
+define('DB_ERROR_CANNOT_DROP', -17);
+
+/**
+ * An identifier in the query refers to a non-existant table
+ */
+define('DB_ERROR_NOSUCHTABLE', -18);
+
+/**
+ * An identifier in the query refers to a non-existant column
+ */
+define('DB_ERROR_NOSUCHFIELD', -19);
+
+/**
+ * The data submitted to the method was inappropriate
+ */
+define('DB_ERROR_NEED_MORE_DATA', -20);
+
+/**
+ * The attempt to lock the table failed
+ */
+define('DB_ERROR_NOT_LOCKED', -21);
+
+/**
+ * The number of columns doesn't match the number of values
+ */
+define('DB_ERROR_VALUE_COUNT_ON_ROW', -22);
+
+/**
+ * The DSN submitted has problems
+ */
+define('DB_ERROR_INVALID_DSN', -23);
+
+/**
+ * Could not connect to the database
+ */
+define('DB_ERROR_CONNECT_FAILED', -24);
+
+/**
+ * The PHP extension needed for this DBMS could not be found
+ */
+define('DB_ERROR_EXTENSION_NOT_FOUND',-25);
+
+/**
+ * The present user has inadequate permissions to perform the task requestd
+ */
+define('DB_ERROR_ACCESS_VIOLATION', -26);
+
+/**
+ * The database requested does not exist
+ */
+define('DB_ERROR_NOSUCHDB', -27);
+
+/**
+ * Tried to insert a null value into a column that doesn't allow nulls
+ */
+define('DB_ERROR_CONSTRAINT_NOT_NULL',-29);
+/**#@-*/
+
+
+// }}}
+// {{{ prepared statement-related
+
+
+/**#@+
+ * Identifiers for the placeholders used in prepared statements.
+ * @see DB_common::prepare()
+ */
+
+/**
+ * Indicates a scalar (<kbd>?</kbd>) placeholder was used
+ *
+ * Quote and escape the value as necessary.
+ */
+define('DB_PARAM_SCALAR', 1);
+
+/**
+ * Indicates an opaque (<kbd>&</kbd>) placeholder was used
+ *
+ * The value presented is a file name.  Extract the contents of that file
+ * and place them in this column.
+ */
+define('DB_PARAM_OPAQUE', 2);
+
+/**
+ * Indicates a misc (<kbd>!</kbd>) placeholder was used
+ *
+ * The value should not be quoted or escaped.
+ */
+define('DB_PARAM_MISC',   3);
+/**#@-*/
+
+
+// }}}
+// {{{ binary data-related
+
+
+/**#@+
+ * The different ways of returning binary data from queries.
+ */
+
+/**
+ * Sends the fetched data straight through to output
+ */
+define('DB_BINMODE_PASSTHRU', 1);
+
+/**
+ * Lets you return data as usual
+ */
+define('DB_BINMODE_RETURN', 2);
+
+/**
+ * Converts the data to hex format before returning it
+ *
+ * For example the string "123" would become "313233".
+ */
+define('DB_BINMODE_CONVERT', 3);
+/**#@-*/
+
+
+// }}}
+// {{{ fetch modes
+
+
+/**#@+
+ * Fetch Modes.
+ * @see DB_common::setFetchMode()
+ */
+
+/**
+ * Indicates the current default fetch mode should be used
+ * @see DB_common::$fetchmode
+ */
+define('DB_FETCHMODE_DEFAULT', 0);
+
+/**
+ * Column data indexed by numbers, ordered from 0 and up
+ */
+define('DB_FETCHMODE_ORDERED', 1);
+
+/**
+ * Column data indexed by column names
+ */
+define('DB_FETCHMODE_ASSOC', 2);
+
+/**
+ * Column data as object properties
+ */
+define('DB_FETCHMODE_OBJECT', 3);
+
+/**
+ * For multi-dimensional results, make the column name the first level
+ * of the array and put the row number in the second level of the array
+ *
+ * This is flipped from the normal behavior, which puts the row numbers
+ * in the first level of the array and the column names in the second level.
+ */
+define('DB_FETCHMODE_FLIPPED', 4);
+/**#@-*/
+
+/**#@+
+ * Old fetch modes.  Left here for compatibility.
+ */
+define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
+define('DB_GETMODE_ASSOC',   DB_FETCHMODE_ASSOC);
+define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED);
+/**#@-*/
+
+
+// }}}
+// {{{ tableInfo() && autoPrepare()-related
+
+
+/**#@+
+ * The type of information to return from the tableInfo() method.
+ *
+ * Bitwised constants, so they can be combined using <kbd>|</kbd>
+ * and removed using <kbd>^</kbd>.
+ *
+ * @see DB_common::tableInfo()
+ *
+ * {@internal Since the TABLEINFO constants are bitwised, if more of them are
+ * added in the future, make sure to adjust DB_TABLEINFO_FULL accordingly.}}
+ */
+define('DB_TABLEINFO_ORDER', 1);
+define('DB_TABLEINFO_ORDERTABLE', 2);
+define('DB_TABLEINFO_FULL', 3);
+/**#@-*/
+
+
+/**#@+
+ * The type of query to create with the automatic query building methods.
+ * @see DB_common::autoPrepare(), DB_common::autoExecute()
+ */
+define('DB_AUTOQUERY_INSERT', 1);
+define('DB_AUTOQUERY_UPDATE', 2);
+/**#@-*/
+
+
+// }}}
+// {{{ portability modes
+
+
+/**#@+
+ * Portability Modes.
+ *
+ * Bitwised constants, so they can be combined using <kbd>|</kbd>
+ * and removed using <kbd>^</kbd>.
+ *
+ * @see DB_common::setOption()
+ *
+ * {@internal Since the PORTABILITY constants are bitwised, if more of them are
+ * added in the future, make sure to adjust DB_PORTABILITY_ALL accordingly.}}
+ */
+
+/**
+ * Turn off all portability features
+ */
+define('DB_PORTABILITY_NONE', 0);
+
+/**
+ * Convert names of tables and fields to lower case
+ * when using the get*(), fetch*() and tableInfo() methods
+ */
+define('DB_PORTABILITY_LOWERCASE', 1);
+
+/**
+ * Right trim the data output by get*() and fetch*()
+ */
+define('DB_PORTABILITY_RTRIM', 2);
+
+/**
+ * Force reporting the number of rows deleted
+ */
+define('DB_PORTABILITY_DELETE_COUNT', 4);
+
+/**
+ * Enable hack that makes numRows() work in Oracle
+ */
+define('DB_PORTABILITY_NUMROWS', 8);
+
+/**
+ * Makes certain error messages in certain drivers compatible
+ * with those from other DBMS's
+ *
+ * + mysql, mysqli:  change unique/primary key constraints
+ *   DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
+ *
+ * + odbc(access):  MS's ODBC driver reports 'no such field' as code
+ *   07001, which means 'too few parameters.'  When this option is on
+ *   that code gets mapped to DB_ERROR_NOSUCHFIELD.
+ */
+define('DB_PORTABILITY_ERRORS', 16);
+
+/**
+ * Convert null values to empty strings in data output by
+ * get*() and fetch*()
+ */
+define('DB_PORTABILITY_NULL_TO_EMPTY', 32);
+
+/**
+ * Turn on all portability features
+ */
+define('DB_PORTABILITY_ALL', 63);
+/**#@-*/
+
+// }}}
+
+
+// }}}
+// {{{ class DB
+
+/**
+ * Database independent query interface
+ *
+ * The main "DB" class is simply a container class with some static
+ * methods for creating DB objects as well as some utility functions
+ * common to all parts of DB.
+ *
+ * The object model of DB is as follows (indentation means inheritance):
+ * <pre>
+ * DB           The main DB class.  This is simply a utility class
+ *              with some "static" methods for creating DB objects as
+ *              well as common utility functions for other DB classes.
+ *
+ * DB_common    The base for each DB implementation.  Provides default
+ * |            implementations (in OO lingo virtual methods) for
+ * |            the actual DB implementations as well as a bunch of
+ * |            query utility functions.
+ * |
+ * +-DB_mysql   The DB implementation for MySQL.  Inherits DB_common.
+ *              When calling DB::factory or DB::connect for MySQL
+ *              connections, the object returned is an instance of this
+ *              class.
+ * </pre>
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Daniel Convissor <danielc@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB
+{
+    // {{{ &factory()
+
+    /**
+     * Create a new DB object for the specified database type but don't
+     * connect to the database
+     *
+     * @param string $type     the database type (eg "mysql")
+     * @param array  $options  an associative array of option names and values
+     *
+     * @return object  a new DB object.  A DB_Error object on failure.
+     *
+     * @see DB_common::setOption()
+     */
+    function &factory($type, $options = false)
+    {
+        if (!is_array($options)) {
+            $options = array('persistent' => $options);
+        }
+
+        if (isset($options['debug']) && $options['debug'] >= 2) {
+            // expose php errors with sufficient debug level
+            include_once DB_PHP_DIR . "/DB/{$type}.php";
+        } else {
+            @include_once DB_PHP_DIR . "/DB/{$type}.php";
+        }
+
+        $classname = "DB_${type}";
+
+        if (!class_exists($classname)) {
+            $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
+                                    "Unable to include the DB/{$type}.php"
+                                    . " file for '$dsn'",
+                                    'DB_Error', true);
+            return $tmp;
+        }
+
+        @$obj =& new $classname;
+
+        foreach ($options as $option => $value) {
+            $test = $obj->setOption($option, $value);
+            if (DB::isError($test)) {
+                return $test;
+            }
+        }
+
+        return $obj;
+    }
+
+    // }}}
+    // {{{ &connect()
+
+    /**
+     * Create a new DB object including a connection to the specified database
+     *
+     * Example 1.
+     * <code>
+     * require_once 'DB.php';
+     *
+     * $dsn = 'pgsql://user:password@host/database';
+     * $options = array(
+     *     'debug'       => 2,
+     *     'portability' => DB_PORTABILITY_ALL,
+     * );
+     *
+     * $db =& DB::connect($dsn, $options);
+     * if (PEAR::isError($db)) {
+     *     die($db->getMessage());
+     * }
+     * </code>
+     *
+     * @param mixed $dsn      the string "data source name" or array in the
+     *                         format returned by DB::parseDSN()
+     * @param array $options  an associative array of option names and values
+     *
+     * @return object  a new DB object.  A DB_Error object on failure.
+     *
+     * @uses DB_dbase::connect(), DB_fbsql::connect(), DB_ibase::connect(),
+     *       DB_ifx::connect(), DB_msql::connect(), DB_mssql::connect(),
+     *       DB_mysql::connect(), DB_mysqli::connect(), DB_oci8::connect(),
+     *       DB_odbc::connect(), DB_pgsql::connect(), DB_sqlite::connect(),
+     *       DB_sybase::connect()
+     *
+     * @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError()
+     */
+    function &connect($dsn, $options = array())
+    {
+        $dsninfo = DB::parseDSN($dsn);
+        $type = $dsninfo['phptype'];
+
+        if (!is_array($options)) {
+            /*
+             * For backwards compatibility.  $options used to be boolean,
+             * indicating whether the connection should be persistent.
+             */
+            $options = array('persistent' => $options);
+        }
+
+        if (isset($options['debug']) && $options['debug'] >= 2) {
+            // expose php errors with sufficient debug level
+            include_once DB_PHP_DIR . "/DB/${type}.php";
+        } else {
+            @include_once DB_PHP_DIR . "/DB/${type}.php";
+        }
+
+        $classname = "DB_${type}";
+        if (!class_exists($classname)) {
+            $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
+                                    "Unable to include the DB/{$type}.php"
+                                    . " file for '$dsn'",
+                                    'DB_Error', true);
+            return $tmp;
+        }
+
+        @$obj =& new $classname;
+
+        foreach ($options as $option => $value) {
+            $test = $obj->setOption($option, $value);
+            if (DB::isError($test)) {
+                return $test;
+            }
+        }
+
+        $err = $obj->connect($dsninfo, $obj->getOption('persistent'));
+        if (DB::isError($err)) {
+            $err->addUserInfo($dsn);
+            return $err;
+        }
+
+        return $obj;
+    }
+
+    // }}}
+    // {{{ apiVersion()
+
+    /**
+     * Return the DB API version
+     *
+     * @return string  the DB API version number
+     */
+    function apiVersion()
+    {
+        return '@package_version@';
+    }
+
+    // }}}
+    // {{{ isError()
+
+    /**
+     * Determines if a variable is a DB_Error object
+     *
+     * @param mixed $value  the variable to check
+     *
+     * @return bool  whether $value is DB_Error object
+     */
+    function isError($value)
+    {
+        return is_a($value, 'DB_Error');
+    }
+
+    // }}}
+    // {{{ isConnection()
+
+    /**
+     * Determines if a value is a DB_<driver> object
+     *
+     * @param mixed $value  the value to test
+     *
+     * @return bool  whether $value is a DB_<driver> object
+     */
+    function isConnection($value)
+    {
+        return (is_object($value) &&
+                is_subclass_of($value, 'db_common') &&
+                method_exists($value, 'simpleQuery'));
+    }
+
+    // }}}
+    // {{{ isManip()
+
+    /**
+     * Tell whether a query is a data manipulation or data definition query
+     *
+     * Examples of data manipulation queries are INSERT, UPDATE and DELETE.
+     * Examples of data definition queries are CREATE, DROP, ALTER, GRANT,
+     * REVOKE.
+     *
+     * @param string $query  the query
+     *
+     * @return boolean  whether $query is a data manipulation query
+     */
+    function isManip($query)
+    {
+        $manips = 'INSERT|UPDATE|DELETE|REPLACE|'
+                . 'CREATE|DROP|'
+                . 'LOAD DATA|SELECT .* INTO|COPY|'
+                . 'ALTER|GRANT|REVOKE|'
+                . 'LOCK|UNLOCK';
+        if (preg_match('/^\s*"?(' . $manips . ')\s+/i', $query)) {
+            return true;
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ errorMessage()
+
+    /**
+     * Return a textual error message for a DB error code
+     *
+     * @param integer $value  the DB error code
+     *
+     * @return string  the error message or false if the error code was
+     *                  not recognized
+     */
+    function errorMessage($value)
+    {
+        static $errorMessages;
+        if (!isset($errorMessages)) {
+            $errorMessages = array(
+                DB_ERROR                    => 'unknown error',
+                DB_ERROR_ACCESS_VIOLATION   => 'insufficient permissions',
+                DB_ERROR_ALREADY_EXISTS     => 'already exists',
+                DB_ERROR_CANNOT_CREATE      => 'can not create',
+                DB_ERROR_CANNOT_DROP        => 'can not drop',
+                DB_ERROR_CONNECT_FAILED     => 'connect failed',
+                DB_ERROR_CONSTRAINT         => 'constraint violation',
+                DB_ERROR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint',
+                DB_ERROR_DIVZERO            => 'division by zero',
+                DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found',
+                DB_ERROR_INVALID            => 'invalid',
+                DB_ERROR_INVALID_DATE       => 'invalid date or time',
+                DB_ERROR_INVALID_DSN        => 'invalid DSN',
+                DB_ERROR_INVALID_NUMBER     => 'invalid number',
+                DB_ERROR_MISMATCH           => 'mismatch',
+                DB_ERROR_NEED_MORE_DATA     => 'insufficient data supplied',
+                DB_ERROR_NODBSELECTED       => 'no database selected',
+                DB_ERROR_NOSUCHDB           => 'no such database',
+                DB_ERROR_NOSUCHFIELD        => 'no such field',
+                DB_ERROR_NOSUCHTABLE        => 'no such table',
+                DB_ERROR_NOT_CAPABLE        => 'DB backend not capable',
+                DB_ERROR_NOT_FOUND          => 'not found',
+                DB_ERROR_NOT_LOCKED         => 'not locked',
+                DB_ERROR_SYNTAX             => 'syntax error',
+                DB_ERROR_UNSUPPORTED        => 'not supported',
+                DB_ERROR_TRUNCATED          => 'truncated',
+                DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
+                DB_OK                       => 'no error',
+            );
+        }
+
+        if (DB::isError($value)) {
+            $value = $value->getCode();
+        }
+
+        return isset($errorMessages[$value]) ? $errorMessages[$value]
+                     : $errorMessages[DB_ERROR];
+    }
+
+    // }}}
+    // {{{ parseDSN()
+
+    /**
+     * Parse a data source name
+     *
+     * Additional keys can be added by appending a URI query string to the
+     * end of the DSN.
+     *
+     * The format of the supplied DSN is in its fullest form:
+     * <code>
+     *  phptype(dbsyntax)://username:password@protocol+hostspec/database?option=8&another=true
+     * </code>
+     *
+     * Most variations are allowed:
+     * <code>
+     *  phptype://username:password@protocol+hostspec:110//usr/db_file.db?mode=0644
+     *  phptype://username:password@hostspec/database_name
+     *  phptype://username:password@hostspec
+     *  phptype://username@hostspec
+     *  phptype://hostspec/database
+     *  phptype://hostspec
+     *  phptype(dbsyntax)
+     *  phptype
+     * </code>
+     *
+     * @param string $dsn Data Source Name to be parsed
+     *
+     * @return array an associative array with the following keys:
+     *  + phptype:  Database backend used in PHP (mysql, odbc etc.)
+     *  + dbsyntax: Database used with regards to SQL syntax etc.
+     *  + protocol: Communication protocol to use (tcp, unix etc.)
+     *  + hostspec: Host specification (hostname[:port])
+     *  + database: Database to use on the DBMS server
+     *  + username: User name for login
+     *  + password: Password for login
+     */
+    function parseDSN($dsn)
+    {
+        $parsed = array(
+            'phptype'  => false,
+            'dbsyntax' => false,
+            'username' => false,
+            'password' => false,
+            'protocol' => false,
+            'hostspec' => false,
+            'port'     => false,
+            'socket'   => false,
+            'database' => false,
+        );
+
+        if (is_array($dsn)) {
+            $dsn = array_merge($parsed, $dsn);
+            if (!$dsn['dbsyntax']) {
+                $dsn['dbsyntax'] = $dsn['phptype'];
+            }
+            return $dsn;
+        }
+
+        // Find phptype and dbsyntax
+        if (($pos = strpos($dsn, '://')) !== false) {
+            $str = substr($dsn, 0, $pos);
+            $dsn = substr($dsn, $pos + 3);
+        } else {
+            $str = $dsn;
+            $dsn = null;
+        }
+
+        // Get phptype and dbsyntax
+        // $str => phptype(dbsyntax)
+        if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
+            $parsed['phptype']  = $arr[1];
+            $parsed['dbsyntax'] = !$arr[2] ? $arr[1] : $arr[2];
+        } else {
+            $parsed['phptype']  = $str;
+            $parsed['dbsyntax'] = $str;
+        }
+
+        if (!count($dsn)) {
+            return $parsed;
+        }
+
+        // Get (if found): username and password
+        // $dsn => username:password@protocol+hostspec/database
+        if (($at = strrpos($dsn,'@')) !== false) {
+            $str = substr($dsn, 0, $at);
+            $dsn = substr($dsn, $at + 1);
+            if (($pos = strpos($str, ':')) !== false) {
+                $parsed['username'] = rawurldecode(substr($str, 0, $pos));
+                $parsed['password'] = rawurldecode(substr($str, $pos + 1));
+            } else {
+                $parsed['username'] = rawurldecode($str);
+            }
+        }
+
+        // Find protocol and hostspec
+
+        if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
+            // $dsn => proto(proto_opts)/database
+            $proto       = $match[1];
+            $proto_opts  = $match[2] ? $match[2] : false;
+            $dsn         = $match[3];
+
+        } else {
+            // $dsn => protocol+hostspec/database (old format)
+            if (strpos($dsn, '+') !== false) {
+                list($proto, $dsn) = explode('+', $dsn, 2);
+            }
+            if (strpos($dsn, '/') !== false) {
+                list($proto_opts, $dsn) = explode('/', $dsn, 2);
+            } else {
+                $proto_opts = $dsn;
+                $dsn = null;
+            }
+        }
+
+        // process the different protocol options
+        $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
+        $proto_opts = rawurldecode($proto_opts);
+        if ($parsed['protocol'] == 'tcp') {
+            if (strpos($proto_opts, ':') !== false) {
+                list($parsed['hostspec'],
+                     $parsed['port']) = explode(':', $proto_opts);
+            } else {
+                $parsed['hostspec'] = $proto_opts;
+            }
+        } elseif ($parsed['protocol'] == 'unix') {
+            $parsed['socket'] = $proto_opts;
+        }
+
+        // Get dabase if any
+        // $dsn => database
+        if ($dsn) {
+            if (($pos = strpos($dsn, '?')) === false) {
+                // /database
+                $parsed['database'] = rawurldecode($dsn);
+            } else {
+                // /database?param1=value1&param2=value2
+                $parsed['database'] = rawurldecode(substr($dsn, 0, $pos));
+                $dsn = substr($dsn, $pos + 1);
+                if (strpos($dsn, '&') !== false) {
+                    $opts = explode('&', $dsn);
+                } else { // database?param1=value1
+                    $opts = array($dsn);
+                }
+                foreach ($opts as $opt) {
+                    list($key, $value) = explode('=', $opt);
+                    if (!isset($parsed[$key])) {
+                        // don't allow params overwrite
+                        $parsed[$key] = rawurldecode($value);
+                    }
+                }
+            }
+        }
+
+        return $parsed;
+    }
+
+    // }}}
+}
+
+// }}}
+// {{{ class DB_Error
+
+/**
+ * DB_Error implements a class for reporting portable database error
+ * messages
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_Error extends PEAR_Error
+{
+    // {{{ constructor
+
+    /**
+     * DB_Error constructor
+     *
+     * @param mixed $code       DB error code, or string with error message
+     * @param int   $mode       what "error mode" to operate in
+     * @param int   $level      what error level to use for $mode &
+     *                           PEAR_ERROR_TRIGGER
+     * @param mixed $debuginfo  additional debug info, such as the last query
+     *
+     * @see PEAR_Error
+     */
+    function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
+                      $level = E_USER_NOTICE, $debuginfo = null)
+    {
+        if (is_int($code)) {
+            $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code,
+                              $mode, $level, $debuginfo);
+        } else {
+            $this->PEAR_Error("DB Error: $code", DB_ERROR,
+                              $mode, $level, $debuginfo);
+        }
+    }
+
+    // }}}
+}
+
+// }}}
+// {{{ class DB_result
+
+/**
+ * This class implements a wrapper for a DB result set
+ *
+ * A new instance of this class will be returned by the DB implementation
+ * after processing a query that returns data.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ */
+class DB_result
+{
+    // {{{ properties
+
+    /**
+     * Should results be freed automatically when there are no more rows?
+     * @var boolean
+     * @see DB_common::$options
+     */
+    var $autofree;
+
+    /**
+     * A reference to the DB_<driver> object
+     * @var object
+     */
+    var $dbh;
+
+    /**
+     * The current default fetch mode
+     * @var integer
+     * @see DB_common::$fetchmode
+     */
+    var $fetchmode;
+
+    /**
+     * The name of the class into which results should be fetched when
+     * DB_FETCHMODE_OBJECT is in effect
+     *
+     * @var string
+     * @see DB_common::$fetchmode_object_class
+     */
+    var $fetchmode_object_class;
+
+    /**
+     * The number of rows to fetch from a limit query
+     * @var integer
+     */
+    var $limit_count = null;
+
+    /**
+     * The row to start fetching from in limit queries
+     * @var integer
+     */
+    var $limit_from = null;
+
+    /**
+     * The execute parameters that created this result
+     * @var array
+     * @since Property available since Release 1.7.0
+     */
+    var $parameters;
+
+    /**
+     * The query string that created this result
+     *
+     * Copied here incase it changes in $dbh, which is referenced
+     *
+     * @var string
+     * @since Property available since Release 1.7.0
+     */
+    var $query;
+
+    /**
+     * The query result resource id created by PHP
+     * @var resource
+     */
+    var $result;
+
+    /**
+     * The present row being dealt with
+     * @var integer
+     */
+    var $row_counter = null;
+
+    /**
+     * The prepared statement resource id created by PHP in $dbh
+     *
+     * This resource is only available when the result set was created using
+     * a driver's native execute() method, not PEAR DB's emulated one.
+     *
+     * Copied here incase it changes in $dbh, which is referenced
+     *
+     * {@internal  Mainly here because the InterBase/Firebird API is only
+     * able to retrieve data from result sets if the statemnt handle is
+     * still in scope.}}
+     *
+     * @var resource
+     * @since Property available since Release 1.7.0
+     */
+    var $statement;
+
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * This constructor sets the object's properties
+     *
+     * @param object   &$dbh     the DB object reference
+     * @param resource $result   the result resource id
+     * @param array    $options  an associative array with result options
+     *
+     * @return void
+     */
+    function DB_result(&$dbh, $result, $options = array())
+    {
+        $this->autofree    = $dbh->options['autofree'];
+        $this->dbh         = &$dbh;
+        $this->fetchmode   = $dbh->fetchmode;
+        $this->fetchmode_object_class = $dbh->fetchmode_object_class;
+        $this->parameters  = $dbh->last_parameters;
+        $this->query       = $dbh->last_query;
+        $this->result      = $result;
+        $this->statement   = empty($dbh->last_stmt) ? null : $dbh->last_stmt;
+        foreach ($options as $key => $value) {
+            $this->setOption($key, $value);
+        }
+    }
+
+    /**
+     * Set options for the DB_result object
+     *
+     * @param string $key    the option to set
+     * @param mixed  $value  the value to set the option to
+     *
+     * @return void
+     */
+    function setOption($key, $value = null)
+    {
+        switch ($key) {
+            case 'limit_from':
+                $this->limit_from = $value;
+                break;
+            case 'limit_count':
+                $this->limit_count = $value;
+        }
+    }
+
+    // }}}
+    // {{{ fetchRow()
+
+    /**
+     * Fetch a row of data and return it by reference into an array
+     *
+     * The type of array returned can be controlled either by setting this
+     * method's <var>$fetchmode</var> parameter or by changing the default
+     * fetch mode setFetchMode() before calling this method.
+     *
+     * There are two options for standardizing the information returned
+     * from databases, ensuring their values are consistent when changing
+     * DBMS's.  These portability options can be turned on when creating a
+     * new DB object or by using setOption().
+     *
+     *   + <var>DB_PORTABILITY_LOWERCASE</var>
+     *     convert names of fields to lower case
+     *
+     *   + <var>DB_PORTABILITY_RTRIM</var>
+     *     right trim the data
+     *
+     * @param int $fetchmode  the constant indicating how to format the data
+     * @param int $rownum     the row number to fetch (index starts at 0)
+     *
+     * @return mixed  an array or object containing the row's data,
+     *                 NULL when the end of the result set is reached
+     *                 or a DB_Error object on failure.
+     *
+     * @see DB_common::setOption(), DB_common::setFetchMode()
+     */
+    function &fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null)
+    {
+        if ($fetchmode === DB_FETCHMODE_DEFAULT) {
+            $fetchmode = $this->fetchmode;
+        }
+        if ($fetchmode === DB_FETCHMODE_OBJECT) {
+            $fetchmode = DB_FETCHMODE_ASSOC;
+            $object_class = $this->fetchmode_object_class;
+        }
+        if ($this->limit_from !== null) {
+            if ($this->row_counter === null) {
+                $this->row_counter = $this->limit_from;
+                // Skip rows
+                if ($this->dbh->features['limit'] === false) {
+                    $i = 0;
+                    while ($i++ < $this->limit_from) {
+                        $this->dbh->fetchInto($this->result, $arr, $fetchmode);
+                    }
+                }
+            }
+            if ($this->row_counter >= ($this->limit_from + $this->limit_count))
+            {
+                if ($this->autofree) {
+                    $this->free();
+                }
+                $tmp = null;
+                return $tmp;
+            }
+            if ($this->dbh->features['limit'] === 'emulate') {
+                $rownum = $this->row_counter;
+            }
+            $this->row_counter++;
+        }
+        $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
+        if ($res === DB_OK) {
+            if (isset($object_class)) {
+                // The default mode is specified in the
+                // DB_common::fetchmode_object_class property
+                if ($object_class == 'stdClass') {
+                    $arr = (object) $arr;
+                } else {
+                    $arr = &new $object_class($arr);
+                }
+            }
+            return $arr;
+        }
+        if ($res == null && $this->autofree) {
+            $this->free();
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ fetchInto()
+
+    /**
+     * Fetch a row of data into an array which is passed by reference
+     *
+     * The type of array returned can be controlled either by setting this
+     * method's <var>$fetchmode</var> parameter or by changing the default
+     * fetch mode setFetchMode() before calling this method.
+     *
+     * There are two options for standardizing the information returned
+     * from databases, ensuring their values are consistent when changing
+     * DBMS's.  These portability options can be turned on when creating a
+     * new DB object or by using setOption().
+     *
+     *   + <var>DB_PORTABILITY_LOWERCASE</var>
+     *     convert names of fields to lower case
+     *
+     *   + <var>DB_PORTABILITY_RTRIM</var>
+     *     right trim the data
+     *
+     * @param array &$arr       the variable where the data should be placed
+     * @param int   $fetchmode  the constant indicating how to format the data
+     * @param int   $rownum     the row number to fetch (index starts at 0)
+     *
+     * @return mixed  DB_OK if a row is processed, NULL when the end of the
+     *                 result set is reached or a DB_Error object on failure
+     *
+     * @see DB_common::setOption(), DB_common::setFetchMode()
+     */
+    function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null)
+    {
+        if ($fetchmode === DB_FETCHMODE_DEFAULT) {
+            $fetchmode = $this->fetchmode;
+        }
+        if ($fetchmode === DB_FETCHMODE_OBJECT) {
+            $fetchmode = DB_FETCHMODE_ASSOC;
+            $object_class = $this->fetchmode_object_class;
+        }
+        if ($this->limit_from !== null) {
+            if ($this->row_counter === null) {
+                $this->row_counter = $this->limit_from;
+                // Skip rows
+                if ($this->dbh->features['limit'] === false) {
+                    $i = 0;
+                    while ($i++ < $this->limit_from) {
+                        $this->dbh->fetchInto($this->result, $arr, $fetchmode);
+                    }
+                }
+            }
+            if ($this->row_counter >= (
+                    $this->limit_from + $this->limit_count))
+            {
+                if ($this->autofree) {
+                    $this->free();
+                }
+                return null;
+            }
+            if ($this->dbh->features['limit'] === 'emulate') {
+                $rownum = $this->row_counter;
+            }
+
+            $this->row_counter++;
+        }
+        $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
+        if ($res === DB_OK) {
+            if (isset($object_class)) {
+                // default mode specified in the
+                // DB_common::fetchmode_object_class property
+                if ($object_class == 'stdClass') {
+                    $arr = (object) $arr;
+                } else {
+                    $arr = new $object_class($arr);
+                }
+            }
+            return DB_OK;
+        }
+        if ($res == null && $this->autofree) {
+            $this->free();
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ numCols()
+
+    /**
+     * Get the the number of columns in a result set
+     *
+     * @return int  the number of columns.  A DB_Error object on failure.
+     */
+    function numCols()
+    {
+        return $this->dbh->numCols($this->result);
+    }
+
+    // }}}
+    // {{{ numRows()
+
+    /**
+     * Get the number of rows in a result set
+     *
+     * @return int  the number of rows.  A DB_Error object on failure.
+     */
+    function numRows()
+    {
+        if ($this->dbh->features['numrows'] === 'emulate'
+            && $this->dbh->options['portability'] & DB_PORTABILITY_NUMROWS)
+        {
+            if ($this->dbh->features['prepare']) {
+                $res = $this->dbh->query($this->query, $this->parameters);
+            } else {
+                $res = $this->dbh->query($this->query);
+            }
+            if (DB::isError($res)) {
+                return $res;
+            }
+            $i = 0;
+            while ($res->fetchInto($tmp, DB_FETCHMODE_ORDERED)) {
+                $i++;
+            }
+            return $i;
+        } else {
+            return $this->dbh->numRows($this->result);
+        }
+    }
+
+    // }}}
+    // {{{ nextResult()
+
+    /**
+     * Get the next result if a batch of queries was executed
+     *
+     * @return bool  true if a new result is available or false if not
+     */
+    function nextResult()
+    {
+        return $this->dbh->nextResult($this->result);
+    }
+
+    // }}}
+    // {{{ free()
+
+    /**
+     * Frees the resources allocated for this result set
+     *
+     * @return bool  true on success.  A DB_Error object on failure.
+     */
+    function free()
+    {
+        $err = $this->dbh->freeResult($this->result);
+        if (DB::isError($err)) {
+            return $err;
+        }
+        $this->result = false;
+        $this->statement = false;
+        return true;
+    }
+
+    // }}}
+    // {{{ tableInfo()
+
+    /**
+     * @see DB_common::tableInfo()
+     * @deprecated Method deprecated some time before Release 1.2
+     */
+    function tableInfo($mode = null)
+    {
+        if (is_string($mode)) {
+            return $this->dbh->raiseError(DB_ERROR_NEED_MORE_DATA);
+        }
+        return $this->dbh->tableInfo($this, $mode);
+    }
+
+    // }}}
+    // {{{ getQuery()
+
+    /**
+     * Determine the query string that created this result
+     *
+     * @return string  the query string
+     *
+     * @since Method available since Release 1.7.0
+     */
+    function getQuery()
+    {
+        return $this->query;
+    }
+
+    // }}}
+    // {{{ getRowCounter()
+
+    /**
+     * Tells which row number is currently being processed
+     *
+     * @return integer  the current row being looked at.  Starts at 1.
+     */
+    function getRowCounter()
+    {
+        return $this->row_counter;
+    }
+
+    // }}}
+}
+
+// }}}
+// {{{ class DB_row
+
+/**
+ * PEAR DB Row Object
+ *
+ * The object contains a row of data from a result set.  Each column's data
+ * is placed in a property named for the column.
+ *
+ * @category   Database
+ * @package    DB
+ * @author     Stig Bakken <ssb@php.net>
+ * @copyright  1997-2005 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/DB
+ * @see        DB_common::setFetchMode()
+ */
+class DB_row
+{
+    // {{{ constructor
+
+    /**
+     * The constructor places a row's data into properties of this object
+     *
+     * @param array  the array containing the row's data
+     *
+     * @return void
+     */
+    function DB_row(&$arr)
+    {
+        foreach ($arr as $key => $value) {
+            $this->$key = &$arr[$key];
+        }
+    }
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/smarty_unit_test_gui.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/smarty_unit_test_gui.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/smarty_unit_test_gui.php	(revision 1328)
@@ -0,0 +1,10 @@
+<?php
+
+require_once 'test_cases.php';
+require_once 'PHPUnit.php';
+
+$suite = new PHPUnit_TestSuite("SmartyTest");
+$result = PHPUnit::run($suite);
+
+echo $result -> toHTML();
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/config.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/config.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/config.php	(revision 1328)
@@ -0,0 +1,5 @@
+<?php
+
+define('SMARTY_DIR', '../libs/');
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/smarty_unit_test.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/smarty_unit_test.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/smarty_unit_test.php	(revision 1328)
@@ -0,0 +1,10 @@
+<?php
+
+require_once 'test_cases.php';
+require_once 'PHPUnit.php';
+
+$suite = new PHPUnit_TestSuite("SmartyTest");
+$result = PHPUnit::run($suite);
+
+echo $result -> toString();
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/test_cases.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/test_cases.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/unit_test/test_cases.php	(revision 1328)
@@ -0,0 +1,450 @@
+<?php
+
+require_once './config.php';
+require_once SMARTY_DIR . 'Smarty.class.php';
+require_once 'PHPUnit.php';
+
+class Obj {
+    var $val = 'val';
+    var $arr = array('one' => 'one', 'two' => 2);
+    var $ten = 10;
+
+    function meth($a="a", $b="b") {
+        return "$a:$b";
+    }
+
+    function six() {
+        return 6;
+    }
+}
+
+    
+class SmartyTest extends PHPUnit_TestCase {   
+    // contains the object handle of the string class
+    var $abc;
+    // contains the last triggered error's errorlevel
+    var $errorlevel;
+
+    // constructor of the test suite
+    function SmartyTest($name) {
+       $this->PHPUnit_TestCase($name);
+    }
+
+    // called before the test functions will be executed    
+    // this function is defined in PHPUnit_TestCase and overwritten 
+    // here
+    function setUp() {
+        // create a new instance of String with the
+        // string 'abc'
+        $this->smarty = new Smarty;
+    }
+    // called after the test functions are executed    
+    // this function is defined in PHPUnit_TestCase and overwritten 
+    // here    
+    function tearDown() {
+        // delete your instance
+        unset($this->smarty);
+    }
+    
+    // dummy errorhandler for functions that are supposed to call trigger_error()
+    function error_handler($errorlevel) {
+        if ($errorlevel) $this->errorlevel = $errorlevel;
+    }
+
+    /* DIRECTORY TESTS */
+    
+    // test that template_dir exists
+    function test_template_dir_exists() {
+        $this->assertTrue(file_exists($this->smarty->template_dir));                       
+    }
+    // test that template_dir is a directory
+    function test_template_dir_is_dir() {
+        $this->assertTrue(is_dir($this->smarty->template_dir));                       
+    }
+    // test that template_dir is readable
+    function test_template_dir_is_readable() {
+        $this->assertTrue(is_readable($this->smarty->template_dir));                       
+    }
+    // test that config_dir exists
+    function test_config_dir_exists() {
+        $this->assertTrue(file_exists($this->smarty->config_dir));                       
+    }
+    // test that config_dir is a directory
+    function test_config_dir_is_dir() {
+        $this->assertTrue(is_dir($this->smarty->config_dir));                       
+    }
+    // test that config_dir is readable
+    function test_config_dir_is_readable() {
+        $this->assertTrue(is_readable($this->smarty->config_dir));                       
+    }
+    // test that compile_dir exists
+    function test_compile_dir_exists() {
+        $this->assertTrue(file_exists($this->smarty->compile_dir));                       
+    }
+    // test that compile_dir is a directory
+    function test_compile_dir_is_dir() {
+        $this->assertTrue(is_dir($this->smarty->compile_dir));                       
+    }
+    // test that compile_dir is readable
+    function test_compile_dir_is_readable() {
+        $this->assertTrue(is_readable($this->smarty->compile_dir));                       
+    }
+    // test that compile_dir is writable
+    function test_compile_dir_is_writable() {
+        $this->assertTrue(is_writable($this->smarty->compile_dir));                       
+    }
+    // test that cache_dir exists
+    function test_cache_dir_exists() {
+        $this->assertTrue(file_exists($this->smarty->cache_dir));                       
+    }
+    // test that cache_dir is a directory
+    function test_cache_dir_is_dir() {
+        $this->assertTrue(is_dir($this->smarty->cache_dir));                       
+    }
+    // test that cache_dir is readable
+    function test_cache_dir_is_readable() {
+        $this->assertTrue(is_readable($this->smarty->cache_dir));                       
+    }
+    // test that cache_dir is writable
+    function test_cache_dir_is_writable() {
+        $this->assertTrue(is_writable($this->smarty->cache_dir));                       
+    }
+
+    /* METHOD EXISTS TESTS */
+    function test_assign_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'assign'));
+    }
+    function test_assign_by_ref_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'assign_by_ref'));
+    }
+    function test_append_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'append'));
+    }
+    function test_append_by_ref_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'append_by_ref'));
+    }
+    function test_clear_assign_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_assign'));
+    }
+    function test_register_function_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_function'));
+    }
+    function test_unregister_function_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_function'));
+    }
+    function test_register_object_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_object'));
+    }
+    function test_unregister_object_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_object'));
+    }
+    function test_register_block_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_block'));
+    }
+    function test_unregister_block_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_block'));
+    }
+    function test_register_compiler_function_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_compiler_function'));
+    }
+    function test_unregister_compiler_function_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_compiler_function'));
+    }
+    function test_register_modifier_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_modifier'));
+    }
+    function test_unregister_modifier_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_modifier'));
+    }
+    function test_register_resource_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_resource'));
+    }
+    function test_unregister_resource_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_resource'));
+    }
+    function test_register_prefilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_prefilter'));
+    }
+    function test_unregister_prefilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_prefilter'));
+    }
+    function test_register_postfilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_postfilter'));
+    }
+    function test_unregister_postfilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_postfilter'));
+    }
+    function test_register_outputfilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'register_outputfilter'));
+    }
+    function test_unregister_outputfilter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'unregister_outputfilter'));
+    }
+    function test_load_filter_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'load_filter'));
+    }
+    function test_clear_cache_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_cache'));
+    }
+    function test_clear_all_cache_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_all_cache'));
+    }
+    function test_is_cached_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'is_cached'));
+    }
+    function test_clear_all_assign_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_all_assign'));
+    }
+    function test_clear_compiled_tpl_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_compiled_tpl'));
+    }
+    function test_template_exists_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'template_exists'));
+    }
+    function test_get_template_vars_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'get_template_vars'));
+    }
+    function test_get_config_vars_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'get_config_vars'));
+    }
+    function test_trigger_error_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'trigger_error'));
+    }
+    function test_display_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'display'));
+    }
+    function test_fetch_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'fetch'));
+    }
+    function test_config_load_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'config_load'));
+    }
+    function test_get_registered_object_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'get_registered_object'));
+    }
+    function test_clear_config_method_exists() {
+        $this->assertTrue(method_exists($this->smarty, 'clear_config'));
+    }
+    function test_get_plugin_filepath() {
+        $this->assertTrue(method_exists($this->smarty, '_get_plugin_filepath'));
+    }
+
+    
+    function test_clear_compiled_tpl() {
+        $this->assertTrue($this->smarty->clear_compiled_tpl());
+    }
+    
+    /* DISPLAY TESTS */
+    
+    // test that display() executes properly
+    function test_call_to_display() {
+        ob_start();
+        $this->smarty->display('index.tpl');
+        $output = ob_get_contents();
+        ob_end_clean();
+        $this->assertEquals($output, 'TEST STRING');
+    }
+
+    /* FETCH TESTS */
+
+    // test that fetch() executes properly
+    function test_call_to_fetch() {
+        $this->assertEquals($this->smarty->fetch('index.tpl'), 'TEST STRING');
+    }
+    
+    /* ASSIGN TESTS */
+
+    // test assigning a simple template variable
+    function test_assign_var() {
+        $this->smarty->assign('foo', 'bar');
+        $this->assertEquals($this->smarty->fetch('assign_var.tpl'), 'bar');
+    }
+
+    /* PARSING TESTS */
+    
+    // test assigning and calling an object
+    function test_parse_obj_meth() {
+        $obj  = new Obj();
+        $this->smarty->assign('obj', $obj);
+        $this->smarty->assign('foo', 'foo');
+        $this->assertEquals('foo:2.5
+2.5:foo
+2.5:b
+val:foo
+foo:val
+foo:foo
+one:2
+foo:foo:b', $this->smarty->fetch('parse_obj_meth.tpl'));
+    }
+    
+    // test assigning and calling an object
+    function test_parse_math() {
+        $obj  = new Obj();
+        $this->smarty->assign('obj', $obj);
+        $this->smarty->assign('flt', 2.5);
+        $this->smarty->assign('items', array(1, 2));
+        $this->assertEquals('3
+3.5
+7
+11
+4
+4.5
+8
+12
+12.5
+25
+16
+20
+8.5
+7', $this->smarty->fetch('parse_math.tpl'));
+    }
+    
+    /* CONFIG FILE TESTS */
+
+    // test assigning a double quoted global variable
+    function test_config_load_globals_double_quotes() {
+        // load the global var
+        $this->smarty->config_load('globals_double_quotes.conf');
+        // test that it is assigned
+        $this->assertEquals($this->smarty->_config[0]['vars']['foo'], 'bar');
+    }
+
+    // test assigning a single quoted global variable
+    function test_config_load_globals_single_quotes() {
+        // load the global var
+        $this->smarty->config_load('globals_single_quotes.conf');
+        // test that it is assigned
+        $this->assertEquals($this->smarty->_config[0]['vars']['foo'], 'bar');
+    }
+
+    // test loading and running modifier.escape.php
+    function test_escape_modifier_get_plugins_filepath() {
+        $filepath = $this->smarty->_get_plugin_filepath('modifier', 'escape');
+        $this->assertTrue($filepath);
+    }
+
+    function test_escape_modifier_include_file() {
+        $filepath = $this->smarty->_get_plugin_filepath('modifier', 'escape');
+        $this->assertTrue(include($filepath));
+    }
+
+    function test_escape_modifier_function_exists() {
+        $this->assertTrue(function_exists('smarty_modifier_escape'));
+    }
+
+    function test_escape_modifier_escape_default() {
+        $string = smarty_modifier_escape("<html><body></body></html>");
+        $this->assertEquals('&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;',
+                            $string);
+    }
+
+    function test_escape_modifier_escape_html() {
+        $string = smarty_modifier_escape("<html><body></body></html>", 'html');
+        $this->assertEquals('&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;',
+                            $string);
+    }
+
+    function test_escape_modifier_escape_htmlall() {
+        $string = smarty_modifier_escape("<html><body></body></html>", 'htmlall');
+        $this->assertEquals('&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;',
+                            $string);
+    }
+
+    function test_escape_modifier_escape_url() {
+        $string = smarty_modifier_escape("http://test.com?foo=bar", 'url');
+        $this->assertEquals('http%3A%2F%2Ftest.com%3Ffoo%3Dbar', $string);
+    }
+
+    function test_escape_modifier_escape_quotes() {
+        $string = smarty_modifier_escape("'\\'\\''", 'quotes');
+        $this->assertEquals("\\'\\'\\'\\'", $string);
+    }
+
+    function test_escape_modifier_escape_hex() {
+        $string = smarty_modifier_escape("abcd", 'hex');
+        $this->assertEquals('%61%62%63%64', $string);
+    }
+
+    function test_escape_modifier_escape_hexentity() {
+        $string = smarty_modifier_escape("ABCD", 'hexentity');
+        $this->assertEquals('&#x41;&#x42;&#x43;&#x44;', $string);
+    }
+
+    function test_escape_modifier_escape_javascript() {
+        $string = smarty_modifier_escape("\r\n\\", 'javascript');
+        $this->assertEquals('\\r\\n\\\\', $string);
+    }
+
+
+    function test_core_is_secure_file_exists() {
+        $file = SMARTY_CORE_DIR . 'core.is_secure.php';
+        $this->assertTrue(file_exists($file));
+    }
+
+    function test_core_is_secure_file_include() {
+        $file = SMARTY_CORE_DIR . 'core.is_secure.php';
+        $this->assertTrue(include($file));
+    }
+
+    function test_core_is_secure_function_exists() {
+        $this->assertTrue(function_exists('smarty_core_is_secure'));
+    }
+
+    function test_core_is_secure_function_is_secure_true() {
+        $security = $this->smarty->security;
+        $this->smarty->security = true;
+
+        /* check if index.tpl is secure (should be true) */
+        $params = array('resource_type' => 'file',
+                        'resource_base_path' => dirname(__FILE__) . '/templates',
+                        'resource_name' => dirname(__FILE__) . '/templates/index.tpl');
+        $this->assertTrue(smarty_core_is_secure($params, $this->smarty));
+        $this->smarty->security = $security;
+    }
+
+    function test_core_is_secure_function_is_secure_false() {
+        $security = $this->smarty->security;
+        $this->smarty->security = true;
+        /* check if test_cases.php is secure (should be false) */
+        $params = array('resource_type' => 'file',
+                        'resource_base_path' => dirname(__FILE__) . '/templates',
+                        'resource_name' => __FILE__);
+        $this->assertFalse(smarty_core_is_secure($params, $this->smarty));
+        $this->smarty->security = $security;
+
+    }
+
+    // test constants and security
+    function test_core_is_secure_function_smarty_var_const() {
+        define('TEST_CONSTANT', 'test constant');
+        $this->assertEquals('test constant', $this->smarty->fetch('constant.tpl',
+                                                             null, 'var_const'));
+    }
+
+    function test_core_is_secure_function_smarty_var_const_allowed() {
+        $security = $this->smarty->security;
+        $security_settings = $this->smarty->security_settings;
+        $this->smarty->security_settings['ALLOW_CONSTANTS'] = true;
+        $this->smarty->security = true;
+        $this->assertEquals('test constant', $this->smarty->fetch('constant.tpl',
+                                                     null, 'var_const_allowed'));
+        $this->smarty->security_settings = $security_settings;
+        $this->smarty->security = $security;   
+    }
+
+    function test_core_is_secure_function_smarty_var_const_not_allowed() {
+        $security = $this->smarty->security;
+        $this->smarty->security = true;
+        /* catch errors: */
+        $this->errorlevel = null;
+        set_error_handler(array(&$this, 'error_handler'));
+        $this->smarty->fetch('constant.tpl', null, 'var_const_not_allowed');
+        restore_error_handler();
+
+        $this->assertEquals( $this->errorlevel, E_USER_WARNING);
+        $this->smarty->security = $security;
+    }
+
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/demo/index.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/demo/index.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/demo/index.php	(revision 1328)
@@ -0,0 +1,25 @@
+<?php
+
+require '../libs/Smarty.class.php';
+
+$smarty = new Smarty;
+
+$smarty->compile_check = true;
+$smarty->debugging = true;
+
+$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
+$smarty->assign("FirstName",array("John","Mary","James","Henry"));
+$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
+$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
+	  array("I", "J", "K", "L"), array("M", "N", "O", "P")));
+
+$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
+	  array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
+
+$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
+$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
+$smarty->assign("option_selected", "NE");
+
+$smarty->display('index.tpl');
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Smarty.class.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Smarty.class.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Smarty.class.php	(revision 1328)
@@ -0,0 +1,1944 @@
+<?php
+
+/**
+ * Project:     Smarty: the PHP compiling template engine
+ * File:        Smarty.class.php
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * For questions, help, comments, discussion, etc., please join the
+ * Smarty mailing list. Send a blank e-mail to
+ * smarty-general-subscribe@lists.php.net
+ *
+ * @link http://smarty.php.net/
+ * @copyright 2001-2005 New Digital Group, Inc.
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Andrei Zmievski <andrei@php.net>
+ * @package Smarty
+ * @version 2.6.13
+ */
+
+/* $Id$ */
+
+/**
+ * DIR_SEP isn't used anymore, but third party apps might
+ */
+if(!defined('DIR_SEP')) {
+    define('DIR_SEP', DIRECTORY_SEPARATOR);
+}
+
+/**
+ * set SMARTY_DIR to absolute path to Smarty library files.
+ * if not defined, include_path will be used. Sets SMARTY_DIR only if user
+ * application has not already defined it.
+ */
+
+if (!defined('SMARTY_DIR')) {
+    define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+}
+
+if (!defined('SMARTY_CORE_DIR')) {
+    define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR);
+}
+
+define('SMARTY_PHP_PASSTHRU',   0);
+define('SMARTY_PHP_QUOTE',      1);
+define('SMARTY_PHP_REMOVE',     2);
+define('SMARTY_PHP_ALLOW',      3);
+
+/**
+ * @package Smarty
+ */
+class Smarty
+{
+    /**#@+
+     * Smarty Configuration Section
+     */
+
+    /**
+     * The name of the directory where templates are located.
+     *
+     * @var string
+     */
+    var $template_dir    =  'templates';
+
+    /**
+     * The directory where compiled templates are located.
+     *
+     * @var string
+     */
+    var $compile_dir     =  'templates_c';
+
+    /**
+     * The directory where config files are located.
+     *
+     * @var string
+     */
+    var $config_dir      =  'configs';
+
+    /**
+     * An array of directories searched for plugins.
+     *
+     * @var array
+     */
+    var $plugins_dir     =  array('plugins');
+
+    /**
+     * If debugging is enabled, a debug console window will display
+     * when the page loads (make sure your browser allows unrequested
+     * popup windows)
+     *
+     * @var boolean
+     */
+    var $debugging       =  false;
+
+    /**
+     * When set, smarty does uses this value as error_reporting-level.
+     *
+     * @var boolean
+     */
+    var $error_reporting  =  null;
+
+    /**
+     * This is the path to the debug console template. If not set,
+     * the default one will be used.
+     *
+     * @var string
+     */
+    var $debug_tpl       =  '';
+
+    /**
+     * This determines if debugging is enable-able from the browser.
+     * <ul>
+     *  <li>NONE => no debugging control allowed</li>
+     *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
+     * </ul>
+     * @link http://www.foo.dom/index.php?SMARTY_DEBUG
+     * @var string
+     */
+    var $debugging_ctrl  =  'NONE';
+
+    /**
+     * This tells Smarty whether to check for recompiling or not. Recompiling
+     * does not need to happen unless a template or config file is changed.
+     * Typically you enable this during development, and disable for
+     * production.
+     *
+     * @var boolean
+     */
+    var $compile_check   =  true;
+
+    /**
+     * This forces templates to compile every time. Useful for development
+     * or debugging.
+     *
+     * @var boolean
+     */
+    var $force_compile   =  false;
+
+    /**
+     * This enables template caching.
+     * <ul>
+     *  <li>0 = no caching</li>
+     *  <li>1 = use class cache_lifetime value</li>
+     *  <li>2 = use cache_lifetime in cache file</li>
+     * </ul>
+     * @var integer
+     */
+    var $caching         =  0;
+
+    /**
+     * The name of the directory for cache files.
+     *
+     * @var string
+     */
+    var $cache_dir       =  'cache';
+
+    /**
+     * This is the number of seconds cached content will persist.
+     * <ul>
+     *  <li>0 = always regenerate cache</li>
+     *  <li>-1 = never expires</li>
+     * </ul>
+     *
+     * @var integer
+     */
+    var $cache_lifetime  =  3600;
+
+    /**
+     * Only used when $caching is enabled. If true, then If-Modified-Since headers
+     * are respected with cached content, and appropriate HTTP headers are sent.
+     * This way repeated hits to a cached page do not send the entire page to the
+     * client every time.
+     *
+     * @var boolean
+     */
+    var $cache_modified_check = false;
+
+    /**
+     * This determines how Smarty handles "<?php ... ?>" tags in templates.
+     * possible values:
+     * <ul>
+     *  <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li>
+     *  <li>SMARTY_PHP_QUOTE    -> escape tags as entities</li>
+     *  <li>SMARTY_PHP_REMOVE   -> remove php tags</li>
+     *  <li>SMARTY_PHP_ALLOW    -> execute php tags</li>
+     * </ul>
+     *
+     * @var integer
+     */
+    var $php_handling    =  SMARTY_PHP_PASSTHRU;
+
+    /**
+     * This enables template security. When enabled, many things are restricted
+     * in the templates that normally would go unchecked. This is useful when
+     * untrusted parties are editing templates and you want a reasonable level
+     * of security. (no direct execution of PHP in templates for example)
+     *
+     * @var boolean
+     */
+    var $security       =   false;
+
+    /**
+     * This is the list of template directories that are considered secure. This
+     * is used only if {@link $security} is enabled. One directory per array
+     * element.  {@link $template_dir} is in this list implicitly.
+     *
+     * @var array
+     */
+    var $secure_dir     =   array();
+
+    /**
+     * These are the security settings for Smarty. They are used only when
+     * {@link $security} is enabled.
+     *
+     * @var array
+     */
+    var $security_settings  = array(
+                                    'PHP_HANDLING'    => false,
+                                    'IF_FUNCS'        => array('array', 'list',
+                                                               'isset', 'empty',
+                                                               'count', 'sizeof',
+                                                               'in_array', 'is_array',
+                                                               'true', 'false', 'null'),
+                                    'INCLUDE_ANY'     => false,
+                                    'PHP_TAGS'        => false,
+                                    'MODIFIER_FUNCS'  => array('count'),
+                                    'ALLOW_CONSTANTS'  => false
+                                   );
+
+    /**
+     * This is an array of directories where trusted php scripts reside.
+     * {@link $security} is disabled during their inclusion/execution.
+     *
+     * @var array
+     */
+    var $trusted_dir        = array();
+
+    /**
+     * The left delimiter used for the template tags.
+     *
+     * @var string
+     */
+    var $left_delimiter  =  '{';
+
+    /**
+     * The right delimiter used for the template tags.
+     *
+     * @var string
+     */
+    var $right_delimiter =  '}';
+
+    /**
+     * The order in which request variables are registered, similar to
+     * variables_order in php.ini E = Environment, G = GET, P = POST,
+     * C = Cookies, S = Server
+     *
+     * @var string
+     */
+    var $request_vars_order    = 'EGPCS';
+
+    /**
+     * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)
+     * are uses as request-vars or $_*[]-vars. note: if
+     * request_use_auto_globals is true, then $request_vars_order has
+     * no effect, but the php-ini-value "gpc_order"
+     *
+     * @var boolean
+     */
+    var $request_use_auto_globals      = true;
+
+    /**
+     * Set this if you want different sets of compiled files for the same
+     * templates. This is useful for things like different languages.
+     * Instead of creating separate sets of templates per language, you
+     * set different compile_ids like 'en' and 'de'.
+     *
+     * @var string
+     */
+    var $compile_id            = null;
+
+    /**
+     * This tells Smarty whether or not to use sub dirs in the cache/ and
+     * templates_c/ directories. sub directories better organized, but
+     * may not work well with PHP safe mode enabled.
+     *
+     * @var boolean
+     *
+     */
+    var $use_sub_dirs          = false;
+
+    /**
+     * This is a list of the modifiers to apply to all template variables.
+     * Put each modifier in a separate array element in the order you want
+     * them applied. example: <code>array('escape:"htmlall"');</code>
+     *
+     * @var array
+     */
+    var $default_modifiers        = array();
+
+    /**
+     * This is the resource type to be used when not specified
+     * at the beginning of the resource path. examples:
+     * $smarty->display('file:index.tpl');
+     * $smarty->display('db:index.tpl');
+     * $smarty->display('index.tpl'); // will use default resource type
+     * {include file="file:index.tpl"}
+     * {include file="db:index.tpl"}
+     * {include file="index.tpl"} {* will use default resource type *}
+     *
+     * @var array
+     */
+    var $default_resource_type    = 'file';
+
+    /**
+     * The function used for cache file handling. If not set, built-in caching is used.
+     *
+     * @var null|string function name
+     */
+    var $cache_handler_func   = null;
+
+    /**
+     * This indicates which filters are automatically loaded into Smarty.
+     *
+     * @var array array of filter names
+     */
+    var $autoload_filters = array();
+
+    /**#@+
+     * @var boolean
+     */
+    /**
+     * This tells if config file vars of the same name overwrite each other or not.
+     * if disabled, same name variables are accumulated in an array.
+     */
+    var $config_overwrite = true;
+
+    /**
+     * This tells whether or not to automatically booleanize config file variables.
+     * If enabled, then the strings "on", "true", and "yes" are treated as boolean
+     * true, and "off", "false" and "no" are treated as boolean false.
+     */
+    var $config_booleanize = true;
+
+    /**
+     * This tells whether hidden sections [.foobar] are readable from the
+     * tempalates or not. Normally you would never allow this since that is
+     * the point behind hidden sections: the application can access them, but
+     * the templates cannot.
+     */
+    var $config_read_hidden = false;
+
+    /**
+     * This tells whether or not automatically fix newlines in config files.
+     * It basically converts \r (mac) or \r\n (dos) to \n
+     */
+    var $config_fix_newlines = true;
+    /**#@-*/
+
+    /**
+     * If a template cannot be found, this PHP function will be executed.
+     * Useful for creating templates on-the-fly or other special action.
+     *
+     * @var string function name
+     */
+    var $default_template_handler_func = '';
+
+    /**
+     * The file that contains the compiler class. This can a full
+     * pathname, or relative to the php_include path.
+     *
+     * @var string
+     */
+    var $compiler_file        =    'Smarty_Compiler.class.php';
+
+    /**
+     * The class used for compiling templates.
+     *
+     * @var string
+     */
+    var $compiler_class        =   'Smarty_Compiler';
+
+    /**
+     * The class used to load config vars.
+     *
+     * @var string
+     */
+    var $config_class          =   'Config_File';
+
+/**#@+
+ * END Smarty Configuration Section
+ * There should be no need to touch anything below this line.
+ * @access private
+ */
+    /**
+     * where assigned template vars are kept
+     *
+     * @var array
+     */
+    var $_tpl_vars             = array();
+
+    /**
+     * stores run-time $smarty.* vars
+     *
+     * @var null|array
+     */
+    var $_smarty_vars          = null;
+
+    /**
+     * keeps track of sections
+     *
+     * @var array
+     */
+    var $_sections             = array();
+
+    /**
+     * keeps track of foreach blocks
+     *
+     * @var array
+     */
+    var $_foreach              = array();
+
+    /**
+     * keeps track of tag hierarchy
+     *
+     * @var array
+     */
+    var $_tag_stack            = array();
+
+    /**
+     * configuration object
+     *
+     * @var Config_file
+     */
+    var $_conf_obj             = null;
+
+    /**
+     * loaded configuration settings
+     *
+     * @var array
+     */
+    var $_config               = array(array('vars'  => array(), 'files' => array()));
+
+    /**
+     * md5 checksum of the string 'Smarty'
+     *
+     * @var string
+     */
+    var $_smarty_md5           = 'f8d698aea36fcbead2b9d5359ffca76f';
+
+    /**
+     * Smarty version number
+     *
+     * @var string
+     */
+    var $_version              = '2.6.13';
+
+    /**
+     * current template inclusion depth
+     *
+     * @var integer
+     */
+    var $_inclusion_depth      = 0;
+
+    /**
+     * for different compiled templates
+     *
+     * @var string
+     */
+    var $_compile_id           = null;
+
+    /**
+     * text in URL to enable debug mode
+     *
+     * @var string
+     */
+    var $_smarty_debug_id      = 'SMARTY_DEBUG';
+
+    /**
+     * debugging information for debug console
+     *
+     * @var array
+     */
+    var $_smarty_debug_info    = array();
+
+    /**
+     * info that makes up a cache file
+     *
+     * @var array
+     */
+    var $_cache_info           = array();
+
+    /**
+     * default file permissions
+     *
+     * @var integer
+     */
+    var $_file_perms           = 0644;
+
+    /**
+     * default dir permissions
+     *
+     * @var integer
+     */
+    var $_dir_perms               = 0771;
+
+    /**
+     * registered objects
+     *
+     * @var array
+     */
+    var $_reg_objects           = array();
+
+    /**
+     * table keeping track of plugins
+     *
+     * @var array
+     */
+    var $_plugins              = array(
+                                       'modifier'      => array(),
+                                       'function'      => array(),
+                                       'block'         => array(),
+                                       'compiler'      => array(),
+                                       'prefilter'     => array(),
+                                       'postfilter'    => array(),
+                                       'outputfilter'  => array(),
+                                       'resource'      => array(),
+                                       'insert'        => array());
+
+
+    /**
+     * cache serials
+     *
+     * @var array
+     */
+    var $_cache_serials = array();
+
+    /**
+     * name of optional cache include file
+     *
+     * @var string
+     */
+    var $_cache_include = null;
+
+    /**
+     * indicate if the current code is used in a compiled
+     * include
+     *
+     * @var string
+     */
+    var $_cache_including = false;
+
+    /**#@-*/
+    /**
+     * The class constructor.
+     */
+    function Smarty()
+    {
+      $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
+                    : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
+    }
+
+    /**
+     * assigns values to template variables
+     *
+     * @param array|string $tpl_var the template variable name(s)
+     * @param mixed $value the value to assign
+     */
+    function assign($tpl_var, $value = null)
+    {
+        if (is_array($tpl_var)){
+            foreach ($tpl_var as $key => $val) {
+                if ($key != '') {
+                    $this->_tpl_vars[$key] = $val;
+                }
+            }
+        } else {
+            if ($tpl_var != '')
+                $this->_tpl_vars[$tpl_var] = $value;
+        }
+    }
+
+    /**
+     * assigns values to template variables by reference
+     *
+     * @param string $tpl_var the template variable name
+     * @param mixed $value the referenced value to assign
+     */
+    function assign_by_ref($tpl_var, &$value)
+    {
+        if ($tpl_var != '')
+            $this->_tpl_vars[$tpl_var] = &$value;
+    }
+
+    /**
+     * appends values to template variables
+     *
+     * @param array|string $tpl_var the template variable name(s)
+     * @param mixed $value the value to append
+     */
+    function append($tpl_var, $value=null, $merge=false)
+    {
+        if (is_array($tpl_var)) {
+            // $tpl_var is an array, ignore $value
+            foreach ($tpl_var as $_key => $_val) {
+                if ($_key != '') {
+                    if(!@is_array($this->_tpl_vars[$_key])) {
+                        settype($this->_tpl_vars[$_key],'array');
+                    }
+                    if($merge && is_array($_val)) {
+                        foreach($_val as $_mkey => $_mval) {
+                            $this->_tpl_vars[$_key][$_mkey] = $_mval;
+                        }
+                    } else {
+                        $this->_tpl_vars[$_key][] = $_val;
+                    }
+                }
+            }
+        } else {
+            if ($tpl_var != '' && isset($value)) {
+                if(!@is_array($this->_tpl_vars[$tpl_var])) {
+                    settype($this->_tpl_vars[$tpl_var],'array');
+                }
+                if($merge && is_array($value)) {
+                    foreach($value as $_mkey => $_mval) {
+                        $this->_tpl_vars[$tpl_var][$_mkey] = $_mval;
+                    }
+                } else {
+                    $this->_tpl_vars[$tpl_var][] = $value;
+                }
+            }
+        }
+    }
+
+    /**
+     * appends values to template variables by reference
+     *
+     * @param string $tpl_var the template variable name
+     * @param mixed $value the referenced value to append
+     */
+    function append_by_ref($tpl_var, &$value, $merge=false)
+    {
+        if ($tpl_var != '' && isset($value)) {
+            if(!@is_array($this->_tpl_vars[$tpl_var])) {
+             settype($this->_tpl_vars[$tpl_var],'array');
+            }
+            if ($merge && is_array($value)) {
+                foreach($value as $_key => $_val) {
+                    $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key];
+                }
+            } else {
+                $this->_tpl_vars[$tpl_var][] = &$value;
+            }
+        }
+    }
+
+
+    /**
+     * clear the given assigned template variable.
+     *
+     * @param string $tpl_var the template variable to clear
+     */
+    function clear_assign($tpl_var)
+    {
+        if (is_array($tpl_var))
+            foreach ($tpl_var as $curr_var)
+                unset($this->_tpl_vars[$curr_var]);
+        else
+            unset($this->_tpl_vars[$tpl_var]);
+    }
+
+
+    /**
+     * Registers custom function to be used in templates
+     *
+     * @param string $function the name of the template function
+     * @param string $function_impl the name of the PHP function to register
+     */
+    function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
+    {
+        $this->_plugins['function'][$function] =
+            array($function_impl, null, null, false, $cacheable, $cache_attrs);
+
+    }
+
+    /**
+     * Unregisters custom function
+     *
+     * @param string $function name of template function
+     */
+    function unregister_function($function)
+    {
+        unset($this->_plugins['function'][$function]);
+    }
+
+    /**
+     * Registers object to be used in templates
+     *
+     * @param string $object name of template object
+     * @param object &$object_impl the referenced PHP object to register
+     * @param null|array $allowed list of allowed methods (empty = all)
+     * @param boolean $smarty_args smarty argument format, else traditional
+     * @param null|array $block_functs list of methods that are block format
+     */
+    function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+    {
+        settype($allowed, 'array');
+        settype($smarty_args, 'boolean');
+        $this->_reg_objects[$object] =
+            array(&$object_impl, $allowed, $smarty_args, $block_methods);
+    }
+
+    /**
+     * Unregisters object
+     *
+     * @param string $object name of template object
+     */
+    function unregister_object($object)
+    {
+        unset($this->_reg_objects[$object]);
+    }
+
+
+    /**
+     * Registers block function to be used in templates
+     *
+     * @param string $block name of template block
+     * @param string $block_impl PHP function to register
+     */
+    function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
+    {
+        $this->_plugins['block'][$block] =
+            array($block_impl, null, null, false, $cacheable, $cache_attrs);
+    }
+
+    /**
+     * Unregisters block function
+     *
+     * @param string $block name of template function
+     */
+    function unregister_block($block)
+    {
+        unset($this->_plugins['block'][$block]);
+    }
+
+    /**
+     * Registers compiler function
+     *
+     * @param string $function name of template function
+     * @param string $function_impl name of PHP function to register
+     */
+    function register_compiler_function($function, $function_impl, $cacheable=true)
+    {
+        $this->_plugins['compiler'][$function] =
+            array($function_impl, null, null, false, $cacheable);
+    }
+
+    /**
+     * Unregisters compiler function
+     *
+     * @param string $function name of template function
+     */
+    function unregister_compiler_function($function)
+    {
+        unset($this->_plugins['compiler'][$function]);
+    }
+
+    /**
+     * Registers modifier to be used in templates
+     *
+     * @param string $modifier name of template modifier
+     * @param string $modifier_impl name of PHP function to register
+     */
+    function register_modifier($modifier, $modifier_impl)
+    {
+        $this->_plugins['modifier'][$modifier] =
+            array($modifier_impl, null, null, false);
+    }
+
+    /**
+     * Unregisters modifier
+     *
+     * @param string $modifier name of template modifier
+     */
+    function unregister_modifier($modifier)
+    {
+        unset($this->_plugins['modifier'][$modifier]);
+    }
+
+    /**
+     * Registers a resource to fetch a template
+     *
+     * @param string $type name of resource
+     * @param array $functions array of functions to handle resource
+     */
+    function register_resource($type, $functions)
+    {
+        if (count($functions)==4) {
+            $this->_plugins['resource'][$type] =
+                array($functions, false);
+
+        } elseif (count($functions)==5) {
+            $this->_plugins['resource'][$type] =
+                array(array(array(&$functions[0], $functions[1])
+                            ,array(&$functions[0], $functions[2])
+                            ,array(&$functions[0], $functions[3])
+                            ,array(&$functions[0], $functions[4]))
+                      ,false);
+
+        } else {
+            $this->trigger_error("malformed function-list for '$type' in register_resource");
+
+        }
+    }
+
+    /**
+     * Unregisters a resource
+     *
+     * @param string $type name of resource
+     */
+    function unregister_resource($type)
+    {
+        unset($this->_plugins['resource'][$type]);
+    }
+
+    /**
+     * Registers a prefilter function to apply
+     * to a template before compiling
+     *
+     * @param string $function name of PHP function to register
+     */
+    function register_prefilter($function)
+    {
+    $_name = (is_array($function)) ? $function[1] : $function;
+        $this->_plugins['prefilter'][$_name]
+            = array($function, null, null, false);
+    }
+
+    /**
+     * Unregisters a prefilter function
+     *
+     * @param string $function name of PHP function
+     */
+    function unregister_prefilter($function)
+    {
+        unset($this->_plugins['prefilter'][$function]);
+    }
+
+    /**
+     * Registers a postfilter function to apply
+     * to a compiled template after compilation
+     *
+     * @param string $function name of PHP function to register
+     */
+    function register_postfilter($function)
+    {
+    $_name = (is_array($function)) ? $function[1] : $function;
+        $this->_plugins['postfilter'][$_name]
+            = array($function, null, null, false);
+    }
+
+    /**
+     * Unregisters a postfilter function
+     *
+     * @param string $function name of PHP function
+     */
+    function unregister_postfilter($function)
+    {
+        unset($this->_plugins['postfilter'][$function]);
+    }
+
+    /**
+     * Registers an output filter function to apply
+     * to a template output
+     *
+     * @param string $function name of PHP function
+     */
+    function register_outputfilter($function)
+    {
+    $_name = (is_array($function)) ? $function[1] : $function;
+        $this->_plugins['outputfilter'][$_name]
+            = array($function, null, null, false);
+    }
+
+    /**
+     * Unregisters an outputfilter function
+     *
+     * @param string $function name of PHP function
+     */
+    function unregister_outputfilter($function)
+    {
+        unset($this->_plugins['outputfilter'][$function]);
+    }
+
+    /**
+     * load a filter of specified type and name
+     *
+     * @param string $type filter type
+     * @param string $name filter name
+     */
+    function load_filter($type, $name)
+    {
+        switch ($type) {
+            case 'output':
+                $_params = array('plugins' => array(array($type . 'filter', $name, null, null, false)));
+                require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+                smarty_core_load_plugins($_params, $this);
+                break;
+
+            case 'pre':
+            case 'post':
+                if (!isset($this->_plugins[$type . 'filter'][$name]))
+                    $this->_plugins[$type . 'filter'][$name] = false;
+                break;
+        }
+    }
+
+    /**
+     * clear cached content for the given template and cache id
+     *
+     * @param string $tpl_file name of template file
+     * @param string $cache_id name of cache_id
+     * @param string $compile_id name of compile_id
+     * @param string $exp_time expiration time
+     * @return boolean
+     */
+    function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
+    {
+
+        if (!isset($compile_id))
+            $compile_id = $this->compile_id;
+
+        if (!isset($tpl_file))
+            $compile_id = null;
+
+        $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
+
+        if (!empty($this->cache_handler_func)) {
+            return call_user_func_array($this->cache_handler_func,
+                                  array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time));
+        } else {
+            $_params = array('auto_base' => $this->cache_dir,
+                            'auto_source' => $tpl_file,
+                            'auto_id' => $_auto_id,
+                            'exp_time' => $exp_time);
+            require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
+            return smarty_core_rm_auto($_params, $this);
+        }
+
+    }
+
+
+    /**
+     * clear the entire contents of cache (all templates)
+     *
+     * @param string $exp_time expire time
+     * @return boolean results of {@link smarty_core_rm_auto()}
+     */
+    function clear_all_cache($exp_time = null)
+    {
+        return $this->clear_cache(null, null, null, $exp_time);
+    }
+
+
+    /**
+     * test to see if valid cache exists for this template
+     *
+     * @param string $tpl_file name of template file
+     * @param string $cache_id
+     * @param string $compile_id
+     * @return string|false results of {@link _read_cache_file()}
+     */
+    function is_cached($tpl_file, $cache_id = null, $compile_id = null)
+    {
+        if (!$this->caching)
+            return false;
+
+        if (!isset($compile_id))
+            $compile_id = $this->compile_id;
+
+        $_params = array(
+            'tpl_file' => $tpl_file,
+            'cache_id' => $cache_id,
+            'compile_id' => $compile_id
+        );
+        require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
+        return smarty_core_read_cache_file($_params, $this);
+    }
+
+
+    /**
+     * clear all the assigned template variables.
+     *
+     */
+    function clear_all_assign()
+    {
+        $this->_tpl_vars = array();
+    }
+
+    /**
+     * clears compiled version of specified template resource,
+     * or all compiled template files if one is not specified.
+     * This function is for advanced use only, not normally needed.
+     *
+     * @param string $tpl_file
+     * @param string $compile_id
+     * @param string $exp_time
+     * @return boolean results of {@link smarty_core_rm_auto()}
+     */
+    function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
+    {
+        if (!isset($compile_id)) {
+            $compile_id = $this->compile_id;
+        }
+        $_params = array('auto_base' => $this->compile_dir,
+                        'auto_source' => $tpl_file,
+                        'auto_id' => $compile_id,
+                        'exp_time' => $exp_time,
+                        'extensions' => array('.inc', '.php'));
+        require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
+        return smarty_core_rm_auto($_params, $this);
+    }
+
+    /**
+     * Checks whether requested template exists.
+     *
+     * @param string $tpl_file
+     * @return boolean
+     */
+    function template_exists($tpl_file)
+    {
+        $_params = array('resource_name' => $tpl_file, 'quiet'=>true, 'get_source'=>false);
+        return $this->_fetch_resource_info($_params);
+    }
+
+    /**
+     * Returns an array containing template variables
+     *
+     * @param string $name
+     * @param string $type
+     * @return array
+     */
+    function &get_template_vars($name=null)
+    {
+        if(!isset($name)) {
+            return $this->_tpl_vars;
+        } elseif(isset($this->_tpl_vars[$name])) {
+            return $this->_tpl_vars[$name];
+        } else {
+            // var non-existant, return valid reference
+            $_tmp = null;
+            return $_tmp;   
+        }
+    }
+
+    /**
+     * Returns an array containing config variables
+     *
+     * @param string $name
+     * @param string $type
+     * @return array
+     */
+    function &get_config_vars($name=null)
+    {
+        if(!isset($name) && is_array($this->_config[0])) {
+            return $this->_config[0]['vars'];
+        } else if(isset($this->_config[0]['vars'][$name])) {
+            return $this->_config[0]['vars'][$name];
+        } else {
+            // var non-existant, return valid reference
+            $_tmp = null;
+            return $_tmp;
+        }
+    }
+
+    /**
+     * trigger Smarty error
+     *
+     * @param string $error_msg
+     * @param integer $error_type
+     */
+    function trigger_error($error_msg, $error_type = E_USER_WARNING)
+    {
+        trigger_error("Smarty error: $error_msg", $error_type);
+    }
+
+
+    /**
+     * executes & displays the template results
+     *
+     * @param string $resource_name
+     * @param string $cache_id
+     * @param string $compile_id
+     */
+    function display($resource_name, $cache_id = null, $compile_id = null)
+    {
+        $this->fetch($resource_name, $cache_id, $compile_id, true);
+    }
+
+    /**
+     * executes & returns or displays the template results
+     *
+     * @param string $resource_name
+     * @param string $cache_id
+     * @param string $compile_id
+     * @param boolean $display
+     */
+    function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
+    {
+        static $_cache_info = array();
+        
+        $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
+               ? $this->error_reporting : error_reporting() & ~E_NOTICE);
+
+        if (!$this->debugging && $this->debugging_ctrl == 'URL') {
+            $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
+            if (@strstr($_query_string, $this->_smarty_debug_id)) {
+                if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
+                    // enable debugging for this browser session
+                    @setcookie('SMARTY_DEBUG', true);
+                    $this->debugging = true;
+                } elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
+                    // disable debugging for this browser session
+                    @setcookie('SMARTY_DEBUG', false);
+                    $this->debugging = false;
+                } else {
+                    // enable debugging for this page
+                    $this->debugging = true;
+                }
+            } else {
+                $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
+            }
+        }
+
+        if ($this->debugging) {
+            // capture time for debugging info
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $_debug_start_time = smarty_core_get_microtime($_params, $this);
+            $this->_smarty_debug_info[] = array('type'      => 'template',
+                                                'filename'  => $resource_name,
+                                                'depth'     => 0);
+            $_included_tpls_idx = count($this->_smarty_debug_info) - 1;
+        }
+
+        if (!isset($compile_id)) {
+            $compile_id = $this->compile_id;
+        }
+
+        $this->_compile_id = $compile_id;
+        $this->_inclusion_depth = 0;
+
+        if ($this->caching) {
+            // save old cache_info, initialize cache_info
+            array_push($_cache_info, $this->_cache_info);
+            $this->_cache_info = array();
+            $_params = array(
+                'tpl_file' => $resource_name,
+                'cache_id' => $cache_id,
+                'compile_id' => $compile_id,
+                'results' => null
+            );
+            require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
+            if (smarty_core_read_cache_file($_params, $this)) {
+                $_smarty_results = $_params['results'];
+                if (!empty($this->_cache_info['insert_tags'])) {
+                    $_params = array('plugins' => $this->_cache_info['insert_tags']);
+                    require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+                    smarty_core_load_plugins($_params, $this);
+                    $_params = array('results' => $_smarty_results);
+                    require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
+                    $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
+                }
+                if (!empty($this->_cache_info['cache_serials'])) {
+                    $_params = array('results' => $_smarty_results);
+                    require_once(SMARTY_CORE_DIR . 'core.process_compiled_include.php');
+                    $_smarty_results = smarty_core_process_compiled_include($_params, $this);
+                }
+
+
+                if ($display) {
+                    if ($this->debugging)
+                    {
+                        // capture time for debugging info
+                        $_params = array();
+                        require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+                        $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
+                        require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
+                        $_smarty_results .= smarty_core_display_debug_console($_params, $this);
+                    }
+                    if ($this->cache_modified_check) {
+                        $_server_vars = ($this->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
+                        $_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
+                        $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT';
+                        if (@count($this->_cache_info['insert_tags']) == 0
+                            && !$this->_cache_serials
+                            && $_gmt_mtime == $_last_modified_date) {
+                            if (php_sapi_name()=='cgi')
+                                header('Status: 304 Not Modified');
+                            else
+                                header('HTTP/1.1 304 Not Modified');
+
+                        } else {
+                            header('Last-Modified: '.$_gmt_mtime);
+                            echo $_smarty_results;
+                        }
+                    } else {
+                            echo $_smarty_results;
+                    }
+                    error_reporting($_smarty_old_error_level);
+                    // restore initial cache_info
+                    $this->_cache_info = array_pop($_cache_info);
+                    return true;
+                } else {
+                    error_reporting($_smarty_old_error_level);
+                    // restore initial cache_info
+                    $this->_cache_info = array_pop($_cache_info);
+                    return $_smarty_results;
+                }
+            } else {
+                $this->_cache_info['template'][$resource_name] = true;
+                if ($this->cache_modified_check && $display) {
+                    header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
+                }
+            }
+        }
+
+        // load filters that are marked as autoload
+        if (count($this->autoload_filters)) {
+            foreach ($this->autoload_filters as $_filter_type => $_filters) {
+                foreach ($_filters as $_filter) {
+                    $this->load_filter($_filter_type, $_filter);
+                }
+            }
+        }
+
+        $_smarty_compile_path = $this->_get_compile_path($resource_name);
+
+        // if we just need to display the results, don't perform output
+        // buffering - for speed
+        $_cache_including = $this->_cache_including;
+        $this->_cache_including = false;
+        if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) {
+            if ($this->_is_compiled($resource_name, $_smarty_compile_path)
+                    || $this->_compile_resource($resource_name, $_smarty_compile_path))
+            {
+                include($_smarty_compile_path);
+            }
+        } else {
+            ob_start();
+            if ($this->_is_compiled($resource_name, $_smarty_compile_path)
+                    || $this->_compile_resource($resource_name, $_smarty_compile_path))
+            {
+                include($_smarty_compile_path);
+            }
+            $_smarty_results = ob_get_contents();
+            ob_end_clean();
+
+            foreach ((array)$this->_plugins['outputfilter'] as $_output_filter) {
+                $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this));
+            }
+        }
+
+        if ($this->caching) {
+            $_params = array('tpl_file' => $resource_name,
+                        'cache_id' => $cache_id,
+                        'compile_id' => $compile_id,
+                        'results' => $_smarty_results);
+            require_once(SMARTY_CORE_DIR . 'core.write_cache_file.php');
+            smarty_core_write_cache_file($_params, $this);
+            require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
+            $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
+
+            if ($this->_cache_serials) {
+                // strip nocache-tags from output
+                $_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s'
+                                                ,''
+                                                ,$_smarty_results);
+            }
+            // restore initial cache_info
+            $this->_cache_info = array_pop($_cache_info);
+        }
+        $this->_cache_including = $_cache_including;
+
+        if ($display) {
+            if (isset($_smarty_results)) { echo $_smarty_results; }
+            if ($this->debugging) {
+                // capture time for debugging info
+                $_params = array();
+                require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+                $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
+                require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
+                echo smarty_core_display_debug_console($_params, $this);
+            }
+            error_reporting($_smarty_old_error_level);
+            return;
+        } else {
+            error_reporting($_smarty_old_error_level);
+            if (isset($_smarty_results)) { return $_smarty_results; }
+        }
+    }
+
+    /**
+     * load configuration values
+     *
+     * @param string $file
+     * @param string $section
+     * @param string $scope
+     */
+    function config_load($file, $section = null, $scope = 'global')
+    {
+        require_once($this->_get_plugin_filepath('function', 'config_load'));
+        smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this);
+    }
+
+    /**
+     * return a reference to a registered object
+     *
+     * @param string $name
+     * @return object
+     */
+    function &get_registered_object($name) {
+        if (!isset($this->_reg_objects[$name]))
+        $this->_trigger_fatal_error("'$name' is not a registered object");
+
+        if (!is_object($this->_reg_objects[$name][0]))
+        $this->_trigger_fatal_error("registered '$name' is not an object");
+
+        return $this->_reg_objects[$name][0];
+    }
+
+    /**
+     * clear configuration values
+     *
+     * @param string $var
+     */
+    function clear_config($var = null)
+    {
+        if(!isset($var)) {
+            // clear all values
+            $this->_config = array(array('vars'  => array(),
+                                         'files' => array()));
+        } else {
+            unset($this->_config[0]['vars'][$var]);
+        }
+    }
+
+    /**
+     * get filepath of requested plugin
+     *
+     * @param string $type
+     * @param string $name
+     * @return string|false
+     */
+    function _get_plugin_filepath($type, $name)
+    {
+        $_params = array('type' => $type, 'name' => $name);
+        require_once(SMARTY_CORE_DIR . 'core.assemble_plugin_filepath.php');
+        return smarty_core_assemble_plugin_filepath($_params, $this);
+    }
+
+   /**
+     * test if resource needs compiling
+     *
+     * @param string $resource_name
+     * @param string $compile_path
+     * @return boolean
+     */
+    function _is_compiled($resource_name, $compile_path)
+    {
+        if (!$this->force_compile && file_exists($compile_path)) {
+            if (!$this->compile_check) {
+                // no need to check compiled file
+                return true;
+            } else {
+                // get file source and timestamp
+                $_params = array('resource_name' => $resource_name, 'get_source'=>false);
+                if (!$this->_fetch_resource_info($_params)) {
+                    return false;
+                }
+                if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
+                    // template not expired, no recompile
+                    return true;
+                } else {
+                    // compile template
+                    return false;
+                }
+            }
+        } else {
+            // compiled template does not exist, or forced compile
+            return false;
+        }
+    }
+
+   /**
+     * compile the template
+     *
+     * @param string $resource_name
+     * @param string $compile_path
+     * @return boolean
+     */
+    function _compile_resource($resource_name, $compile_path)
+    {
+
+        $_params = array('resource_name' => $resource_name);
+        if (!$this->_fetch_resource_info($_params)) {
+            return false;
+        }
+
+        $_source_content = $_params['source_content'];
+        $_cache_include    = substr($compile_path, 0, -4).'.inc';
+
+        if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
+            // if a _cache_serial was set, we also have to write an include-file:
+            if ($this->_cache_include_info) {
+                require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php');
+                smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)),  $this);
+            }
+
+            $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content);
+            require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
+            smarty_core_write_compiled_resource($_params, $this);
+
+            return true;
+        } else {
+            return false;
+        }
+
+    }
+
+   /**
+     * compile the given source
+     *
+     * @param string $resource_name
+     * @param string $source_content
+     * @param string $compiled_content
+     * @return boolean
+     */
+    function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null)
+    {
+        if (file_exists(SMARTY_DIR . $this->compiler_file)) {
+            require_once(SMARTY_DIR . $this->compiler_file);
+        } else {
+            // use include_path
+            require_once($this->compiler_file);
+        }
+
+
+        $smarty_compiler = new $this->compiler_class;
+
+        $smarty_compiler->template_dir      = $this->template_dir;
+        $smarty_compiler->compile_dir       = $this->compile_dir;
+        $smarty_compiler->plugins_dir       = $this->plugins_dir;
+        $smarty_compiler->config_dir        = $this->config_dir;
+        $smarty_compiler->force_compile     = $this->force_compile;
+        $smarty_compiler->caching           = $this->caching;
+        $smarty_compiler->php_handling      = $this->php_handling;
+        $smarty_compiler->left_delimiter    = $this->left_delimiter;
+        $smarty_compiler->right_delimiter   = $this->right_delimiter;
+        $smarty_compiler->_version          = $this->_version;
+        $smarty_compiler->security          = $this->security;
+        $smarty_compiler->secure_dir        = $this->secure_dir;
+        $smarty_compiler->security_settings = $this->security_settings;
+        $smarty_compiler->trusted_dir       = $this->trusted_dir;
+        $smarty_compiler->use_sub_dirs      = $this->use_sub_dirs;
+        $smarty_compiler->_reg_objects      = &$this->_reg_objects;
+        $smarty_compiler->_plugins          = &$this->_plugins;
+        $smarty_compiler->_tpl_vars         = &$this->_tpl_vars;
+        $smarty_compiler->default_modifiers = $this->default_modifiers;
+        $smarty_compiler->compile_id        = $this->_compile_id;
+        $smarty_compiler->_config            = $this->_config;
+        $smarty_compiler->request_use_auto_globals  = $this->request_use_auto_globals;
+
+        if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) {
+            $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path];
+        }
+        $smarty_compiler->_cache_include = $cache_include_path;
+
+
+        $_results = $smarty_compiler->_compile_file($resource_name, $source_content, $compiled_content);
+
+        if ($smarty_compiler->_cache_serial) {
+            $this->_cache_include_info = array(
+                'cache_serial'=>$smarty_compiler->_cache_serial
+                ,'plugins_code'=>$smarty_compiler->_plugins_code
+                ,'include_file_path' => $cache_include_path);
+
+        } else {
+            $this->_cache_include_info = null;
+
+        }
+
+        return $_results;
+    }
+
+    /**
+     * Get the compile path for this resource
+     *
+     * @param string $resource_name
+     * @return string results of {@link _get_auto_filename()}
+     */
+    function _get_compile_path($resource_name)
+    {
+        return $this->_get_auto_filename($this->compile_dir, $resource_name,
+                                         $this->_compile_id) . '.php';
+    }
+
+    /**
+     * fetch the template info. Gets timestamp, and source
+     * if get_source is true
+     *
+     * sets $source_content to the source of the template, and
+     * $resource_timestamp to its time stamp
+     * @param string $resource_name
+     * @param string $source_content
+     * @param integer $resource_timestamp
+     * @param boolean $get_source
+     * @param boolean $quiet
+     * @return boolean
+     */
+
+    function _fetch_resource_info(&$params)
+    {
+        if(!isset($params['get_source'])) { $params['get_source'] = true; }
+        if(!isset($params['quiet'])) { $params['quiet'] = false; }
+
+        $_return = false;
+        $_params = array('resource_name' => $params['resource_name']) ;
+        if (isset($params['resource_base_path']))
+            $_params['resource_base_path'] = $params['resource_base_path'];
+        else
+            $_params['resource_base_path'] = $this->template_dir;
+
+        if ($this->_parse_resource_name($_params)) {
+            $_resource_type = $_params['resource_type'];
+            $_resource_name = $_params['resource_name'];
+            switch ($_resource_type) {
+                case 'file':
+                    if ($params['get_source']) {
+                        $params['source_content'] = $this->_read_file($_resource_name);
+                    }
+                    $params['resource_timestamp'] = filemtime($_resource_name);
+                    $_return = is_file($_resource_name);
+                    break;
+
+                default:
+                    // call resource functions to fetch the template source and timestamp
+                    if ($params['get_source']) {
+                        $_source_return = isset($this->_plugins['resource'][$_resource_type]) &&
+                            call_user_func_array($this->_plugins['resource'][$_resource_type][0][0],
+                                                 array($_resource_name, &$params['source_content'], &$this));
+                    } else {
+                        $_source_return = true;
+                    }
+
+                    $_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) &&
+                        call_user_func_array($this->_plugins['resource'][$_resource_type][0][1],
+                                             array($_resource_name, &$params['resource_timestamp'], &$this));
+
+                    $_return = $_source_return && $_timestamp_return;
+                    break;
+            }
+        }
+
+        if (!$_return) {
+            // see if we can get a template with the default template handler
+            if (!empty($this->default_template_handler_func)) {
+                if (!is_callable($this->default_template_handler_func)) {
+                    $this->trigger_error("default template handler function \"$this->default_template_handler_func\" doesn't exist.");
+                } else {
+                    $_return = call_user_func_array(
+                        $this->default_template_handler_func,
+                        array($_params['resource_type'], $_params['resource_name'], &$params['source_content'], &$params['resource_timestamp'], &$this));
+                }
+            }
+        }
+
+        if (!$_return) {
+            if (!$params['quiet']) {
+                $this->trigger_error('unable to read resource: "' . $params['resource_name'] . '"');
+            }
+        } else if ($_return && $this->security) {
+            require_once(SMARTY_CORE_DIR . 'core.is_secure.php');
+            if (!smarty_core_is_secure($_params, $this)) {
+                if (!$params['quiet'])
+                    $this->trigger_error('(secure mode) accessing "' . $params['resource_name'] . '" is not allowed');
+                $params['source_content'] = null;
+                $params['resource_timestamp'] = null;
+                return false;
+            }
+        }
+        return $_return;
+    }
+
+
+    /**
+     * parse out the type and name from the resource
+     *
+     * @param string $resource_base_path
+     * @param string $resource_name
+     * @param string $resource_type
+     * @param string $resource_name
+     * @return boolean
+     */
+
+    function _parse_resource_name(&$params)
+    {
+
+        // split tpl_path by the first colon
+        $_resource_name_parts = explode(':', $params['resource_name'], 2);
+
+        if (count($_resource_name_parts) == 1) {
+            // no resource type given
+            $params['resource_type'] = $this->default_resource_type;
+            $params['resource_name'] = $_resource_name_parts[0];
+        } else {
+            if(strlen($_resource_name_parts[0]) == 1) {
+                // 1 char is not resource type, but part of filepath
+                $params['resource_type'] = $this->default_resource_type;
+                $params['resource_name'] = $params['resource_name'];
+            } else {
+                $params['resource_type'] = $_resource_name_parts[0];
+                $params['resource_name'] = $_resource_name_parts[1];
+            }
+        }
+
+        if ($params['resource_type'] == 'file') {
+            if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $params['resource_name'])) {
+                // relative pathname to $params['resource_base_path']
+                // use the first directory where the file is found
+                foreach ((array)$params['resource_base_path'] as $_curr_path) {
+                    $_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
+                    if (file_exists($_fullpath) && is_file($_fullpath)) {
+                        $params['resource_name'] = $_fullpath;
+                        return true;
+                    }
+                    // didn't find the file, try include_path
+                    $_params = array('file_path' => $_fullpath);
+                    require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
+                    if(smarty_core_get_include_path($_params, $this)) {
+                        $params['resource_name'] = $_params['new_file_path'];
+                        return true;
+                    }
+                }
+                return false;
+            } else {
+                /* absolute path */
+                return file_exists($params['resource_name']);
+            }
+        } elseif (empty($this->_plugins['resource'][$params['resource_type']])) {
+            $_params = array('type' => $params['resource_type']);
+            require_once(SMARTY_CORE_DIR . 'core.load_resource_plugin.php');
+            smarty_core_load_resource_plugin($_params, $this);
+        }
+
+        return true;
+    }
+
+
+    /**
+     * Handle modifiers
+     *
+     * @param string|null $modifier_name
+     * @param array|null $map_array
+     * @return string result of modifiers
+     */
+    function _run_mod_handler()
+    {
+        $_args = func_get_args();
+        list($_modifier_name, $_map_array) = array_splice($_args, 0, 2);
+        list($_func_name, $_tpl_file, $_tpl_line) =
+            $this->_plugins['modifier'][$_modifier_name];
+
+        $_var = $_args[0];
+        foreach ($_var as $_key => $_val) {
+            $_args[0] = $_val;
+            $_var[$_key] = call_user_func_array($_func_name, $_args);
+        }
+        return $_var;
+    }
+
+    /**
+     * Remove starting and ending quotes from the string
+     *
+     * @param string $string
+     * @return string
+     */
+    function _dequote($string)
+    {
+        if ((substr($string, 0, 1) == "'" || substr($string, 0, 1) == '"') &&
+            substr($string, -1) == substr($string, 0, 1))
+            return substr($string, 1, -1);
+        else
+            return $string;
+    }
+
+
+    /**
+     * read in a file
+     *
+     * @param string $filename
+     * @return string
+     */
+    function _read_file($filename)
+    {
+        if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
+            $contents = '';
+            while (!feof($fd)) {
+                $contents .= fread($fd, 8192);
+            }
+            fclose($fd);
+            return $contents;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * get a concrete filename for automagically created content
+     *
+     * @param string $auto_base
+     * @param string $auto_source
+     * @param string $auto_id
+     * @return string
+     * @staticvar string|null
+     * @staticvar string|null
+     */
+    function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null)
+    {
+        $_compile_dir_sep =  $this->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
+        $_return = $auto_base . DIRECTORY_SEPARATOR;
+
+        if(isset($auto_id)) {
+            // make auto_id safe for directory names
+            $auto_id = str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id)));
+            // split into separate directories
+            $_return .= $auto_id . $_compile_dir_sep;
+        }
+
+        if(isset($auto_source)) {
+            // make source name safe for filename
+            $_filename = urlencode(basename($auto_source));
+            $_crc32 = sprintf('%08X', crc32($auto_source));
+            // prepend %% to avoid name conflicts with
+            // with $params['auto_id'] names
+            $_crc32 = substr($_crc32, 0, 2) . $_compile_dir_sep .
+                      substr($_crc32, 0, 3) . $_compile_dir_sep . $_crc32;
+            $_return .= '%%' . $_crc32 . '%%' . $_filename;
+        }
+
+        return $_return;
+    }
+
+    /**
+     * unlink a file, possibly using expiration time
+     *
+     * @param string $resource
+     * @param integer $exp_time
+     */
+    function _unlink($resource, $exp_time = null)
+    {
+        if(isset($exp_time)) {
+            if(time() - @filemtime($resource) >= $exp_time) {
+                return @unlink($resource);
+            }
+        } else {
+            return @unlink($resource);
+        }
+    }
+
+    /**
+     * returns an auto_id for auto-file-functions
+     *
+     * @param string $cache_id
+     * @param string $compile_id
+     * @return string|null
+     */
+    function _get_auto_id($cache_id=null, $compile_id=null) {
+    if (isset($cache_id))
+        return (isset($compile_id)) ? $cache_id . '|' . $compile_id  : $cache_id;
+    elseif(isset($compile_id))
+        return $compile_id;
+    else
+        return null;
+    }
+
+    /**
+     * trigger Smarty plugin error
+     *
+     * @param string $error_msg
+     * @param string $tpl_file
+     * @param integer $tpl_line
+     * @param string $file
+     * @param integer $line
+     * @param integer $error_type
+     */
+    function _trigger_fatal_error($error_msg, $tpl_file = null, $tpl_line = null,
+            $file = null, $line = null, $error_type = E_USER_ERROR)
+    {
+        if(isset($file) && isset($line)) {
+            $info = ' ('.basename($file).", line $line)";
+        } else {
+            $info = '';
+        }
+        if (isset($tpl_line) && isset($tpl_file)) {
+            $this->trigger_error('[in ' . $tpl_file . ' line ' . $tpl_line . "]: $error_msg$info", $error_type);
+        } else {
+            $this->trigger_error($error_msg . $info, $error_type);
+        }
+    }
+
+
+    /**
+     * callback function for preg_replace, to call a non-cacheable block
+     * @return string
+     */
+    function _process_compiled_include_callback($match) {
+        $_func = '_smarty_tplfunc_'.$match[2].'_'.$match[3];
+        ob_start();
+        $_func($this);
+        $_ret = ob_get_contents();
+        ob_end_clean();
+        return $_ret;
+    }
+
+
+    /**
+     * called for included templates
+     *
+     * @param string $_smarty_include_tpl_file
+     * @param string $_smarty_include_vars
+     */
+
+    // $_smarty_include_tpl_file, $_smarty_include_vars
+
+    function _smarty_include($params)
+    {
+        if ($this->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $debug_start_time = smarty_core_get_microtime($_params, $this);
+            $this->_smarty_debug_info[] = array('type'      => 'template',
+                                                  'filename'  => $params['smarty_include_tpl_file'],
+                                                  'depth'     => ++$this->_inclusion_depth);
+            $included_tpls_idx = count($this->_smarty_debug_info) - 1;
+        }
+
+        $this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']);
+
+        // config vars are treated as local, so push a copy of the
+        // current ones onto the front of the stack
+        array_unshift($this->_config, $this->_config[0]);
+
+        $_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']);
+
+
+        if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path)
+            || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path))
+        {
+            include($_smarty_compile_path);
+        }
+
+        // pop the local vars off the front of the stack
+        array_shift($this->_config);
+
+        $this->_inclusion_depth--;
+
+        if ($this->debugging) {
+            // capture time for debugging info
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
+        }
+
+        if ($this->caching) {
+            $this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
+        }
+    }
+
+
+    /**
+     * get or set an array of cached attributes for function that is
+     * not cacheable
+     * @return array
+     */
+    function &_smarty_cache_attrs($cache_serial, $count) {
+        $_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count];
+
+        if ($this->_cache_including) {
+            /* return next set of cache_attrs */
+            $_return = current($_cache_attrs);
+            next($_cache_attrs);
+            return $_return;
+
+        } else {
+            /* add a reference to a new set of cache_attrs */
+            $_cache_attrs[] = array();
+            return $_cache_attrs[count($_cache_attrs)-1];
+
+        }
+
+    }
+
+
+    /**
+     * wrapper for include() retaining $this
+     * @return mixed
+     */
+    function _include($filename, $once=false, $params=null)
+    {
+        if ($once) {
+            return include_once($filename);
+        } else {
+            return include($filename);
+        }
+    }
+
+
+    /**
+     * wrapper for eval() retaining $this
+     * @return mixed
+     */
+    function _eval($code, $params=null)
+    {
+        return eval($code);
+    }
+    /**#@-*/
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Config_File.class.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Config_File.class.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Config_File.class.php	(revision 1328)
@@ -0,0 +1,389 @@
+<?php
+
+/**
+ * Config_File class.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @link http://smarty.php.net/
+ * @version 2.6.13
+ * @copyright Copyright: 2001-2005 New Digital Group, Inc.
+ * @author Andrei Zmievski <andrei@php.net>
+ * @access public
+ * @package Smarty
+ */
+
+/* $Id$ */
+
+/**
+ * Config file reading class
+ * @package Smarty
+ */
+class Config_File {
+    /**#@+
+     * Options
+     * @var boolean
+     */
+    /**
+     * Controls whether variables with the same name overwrite each other.
+     */
+    var $overwrite        =    true;
+
+    /**
+     * Controls whether config values of on/true/yes and off/false/no get
+     * converted to boolean values automatically.
+     */
+    var $booleanize        =    true;
+
+    /**
+     * Controls whether hidden config sections/vars are read from the file.
+     */
+    var $read_hidden     =    true;
+
+    /**
+     * Controls whether or not to fix mac or dos formatted newlines.
+     * If set to true, \r or \r\n will be changed to \n.
+     */
+    var $fix_newlines =    true;
+    /**#@-*/
+
+    /** @access private */
+    var $_config_path    = "";
+    var $_config_data    = array();
+    /**#@-*/
+
+    /**
+     * Constructs a new config file class.
+     *
+     * @param string $config_path (optional) path to the config files
+     */
+    function Config_File($config_path = NULL)
+    {
+        if (isset($config_path))
+            $this->set_path($config_path);
+    }
+
+
+    /**
+     * Set the path where configuration files can be found.
+     *
+     * @param string $config_path path to the config files
+     */
+    function set_path($config_path)
+    {
+        if (!empty($config_path)) {
+            if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) {
+                $this->_trigger_error_msg("Bad config file path '$config_path'");
+                return;
+            }
+            if(substr($config_path, -1) != DIRECTORY_SEPARATOR) {
+                $config_path .= DIRECTORY_SEPARATOR;
+            }
+
+            $this->_config_path = $config_path;
+        }
+    }
+
+
+    /**
+     * Retrieves config info based on the file, section, and variable name.
+     *
+     * @param string $file_name config file to get info for
+     * @param string $section_name (optional) section to get info for
+     * @param string $var_name (optional) variable to get info for
+     * @return string|array a value or array of values
+     */
+    function get($file_name, $section_name = NULL, $var_name = NULL)
+    {
+        if (empty($file_name)) {
+            $this->_trigger_error_msg('Empty config file name');
+            return;
+        } else {
+            $file_name = $this->_config_path . $file_name;
+            if (!isset($this->_config_data[$file_name]))
+                $this->load_file($file_name, false);
+        }
+
+        if (!empty($var_name)) {
+            if (empty($section_name)) {
+                return $this->_config_data[$file_name]["vars"][$var_name];
+            } else {
+                if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]))
+                    return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
+                else
+                    return array();
+            }
+        } else {
+            if (empty($section_name)) {
+                return (array)$this->_config_data[$file_name]["vars"];
+            } else {
+                if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"]))
+                    return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"];
+                else
+                    return array();
+            }
+        }
+    }
+
+
+    /**
+     * Retrieves config info based on the key.
+     *
+     * @param $file_name string config key (filename/section/var)
+     * @return string|array same as get()
+     * @uses get() retrieves information from config file and returns it
+     */
+    function &get_key($config_key)
+    {
+        list($file_name, $section_name, $var_name) = explode('/', $config_key, 3);
+        $result = &$this->get($file_name, $section_name, $var_name);
+        return $result;
+    }
+
+    /**
+     * Get all loaded config file names.
+     *
+     * @return array an array of loaded config file names
+     */
+    function get_file_names()
+    {
+        return array_keys($this->_config_data);
+    }
+
+
+    /**
+     * Get all section names from a loaded file.
+     *
+     * @param string $file_name config file to get section names from
+     * @return array an array of section names from the specified file
+     */
+    function get_section_names($file_name)
+    {
+        $file_name = $this->_config_path . $file_name;
+        if (!isset($this->_config_data[$file_name])) {
+            $this->_trigger_error_msg("Unknown config file '$file_name'");
+            return;
+        }
+
+        return array_keys($this->_config_data[$file_name]["sections"]);
+    }
+
+
+    /**
+     * Get all global or section variable names.
+     *
+     * @param string $file_name config file to get info for
+     * @param string $section_name (optional) section to get info for
+     * @return array an array of variables names from the specified file/section
+     */
+    function get_var_names($file_name, $section = NULL)
+    {
+        if (empty($file_name)) {
+            $this->_trigger_error_msg('Empty config file name');
+            return;
+        } else if (!isset($this->_config_data[$file_name])) {
+            $this->_trigger_error_msg("Unknown config file '$file_name'");
+            return;
+        }
+
+        if (empty($section))
+            return array_keys($this->_config_data[$file_name]["vars"]);
+        else
+            return array_keys($this->_config_data[$file_name]["sections"][$section]["vars"]);
+    }
+
+
+    /**
+     * Clear loaded config data for a certain file or all files.
+     *
+     * @param string $file_name file to clear config data for
+     */
+    function clear($file_name = NULL)
+    {
+        if ($file_name === NULL)
+            $this->_config_data = array();
+        else if (isset($this->_config_data[$file_name]))
+            $this->_config_data[$file_name] = array();
+    }
+
+
+    /**
+     * Load a configuration file manually.
+     *
+     * @param string $file_name file name to load
+     * @param boolean $prepend_path whether current config path should be
+     *                              prepended to the filename
+     */
+    function load_file($file_name, $prepend_path = true)
+    {
+        if ($prepend_path && $this->_config_path != "")
+            $config_file = $this->_config_path . $file_name;
+        else
+            $config_file = $file_name;
+
+        ini_set('track_errors', true);
+        $fp = @fopen($config_file, "r");
+        if (!is_resource($fp)) {
+            $this->_trigger_error_msg("Could not open config file '$config_file'");
+            return false;
+        }
+
+        $contents = ($size = filesize($config_file)) ? fread($fp, $size) : '';
+        fclose($fp);
+
+        $this->_config_data[$config_file] = $this->parse_contents($contents);
+        return true;
+    }
+
+    /**
+     * Store the contents of a file manually.
+     *
+     * @param string $config_file file name of the related contents
+     * @param string $contents the file-contents to parse
+     */
+    function set_file_contents($config_file, $contents)
+    {
+        $this->_config_data[$config_file] = $this->parse_contents($contents);
+        return true;
+    }
+
+    /**
+     * parse the source of a configuration file manually.
+     *
+     * @param string $contents the file-contents to parse
+     */
+    function parse_contents($contents)
+    {
+        if($this->fix_newlines) {
+            // fix mac/dos formatted newlines
+            $contents = preg_replace('!\r\n?!', "\n", $contents);
+        }
+
+        $config_data = array();
+        $config_data['sections'] = array();
+        $config_data['vars'] = array();
+
+        /* reference to fill with data */
+        $vars =& $config_data['vars'];
+
+        /* parse file line by line */
+        preg_match_all('!^.*\r?\n?!m', $contents, $match);
+        $lines = $match[0];
+        for ($i=0, $count=count($lines); $i<$count; $i++) {
+            $line = $lines[$i];
+            if (empty($line)) continue;
+
+            if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) {
+                /* section found */
+                if (substr($match[1], 0, 1) == '.') {
+                    /* hidden section */
+                    if ($this->read_hidden) {
+                        $section_name = substr($match[1], 1);
+                    } else {
+                        /* break reference to $vars to ignore hidden section */
+                        unset($vars);
+                        $vars = array();
+                        continue;
+                    }
+                } else {                    
+                    $section_name = $match[1];
+                }
+                if (!isset($config_data['sections'][$section_name]))
+                    $config_data['sections'][$section_name] = array('vars' => array());
+                $vars =& $config_data['sections'][$section_name]['vars'];
+                continue;
+            }
+
+            if (preg_match('/^\s*(\.?\w+)\s*=\s*(.*)/s', $line, $match)) {
+                /* variable found */
+                $var_name = rtrim($match[1]);
+                if (strpos($match[2], '"""') === 0) {
+                    /* handle multiline-value */
+                    $lines[$i] = substr($match[2], 3);
+                    $var_value = '';
+                    while ($i<$count) {
+                        if (($pos = strpos($lines[$i], '"""')) === false) {
+                            $var_value .= $lines[$i++];
+                        } else {
+                            /* end of multiline-value */
+                            $var_value .= substr($lines[$i], 0, $pos);
+                            break;
+                        }
+                    }
+                    $booleanize = false;
+
+                } else {
+                    /* handle simple value */
+                    $var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', rtrim($match[2]));
+                    $booleanize = $this->booleanize;
+
+                }
+                $this->_set_config_var($vars, $var_name, $var_value, $booleanize);
+            }
+            /* else unparsable line / means it is a comment / means ignore it */
+        }
+        return $config_data;
+    }
+
+    /**#@+ @access private */
+    /**
+     * @param array &$container
+     * @param string $var_name
+     * @param mixed $var_value
+     * @param boolean $booleanize determines whether $var_value is converted to
+     *                            to true/false
+     */
+    function _set_config_var(&$container, $var_name, $var_value, $booleanize)
+    {
+        if (substr($var_name, 0, 1) == '.') {
+            if (!$this->read_hidden)
+                return;
+            else
+                $var_name = substr($var_name, 1);
+        }
+
+        if (!preg_match("/^[a-zA-Z_]\w*$/", $var_name)) {
+            $this->_trigger_error_msg("Bad variable name '$var_name'");
+            return;
+        }
+
+        if ($booleanize) {
+            if (preg_match("/^(on|true|yes)$/i", $var_value))
+                $var_value = true;
+            else if (preg_match("/^(off|false|no)$/i", $var_value))
+                $var_value = false;
+        }
+
+        if (!isset($container[$var_name]) || $this->overwrite)
+            $container[$var_name] = $var_value;
+        else {
+            settype($container[$var_name], 'array');
+            $container[$var_name][] = $var_value;
+        }
+    }
+
+    /**
+     * @uses trigger_error() creates a PHP warning/error
+     * @param string $error_msg
+     * @param integer $error_type one of
+     */
+    function _trigger_error_msg($error_msg, $error_type = E_USER_WARNING)
+    {
+        trigger_error("Config_File error: $error_msg", $error_type);
+    }
+    /**#@-*/
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.rmdir.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.rmdir.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.rmdir.php	(revision 1328)
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * delete a dir recursively (level=0 -> keep root)
+ * WARNING: no tests, it will try to remove what you tell it!
+ *
+ * @param string $dirname
+ * @param integer $level
+ * @param integer $exp_time
+ * @return boolean
+ */
+
+//  $dirname, $level = 1, $exp_time = null
+
+function smarty_core_rmdir($params, &$smarty)
+{
+   if(!isset($params['level'])) { $params['level'] = 1; }
+   if(!isset($params['exp_time'])) { $params['exp_time'] = null; }
+
+   if($_handle = @opendir($params['dirname'])) {
+
+        while (false !== ($_entry = readdir($_handle))) {
+            if ($_entry != '.' && $_entry != '..') {
+                if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) {
+                    $_params = array(
+                        'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry,
+                        'level' => $params['level'] + 1,
+                        'exp_time' => $params['exp_time']
+                    );
+                    smarty_core_rmdir($_params, $smarty);
+                }
+                else {
+                    $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']);
+                }
+            }
+        }
+        closedir($_handle);
+   }
+
+   if ($params['level']) {
+       return @rmdir($params['dirname']);
+   }
+   return (bool)$_handle;
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_compiled_resource.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_compiled_resource.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_compiled_resource.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * write the compiled resource
+ *
+ * @param string $compile_path
+ * @param string $compiled_content
+ * @return true
+ */
+function smarty_core_write_compiled_resource($params, &$smarty)
+{
+    if(!@is_writable($smarty->compile_dir)) {
+        // compile_dir not writable, see if it exists
+        if(!@is_dir($smarty->compile_dir)) {
+            $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
+            return false;
+        }
+        $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR);
+        return false;
+    }
+
+    $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true);
+    require_once(SMARTY_CORE_DIR . 'core.write_file.php');
+    smarty_core_write_file($_params, $smarty);
+    return true;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.load_plugins.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.load_plugins.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.load_plugins.php	(revision 1328)
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Load requested plugins
+ *
+ * @param array $plugins
+ */
+
+// $plugins
+
+function smarty_core_load_plugins($params, &$smarty)
+{
+
+    foreach ($params['plugins'] as $_plugin_info) {
+        list($_type, $_name, $_tpl_file, $_tpl_line, $_delayed_loading) = $_plugin_info;
+        $_plugin = &$smarty->_plugins[$_type][$_name];
+
+        /*
+         * We do not load plugin more than once for each instance of Smarty.
+         * The following code checks for that. The plugin can also be
+         * registered dynamically at runtime, in which case template file
+         * and line number will be unknown, so we fill them in.
+         *
+         * The final element of the info array is a flag that indicates
+         * whether the dynamically registered plugin function has been
+         * checked for existence yet or not.
+         */
+        if (isset($_plugin)) {
+            if (empty($_plugin[3])) {
+                if (!is_callable($_plugin[0])) {
+                    $smarty->_trigger_fatal_error("[plugin] $_type '$_name' is not implemented", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
+                } else {
+                    $_plugin[1] = $_tpl_file;
+                    $_plugin[2] = $_tpl_line;
+                    $_plugin[3] = true;
+                    if (!isset($_plugin[4])) $_plugin[4] = true; /* cacheable */
+                }
+            }
+            continue;
+        } else if ($_type == 'insert') {
+            /*
+             * For backwards compatibility, we check for insert functions in
+             * the symbol table before trying to load them as a plugin.
+             */
+            $_plugin_func = 'insert_' . $_name;
+            if (function_exists($_plugin_func)) {
+                $_plugin = array($_plugin_func, $_tpl_file, $_tpl_line, true, false);
+                continue;
+            }
+        }
+
+        $_plugin_file = $smarty->_get_plugin_filepath($_type, $_name);
+
+        if (! $_found = ($_plugin_file != false)) {
+            $_message = "could not load plugin file '$_type.$_name.php'\n";
+        }
+
+        /*
+         * If plugin file is found, it -must- provide the properly named
+         * plugin function. In case it doesn't, simply output the error and
+         * do not fall back on any other method.
+         */
+        if ($_found) {
+            include_once $_plugin_file;
+
+            $_plugin_func = 'smarty_' . $_type . '_' . $_name;
+            if (!function_exists($_plugin_func)) {
+                $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", $_tpl_file, $_tpl_line, __FILE__, __LINE__);
+                continue;
+            }
+        }
+        /*
+         * In case of insert plugins, their code may be loaded later via
+         * 'script' attribute.
+         */
+        else if ($_type == 'insert' && $_delayed_loading) {
+            $_plugin_func = 'smarty_' . $_type . '_' . $_name;
+            $_found = true;
+        }
+
+        /*
+         * Plugin specific processing and error checking.
+         */
+        if (!$_found) {
+            if ($_type == 'modifier') {
+                /*
+                 * In case modifier falls back on using PHP functions
+                 * directly, we only allow those specified in the security
+                 * context.
+                 */
+                if ($smarty->security && !in_array($_name, $smarty->security_settings['MODIFIER_FUNCS'])) {
+                    $_message = "(secure mode) modifier '$_name' is not allowed";
+                } else {
+                    if (!function_exists($_name)) {
+                        $_message = "modifier '$_name' is not implemented";
+                    } else {
+                        $_plugin_func = $_name;
+                        $_found = true;
+                    }
+                }
+            } else if ($_type == 'function') {
+                /*
+                 * This is a catch-all situation.
+                 */
+                $_message = "unknown tag - '$_name'";
+            }
+        }
+
+        if ($_found) {
+            $smarty->_plugins[$_type][$_name] = array($_plugin_func, $_tpl_file, $_tpl_line, true, true);
+        } else {
+            // output error
+            $smarty->_trigger_fatal_error('[plugin] ' . $_message, $_tpl_file, $_tpl_line, __FILE__, __LINE__);
+        }
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.create_dir_structure.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.create_dir_structure.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.create_dir_structure.php	(revision 1328)
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * create full directory structure
+ *
+ * @param string $dir
+ */
+
+// $dir
+
+function smarty_core_create_dir_structure($params, &$smarty)
+{
+    if (!file_exists($params['dir'])) {
+        $_open_basedir_ini = ini_get('open_basedir');
+
+        if (DIRECTORY_SEPARATOR=='/') {
+            /* unix-style paths */
+            $_dir = $params['dir'];
+            $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
+            $_new_dir = (substr($_dir, 0, 1)=='/') ? '/' : getcwd().'/';
+            if($_use_open_basedir = !empty($_open_basedir_ini)) {
+                $_open_basedirs = explode(':', $_open_basedir_ini);
+            }
+
+        } else {
+            /* other-style paths */
+            $_dir = str_replace('\\','/', $params['dir']);
+            $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
+            if (preg_match('!^((//)|([a-zA-Z]:/))!', $_dir, $_root_dir)) {
+                /* leading "//" for network volume, or "[letter]:/" for full path */
+                $_new_dir = $_root_dir[1];
+                /* remove drive-letter from _dir_parts */
+                if (isset($_root_dir[3])) array_shift($_dir_parts);
+
+            } else {
+                $_new_dir = str_replace('\\', '/', getcwd()).'/';
+
+            }
+
+            if($_use_open_basedir = !empty($_open_basedir_ini)) {
+                $_open_basedirs = explode(';', str_replace('\\', '/', $_open_basedir_ini));
+            }
+
+        }
+
+        /* all paths use "/" only from here */
+        foreach ($_dir_parts as $_dir_part) {
+            $_new_dir .= $_dir_part;
+
+            if ($_use_open_basedir) {
+                // do not attempt to test or make directories outside of open_basedir
+                $_make_new_dir = false;
+                foreach ($_open_basedirs as $_open_basedir) {
+                    if (substr($_new_dir, 0, strlen($_open_basedir)) == $_open_basedir) {
+                        $_make_new_dir = true;
+                        break;
+                    }
+                }
+            } else {
+                $_make_new_dir = true;
+            }
+
+            if ($_make_new_dir && !file_exists($_new_dir) && !@mkdir($_new_dir, $smarty->_dir_perms) && !is_dir($_new_dir)) {
+                $smarty->trigger_error("problem creating directory '" . $_new_dir . "'");
+                return false;
+            }
+            $_new_dir .= '/';
+        }
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.is_secure.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.is_secure.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.is_secure.php	(revision 1328)
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * determines if a resource is secure or not.
+ *
+ * @param string $resource_type
+ * @param string $resource_name
+ * @return boolean
+ */
+
+//  $resource_type, $resource_name
+
+function smarty_core_is_secure($params, &$smarty)
+{
+    if (!$smarty->security || $smarty->security_settings['INCLUDE_ANY']) {
+        return true;
+    }
+
+    if ($params['resource_type'] == 'file') {
+        $_rp = realpath($params['resource_name']);
+        if (isset($params['resource_base_path'])) {
+            foreach ((array)$params['resource_base_path'] as $curr_dir) {
+                if ( ($_cd = realpath($curr_dir)) !== false &&
+                     strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
+                     substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
+                    return true;
+                }
+            }
+        }
+        if (!empty($smarty->secure_dir)) {
+            foreach ((array)$smarty->secure_dir as $curr_dir) {
+                if ( ($_cd = realpath($curr_dir)) !== false) {
+                    if($_cd == $_rp) {
+                        return true;
+                    } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
+                        substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) {
+                        return true;
+                    }
+                }
+            }
+        }
+    } else {
+        // resource is not on local file system
+        return call_user_func_array(
+            $smarty->_plugins['resource'][$params['resource_type']][0][2],
+            array($params['resource_name'], &$smarty));
+    }
+
+    return false;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.run_insert_handler.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.run_insert_handler.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.run_insert_handler.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Handle insert tags
+ *
+ * @param array $args
+ * @return string
+ */
+function smarty_core_run_insert_handler($params, &$smarty)
+{
+
+    require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+    if ($smarty->debugging) {
+        $_params = array();
+        $_debug_start_time = smarty_core_get_microtime($_params, $smarty);
+    }
+
+    if ($smarty->caching) {
+        $_arg_string = serialize($params['args']);
+        $_name = $params['args']['name'];
+        if (!isset($smarty->_cache_info['insert_tags'][$_name])) {
+            $smarty->_cache_info['insert_tags'][$_name] = array('insert',
+                                                             $_name,
+                                                             $smarty->_plugins['insert'][$_name][1],
+                                                             $smarty->_plugins['insert'][$_name][2],
+                                                             !empty($params['args']['script']) ? true : false);
+        }
+        return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5;
+    } else {
+        if (isset($params['args']['script'])) {
+            $_params = array('resource_name' => $smarty->_dequote($params['args']['script']));
+            require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
+            if(!smarty_core_get_php_resource($_params, $smarty)) {
+                return false;
+            }
+
+            if ($_params['resource_type'] == 'file') {
+                $smarty->_include($_params['php_resource'], true);
+            } else {
+                $smarty->_eval($_params['php_resource']);
+            }
+            unset($params['args']['script']);
+        }
+
+        $_funcname = $smarty->_plugins['insert'][$params['args']['name']][0];
+        $_content = $_funcname($params['args'], $smarty);
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $smarty->_smarty_debug_info[] = array('type'      => 'insert',
+                                                'filename'  => 'insert_'.$params['args']['name'],
+                                                'depth'     => $smarty->_inclusion_depth,
+                                                'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
+        }
+
+        if (!empty($params['args']["assign"])) {
+            $smarty->assign($params['args']["assign"], $_content);
+        } else {
+            return $_content;
+        }
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.assemble_plugin_filepath.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.assemble_plugin_filepath.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.assemble_plugin_filepath.php	(revision 1328)
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * assemble filepath of requested plugin
+ *
+ * @param string $type
+ * @param string $name
+ * @return string|false
+ */
+function smarty_core_assemble_plugin_filepath($params, &$smarty)
+{
+    static $_filepaths_cache = array();
+
+    $_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
+    if (isset($_filepaths_cache[$_plugin_filename])) {
+        return $_filepaths_cache[$_plugin_filename];
+    }
+    $_return = false;
+
+    foreach ((array)$smarty->plugins_dir as $_plugin_dir) {
+
+        $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
+
+        // see if path is relative
+        if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
+            $_relative_paths[] = $_plugin_dir;
+            // relative path, see if it is in the SMARTY_DIR
+            if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
+                $_return = SMARTY_DIR . $_plugin_filepath;
+                break;
+            }
+        }
+        // try relative to cwd (or absolute)
+        if (@is_readable($_plugin_filepath)) {
+            $_return = $_plugin_filepath;
+            break;
+        }
+    }
+
+    if($_return === false) {
+        // still not found, try PHP include_path
+        if(isset($_relative_paths)) {
+            foreach ((array)$_relative_paths as $_plugin_dir) {
+
+                $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
+
+                $_params = array('file_path' => $_plugin_filepath);
+                require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
+                if(smarty_core_get_include_path($_params, $smarty)) {
+                    $_return = $_params['new_file_path'];
+                    break;
+                }
+            }
+        }
+    }
+    $_filepaths_cache[$_plugin_filename] = $_return;
+    return $_return;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.is_trusted.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.is_trusted.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.is_trusted.php	(revision 1328)
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * determines if a resource is trusted or not
+ *
+ * @param string $resource_type
+ * @param string $resource_name
+ * @return boolean
+ */
+
+ // $resource_type, $resource_name
+
+function smarty_core_is_trusted($params, &$smarty)
+{
+    $_smarty_trusted = false;
+    if ($params['resource_type'] == 'file') {
+        if (!empty($smarty->trusted_dir)) {
+            $_rp = realpath($params['resource_name']);
+            foreach ((array)$smarty->trusted_dir as $curr_dir) {
+                if (!empty($curr_dir) && is_readable ($curr_dir)) {
+                    $_cd = realpath($curr_dir);
+                    if (strncmp($_rp, $_cd, strlen($_cd)) == 0
+                        && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
+                        $_smarty_trusted = true;
+                        break;
+                    }
+                }
+            }
+        }
+
+    } else {
+        // resource is not on local file system
+        $_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3],
+                                                array($params['resource_name'], $smarty));
+    }
+
+    return $_smarty_trusted;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_microtime.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_microtime.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_microtime.php	(revision 1328)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Get seconds and microseconds
+ * @return double
+ */
+function smarty_core_get_microtime($params, &$smarty)
+{
+    $mtime = microtime();
+    $mtime = explode(" ", $mtime);
+    $mtime = (double)($mtime[1]) + (double)($mtime[0]);
+    return ($mtime);
+}
+
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_file.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_file.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_file.php	(revision 1328)
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * write out a file to disk
+ *
+ * @param string $filename
+ * @param string $contents
+ * @param boolean $create_dirs
+ * @return boolean
+ */
+function smarty_core_write_file($params, &$smarty)
+{
+    $_dirname = dirname($params['filename']);
+
+    if ($params['create_dirs']) {
+        $_params = array('dir' => $_dirname);
+        require_once(SMARTY_CORE_DIR . 'core.create_dir_structure.php');
+        smarty_core_create_dir_structure($_params, $smarty);
+    }
+
+    // write to tmp file, then rename it to avoid
+    // file locking race condition
+    $_tmp_file = tempnam($_dirname, 'wrt');
+
+    if (!($fd = @fopen($_tmp_file, 'wb'))) {
+        $_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('wrt');
+        if (!($fd = @fopen($_tmp_file, 'wb'))) {
+            $smarty->trigger_error("problem writing temporary file '$_tmp_file'");
+            return false;
+        }
+    }
+
+    fwrite($fd, $params['contents']);
+    fclose($fd);
+
+    // Delete the file if it allready exists (this is needed on Win,
+    // because it cannot overwrite files with rename()
+    if (file_exists($params['filename'])) {
+        @unlink($params['filename']);
+    }
+    @rename($_tmp_file, $params['filename']);
+    @chmod($params['filename'], $smarty->_file_perms);
+
+    return true;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.smarty_include_php.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.smarty_include_php.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.smarty_include_php.php	(revision 1328)
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * called for included php files within templates
+ *
+ * @param string $smarty_file
+ * @param string $smarty_assign variable to assign the included template's
+ *               output into
+ * @param boolean $smarty_once uses include_once if this is true
+ * @param array $smarty_include_vars associative array of vars from
+ *              {include file="blah" var=$var}
+ */
+
+//  $file, $assign, $once, $_smarty_include_vars
+
+function smarty_core_smarty_include_php($params, &$smarty)
+{
+    $_params = array('resource_name' => $params['smarty_file']);
+    require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
+    smarty_core_get_php_resource($_params, $smarty);
+    $_smarty_resource_type = $_params['resource_type'];
+    $_smarty_php_resource = $_params['php_resource'];
+
+    if (!empty($params['smarty_assign'])) {
+        ob_start();
+        if ($_smarty_resource_type == 'file') {
+            $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
+        } else {
+            $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
+        }
+        $smarty->assign($params['smarty_assign'], ob_get_contents());
+        ob_end_clean();
+    } else {
+        if ($_smarty_resource_type == 'file') {
+            $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
+        } else {
+            $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
+        }
+    }
+}
+
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.display_debug_console.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.display_debug_console.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.display_debug_console.php	(revision 1328)
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty debug_console function plugin
+ *
+ * Type:     core<br>
+ * Name:     display_debug_console<br>
+ * Purpose:  display the javascript debug console window
+ * @param array Format: null
+ * @param Smarty
+ */
+function smarty_core_display_debug_console($params, &$smarty)
+{
+    // we must force compile the debug template in case the environment
+    // changed between separate applications.
+
+    if(empty($smarty->debug_tpl)) {
+        // set path to debug template from SMARTY_DIR
+        $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
+        if($smarty->security && is_file($smarty->debug_tpl)) {
+            $smarty->secure_dir[] = realpath($smarty->debug_tpl);
+        }
+        $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
+    }
+
+    $_ldelim_orig = $smarty->left_delimiter;
+    $_rdelim_orig = $smarty->right_delimiter;
+
+    $smarty->left_delimiter = '{';
+    $smarty->right_delimiter = '}';
+
+    $_compile_id_orig = $smarty->_compile_id;
+    $smarty->_compile_id = null;
+
+    $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
+    if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path))
+    {
+        ob_start();
+        $smarty->_include($_compile_path);
+        $_results = ob_get_contents();
+        ob_end_clean();
+    } else {
+        $_results = '';
+    }
+
+    $smarty->_compile_id = $_compile_id_orig;
+
+    $smarty->left_delimiter = $_ldelim_orig;
+    $smarty->right_delimiter = $_rdelim_orig;
+
+    return $_results;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_php_resource.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_php_resource.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_php_resource.php	(revision 1328)
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Retrieves PHP script resource
+ *
+ * sets $php_resource to the returned resource
+ * @param string $resource
+ * @param string $resource_type
+ * @param  $php_resource
+ * @return boolean
+ */
+
+function smarty_core_get_php_resource(&$params, &$smarty)
+{
+
+    $params['resource_base_path'] = $smarty->trusted_dir;
+    $smarty->_parse_resource_name($params, $smarty);
+
+    /*
+     * Find out if the resource exists.
+     */
+
+    if ($params['resource_type'] == 'file') {
+        $_readable = false;
+        if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) {
+            $_readable = true;
+        } else {
+            // test for file in include_path
+            $_params = array('file_path' => $params['resource_name']);
+            require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
+            if(smarty_core_get_include_path($_params, $smarty)) {
+                $_include_path = $_params['new_file_path'];
+                $_readable = true;
+            }
+        }
+    } else if ($params['resource_type'] != 'file') {
+        $_template_source = null;
+        $_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0])
+            && call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0],
+                                    array($params['resource_name'], &$_template_source, &$smarty));
+    }
+
+    /*
+     * Set the error function, depending on which class calls us.
+     */
+    if (method_exists($smarty, '_syntax_error')) {
+        $_error_funcc = '_syntax_error';
+    } else {
+        $_error_funcc = 'trigger_error';
+    }
+
+    if ($_readable) {
+        if ($smarty->security) {
+            require_once(SMARTY_CORE_DIR . 'core.is_trusted.php');
+            if (!smarty_core_is_trusted($params, $smarty)) {
+                $smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted');
+                return false;
+            }
+        }
+    } else {
+        $smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable');
+        return false;
+    }
+
+    if ($params['resource_type'] == 'file') {
+        $params['php_resource'] = $params['resource_name'];
+    } else {
+        $params['php_resource'] = $_template_source;
+    }
+    return true;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.process_compiled_include.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.process_compiled_include.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.process_compiled_include.php	(revision 1328)
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Replace nocache-tags by results of the corresponding non-cacheable
+ * functions and return it
+ *
+ * @param string $compiled_tpl
+ * @param string $cached_source
+ * @return string
+ */
+
+function smarty_core_process_compiled_include($params, &$smarty)
+{
+    $_cache_including = $smarty->_cache_including;
+    $smarty->_cache_including = true;
+
+    $_return = $params['results'];
+
+    foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
+        $smarty->_include($_include_file_path, true);
+    }
+
+    foreach ($smarty->_cache_serials as $_include_file_path=>$_cache_serial) {
+        $_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s',
+                                         array(&$smarty, '_process_compiled_include_callback'),
+                                         $_return);
+    }
+    $smarty->_cache_including = $_cache_including;
+    return $_return;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.read_cache_file.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.read_cache_file.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.read_cache_file.php	(revision 1328)
@@ -0,0 +1,101 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * read a cache file, determine if it needs to be
+ * regenerated or not
+ *
+ * @param string $tpl_file
+ * @param string $cache_id
+ * @param string $compile_id
+ * @param string $results
+ * @return boolean
+ */
+
+//  $tpl_file, $cache_id, $compile_id, &$results
+
+function smarty_core_read_cache_file(&$params, &$smarty)
+{
+    static  $content_cache = array();
+
+    if ($smarty->force_compile) {
+        // force compile enabled, always regenerate
+        return false;
+    }
+
+    if (isset($content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']])) {
+        list($params['results'], $smarty->_cache_info) = $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']];
+        return true;
+    }
+
+    if (!empty($smarty->cache_handler_func)) {
+        // use cache_handler function
+        call_user_func_array($smarty->cache_handler_func,
+                             array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null));
+    } else {
+        // use local cache file
+        $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']);
+        $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id);
+        $params['results'] = $smarty->_read_file($_cache_file);
+    }
+
+    if (empty($params['results'])) {
+        // nothing to parse (error?), regenerate cache
+        return false;
+    }
+
+    $_contents = $params['results'];
+    $_info_start = strpos($_contents, "\n") + 1;
+    $_info_len = (int)substr($_contents, 0, $_info_start - 1);
+    $_cache_info = unserialize(substr($_contents, $_info_start, $_info_len));
+    $params['results'] = substr($_contents, $_info_start + $_info_len);
+
+    if ($smarty->caching == 2 && isset ($_cache_info['expires'])){
+        // caching by expiration time
+        if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) {
+            // cache expired, regenerate
+            return false;
+        }
+    } else {
+        // caching by lifetime
+        if ($smarty->cache_lifetime > -1 && (time() - $_cache_info['timestamp'] > $smarty->cache_lifetime)) {
+            // cache expired, regenerate
+            return false;
+        }
+    }
+
+    if ($smarty->compile_check) {
+        $_params = array('get_source' => false, 'quiet'=>true);
+        foreach (array_keys($_cache_info['template']) as $_template_dep) {
+            $_params['resource_name'] = $_template_dep;
+            if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) {
+                // template file has changed, regenerate cache
+                return false;
+            }
+        }
+
+        if (isset($_cache_info['config'])) {
+            $_params = array('resource_base_path' => $smarty->config_dir, 'get_source' => false, 'quiet'=>true);
+            foreach (array_keys($_cache_info['config']) as $_config_dep) {
+                $_params['resource_name'] = $_config_dep;
+                if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) {
+                    // config file has changed, regenerate cache
+                    return false;
+                }
+            }
+        }
+    }
+
+    $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info);
+
+    $smarty->_cache_info = $_cache_info;
+    return true;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_include_path.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_include_path.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.get_include_path.php	(revision 1328)
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Get path to file from include_path
+ *
+ * @param string $file_path
+ * @param string $new_file_path
+ * @return boolean
+ * @staticvar array|null
+ */
+
+//  $file_path, &$new_file_path
+
+function smarty_core_get_include_path(&$params, &$smarty)
+{
+    static $_path_array = null;
+
+    if(!isset($_path_array)) {
+        $_ini_include_path = ini_get('include_path');
+
+        if(strstr($_ini_include_path,';')) {
+            // windows pathnames
+            $_path_array = explode(';',$_ini_include_path);
+        } else {
+            $_path_array = explode(':',$_ini_include_path);
+        }
+    }
+    foreach ($_path_array as $_include_path) {
+        if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) {
+               $params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
+            return true;
+        }
+    }
+    return false;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.assign_smarty_interface.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.assign_smarty_interface.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.assign_smarty_interface.php	(revision 1328)
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty assign_smarty_interface core plugin
+ *
+ * Type:     core<br>
+ * Name:     assign_smarty_interface<br>
+ * Purpose:  assign the $smarty interface variable
+ * @param array Format: null
+ * @param Smarty
+ */
+function smarty_core_assign_smarty_interface($params, &$smarty)
+{
+        if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) {
+            return;
+        }
+
+        $_globals_map = array('g'  => 'HTTP_GET_VARS',
+                             'p'  => 'HTTP_POST_VARS',
+                             'c'  => 'HTTP_COOKIE_VARS',
+                             's'  => 'HTTP_SERVER_VARS',
+                             'e'  => 'HTTP_ENV_VARS');
+
+        $_smarty_vars_request  = array();
+
+        foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) {
+            if (isset($_globals_map[$_c])) {
+                $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]);
+            }
+        }
+        $_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']);
+
+        $smarty->_smarty_vars['request'] = $_smarty_vars_request;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.load_resource_plugin.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.load_resource_plugin.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.load_resource_plugin.php	(revision 1328)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * load a resource plugin
+ *
+ * @param string $type
+ */
+
+// $type
+
+function smarty_core_load_resource_plugin($params, &$smarty)
+{
+    /*
+     * Resource plugins are not quite like the other ones, so they are
+     * handled differently. The first element of plugin info is the array of
+     * functions provided by the plugin, the second one indicates whether
+     * all of them exist or not.
+     */
+
+    $_plugin = &$smarty->_plugins['resource'][$params['type']];
+    if (isset($_plugin)) {
+        if (!$_plugin[1] && count($_plugin[0])) {
+            $_plugin[1] = true;
+            foreach ($_plugin[0] as $_plugin_func) {
+                if (!is_callable($_plugin_func)) {
+                    $_plugin[1] = false;
+                    break;
+                }
+            }
+        }
+
+        if (!$_plugin[1]) {
+            $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__);
+        }
+
+        return;
+    }
+
+    $_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']);
+    $_found = ($_plugin_file != false);
+
+    if ($_found) {            /*
+         * If the plugin file is found, it -must- provide the properly named
+         * plugin functions.
+         */
+        include_once($_plugin_file);
+
+        /*
+         * Locate functions that we require the plugin to provide.
+         */
+        $_resource_ops = array('source', 'timestamp', 'secure', 'trusted');
+        $_resource_funcs = array();
+        foreach ($_resource_ops as $_op) {
+            $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;
+            if (!function_exists($_plugin_func)) {
+                $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__);
+                return;
+            } else {
+                $_resource_funcs[] = $_plugin_func;
+            }
+        }
+
+        $smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true);
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.rm_auto.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.rm_auto.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.rm_auto.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * delete an automagically created file by name and id
+ *
+ * @param string $auto_base
+ * @param string $auto_source
+ * @param string $auto_id
+ * @param integer $exp_time
+ * @return boolean
+ */
+
+// $auto_base, $auto_source = null, $auto_id = null, $exp_time = null
+
+function smarty_core_rm_auto($params, &$smarty)
+{
+    if (!@is_dir($params['auto_base']))
+      return false;
+
+    if(!isset($params['auto_id']) && !isset($params['auto_source'])) {
+        $_params = array(
+            'dirname' => $params['auto_base'],
+            'level' => 0,
+            'exp_time' => $params['exp_time']
+        );
+        require_once(SMARTY_CORE_DIR . 'core.rmdir.php');
+        $_res = smarty_core_rmdir($_params, $smarty);
+    } else {
+        $_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']);
+
+        if(isset($params['auto_source'])) {
+            if (isset($params['extensions'])) {
+                $_res = false;
+                foreach ((array)$params['extensions'] as $_extension)
+                    $_res |= $smarty->_unlink($_tname.$_extension, $params['exp_time']);
+            } else {
+                $_res = $smarty->_unlink($_tname, $params['exp_time']);
+            }
+        } elseif ($smarty->use_sub_dirs) {
+            $_params = array(
+                'dirname' => $_tname,
+                'level' => 1,
+                'exp_time' => $params['exp_time']
+            );
+            require_once(SMARTY_CORE_DIR . 'core.rmdir.php');
+            $_res = smarty_core_rmdir($_params, $smarty);
+        } else {
+            // remove matching file names
+            $_handle = opendir($params['auto_base']);
+            $_res = true;
+            while (false !== ($_filename = readdir($_handle))) {
+                if($_filename == '.' || $_filename == '..') {
+                    continue;
+                } elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) {
+                    $_res &= (bool)$smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']);
+                }
+            }
+        }
+    }
+
+    return $_res;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_compiled_include.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_compiled_include.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_compiled_include.php	(revision 1328)
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Extract non-cacheable parts out of compiled template and write it
+ *
+ * @param string $compile_path
+ * @param string $template_compiled
+ * @return boolean
+ */
+
+function smarty_core_write_compiled_include($params, &$smarty)
+{
+    $_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; \};';
+    $_tag_end   = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{/nocache\:(\\2)#(\\3)\}\'; \};';
+
+    preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us',
+                   $params['compiled_content'], $_match_source, PREG_SET_ORDER);
+
+    // no nocache-parts found: done
+    if (count($_match_source)==0) return;
+
+    // convert the matched php-code to functions
+    $_include_compiled =  "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
+    $_include_compiled .= "         compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n";
+
+    $_compile_path = $params['include_file_path'];
+
+    $smarty->_cache_serials[$_compile_path] = $params['cache_serial'];
+    $_include_compiled .= "\$this->_cache_serials['".$_compile_path."'] = '".$params['cache_serial']."';\n\n?>";
+
+    $_include_compiled .= $params['plugins_code'];
+    $_include_compiled .= "<?php";
+
+    $this_varname = ((double)phpversion() >= 5.0) ? '_smarty' : 'this';
+    for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) {
+        $_match =& $_match_source[$_i];
+        $source = $_match[4];
+        if ($this_varname == '_smarty') {
+            /* rename $this to $_smarty in the sourcecode */
+            $tokens = token_get_all('<?php ' . $_match[4]);
+
+            /* remove trailing <?php */
+            $open_tag = '';
+            while ($tokens) {
+                $token = array_shift($tokens);
+                if (is_array($token)) {
+                    $open_tag .= $token[1];
+                } else {
+                    $open_tag .= $token;
+                }
+                if ($open_tag == '<?php ') break;
+            }
+
+            for ($i=0, $count = count($tokens); $i < $count; $i++) {
+                if (is_array($tokens[$i])) {
+                    if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') {
+                        $tokens[$i] = '$' . $this_varname;
+                    } else {
+                        $tokens[$i] = $tokens[$i][1];
+                    }                   
+                }
+            }
+            $source = implode('', $tokens);
+        }
+
+        /* add function to compiled include */
+        $_include_compiled .= "
+function _smarty_tplfunc_$_match[2]_$_match[3](&\$$this_varname)
+{
+$source
+}
+
+";
+    }
+    $_include_compiled .= "\n\n?>\n";
+
+    $_params = array('filename' => $_compile_path,
+                     'contents' => $_include_compiled, 'create_dirs' => true);
+
+    require_once(SMARTY_CORE_DIR . 'core.write_file.php');
+    smarty_core_write_file($_params, $smarty);
+    return true;
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.process_cached_inserts.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.process_cached_inserts.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.process_cached_inserts.php	(revision 1328)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Replace cached inserts with the actual results
+ *
+ * @param string $results
+ * @return string
+ */
+function smarty_core_process_cached_inserts($params, &$smarty)
+{
+    preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
+                   $params['results'], $match);
+    list($cached_inserts, $insert_args) = $match;
+
+    for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $debug_start_time = smarty_core_get_microtime($_params, $smarty);
+        }
+
+        $args = unserialize($insert_args[$i]);
+        $name = $args['name'];
+
+        if (isset($args['script'])) {
+            $_params = array('resource_name' => $smarty->_dequote($args['script']));
+            require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
+            if(!smarty_core_get_php_resource($_params, $smarty)) {
+                return false;
+            }
+            $resource_type = $_params['resource_type'];
+            $php_resource = $_params['php_resource'];
+
+
+            if ($resource_type == 'file') {
+                $smarty->_include($php_resource, true);
+            } else {
+                $smarty->_eval($php_resource);
+            }
+        }
+
+        $function_name = $smarty->_plugins['insert'][$name][0];
+        if (empty($args['assign'])) {
+            $replace = $function_name($args, $smarty);
+        } else {
+            $smarty->assign($args['assign'], $function_name($args, $smarty));
+            $replace = '';
+        }
+
+        $params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i]));
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $smarty->_smarty_debug_info[] = array('type'      => 'insert',
+                                                'filename'  => 'insert_'.$name,
+                                                'depth'     => $smarty->_inclusion_depth,
+                                                'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);
+        }
+    }
+
+    return $params['results'];
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_cache_file.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_cache_file.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/internals/core.write_cache_file.php	(revision 1328)
@@ -0,0 +1,96 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Prepend the cache information to the cache file
+ * and write it
+ *
+ * @param string $tpl_file
+ * @param string $cache_id
+ * @param string $compile_id
+ * @param string $results
+ * @return true|null
+ */
+
+ // $tpl_file, $cache_id, $compile_id, $results
+
+function smarty_core_write_cache_file($params, &$smarty)
+{
+
+    // put timestamp in cache header
+    $smarty->_cache_info['timestamp'] = time();
+    if ($smarty->cache_lifetime > -1){
+        // expiration set
+        $smarty->_cache_info['expires'] = $smarty->_cache_info['timestamp'] + $smarty->cache_lifetime;
+    } else {
+        // cache will never expire
+        $smarty->_cache_info['expires'] = -1;
+    }
+
+    // collapse nocache.../nocache-tags
+    if (preg_match_all('!\{(/?)nocache\:[0-9a-f]{32}#\d+\}!', $params['results'], $match, PREG_PATTERN_ORDER)) {
+        // remove everything between every pair of outermost noache.../nocache-tags
+        // and replace it by a single nocache-tag
+        // this new nocache-tag will be replaced by dynamic contents in
+        // smarty_core_process_compiled_includes() on a cache-read
+        
+        $match_count = count($match[0]);
+        $results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_SPLIT_DELIM_CAPTURE);
+        
+        $level = 0;
+        $j = 0;
+        for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) {
+            if ($results[$i] == $match[0][$j]) {
+                // nocache tag
+                if ($match[1][$j]) { // closing tag
+                    $level--;
+                    unset($results[$i]);
+                } else { // opening tag
+                    if ($level++ > 0) unset($results[$i]);
+                }
+                $j++;
+            } elseif ($level > 0) {
+                unset($results[$i]);
+            }
+        }
+        $params['results'] = implode('', $results);
+    }
+    $smarty->_cache_info['cache_serials'] = $smarty->_cache_serials;
+
+    // prepend the cache header info into cache file
+    $_cache_info = serialize($smarty->_cache_info);
+    $params['results'] = strlen($_cache_info) . "\n" . $_cache_info . $params['results'];
+
+    if (!empty($smarty->cache_handler_func)) {
+        // use cache_handler function
+        call_user_func_array($smarty->cache_handler_func,
+                             array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null));
+    } else {
+        // use local cache file
+
+        if(!@is_writable($smarty->cache_dir)) {
+            // cache_dir not writable, see if it exists
+            if(!@is_dir($smarty->cache_dir)) {
+                $smarty->trigger_error('the $cache_dir \'' . $smarty->cache_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
+                return false;
+            }
+            $smarty->trigger_error('unable to write to $cache_dir \'' . realpath($smarty->cache_dir) . '\'. Be sure $cache_dir is writable by the web server user.', E_USER_ERROR);
+            return false;
+        }
+
+        $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']);
+        $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id);
+        $_params = array('filename' => $_cache_file, 'contents' => $params['results'], 'create_dirs' => true);
+        require_once(SMARTY_CORE_DIR . 'core.write_file.php');
+        smarty_core_write_file($_params, $smarty);
+        return true;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.math.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.math.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.math.php	(revision 1328)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {math} function plugin
+ *
+ * Type:     function<br>
+ * Name:     math<br>
+ * Purpose:  handle math computations in template<br>
+ * @link http://smarty.php.net/manual/en/language.function.math.php {math}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_math($params, &$smarty)
+{
+    // be sure equation parameter is present
+    if (empty($params['equation'])) {
+        $smarty->trigger_error("math: missing equation parameter");
+        return;
+    }
+
+    $equation = $params['equation'];
+
+    // make sure parenthesis are balanced
+    if (substr_count($equation,"(") != substr_count($equation,")")) {
+        $smarty->trigger_error("math: unbalanced parenthesis");
+        return;
+    }
+
+    // match all vars in equation, make sure all are passed
+    preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
+    $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
+                           'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
+    
+    foreach($match[1] as $curr_var) {
+        if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
+            $smarty->trigger_error("math: function call $curr_var not allowed");
+            return;
+        }
+    }
+
+    foreach($params as $key => $val) {
+        if ($key != "equation" && $key != "format" && $key != "assign") {
+            // make sure value is not empty
+            if (strlen($val)==0) {
+                $smarty->trigger_error("math: parameter $key is empty");
+                return;
+            }
+            if (!is_numeric($val)) {
+                $smarty->trigger_error("math: parameter $key: is not numeric");
+                return;
+            }
+            $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
+        }
+    }
+
+    eval("\$smarty_math_result = ".$equation.";");
+
+    if (empty($params['format'])) {
+        if (empty($params['assign'])) {
+            return $smarty_math_result;
+        } else {
+            $smarty->assign($params['assign'],$smarty_math_result);
+        }
+    } else {
+        if (empty($params['assign'])){
+            printf($params['format'],$smarty_math_result);
+        } else {
+            $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
+        }
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.fetch.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.fetch.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.fetch.php	(revision 1328)
@@ -0,0 +1,221 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {fetch} plugin
+ *
+ * Type:     function<br>
+ * Name:     fetch<br>
+ * Purpose:  fetch file, web or ftp data and display results
+ * @link http://smarty.php.net/manual/en/language.function.fetch.php {fetch}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string|null if the assign parameter is passed, Smarty assigns the
+ *                     result to a template variable
+ */
+function smarty_function_fetch($params, &$smarty)
+{
+    if (empty($params['file'])) {
+        $smarty->_trigger_fatal_error("[plugin] parameter 'file' cannot be empty");
+        return;
+    }
+
+    $content = '';
+    if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) {
+        $_params = array('resource_type' => 'file', 'resource_name' => $params['file']);
+        require_once(SMARTY_CORE_DIR . 'core.is_secure.php');
+        if(!smarty_core_is_secure($_params, $smarty)) {
+            $smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed');
+            return;
+        }
+        
+        // fetch the file
+        if($fp = @fopen($params['file'],'r')) {
+            while(!feof($fp)) {
+                $content .= fgets ($fp,4096);
+            }
+            fclose($fp);
+        } else {
+            $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\'');
+            return;
+        }
+    } else {
+        // not a local file
+        if(preg_match('!^http://!i',$params['file'])) {
+            // http fetch
+            if($uri_parts = parse_url($params['file'])) {
+                // set defaults
+                $host = $server_name = $uri_parts['host'];
+                $timeout = 30;
+                $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
+                $agent = "Smarty Template Engine ".$smarty->_version;
+                $referer = "";
+                $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
+                $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
+                $_is_proxy = false;
+                if(empty($uri_parts['port'])) {
+                    $port = 80;
+                } else {
+                    $port = $uri_parts['port'];
+                }
+                if(!empty($uri_parts['user'])) {
+                    $user = $uri_parts['user'];
+                }
+                if(!empty($uri_parts['pass'])) {
+                    $pass = $uri_parts['pass'];
+                }
+                // loop through parameters, setup headers
+                foreach($params as $param_key => $param_value) {
+                    switch($param_key) {
+                        case "file":
+                        case "assign":
+                        case "assign_headers":
+                            break;
+                        case "user":
+                            if(!empty($param_value)) {
+                                $user = $param_value;
+                            }
+                            break;
+                        case "pass":
+                            if(!empty($param_value)) {
+                                $pass = $param_value;
+                            }
+                            break;
+                        case "accept":
+                            if(!empty($param_value)) {
+                                $accept = $param_value;
+                            }
+                            break;
+                        case "header":
+                            if(!empty($param_value)) {
+                                if(!preg_match('![\w\d-]+: .+!',$param_value)) {
+                                    $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'");
+                                    return;
+                                } else {
+                                    $extra_headers[] = $param_value;
+                                }
+                            }
+                            break;
+                        case "proxy_host":
+                            if(!empty($param_value)) {
+                                $proxy_host = $param_value;
+                            }
+                            break;
+                        case "proxy_port":
+                            if(!preg_match('!\D!', $param_value)) {
+                                $proxy_port = (int) $param_value;
+                            } else {
+                                $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
+                                return;
+                            }
+                            break;
+                        case "agent":
+                            if(!empty($param_value)) {
+                                $agent = $param_value;
+                            }
+                            break;
+                        case "referer":
+                            if(!empty($param_value)) {
+                                $referer = $param_value;
+                            }
+                            break;
+                        case "timeout":
+                            if(!preg_match('!\D!', $param_value)) {
+                                $timeout = (int) $param_value;
+                            } else {
+                                $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
+                                return;
+                            }
+                            break;
+                        default:
+                            $smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'");
+                            return;
+                    }
+                }
+                if(!empty($proxy_host) && !empty($proxy_port)) {
+                    $_is_proxy = true;
+                    $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);
+                } else {
+                    $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);
+                }
+
+                if(!$fp) {
+                    $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)");
+                    return;
+                } else {
+                    if($_is_proxy) {
+                        fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n");
+                    } else {
+                        fputs($fp, "GET $uri HTTP/1.0\r\n");
+                    }
+                    if(!empty($host)) {
+                        fputs($fp, "Host: $host\r\n");
+                    }
+                    if(!empty($accept)) {
+                        fputs($fp, "Accept: $accept\r\n");
+                    }
+                    if(!empty($agent)) {
+                        fputs($fp, "User-Agent: $agent\r\n");
+                    }
+                    if(!empty($referer)) {
+                        fputs($fp, "Referer: $referer\r\n");
+                    }
+                    if(isset($extra_headers) && is_array($extra_headers)) {
+                        foreach($extra_headers as $curr_header) {
+                            fputs($fp, $curr_header."\r\n");
+                        }
+                    }
+                    if(!empty($user) && !empty($pass)) {
+                        fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
+                    }
+
+                    fputs($fp, "\r\n");
+                    while(!feof($fp)) {
+                        $content .= fgets($fp,4096);
+                    }
+                    fclose($fp);
+                    $csplit = split("\r\n\r\n",$content,2);
+
+                    $content = $csplit[1];
+
+                    if(!empty($params['assign_headers'])) {
+                        $smarty->assign($params['assign_headers'],split("\r\n",$csplit[0]));
+                    }
+                }
+            } else {
+                $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax");
+                return;
+            }
+        } else {
+            // ftp fetch
+            if($fp = @fopen($params['file'],'r')) {
+                while(!feof($fp)) {
+                    $content .= fgets ($fp,4096);
+                }
+                fclose($fp);
+            } else {
+                $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\'');
+                return;
+            }
+        }
+
+    }
+
+
+    if (!empty($params['assign'])) {
+        $smarty->assign($params['assign'],$content);
+    } else {
+        return $content;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.indent.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.indent.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.indent.php	(revision 1328)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty indent modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     indent<br>
+ * Purpose:  indent lines of text
+ * @link http://smarty.php.net/manual/en/language.modifier.indent.php
+ *          indent (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param integer
+ * @param string
+ * @return string
+ */
+function smarty_modifier_indent($string,$chars=4,$char=" ")
+{
+    return preg_replace('!^!m',str_repeat($char,$chars),$string);
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.truncate.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.truncate.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.truncate.php	(revision 1328)
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty truncate modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     truncate<br>
+ * Purpose:  Truncate a string to a certain length if necessary,
+ *           optionally splitting in the middle of a word, and
+ *           appending the $etc string or inserting $etc into the middle.
+ * @link http://smarty.php.net/manual/en/language.modifier.truncate.php
+ *          truncate (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param integer
+ * @param string
+ * @param boolean
+ * @param boolean
+ * @return string
+ */
+function smarty_modifier_truncate($string, $length = 80, $etc = '...',
+                                  $break_words = false, $middle = false)
+{
+    if ($length == 0)
+        return '';
+
+    if (strlen($string) > $length) {
+        $length -= strlen($etc);
+        if (!$break_words && !$middle) {
+            $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
+        }
+        if(!$middle) {
+            return substr($string, 0, $length).$etc;
+        } else {
+            return substr($string, 0, $length/2) . $etc . substr($string, -$length/2);
+        }
+    } else {
+        return $string;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_select_date.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_select_date.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_select_date.php	(revision 1328)
@@ -0,0 +1,323 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {html_select_date} plugin
+ *
+ * Type:     function<br>
+ * Name:     html_select_date<br>
+ * Purpose:  Prints the dropdowns for date selection.
+ *
+ * ChangeLog:<br>
+ *           - 1.0 initial release
+ *           - 1.1 added support for +/- N syntax for begin
+ *                and end year values. (Monte)
+ *           - 1.2 added support for yyyy-mm-dd syntax for
+ *                time value. (Jan Rosier)
+ *           - 1.3 added support for choosing format for
+ *                month values (Gary Loescher)
+ *           - 1.3.1 added support for choosing format for
+ *                day values (Marcus Bointon)
+ *           - 1.3.2 suppport negative timestamps, force year
+ *             dropdown to include given date unless explicitly set (Monte)
+ * @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date}
+ *      (Smarty online manual)
+ * @version 1.3.2
+ * @author Andrei Zmievski
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_html_select_date($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+    require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
+    require_once $smarty->_get_plugin_filepath('function','html_options');
+    /* Default values. */
+    $prefix          = "Date_";
+    $start_year      = strftime("%Y");
+    $end_year        = $start_year;
+    $display_days    = true;
+    $display_months  = true;
+    $display_years   = true;
+    $month_format    = "%B";
+    /* Write months as numbers by default  GL */
+    $month_value_format = "%m";
+    $day_format      = "%02d";
+    /* Write day values using this format MB */
+    $day_value_format = "%d";
+    $year_as_text    = false;
+    /* Display years in reverse order? Ie. 2000,1999,.... */
+    $reverse_years   = false;
+    /* Should the select boxes be part of an array when returned from PHP?
+       e.g. setting it to "birthday", would create "birthday[Day]",
+       "birthday[Month]" & "birthday[Year]". Can be combined with prefix */
+    $field_array     = null;
+    /* <select size>'s of the different <select> tags.
+       If not set, uses default dropdown. */
+    $day_size        = null;
+    $month_size      = null;
+    $year_size       = null;
+    /* Unparsed attributes common to *ALL* the <select>/<input> tags.
+       An example might be in the template: all_extra ='class ="foo"'. */
+    $all_extra       = null;
+    /* Separate attributes for the tags. */
+    $day_extra       = null;
+    $month_extra     = null;
+    $year_extra      = null;
+    /* Order in which to display the fields.
+       "D" -> day, "M" -> month, "Y" -> year. */
+    $field_order     = 'MDY';
+    /* String printed between the different fields. */
+    $field_separator = "\n";
+    $time = time();
+    $all_empty       = null;
+    $day_empty       = null;
+    $month_empty     = null;
+    $year_empty      = null;
+    $extra_attrs     = '';
+
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'prefix':
+            case 'time':
+            case 'start_year':
+            case 'end_year':
+            case 'month_format':
+            case 'day_format':
+            case 'day_value_format':
+            case 'field_array':
+            case 'day_size':
+            case 'month_size':
+            case 'year_size':
+            case 'all_extra':
+            case 'day_extra':
+            case 'month_extra':
+            case 'year_extra':
+            case 'field_order':
+            case 'field_separator':
+            case 'month_value_format':
+            case 'month_empty':
+            case 'day_empty':
+            case 'year_empty':
+                $$_key = (string)$_value;
+                break;
+
+            case 'all_empty':
+                $$_key = (string)$_value;
+                $day_empty = $month_empty = $year_empty = $all_empty;
+                break;
+
+            case 'display_days':
+            case 'display_months':
+            case 'display_years':
+            case 'year_as_text':
+            case 'reverse_years':
+                $$_key = (bool)$_value;
+                break;
+
+            default:
+                if(!is_array($_value)) {
+                    $extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"';
+                } else {
+                    $smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if(preg_match('!^-\d+$!',$time)) {
+        // negative timestamp, use date()
+        $time = date('Y-m-d',$time);
+    }
+    // If $time is not in format yyyy-mm-dd
+    if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) {
+        // use smarty_make_timestamp to get an unix timestamp and
+        // strftime to make yyyy-mm-dd
+        $time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
+    }
+    // Now split this in pieces, which later can be used to set the select
+    $time = explode("-", $time);
+    
+    // make syntax "+N" or "-N" work with start_year and end_year
+    if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
+        if ($match[1] == '+') {
+            $end_year = strftime('%Y') + $match[2];
+        } else {
+            $end_year = strftime('%Y') - $match[2];
+        }
+    }
+    if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
+        if ($match[1] == '+') {
+            $start_year = strftime('%Y') + $match[2];
+        } else {
+            $start_year = strftime('%Y') - $match[2];
+        }
+    }
+    if (strlen($time[0]) > 0) { 
+        if ($start_year > $time[0] && !isset($params['start_year'])) {
+            // force start year to include given date if not explicitly set
+            $start_year = $time[0];
+        }
+        if($end_year < $time[0] && !isset($params['end_year'])) {
+            // force end year to include given date if not explicitly set
+            $end_year = $time[0];
+        }
+    }
+
+    $field_order = strtoupper($field_order);
+
+    $html_result = $month_result = $day_result = $year_result = "";
+
+    if ($display_months) {
+        $month_names = array();
+        $month_values = array();
+        if(isset($month_empty)) {
+            $month_names[''] = $month_empty;
+            $month_values[''] = '';
+        }
+        for ($i = 1; $i <= 12; $i++) {
+            $month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000));
+            $month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
+        }
+
+        $month_result .= '<select name=';
+        if (null !== $field_array){
+            $month_result .= '"' . $field_array . '[' . $prefix . 'Month]"';
+        } else {
+            $month_result .= '"' . $prefix . 'Month"';
+        }
+        if (null !== $month_size){
+            $month_result .= ' size="' . $month_size . '"';
+        }
+        if (null !== $month_extra){
+            $month_result .= ' ' . $month_extra;
+        }
+        if (null !== $all_extra){
+            $month_result .= ' ' . $all_extra;
+        }
+        $month_result .= $extra_attrs . '>'."\n";
+
+        $month_result .= smarty_function_html_options(array('output'     => $month_names,
+                                                            'values'     => $month_values,
+                                                            'selected'   => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
+                                                            'print_result' => false),
+                                                      $smarty);
+        $month_result .= '</select>';
+    }
+
+    if ($display_days) {
+        $days = array();
+        if (isset($day_empty)) {
+            $days[''] = $day_empty;
+            $day_values[''] = '';
+        }
+        for ($i = 1; $i <= 31; $i++) {
+            $days[] = sprintf($day_format, $i);
+            $day_values[] = sprintf($day_value_format, $i);
+        }
+
+        $day_result .= '<select name=';
+        if (null !== $field_array){
+            $day_result .= '"' . $field_array . '[' . $prefix . 'Day]"';
+        } else {
+            $day_result .= '"' . $prefix . 'Day"';
+        }
+        if (null !== $day_size){
+            $day_result .= ' size="' . $day_size . '"';
+        }
+        if (null !== $all_extra){
+            $day_result .= ' ' . $all_extra;
+        }
+        if (null !== $day_extra){
+            $day_result .= ' ' . $day_extra;
+        }
+        $day_result .= $extra_attrs . '>'."\n";
+        $day_result .= smarty_function_html_options(array('output'     => $days,
+                                                          'values'     => $day_values,
+                                                          'selected'   => $time[2],
+                                                          'print_result' => false),
+                                                    $smarty);
+        $day_result .= '</select>';
+    }
+
+    if ($display_years) {
+        if (null !== $field_array){
+            $year_name = $field_array . '[' . $prefix . 'Year]';
+        } else {
+            $year_name = $prefix . 'Year';
+        }
+        if ($year_as_text) {
+            $year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"';
+            if (null !== $all_extra){
+                $year_result .= ' ' . $all_extra;
+            }
+            if (null !== $year_extra){
+                $year_result .= ' ' . $year_extra;
+            }
+            $year_result .= ' />';
+        } else {
+            $years = range((int)$start_year, (int)$end_year);
+            if ($reverse_years) {
+                rsort($years, SORT_NUMERIC);
+            } else {
+                sort($years, SORT_NUMERIC);
+            }
+            $yearvals = $years;
+            if(isset($year_empty)) {
+                array_unshift($years, $year_empty);
+                array_unshift($yearvals, '');
+            }
+            $year_result .= '<select name="' . $year_name . '"';
+            if (null !== $year_size){
+                $year_result .= ' size="' . $year_size . '"';
+            }
+            if (null !== $all_extra){
+                $year_result .= ' ' . $all_extra;
+            }
+            if (null !== $year_extra){
+                $year_result .= ' ' . $year_extra;
+            }
+            $year_result .= $extra_attrs . '>'."\n";
+            $year_result .= smarty_function_html_options(array('output' => $years,
+                                                               'values' => $yearvals,
+                                                               'selected'   => $time[0],
+                                                               'print_result' => false),
+                                                         $smarty);
+            $year_result .= '</select>';
+        }
+    }
+
+    // Loop thru the field_order field
+    for ($i = 0; $i <= 2; $i++){
+        $c = substr($field_order, $i, 1);
+        switch ($c){
+            case 'D':
+                $html_result .= $day_result;
+                break;
+
+            case 'M':
+                $html_result .= $month_result;
+                break;
+
+            case 'Y':
+                $html_result .= $year_result;
+                break;
+        }
+        // Add the field seperator
+        if($i != 2) {
+            $html_result .= $field_separator;
+        }
+    }
+
+    return $html_result;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/shared.escape_special_chars.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/shared.escape_special_chars.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/shared.escape_special_chars.php	(revision 1328)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Smarty shared plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * escape_special_chars common function
+ *
+ * Function: smarty_function_escape_special_chars<br>
+ * Purpose:  used by other smarty functions to escape
+ *           special chars except for already escaped ones
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_function_escape_special_chars($string)
+{
+    if(!is_array($string)) {
+        $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
+        $string = htmlspecialchars($string);
+        $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string);
+    }
+    return $string;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_checkboxes.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_checkboxes.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_checkboxes.php	(revision 1328)
@@ -0,0 +1,143 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_checkboxes} function plugin
+ *
+ * File:       function.html_checkboxes.php<br>
+ * Type:       function<br>
+ * Name:       html_checkboxes<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of checkbox input types<br>
+ * Input:<br>
+ *           - name       (optional) - string default "checkbox"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each checkbox
+ *           - assign     (optional) - assign the output as an array to this variable
+ * Examples:
+ * <pre>
+ * {html_checkboxes values=$ids output=$names}
+ * {html_checkboxes values=$ids name='box' separator='<br>' output=$names}
+ * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_checkboxes($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+
+    $name = 'checkbox';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+    $output = null;
+
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'name':
+            case 'separator':
+                $$_key = $_val;
+                break;
+
+            case 'labels':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'checked':
+            case 'selected':
+                $selected = array_map('strval', array_values((array)$_val));
+                break;
+
+            case 'checkboxes':
+                $smarty->trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    settype($selected, 'array');
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
+
+
+    } else {
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+
+}
+
+function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) {
+    $_output = '';
+    if ($labels) $_output .= '<label>';
+    $_output .= '<input type="checkbox" name="'
+        . smarty_function_escape_special_chars($name) . '[]" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+
+    if (in_array((string)$value, $selected)) {
+        $_output .= ' checked="checked"';
+    }
+    $_output .= $extra . ' />' . $output;
+    if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.config_load.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.config_load.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.config_load.php	(revision 1328)
@@ -0,0 +1,142 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {config_load} function plugin
+ *
+ * Type:     function<br>
+ * Name:     config_load<br>
+ * Purpose:  load config file vars
+ * @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author messju mohr <messju at lammfellpuschen dot de> (added use of resources)
+ * @param array Format:
+ * <pre>
+ * array('file' => required config file name,
+ *       'section' => optional config file section to load
+ *       'scope' => local/parent/global
+ *       'global' => overrides scope, setting to parent if true)
+ * </pre>
+ * @param Smarty
+ */
+function smarty_function_config_load($params, &$smarty)
+{
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $_debug_start_time = smarty_core_get_microtime($_params, $smarty);
+        }
+
+        $_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null;
+        $_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null;
+        $_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global';
+        $_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false;
+
+        if (!isset($_file) || strlen($_file) == 0) {
+            $smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        if (isset($_scope)) {
+            if ($_scope != 'local' &&
+                $_scope != 'parent' &&
+                $_scope != 'global') {
+                $smarty->trigger_error("invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__);
+            }
+        } else {
+            if ($_global) {
+                $_scope = 'parent';
+            } else {
+                $_scope = 'local';
+            }
+        }
+
+        $_params = array('resource_name' => $_file,
+                         'resource_base_path' => $smarty->config_dir,
+                         'get_source' => false);
+        $smarty->_parse_resource_name($_params);
+        $_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
+        if (isset($_section))
+            $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section);
+        else
+            $_compile_file = $smarty->_get_compile_path($_file_path);
+
+        if($smarty->force_compile || !file_exists($_compile_file)) {
+            $_compile = true;
+        } elseif ($smarty->compile_check) {
+            $_params = array('resource_name' => $_file,
+                             'resource_base_path' => $smarty->config_dir,
+                             'get_source' => false);
+            $_compile = $smarty->_fetch_resource_info($_params) &&
+                $_params['resource_timestamp'] > filemtime($_compile_file);
+        } else {
+            $_compile = false;
+        }
+
+        if($_compile) {
+            // compile config file
+            if(!is_object($smarty->_conf_obj)) {
+                require_once SMARTY_DIR . $smarty->config_class . '.class.php';
+                $smarty->_conf_obj = new $smarty->config_class();
+                $smarty->_conf_obj->overwrite = $smarty->config_overwrite;
+                $smarty->_conf_obj->booleanize = $smarty->config_booleanize;
+                $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
+                $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
+            }
+
+            $_params = array('resource_name' => $_file,
+                             'resource_base_path' => $smarty->config_dir,
+                             $_params['get_source'] = true);
+            if (!$smarty->_fetch_resource_info($_params)) {
+                return;
+            }
+            $smarty->_conf_obj->set_file_contents($_file, $_params['source_content']);
+            $_config_vars = array_merge($smarty->_conf_obj->get($_file),
+                    $smarty->_conf_obj->get($_file, $_section));
+            if(function_exists('var_export')) {
+                $_output = '<?php $_config_vars = ' . var_export($_config_vars, true) . '; ?>';
+            } else {
+                $_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>';
+            }
+            $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp']));
+            require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
+            smarty_core_write_compiled_resource($_params, $smarty);
+        } else {
+            include($_compile_file);
+        }
+
+        if ($smarty->caching) {
+            $smarty->_cache_info['config'][$_file] = true;
+        }
+
+        $smarty->_config[0]['vars'] = @array_merge($smarty->_config[0]['vars'], $_config_vars);
+        $smarty->_config[0]['files'][$_file] = true;
+
+        if ($_scope == 'parent') {
+                $smarty->_config[1]['vars'] = @array_merge($smarty->_config[1]['vars'], $_config_vars);
+                $smarty->_config[1]['files'][$_file] = true;
+        } else if ($_scope == 'global') {
+            for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) {
+                $smarty->_config[$i]['vars'] = @array_merge($smarty->_config[$i]['vars'], $_config_vars);
+                $smarty->_config[$i]['files'][$_file] = true;
+            }
+        }
+
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
+            $smarty->_smarty_debug_info[] = array('type'      => 'config',
+                                                'filename'  => $_file.' ['.$_section.'] '.$_scope,
+                                                'depth'     => $smarty->_inclusion_depth,
+                                                'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);
+        }
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.upper.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.upper.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.upper.php	(revision 1328)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty upper modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     upper<br>
+ * Purpose:  convert string to uppercase
+ * @link http://smarty.php.net/manual/en/language.modifier.upper.php
+ *          upper (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_upper($string)
+{
+    return strtoupper($string);
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_image.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_image.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_image.php	(revision 1328)
@@ -0,0 +1,142 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_image} function plugin
+ *
+ * Type:     function<br>
+ * Name:     html_image<br>
+ * Date:     Feb 24, 2003<br>
+ * Purpose:  format HTML tags for the image<br>
+ * Input:<br>
+ *         - file = file (and path) of image (required)
+ *         - height = image height (optional, default actual height)
+ *         - width = image width (optional, default actual width)
+ *         - basedir = base directory for absolute paths, default
+ *                     is environment variable DOCUMENT_ROOT
+ *         - path_prefix = prefix for path output (optional, default empty)
+ *
+ * Examples: {html_image file="/images/masthead.gif"}
+ * Output:   <img src="/images/masthead.gif" width=400 height=23>
+ * @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image}
+ *      (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @author credits to Duda <duda@big.hu> - wrote first image function
+ *           in repository, helped with lots of functionality
+ * @version  1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_image($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+    
+    $alt = '';
+    $file = '';
+    $height = '';
+    $width = '';
+    $extra = '';
+    $prefix = '';
+    $suffix = '';
+    $path_prefix = '';
+    $server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
+    $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : '';
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'file':
+            case 'height':
+            case 'width':
+            case 'dpi':
+            case 'path_prefix':
+            case 'basedir':
+                $$_key = $_val;
+                break;
+
+            case 'alt':
+                if(!is_array($_val)) {
+                    $$_key = smarty_function_escape_special_chars($_val);
+                } else {
+                    $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+
+            case 'link':
+            case 'href':
+                $prefix = '<a href="' . $_val . '">';
+                $suffix = '</a>';
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (empty($file)) {
+        $smarty->trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
+        return;
+    }
+
+    if (substr($file,0,1) == '/') {
+        $_image_path = $basedir . $file;
+    } else {
+        $_image_path = $file;
+    }
+    
+    if(!isset($params['width']) || !isset($params['height'])) {
+        if(!$_image_data = @getimagesize($_image_path)) {
+            if(!file_exists($_image_path)) {
+                $smarty->trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
+                return;
+            } else if(!is_readable($_image_path)) {
+                $smarty->trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE);
+                return;
+            } else {
+                $smarty->trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE);
+                return;
+            }
+        }
+        if ($smarty->security &&
+            ($_params = array('resource_type' => 'file', 'resource_name' => $_image_path)) &&
+            (require_once(SMARTY_CORE_DIR . 'core.is_secure.php')) &&
+            (!smarty_core_is_secure($_params, $smarty)) ) {
+            $smarty->trigger_error("html_image: (secure) '$_image_path' not in secure directory", E_USER_NOTICE);
+        }        
+        
+        if(!isset($params['width'])) {
+            $width = $_image_data[0];
+        }
+        if(!isset($params['height'])) {
+            $height = $_image_data[1];
+        }
+
+    }
+
+    if(isset($params['dpi'])) {
+        if(strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) {
+            $dpi_default = 72;
+        } else {
+            $dpi_default = 96;
+        }
+        $_resize = $dpi_default/$params['dpi'];
+        $width = round($width * $_resize);
+        $height = round($height * $_resize);
+    }
+
+    return $prefix . '<img src="'.$path_prefix.$file.'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.spacify.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.spacify.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.spacify.php	(revision 1328)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty spacify modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     spacify<br>
+ * Purpose:  add spaces between characters in a string
+ * @link http://smarty.php.net/manual/en/language.modifier.spacify.php
+ *          spacify (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_spacify($string, $spacify_char = ' ')
+{
+    return implode($spacify_char,
+                   preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY));
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_sentences.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_sentences.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_sentences.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty count_sentences modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_sentences
+ * Purpose:  count the number of sentences in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
+ *          count_sentences (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_sentences($string)
+{
+    // find periods with a word before but not after.
+    return preg_match_all('/[^\s]\.(?!\w)/', $string, $match);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.escape.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.escape.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.escape.php	(revision 1328)
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty escape modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     escape<br>
+ * Purpose:  Escape the string according to escapement type
+ * @link http://smarty.php.net/manual/en/language.modifier.escape.php
+ *          escape (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param html|htmlall|url|quotes|hex|hexentity|javascript
+ * @return string
+ */
+function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-8859-1')
+{
+    switch ($esc_type) {
+        case 'html':
+            return htmlspecialchars($string, ENT_QUOTES, $char_set);
+
+        case 'htmlall':
+            return htmlentities($string, ENT_QUOTES, $char_set);
+
+        case 'url':
+            return rawurlencode($string);
+
+        case 'urlpathinfo':
+            return str_replace('%2F','/',rawurlencode($string));
+            
+        case 'quotes':
+            // escape unescaped single quotes
+            return preg_replace("%(?<!\\\\)'%", "\\'", $string);
+
+        case 'hex':
+            // escape every character into hex
+            $return = '';
+            for ($x=0; $x < strlen($string); $x++) {
+                $return .= '%' . bin2hex($string[$x]);
+            }
+            return $return;
+            
+        case 'hexentity':
+            $return = '';
+            for ($x=0; $x < strlen($string); $x++) {
+                $return .= '&#x' . bin2hex($string[$x]) . ';';
+            }
+            return $return;
+
+        case 'decentity':
+            $return = '';
+            for ($x=0; $x < strlen($string); $x++) {
+                $return .= '&#' . ord($string[$x]) . ';';
+            }
+            return $return;
+
+        case 'javascript':
+            // escape quotes and backslashes, newlines, etc.
+            return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
+            
+        case 'mail':
+            // safe way to display e-mail address on a web page
+            return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string);
+            
+        case 'nonstd':
+           // escape non-standard chars, such as ms document quotes
+           $_res = '';
+           for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
+               $_ord = ord(substr($string, $_i, 1));
+               // non-standard char, escape it
+               if($_ord >= 126){
+                   $_res .= '&#' . $_ord . ';';
+               }
+               else {
+                   $_res .= substr($string, $_i, 1);
+               }
+           }
+           return $_res;
+
+        default:
+            return $string;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_paragraphs.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_paragraphs.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_paragraphs.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty count_paragraphs modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_paragraphs<br>
+ * Purpose:  count the number of paragraphs in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
+ *          count_paragraphs (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_paragraphs($string)
+{
+    // count \r or \n characters
+    return count(preg_split('/[\r\n]+/', $string));
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/compiler.assign.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/compiler.assign.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/compiler.assign.php	(revision 1328)
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {assign} compiler function plugin
+ *
+ * Type:     compiler function<br>
+ * Name:     assign<br>
+ * Purpose:  assign a value to a template variable
+ * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com> (initial author)
+ * @auther messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function)
+ * @param string containing var-attribute and value-attribute
+ * @param Smarty_Compiler
+ */
+function smarty_compiler_assign($tag_attrs, &$compiler)
+{
+    $_params = $compiler->_parse_attrs($tag_attrs);
+
+    if (!isset($_params['var'])) {
+        $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING);
+        return;
+    }
+
+    if (!isset($_params['value'])) {
+        $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING);
+        return;
+    }
+
+    return "\$this->assign({$_params['var']}, {$_params['value']});";
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.strip.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.strip.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.strip.php	(revision 1328)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty strip modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     strip<br>
+ * Purpose:  Replace all repeated spaces, newlines, tabs
+ *           with a single space or supplied replacement string.<br>
+ * Example:  {$var|strip} {$var|strip:"&nbsp;"}
+ * Date:     September 25th, 2002
+ * @link http://smarty.php.net/manual/en/language.modifier.strip.php
+ *          strip (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version  1.0
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_strip($text, $replace = ' ')
+{
+    return preg_replace('!\s+!', $replace, $text);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_words.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_words.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_words.php	(revision 1328)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty count_words modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_words<br>
+ * Purpose:  count the number of words in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.words.php
+ *          count_words (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_words($string)
+{
+    // split text by ' ',\r,\n,\f,\t
+    $split_array = preg_split('/\s+/',$string);
+    // count matches that contain alphanumerics
+    $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array);
+
+    return count($word_count);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.cat.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.cat.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.cat.php	(revision 1328)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty cat modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     cat<br>
+ * Date:     Feb 24, 2003
+ * Purpose:  catenate a value to a variable
+ * Input:    string to catenate
+ * Example:  {$var|cat:"foo"}
+ * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version 1.0
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_cat($string, $cat)
+{
+    return $string . $cat;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.debug_print_var.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.debug_print_var.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.debug_print_var.php	(revision 1328)
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty debug_print_var modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     debug_print_var<br>
+ * Purpose:  formats variable contents for display in the console
+ * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php
+ *          debug_print_var (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array|object
+ * @param integer
+ * @param integer
+ * @return string
+ */
+function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
+{
+    $_replace = array("\n"=>'<i>&#92;n</i>', "\r"=>'<i>&#92;r</i>', "\t"=>'<i>&#92;t</i>');
+    if (is_array($var)) {
+        $results = "<b>Array (".count($var).")</b>";
+        foreach ($var as $curr_key => $curr_val) {
+            $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
+            $results .= "<br>".str_repeat('&nbsp;', $depth*2)."<b>".strtr($curr_key, $_replace)."</b> =&gt; $return";
+        }
+    } else if (is_object($var)) {
+        $object_vars = get_object_vars($var);
+        $results = "<b>".get_class($var)." Object (".count($object_vars).")</b>";
+        foreach ($object_vars as $curr_key => $curr_val) {
+            $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
+            $results .= "<br>".str_repeat('&nbsp;', $depth*2)."<b>$curr_key</b> =&gt; $return";
+        }
+    } else if (is_resource($var)) {
+        $results = '<i>'.(string)$var.'</i>';
+    } else if (empty($var) && $var != "0") {
+        $results = '<i>empty</i>';
+    } else {
+        if (strlen($var) > $length ) {
+            $results = substr($var, 0, $length-3).'...';
+        } else {
+            $results = $var;
+        }
+        $results = htmlspecialchars($results);
+        $results = strtr($results, $_replace);
+    }
+    return $results;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.replace.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.replace.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.replace.php	(revision 1328)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty replace modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     replace<br>
+ * Purpose:  simple search/replace
+ * @link http://smarty.php.net/manual/en/language.modifier.replace.php
+ *          replace (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_replace($string, $search, $replace)
+{
+    return str_replace($search, $replace, $string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.string_format.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.string_format.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.string_format.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty string_format modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     string_format<br>
+ * Purpose:  format strings via sprintf
+ * @link http://smarty.php.net/manual/en/language.modifier.string.format.php
+ *          string_format (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_string_format($string, $format)
+{
+    return sprintf($format, $string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.eval.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.eval.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.eval.php	(revision 1328)
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {eval} function plugin
+ *
+ * Type:     function<br>
+ * Name:     eval<br>
+ * Purpose:  evaluate a template variable as a template<br>
+ * @link http://smarty.php.net/manual/en/language.function.eval.php {eval}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ */
+function smarty_function_eval($params, &$smarty)
+{
+
+    if (!isset($params['var'])) {
+        $smarty->trigger_error("eval: missing 'var' parameter");
+        return;
+    }
+
+    if($params['var'] == '') {
+        return;
+    }
+
+    $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
+
+    ob_start();
+    $smarty->_eval('?>' . $_var_compiled);
+    $_contents = ob_get_contents();
+    ob_end_clean();
+
+    if (!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_contents);
+    } else {
+        return $_contents;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.nl2br.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.nl2br.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.nl2br.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty plugin
+ *
+ * Type:     modifier<br>
+ * Name:     nl2br<br>
+ * Date:     Feb 26, 2003
+ * Purpose:  convert \r\n, \r or \n to <<br>>
+ * Input:<br>
+ *         - contents = contents to replace
+ *         - preceed_test = if true, includes preceeding break tags
+ *           in replacement
+ * Example:  {$text|nl2br}
+ * @link http://smarty.php.net/manual/en/language.modifier.nl2br.php
+ *          nl2br (Smarty online manual)
+ * @version  1.0
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_nl2br($string)
+{
+    return nl2br($string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.strip_tags.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.strip_tags.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.strip_tags.php	(revision 1328)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty strip_tags modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     strip_tags<br>
+ * Purpose:  strip html tags from text
+ * @link http://smarty.php.net/manual/en/language.modifier.strip.tags.php
+ *          strip_tags (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param boolean
+ * @return string
+ */
+function smarty_modifier_strip_tags($string, $replace_with_space = true)
+{
+    if ($replace_with_space)
+        return preg_replace('!<[^>]*?>!', ' ', $string);
+    else
+        return strip_tags($string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.default.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.default.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.default.php	(revision 1328)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty default modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     default<br>
+ * Purpose:  designate default value for empty variables
+ * @link http://smarty.php.net/manual/en/language.modifier.default.php
+ *          default (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_default($string, $default = '')
+{
+    if (!isset($string) || $string === '')
+        return $default;
+    else
+        return $string;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.date_format.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.date_format.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.date_format.php	(revision 1328)
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Include the {@link shared.make_timestamp.php} plugin
+ */
+require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
+/**
+ * Smarty date_format modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     date_format<br>
+ * Purpose:  format datestamps via strftime<br>
+ * Input:<br>
+ *         - string: input date string
+ *         - format: strftime format for output
+ *         - default_date: default date if $string is empty
+ * @link http://smarty.php.net/manual/en/language.modifier.date.format.php
+ *          date_format (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @param string
+ * @return string|void
+ * @uses smarty_make_timestamp()
+ */
+function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)
+{
+    if (substr(PHP_OS,0,3) == 'WIN') {
+           $_win_from = array ('%e',  '%T',       '%D');
+           $_win_to   = array ('%#d', '%H:%M:%S', '%m/%d/%y');
+           $format = str_replace($_win_from, $_win_to, $format);
+    }
+    if($string != '') {
+        return strftime($format, smarty_make_timestamp($string));
+    } elseif (isset($default_date) && $default_date != '') {
+        return strftime($format, smarty_make_timestamp($default_date));
+    } else {
+        return;
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.capitalize.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.capitalize.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.capitalize.php	(revision 1328)
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty capitalize modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     capitalize<br>
+ * Purpose:  capitalize words in the string
+ * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE
+ *      capitalize (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_capitalize($string, $uc_digits = false)
+{
+    smarty_modifier_capitalize_ucfirst(null, $uc_digits);
+    return preg_replace_callback('!\b\w+\b!', 'smarty_modifier_capitalize_ucfirst', $string);
+}
+
+function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
+{
+    static $_uc_digits = false;
+    
+    if(isset($uc_digits)) {
+        $_uc_digits = $uc_digits;
+        return;
+    }
+    
+    if(!preg_match('!\d!',$string[0]) || $_uc_digits)
+        return ucfirst($string[0]);
+    else
+        return $string[0];
+}
+
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.cycle.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.cycle.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.cycle.php	(revision 1328)
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {cycle} function plugin
+ *
+ * Type:     function<br>
+ * Name:     cycle<br>
+ * Date:     May 3, 2002<br>
+ * Purpose:  cycle through given values<br>
+ * Input:
+ *         - name = name of cycle (optional)
+ *         - values = comma separated list of values to cycle,
+ *                    or an array of values to cycle
+ *                    (this can be left out for subsequent calls)
+ *         - reset = boolean - resets given var to true
+ *         - print = boolean - print var or not. default is true
+ *         - advance = boolean - whether or not to advance the cycle
+ *         - delimiter = the value delimiter, default is ","
+ *         - assign = boolean, assigns to template var instead of
+ *                    printed.
+ *
+ * Examples:<br>
+ * <pre>
+ * {cycle values="#eeeeee,#d0d0d0d"}
+ * {cycle name=row values="one,two,three" reset=true}
+ * {cycle name=row}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author credit to Mark Priatel <mpriatel@rogers.com>
+ * @author credit to Gerard <gerard@interfold.com>
+ * @author credit to Jason Sweat <jsweat_php@yahoo.com>
+ * @version  1.3
+ * @param array
+ * @param Smarty
+ * @return string|null
+ */
+function smarty_function_cycle($params, &$smarty)
+{
+    static $cycle_vars;
+    
+    $name = (empty($params['name'])) ? 'default' : $params['name'];
+    $print = (isset($params['print'])) ? (bool)$params['print'] : true;
+    $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true;
+    $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false;
+            
+    if (!in_array('values', array_keys($params))) {
+        if(!isset($cycle_vars[$name]['values'])) {
+            $smarty->trigger_error("cycle: missing 'values' parameter");
+            return;
+        }
+    } else {
+        if(isset($cycle_vars[$name]['values'])
+            && $cycle_vars[$name]['values'] != $params['values'] ) {
+            $cycle_vars[$name]['index'] = 0;
+        }
+        $cycle_vars[$name]['values'] = $params['values'];
+    }
+
+    $cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ',';
+    
+    if(is_array($cycle_vars[$name]['values'])) {
+        $cycle_array = $cycle_vars[$name]['values'];
+    } else {
+        $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']);
+    }
+    
+    if(!isset($cycle_vars[$name]['index']) || $reset ) {
+        $cycle_vars[$name]['index'] = 0;
+    }
+    
+    if (isset($params['assign'])) {
+        $print = false;
+        $smarty->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]);
+    }
+        
+    if($print) {
+        $retval = $cycle_array[$cycle_vars[$name]['index']];
+    } else {
+        $retval = null;
+    }
+
+    if($advance) {
+        if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) {
+            $cycle_vars[$name]['index'] = 0;
+        } else {
+            $cycle_vars[$name]['index']++;
+        }
+    }
+    
+    return $retval;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_characters.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_characters.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.count_characters.php	(revision 1328)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty count_characters modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_characteres<br>
+ * Purpose:  count the number of characters in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php
+ *          count_characters (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param boolean include whitespace in the character count
+ * @return integer
+ */
+function smarty_modifier_count_characters($string, $include_spaces = false)
+{
+    if ($include_spaces)
+       return(strlen($string));
+
+    return preg_match_all("/[^\s]/",$string, $match);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.lower.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.lower.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.lower.php	(revision 1328)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty lower modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     lower<br>
+ * Purpose:  convert string to lowercase
+ * @link http://smarty.php.net/manual/en/language.modifier.lower.php
+ *          lower (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_lower($string)
+{
+    return strtolower($string);
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/block.textformat.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/block.textformat.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/block.textformat.php	(revision 1328)
@@ -0,0 +1,103 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {textformat}{/textformat} block plugin
+ *
+ * Type:     block function<br>
+ * Name:     textformat<br>
+ * Purpose:  format text a certain way with preset styles
+ *           or custom wrap/indent settings<br>
+ * @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat}
+ *       (Smarty online manual)
+ * @param array
+ * <pre>
+ * Params:   style: string (email)
+ *           indent: integer (0)
+ *           wrap: integer (80)
+ *           wrap_char string ("\n")
+ *           indent_char: string (" ")
+ *           wrap_boundary: boolean (true)
+ * </pre>
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param string contents of the block
+ * @param Smarty clever simulation of a method
+ * @return string string $content re-formatted
+ */
+function smarty_block_textformat($params, $content, &$smarty)
+{
+    if (is_null($content)) {
+        return;
+    }
+
+    $style = null;
+    $indent = 0;
+    $indent_first = 0;
+    $indent_char = ' ';
+    $wrap = 80;
+    $wrap_char = "\n";
+    $wrap_cut = false;
+    $assign = null;
+    
+    foreach ($params as $_key => $_val) {
+        switch ($_key) {
+            case 'style':
+            case 'indent_char':
+            case 'wrap_char':
+            case 'assign':
+                $$_key = (string)$_val;
+                break;
+
+            case 'indent':
+            case 'indent_first':
+            case 'wrap':
+                $$_key = (int)$_val;
+                break;
+
+            case 'wrap_cut':
+                $$_key = (bool)$_val;
+                break;
+
+            default:
+                $smarty->trigger_error("textformat: unknown attribute '$_key'");
+        }
+    }
+
+    if ($style == 'email') {
+        $wrap = 72;
+    }
+
+    // split into paragraphs
+    $_paragraphs = preg_split('![\r\n][\r\n]!',$content);
+    $_output = '';
+
+    for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) {
+        if ($_paragraphs[$_x] == '') {
+            continue;
+        }
+        // convert mult. spaces & special chars to single space
+        $_paragraphs[$_x] = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]);
+        // indent first line
+        if($indent_first > 0) {
+            $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x];
+        }
+        // wordwrap sentences
+        $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut);
+        // indent lines
+        if($indent > 0) {
+            $_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]);
+        }
+    }
+    $_output = implode($wrap_char . $wrap_char, $_paragraphs);
+
+    return $assign ? $smarty->assign($assign, $_output) : $_output;
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.popup.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.popup.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.popup.php	(revision 1328)
@@ -0,0 +1,119 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {popup} function plugin
+ *
+ * Type:     function<br>
+ * Name:     popup<br>
+ * Purpose:  make text pop up in windows via overlib
+ * @link http://smarty.php.net/manual/en/language.function.popup.php {popup}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_popup($params, &$smarty)
+{
+    $append = '';
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'text':
+            case 'trigger':
+            case 'function':
+            case 'inarray':
+                $$_key = (string)$_value;
+                if ($_key == 'function' || $_key == 'inarray')
+                    $append .= ',' . strtoupper($_key) . ",'$_value'";
+                break;
+
+            case 'caption':
+            case 'closetext':
+            case 'status':
+                $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'";
+                break;
+
+            case 'fgcolor':
+            case 'bgcolor':
+            case 'textcolor':
+            case 'capcolor':
+            case 'closecolor':
+            case 'textfont':
+            case 'captionfont':
+            case 'closefont':
+            case 'fgbackground':
+            case 'bgbackground':
+            case 'caparray':
+            case 'capicon':
+            case 'background':
+            case 'frame':
+                $append .= ',' . strtoupper($_key) . ",'$_value'";
+                break;
+
+            case 'textsize':
+            case 'captionsize':
+            case 'closesize':
+            case 'width':
+            case 'height':
+            case 'border':
+            case 'offsetx':
+            case 'offsety':
+            case 'snapx':
+            case 'snapy':
+            case 'fixx':
+            case 'fixy':
+            case 'padx':
+            case 'pady':
+            case 'timeout':
+            case 'delay':
+                $append .= ',' . strtoupper($_key) . ",$_value";
+                break;
+
+            case 'sticky':
+            case 'left':
+            case 'right':
+            case 'center':
+            case 'above':
+            case 'below':
+            case 'noclose':
+            case 'autostatus':
+            case 'autostatuscap':
+            case 'fullhtml':
+            case 'hauto':
+            case 'vauto':
+            case 'mouseoff':
+            case 'followmouse':
+            case 'closeclick':
+                if ($_value) $append .= ',' . strtoupper($_key);
+                break;
+
+            default:
+                $smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING);
+        }
+    }
+
+    if (empty($text) && !isset($inarray) && empty($function)) {
+        $smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required");
+        return false;
+    }
+
+    if (empty($trigger)) { $trigger = "onmouseover"; }
+
+    $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
+    $retval .= $append . ');"';
+    if ($trigger == 'onmouseover')
+       $retval .= ' onmouseout="nd();"';
+
+
+    return $retval;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.assign_debug_info.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.assign_debug_info.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.assign_debug_info.php	(revision 1328)
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty {assign_debug_info} function plugin
+ *
+ * Type:     function<br>
+ * Name:     assign_debug_info<br>
+ * Purpose:  assign debug info to the template<br>
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array unused in this plugin, this plugin uses {@link Smarty::$_config},
+ *              {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info}
+ * @param Smarty
+ */
+function smarty_function_assign_debug_info($params, &$smarty)
+{
+    $assigned_vars = $smarty->_tpl_vars;
+    ksort($assigned_vars);
+    if (@is_array($smarty->_config[0])) {
+        $config_vars = $smarty->_config[0];
+        ksort($config_vars);
+        $smarty->assign("_debug_config_keys", array_keys($config_vars));
+        $smarty->assign("_debug_config_vals", array_values($config_vars));
+    }
+    
+    $included_templates = $smarty->_smarty_debug_info;
+    
+    $smarty->assign("_debug_keys", array_keys($assigned_vars));
+    $smarty->assign("_debug_vals", array_values($assigned_vars));
+    
+    $smarty->assign("_debug_tpls", $included_templates);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_radios.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_radios.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_radios.php	(revision 1328)
@@ -0,0 +1,156 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_radios} function plugin
+ *
+ * File:       function.html_radios.php<br>
+ * Type:       function<br>
+ * Name:       html_radios<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of radio input types<br>
+ * Input:<br>
+ *           - name       (optional) - string default "radio"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each radio button
+ *           - assign     (optional) - assign the output as an array to this variable
+ * Examples:
+ * <pre>
+ * {html_radios values=$ids output=$names}
+ * {html_radios values=$ids name='box' separator='<br>' output=$names}
+ * {html_radios values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_radios($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+   
+    $name = 'radio';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+    $label_ids = false;
+    $output = null;
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'name':
+            case 'separator':
+                $$_key = (string)$_val;
+                break;
+
+            case 'checked':
+            case 'selected':
+                if(is_array($_val)) {
+                    $smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
+                } else {
+                    $selected = (string)$_val;
+                }
+                break;
+
+            case 'labels':
+            case 'label_ids':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'radios':
+                $smarty->trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
+
+    } else {
+
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+
+}
+
+function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
+    $_output = '';
+    if ($labels) {
+      if($label_ids) {
+          $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+          $_output .= '<label for="' . $_id . '">';
+      } else {
+          $_output .= '<label>';           
+      }
+   }
+   $_output .= '<input type="radio" name="'
+        . smarty_function_escape_special_chars($name) . '" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+
+   if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
+
+    if ((string)$value==$selected) {
+        $_output .= ' checked="checked"';
+    }
+    $_output .= $extra . ' />' . $output;
+    if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/outputfilter.trimwhitespace.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/outputfilter.trimwhitespace.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/outputfilter.trimwhitespace.php	(revision 1328)
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty trimwhitespace outputfilter plugin
+ *
+ * File:     outputfilter.trimwhitespace.php<br>
+ * Type:     outputfilter<br>
+ * Name:     trimwhitespace<br>
+ * Date:     Jan 25, 2003<br>
+ * Purpose:  trim leading white space and blank lines from
+ *           template source after it gets interpreted, cleaning
+ *           up code and saving bandwidth. Does not affect
+ *           <<PRE>></PRE> and <SCRIPT></SCRIPT> blocks.<br>
+ * Install:  Drop into the plugin directory, call
+ *           <code>$smarty->load_filter('output','trimwhitespace');</code>
+ *           from application.
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
+ * @version  1.3
+ * @param string
+ * @param Smarty
+ */
+function smarty_outputfilter_trimwhitespace($source, &$smarty)
+{
+    // Pull out the script blocks
+    preg_match_all("!<script[^>]+>.*?</script>!is", $source, $match);
+    $_script_blocks = $match[0];
+    $source = preg_replace("!<script[^>]+>.*?</script>!is",
+                           '@@@SMARTY:TRIM:SCRIPT@@@', $source);
+
+    // Pull out the pre blocks
+    preg_match_all("!<pre>.*?</pre>!is", $source, $match);
+    $_pre_blocks = $match[0];
+    $source = preg_replace("!<pre>.*?</pre>!is",
+                           '@@@SMARTY:TRIM:PRE@@@', $source);
+
+    // Pull out the textarea blocks
+    preg_match_all("!<textarea[^>]+>.*?</textarea>!is", $source, $match);
+    $_textarea_blocks = $match[0];
+    $source = preg_replace("!<textarea[^>]+>.*?</textarea>!is",
+                           '@@@SMARTY:TRIM:TEXTAREA@@@', $source);
+
+    // remove all leading spaces, tabs and carriage returns NOT
+    // preceeded by a php close tag.
+    $source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source));
+
+    // replace script blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
+
+    // replace pre blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source);
+
+    // replace textarea blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
+
+    return $source;
+}
+
+function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$subject) {
+    $_len = strlen($search_str);
+    $_pos = 0;
+    for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)
+        if (($_pos=strpos($subject, $search_str, $_pos))!==false)
+            $subject = substr_replace($subject, $replace[$_i], $_pos, $_len);
+        else
+            break;
+
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_table.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_table.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_table.php	(revision 1328)
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_table} function plugin
+ *
+ * Type:     function<br>
+ * Name:     html_table<br>
+ * Date:     Feb 17, 2003<br>
+ * Purpose:  make an html table from an array of data<br>
+ * Input:<br>
+ *         - loop = array to loop through
+ *         - cols = number of columns
+ *         - rows = number of rows
+ *         - table_attr = table attributes
+ *         - tr_attr = table row attributes (arrays are cycled)
+ *         - td_attr = table cell attributes (arrays are cycled)
+ *         - trailpad = value to pad trailing cells with
+ *         - vdir = vertical direction (default: "down", means top-to-bottom)
+ *         - hdir = horizontal direction (default: "right", means left-to-right)
+ *         - inner = inner loop (default "cols": print $loop line by line,
+ *                   $loop will be printed column by column otherwise)
+ *
+ *
+ * Examples:
+ * <pre>
+ * {table loop=$data}
+ * {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
+ * {table loop=$data cols=4 tr_attr=$colors}
+ * </pre>
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version  1.0
+ * @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table}
+ *          (Smarty online manual)
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_html_table($params, &$smarty)
+{
+    $table_attr = 'border="1"';
+    $tr_attr = '';
+    $td_attr = '';
+    $cols = 3;
+    $rows = 3;
+    $trailpad = '&nbsp;';
+    $vdir = 'down';
+    $hdir = 'right';
+    $inner = 'cols';
+
+    if (!isset($params['loop'])) {
+        $smarty->trigger_error("html_table: missing 'loop' parameter");
+        return;
+    }
+
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'loop':
+                $$_key = (array)$_value;
+                break;
+
+            case 'cols':
+            case 'rows':
+                $$_key = (int)$_value;
+                break;
+
+            case 'table_attr':
+            case 'trailpad':
+            case 'hdir':
+            case 'vdir':
+            case 'inner':
+                $$_key = (string)$_value;
+                break;
+
+            case 'tr_attr':
+            case 'td_attr':
+                $$_key = $_value;
+                break;
+        }
+    }
+
+    $loop_count = count($loop);
+    if (empty($params['rows'])) {
+        /* no rows specified */
+        $rows = ceil($loop_count/$cols);
+    } elseif (empty($params['cols'])) {
+        if (!empty($params['rows'])) {
+            /* no cols specified, but rows */
+            $cols = ceil($loop_count/$rows);
+        }
+    }
+
+    $output = "<table $table_attr>\n";
+
+    for ($r=0; $r<$rows; $r++) {
+        $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
+        $rx =  ($vdir == 'down') ? $r*$cols : ($rows-1-$r)*$cols;
+
+        for ($c=0; $c<$cols; $c++) {
+            $x =  ($hdir == 'right') ? $rx+$c : $rx+$cols-1-$c;
+            if ($inner!='cols') {
+                /* shuffle x to loop over rows*/
+                $x = floor($x/$cols) + ($x%$cols)*$rows;
+            }
+
+            if ($x<$loop_count) {
+                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[$x] . "</td>\n";
+            } else {
+                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
+            }
+        }
+        $output .= "</tr>\n";
+    }
+    $output .= "</table>\n";
+    
+    return $output;
+}
+
+function smarty_function_html_table_cycle($name, $var, $no) {
+    if(!is_array($var)) {
+        $ret = $var;
+    } else {
+        $ret = $var[$no % count($var)];
+    }
+    
+    return ($ret) ? ' '.$ret : '';
+}
+
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.wordwrap.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.wordwrap.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.wordwrap.php	(revision 1328)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty wordwrap modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     wordwrap<br>
+ * Purpose:  wrap a string of text at a given length
+ * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php
+ *          wordwrap (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param integer
+ * @param string
+ * @param boolean
+ * @return string
+ */
+function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
+{
+    return wordwrap($string,$length,$break,$cut);
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.regex_replace.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.regex_replace.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/modifier.regex_replace.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty regex_replace modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     regex_replace<br>
+ * Purpose:  regular expression search/replace
+ * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
+ *          regex_replace (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string|array
+ * @param string|array
+ * @return string
+ */
+function smarty_modifier_regex_replace($string, $search, $replace)
+{
+    if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
+        /* remove eval-modifier from $search */
+        $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
+    }
+       
+    return preg_replace($search, $replace, $string);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_options.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_options.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_options.php	(revision 1328)
@@ -0,0 +1,122 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_options} function plugin
+ *
+ * Type:     function<br>
+ * Name:     html_options<br>
+ * Input:<br>
+ *           - name       (optional) - string default "select"
+ *           - values     (required if no options supplied) - array
+ *           - options    (required if no values supplied) - associative array
+ *           - selected   (optional) - string default not set
+ *           - output     (required if not options supplied) - array
+ * Purpose:  Prints the list of <option> tags generated from
+ *           the passed parameters
+ * @link http://smarty.php.net/manual/en/language.function.html.options.php {html_image}
+ *      (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_options($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+    
+    $name = null;
+    $values = null;
+    $options = null;
+    $selected = array();
+    $output = null;
+    
+    $extra = '';
+    
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'name':
+                $$_key = (string)$_val;
+                break;
+            
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+                
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'selected':
+                $$_key = array_map('strval', array_values((array)$_val));
+                break;
+                
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    $_html_result = '';
+
+    if (isset($options)) {
+        
+        foreach ($options as $_key=>$_val)
+            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
+
+    } else {
+        
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
+        }
+
+    }
+
+    if(!empty($name)) {
+        $_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
+    }
+
+    return $_html_result;
+
+}
+
+function smarty_function_html_options_optoutput($key, $value, $selected) {
+    if(!is_array($value)) {
+        $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
+            smarty_function_escape_special_chars($key) . '"';
+        if (in_array((string)$key, $selected))
+            $_html_result .= ' selected="selected"';
+        $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
+    } else {
+        $_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
+    }
+    return $_html_result;
+}
+
+function smarty_function_html_options_optgroup($key, $values, $selected) {
+    $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
+    foreach ($values as $key => $value) {
+        $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected);
+    }
+    $optgroup_html .= "</optgroup>\n";
+    return $optgroup_html;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.counter.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.counter.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.counter.php	(revision 1328)
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {counter} function plugin
+ *
+ * Type:     function<br>
+ * Name:     counter<br>
+ * Purpose:  print out a counter value
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @link http://smarty.php.net/manual/en/language.function.counter.php {counter}
+ *       (Smarty online manual)
+ * @param array parameters
+ * @param Smarty
+ * @return string|null
+ */
+function smarty_function_counter($params, &$smarty)
+{
+    static $counters = array();
+
+    $name = (isset($params['name'])) ? $params['name'] : 'default';
+    if (!isset($counters[$name])) {
+        $counters[$name] = array(
+            'start'=>1,
+            'skip'=>1,
+            'direction'=>'up',
+            'count'=>1
+            );
+    }
+    $counter =& $counters[$name];
+
+    if (isset($params['start'])) {
+        $counter['start'] = $counter['count'] = (int)$params['start'];
+    }
+
+    if (!empty($params['assign'])) {
+        $counter['assign'] = $params['assign'];
+    }
+
+    if (isset($counter['assign'])) {
+        $smarty->assign($counter['assign'], $counter['count']);
+    }
+    
+    if (isset($params['print'])) {
+        $print = (bool)$params['print'];
+    } else {
+        $print = empty($counter['assign']);
+    }
+
+    if ($print) {
+        $retval = $counter['count'];
+    } else {
+        $retval = null;
+    }
+
+    if (isset($params['skip'])) {
+        $counter['skip'] = $params['skip'];
+    }
+    
+    if (isset($params['direction'])) {
+        $counter['direction'] = $params['direction'];
+    }
+
+    if ($counter['direction'] == "down")
+        $counter['count'] -= $counter['skip'];
+    else
+        $counter['count'] += $counter['skip'];
+    
+    return $retval;
+    
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/shared.make_timestamp.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/shared.make_timestamp.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/shared.make_timestamp.php	(revision 1328)
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Smarty shared plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Function: smarty_make_timestamp<br>
+ * Purpose:  used by other smarty functions to make a timestamp
+ *           from a string.
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_make_timestamp($string)
+{
+    if(empty($string)) {
+        // use "now":
+        $time = time();
+
+    } elseif (preg_match('/^\d{14}$/', $string)) {
+        // it is mysql timestamp format of YYYYMMDDHHMMSS?            
+        $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2),
+                       substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4));
+        
+    } elseif (is_numeric($string)) {
+        // it is a numeric string, we handle it as timestamp
+        $time = (int)$string;
+        
+    } else {
+        // strtotime should handle it
+        $time = strtotime($string);
+        if ($time == -1 || $time === false) {
+            // strtotime() was not able to parse $string, use "now":
+            $time = time();
+        }
+    }
+    return $time;
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_select_time.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_select_time.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.html_select_time.php	(revision 1328)
@@ -0,0 +1,194 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_select_time} function plugin
+ *
+ * Type:     function<br>
+ * Name:     html_select_time<br>
+ * Purpose:  Prints the dropdowns for time selection
+ * @link http://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time}
+ *          (Smarty online manual)
+ * @author Roberto Berto <roberto@berto.net>
+ * @credits Monte Ohrt <monte AT ohrt DOT com>
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_make_timestamp()
+ */
+function smarty_function_html_select_time($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
+    require_once $smarty->_get_plugin_filepath('function','html_options');
+    /* Default values. */
+    $prefix             = "Time_";
+    $time               = time();
+    $display_hours      = true;
+    $display_minutes    = true;
+    $display_seconds    = true;
+    $display_meridian   = true;
+    $use_24_hours       = true;
+    $minute_interval    = 1;
+    $second_interval    = 1;
+    /* Should the select boxes be part of an array when returned from PHP?
+       e.g. setting it to "birthday", would create "birthday[Hour]",
+       "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
+       Can be combined with prefix. */
+    $field_array        = null;
+    $all_extra          = null;
+    $hour_extra         = null;
+    $minute_extra       = null;
+    $second_extra       = null;
+    $meridian_extra     = null;
+
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'prefix':
+            case 'time':
+            case 'field_array':
+            case 'all_extra':
+            case 'hour_extra':
+            case 'minute_extra':
+            case 'second_extra':
+            case 'meridian_extra':
+                $$_key = (string)$_value;
+                break;
+
+            case 'display_hours':
+            case 'display_minutes':
+            case 'display_seconds':
+            case 'display_meridian':
+            case 'use_24_hours':
+                $$_key = (bool)$_value;
+                break;
+
+            case 'minute_interval':
+            case 'second_interval':
+                $$_key = (int)$_value;
+                break;
+
+            default:
+                $smarty->trigger_error("[html_select_time] unknown parameter $_key", E_USER_WARNING);
+        }
+    }
+
+    $time = smarty_make_timestamp($time);
+
+    $html_result = '';
+
+    if ($display_hours) {
+        $hours       = $use_24_hours ? range(0, 23) : range(1, 12);
+        $hour_fmt = $use_24_hours ? '%H' : '%I';
+        for ($i = 0, $for_max = count($hours); $i < $for_max; $i++)
+            $hours[$i] = sprintf('%02d', $hours[$i]);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Hour"';
+        }
+        if (null !== $hour_extra){
+            $html_result .= ' ' . $hour_extra;
+        }
+        if (null !== $all_extra){
+            $html_result .= ' ' . $all_extra;
+        }
+        $html_result .= '>'."\n";
+        $html_result .= smarty_function_html_options(array('output'          => $hours,
+                                                           'values'          => $hours,
+                                                           'selected'      => strftime($hour_fmt, $time),
+                                                           'print_result' => false),
+                                                     $smarty);
+        $html_result .= "</select>\n";
+    }
+
+    if ($display_minutes) {
+        $all_minutes = range(0, 59);
+        for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval)
+            $minutes[] = sprintf('%02d', $all_minutes[$i]);
+        $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Minute"';
+        }
+        if (null !== $minute_extra){
+            $html_result .= ' ' . $minute_extra;
+        }
+        if (null !== $all_extra){
+            $html_result .= ' ' . $all_extra;
+        }
+        $html_result .= '>'."\n";
+        
+        $html_result .= smarty_function_html_options(array('output'          => $minutes,
+                                                           'values'          => $minutes,
+                                                           'selected'      => $selected,
+                                                           'print_result' => false),
+                                                     $smarty);
+        $html_result .= "</select>\n";
+    }
+
+    if ($display_seconds) {
+        $all_seconds = range(0, 59);
+        for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval)
+            $seconds[] = sprintf('%02d', $all_seconds[$i]);
+        $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Second"';
+        }
+        
+        if (null !== $second_extra){
+            $html_result .= ' ' . $second_extra;
+        }
+        if (null !== $all_extra){
+            $html_result .= ' ' . $all_extra;
+        }
+        $html_result .= '>'."\n";
+        
+        $html_result .= smarty_function_html_options(array('output'          => $seconds,
+                                                           'values'          => $seconds,
+                                                           'selected'      => $selected,
+                                                           'print_result' => false),
+                                                     $smarty);
+        $html_result .= "</select>\n";
+    }
+
+    if ($display_meridian && !$use_24_hours) {
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Meridian"';
+        }
+        
+        if (null !== $meridian_extra){
+            $html_result .= ' ' . $meridian_extra;
+        }
+        if (null !== $all_extra){
+            $html_result .= ' ' . $all_extra;
+        }
+        $html_result .= '>'."\n";
+        
+        $html_result .= smarty_function_html_options(array('output'          => array('AM', 'PM'),
+                                                           'values'          => array('am', 'pm'),
+                                                           'selected'      => strtolower(strftime('%p', $time)),
+                                                           'print_result' => false),
+                                                     $smarty);
+        $html_result .= "</select>\n";
+    }
+
+    return $html_result;
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.mailto.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.mailto.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.mailto.php	(revision 1328)
@@ -0,0 +1,163 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {mailto} function plugin
+ *
+ * Type:     function<br>
+ * Name:     mailto<br>
+ * Date:     May 21, 2002
+ * Purpose:  automate mailto address link creation, and optionally
+ *           encode them.<br>
+ * Input:<br>
+ *         - address = e-mail address
+ *         - text = (optional) text to display, default is address
+ *         - encode = (optional) can be one of:
+ *                * none : no encoding (default)
+ *                * javascript : encode with javascript
+ *                * javascript_charcode : encode with javascript charcode
+ *                * hex : encode with hexidecimal (no javascript)
+ *         - cc = (optional) address(es) to carbon copy
+ *         - bcc = (optional) address(es) to blind carbon copy
+ *         - subject = (optional) e-mail subject
+ *         - newsgroups = (optional) newsgroup(s) to post to
+ *         - followupto = (optional) address(es) to follow up to
+ *         - extra = (optional) extra tags for the href link
+ *
+ * Examples:
+ * <pre>
+ * {mailto address="me@domain.com"}
+ * {mailto address="me@domain.com" encode="javascript"}
+ * {mailto address="me@domain.com" encode="hex"}
+ * {mailto address="me@domain.com" subject="Hello to you!"}
+ * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
+ * {mailto address="me@domain.com" extra='class="mailto"'}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.mailto.php {mailto}
+ *          (Smarty online manual)
+ * @version  1.2
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @author   credits to Jason Sweat (added cc, bcc and subject functionality)
+ * @param    array
+ * @param    Smarty
+ * @return   string
+ */
+function smarty_function_mailto($params, &$smarty)
+{
+    $extra = '';
+
+    if (empty($params['address'])) {
+        $smarty->trigger_error("mailto: missing 'address' parameter");
+        return;
+    } else {
+        $address = $params['address'];
+    }
+
+    $text = $address;
+
+    // netscape and mozilla do not decode %40 (@) in BCC field (bug?)
+    // so, don't encode it.
+    $mail_parms = array();
+    foreach ($params as $var=>$value) {
+        switch ($var) {
+            case 'cc':
+            case 'bcc':
+            case 'followupto':
+                if (!empty($value))
+                    $mail_parms[] = $var.'='.str_replace('%40','@',rawurlencode($value));
+                break;
+                
+            case 'subject':
+            case 'newsgroups':
+                $mail_parms[] = $var.'='.rawurlencode($value);
+                break;
+
+            case 'extra':
+            case 'text':
+                $$var = $value;
+
+            default:
+        }
+    }
+
+    $mail_parm_vals = '';
+    for ($i=0; $i<count($mail_parms); $i++) {
+        $mail_parm_vals .= (0==$i) ? '?' : '&';
+        $mail_parm_vals .= $mail_parms[$i];
+    }
+    $address .= $mail_parm_vals;
+
+    $encode = (empty($params['encode'])) ? 'none' : $params['encode'];
+    if (!in_array($encode,array('javascript','javascript_charcode','hex','none')) ) {
+        $smarty->trigger_error("mailto: 'encode' parameter must be none, javascript or hex");
+        return;
+    }
+
+    if ($encode == 'javascript' ) {
+        $string = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');';
+
+        $js_encode = '';
+        for ($x=0; $x < strlen($string); $x++) {
+            $js_encode .= '%' . bin2hex($string[$x]);
+        }
+
+        return '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>';
+
+    } elseif ($encode == 'javascript_charcode' ) {
+        $string = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
+
+        for($x = 0, $y = strlen($string); $x < $y; $x++ ) {
+            $ord[] = ord($string[$x]);   
+        }
+
+        $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n";
+        $_ret .= "<!--\n";
+        $_ret .= "{document.write(String.fromCharCode(";
+        $_ret .= implode(',',$ord);
+        $_ret .= "))";
+        $_ret .= "}\n";
+        $_ret .= "//-->\n";
+        $_ret .= "</script>\n";
+        
+        return $_ret;
+        
+        
+    } elseif ($encode == 'hex') {
+
+        preg_match('!^(.*)(\?.*)$!',$address,$match);
+        if(!empty($match[2])) {
+            $smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.");
+            return;
+        }
+        $address_encode = '';
+        for ($x=0; $x < strlen($address); $x++) {
+            if(preg_match('!\w!',$address[$x])) {
+                $address_encode .= '%' . bin2hex($address[$x]);
+            } else {
+                $address_encode .= $address[$x];
+            }
+        }
+        $text_encode = '';
+        for ($x=0; $x < strlen($text); $x++) {
+            $text_encode .= '&#x' . bin2hex($text[$x]).';';
+        }
+
+        $mailto = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;";
+        return '<a href="'.$mailto.$address_encode.'" '.$extra.'>'.$text_encode.'</a>';
+
+    } else {
+        // no encoding
+        return '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
+
+    }
+
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.popup_init.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.popup_init.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.popup_init.php	(revision 1328)
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {popup_init} function plugin
+ *
+ * Type:     function<br>
+ * Name:     popup_init<br>
+ * Purpose:  initialize overlib
+ * @link http://smarty.php.net/manual/en/language.function.popup.init.php {popup_init}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array
+ * @param Smarty
+ * @return string
+ */
+function smarty_function_popup_init($params, &$smarty)
+{
+    $zindex = 1000;
+    
+    if (!empty($params['zindex'])) {
+        $zindex = $params['zindex'];
+    }
+    
+    if (!empty($params['src'])) {
+        return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n"
+         . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n";
+    } else {
+        $smarty->trigger_error("popup_init: missing src parameter");
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.debug.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.debug.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/plugins/function.debug.php	(revision 1328)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {debug} function plugin
+ *
+ * Type:     function<br>
+ * Name:     debug<br>
+ * Date:     July 1, 2002<br>
+ * Purpose:  popup debug window
+ * @link http://smarty.php.net/manual/en/language.function.debug.php {debug}
+ *       (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version  1.0
+ * @param array
+ * @param Smarty
+ * @return string output from {@link Smarty::_generate_debug_output()}
+ */
+function smarty_function_debug($params, &$smarty)
+{
+    if (isset($params['output'])) {
+        $smarty->assign('_smarty_debug_output', $params['output']);
+    }
+    require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
+    return smarty_core_display_debug_console(null, $smarty);
+}
+
+/* vim: set expandtab: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Smarty_Compiler.class.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Smarty_Compiler.class.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/module/Smarty/libs/Smarty_Compiler.class.php	(revision 1328)
@@ -0,0 +1,2313 @@
+<?php
+
+/**
+ * Project:     Smarty: the PHP compiling template engine
+ * File:        Smarty_Compiler.class.php
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @link http://smarty.php.net/
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Andrei Zmievski <andrei@php.net>
+ * @version 2.6.13
+ * @copyright 2001-2005 New Digital Group, Inc.
+ * @package Smarty
+ */
+
+/* $Id$ */
+
+/**
+ * Template compiling class
+ * @package Smarty
+ */
+class Smarty_Compiler extends Smarty {
+
+    // internal vars
+    /**#@+
+     * @access private
+     */
+    var $_folded_blocks         =   array();    // keeps folded template blocks
+    var $_current_file          =   null;       // the current template being compiled
+    var $_current_line_no       =   1;          // line number for error messages
+    var $_capture_stack         =   array();    // keeps track of nested capture buffers
+    var $_plugin_info           =   array();    // keeps track of plugins to load
+    var $_init_smarty_vars      =   false;
+    var $_permitted_tokens      =   array('true','false','yes','no','on','off','null');
+    var $_db_qstr_regexp        =   null;        // regexps are setup in the constructor
+    var $_si_qstr_regexp        =   null;
+    var $_qstr_regexp           =   null;
+    var $_func_regexp           =   null;
+    var $_reg_obj_regexp        =   null;
+    var $_var_bracket_regexp    =   null;
+    var $_num_const_regexp      =   null;
+    var $_dvar_guts_regexp      =   null;
+    var $_dvar_regexp           =   null;
+    var $_cvar_regexp           =   null;
+    var $_svar_regexp           =   null;
+    var $_avar_regexp           =   null;
+    var $_mod_regexp            =   null;
+    var $_var_regexp            =   null;
+    var $_parenth_param_regexp  =   null;
+    var $_func_call_regexp      =   null;
+    var $_obj_ext_regexp        =   null;
+    var $_obj_start_regexp      =   null;
+    var $_obj_params_regexp     =   null;
+    var $_obj_call_regexp       =   null;
+    var $_cacheable_state       =   0;
+    var $_cache_attrs_count     =   0;
+    var $_nocache_count         =   0;
+    var $_cache_serial          =   null;
+    var $_cache_include         =   null;
+
+    var $_strip_depth           =   0;
+    var $_additional_newline    =   "\n";
+
+    /**#@-*/
+    /**
+     * The class constructor.
+     */
+    function Smarty_Compiler()
+    {
+        // matches double quoted strings:
+        // "foobar"
+        // "foo\"bar"
+        $this->_db_qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
+
+        // matches single quoted strings:
+        // 'foobar'
+        // 'foo\'bar'
+        $this->_si_qstr_regexp = '\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
+
+        // matches single or double quoted strings
+        $this->_qstr_regexp = '(?:' . $this->_db_qstr_regexp . '|' . $this->_si_qstr_regexp . ')';
+
+        // matches bracket portion of vars
+        // [0]
+        // [foo]
+        // [$bar]
+        $this->_var_bracket_regexp = '\[\$?[\w\.]+\]';
+
+        // matches numerical constants
+        // 30
+        // -12
+        // 13.22
+        $this->_num_const_regexp = '(?:\-?\d+(?:\.\d+)?)';
+
+        // matches $ vars (not objects):
+        // $foo
+        // $foo.bar
+        // $foo.bar.foobar
+        // $foo[0]
+        // $foo[$bar]
+        // $foo[5][blah]
+        // $foo[5].bar[$foobar][4]
+        $this->_dvar_math_regexp = '(?:[\+\*\/\%]|(?:-(?!>)))';
+        $this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]';
+        $this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp
+                . ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?';
+        $this->_dvar_regexp = '\$' . $this->_dvar_guts_regexp;
+
+        // matches config vars:
+        // #foo#
+        // #foobar123_foo#
+        $this->_cvar_regexp = '\#\w+\#';
+
+        // matches section vars:
+        // %foo.bar%
+        $this->_svar_regexp = '\%\w+\.\w+\%';
+
+        // matches all valid variables (no quotes, no modifiers)
+        $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|'
+           . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')';
+
+        // matches valid variable syntax:
+        // $foo
+        // $foo
+        // #foo#
+        // #foo#
+        // "text"
+        // "text"
+        $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')';
+
+        // matches valid object call (one level of object nesting allowed in parameters):
+        // $foo->bar
+        // $foo->bar()
+        // $foo->bar("text")
+        // $foo->bar($foo, $bar, "text")
+        // $foo->bar($foo, "foo")
+        // $foo->bar->foo()
+        // $foo->bar->foo->bar()
+        // $foo->bar($foo->bar)
+        // $foo->bar($foo->bar())
+        // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar))
+        $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
+        $this->_obj_restricted_param_regexp = '(?:'
+                . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')'
+                . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)';
+        $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
+                . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)';
+        $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
+                . '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)';
+        $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)';
+        $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)';
+        
+        // matches valid modifier syntax:
+        // |foo
+        // |@foo
+        // |foo:"bar"
+        // |foo:$bar
+        // |foo:"bar":$foobar
+        // |foo|bar
+        // |foo:$foo->bar
+        $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|'
+           . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)';
+
+        // matches valid function name:
+        // foo123
+        // _foo_bar
+        $this->_func_regexp = '[a-zA-Z_]\w*';
+
+        // matches valid registered object:
+        // foo->bar
+        $this->_reg_obj_regexp = '[a-zA-Z_]\w*->[a-zA-Z_]\w*';
+
+        // matches valid parameter values:
+        // true
+        // $foo
+        // $foo|bar
+        // #foo#
+        // #foo#|bar
+        // "text"
+        // "text"|bar
+        // $foo->bar
+        $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|'
+           . $this->_var_regexp . '|' . $this->_num_const_regexp  . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)';
+
+        // matches valid parenthesised function parameters:
+        //
+        // "text"
+        //    $foo, $bar, "text"
+        // $foo|bar, "foo"|bar, $foo->bar($foo)|bar
+        $this->_parenth_param_regexp = '(?:\((?:\w+|'
+                . $this->_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
+                . $this->_param_regexp . ')))*)?\))';
+
+        // matches valid function call:
+        // foo()
+        // foo_bar($foo)
+        // _foo_bar($foo,"bar")
+        // foo123($foo,$foo->bar(),"foo")
+        $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:'
+           . $this->_parenth_param_regexp . '))';
+    }
+
+    /**
+     * compile a resource
+     *
+     * sets $compiled_content to the compiled source
+     * @param string $resource_name
+     * @param string $source_content
+     * @param string $compiled_content
+     * @return true
+     */
+    function _compile_file($resource_name, $source_content, &$compiled_content)
+    {
+
+        if ($this->security) {
+            // do not allow php syntax to be executed unless specified
+            if ($this->php_handling == SMARTY_PHP_ALLOW &&
+                !$this->security_settings['PHP_HANDLING']) {
+                $this->php_handling = SMARTY_PHP_PASSTHRU;
+            }
+        }
+
+        $this->_load_filters();
+
+        $this->_current_file = $resource_name;
+        $this->_current_line_no = 1;
+        $ldq = preg_quote($this->left_delimiter, '~');
+        $rdq = preg_quote($this->right_delimiter, '~');
+
+        // run template source through prefilter functions
+        if (count($this->_plugins['prefilter']) > 0) {
+            foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
+                if ($prefilter === false) continue;
+                if ($prefilter[3] || is_callable($prefilter[0])) {
+                    $source_content = call_user_func_array($prefilter[0],
+                                                            array($source_content, &$this));
+                    $this->_plugins['prefilter'][$filter_name][3] = true;
+                } else {
+                    $this->_trigger_fatal_error("[plugin] prefilter '$filter_name' is not implemented");
+                }
+            }
+        }
+
+        /* fetch all special blocks */
+        $search = "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s";
+
+        preg_match_all($search, $source_content, $match,  PREG_SET_ORDER);
+        $this->_folded_blocks = $match;
+        reset($this->_folded_blocks);
+
+        /* replace special blocks by "{php}" */
+        $source_content = preg_replace($search.'e', "'"
+                                       . $this->_quote_replace($this->left_delimiter) . 'php'
+                                       . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
+                                       . $this->_quote_replace($this->right_delimiter)
+                                       . "'"
+                                       , $source_content);
+
+        /* Gather all template tags. */
+        preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match);
+        $template_tags = $_match[1];
+        /* Split content by template tags to obtain non-template content. */
+        $text_blocks = preg_split("~{$ldq}.*?{$rdq}~s", $source_content);
+
+        /* loop through text blocks */
+        for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) {
+            /* match anything resembling php tags */
+            if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?php[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) {
+                /* replace tags with placeholders to prevent recursive replacements */
+                $sp_match[1] = array_unique($sp_match[1]);
+                usort($sp_match[1], '_smarty_sort_length');
+                for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
+                    $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]);
+                }
+                /* process each one */
+                for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
+                    if ($this->php_handling == SMARTY_PHP_PASSTHRU) {
+                        /* echo php contents */
+                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?php echo \''.str_replace("'", "\'", $sp_match[1][$curr_sp]).'\'; ?>'."\n", $text_blocks[$curr_tb]);
+                    } else if ($this->php_handling == SMARTY_PHP_QUOTE) {
+                        /* quote php tags */
+                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', htmlspecialchars($sp_match[1][$curr_sp]), $text_blocks[$curr_tb]);
+                    } else if ($this->php_handling == SMARTY_PHP_REMOVE) {
+                        /* remove php tags */
+                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '', $text_blocks[$curr_tb]);
+                    } else {
+                        /* SMARTY_PHP_ALLOW, but echo non php starting tags */
+                        $sp_match[1][$curr_sp] = preg_replace('~(<\?(?!php|=|$))~i', '<?php echo \'\\1\'?>'."\n", $sp_match[1][$curr_sp]);
+                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', $sp_match[1][$curr_sp], $text_blocks[$curr_tb]);
+                    }
+                }
+            }
+        }
+
+        /* Compile the template tags into PHP code. */
+        $compiled_tags = array();
+        for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) {
+            $this->_current_line_no += substr_count($text_blocks[$i], "\n");
+            $compiled_tags[] = $this->_compile_tag($template_tags[$i]);
+            $this->_current_line_no += substr_count($template_tags[$i], "\n");
+        }
+        if (count($this->_tag_stack)>0) {
+            list($_open_tag, $_line_no) = end($this->_tag_stack);
+            $this->_syntax_error("unclosed tag \{$_open_tag} (opened line $_line_no).", E_USER_ERROR, __FILE__, __LINE__);
+            return;
+        }
+
+        /* Reformat $text_blocks between 'strip' and '/strip' tags,
+           removing spaces, tabs and newlines. */
+        $strip = false;
+        for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
+            if ($compiled_tags[$i] == '{strip}') {
+                $compiled_tags[$i] = '';
+                $strip = true;
+                /* remove leading whitespaces */
+                $text_blocks[$i + 1] = ltrim($text_blocks[$i + 1]);
+            }
+            if ($strip) {
+                /* strip all $text_blocks before the next '/strip' */
+                for ($j = $i + 1; $j < $for_max; $j++) {
+                    /* remove leading and trailing whitespaces of each line */
+                    $text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $text_blocks[$j]);
+                    if ($compiled_tags[$j] == '{/strip}') {                       
+                        /* remove trailing whitespaces from the last text_block */
+                        $text_blocks[$j] = rtrim($text_blocks[$j]);
+                    }
+                    $text_blocks[$j] = "<?php echo '" . strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>";
+                    if ($compiled_tags[$j] == '{/strip}') {
+                        $compiled_tags[$j] = "\n"; /* slurped by php, but necessary
+                                    if a newline is following the closing strip-tag */
+                        $strip = false;
+                        $i = $j;
+                        break;
+                    }
+                }
+            }
+        }
+        $compiled_content = '';
+
+        /* Interleave the compiled contents and text blocks to get the final result. */
+        for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
+            if ($compiled_tags[$i] == '') {
+                // tag result empty, remove first newline from following text block
+                $text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]);
+            }
+            $compiled_content .= $text_blocks[$i].$compiled_tags[$i];
+        }
+        $compiled_content .= $text_blocks[$i];
+
+        // remove \n from the end of the file, if any
+        if (strlen($compiled_content) && (substr($compiled_content, -1) == "\n") ) {
+            $compiled_content = substr($compiled_content, 0, -1);
+        }
+
+        if (!empty($this->_cache_serial)) {
+            $compiled_content = "<?php \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content;
+        }
+
+        // remove unnecessary close/open tags
+        $compiled_content = preg_replace('~\?>\n?<\?php~', '', $compiled_content);
+
+        // run compiled template through postfilter functions
+        if (count($this->_plugins['postfilter']) > 0) {
+            foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {
+                if ($postfilter === false) continue;
+                if ($postfilter[3] || is_callable($postfilter[0])) {
+                    $compiled_content = call_user_func_array($postfilter[0],
+                                                              array($compiled_content, &$this));
+                    $this->_plugins['postfilter'][$filter_name][3] = true;
+                } else {
+                    $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented");
+                }
+            }
+        }
+
+        // put header at the top of the compiled template
+        $template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
+        $template_header .= "         compiled from ".strtr(urlencode($resource_name), array('%2F'=>'/', '%3A'=>':'))." */ ?>\n";
+
+        /* Emit code to load needed plugins. */
+        $this->_plugins_code = '';
+        if (count($this->_plugin_info)) {
+            $_plugins_params = "array('plugins' => array(";
+            foreach ($this->_plugin_info as $plugin_type => $plugins) {
+                foreach ($plugins as $plugin_name => $plugin_info) {
+                    $_plugins_params .= "array('$plugin_type', '$plugin_name', '" . strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\")) . "', $plugin_info[1], ";
+                    $_plugins_params .= $plugin_info[2] ? 'true),' : 'false),';
+                }
+            }
+            $_plugins_params .= '))';
+            $plugins_code = "<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');\nsmarty_core_load_plugins($_plugins_params, \$this); ?>\n";
+            $template_header .= $plugins_code;
+            $this->_plugin_info = array();
+            $this->_plugins_code = $plugins_code;
+        }
+
+        if ($this->_init_smarty_vars) {
+            $template_header .= "<?php require_once(SMARTY_CORE_DIR . 'core.assign_smarty_interface.php');\nsmarty_core_assign_smarty_interface(null, \$this); ?>\n";
+            $this->_init_smarty_vars = false;
+        }
+
+        $compiled_content = $template_header . $compiled_content;
+        return true;
+    }
+
+    /**
+     * Compile a template tag
+     *
+     * @param string $template_tag
+     * @return string
+     */
+    function _compile_tag($template_tag)
+    {
+        /* Matched comment. */
+        if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*')
+            return '';
+        
+        /* Split tag into two three parts: command, command modifiers and the arguments. */
+        if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp
+                . '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*))
+                      (?:\s+(.*))?$
+                    ~xs', $template_tag, $match)) {
+            $this->_syntax_error("unrecognized tag: $template_tag", E_USER_ERROR, __FILE__, __LINE__);
+        }
+        
+        $tag_command = $match[1];
+        $tag_modifier = isset($match[2]) ? $match[2] : null;
+        $tag_args = isset($match[3]) ? $match[3] : null;
+
+        if (preg_match('~^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$~', $tag_command)) {
+            /* tag name is a variable or object */
+            $_return = $this->_parse_var_props($tag_command . $tag_modifier);
+            return "<?php echo $_return; ?>" . $this->_additional_newline;
+        }
+
+        /* If the tag name is a registered object, we process it. */
+        if (preg_match('~^\/?' . $this->_reg_obj_regexp . '$~', $tag_command)) {
+            return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier);
+        }
+
+        switch ($tag_command) {
+            case 'include':
+                return $this->_compile_include_tag($tag_args);
+
+            case 'include_php':
+                return $this->_compile_include_php_tag($tag_args);
+
+            case 'if':
+                $this->_push_tag('if');
+                return $this->_compile_if_tag($tag_args);
+
+            case 'else':
+                list($_open_tag) = end($this->_tag_stack);
+                if ($_open_tag != 'if' && $_open_tag != 'elseif')
+                    $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__);
+                else
+                    $this->_push_tag('else');
+                return '<?php else: ?>';
+
+            case 'elseif':
+                list($_open_tag) = end($this->_tag_stack);
+                if ($_open_tag != 'if' && $_open_tag != 'elseif')
+                    $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__);
+                if ($_open_tag == 'if')
+                    $this->_push_tag('elseif');
+                return $this->_compile_if_tag($tag_args, true);
+
+            case '/if':
+                $this->_pop_tag('if');
+                return '<?php endif; ?>';
+
+            case 'capture':
+                return $this->_compile_capture_tag(true, $tag_args);
+
+            case '/capture':
+                return $this->_compile_capture_tag(false);
+
+            case 'ldelim':
+                return $this->left_delimiter;
+
+            case 'rdelim':
+                return $this->right_delimiter;
+
+            case 'section':
+                $this->_push_tag('section');
+                return $this->_compile_section_start($tag_args);
+
+            case 'sectionelse':
+                $this->_push_tag('sectionelse');
+                return "<?php endfor; else: ?>";
+                break;
+
+            case '/section':
+                $_open_tag = $this->_pop_tag('section');
+                if ($_open_tag == 'sectionelse')
+                    return "<?php endif; ?>";
+                else
+                    return "<?php endfor; endif; ?>";
+
+            case 'foreach':
+                $this->_push_tag('foreach');
+                return $this->_compile_foreach_start($tag_args);
+                break;
+
+            case 'foreachelse':
+                $this->_push_tag('foreachelse');
+                return "<?php endforeach; else: ?>";
+
+            case '/foreach':
+                $_open_tag = $this->_pop_tag('foreach');
+                if ($_open_tag == 'foreachelse')
+                    return "<?php endif; unset(\$_from); ?>";
+                else
+                    return "<?php endforeach; endif; unset(\$_from); ?>";
+                break;
+
+            case 'strip':
+            case '/strip':
+                if (substr($tag_command, 0, 1)=='/') {
+                    $this->_pop_tag('strip');
+                    if (--$this->_strip_depth==0) { /* outermost closing {/strip} */
+                        $this->_additional_newline = "\n";
+                        return '{' . $tag_command . '}';
+                    }
+                } else {
+                    $this->_push_tag('strip');
+                    if ($this->_strip_depth++==0) { /* outermost opening {strip} */
+                        $this->_additional_newline = "";
+                        return '{' . $tag_command . '}';
+                    }
+                }
+                return '';
+
+            case 'php':
+                /* handle folded tags replaced by {php} */
+                list(, $block) = each($this->_folded_blocks);
+                $this->_current_line_no += substr_count($block[0], "\n");
+                /* the number of matched elements in the regexp in _compile_file()
+                   determins the type of folded tag that was found */
+                switch (count($block)) {
+                    case 2: /* comment */
+                        return '';
+
+                    case 3: /* literal */
+                        return "<?php echo '" . strtr($block[2], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>" . $this->_additional_newline;
+
+                    case 4: /* php */
+                        if ($this->security && !$this->security_settings['PHP_TAGS']) {
+                            $this->_syntax_error("(secure mode) php tags not permitted", E_USER_WARNING, __FILE__, __LINE__);
+                            return;
+                        }
+                        return '<?php ' . $block[3] .' ?>';
+                }
+                break;
+
+            case 'insert':
+                return $this->_compile_insert_tag($tag_args);
+
+            default:
+                if ($this->_compile_compiler_tag($tag_command, $tag_args, $output)) {
+                    return $output;
+                } else if ($this->_compile_block_tag($tag_command, $tag_args, $tag_modifier, $output)) {
+                    return $output;
+                } else if ($this->_compile_custom_tag($tag_command, $tag_args, $tag_modifier, $output)) {
+                    return $output;                    
+                } else {
+                    $this->_syntax_error("unrecognized tag '$tag_command'", E_USER_ERROR, __FILE__, __LINE__);
+                }
+
+        }
+    }
+
+
+    /**
+     * compile the custom compiler tag
+     *
+     * sets $output to the compiled custom compiler tag
+     * @param string $tag_command
+     * @param string $tag_args
+     * @param string $output
+     * @return boolean
+     */
+    function _compile_compiler_tag($tag_command, $tag_args, &$output)
+    {
+        $found = false;
+        $have_function = true;
+
+        /*
+         * First we check if the compiler function has already been registered
+         * or loaded from a plugin file.
+         */
+        if (isset($this->_plugins['compiler'][$tag_command])) {
+            $found = true;
+            $plugin_func = $this->_plugins['compiler'][$tag_command][0];
+            if (!is_callable($plugin_func)) {
+                $message = "compiler function '$tag_command' is not implemented";
+                $have_function = false;
+            }
+        }
+        /*
+         * Otherwise we need to load plugin file and look for the function
+         * inside it.
+         */
+        else if ($plugin_file = $this->_get_plugin_filepath('compiler', $tag_command)) {
+            $found = true;
+
+            include_once $plugin_file;
+
+            $plugin_func = 'smarty_compiler_' . $tag_command;
+            if (!is_callable($plugin_func)) {
+                $message = "plugin function $plugin_func() not found in $plugin_file\n";
+                $have_function = false;
+            } else {
+                $this->_plugins['compiler'][$tag_command] = array($plugin_func, null, null, null, true);
+            }
+        }
+
+        /*
+         * True return value means that we either found a plugin or a
+         * dynamically registered function. False means that we didn't and the
+         * compiler should now emit code to load custom function plugin for this
+         * tag.
+         */
+        if ($found) {
+            if ($have_function) {
+                $output = call_user_func_array($plugin_func, array($tag_args, &$this));
+                if($output != '') {
+                $output = '<?php ' . $this->_push_cacheable_state('compiler', $tag_command)
+                                   . $output
+                                   . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>';
+                }
+            } else {
+                $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__);
+            }
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+    /**
+     * compile block function tag
+     *
+     * sets $output to compiled block function tag
+     * @param string $tag_command
+     * @param string $tag_args
+     * @param string $tag_modifier
+     * @param string $output
+     * @return boolean
+     */
+    function _compile_block_tag($tag_command, $tag_args, $tag_modifier, &$output)
+    {
+        if (substr($tag_command, 0, 1) == '/') {
+            $start_tag = false;
+            $tag_command = substr($tag_command, 1);
+        } else
+            $start_tag = true;
+
+        $found = false;
+        $have_function = true;
+
+        /*
+         * First we check if the block function has already been registered
+         * or loaded from a plugin file.
+         */
+        if (isset($this->_plugins['block'][$tag_command])) {
+            $found = true;
+            $plugin_func = $this->_plugins['block'][$tag_command][0];
+            if (!is_callable($plugin_func)) {
+                $message = "block function '$tag_command' is not implemented";
+                $have_function = false;
+            }
+        }
+        /*
+         * Otherwise we need to load plugin file and look for the function
+         * inside it.
+         */
+        else if ($plugin_file = $this->_get_plugin_filepath('block', $tag_command)) {
+            $found = true;
+
+            include_once $plugin_file;
+
+            $plugin_func = 'smarty_block_' . $tag_command;
+            if (!function_exists($plugin_func)) {
+                $message = "plugin function $plugin_func() not found in $plugin_file\n";
+                $have_function = false;
+            } else {
+                $this->_plugins['block'][$tag_command] = array($plugin_func, null, null, null, true);
+
+            }
+        }
+
+        if (!$found) {
+            return false;
+        } else if (!$have_function) {
+            $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__);
+            return true;
+        }
+
+        /*
+         * Even though we've located the plugin function, compilation
+         * happens only once, so the plugin will still need to be loaded
+         * at runtime for future requests.
+         */
+        $this->_add_plugin('block', $tag_command);
+
+        if ($start_tag)
+            $this->_push_tag($tag_command);
+        else
+            $this->_pop_tag($tag_command);
+
+        if ($start_tag) {
+            $output = '<?php ' . $this->_push_cacheable_state('block', $tag_command);
+            $attrs = $this->_parse_attrs($tag_args);
+            $_cache_attrs='';
+            $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, $_cache_attrs);
+            $output .= "$_cache_attrs\$this->_tag_stack[] = array('$tag_command', array(".implode(',', $arg_list).')); ';
+            $output .= '$_block_repeat=true;' . $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);';
+            $output .= 'while ($_block_repeat) { ob_start(); ?>';
+        } else {
+            $output = '<?php $_block_content = ob_get_contents(); ob_end_clean(); ';
+            $_out_tag_text = $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat)';
+            if ($tag_modifier != '') {
+                $this->_parse_modifiers($_out_tag_text, $tag_modifier);
+            }
+            $output .= '$_block_repeat=false;echo ' . $_out_tag_text . '; } ';
+            $output .= " array_pop(\$this->_tag_stack); " . $this->_pop_cacheable_state('block', $tag_command) . '?>';
+        }
+
+        return true;
+    }
+
+
+    /**
+     * compile custom function tag
+     *
+     * @param string $tag_command
+     * @param string $tag_args
+     * @param string $tag_modifier
+     * @return string
+     */
+    function _compile_custom_tag($tag_command, $tag_args, $tag_modifier, &$output)
+    {
+        $found = false;
+        $have_function = true;
+
+        /*
+         * First we check if the custom function has already been registered
+         * or loaded from a plugin file.
+         */
+        if (isset($this->_plugins['function'][$tag_command])) {
+            $found = true;
+            $plugin_func = $this->_plugins['function'][$tag_command][0];
+            if (!is_callable($plugin_func)) {
+                $message = "custom function '$tag_command' is not implemented";
+                $have_function = false;
+            }
+        }
+        /*
+         * Otherwise we need to load plugin file and look for the function
+         * inside it.
+         */
+        else if ($plugin_file = $this->_get_plugin_filepath('function', $tag_command)) {
+            $found = true;
+
+            include_once $plugin_file;
+
+            $plugin_func = 'smarty_function_' . $tag_command;
+            if (!function_exists($plugin_func)) {
+                $message = "plugin function $plugin_func() not found in $plugin_file\n";
+                $have_function = false;
+            } else {
+                $this->_plugins['function'][$tag_command] = array($plugin_func, null, null, null, true);
+
+            }
+        }
+
+        if (!$found) {
+            return false;
+        } else if (!$have_function) {
+            $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__);
+            return true;
+        }
+
+        /* declare plugin to be loaded on display of the template that
+           we compile right now */
+        $this->_add_plugin('function', $tag_command);
+
+        $_cacheable_state = $this->_push_cacheable_state('function', $tag_command);
+        $attrs = $this->_parse_attrs($tag_args);
+        $_cache_attrs = '';
+        $arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs);
+
+        $output = $this->_compile_plugin_call('function', $tag_command).'(array('.implode(',', $arg_list)."), \$this)";
+        if($tag_modifier != '') {
+            $this->_parse_modifiers($output, $tag_modifier);
+        }
+
+        if($output != '') {
+            $output =  '<?php ' . $_cacheable_state . $_cache_attrs . 'echo ' . $output . ';'
+                . $this->_pop_cacheable_state('function', $tag_command) . "?>" . $this->_additional_newline;
+        }
+
+        return true;
+    }
+
+    /**
+     * compile a registered object tag
+     *
+     * @param string $tag_command
+     * @param array $attrs
+     * @param string $tag_modifier
+     * @return string
+     */
+    function _compile_registered_object_tag($tag_command, $attrs, $tag_modifier)
+    {
+        if (substr($tag_command, 0, 1) == '/') {
+            $start_tag = false;
+            $tag_command = substr($tag_command, 1);
+        } else {
+            $start_tag = true;
+        }
+
+        list($object, $obj_comp) = explode('->', $tag_command);
+
+        $arg_list = array();
+        if(count($attrs)) {
+            $_assign_var = false;
+            foreach ($attrs as $arg_name => $arg_value) {
+                if($arg_name == 'assign') {
+                    $_assign_var = $arg_value;
+                    unset($attrs['assign']);
+                    continue;
+                }
+                if (is_bool($arg_value))
+                    $arg_value = $arg_value ? 'true' : 'false';
+                $arg_list[] = "'$arg_name' => $arg_value";
+            }
+        }
+
+        if($this->_reg_objects[$object][2]) {
+            // smarty object argument format
+            $args = "array(".implode(',', (array)$arg_list)."), \$this";
+        } else {
+            // traditional argument format
+            $args = implode(',', array_values($attrs));
+            if (empty($args)) {
+                $args = 'null';
+            }
+        }
+
+        $prefix = '';
+        $postfix = '';
+        $newline = '';
+        if(!is_object($this->_reg_objects[$object][0])) {
+            $this->_trigger_fatal_error("registered '$object' is not an object" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__);
+        } elseif(!empty($this->_reg_objects[$object][1]) && !in_array($obj_comp, $this->_reg_objects[$object][1])) {
+            $this->_trigger_fatal_error("'$obj_comp' is not a registered component of object '$object'", $this->_current_file, $this->_current_line_no, __FILE__, __LINE__);
+        } elseif(method_exists($this->_reg_objects[$object][0], $obj_comp)) {
+            // method
+            if(in_array($obj_comp, $this->_reg_objects[$object][3])) {
+                // block method
+                if ($start_tag) {
+                    $prefix = "\$this->_tag_stack[] = array('$obj_comp', $args); ";
+                    $prefix .= "\$_block_repeat=true; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], null, \$this, \$_block_repeat); ";
+                    $prefix .= "while (\$_block_repeat) { ob_start();";
+                    $return = null;
+                    $postfix = '';
+            } else {
+                    $prefix = "\$_obj_block_content = ob_get_contents(); ob_end_clean(); ";
+                    $return = "\$_block_repeat=false; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$_obj_block_content, \$this, \$_block_repeat)";
+                    $postfix = "} array_pop(\$this->_tag_stack);";
+                }
+            } else {
+                // non-block method
+                $return = "\$this->_reg_objects['$object'][0]->$obj_comp($args)";
+            }
+        } else {
+            // property
+            $return = "\$this->_reg_objects['$object'][0]->$obj_comp";
+        }
+
+        if($return != null) {
+            if($tag_modifier != '') {
+                $this->_parse_modifiers($return, $tag_modifier);
+            }
+
+            if(!empty($_assign_var)) {
+                $output = "\$this->assign('" . $this->_dequote($_assign_var) ."',  $return);";
+            } else {
+                $output = 'echo ' . $return . ';';
+                $newline = $this->_additional_newline;
+            }
+        } else {
+            $output = '';
+        }
+
+        return '<?php ' . $prefix . $output . $postfix . "?>" . $newline;
+    }
+
+    /**
+     * Compile {insert ...} tag
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_insert_tag($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+        $name = $this->_dequote($attrs['name']);
+
+        if (empty($name)) {
+            $this->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        if (!empty($attrs['script'])) {
+            $delayed_loading = true;
+        } else {
+            $delayed_loading = false;
+        }
+
+        foreach ($attrs as $arg_name => $arg_value) {
+            if (is_bool($arg_value))
+                $arg_value = $arg_value ? 'true' : 'false';
+            $arg_list[] = "'$arg_name' => $arg_value";
+        }
+
+        $this->_add_plugin('insert', $name, $delayed_loading);
+
+        $_params = "array('args' => array(".implode(', ', (array)$arg_list)."))";
+
+        return "<?php require_once(SMARTY_CORE_DIR . 'core.run_insert_handler.php');\necho smarty_core_run_insert_handler($_params, \$this); ?>" . $this->_additional_newline;
+    }
+
+    /**
+     * Compile {include ...} tag
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_include_tag($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+        $arg_list = array();
+
+        if (empty($attrs['file'])) {
+            $this->_syntax_error("missing 'file' attribute in include tag", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        foreach ($attrs as $arg_name => $arg_value) {
+            if ($arg_name == 'file') {
+                $include_file = $arg_value;
+                continue;
+            } else if ($arg_name == 'assign') {
+                $assign_var = $arg_value;
+                continue;
+            }
+            if (is_bool($arg_value))
+                $arg_value = $arg_value ? 'true' : 'false';
+            $arg_list[] = "'$arg_name' => $arg_value";
+        }
+
+        $output = '<?php ';
+
+        if (isset($assign_var)) {
+            $output .= "ob_start();\n";
+        }
+
+        $output .=
+            "\$_smarty_tpl_vars = \$this->_tpl_vars;\n";
+
+
+        $_params = "array('smarty_include_tpl_file' => " . $include_file . ", 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))";
+        $output .= "\$this->_smarty_include($_params);\n" .
+        "\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
+        "unset(\$_smarty_tpl_vars);\n";
+
+        if (isset($assign_var)) {
+            $output .= "\$this->assign(" . $assign_var . ", ob_get_contents()); ob_end_clean();\n";
+        }
+
+        $output .= ' ?>';
+
+        return $output;
+
+    }
+
+    /**
+     * Compile {include ...} tag
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_include_php_tag($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+
+        if (empty($attrs['file'])) {
+            $this->_syntax_error("missing 'file' attribute in include_php tag", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        $assign_var = (empty($attrs['assign'])) ? '' : $this->_dequote($attrs['assign']);
+        $once_var = (empty($attrs['once']) || $attrs['once']=='false') ? 'false' : 'true';
+
+        $arg_list = array();
+        foreach($attrs as $arg_name => $arg_value) {
+            if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') {
+                if(is_bool($arg_value))
+                    $arg_value = $arg_value ? 'true' : 'false';
+                $arg_list[] = "'$arg_name' => $arg_value";
+            }
+        }
+
+        $_params = "array('smarty_file' => " . $attrs['file'] . ", 'smarty_assign' => '$assign_var', 'smarty_once' => $once_var, 'smarty_include_vars' => array(".implode(',', $arg_list)."))";
+
+        return "<?php require_once(SMARTY_CORE_DIR . 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, \$this); ?>" . $this->_additional_newline;
+    }
+
+
+    /**
+     * Compile {section ...} tag
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_section_start($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+        $arg_list = array();
+
+        $output = '<?php ';
+        $section_name = $attrs['name'];
+        if (empty($section_name)) {
+            $this->_syntax_error("missing section name", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        $output .= "unset(\$this->_sections[$section_name]);\n";
+        $section_props = "\$this->_sections[$section_name]";
+
+        foreach ($attrs as $attr_name => $attr_value) {
+            switch ($attr_name) {
+                case 'loop':
+                    $output .= "{$section_props}['loop'] = is_array(\$_loop=$attr_value) ? count(\$_loop) : max(0, (int)\$_loop); unset(\$_loop);\n";
+                    break;
+
+                case 'show':
+                    if (is_bool($attr_value))
+                        $show_attr_value = $attr_value ? 'true' : 'false';
+                    else
+                        $show_attr_value = "(bool)$attr_value";
+                    $output .= "{$section_props}['show'] = $show_attr_value;\n";
+                    break;
+
+                case 'name':
+                    $output .= "{$section_props}['$attr_name'] = $attr_value;\n";
+                    break;
+
+                case 'max':
+                case 'start':
+                    $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n";
+                    break;
+
+                case 'step':
+                    $output .= "{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\n";
+                    break;
+
+                default:
+                    $this->_syntax_error("unknown section attribute - '$attr_name'", E_USER_ERROR, __FILE__, __LINE__);
+                    break;
+            }
+        }
+
+        if (!isset($attrs['show']))
+            $output .= "{$section_props}['show'] = true;\n";
+
+        if (!isset($attrs['loop']))
+            $output .= "{$section_props}['loop'] = 1;\n";
+
+        if (!isset($attrs['max']))
+            $output .= "{$section_props}['max'] = {$section_props}['loop'];\n";
+        else
+            $output .= "if ({$section_props}['max'] < 0)\n" .
+                       "    {$section_props}['max'] = {$section_props}['loop'];\n";
+
+        if (!isset($attrs['step']))
+            $output .= "{$section_props}['step'] = 1;\n";
+
+        if (!isset($attrs['start']))
+            $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n";
+        else {
+            $output .= "if ({$section_props}['start'] < 0)\n" .
+                       "    {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" .
+                       "else\n" .
+                       "    {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n";
+        }
+
+        $output .= "if ({$section_props}['show']) {\n";
+        if (!isset($attrs['start']) && !isset($attrs['step']) && !isset($attrs['max'])) {
+            $output .= "    {$section_props}['total'] = {$section_props}['loop'];\n";
+        } else {
+            $output .= "    {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n";
+        }
+        $output .= "    if ({$section_props}['total'] == 0)\n" .
+                   "        {$section_props}['show'] = false;\n" .
+                   "} else\n" .
+                   "    {$section_props}['total'] = 0;\n";
+
+        $output .= "if ({$section_props}['show']):\n";
+        $output .= "
+            for ({$section_props}['index'] = {$section_props}['start'], {$section_props}['iteration'] = 1;
+                 {$section_props}['iteration'] <= {$section_props}['total'];
+                 {$section_props}['index'] += {$section_props}['step'], {$section_props}['iteration']++):\n";
+        $output .= "{$section_props}['rownum'] = {$section_props}['iteration'];\n";
+        $output .= "{$section_props}['index_prev'] = {$section_props}['index'] - {$section_props}['step'];\n";
+        $output .= "{$section_props}['index_next'] = {$section_props}['index'] + {$section_props}['step'];\n";
+        $output .= "{$section_props}['first']      = ({$section_props}['iteration'] == 1);\n";
+        $output .= "{$section_props}['last']       = ({$section_props}['iteration'] == {$section_props}['total']);\n";
+
+        $output .= "?>";
+
+        return $output;
+    }
+
+
+    /**
+     * Compile {foreach ...} tag.
+     *
+     * @param string $tag_args
+     * @return string
+     */
+    function _compile_foreach_start($tag_args)
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+        $arg_list = array();
+
+        if (empty($attrs['from'])) {
+            return $this->_syntax_error("foreach: missing 'from' attribute", E_USER_ERROR, __FILE__, __LINE__);
+        }
+        $from = $attrs['from'];
+
+        if (empty($attrs['item'])) {
+            return $this->_syntax_error("foreach: missing 'item' attribute", E_USER_ERROR, __FILE__, __LINE__);
+        }
+        $item = $this->_dequote($attrs['item']);
+        if (!preg_match('~^\w+$~', $item)) {
+            return $this->_syntax_error("'foreach: item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        if (isset($attrs['key'])) {
+            $key  = $this->_dequote($attrs['key']);
+            if (!preg_match('~^\w+$~', $key)) {
+                return $this->_syntax_error("foreach: 'key' must to be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);
+            }
+            $key_part = "\$this->_tpl_vars['$key'] => ";
+        } else {
+            $key = null;
+            $key_part = '';
+        }
+
+        if (isset($attrs['name'])) {
+            $name = $attrs['name'];
+        } else {
+            $name = null;
+        }
+
+        $output = '<?php ';
+        $output .= "\$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array'); }";
+        if (isset($name)) {
+            $foreach_props = "\$this->_foreach[$name]";
+            $output .= "{$foreach_props} = array('total' => count(\$_from), 'iteration' => 0);\n";
+            $output .= "if ({$foreach_props}['total'] > 0):\n";
+            $output .= "    foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n";
+            $output .= "        {$foreach_props}['iteration']++;\n";
+        } else {
+            $output .= "if (count(\$_from)):\n";
+            $output .= "    foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n";
+        }
+        $output .= '?>';
+
+        return $output;
+    }
+
+
+    /**
+     * Compile {capture} .. {/capture} tags
+     *
+     * @param boolean $start true if this is the {capture} tag
+     * @param string $tag_args
+     * @return string
+     */
+
+    function _compile_capture_tag($start, $tag_args = '')
+    {
+        $attrs = $this->_parse_attrs($tag_args);
+
+        if ($start) {
+            if (isset($attrs['name']))
+                $buffer = $attrs['name'];
+            else
+                $buffer = "'default'";
+
+            if (isset($attrs['assign']))
+                $assign = $attrs['assign'];
+            else
+                $assign = null;
+            $output = "<?php ob_start(); ?>";
+            $this->_capture_stack[] = array($buffer, $assign);
+        } else {
+            list($buffer, $assign) = array_pop($this->_capture_stack);
+            $output = "<?php \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); ";
+            if (isset($assign)) {
+                $output .= " \$this->assign($assign, ob_get_contents());";
+            }
+            $output .= "ob_end_clean(); ?>";
+        }
+
+        return $output;
+    }
+
+    /**
+     * Compile {if ...} tag
+     *
+     * @param string $tag_args
+     * @param boolean $elseif if true, uses elseif instead of if
+     * @return string
+     */
+    function _compile_if_tag($tag_args, $elseif = false)
+    {
+
+        /* Tokenize args for 'if' tag. */
+        preg_match_all('~(?>
+                ' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*)? | # valid object call
+                ' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)?    | # var or quoted string
+                \-?0[xX][0-9a-fA-F]+|\-?\d+(?:\.\d+)?|\.\d+|!==|===|==|!=|<>|<<|>>|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|\&|\~|<|>|\||\%|\+|\-|\/|\*|\@    | # valid non-word token
+                \b\w+\b                                                        | # valid word token
+                \S+                                                           # anything else
+                )~x', $tag_args, $match);
+
+        $tokens = $match[0];
+
+        if(empty($tokens)) {
+            $_error_msg = $elseif ? "'elseif'" : "'if'";
+            $_error_msg .= ' statement requires arguments'; 
+            $this->_syntax_error($_error_msg, E_USER_ERROR, __FILE__, __LINE__);
+        }
+            
+                
+        // make sure we have balanced parenthesis
+        $token_count = array_count_values($tokens);
+        if(isset($token_count['(']) && $token_count['('] != $token_count[')']) {
+            $this->_syntax_error("unbalanced parenthesis in if statement", E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        $is_arg_stack = array();
+
+        for ($i = 0; $i < count($tokens); $i++) {
+
+            $token = &$tokens[$i];
+
+            switch (strtolower($token)) {
+                case '!':
+                case '%':
+                case '!==':
+                case '==':
+                case '===':
+                case '>':
+                case '<':
+                case '!=':
+                case '<>':
+                case '<<':
+                case '>>':
+                case '<=':
+                case '>=':
+                case '&&':
+                case '||':
+                case '|':
+                case '^':
+                case '&':
+                case '~':
+                case ')':
+                case ',':
+                case '+':
+                case '-':
+                case '*':
+                case '/':
+                case '@':
+                    break;
+
+                case 'eq':
+                    $token = '==';
+                    break;
+
+                case 'ne':
+                case 'neq':
+                    $token = '!=';
+                    break;
+
+                case 'lt':
+                    $token = '<';
+                    break;
+
+                case 'le':
+                case 'lte':
+                    $token = '<=';
+                    break;
+
+                case 'gt':
+                    $token = '>';
+                    break;
+
+                case 'ge':
+                case 'gte':
+                    $token = '>=';
+                    break;
+
+                case 'and':
+                    $token = '&&';
+                    break;
+
+                case 'or':
+                    $token = '||';
+                    break;
+
+                case 'not':
+                    $token = '!';
+                    break;
+
+                case 'mod':
+                    $token = '%';
+                    break;
+
+                case '(':
+                    array_push($is_arg_stack, $i);
+                    break;
+
+                case 'is':
+                    /* If last token was a ')', we operate on the parenthesized
+                       expression. The start of the expression is on the stack.
+                       Otherwise, we operate on the last encountered token. */
+                    if ($tokens[$i-1] == ')')
+                        $is_arg_start = array_pop($is_arg_stack);
+                    else
+                        $is_arg_start = $i-1;
+                    /* Construct the argument for 'is' expression, so it knows
+                       what to operate on. */
+                    $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
+
+                    /* Pass all tokens from next one until the end to the
+                       'is' expression parsing function. The function will
+                       return modified tokens, where the first one is the result
+                       of the 'is' expression and the rest are the tokens it
+                       didn't touch. */
+                    $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
+
+                    /* Replace the old tokens with the new ones. */
+                    array_splice($tokens, $is_arg_start, count($tokens), $new_tokens);
+
+                    /* Adjust argument start so that it won't change from the
+                       current position for the next iteration. */
+                    $i = $is_arg_start;
+                    break;
+
+                default:
+                    if(preg_match('~^' . $this->_func_regexp . '$~', $token) ) {
+                            // function call
+                            if($this->security &&
+                               !in_array($token, $this->security_settings['IF_FUNCS'])) {
+                                $this->_syntax_error("(secure mode) '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__);
+                            }
+                    } elseif(preg_match('~^' . $this->_var_regexp . '$~', $token) && (strpos('+-*/^%&|', substr($token, -1)) === false) && isset($tokens[$i+1]) && $tokens[$i+1] == '(') {
+                        // variable function call
+                        $this->_syntax_error("variable function call '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__);                      
+                    } elseif(preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)$~', $token)) {
+                        // object or variable
+                        $token = $this->_parse_var_props($token);
+                    } elseif(is_numeric($token)) {
+                        // number, skip it
+                    } else {
+                        $this->_syntax_error("unidentified token '$token'", E_USER_ERROR, __FILE__, __LINE__);
+                    }
+                    break;
+            }
+        }
+
+        if ($elseif)
+            return '<?php elseif ('.implode(' ', $tokens).'): ?>';
+        else
+            return '<?php if ('.implode(' ', $tokens).'): ?>';
+    }
+
+
+    function _compile_arg_list($type, $name, $attrs, &$cache_code) {
+        $arg_list = array();
+
+        if (isset($type) && isset($name)
+            && isset($this->_plugins[$type])
+            && isset($this->_plugins[$type][$name])
+            && empty($this->_plugins[$type][$name][4])
+            && is_array($this->_plugins[$type][$name][5])
+            ) {
+            /* we have a list of parameters that should be cached */
+            $_cache_attrs = $this->_plugins[$type][$name][5];
+            $_count = $this->_cache_attrs_count++;
+            $cache_code = "\$_cache_attrs =& \$this->_smarty_cache_attrs('$this->_cache_serial','$_count');";
+
+        } else {
+            /* no parameters are cached */
+            $_cache_attrs = null;
+        }
+
+        foreach ($attrs as $arg_name => $arg_value) {
+            if (is_bool($arg_value))
+                $arg_value = $arg_value ? 'true' : 'false';
+            if (is_null($arg_value))
+                $arg_value = 'null';
+            if ($_cache_attrs && in_array($arg_name, $_cache_attrs)) {
+                $arg_list[] = "'$arg_name' => (\$this->_cache_including) ? \$_cache_attrs['$arg_name'] : (\$_cache_attrs['$arg_name']=$arg_value)";
+            } else {
+                $arg_list[] = "'$arg_name' => $arg_value";
+            }
+        }
+        return $arg_list;
+    }
+
+    /**
+     * Parse is expression
+     *
+     * @param string $is_arg
+     * @param array $tokens
+     * @return array
+     */
+    function _parse_is_expr($is_arg, $tokens)
+    {
+        $expr_end = 0;
+        $negate_expr = false;
+
+        if (($first_token = array_shift($tokens)) == 'not') {
+            $negate_expr = true;
+            $expr_type = array_shift($tokens);
+        } else
+            $expr_type = $first_token;
+
+        switch ($expr_type) {
+            case 'even':
+                if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') {
+                    $expr_end++;
+                    $expr_arg = $tokens[$expr_end++];
+                    $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))";
+                } else
+                    $expr = "!(1 & $is_arg)";
+                break;
+
+            case 'odd':
+                if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') {
+                    $expr_end++;
+                    $expr_arg = $tokens[$expr_end++];
+                    $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))";
+                } else
+                    $expr = "(1 & $is_arg)";
+                break;
+
+            case 'div':
+                if (@$tokens[$expr_end] == 'by') {
+                    $expr_end++;
+                    $expr_arg = $tokens[$expr_end++];
+                    $expr = "!($is_arg % " . $this->_parse_var_props($expr_arg) . ")";
+                } else {
+                    $this->_syntax_error("expecting 'by' after 'div'", E_USER_ERROR, __FILE__, __LINE__);
+                }
+                break;
+
+            default:
+                $this->_syntax_error("unknown 'is' expression - '$expr_type'", E_USER_ERROR, __FILE__, __LINE__);
+                break;
+        }
+
+        if ($negate_expr) {
+            $expr = "!($expr)";
+        }
+
+        array_splice($tokens, 0, $expr_end, $expr);
+
+        return $tokens;
+    }
+
+
+    /**
+     * Parse attribute string
+     *
+     * @param string $tag_args
+     * @return array
+     */
+    function _parse_attrs($tag_args)
+    {
+
+        /* Tokenize tag attributes. */
+        preg_match_all('~(?:' . $this->_obj_call_regexp . '|' . $this->_qstr_regexp . ' | (?>[^"\'=\s]+)
+                         )+ |
+                         [=]
+                        ~x', $tag_args, $match);
+        $tokens       = $match[0];
+
+        $attrs = array();
+        /* Parse state:
+            0 - expecting attribute name
+            1 - expecting '='
+            2 - expecting attribute value (not '=') */
+        $state = 0;
+
+        foreach ($tokens as $token) {
+            switch ($state) {
+                case 0:
+                    /* If the token is a valid identifier, we set attribute name
+                       and go to state 1. */
+                    if (preg_match('~^\w+$~', $token)) {
+                        $attr_name = $token;
+                        $state = 1;
+                    } else
+                        $this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__);
+                    break;
+
+                case 1:
+                    /* If the token is '=', then we go to state 2. */
+                    if ($token == '=') {
+                        $state = 2;
+                    } else
+                        $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
+                    break;
+
+                case 2:
+                    /* If token is not '=', we set the attribute value and go to
+                       state 0. */
+                    if ($token != '=') {
+                        /* We booleanize the token if it's a non-quoted possible
+                           boolean value. */
+                        if (preg_match('~^(on|yes|true)$~', $token)) {
+                            $token = 'true';
+                        } else if (preg_match('~^(off|no|false)$~', $token)) {
+                            $token = 'false';
+                        } else if ($token == 'null') {
+                            $token = 'null';
+                        } else if (preg_match('~^' . $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) {
+                            /* treat integer literally */
+                        } else if (!preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$~', $token)) {
+                            /* treat as a string, double-quote it escaping quotes */
+                            $token = '"'.addslashes($token).'"';
+                        }
+
+                        $attrs[$attr_name] = $token;
+                        $state = 0;
+                    } else
+                        $this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__);
+                    break;
+            }
+            $last_token = $token;
+        }
+
+        if($state != 0) {
+            if($state == 1) {
+                $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__);
+            } else {
+                $this->_syntax_error("missing attribute value", E_USER_ERROR, __FILE__, __LINE__);
+            }
+        }
+
+        $this->_parse_vars_props($attrs);
+
+        return $attrs;
+    }
+
+    /**
+     * compile multiple variables and section properties tokens into
+     * PHP code
+     *
+     * @param array $tokens
+     */
+    function _parse_vars_props(&$tokens)
+    {
+        foreach($tokens as $key => $val) {
+            $tokens[$key] = $this->_parse_var_props($val);
+        }
+    }
+
+    /**
+     * compile single variable and section properties token into
+     * PHP code
+     *
+     * @param string $val
+     * @param string $tag_attrs
+     * @return string
+     */
+    function _parse_var_props($val)
+    {
+        $val = trim($val);
+
+        if(preg_match('~^(' . $this->_obj_call_regexp . '|' . $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match)) {
+            // $ variable or object
+            $return = $this->_parse_var($match[1]);
+            $modifiers = $match[2];
+            if (!empty($this->default_modifiers) && !preg_match('~(^|\|)smarty:nodefaults($|\|)~',$modifiers)) {
+                $_default_mod_string = implode('|',(array)$this->default_modifiers);
+                $modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers;
+            }
+            $this->_parse_modifiers($return, $modifiers);
+            return $return;
+        } elseif (preg_match('~^' . $this->_db_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // double quoted text
+                preg_match('~^(' . $this->_db_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match);
+                $return = $this->_expand_quoted_text($match[1]);
+                if($match[2] != '') {
+                    $this->_parse_modifiers($return, $match[2]);
+                }
+                return $return;
+            }
+        elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // numerical constant
+                preg_match('~^(' . $this->_num_const_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match);
+                if($match[2] != '') {
+                    $this->_parse_modifiers($match[1], $match[2]);
+                    return $match[1];
+                }
+            }
+        elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // single quoted text
+                preg_match('~^(' . $this->_si_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match);
+                if($match[2] != '') {
+                    $this->_parse_modifiers($match[1], $match[2]);
+                    return $match[1];
+                }
+            }
+        elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // config var
+                return $this->_parse_conf_var($val);
+            }
+        elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) {
+                // section var
+                return $this->_parse_section_prop($val);
+            }
+        elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) {
+            // literal string
+            return $this->_expand_quoted_text('"' . strtr($val, array('\\' => '\\\\', '"' => '\\"')) .'"');
+        }
+        return $val;
+    }
+
+    /**
+     * expand quoted text with embedded variables
+     *
+     * @param string $var_expr
+     * @return string
+     */
+    function _expand_quoted_text($var_expr)
+    {
+        // if contains unescaped $, expand it
+        if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) {
+            $_match = $_match[0];
+            rsort($_match);
+            reset($_match);
+            foreach($_match as $_var) {
+                $var_expr = str_replace ($_var, '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."', $var_expr);
+            }
+            $_return = preg_replace('~\.""|(?<!\\\\)""\.~', '', $var_expr);
+        } else {
+            $_return = $var_expr;
+        }
+        // replace double quoted literal string with single quotes
+        $_return = preg_replace('~^"([\s\w]+)"$~',"'\\1'",$_return);
+        return $_return;
+    }
+
+    /**
+     * parse variable expression into PHP code
+     *
+     * @param string $var_expr
+     * @param string $output
+     * @return string
+     */
+    function _parse_var($var_expr)
+    {
+        $_has_math = false;
+        $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+        if(count($_math_vars) > 1) {
+            $_first_var = "";
+            $_complete_var = "";
+            $_output = "";
+            // simple check if there is any math, to stop recursion (due to modifiers with "xx % yy" as parameter)
+            foreach($_math_vars as $_k => $_math_var) {
+                $_math_var = $_math_vars[$_k];
+
+                if(!empty($_math_var) || is_numeric($_math_var)) {
+                    // hit a math operator, so process the stuff which came before it
+                    if(preg_match('~^' . $this->_dvar_math_regexp . '$~', $_math_var)) {
+                        $_has_math = true;
+                        if(!empty($_complete_var) || is_numeric($_complete_var)) {
+                            $_output .= $this->_parse_var($_complete_var);
+                        }
+
+                        // just output the math operator to php
+                        $_output .= $_math_var;
+
+                        if(empty($_first_var))
+                            $_first_var = $_complete_var;
+
+                        $_complete_var = "";
+                    } else {
+                        $_complete_var .= $_math_var;
+                    }
+                }
+            }
+            if($_has_math) {
+                if(!empty($_complete_var) || is_numeric($_complete_var))
+                    $_output .= $this->_parse_var($_complete_var);
+
+                // get the modifiers working (only the last var from math + modifier is left)
+                $var_expr = $_complete_var;
+            }
+        }
+
+        // prevent cutting of first digit in the number (we _definitly_ got a number if the first char is a digit)
+        if(is_numeric(substr($var_expr, 0, 1)))
+            $_var_ref = $var_expr;
+        else
+            $_var_ref = substr($var_expr, 1);
+        
+        if(!$_has_math) {
+            
+            // get [foo] and .foo and ->foo and (...) pieces
+            preg_match_all('~(?:^\w+)|' . $this->_obj_params_regexp . '|(?:' . $this->_var_bracket_regexp . ')|->\$?\w+|\.\$?\w+|\S+~', $_var_ref, $match);
+                        
+            $_indexes = $match[0];
+            $_var_name = array_shift($_indexes);
+
+            /* Handle $smarty.* variable references as a special case. */
+            if ($_var_name == 'smarty') {
+                /*
+                 * If the reference could be compiled, use the compiled output;
+                 * otherwise, fall back on the $smarty variable generated at
+                 * run-time.
+                 */
+                if (($smarty_ref = $this->_compile_smarty_ref($_indexes)) !== null) {
+                    $_output = $smarty_ref;
+                } else {
+                    $_var_name = substr(array_shift($_indexes), 1);
+                    $_output = "\$this->_smarty_vars['$_var_name']";
+                }
+            } elseif(is_numeric($_var_name) && is_numeric(substr($var_expr, 0, 1))) {
+                // because . is the operator for accessing arrays thru inidizes we need to put it together again for floating point numbers
+                if(count($_indexes) > 0)
+                {
+                    $_var_name .= implode("", $_indexes);
+                    $_indexes = array();
+                }
+                $_output = $_var_name;
+            } else {
+                $_output = "\$this->_tpl_vars['$_var_name']";
+            }
+
+            foreach ($_indexes as $_index) {
+                if (substr($_index, 0, 1) == '[') {
+                    $_index = substr($_index, 1, -1);
+                    if (is_numeric($_index)) {
+                        $_output .= "[$_index]";
+                    } elseif (substr($_index, 0, 1) == '$') {
+                        if (strpos($_index, '.') !== false) {
+                            $_output .= '[' . $this->_parse_var($_index) . ']';
+                        } else {
+                            $_output .= "[\$this->_tpl_vars['" . substr($_index, 1) . "']]";
+                        }
+                    } else {
+                        $_var_parts = explode('.', $_index);
+                        $_var_section = $_var_parts[0];
+                        $_var_section_prop = isset($_var_parts[1]) ? $_var_parts[1] : 'index';
+                        $_output .= "[\$this->_sections['$_var_section']['$_var_section_prop']]";
+                    }
+                } else if (substr($_index, 0, 1) == '.') {
+                    if (substr($_index, 1, 1) == '$')
+                        $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]";
+                    else
+                        $_output .= "['" . substr($_index, 1) . "']";
+                } else if (substr($_index,0,2) == '->') {
+                    if(substr($_index,2,2) == '__') {
+                        $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__);
+                    } elseif($this->security && substr($_index, 2, 1) == '_') {
+                        $this->_syntax_error('(secure) call to private object member is not allowed', E_USER_ERROR, __FILE__, __LINE__);
+                    } elseif (substr($_index, 2, 1) == '$') {
+                        if ($this->security) {
+                            $this->_syntax_error('(secure) call to dynamic object member is not allowed', E_USER_ERROR, __FILE__, __LINE__);
+                        } else {
+                            $_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index,3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}';
+                        }
+                    } else {
+                        $_output .= $_index;
+                    }
+                } elseif (substr($_index, 0, 1) == '(') {
+                    $_index = $this->_parse_parenth_args($_index);
+                    $_output .= $_index;
+                } else {
+                    $_output .= $_index;
+                }
+            }
+        }
+
+        return $_output;
+    }
+
+    /**
+     * parse arguments in function call parenthesis
+     *
+     * @param string $parenth_args
+     * @return string
+     */
+    function _parse_parenth_args($parenth_args)
+    {
+        preg_match_all('~' . $this->_param_regexp . '~',$parenth_args, $match);
+        $orig_vals = $match = $match[0];
+        $this->_parse_vars_props($match);
+        $replace = array();
+        for ($i = 0, $count = count($match); $i < $count; $i++) {
+            $replace[$orig_vals[$i]] = $match[$i];
+        }
+        return strtr($parenth_args, $replace);
+    }
+
+    /**
+     * parse configuration variable expression into PHP code
+     *
+     * @param string $conf_var_expr
+     */
+    function _parse_conf_var($conf_var_expr)
+    {
+        $parts = explode('|', $conf_var_expr, 2);
+        $var_ref = $parts[0];
+        $modifiers = isset($parts[1]) ? $parts[1] : '';
+
+        $var_name = substr($var_ref, 1, -1);
+
+        $output = "\$this->_config[0]['vars']['$var_name']";
+
+        $this->_parse_modifiers($output, $modifiers);
+
+        return $output;
+    }
+
+    /**
+     * parse section property expression into PHP code
+     *
+     * @param string $section_prop_expr
+     * @return string
+     */
+    function _parse_section_prop($section_prop_expr)
+    {
+        $parts = explode('|', $section_prop_expr, 2);
+        $var_ref = $parts[0];
+        $modifiers = isset($parts[1]) ? $parts[1] : '';
+
+        preg_match('!%(\w+)\.(\w+)%!', $var_ref, $match);
+        $section_name = $match[1];
+        $prop_name = $match[2];
+
+        $output = "\$this->_sections['$section_name']['$prop_name']";
+
+        $this->_parse_modifiers($output, $modifiers);
+
+        return $output;
+    }
+
+
+    /**
+     * parse modifier chain into PHP code
+     *
+     * sets $output to parsed modified chain
+     * @param string $output
+     * @param string $modifier_string
+     */
+    function _parse_modifiers(&$output, $modifier_string)
+    {
+        preg_match_all('~\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)~', '|' . $modifier_string, $_match);
+        list(, $_modifiers, $modifier_arg_strings) = $_match;
+
+        for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) {
+            $_modifier_name = $_modifiers[$_i];
+
+            if($_modifier_name == 'smarty') {
+                // skip smarty modifier
+                continue;
+            }
+
+            preg_match_all('~:(' . $this->_qstr_regexp . '|[^:]+)~', $modifier_arg_strings[$_i], $_match);
+            $_modifier_args = $_match[1];
+
+            if (substr($_modifier_name, 0, 1) == '@') {
+                $_map_array = false;
+                $_modifier_name = substr($_modifier_name, 1);
+            } else {
+                $_map_array = true;
+            }
+
+            if (empty($this->_plugins['modifier'][$_modifier_name])
+                && !$this->_get_plugin_filepath('modifier', $_modifier_name)
+                && function_exists($_modifier_name)) {
+                if ($this->security && !in_array($_modifier_name, $this->security_settings['MODIFIER_FUNCS'])) {
+                    $this->_trigger_fatal_error("[plugin] (secure mode) modifier '$_modifier_name' is not allowed" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__);
+                } else {
+                    $this->_plugins['modifier'][$_modifier_name] = array($_modifier_name,  null, null, false);
+                }
+            }
+            $this->_add_plugin('modifier', $_modifier_name);
+
+            $this->_parse_vars_props($_modifier_args);
+
+            if($_modifier_name == 'default') {
+                // supress notifications of default modifier vars and args
+                if(substr($output, 0, 1) == '$') {
+                    $output = '@' . $output;
+                }
+                if(isset($_modifier_args[0]) && substr($_modifier_args[0], 0, 1) == '$') {
+                    $_modifier_args[0] = '@' . $_modifier_args[0];
+                }
+            }
+            if (count($_modifier_args) > 0)
+                $_modifier_args = ', '.implode(', ', $_modifier_args);
+            else
+                $_modifier_args = '';
+
+            if ($_map_array) {
+                $output = "((is_array(\$_tmp=$output)) ? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))";
+
+            } else {
+
+                $output = $this->_compile_plugin_call('modifier', $_modifier_name)."($output$_modifier_args)";
+
+            }
+        }
+    }
+
+
+    /**
+     * add plugin
+     *
+     * @param string $type
+     * @param string $name
+     * @param boolean? $delayed_loading
+     */
+    function _add_plugin($type, $name, $delayed_loading = null)
+    {
+        if (!isset($this->_plugin_info[$type])) {
+            $this->_plugin_info[$type] = array();
+        }
+        if (!isset($this->_plugin_info[$type][$name])) {
+            $this->_plugin_info[$type][$name] = array($this->_current_file,
+                                                      $this->_current_line_no,
+                                                      $delayed_loading);
+        }
+    }
+
+
+    /**
+     * Compiles references of type $smarty.foo
+     *
+     * @param string $indexes
+     * @return string
+     */
+    function _compile_smarty_ref(&$indexes)
+    {
+        /* Extract the reference name. */
+        $_ref = substr($indexes[0], 1);
+        foreach($indexes as $_index_no=>$_index) {
+            if (substr($_index, 0, 1) != '.' && $_index_no<2 || !preg_match('~^(\.|\[|->)~', $_index)) {
+                $this->_syntax_error('$smarty' . implode('', array_slice($indexes, 0, 2)) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);
+            }
+        }
+
+        switch ($_ref) {
+            case 'now':
+                $compiled_ref = 'time()';
+                $_max_index = 1;
+                break;
+
+            case 'foreach':
+                array_shift($indexes);
+                $_var = $this->_parse_var_props(substr($indexes[0], 1));
+                $_propname = substr($indexes[1], 1);
+                $_max_index = 1;
+                switch ($_propname) {
+                    case 'index':
+                        array_shift($indexes);
+                        $compiled_ref = "(\$this->_foreach[$_var]['iteration']-1)";
+                        break;
+                        
+                    case 'first':
+                        array_shift($indexes);
+                        $compiled_ref = "(\$this->_foreach[$_var]['iteration'] <= 1)";
+                        break;
+
+                    case 'last':
+                        array_shift($indexes);
+                        $compiled_ref = "(\$this->_foreach[$_var]['iteration'] == \$this->_foreach[$_var]['total'])";
+                        break;
+                        
+                    case 'show':
+                        array_shift($indexes);
+                        $compiled_ref = "(\$this->_foreach[$_var]['total'] > 0)";
+                        break;
+                        
+                    default:
+                        unset($_max_index);
+                        $compiled_ref = "\$this->_foreach[$_var]";
+                }
+                break;
+
+            case 'section':
+                array_shift($indexes);
+                $_var = $this->_parse_var_props(substr($indexes[0], 1));
+                $compiled_ref = "\$this->_sections[$_var]";
+                break;
+
+            case 'get':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_GET' : "\$GLOBALS['HTTP_GET_VARS']";
+                break;
+
+            case 'post':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_POST' : "\$GLOBALS['HTTP_POST_VARS']";
+                break;
+
+            case 'cookies':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_COOKIE' : "\$GLOBALS['HTTP_COOKIE_VARS']";
+                break;
+
+            case 'env':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_ENV' : "\$GLOBALS['HTTP_ENV_VARS']";
+                break;
+
+            case 'server':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_SERVER' : "\$GLOBALS['HTTP_SERVER_VARS']";
+                break;
+
+            case 'session':
+                $compiled_ref = ($this->request_use_auto_globals) ? '$_SESSION' : "\$GLOBALS['HTTP_SESSION_VARS']";
+                break;
+
+            /*
+             * These cases are handled either at run-time or elsewhere in the
+             * compiler.
+             */
+            case 'request':
+                if ($this->request_use_auto_globals) {
+                    $compiled_ref = '$_REQUEST';
+                    break;
+                } else {
+                    $this->_init_smarty_vars = true;
+                }
+                return null;
+
+            case 'capture':
+                return null;
+
+            case 'template':
+                $compiled_ref = "'$this->_current_file'";
+                $_max_index = 1;
+                break;
+
+            case 'version':
+                $compiled_ref = "'$this->_version'";
+                $_max_index = 1;
+                break;
+
+            case 'const':
+                if ($this->security && !$this->security_settings['ALLOW_CONSTANTS']) {
+                    $this->_syntax_error("(secure mode) constants not permitted",
+                                         E_USER_WARNING, __FILE__, __LINE__);
+                    return;
+                }
+                array_shift($indexes);
+                if (preg_match('!^\.\w+$!', $indexes[0])) {
+                    $compiled_ref = '@' . substr($indexes[0], 1);
+                } else {
+                    $_val = $this->_parse_var_props(substr($indexes[0], 1));
+                    $compiled_ref = '@constant(' . $_val . ')';
+                }
+                $_max_index = 1;
+                break;
+
+            case 'config':
+                $compiled_ref = "\$this->_config[0]['vars']";
+                $_max_index = 3;
+                break;
+
+            case 'ldelim':
+                $compiled_ref = "'$this->left_delimiter'";
+                break;
+
+            case 'rdelim':
+                $compiled_ref = "'$this->right_delimiter'";
+                break;
+                
+            default:
+                $this->_syntax_error('$smarty.' . $_ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__);
+                break;
+        }
+
+        if (isset($_max_index) && count($indexes) > $_max_index) {
+            $this->_syntax_error('$smarty' . implode('', $indexes) .' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);
+        }
+
+        array_shift($indexes);
+        return $compiled_ref;
+    }
+
+    /**
+     * compiles call to plugin of type $type with name $name
+     * returns a string containing the function-name or method call
+     * without the paramter-list that would have follow to make the
+     * call valid php-syntax
+     *
+     * @param string $type
+     * @param string $name
+     * @return string
+     */
+    function _compile_plugin_call($type, $name) {
+        if (isset($this->_plugins[$type][$name])) {
+            /* plugin loaded */
+            if (is_array($this->_plugins[$type][$name][0])) {
+                return ((is_object($this->_plugins[$type][$name][0][0])) ?
+                        "\$this->_plugins['$type']['$name'][0][0]->"    /* method callback */
+                        : (string)($this->_plugins[$type][$name][0][0]).'::'    /* class callback */
+                       ). $this->_plugins[$type][$name][0][1];
+
+            } else {
+                /* function callback */
+                return $this->_plugins[$type][$name][0];
+
+            }
+        } else {
+            /* plugin not loaded -> auto-loadable-plugin */
+            return 'smarty_'.$type.'_'.$name;
+
+        }
+    }
+
+    /**
+     * load pre- and post-filters
+     */
+    function _load_filters()
+    {
+        if (count($this->_plugins['prefilter']) > 0) {
+            foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
+                if ($prefilter === false) {
+                    unset($this->_plugins['prefilter'][$filter_name]);
+                    $_params = array('plugins' => array(array('prefilter', $filter_name, null, null, false)));
+                    require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+                    smarty_core_load_plugins($_params, $this);
+                }
+            }
+        }
+        if (count($this->_plugins['postfilter']) > 0) {
+            foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {
+                if ($postfilter === false) {
+                    unset($this->_plugins['postfilter'][$filter_name]);
+                    $_params = array('plugins' => array(array('postfilter', $filter_name, null, null, false)));
+                    require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+                    smarty_core_load_plugins($_params, $this);
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Quote subpattern references
+     *
+     * @param string $string
+     * @return string
+     */
+    function _quote_replace($string)
+    {
+        return strtr($string, array('\\' => '\\\\', '$' => '\\$'));
+    }
+
+    /**
+     * display Smarty syntax error
+     *
+     * @param string $error_msg
+     * @param integer $error_type
+     * @param string $file
+     * @param integer $line
+     */
+    function _syntax_error($error_msg, $error_type = E_USER_ERROR, $file=null, $line=null)
+    {
+        $this->_trigger_fatal_error("syntax error: $error_msg", $this->_current_file, $this->_current_line_no, $file, $line, $error_type);
+    }
+
+
+    /**
+     * check if the compilation changes from cacheable to
+     * non-cacheable state with the beginning of the current
+     * plugin. return php-code to reflect the transition.
+     * @return string
+     */
+    function _push_cacheable_state($type, $name) {
+        $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4];
+        if ($_cacheable
+            || 0<$this->_cacheable_state++) return '';
+        if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty'));
+        $_ret = 'if ($this->caching && !$this->_cache_including) { echo \'{nocache:'
+            . $this->_cache_serial . '#' . $this->_nocache_count
+            . '}\'; };';
+        return $_ret;
+    }
+
+
+    /**
+     * check if the compilation changes from non-cacheable to
+     * cacheable state with the end of the current plugin return
+     * php-code to reflect the transition.
+     * @return string
+     */
+    function _pop_cacheable_state($type, $name) {
+        $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4];
+        if ($_cacheable
+            || --$this->_cacheable_state>0) return '';
+        return 'if ($this->caching && !$this->_cache_including) { echo \'{/nocache:'
+            . $this->_cache_serial . '#' . ($this->_nocache_count++)
+            . '}\'; };';
+    }
+
+
+    /**
+     * push opening tag-name, file-name and line-number on the tag-stack
+     * @param string the opening tag's name
+     */
+    function _push_tag($open_tag)
+    {
+        array_push($this->_tag_stack, array($open_tag, $this->_current_line_no));
+    }
+
+    /**
+     * pop closing tag-name
+     * raise an error if this stack-top doesn't match with the closing tag
+     * @param string the closing tag's name
+     * @return string the opening tag's name
+     */
+    function _pop_tag($close_tag)
+    {
+        $message = '';
+        if (count($this->_tag_stack)>0) {
+            list($_open_tag, $_line_no) = array_pop($this->_tag_stack);
+            if ($close_tag == $_open_tag) {
+                return $_open_tag;
+            }
+            if ($close_tag == 'if' && ($_open_tag == 'else' || $_open_tag == 'elseif' )) {
+                return $this->_pop_tag($close_tag);
+            }
+            if ($close_tag == 'section' && $_open_tag == 'sectionelse') {
+                $this->_pop_tag($close_tag);
+                return $_open_tag;
+            }
+            if ($close_tag == 'foreach' && $_open_tag == 'foreachelse') {
+                $this->_pop_tag($close_tag);
+                return $_open_tag;
+            }
+            if ($_open_tag == 'else' || $_open_tag == 'elseif') {
+                $_open_tag = 'if';
+            } elseif ($_open_tag == 'sectionelse') {
+                $_open_tag = 'section';
+            } elseif ($_open_tag == 'foreachelse') {
+                $_open_tag = 'foreach';
+            }
+            $message = " expected {/$_open_tag} (opened line $_line_no).";
+        }
+        $this->_syntax_error("mismatched tag {/$close_tag}.$message",
+                             E_USER_ERROR, __FILE__, __LINE__);
+    }
+
+}
+
+/**
+ * compare to values by their string length
+ *
+ * @access private
+ * @param string $a
+ * @param string $b
+ * @return 0|-1|1
+ */
+function _smarty_sort_length($a, $b)
+{
+    if($a == $b)
+        return 0;
+
+    if(strlen($a) == strlen($b))
+        return ($a > $b) ? -1 : 1;
+
+    return (strlen($a) > strlen($b)) ? -1 : 1;
+}
+
+
+/* vim: set et: */
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/lib/slib.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/lib/slib.php	(revision 3650)
+++ /temp/tags/eccube-0_9_2beta/data/lib/slib.php	(revision 3650)
@@ -0,0 +1,2342 @@
+<?php
+
+//---¤³¤Î¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ò»ØÄê
+$INC_PATH = realpath( dirname( __FILE__) );
+require_once( $INC_PATH ."/../conf/conf.php" );
+require_once( $INC_PATH ."/../class/SC_DbConn.php" );
+
+// Á´¥Ú¡¼¥¸¶¦ÄÌ¥¨¥é¡¼
+$GLOBAL_ERR = "";
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½é´ü½èÍý
+sfInitInstall();
+// ¥¢¥Ã¥×¥Ç¡¼¥È¤ÇÀ¸À®¤µ¤ì¤¿PHP¤òÆÉ¤ß½Ð¤¹
+sfLoadUpdateModule();
+
+/* ¥Æ¡¼¥Ö¥ë¤ÎÂ¸ºß¥Á¥§¥Ã¥¯¥Á¥§¥Ã¥¯ */
+function sfTabaleExists($table_name) {
+	$objQuery = new SC_Query();	
+	$sql = "SELECT
+				relname
+			FROM
+			    pg_class
+			WHERE
+				(relkind = 'r' OR relkind = 'v') AND 
+			    relname = ? 
+			GROUP BY
+				relname";
+	$arrRet = $objQuery->getAll($sql, array($table_name));
+	if(count($arrRet) > 0) {
+		$flg = true;
+	} else {
+		$flg = false;
+	}	
+	return $flg;
+}
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½é´ü½èÍý
+function sfInitInstall() {
+	// ¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+	if(!defined('ECCUBE_INSTALL')) {
+		if(!ereg("^/install/", $_SERVER['PHP_SELF'])) {
+			header("Location: /install/");
+		}	
+	} else {
+		$path = ROOT_DIR . "html/install/index.php";
+		if(file_exists($path)) {
+			sfErrorHeader(">> /install/index.php¤Ï¡¢¥¤¥ó¥¹¥È¡¼¥ë´°Î»¸å¤Ë¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡£");
+		}
+	}
+}
+
+// ¥¢¥Ã¥×¥Ç¡¼¥È¤ÇÀ¸À®¤µ¤ì¤¿PHP¤òÆÉ¤ß½Ð¤·
+function sfLoadUpdateModule() {
+	if(ereg("^/install/", $_SERVER['PHP_SELF'])) {
+		return;
+	}		
+	//DB¤«¤éÀßÄê¾ðÊó¤ò¼èÆÀ
+	if(defined('DB_USER') && defined('DB_PASSWORD') && defined('DB_SERVER') && defined('DB_NAME')) {
+		$objConn = new SC_DbConn(DEFAULT_DSN);
+		// ºÇ½é¤Ë¼Â¹Ô¤¹¤ëPHP¥½¡¼¥¹¤ò¸¡º÷¤¹¤ë
+		$arrRet = $objConn->getAll("SELECT extern_php FROM dtb_update WHERE main_php = ? OR main_php = '*'",array($_SERVER['PHP_SELF']));
+		foreach($arrRet as $array) {
+			if($array['extern_php'] != "") {
+				$path = ROOT_DIR . $array['extern_php'];
+				if(file_exists($path)) {
+					require_once($path);
+				}
+			}
+		}
+	}
+}
+
+function sf_getBasisData() {
+	//DB¤«¤éÀßÄê¾ðÊó¤ò¼èÆÀ
+	$objConn = new SC_DbConn(DEFAULT_DSN);
+	$result = $objConn->getAll("SELECT * FROM dtb_baseinfo");
+	if(is_array($result[0])) {
+		foreach ( $result[0] as $key=>$value ){
+			$CONF["$key"] = $value;
+		}
+	}
+	return $CONF;
+}
+
+// Áõ¾þÉÕ¤­¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ÎÉ½¼¨
+function sfErrorHeader($mess, $print = false) {
+	global $GLOBAL_ERR;
+	if($GLOBAL_ERR == "") {
+		$GLOBAL_ERR = "<meta http-equiv='Content-Type' content='text/html; charset=EUC-JP'>\n";
+	}
+	$GLOBAL_ERR.= "<table width='100%' border='0' cellspacing='0' cellpadding='0' summary=' '>\n";
+	$GLOBAL_ERR.= "<tr>\n";
+	$GLOBAL_ERR.= "<td bgcolor='#ffeebb' height='25' colspan='2' align='center'>\n";
+	$GLOBAL_ERR.= "<SPAN style='color:red; font-size:12px'><strong>" . $mess . "</strong></span>\n";
+	$GLOBAL_ERR.= "</td>\n";
+	$GLOBAL_ERR.= "	</tr>\n";
+	$GLOBAL_ERR.= "</table>\n";
+	
+	if($print) {
+		print($GLOBAL_ERR);
+	}
+}
+
+/* ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨ */
+function sfDispError($type) {
+	
+	class LC_ErrorPage {
+		function LC_ErrorPage() {
+			$this->tpl_mainpage = 'login_error.tpl';
+			$this->tpl_title = '¥¨¥é¡¼';
+		}
+	}
+
+	$objPage = new LC_ErrorPage();
+	$objView = new SC_AdminView();
+	
+	switch ($type) {
+	    case LOGIN_ERROR:
+			$objPage->tpl_error="£É£Ä¤Þ¤¿¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£";
+	    	break;
+		case ACCESS_ERROR:
+			$objPage->tpl_error="¥í¥°¥¤¥óÇ§¾Ú¤ÎÍ­¸ú´ü¸ÂÀÚ¤ì¤Î²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+		case AUTH_ERROR:
+			$objPage->tpl_error="¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ï¥¢¥¯¥»¥¹¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+		case PAGE_ERROR:
+			$objPage->tpl_error="ÉÔÀµ¤Ê¥Ú¡¼¥¸°ÜÆ°¤Ç¤¹¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+		default:
+	    	$objPage->tpl_error="¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br />¤â¤¦°ìÅÙ¤´³ÎÇ§¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+	}
+	
+	$objView->assignobj($objPage);
+	$objView->display(LOGIN_FRAME);
+	
+	exit;
+}
+
+/* ¥µ¥¤¥È¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨ */
+function sfDispSiteError($type, $objSiteSess = "") {
+	
+	if ($objSiteSess != "") {
+		$objSiteSess->setNowPage('error');
+	}
+	
+	class LC_ErrorPage {
+		function LC_ErrorPage() {
+			$this->tpl_mainpage = 'error.tpl';
+			$this->tpl_css = '/css/layout/error.css';
+			$this->tpl_title = '¥¨¥é¡¼';
+		}
+	}
+	
+	$objPage = new LC_ErrorPage();
+	$objView = new SC_SiteView();
+	
+	switch ($type) {
+	    case PRODUCT_NOT_FOUND:
+			$objPage->tpl_error="¤´»ØÄê¤Î¥Ú¡¼¥¸¤Ï¤´¤¶¤¤¤Þ¤»¤ó¡£";
+			break;
+		case PAGE_ERROR:
+			$objPage->tpl_error="ÉÔÀµ¤Ê¥Ú¡¼¥¸°ÜÆ°¤Ç¤¹¡£";
+			break;
+		case CART_EMPTY:
+			$objPage->tpl_error="¥«¡¼¥È¤Ë¾¦ÉÊ¤¬¤¬¤¢¤ê¤Þ¤»¤ó¡£";
+			break;
+	    case CART_ADD_ERROR:
+			$objPage->tpl_error="¹ØÆþ½èÍýÃæ¤Ï¡¢¥«¡¼¥È¤Ë¾¦ÉÊ¤òÄÉ²Ã¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£";
+			break;
+		case CANCEL_PURCHASE:
+			$objPage->tpl_error="¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£°Ê²¼¤ÎÍ×°ø¤¬¹Í¤¨¤é¤ì¤Þ¤¹¡£<br />¡¦¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÍ­¸ú´ü¸Â¤¬ÀÚ¤ì¤Æ¤ë¾ì¹ç<br />¡¦¹ØÆþ¼êÂ³¤­Ãæ¤Ë¿·¤·¤¤¹ØÆþ¼êÂ³¤­¤ò¼Â¹Ô¤·¤¿¾ì¹ç<br />¡¦¤¹¤Ç¤Ë¹ØÆþ¼êÂ³¤­¤ò´°Î»¤·¤Æ¤¤¤ë¾ì¹ç";
+			break;
+		case CATEGORY_NOT_FOUND:
+			$objPage->tpl_error="¤´»ØÄê¤Î¥«¥Æ¥´¥ê¤ÏÂ¸ºß¤·¤Þ¤»¤ó¡£";
+			break;
+		case SITE_LOGIN_ERROR:
+			$objPage->tpl_error="¥á¡¼¥ë¥¢¥É¥ì¥¹¤â¤·¤¯¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£";
+			break;
+		case TEMP_LOGIN_ERROR:
+			$objPage->tpl_error="¥á¡¼¥ë¥¢¥É¥ì¥¹¤â¤·¤¯¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />ËÜÅÐÏ¿¤¬¤ªºÑ¤ß¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢²¾ÅÐÏ¿¥á¡¼¥ë¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ë<br />URL¤è¤êËÜÅÐÏ¿¤ò¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+		case CUSTOMER_ERROR:
+			$objPage->tpl_error="ÉÔÀµ¤Ê¥¢¥¯¥»¥¹¤Ç¤¹¡£";
+			break;
+		case SOLD_OUT:
+			$objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¤´¹ØÆþ¤ÎÄ¾Á°¤ÇÇä¤êÀÚ¤ì¤¿¾¦ÉÊ¤¬¤¢¤ê¤Þ¤¹¡£¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
+			break;
+		case CART_NOT_FOUND:
+			$objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¥«¡¼¥ÈÆâ¤Î¾¦ÉÊ¾ðÊó¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
+			break;
+		case LACK_POINT:
+			$objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¥Ý¥¤¥ó¥È¤¬ÉÔÂ­¤·¤Æ¤ª¤ê¤Þ¤¹¡£¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
+			break;
+		case FAVORITE_ERROR:
+			$objPage->tpl_error="´û¤Ë¤ªµ¤¤ËÆþ¤ê¤ËÄÉ²Ã¤µ¤ì¤Æ¤¤¤ë¾¦ÉÊ¤Ç¤¹¡£";
+			break;
+		case EXTRACT_ERROR:
+			$objPage->tpl_error="¥Õ¥¡¥¤¥ë¤Î²òÅà¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\n»ØÄê¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë½ñ¤­¹þ¤ß¸¢¸Â¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£";
+			break;
+		case FTP_DOWNLOAD_ERROR:
+			$objPage->tpl_error="¥Õ¥¡¥¤¥ë¤ÎFTP¥À¥¦¥ó¥í¡¼¥É¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+			break;
+		case FTP_LOGIN_ERROR:
+			$objPage->tpl_error="FTP¥í¥°¥¤¥ó¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+			break;
+		case FTP_CONNECT_ERROR:
+			$objPage->tpl_error="FTP¥í¥°¥¤¥ó¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+			break;
+		case CREATE_DB_ERROR:
+			$objPage->tpl_error="DB¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\n»ØÄê¤Î¥æ¡¼¥¶¡¼¤Ë¤Ï¡¢DBºîÀ®¤Î¸¢¸Â¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£";
+			break;
+		case DB_IMPORT_ERROR:
+			$objPage->tpl_error="¥Ç¡¼¥¿¥Ù¡¼¥¹¹½Â¤¤Î¥¤¥ó¥Ý¡¼¥È¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\nsql¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤ë²ÄÇ½À­¤¬¤¢¤ê¤Þ¤¹¡£";
+			break;
+		case FILE_NOT_FOUND:
+			$objPage->tpl_error="»ØÄê¤Î¥Ñ¥¹¤Ë¡¢ÀßÄê¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤»¤ó¡£";
+			break;
+		case WRITE_FILE_ERROR:
+			$objPage->tpl_error="ÀßÄê¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤á¤Þ¤»¤ó¡£\nÀßÄê¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤ß¸¢¸Â¤òÍ¿¤¨¤Æ¤¯¤À¤µ¤¤¡£";
+			break;
+ 		default:
+	    	$objPage->tpl_error="¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+			break;
+	}
+	
+	$objView->assignobj($objPage);
+	$objView->display(SITE_FRAME);
+	exit;
+}
+
+/* Ç§¾Ú¤Î²ÄÈÝÈ½Äê */
+function sfIsSuccess($objSess, $disp_error = true) { 
+	$ret = $objSess->IsSuccess();
+	if($ret != SUCCESS) {
+		if($disp_error) {
+			// ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨
+			sfDispError($ret);
+		}
+		return false;
+	}
+	return true;		
+}
+
+/* Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¤¬¹Ô¤ï¤ì¤¿¤«È½Äê */
+function sfIsPrePage($objSiteSess) {
+	$ret = $objSiteSess->isPrePage();
+	if($ret != true) {
+		// ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨
+		sfDispSiteError(PAGE_ERROR, $objSiteSess);
+	}
+}
+
+function sfCheckNormalAccess($objSiteSess, $objCartSess) {
+	// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
+	$uniqid = $objSiteSess->getUniqId();
+	// ¹ØÆþ¥Ü¥¿¥ó¤ò²¡¤·¤¿»þ¤Î¥«¡¼¥ÈÆâÍÆ¤¬¥³¥Ô¡¼¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¤ß¥³¥Ô¡¼¤¹¤ë¡£
+	$objCartSess->saveCurrentCart($uniqid);
+	// POST¤Î¥æ¥Ë¡¼¥¯ID¤È¥»¥Ã¥·¥ç¥ó¤Î¥æ¥Ë¡¼¥¯ID¤òÈæ³Ó(¥æ¥Ë¡¼¥¯ID¤¬POST¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¹¥ë¡¼)
+	$ret = $objSiteSess->checkUniqId();
+	if($ret != true) {
+		// ¥¨¥é¡¼¥Ú¡¼¥¸¤ÎÉ½¼¨
+		sfDispSiteError(CANCEL_PURCHASE, $objSiteSess);
+	}
+	
+	// ¥«¡¼¥ÈÆâ¤¬¶õ¤Ç¤Ê¤¤¤« || ¹ØÆþ¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤«¤éÊÑ²½¤¬¤Ê¤¤¤«
+	$quantity = $objCartSess->getTotalQuantity();
+	$ret = $objCartSess->checkChangeCart();
+	if($ret == true || !($quantity > 0)) {
+		// ¥«¡¼¥È¾ðÊóÉ½¼¨¤Ë¶¯À©°ÜÆ°¤¹¤ë
+		header("Location: ".URL_CART_TOP);
+		exit;
+	}
+	return $uniqid;
+}
+
+/* DBÍÑÆüÉÕÊ¸»úÎó¼èÆÀ */
+function sfGetTimestamp($year, $month, $day, $last = false) {
+	if($year != "" && $month != "" && $day != "") {	
+		if($last) {
+			$time = "23:59:59";
+		} else {
+			$time = "00:00:00";
+		}
+		$date = $year."-".$month."-".$day." ".$time;
+	} else {
+		$date = "";
+	}
+	return 	$date;
+}
+
+// INT·¿¤Î¿ôÃÍ¥Á¥§¥Ã¥¯
+function sfIsInt($value) {
+	if($value != "" && strlen($value) <= INT_LEN && is_numeric($value)) {
+		return true;
+	}
+	return false;
+}
+
+function sfCSVDownload($data, $prefix = ""){
+	
+	if($prefix == "") {
+		$dir_name = sfUpDirName();
+		$file_name = $dir_name . date("ymdHis") .".csv";
+	} else {
+		$file_name = $prefix . date("ymdHis") .".csv";
+	}
+	
+	/* HTTP¥Ø¥Ã¥À¤Î½ÐÎÏ */
+	Header("Content-disposition: attachment; filename=${file_name}");
+	Header("Content-type: application/octet-stream; name=${file_name}");
+	Header("Cache-Control: ");
+	Header("Pragma: ");
+	
+	/* i18n¢· ¤À¤ÈÀµ¾ï¤ËÆ°ºî¤·¤Ê¤¤¤¿¤á¡¢mb¢· ¤ËÊÑ¹¹
+	if (i18n_discover_encoding($data) == 'EUC-JP'){
+		$data = i18n_convert($data,'SJIS','EUC-JP');
+	}
+	*/
+	if (mb_internal_encoding() == 'EUC-JP'){
+		$data = mb_convert_encoding($data,'SJIS','EUC-JP');
+	}
+	
+	/* ¥Ç¡¼¥¿¤ò½ÐÎÏ */
+	echo $data;
+}
+
+/* 1³¬ÁØ¾å¤Î¥Ç¥£¥ì¥¯¥È¥êÌ¾¤ò¼èÆÀ¤¹¤ë */
+function sfUpDirName() {
+	$path = $_SERVER['PHP_SELF'];
+	$arrVal = split("/", $path);
+	$cnt = count($arrVal);
+	return $arrVal[($cnt - 2)];
+}
+
+// ¸½ºß¤Î¥µ¥¤¥È¤ò¹¹¿·¡Ê¤¿¤À¤·¥Ý¥¹¥È¤Ï¹Ô¤ï¤Ê¤¤¡Ë
+function sfReload($get = "") {
+	if ($_SERVER["SERVER_PORT"] == "443" ){
+		$protocol = "https";
+	} else {
+		$protocol = "http";
+	}
+		
+	if($get != "") {
+		header("Location: ".$protocol."://" .$_SERVER["SERVER_NAME"] . $_SERVER['PHP_SELF'] . "?" . $get);
+	} else {
+		header("Location: ".$protocol."://" .$_SERVER["SERVER_NAME"] . $_SERVER['PHP_SELF']);
+	}
+	exit;
+}
+
+// ¥é¥ó¥­¥ó¥°¤ò¾å¤²¤ë¡£
+function sfRankUp($table, $colname, $id, $andwhere = "") {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	$where = "$colname = ?";
+	if($andwhere != "") {
+		$where.= " AND $andwhere";
+	}
+	// ÂÐ¾Ý¹àÌÜ¤Î¥é¥ó¥¯¤ò¼èÆÀ
+	$rank = $objQuery->get($table, "rank", $where, array($id));
+	// ¥é¥ó¥¯¤ÎºÇÂçÃÍ¤ò¼èÆÀ
+	$maxrank = $objQuery->max($table, "rank", $andwhere);
+	// ¥é¥ó¥¯¤¬ºÇÂçÃÍ¤è¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+	if($rank < $maxrank) {
+		// ¥é¥ó¥¯¤¬°ì¤Ä¾å¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+		$where = "rank = ?";
+		if($andwhere != "") {
+			$where.= " AND $andwhere";
+		}
+		$uprank = $rank + 1;
+		$up_id = $objQuery->get($table, $colname, $where, array($uprank));
+		// ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
+		$sqlup = "UPDATE $table SET rank = ?, update_date = Now() WHERE $colname = ?";
+		$objQuery->exec($sqlup, array($rank + 1, $id));
+		$objQuery->exec($sqlup, array($rank, $up_id));
+	}
+	$objQuery->commit();
+}
+
+// ¥é¥ó¥­¥ó¥°¤ò²¼¤²¤ë¡£
+function sfRankDown($table, $colname, $id, $andwhere = "") {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	$where = "$colname = ?";
+	if($andwhere != "") {
+		$where.= " AND $andwhere";
+	}
+	// ÂÐ¾Ý¹àÌÜ¤Î¥é¥ó¥¯¤ò¼èÆÀ
+	$rank = $objQuery->get($table, "rank", $where, array($id));
+		
+	// ¥é¥ó¥¯¤¬1(ºÇ¾®ÃÍ)¤è¤ê¤âÂç¤­¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+	if($rank > 1) {
+		// ¥é¥ó¥¯¤¬°ì¤Ä²¼¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+		$where = "rank = ?";
+		if($andwhere != "") {
+			$where.= " AND $andwhere";
+		}
+		$downrank = $rank - 1;
+		$down_id = $objQuery->get($table, $colname, $where, array($downrank));
+		// ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
+		$sqlup = "UPDATE $table SET rank = ?, update_date = Now() WHERE $colname = ?";
+		$objQuery->exec($sqlup, array($rank - 1, $id));
+		$objQuery->exec($sqlup, array($rank, $down_id));
+	}
+	$objQuery->commit();
+}
+
+//----¡¡»ØÄê½ç°Ì¤Ø°ÜÆ°
+function sfMoveRank($tableName, $keyIdColumn, $keyId, $pos, $where = "") {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+		
+	// ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë
+	$rank = $objQuery->get($tableName, "rank", "$keyIdColumn = ?", array($keyId));	
+	$max = $objQuery->max($tableName, "rank", $where);
+		
+	// ÃÍ¤ÎÄ´À°¡ÊµÕ½ç¡Ë
+	if($pos > $max) {
+		$position = 1;
+	} else if($pos < 1) {
+		$position = $max;
+	} else {
+		$position = $max - $pos + 1;
+	}
+	
+	if( $position > $rank ) $term = "rank - 1";	//Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤êÂç¤­¤¤¾ì¹ç
+	if( $position < $rank ) $term = "rank + 1";	//Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤ê¾®¤µ¤¤¾ì¹ç
+
+	//--¡¡»ØÄê¤·¤¿½ç°Ì¤Î¾¦ÉÊ¤«¤é°ÜÆ°¤µ¤»¤ë¾¦ÉÊ¤Þ¤Ç¤Îrank¤ò£±¤Ä¤º¤é¤¹
+	$sql = "UPDATE $tableName SET rank = $term, update_date = NOW() WHERE rank BETWEEN ? AND ? AND delete = 0";
+	if($where != "") {
+		$sql.= " AND $where";
+	}
+	
+	if( $position > $rank ) $objQuery->exec( $sql, array( $rank + 1, $position ));
+	if( $position < $rank ) $objQuery->exec( $sql, array( $position, $rank - 1 ));
+
+	//-- »ØÄê¤·¤¿½ç°Ì¤Ørank¤ò½ñ¤­´¹¤¨¤ë¡£
+	$sql  = "UPDATE $tableName SET rank = ?, update_date = NOW() WHERE $keyIdColumn = ? AND delete = 0 ";
+	if($where != "") {
+		$sql.= " AND $where";
+	}
+	
+	$objQuery->exec( $sql, array( $position, $keyId ) );
+	$objQuery->commit();
+}
+
+// ¥é¥ó¥¯¤ò´Þ¤à¥ì¥³¡¼¥É¤Îºï½ü
+// ¥ì¥³¡¼¥É¤´¤Èºï½ü¤¹¤ë¾ì¹ç¤Ï¡¢$delete¤òtrue¤Ë¤¹¤ë¡£
+function sfDeleteRankRecord($table, $colname, $id, $andwhere = "", $delete = false) {
+	$objQuery = new SC_Query();
+	$objQuery->begin();
+	// ºï½ü¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£		
+	$where = "$colname = ?";
+	if($andwhere != "") {
+		$where.= " AND $andwhere";
+	}
+	$rank = $objQuery->get($table, "rank", $where, array($id));
+
+	if(!$delete) {
+		// ¥é¥ó¥¯¤òºÇ²¼°Ì¤Ë¤¹¤ë¡¢DEL¥Õ¥é¥°ON
+		$sqlup = "UPDATE $table SET rank = 0, delete = 1, update_date = Now() ";
+		$sqlup.= "WHERE $colname = ?";
+		// UPDATE¤Î¼Â¹Ô
+		$objQuery->exec($sqlup, array($id));
+	} else {
+		$objQuery->delete($table, "$colname = ?", array($id));
+	}
+	
+	// ÄÉ²Ã¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤è¤ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä¤º¤é¤¹¡£
+	$where = "rank > ?";
+	if($andwhere != "") {
+		$where.= " AND $andwhere";
+	}
+	$sqlup = "UPDATE $table SET rank = (rank - 1) WHERE $where";
+	$objQuery->exec($sqlup, array($rank));
+	$objQuery->commit();
+}
+
+// ¥ì¥³¡¼¥É¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+function sfIsRecord($table, $col, $arrval, $addwhere = "") {
+	$objQuery = new SC_Query();
+	$arrCol = split("[, ]", $col);
+		
+	$where = "delete = 0";
+	
+	if($addwhere != "") {
+		$where.= " AND $addwhere";
+	}
+		
+	foreach($arrCol as $val) {
+		if($val != "") {
+			if($where == "") {
+				$where = "$val = ?";
+			} else {
+				$where.= " AND $val = ?";
+			}
+		}
+	}
+	$ret = $objQuery->get($table, $col, $where, $arrval);
+	
+	if($ret != "") {
+		return true;
+	}
+	return false;
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Þ¡¼¥¸
+function sfMergeCBValue($keyname, $max) {
+	$conv = "";
+	$cnt = 1;
+	for($cnt = 1; $cnt <= $max; $cnt++) {
+		if ($_POST[$keyname . $cnt] == "1") {
+			$conv.= "1";
+		} else {
+			$conv.= "0";
+		}
+	}
+	return $conv;
+}
+
+// html_checkboxes¤ÎÃÍ¤ò¥Þ¡¼¥¸¤·¤Æ2¿Ê¿ô·Á¼°¤ËÊÑ¹¹¤¹¤ë¡£
+function sfMergeCheckBoxes($array, $max) {
+	$ret = "";
+	if(is_array($array)) {	
+		foreach($array as $val) {
+			$arrTmp[$val] = "1";
+		}
+	}
+	for($i = 1; $i <= $max; $i++) {	
+		if($arrTmp[$i] == "1") {
+			$ret.= "1";
+		} else {
+			$ret.= "0";
+		}
+	}
+	return $ret;
+}
+
+
+// html_checkboxes¤ÎÃÍ¤ò¥Þ¡¼¥¸¤·¤Æ¡Ö-¡×¤Ç¤Ä¤Ê¤²¤ë¡£
+function sfMergeParamCheckBoxes($array) {
+	if(is_array($array)) {
+		foreach($array as $val) {
+			if($ret != "") {
+				$ret.= "-$val";
+			} else {
+				$ret = $val;			
+			}
+		}
+	} else {
+		$ret = $array;
+	}
+	return $ret;
+}
+
+// html_checkboxes¤ÎÃÍ¤ò¥Þ¡¼¥¸¤·¤ÆSQL¸¡º÷ÍÑ¤ËÊÑ¹¹¤¹¤ë¡£
+function sfSearchCheckBoxes($array) {
+	$max = 0;
+	$ret = "";
+	foreach($array as $val) {
+		$arrTmp[$val] = "1";
+		if($val > $max) {
+			$max = $val;
+		}
+	}
+	for($i = 1; $i <= $max; $i++) {	
+		if($arrTmp[$i] == "1") {
+			$ret.= "1";
+		} else {
+			$ret.= "_";
+		}
+	}
+	
+	if($ret != "") {	
+		$ret.= "%";
+	}
+	return $ret;
+}
+
+// 2¿Ê¿ô·Á¼°¤ÎÃÍ¤òhtml_checkboxesÂÐ±þ¤ÎÃÍ¤ËÀÚ¤êÂØ¤¨¤ë
+function sfSplitCheckBoxes($val) {
+	$len = strlen($val);
+	for($i = 0; $i < $len; $i++) {
+		if(substr($val, $i, 1) == "1") {
+			$arrRet[] = ($i + 1);
+		}
+	}
+	return $arrRet;
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Þ¡¼¥¸
+function sfMergeCBSearchValue($keyname, $max) {
+	$conv = "";
+	$cnt = 1;
+	for($cnt = 1; $cnt <= $max; $cnt++) {
+		if ($_POST[$keyname . $cnt] == "1") {
+			$conv.= "1";
+		} else {
+			$conv.= "_";
+		}
+	}
+	return $conv;
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤òÊ¬²ò
+function sfSplitCBValue($val, $keyname = "") {
+	$len = strlen($val);
+	$no = 1;
+	for ($cnt = 0; $cnt < $len; $cnt++) {
+		if($keyname != "") {
+			$arr[$keyname . $no] = substr($val, $cnt, 1);
+		} else {
+			$arr[] = substr($val, $cnt, 1);
+		}
+		$no++;
+	}
+	return $arr;
+}
+
+// ¥­¡¼¤ÈÃÍ¤ò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ
+function sfArrKeyValue($arrList, $keyname, $valname, $len_max = "", $keysize = "") {
+	
+	$max = count($arrList);
+	
+	if($len_max != "" && $max > $len_max) {
+		$max = $len_max;
+	}
+	
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($keysize != "") {
+			$key = sfCutString($arrList[$cnt][$keyname], $keysize);
+		} else {
+			$key = $arrList[$cnt][$keyname];
+		}
+		$val = $arrList[$cnt][$valname];
+		
+		if(!isset($arrRet[$key])) {
+			$arrRet[$key] = $val;
+		}
+		
+	}
+	return $arrRet;
+}
+
+// ¥­¡¼¤ÈÃÍ¤ò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ(ÃÍ¤¬Ê£¿ô¤Î¾ì¹ç)
+function sfArrKeyValues($arrList, $keyname, $valname, $len_max = "", $keysize = "", $connect = "") {
+	
+	$max = count($arrList);
+	
+	if($len_max != "" && $max > $len_max) {
+		$max = $len_max;
+	}
+	
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($keysize != "") {
+			$key = sfCutString($arrList[$cnt][$keyname], $keysize);
+		} else {
+			$key = $arrList[$cnt][$keyname];
+		}
+		$val = $arrList[$cnt][$valname];
+		
+		if($connect != "") {
+			$arrRet[$key].= "$val".$connect;
+		} else {
+			$arrRet[$key][] = $val;		
+		}
+	}
+	return $arrRet;
+}
+
+// ÇÛÎó¤ÎÃÍ¤ò¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊÖ¤¹¡£
+function sfGetCommaList($array) {
+	if (count($array) > 0) {
+		foreach($array as $val) {
+			$line .= $val . ", ";
+		}
+		$line = ereg_replace(", $", "", $line);
+		return $line;
+	}else{
+		return false;
+	}
+	
+}
+
+/* ÇÛÎó¤ÎÍ×ÁÇ¤òCSV¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎÏ¤¹¤ë¡£*/
+function sfGetCSVList($array) {
+	if (count($array) > 0) {
+		foreach($array as $key => $val) {
+			$line .= "\"".$val."\",";
+		}
+		$line = ereg_replace(",$", "\n", $line);
+		return $line;
+	}else{
+		return false;
+	}
+}
+
+/* ÇÛÎó¤ÎÍ×ÁÇ¤òPDF¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎÏ¤¹¤ë¡£*/
+function sfGetPDFList($array) {
+	foreach($array as $key => $val) {
+		$line .= "\t".$val;
+	}
+	$line.="\n";
+	return $line;
+}
+
+
+
+/*-----------------------------------------------------------------*/
+/*	check_set_term
+/*	Ç¯·îÆü¤ËÊÌ¤ì¤¿2¤Ä¤Î´ü´Ö¤ÎÂÅÅöÀ­¤ò¥Á¥§¥Ã¥¯¤·¡¢À°¹çÀ­¤È´ü´Ö¤òÊÖ¤¹
+/*¡¡°ú¿ô (³«»ÏÇ¯,³«»Ï·î,³«»ÏÆü,½ªÎ»Ç¯,½ªÎ»·î,½ªÎ»Æü)
+/*¡¡ÌáÃÍ array(£±¡¤£²¡¤£³¡Ë
+/*  		£±¡¥³«»ÏÇ¯·îÆü (YYYY/MM/DD 000000)
+/*			£²¡¥½ªÎ»Ç¯·îÆü (YYYY/MM/DD 235959)
+/*			£³¡¥¥¨¥é¡¼ ( 0 = OK, 1 = NG )
+/*-----------------------------------------------------------------*/
+function sfCheckSetTerm ( $start_year, $start_month, $start_day, $end_year, $end_month, $end_day ) {
+
+	// ´ü´Ö»ØÄê
+	$error = 0;
+	if ( $start_month || $start_day || $start_year){
+		if ( ! checkdate($start_month, $start_day , $start_year) ) $error = 1;
+	} else {
+		$error = 1;
+	}
+	if ( $end_month || $end_day || $end_year){
+		if ( ! checkdate($end_month ,$end_day ,$end_year) ) $error = 2;
+	}
+	if ( ! $error ){
+		$date1 = $start_year ."/".sprintf("%02d",$start_month) ."/".sprintf("%02d",$start_day) ." 000000";
+		$date2 = $end_year   ."/".sprintf("%02d",$end_month)   ."/".sprintf("%02d",$end_day)   ." 235959";
+		if ($date1 > $date2) $error = 3;
+	} else {
+		$error = 1;
+	}
+	return array($date1, $date2, $error);
+}
+
+// ¥¨¥é¡¼²Õ½ê¤ÎÇØ·Ê¿§¤òÊÑ¹¹¤¹¤ë¤¿¤á¤Îfunction SC_View¤ÇÆÉ¤ß¹þ¤à
+function sfSetErrorStyle(){
+	return 'style="background-color:'.ERR_COLOR.'"';
+}
+
+/* DB¤ËÅÏ¤¹¿ôÃÍ¤Î¥Á¥§¥Ã¥¯
+ * 10·å°Ê¾å¤Ï¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥¨¥é¡¼¤òµ¯¤³¤¹¤Î¤Ç¡£
+ */
+function sfCheckNumLength( $value ){
+	if ( ! is_numeric($value)  ){
+		return false;
+	} 
+	
+	if ( strlen($value) > 9 ) {
+		return false;
+	}
+	
+	return true;
+}
+
+// °ìÃ×¤·¤¿ÃÍ¤Î¥­¡¼Ì¾¤ò¼èÆÀ
+function sfSearchKey($array, $word, $default) {
+	foreach($array as $key => $val) {
+		if($val == $word) {
+			return $key;
+		}
+	}
+	return $default;
+}
+
+// ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ($products_check:true¾¦ÉÊÅÐÏ¿ºÑ¤ß¤Î¤â¤Î¤À¤±¼èÆÀ)
+function sfGetCategoryList($addwhere = "", $products_check = false, $head = CATEGORY_HEAD) {
+	$objQuery = new SC_Query();
+	$where = "delete = 0";
+	
+	if($addwhere != "") {
+		$where.= " AND $addwhere";
+	}
+		
+	$objQuery->setoption("ORDER BY rank DESC");
+	
+	if($products_check) {
+		$col = "T1.category_id, category_name, level";
+		$from = "dtb_category AS T1 LEFT JOIN dtb_category_total_count AS T2 ON T1.category_id = T2.category_id";
+		$where .= " AND product_count > 0";
+	} else {
+		$col = "category_id, category_name, level";
+		$from = "dtb_category";
+	}
+	
+	$arrRet = $objQuery->select($col, $from, $where);
+			
+	$max = count($arrRet);
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		$id = $arrRet[$cnt]['category_id'];
+		$name = $arrRet[$cnt]['category_name'];
+		$arrList[$id] = "";
+		/*
+		for($n = 1; $n < $arrRet[$cnt]['level']; $n++) {
+			$arrList[$id].= "¡¡";
+		}
+		*/
+		for($cat_cnt = 0; $cat_cnt < $arrRet[$cnt]['level']; $cat_cnt++) {
+			$arrList[$id].= $head;
+		}
+		$arrList[$id].= $name;
+	}
+	return $arrList;
+}
+
+// ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ¡Ê¿Æ¥«¥Æ¥´¥ê¤ÎValue:0)
+function sfGetLevelCatList($parent_zero = true) {
+	$objQuery = new SC_Query();
+	$col = "category_id, category_name, level";
+	$where = "delete = 0";
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, "dtb_category", $where);
+	$max = count($arrRet);
+	
+	for($cnt = 0; $cnt < $max; $cnt++) {
+		if($parent_zero) {
+			if($arrRet[$cnt]['level'] == LEVEL_MAX) {
+				$arrValue[$cnt] = $arrRet[$cnt]['category_id'];
+			} else {
+				$arrValue[$cnt] = ""; 
+			}
+		} else {
+			$arrValue[$cnt] = $arrRet[$cnt]['category_id'];
+		}
+		
+		$arrOutput[$cnt] = "";
+		/*	 		
+		for($n = 1; $n < $arrRet[$cnt]['level']; $n++) {
+			$arrOutput[$cnt].= "¡¡";
+		}
+		*/
+		for($cat_cnt = 0; $cat_cnt < $arrRet[$cnt]['level']; $cat_cnt++) {
+			$arrOutput[$cnt].= CATEGORY_HEAD;
+		}
+		$arrOutput[$cnt].= $arrRet[$cnt]['category_name'];
+	}
+	return array($arrValue, $arrOutput);
+}
+
+function sfGetErrorColor($val) {
+	if($val != "") {
+		return "background-color:" . ERR_COLOR;
+	}
+	return "";
+}
+
+
+function sfGetEnabled($val) {
+	if( ! $val ) {
+		return " disabled=\"disabled\"";
+	}
+	return "";
+}
+
+function sfGetChecked($param, $value) {
+	if($param == $value) {
+		return "checked=\"checked\"";
+	}
+	return "";
+}
+
+// SELECT¥Ü¥Ã¥¯¥¹ÍÑ¥ê¥¹¥È¤ÎºîÀ®
+function sfGetIDValueList($table, $keyname, $valname) {
+	$objQuery = new SC_Query();
+	$col = "$keyname, $valname";
+	$objQuery->setwhere("delete = 0");
+	$objQuery->setorder("rank DESC");
+	$arrList = $objQuery->select($col, $table);
+	$count = count($arrList);
+	for($cnt = 0; $cnt < $count; $cnt++) {
+		$key = $arrList[$cnt][$keyname];
+		$val = $arrList[$cnt][$valname];
+		$arrRet[$key] = $val;
+	}
+	return $arrRet;
+}
+
+function sfTrim($str) {
+	$ret = ereg_replace("^[¡¡ \n\r]*", "", $str);
+	$ret = ereg_replace("[¡¡ \n\r]*$", "", $ret);
+	return $ret;
+}
+
+/* ½êÂ°¤¹¤ë¤¹¤Ù¤Æ¤Î³¬ÁØ¤Î¿ÆID¤òÇÛÎó¤ÇÊÖ¤¹ */
+function sfGetParents($objQuery, $table, $pid_name, $id_name, $id) {
+	$arrRet = sfGetParentsArray($table, $pid_name, $id_name, $id);
+	// ÇÛÎó¤ÎÀèÆ¬1¤Ä¤òºï½ü¤¹¤ë¡£
+	array_shift($arrRet);
+	return $arrRet;
+}
+
+
+/* ¿ÆID¤ÎÇÛÎó¤ò¸µ¤ËÆÃÄê¤Î¥«¥é¥à¤ò¼èÆÀ¤¹¤ë¡£*/
+function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId ) {
+	$col = $col_name;
+	$len = count($arrId);
+	$where = "";
+	
+	for($cnt = 0; $cnt < $len; $cnt++) {
+		if($where == "") {
+			$where = "$id_name = ?";
+		} else {
+			$where.= " OR $id_name = ?";
+		}
+	}
+	
+	$objQuery->setorder("level");
+	$arrRet = $objQuery->select($col, $table, $where, $arrId);
+	return $arrRet;	
+}
+
+/* »ÒID¤ÎÇÛÎó¤òÊÖ¤¹ */
+function sfGetChildsID($table, $pid_name, $id_name, $id) {
+	$arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);
+	return $arrRet;
+}
+
+/* ¥«¥Æ¥´¥êÊÑ¹¹»þ¤Î°ÜÆ°½èÍý */
+function sfMoveCatRank($objQuery, $table, $id_name, $cat_name, $old_catid, $new_catid, $id) {
+	if ($old_catid == $new_catid) {
+		return;
+	}
+	// µì¥«¥Æ¥´¥ê¤Ç¤Î¥é¥ó¥¯ºï½ü½èÍý
+	// °ÜÆ°¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£		
+	$where = "$id_name = ?";
+	$rank = $objQuery->get($table, "rank", $where, array($id));
+	// ºï½ü¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤è¤ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä²¼¤Ë¤º¤é¤¹¡£
+	$where = "rank > ? AND $cat_name = ?";
+	$sqlup = "UPDATE $table SET rank = (rank - 1) WHERE $where";
+	$objQuery->exec($sqlup, array($rank, $old_catid));
+	// ¿·¥«¥Æ¥´¥ê¤Ç¤ÎÅÐÏ¿½èÍý
+	// ¿·¥«¥Æ¥´¥ê¤ÎºÇÂç¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
+	$max_rank = $objQuery->max($table, "rank", "$cat_name = ?", array($new_catid)) + 1;
+	$where = "$id_name = ?";
+	$sqlup = "UPDATE $table SET rank = ? WHERE $where";
+	$objQuery->exec($sqlup, array($max_rank, $id));
+}
+
+/* ÀÇ¶â·×»» */
+function sfTax($price, $tax, $tax_rule) {
+	$real_tax = $tax / 100;
+	$ret = $price * $real_tax;
+	switch($tax_rule) {
+	// »Í¼Î¸ÞÆþ
+	case 1:
+		$ret = round($ret);
+		break;
+	// ÀÚ¤ê¼Î¤Æ
+	case 2:
+		$ret = floor($ret);
+		break;
+	// ÀÚ¤ê¾å¤²
+	case 3:
+		$ret = ceil($ret);
+		break;
+	// ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
+	default:
+		$ret = ceil($ret);
+		break;
+	}
+	return $ret;
+}
+
+/* ÀÇ¶âÉÕÍ¿ */
+function sfPreTax($price, $tax, $tax_rule) {
+	$real_tax = $tax / 100;
+	$ret = $price * (1 + $real_tax);
+	switch($tax_rule) {
+	// »Í¼Î¸ÞÆþ
+	case 1:
+		$ret = round($ret);
+		break;
+	// ÀÚ¤ê¼Î¤Æ
+	case 2:
+		$ret = floor($ret);
+		break;
+	// ÀÚ¤ê¾å¤²
+	case 3:
+		$ret = ceil($ret);
+		break;
+	// ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
+	default:
+		$ret = ceil($ret);
+		break;
+	}
+	return $ret;
+}
+
+/* ¥Ý¥¤¥ó¥ÈÉÕÍ¿ */
+function sfPrePoint($price, $point_rate, $rule = POINT_RULE, $product_id = "") {
+	if(sfIsInt($product_id)) {
+		$objQuery = new SC_Query();
+		$where = "to_char(now(),'YYYY/MM/DD/HH24') >= to_char(start_date,'YYYY/MM/DD/HH24') AND ";
+		$where .= "to_char(now(),'YYYY/MM/DD/HH24') < to_char(end_date,'YYYY/MM/DD/HH24') AND ";
+		$where .= "delete = 0 AND campaign_id IN (SELECT campaign_id FROM dtb_campaign_detail where product_id = ? )";
+		//ÅÐÏ¿(¹¹¿·)ÆüÉÕ½ç
+		$objQuery->setorder('update_date DESC');
+		//¥­¥ã¥ó¥Ú¡¼¥ó¥Ý¥¤¥ó¥È¤Î¼èÆÀ
+		$arrRet = $objQuery->select("campaign_name, campaign_point_rate", "dtb_campaign", $where, array($product_id));
+	}
+	//Ê£¿ô¤Î¥­¥ã¥ó¥Ú¡¼¥ó¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¾¦ÉÊ¤Ï¡¢ºÇ¿·¤Î¥­¥ã¥ó¥Ú¡¼¥ó¤«¤é¥Ý¥¤¥ó¥È¤ò¼èÆÀ
+	if($arrRet[0]['campaign_point_rate'] != "") {
+		$campaign_point_rate = $arrRet[0]['campaign_point_rate'];
+		$real_point = $campaign_point_rate / 100;
+	} else {
+		$real_point = $point_rate / 100;
+	}
+	$ret = $price * $real_point;
+	switch($rule) {
+	// »Í¼Î¸ÞÆþ
+	case 1:
+		$ret = round($ret);
+		break;
+	// ÀÚ¤ê¼Î¤Æ
+	case 2:
+		$ret = floor($ret);
+		break;
+	// ÀÚ¤ê¾å¤²
+	case 3:
+		$ret = ceil($ret);
+		break;
+	// ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
+	default:
+		$ret = ceil($ret);
+		break;
+	}
+	//¥­¥ã¥ó¥Ú¡¼¥ó¾¦ÉÊ¤Î¾ì¹ç
+	if($campaign_point_rate != "") {
+		$ret = "(".$arrRet[0]['campaign_name']."¥Ý¥¤¥ó¥ÈÎ¨".$campaign_point_rate."%)".$ret;
+	}
+	return $ret;
+}
+
+/* µ¬³ÊÊ¬Îà¤Î·ï¿ô¼èÆÀ */
+function sfGetClassCatCount() {
+	$sql = "select count(dtb_class.class_id), dtb_class.class_id ";
+	$sql.= "from dtb_class inner join dtb_classcategory on dtb_class.class_id = dtb_classcategory.class_id ";
+	$sql.= "where dtb_class.delete = 0 AND dtb_classcategory.delete = 0 ";
+	$sql.= "group by dtb_class.class_id, dtb_class.name;";
+	$objQuery = new SC_Query();
+	$arrList = $objQuery->getall($sql);
+	// ¥­¡¼¤ÈÃÍ¤ò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ
+	$arrRet = sfArrKeyValue($arrList, 'class_id', 'count');
+	return $arrRet;
+}
+
+/* µ¬³Ê¤ÎÅÐÏ¿ */
+function sfInsertProductClass($objQuery, $arrList, $product_id) {
+	// ¤¹¤Ç¤Ëµ¬³ÊÅÐÏ¿¤¬¤¢¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	$where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0";
+	$count = $objQuery->count("dtb_products_class", $where,  array($product_id));
+	
+	// ¤¹¤Ç¤Ëµ¬³ÊÅÐÏ¿¤¬¤Ê¤¤¾ì¹ç
+	if($count == 0) {
+		// ´ûÂ¸µ¬³Ê¤Îºï½ü
+		$where = "product_id = ?";
+		$objQuery->delete("dtb_products_class", $where, array($product_id));
+		$sqlval['product_id'] = $product_id;
+		$sqlval['classcategory_id1'] = '0';
+		$sqlval['classcategory_id2'] = '0';
+		$sqlval['product_code'] = $arrList["product_code"];
+		$sqlval['stock'] = $arrList["stock"];
+		$sqlval['stock_unlimited'] = $arrList["stock_unlimited"];
+		$sqlval['price01'] = $arrList['price01'];
+		$sqlval['price02'] = $arrList['price02'];
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+		
+		if($_SESSION['member_id'] == "") {
+			$sqlval['creator_id'] = '0';
+		}
+		
+		// INSERT¤Î¼Â¹Ô
+		$objQuery->insert("dtb_products_class", $sqlval);
+	}
+}
+
+function sfGetProductClassId($product_id, $classcategory_id1, $classcategory_id2) {
+	$where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
+	$objQuery = new SC_Query();
+	$ret = $objQuery->get("dtb_products_class", "product_class_id", $where, Array($product_id, $classcategory_id1, $classcategory_id2));
+	return $ret;
+}
+
+/* Ê¸Ëö¤Î¡Ö/¡×¤ò¤Ê¤¯¤¹ */
+function sfTrimURL($url) {
+	$ret = ereg_replace("[/]+$", "", $url);
+	return $ret;
+}
+
+/* ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ */
+function sfGetProductsClass($arrID) {
+	list($product_id, $classcategory_id1, $classcategory_id2) = $arrID;	
+	
+	if($classcategory_id1 == "") {
+		$classcategory_id1 = '0';
+	}
+	if($classcategory_id2 == "") {
+		$classcategory_id2 = '0';
+	}
+		
+	// ¾¦ÉÊµ¬³Ê¼èÆÀ
+	$objQuery = new SC_Query();
+	$col = "product_id, deliv_fee, name, product_code, main_list_image, main_image, price01, price02, point_rate, product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, sale_limit, sale_unlimited";
+	$table = "vw_product_class";
+	$where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
+	$objQuery->setorder("rank1 DESC, rank2 DESC");
+	$arrRet = $objQuery->select($col, $table, $where, array($product_id, $classcategory_id1, $classcategory_id2));
+	return $arrRet[0];
+}
+
+/* ½¸·×¾ðÊó¤ò¸µ¤ËºÇ½ª·×»» */
+function sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer = "") {
+	// ¾¦ÉÊ¤Î¹ç·×¸Ä¿ô
+	$total_quantity = $objCartSess->getTotalQuantity(true);
+	
+	// ÀÇ¶â¤Î¼èÆÀ
+	$arrData['tax'] = $objPage->tpl_total_tax;
+	// ¾®·×¤Î¼èÆÀ
+	$arrData['subtotal'] = $objPage->tpl_total_pretax;	
+	
+	// ¹ç·×Á÷ÎÁ¤Î¼èÆÀ
+	$arrData['deliv_fee'] = 0;
+		
+	// ¾¦ÉÊ¤´¤È¤ÎÁ÷ÎÁ¤¬Í­¸ú¤Î¾ì¹ç
+	if (OPTION_PRODUCT_DELIV_FEE == 1) {
+		$arrData['deliv_fee']+= $objCartSess->getAllProductsDelivFee();
+	}
+	
+	// ÇÛÁ÷¶È¼Ô¤ÎÁ÷ÎÁ¤¬Í­¸ú¤Î¾ì¹ç
+	if (OPTION_DELIV_FEE == 1) {
+		// Á÷ÎÁ¤Î¹ç·×¤ò·×»»¤¹¤ë
+		$arrData['deliv_fee']+= sfGetDelivFee($arrData['deliv_pref'], $arrData['payment_id']);
+	}
+	
+	// Á÷ÎÁÌµÎÁ¤Î¹ØÆþ¿ô¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if(DELIV_FREE_AMOUNT > 0) {
+		if($total_quantity >= DELIV_FREE_AMOUNT) {
+			$arrData['deliv_fee'] = 0;
+		}	
+	}
+		
+	// Á÷ÎÁÌµÎÁ¾ò·ï¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if($arrInfo['free_rule'] > 0) {
+		// ¾®·×¤¬ÌµÎÁ¾ò·ï¤òÄ¶¤¨¤Æ¤¤¤ë¾ì¹ç
+		if($arrData['subtotal'] >= $arrInfo['free_rule']) {
+			$arrData['deliv_fee'] = 0;
+		}
+	}
+
+	// ¹ç·×¤Î·×»»
+	$arrData['total'] = $objPage->tpl_total_pretax;	// ¾¦ÉÊ¹ç·×
+	$arrData['total']+= $arrData['deliv_fee'];		// Á÷ÎÁ
+	$arrData['total']+= $arrData['charge'];			// ¼ê¿ôÎÁ
+	// ¤ª»ÙÊ§¤¤¹ç·×
+	$arrData['payment_total'] = $arrData['total'] - ($arrData['use_point'] * POINT_VALUE);
+	// ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»»
+	$arrData['add_point'] = sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo);
+	
+	if($objCustomer != "") {
+		// ÃÂÀ¸Æü·î¤Ç¤¢¤Ã¤¿¾ì¹ç
+		if($objCustomer->isBirthMonth()) {
+			$arrData['birth_point'] = BIRTH_MONTH_POINT;
+			$arrData['add_point'] += $arrData['birth_point'];
+		}
+	}
+	
+	if($arrData['add_point'] < 0) {
+		$arrData['add_point'] = 0;
+	}
+	
+	return $arrData;
+}
+
+/* ¥«¡¼¥ÈÆâ¾¦ÉÊ¤Î½¸·×½èÍý */
+function sfTotalCart($objPage, $objCartSess, $arrInfo) {
+	// µ¬³ÊÌ¾°ìÍ÷
+	$arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
+	// µ¬³ÊÊ¬ÎàÌ¾°ìÍ÷
+	$arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+	
+	$objPage->tpl_total_pretax = 0;		// ÈñÍÑ¹ç·×(ÀÇ¹þ¤ß)
+	$objPage->tpl_total_tax = 0;		// ¾ÃÈñÀÇ¹ç·×
+	$objPage->tpl_total_point = 0;		// ¥Ý¥¤¥ó¥È¹ç·×
+	
+	// ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
+	$arrCart = $objCartSess->getCartList();
+	$max = count($arrCart);
+	$cnt = 0;
+
+	for ($i = 0; $i < $max; $i++) {
+		// ¾¦ÉÊµ¬³Ê¾ðÊó¤Î¼èÆÀ	
+		$arrData = sfGetProductsClass($arrCart[$i]['id']);
+				
+		// DB¤ËÂ¸ºß¤¹¤ë¾¦ÉÊ
+		if (count($arrData) > 0) {
+			
+			// ¹ØÆþÀ©¸Â¿ô¤òµá¤á¤ë¡£			
+			if ($arrData['stock_unlimited'] != '1' && $arrData['sale_unlimited'] != '1') {
+				if($arrData['sale_limit'] < $arrData['stock']) {
+					$limit = $arrData['sale_limit'];
+				} else {
+					$limit = $arrData['stock'];
+				}
+			} else {
+				if ($arrData['sale_unlimited'] != '1') {
+					$limit = $arrData['sale_limit'];
+				}
+				if ($arrData['stock_unlimited'] != '1') {
+					$limit = $arrData['stock'];
+				}
+			}
+						
+			if($limit != "" && $limit < $arrCart[$i]['quantity']) {
+				// ¥«¡¼¥ÈÆâ¾¦ÉÊ¿ô¤òÀ©¸Â¤Ë¹ç¤ï¤»¤ë
+				$objCartSess->setProductValue($arrCart[$i]['id'], 'quantity', $limit);
+				$quantity = $limit;
+				$objPage->tpl_message = "¢¨¡Ö" . $arrData['name'] . "¡×¤ÏÈÎÇäÀ©¸Â¤·¤Æ¤ª¤ê¤Þ¤¹¡¢°ìÅÙ¤Ë¤³¤ì°Ê¾å¤Î¹ØÆþ¤Ï¤Ç¤­¤Þ¤»¤ó¡£";
+			} else {
+				$quantity = $arrCart[$i]['quantity'];
+			}
+			
+			$objPage->arrProductsClass[$cnt] = $arrData;
+			$objPage->arrProductsClass[$cnt]['quantity'] = $quantity;
+			$objPage->arrProductsClass[$cnt]['cart_no'] = $arrCart[$i]['cart_no'];
+			$objPage->arrProductsClass[$cnt]['class_name1'] = $arrClassName[$arrData['class_id1']];
+			$objPage->arrProductsClass[$cnt]['class_name2'] = $arrClassName[$arrData['class_id2']];
+			$objPage->arrProductsClass[$cnt]['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
+			$objPage->arrProductsClass[$cnt]['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
+			
+			// ²Á³Ê¤ÎÅÐÏ¿
+			if ($arrData['price02'] != "") {
+				$objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price02']);
+				$objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price02'];
+			} else {
+				$objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price01']);
+				$objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price01'];
+			}
+			// ¥Ý¥¤¥ó¥ÈÉÕÍ¿Î¨¤ÎÅÐÏ¿
+			$objCartSess->setProductValue($arrCart[$i]['id'], 'point_rate', $arrData['point_rate']);
+			// ¾¦ÉÊ¤´¤È¤Î¹ç·×¶â³Û
+			$objPage->arrProductsClass[$cnt]['total_pretax'] = $objCartSess->getProductTotal($arrInfo, $arrCart[$i]['id']);
+			// Á÷ÎÁ¤Î¹ç·×¤ò·×»»¤¹¤ë
+			$objPage->tpl_total_deliv_fee+= ($arrData['deliv_fee'] * $arrCart[$i]['quantity']);
+			$cnt++;
+		} else {
+			// DB¤Ë¾¦ÉÊ¤¬¸«¤Ä¤«¤é¤Ê¤¤¾ì¹ç¤Ï¥«¡¼¥È¾¦ÉÊ¤Îºï½ü
+			$objCartSess->delProductKey('id', $arrCart[$i]['id']);
+		}
+	}
+	
+	// Á´¾¦ÉÊ¹ç·×¶â³Û(ÀÇ¹þ¤ß)
+	$objPage->tpl_total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
+	// Á´¾¦ÉÊ¹ç·×¾ÃÈñÀÇ
+	$objPage->tpl_total_tax = $objCartSess->getAllProductsTax($arrInfo);
+	// Á´¾¦ÉÊ¹ç·×¥Ý¥¤¥ó¥È
+	$objPage->tpl_total_point = $objCartSess->getAllProductsPoint();
+	
+	return $objPage;	
+}
+
+/* DB¤«¤é¼è¤ê½Ð¤·¤¿ÆüÉÕ¤ÎÊ¸»úÎó¤òÄ´À°¤¹¤ë¡£*/
+function sfDispDBDate($dbdate, $time = true) {
+	list($y, $m, $d, $H, $M) = split("[- :]", $dbdate);
+
+	if(strlen($y) > 0 && strlen($m) > 0 && strlen($d) > 0) {
+		if ($time) {
+			$str = sprintf("%04d/%02d/%02d %02d:%02d", $y, $m, $d, $H, $M);
+		} else {
+			$str = sprintf("%04d/%02d/%02d", $y, $m, $d, $H, $M);						
+		}
+	} else {
+		$str = "";
+	}
+	return $str;
+}
+
+function sfGetDelivTime($payment_id = "") {
+	$objQuery = new SC_Query();
+	
+	$deliv_id = "";
+	
+	if($payment_id != "") {
+		$where = "delete = 0 AND payment_id = ?";
+		$arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id));
+		$deliv_id = $arrRet[0]['deliv_id'];
+	}
+	
+	if($deliv_id != "") {
+		$objQuery->setorder("time_id");
+		$where = "deliv_id = ?";
+		$arrRet= $objQuery->select("time_id, time", "dtb_delivtime", $where, array($deliv_id));
+	}
+	return $arrRet;	
+}
+
+
+// ÅÔÆ»ÉÜ¸©¡¢»ÙÊ§¤¤ÊýË¡¤«¤éÇÛÁ÷ÎÁ¶â¤ò¼èÆÀ¤¹¤ë
+function sfGetDelivFee($pref, $payment_id = "") {
+	$objQuery = new SC_Query();
+	
+	$deliv_id = "";
+	
+	// »ÙÊ§¤¤ÊýË¡¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ÂÐ±þ¤·¤¿ÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë
+	if($payment_id != "") {
+		$where = "delete = 0 AND payment_id = ?";
+		$arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id));
+		$deliv_id = $arrRet[0]['deliv_id'];
+	// »ÙÊ§¤¤ÊýË¡¤¬»ØÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ÀèÆ¬¤ÎÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë
+	} else {
+		$where = "delete = 0";
+		$objQuery->setOrder("rank DESC");
+		$objQuery->setLimitOffset(1);
+		$arrRet = $objQuery->select("deliv_id", "dtb_deliv", $where);
+		$deliv_id = $arrRet[0]['deliv_id'];	
+	}
+	
+	// ÇÛÁ÷¶È¼Ô¤«¤éÇÛÁ÷ÎÁ¤ò¼èÆÀ
+	if($deliv_id != "") {
+		
+		// ÅÔÆ»ÉÜ¸©¤¬»ØÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ÅìµþÅÔ¤ÎÈÖ¹æ¤ò»ØÄê¤·¤Æ¤ª¤¯
+		if($pref == "") {
+			$pref = 13;
+		}
+		
+		$objQuery = new SC_Query();
+		$where = "deliv_id = ? AND pref = ?";
+		$arrRet= $objQuery->select("fee", "dtb_delivfee", $where, array($deliv_id, $pref));
+	}	
+	return $arrRet[0]['fee'];	
+}
+
+/* »ÙÊ§¤¤ÊýË¡¤Î¼èÆÀ */
+function sfGetPayment() {
+	$objQuery = new SC_Query();
+	// ¹ØÆþ¶â³Û¤¬¾ò·ï³Û°Ê²¼¤Î¹àÌÜ¤ò¼èÆÀ
+	$where = "delete = 0";
+	$objQuery->setorder("fix, rank DESC");
+	$arrRet = $objQuery->select("payment_id, payment_method, rule", "dtb_payment", $where);
+	return $arrRet;	
+}
+
+/* ÇÛÎó¤ò¥­¡¼Ì¾¤´¤È¤ÎÇÛÎó¤ËÊÑ¹¹¤¹¤ë */
+function sfSwapArray($array) {
+	$max = count($array);
+	for($i = 0; $i < $max; $i++) {
+		foreach($array[$i] as $key => $val) {
+			$arrRet[$key][] = $val;
+		}
+	}
+	return $arrRet;
+}
+
+/* ¤«¤±»»¤ò¤¹¤ë¡ÊSmartyÍÑ) */
+function sfMultiply($num1, $num2) {
+	return ($num1 * $num2);
+}
+
+/* DB¤ËÅÐÏ¿¤µ¤ì¤¿¥Æ¥ó¥×¥ì¡¼¥È¥á¡¼¥ë¤ÎÁ÷¿® */
+function sfSendTemplateMail($to, $to_name, $template_id, $objPage) {
+	global $arrMAILTPLPATH;
+	$objQuery = new SC_Query();
+	// ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¾ðÊó¤Î¼èÆÀ
+	$where = "template_id = ?";
+	$arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id));
+	$objPage->tpl_header = $arrRet[0]['header'];
+	$objPage->tpl_footer = $arrRet[0]['footer'];
+	$tmp_subject = $arrRet[0]['subject'];
+	
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	
+	$objMailView = new SC_SiteView();
+	// ¥á¡¼¥ëËÜÊ¸¤Î¼èÆÀ
+	$objMailView->assignobj($objPage);
+	$body = $objMailView->fetch($arrMAILTPLPATH[$template_id]);
+	
+	// ¥á¡¼¥ëÁ÷¿®½èÍý
+	$objSendMail = new GC_SendMail();
+	$from = $arrInfo['email03'];
+	$error = $arrInfo['email04'];
+	$tosubject = $tmp_subject;
+	$objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error);
+	$objSendMail->setTo($to, $to_name);
+	$objSendMail->sendMail();	// ¥á¡¼¥ëÁ÷¿®
+}
+
+/* ¼õÃí´°Î»¥á¡¼¥ëÁ÷¿® */
+function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true) {
+	global $arrMAILTPLPATH;
+	
+	$objPage = new LC_Page();
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	$objPage->arrInfo = $arrInfo;
+	
+	$objQuery = new SC_Query();
+		
+	if($subject == "" && $header == "" && $footer == "") {
+		// ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¾ðÊó¤Î¼èÆÀ
+		$where = "template_id = ?";
+		$arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array('1'));
+		$objPage->tpl_header = $arrRet[0]['header'];
+		$objPage->tpl_footer = $arrRet[0]['footer'];
+		$tmp_subject = $arrRet[0]['subject'];
+	} else {
+		$objPage->tpl_header = $header;
+		$objPage->tpl_footer = $footer;
+		$tmp_subject = $subject;
+	}
+	
+	// ¼õÃí¾ðÊó¤Î¼èÆÀ
+	$where = "order_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
+	$arrOrder = $arrRet[0];
+	$arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id));
+	
+	$objPage->Message_tmp = $arrOrder['message'];
+		
+	// ¸ÜµÒ¾ðÊó¤Î¼èÆÀ
+	$customer_id = $arrOrder['customer_id'];
+	$arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
+	$arrCustomer = $arrRet[0];
+
+	$objPage->arrCustomer = $arrCustomer;
+	$objPage->arrOrder = $arrOrder;
+
+	//¥³¥ó¥Ó¥Ë·èºÑ¾ðÊó
+	if($arrOrder['conveni_data'] != "") {
+		global $arrCONVENIENCE;
+		global $arrCONVENIMESSAGE;
+		$objPage->arrCONVENIENCE = $arrCONVENIENCE;
+		$objPage->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
+		$arrConv = unserialize($arrOrder['conveni_data']);
+		$objPage->arrConv = $arrConv;
+	}
+
+	// ÅÔÆ»ÉÜ¸©ÊÑ´¹
+	global $arrPref;
+	$objPage->arrOrder['deliv_pref'] = $arrPref[$objPage->arrOrder['deliv_pref']];
+	
+	$objPage->arrOrderDetail = $arrOrderDetail;
+	
+	$objCustomer = new SC_Customer();
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+	
+	$objMailView = new SC_SiteView();
+	// ¥á¡¼¥ëËÜÊ¸¤Î¼èÆÀ
+	$objMailView->assignobj($objPage);
+	$body = $objMailView->fetch($arrMAILTPLPATH[$template_id]);
+	
+	// ¥á¡¼¥ëÁ÷¿®½èÍý
+	$objSendMail = new GC_SendMail();
+	$bcc = $arrInfo['email01'];
+	$from = $arrInfo['email03'];
+	$error = $arrInfo['email04'];
+	
+	$tosubject = sfMakeSubject($tmp_subject);
+	
+	$objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
+	$objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " ". $arrOrder["order_name02"] ." ÍÍ");
+
+
+	// Á÷¿®¥Õ¥é¥°:true¤Î¾ì¹ç¤Ï¡¢Á÷¿®¤¹¤ë¡£
+	if($send) {
+		if ($objSendMail->sendMail()) {
+			sfSaveMailHistory($order_id, $template_id, $tosubject, $body);
+		}
+	}
+
+	return $objSendMail;
+}
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍÑ¤·¤¿¥á¡¼¥ë¤ÎÁ÷¿®
+function sfSendTplMail($to, $subject, $tplpath, $objPage) {
+	$objMailView = new SC_SiteView();
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	// ¥á¡¼¥ëËÜÊ¸¤Î¼èÆÀ
+	$objPage->tpl_shopname=$arrInfo['shop_name'];
+	$objPage->tpl_infoemail = $arrInfo['email02'];
+	$objMailView->assignobj($objPage);
+	$body = $objMailView->fetch($tplpath);
+	// ¥á¡¼¥ëÁ÷¿®½èÍý
+	$objSendMail = new GC_SendMail();
+	$to = mb_encode_mimeheader($to);
+	$bcc = $arrInfo['email01'];
+	$from = $arrInfo['email03'];
+	$error = $arrInfo['email04'];
+	$objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
+	$objSendMail->sendMail();	
+}
+
+// ÄÌ¾ï¤Î¥á¡¼¥ëÁ÷¿®
+function sfSendMail($to, $subject, $body) {
+	$objSiteInfo = new SC_SiteInfo();
+	$arrInfo = $objSiteInfo->data;
+	// ¥á¡¼¥ëÁ÷¿®½èÍý
+	$objSendMail = new GC_SendMail();
+	$bcc = $arrInfo['email01'];
+	$from = $arrInfo['email03'];
+	$error = $arrInfo['email04'];
+	$objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
+	$objSendMail->sendMail();
+}
+
+//·ïÌ¾¤Ë¥Æ¥ó¥×¥ì¡¼¥È¤òÍÑ¤¤¤ë
+function sfMakeSubject($subject){
+	
+	$objQuery = new SC_Query();
+	$objMailView = new SC_SiteView();
+	$objPage = new LC_Page();
+	
+	$arrInfo = $objQuery->select("*","dtb_baseinfo");
+	$arrInfo = $arrInfo[0];
+	$objPage->tpl_shopname=$arrInfo['shop_name'];
+	$objPage->tpl_infoemail=$subject;
+	$objMailView->assignobj($objPage);
+	$mailtitle = $objMailView->fetch('mail_templates/mail_title.tpl');
+	$ret = $mailtitle.$subject;
+	return $ret; 
+}
+
+// ¥á¡¼¥ëÇÛ¿®ÍúÎò¤Ø¤ÎÅÐÏ¿
+function sfSaveMailHistory($order_id, $template_id, $subject, $body) {
+	$sqlval['subject'] = $subject;
+	$sqlval['order_id'] = $order_id;
+	$sqlval['template_id'] = $template_id;
+	$sqlval['send_date'] = "Now()";
+	if($_SESSION['member_id'] != "") {
+		$sqlval['creator_id'] = $_SESSION['member_id'];
+	} else {
+		$sqlval['creator_id'] = '0';
+	}
+	$sqlval['mail_body'] = $body;
+	
+	$objQuery = new SC_Query();
+	$objQuery->insert("dtb_mail_history", $sqlval);
+}
+
+/* ²ñ°÷¾ðÊó¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
+function sfGetCustomerSqlVal($uniqid, $sqlval) {
+	$objCustomer = new SC_Customer();
+	// ²ñ°÷¾ðÊóÅÐÏ¿½èÍý
+	if ($objCustomer->isLoginSuccess()) {
+		// ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
+		$sqlval['order_temp_id'] = $uniqid;
+		$sqlval['update_date'] = 'Now()';
+		$sqlval['customer_id'] = $objCustomer->getValue('customer_id');
+	    $sqlval['order_name01'] = $objCustomer->getValue('name01');
+	    $sqlval['order_name02'] = $objCustomer->getValue('name02');
+	    $sqlval['order_kana01'] = $objCustomer->getValue('kana01');
+	    $sqlval['order_kana02'] = $objCustomer->getValue('kana02');
+	    $sqlval['order_sex'] = $objCustomer->getValue('sex');
+	    $sqlval['order_zip01'] = $objCustomer->getValue('zip01');
+	    $sqlval['order_zip02'] = $objCustomer->getValue('zip02');
+	    $sqlval['order_pref'] = $objCustomer->getValue('pref');
+	    $sqlval['order_addr01'] = $objCustomer->getValue('addr01');
+	    $sqlval['order_addr02'] = $objCustomer->getValue('addr02');
+	    $sqlval['order_tel01'] = $objCustomer->getValue('tel01');
+	    $sqlval['order_tel02'] = $objCustomer->getValue('tel02');
+		$sqlval['order_tel03'] = $objCustomer->getValue('tel03');
+		$sqlval['order_email'] = $objCustomer->getValue('email');
+		$sqlval['order_job'] = $objCustomer->getValue('job');
+		$sqlval['order_birth'] = $objCustomer->getValue('birth');
+	}
+	return $sqlval;
+}
+
+// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ø¤Î½ñ¤­¹þ¤ß½èÍý
+function sfRegistTempOrder($uniqid, $sqlval) {
+	if($uniqid != "") {
+		// ´ûÂ¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
+		$objQuery = new SC_Query();
+		$where = "order_temp_id = ?";
+		$cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
+		// ´ûÂ¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
+		if ($cnt == 0) {
+			// ½é²ó½ñ¤­¹þ¤ß»þ¤Ë²ñ°÷¤ÎÅÐÏ¿ºÑ¤ß¾ðÊó¤ò¼è¤ê¹þ¤à
+			$sqlval = sfGetCustomerSqlVal($uniqid, $sqlval);
+			$objQuery->insert("dtb_order_temp", $sqlval);
+		} else {
+			$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
+		}
+	}
+}
+
+/* ²ñ°÷¤Î¥á¥ë¥Þ¥¬ÅÐÏ¿¤¬¤¢¤ë¤«¤É¤¦¤«¤Î¥Á¥§¥Ã¥¯(²¾²ñ°÷¤ò´Þ¤Þ¤Ê¤¤) */
+function sfCheckCustomerMailMaga($email) {
+	$col = "T1.email, T1.mail_flag, T2.customer_id";
+	$from = "dtb_customer_mail AS T1 LEFT JOIN dtb_customer AS T2 ON T1.email = T2.email";
+	$where = "T1.email = ? AND T2.status = 2";
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select($col, $from, $where, array($email));
+	// ²ñ°÷¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë
+	if($arrRet[0]['customer_id'] != "") {
+		return true;
+	}
+	return false;
+}
+
+// ¥«¡¼¥É¤Î½èÍý·ë²Ì¤òÊÖ¤¹
+function sfGetAuthonlyResult($dir, $file_name, $name01, $name02, $card_no, $card_exp, $amount, $order_id, $jpo_info = "10"){
+
+	$path = $dir .$file_name;		// cgi¥Õ¥¡¥¤¥ë¤Î¥Õ¥ë¥Ñ¥¹À¸À®
+	$now_dir = getcwd();			// require¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤Î¤Ç¡¢cgi¼Â¹Ô¥Ç¥£¥ì¥¯¥È¥ê¤Ë°ÜÆ°¤¹¤ë
+	chdir($dir);
+	
+	// ¥Ñ¥¤¥×ÅÏ¤·¤Ç¥³¥Þ¥ó¥É¥é¥¤¥ó¤«¤écgiµ¯Æ°
+	$cmd = "$path card_no=$card_no name01=$name01 name02=$name02 card_exp=$card_exp amount=$amount order_id=$order_id jpo_info=$jpo_info";
+
+	$tmpResult = popen($cmd, "r");
+	
+	// ·ë²Ì¼èÆÀ
+	while( ! FEOF ( $tmpResult ) ) {
+		$result .= FGETS($tmpResult);
+	}
+	pclose($tmpResult);				// 	¥Ñ¥¤¥×¤òÊÄ¤¸¤ë
+	chdir($now_dir);				//¡¡¸µ¤Ë¤¤¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ëµ¢¤ë
+	
+	// ·ë²Ì¤òÏ¢ÁÛÇÛÎó¤Ø³ÊÇ¼
+	$result = ereg_replace("&$", "", $result);
+	foreach (explode("&",$result) as $data) {
+		list($key, $val) = explode("=", $data, 2);
+		$return[$key] = $val;
+	}
+	
+	return $return;
+}
+
+// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¾ðÊó¤ò¼èÆÀ¤¹¤ë
+function sfGetOrderTemp($order_temp_id) {
+	$objQuery = new SC_Query();
+	$where = "order_temp_id = ?";
+	$arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($order_temp_id));
+	return $arrRet[0];
+}
+
+// ¥«¥Æ¥´¥êID¼èÆÀÈ½ÄêÍÑ¤Î¥°¥í¡¼¥Ð¥ëÊÑ¿ô(°ìÅÙ¼èÆÀ¤µ¤ì¤Æ¤¤¤¿¤éºÆ¼èÆÀ¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë)
+$g_category_on = false;
+$g_category_id = "";
+
+/* ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¤ò¼èÆÀ¤¹¤ë */
+function sfGetCategoryId($product_id, $category_id) {
+	global $g_category_on;
+	global $g_category_id;
+	if(!$g_category_on)	{
+		$g_category_on = true;
+		if(sfIsInt($category_id) && sfIsRecord("dtb_category","category_id", $category_id)) {
+			$g_category_id = $category_id;
+		} else if (sfIsInt($product_id) && sfIsRecord("dtb_products","product_id", $product_id, "status = 1")) {
+			$objQuery = new SC_Query();
+			$where = "product_id = ?";
+			$category_id = $objQuery->get("dtb_products", "category_id", $where, array($product_id));
+			$g_category_id = $category_id;
+		} else {
+			// ÉÔÀµ¤Ê¾ì¹ç¤Ï¡¢0¤òÊÖ¤¹¡£
+			$g_category_id = 0;
+		}
+	}
+	return $g_category_id;
+}
+
+// ROOTID¼èÆÀÈ½ÄêÍÑ¤Î¥°¥í¡¼¥Ð¥ëÊÑ¿ô(°ìÅÙ¼èÆÀ¤µ¤ì¤Æ¤¤¤¿¤éºÆ¼èÆÀ¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë)
+$g_root_on = false;
+$g_root_id = "";
+
+/* ÁªÂòÃæ¤Î¥¢¥¤¥Æ¥à¤Î¥ë¡¼¥È¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë */
+function sfGetRootId() {
+	global $g_root_on;
+	global $g_root_id;
+	if(!$g_root_on)	{
+		$g_root_on = true;
+		$objQuery = new SC_Query();
+		if($_GET['product_id'] != "" || $_GET['category_id'] != "") {
+			// ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òÈ½Äê¤¹¤ë
+			$category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
+			// ROOT¥«¥Æ¥´¥êID¤Î¼èÆÀ
+			 $arrRet = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id);
+			 $root_id = $arrRet[0];
+		} else {
+			// ROOT¥«¥Æ¥´¥êID¤ò¤Ê¤·¤ËÀßÄê¤¹¤ë
+			$root_id = "";
+		}
+		$g_root_id = $root_id;
+	}
+	return $g_root_id;
+}
+
+/* ¥«¥Æ¥´¥ê¤«¤é¾¦ÉÊ¤ò¸¡º÷¤¹¤ë¾ì¹ç¤ÎWHEREÊ¸¤ÈÃÍ¤òÊÖ¤¹ */
+function sfGetCatWhere($category_id) {
+	// »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
+	$arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $category_id);
+	$tmp_where = "";
+	foreach ($arrRet as $val) {
+		if($tmp_where == "") {
+			$tmp_where.= " category_id IN ( ? ";
+		} else {
+			$tmp_where.= " ,? ";
+		}
+		$arrval[] = $val;
+	}
+	$tmp_where.= " ) ";
+	return array($tmp_where, $arrval);
+}
+
+/* ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»»¼° */
+function sfGetAddPoint($totalpoint, $use_point, $arrInfo) {
+	// ¹ØÆþ¾¦ÉÊ¤Î¹ç·×¥Ý¥¤¥ó¥È¤«¤éÍøÍÑ¤·¤¿¥Ý¥¤¥ó¥È¤Î¥Ý¥¤¥ó¥È´¹»»²ÁÃÍ¤ò°ú¤¯Êý¼°
+	$add_point = $totalpoint - intval($use_point * ($arrInfo['point_rate'] / 100));
+	
+	if($add_point < 0) {
+		$add_point = '0';
+	}
+	return $add_point;
+}
+
+/* °ì°Õ¤«¤ÄÍ½Â¬¤µ¤ì¤Ë¤¯¤¤ID */
+function sfGetUniqRandomId($head = "") {
+	// Í½Â¬¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¥é¥ó¥À¥àÊ¸»úÎó¤òÉÕÍ¿¤¹¤ë¡£
+	$random = gfMakePassword(8);
+	// Æ±°ì¥Û¥¹¥ÈÆâ¤Ç°ì°Õ¤ÊID¤òÀ¸À®
+	$id = uniqid($head);
+	return ($id . $random);
+}
+
+// ¥«¥Æ¥´¥êÊÌ¥ª¥¹¥¹¥áÉÊ¤Î¼èÆÀ
+function sfGetBestProducts( $conn, $category_id = 0){
+	// ´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÆâÍÆ¤ò¼èÆÀ¤¹¤ë
+	$sql = "SELECT name, main_image, main_list_image, price01_min, price01_max, price02_min, price02_max, point_rate,
+			 A.product_id, A.comment FROM dtb_best_products as A LEFT JOIN vw_products_allclass as B 
+			USING (product_id) WHERE A.category_id = ? AND A.delete = 0 AND status = 1 ORDER BY A.rank";
+	$arrItems = $conn->getAll($sql, array($category_id));
+	return $arrItems;
+}
+
+// ÆÃ¼ìÀ©¸æÊ¸»ú¤Î¼êÆ°¥¨¥¹¥±¡¼¥×
+function sfManualEscape($data) {
+	// ÇÛÎó¤Ç¤Ê¤¤¾ì¹ç
+	if(!is_array($data)) {			
+		$ret = pg_escape_string($data);
+		$ret = ereg_replace("%", "\\%", $ret);
+		$ret = ereg_replace("_", "\\_", $ret);
+		return $ret;
+	}
+	
+	// ÇÛÎó¤Î¾ì¹ç
+	foreach($data as $val) {
+		$ret = pg_escape_string($val);
+		$ret = ereg_replace("%", "\\%", $ret);
+		$ret = ereg_replace("_", "\\_", $ret);
+		$arrRet[] = $ret;
+	}
+	return $arrRet;
+}
+
+// ¼õÃíÈÖ¹æ¡¢ÍøÍÑ¥Ý¥¤¥ó¥È¡¢²Ã»»¥Ý¥¤¥ó¥È¤«¤éºÇ½ª¥Ý¥¤¥ó¥È¤ò¼èÆÀ
+function sfGetCustomerPoint($order_id, $use_point, $add_point) {
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("customer_id", "dtb_order", "order_id = ?", array($order_id));
+	$customer_id = $arrRet[0]['customer_id'];
+	if($customer_id != "" && $customer_id >= 1) {
+		$arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
+		$point = $arrRet[0]['point'];
+		$total_point = $arrRet[0]['point'] - $use_point + $add_point;
+	} else {
+		$total_point = "";
+		$point = "";
+	}
+	return array($point, $total_point);
+}
+
+/* ¥É¥á¥¤¥ó´Ö¤ÇÍ­¸ú¤Ê¥»¥Ã¥·¥ç¥ó¤Î¥¹¥¿¡¼¥È */
+function sfDomainSessionStart() {
+	$ret = session_id();
+	
+/*
+	¥Ø¥Ã¥À¡¼¤òÁ÷¿®¤·¤Æ¤¤¤Æ¤âsession_start()¤¬É¬Í×¤Ê¥Ú¡¼¥¸¤¬¤¢¤ë¤Î¤Ç
+	¥³¥á¥ó¥È¥¢¥¦¥È¤·¤Æ¤ª¤¯
+	if($ret == "" && !headers_sent()) {
+*/
+	if($ret == "") {
+		/* ¥»¥Ã¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤Î»ØÄê
+		 ¡¦¥Ö¥é¥¦¥¶¤òÊÄ¤¸¤ë¤Þ¤ÇÍ­¸ú
+		 ¡¦¤¹¤Ù¤Æ¤Î¥Ñ¥¹¤ÇÍ­¸ú
+		 ¡¦Æ±¤¸¥É¥á¥¤¥ó´Ö¤Ç¶¦Í­ */
+		session_set_cookie_params (0, "/", DOMAIN_NAME);
+		
+		if(!ini_get("session.auto_start")){
+			// ¥»¥Ã¥·¥ç¥ó³«»Ï
+			session_start();
+		}
+	}
+}
+
+/* Ê¸»úÎó¤Ë¶¯À©Åª¤Ë²þ¹Ô¤òÆþ¤ì¤ë */
+function sfPutBR($str, $size) {
+	$i = 0;
+	$cnt = 0;
+	$line = array();
+	$ret = "";
+	
+	while($str[$i] != "") {
+		$line[$cnt].=$str[$i];
+		$i++;
+		if(strlen($line[$cnt]) > $size) {
+			$line[$cnt].="<br />";
+			$cnt++;
+		}
+	}
+	
+	foreach($line as $val) {
+		$ret.=$val;
+	}
+	return $ret;
+}
+
+// Æó²ó°Ê¾å·«¤êÊÖ¤µ¤ì¤Æ¤¤¤ë¥¹¥é¥Ã¥·¥å[/]¤ò°ì¤Ä¤ËÊÑ´¹¤¹¤ë¡£
+function sfRmDupSlash($istr){
+	if(ereg("^http://", $istr)) {
+		$str = substr($istr, 7);
+		$head = "http://";
+	} else if(ereg("^https://", $istr)) {
+		$str = substr($istr, 8);
+		$head = "https://";
+	} else {
+		$str = $istr;
+	}
+	$str = ereg_replace("[/]+", "/", $str);
+	$ret = $head . $str;
+	return $ret;	
+}
+
+function sfEncodeFile($filepath, $enc_type, $out_dir) {
+	$ifp = fopen($filepath, "r");
+	
+	$basename = basename($filepath);
+	$outpath = $out_dir . "enc_" . $basename;
+	
+	$ofp = fopen($outpath, "w+");
+	
+	while(!feof($ifp)) {
+		$line = fgets($ifp);
+		$line = mb_convert_encoding($line, $enc_type, "auto");
+		fwrite($ofp,  $line);
+	}
+	
+	fclose($ofp);
+	fclose($ifp);
+	
+	return 	$outpath;
+}
+
+function sfCutString($str, $len, $byte = true) {
+	if($byte) {
+		if(strlen($str) > ($len + 2)) {
+			$ret =substr($str, 0, $len) . "...";
+		} else {
+			$ret = $str;
+		}
+	} else {
+		if(mb_strlen($str) > ($len + 1)) {
+			$ret = mb_substr($str, 0, $len) . "...";
+		} else {
+			$ret = $str;
+		}
+	}
+	return $ret;
+}
+
+// Ç¯¡¢·î¡¢Äù¤áÆü¤«¤é¡¢Àè·î¤ÎÄù¤áÆü+1¡¢º£·î¤ÎÄù¤áÆü¤òµá¤á¤ë¡£
+function sfTermMonth($year, $month, $close_day) {
+	$end_year = $year;
+	$end_month = $month;
+	
+	// ³«»Ï·î¤¬½ªÎ»·î¤ÈÆ±¤¸¤«ÈÝ¤«
+	$same_month = false;
+	
+	// ³ºÅö·î¤ÎËöÆü¤òµá¤á¤ë¡£
+	$end_last_day = date("d", mktime(0, 0, 0, $month + 1, 0, $year));
+	
+	// ·î¤ÎËöÆü¤¬Äù¤áÆü¤è¤ê¾¯¤Ê¤¤¾ì¹ç
+	if($end_last_day < $close_day) {
+		// Äù¤áÆü¤ò·îËöÆü¤Ë¹ç¤ï¤»¤ë
+		$end_day = $end_last_day;
+	} else {
+		$end_day = $close_day;
+	}
+	
+	// Á°·î¤Î¼èÆÀ
+	$tmp_year = date("Y", mktime(0, 0, 0, $month, 0, $year));
+	$tmp_month = date("m", mktime(0, 0, 0, $month, 0, $year));
+	// Á°·î¤ÎËöÆü¤òµá¤á¤ë¡£
+	$start_last_day = date("d", mktime(0, 0, 0, $month, 0, $year));
+	
+	// Á°·î¤ÎËöÆü¤¬Äù¤áÆü¤è¤ê¾¯¤Ê¤¤¾ì¹ç
+	if ($start_last_day < $close_day) {
+		// ·îËöÆü¤Ë¹ç¤ï¤»¤ë
+		$tmp_day = $start_last_day;
+	} else {
+		$tmp_day = $close_day;
+	}
+	
+	// Àè·î¤ÎËöÆü¤ÎÍâÆü¤ò¼èÆÀ¤¹¤ë
+	$start_year = date("Y", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
+	$start_month = date("m", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
+	$start_day = date("d", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
+	
+	// ÆüÉÕ¤ÎºîÀ®
+	$start_date = sprintf("%d/%d/%d 00:00:00", $start_year, $start_month, $start_day);
+	$end_date = sprintf("%d/%d/%d 23:59:59", $end_year, $end_month, $end_day);
+	
+	return array($start_date, $end_date);
+}
+
+// PDFÍÑ¤ÎRGB¥«¥é¡¼¤òÊÖ¤¹
+function sfGetPdfRgb($hexrgb) {
+	$hex = substr($hexrgb, 0, 2);
+	$r = hexdec($hex) / 255;
+	
+	$hex = substr($hexrgb, 2, 2);
+	$g = hexdec($hex) / 255;
+	
+	$hex = substr($hexrgb, 4, 2);
+	$b = hexdec($hex) / 255;
+	
+	return array($r, $g, $b);	
+}
+
+//¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤È¥á¡¼¥ëÇÛ¿®
+function sfRegistTmpMailData($mail_flag, $email){
+	$objQuery = new SC_Query();
+	$objConn = new SC_DBConn();
+	$objPage = new LC_Page();
+	
+	$random_id = sfGetUniqRandomId();
+	$arrRegistMailMagazine["mail_flag"] = $mail_flag;
+	$arrRegistMailMagazine["email"] = $email;
+	$arrRegistMailMagazine["temp_id"] =$random_id;
+	$arrRegistMailMagazine["end_flag"]='0';
+	$arrRegistMailMagazine["update_date"] = 'now()';
+	
+	//¥á¥ë¥Þ¥¬²¾ÅÐÏ¿ÍÑ¥Õ¥é¥°
+	$flag = $objQuery->count("dtb_customer_mail_temp", "email=?", array($email));
+	$objConn->query("BEGIN");
+	switch ($flag){
+		case '0':
+		$objConn->autoExecute("dtb_customer_mail_temp",$arrRegistMailMagazine);
+		break;
+	
+		case '1':
+		$objConn->autoExecute("dtb_customer_mail_temp",$arrRegistMailMagazine, "email = '" .addslashes($email). "'");
+		break;
+	}
+	$objConn->query("COMMIT");
+	$subject = sfMakeSubject('¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
+	$objPage->tpl_url = SSL_URL."mailmagazine/regist.php?temp_id=".$arrRegistMailMagazine['temp_id'];
+	switch ($mail_flag){
+		case '1':
+		$objPage->tpl_name = "ÅÐÏ¿";
+		$objPage->tpl_kindname = "HTML";
+		break;
+		
+		case '2':
+		$objPage->tpl_name = "ÅÐÏ¿";
+		$objPage->tpl_kindname = "¥Æ¥­¥¹¥È";
+		break;
+		
+		case '3':
+		$objPage->tpl_name = "²ò½ü";
+		break;
+	}
+		$objPage->tpl_email = $email;
+	sfSendTplMail($email, $subject, 'mail_templates/mailmagazine_temp.tpl', $objPage);
+}
+
+// ºÆµ¢Åª¤ËÂ¿ÃÊÇÛÎó¤ò¸¡º÷¤·¤Æ°ì¼¡¸µÇÛÎó(Hidden°úÅÏ¤·ÍÑÇÛÎó)¤ËÊÑ´¹¤¹¤ë¡£
+function sfMakeHiddenArray($arrSrc, $arrDst = array(), $parent_key = "") {
+	if(is_array($arrSrc)) {
+		foreach($arrSrc as $key => $val) {
+			if($parent_key != "") {
+				$keyname = $parent_key . "[". $key . "]";
+			} else {
+				$keyname = $key;
+			}
+			if(is_array($val)) {
+				$arrDst = sfMakeHiddenArray($val, $arrDst, $keyname);
+			} else {
+				$arrDst[$keyname] = $val;
+			}
+		}
+	}
+	return $arrDst;
+}
+
+// DB¼èÆÀÆü»þ¤ò¥¿¥¤¥à¤ËÊÑ´¹
+function sfDBDatetoTime($db_date) {
+	$date = ereg_replace("\..*$","",$db_date);
+	$time = strtotime($date);
+	return $time;
+}
+
+// ½ÐÎÏ¤ÎºÝ¤Ë¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂØ¤¨¤é¤ì¤ë
+/*
+	index.php?tpl=test.tpl
+*/
+function sfCustomDisplay($objPage) {
+	$basename = basename($_SERVER["REQUEST_URI"]);
+
+	if($basename == "") {
+		$path = $_SERVER["REQUEST_URI"] . "index.php";
+	} else {
+		$path = $_SERVER["REQUEST_URI"];
+	}	
+
+	if($_GET['tpl'] != "") {
+		$tpl_name = $_GET['tpl'];
+	} else {
+		$tpl_name = ereg_replace("^/", "", $path);
+		$tpl_name = ereg_replace("/", "_", $tpl_name);
+		$tpl_name = ereg_replace("(\.php$|\.html$)", ".tpl", $tpl_name);
+	}
+
+	$template_path = TEMPLATE_FTP_DIR . $tpl_name;
+
+	if(file_exists($template_path)) {
+		$objView = new SC_UserView(TEMPLATE_FTP_DIR, COMPILE_FTP_DIR);
+		$objView->assignobj($objPage);
+		$objView->display($tpl_name);
+	} else {
+		$objView = new SC_SiteView();
+		$objView->assignobj($objPage);
+		$objView->display(SITE_FRAME);
+	}
+}
+
+//²ñ°÷ÊÔ½¸ÅÐÏ¿½èÍý
+function sfEditCustomerData($array, $arrRegistColumn) {
+	$objQuery = new SC_Query();
+	
+	foreach ($arrRegistColumn as $data) {
+		if ($data["column"] != "password") {
+			if($array[ $data['column'] ] != "") {
+				$arrRegist[ $data["column"] ] = $array[ $data["column"] ];
+			} else {
+				$arrRegist[ $data['column'] ] = NULL;
+			}
+		}
+	}
+	if (strlen($array["year"]) > 0 && strlen($array["month"]) > 0 && strlen($array["day"]) > 0) {
+		$arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
+	} else {
+		$arrRegist["birth"] = NULL;
+	}
+
+	//-- ¥Ñ¥¹¥ï¡¼¥É¤Î¹¹¿·¤¬¤¢¤ë¾ì¹ç¤Ï°Å¹æ²½¡£¡Ê¹¹¿·¤¬¤Ê¤¤¾ì¹ç¤ÏUPDATEÊ¸¤ò¹½À®¤·¤Ê¤¤¡Ë
+	if ($array["password"] != DEFAULT_PASSWORD) $arrRegist["password"] = crypt($array["password"]);
+	$arrRegist["update_date"] = "NOW()";
+	
+	$sqlval['email'] = $array['email'];
+	$sqlval['mail_flag'] = $array['mail_flag'];
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($array['customer_id']));
+	$objQuery->delete("dtb_customer_mail", "email = ?", array($array['email']));
+	$objQuery->insert("dtb_customer_mail", $sqlval);
+	$objQuery->commit();
+}
+
+// PHP¤Îmb_convert_encoding´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
+function sf_mb_convert_encoding($str, $encode = 'EUC-JP') {
+	return  mb_convert_encoding($str, $encode);
+}	
+
+// PHP¤Îmktime´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
+function sf_mktime($format, $hour=0, $minute=0, $second=0, $month=1, $day=1, $year=1999) {
+	return  date($format,mktime($hour, $minute, $second, $month, $day, $year));
+}	
+
+// PHP¤Îdate´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
+function sf_date($format, $timestamp = '') {
+	return  date( $format, $timestamp);
+}
+
+// ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤Î·¿¤òÊÑ´¹¤¹¤ë
+function sfChangeCheckBox($data , $tpl = false){
+	if ($tpl) {
+		if ($data == 1){
+			return 'checked';
+		}else{
+			return "";
+		}
+	}else{
+		if ($data == "on"){
+			return 1;
+		}else{
+			return 2;
+		}
+	}
+}
+
+function sfCategory_Count($objQuery){
+	$sql = "";
+	
+	//¥Æ¡¼¥Ö¥ëÆâÍÆ¤Îºï½ü
+	$objQuery->query("DELETE FROM dtb_category_count");
+	$objQuery->query("DELETE FROM dtb_category_total_count");
+	
+	//³Æ¥«¥Æ¥´¥êÆâ¤Î¾¦ÉÊ¿ô¤ò¿ô¤¨¤Æ³ÊÇ¼
+	$sql = " INSERT INTO dtb_category_count(category_id, product_count) ";
+	$sql .= " SELECT T1.category_id, count(T2.category_id) FROM dtb_category AS T1 LEFT JOIN dtb_products AS T2 ";
+	$sql .= " ON T1.category_id = T2.category_id  ";
+	$sql .= " WHERE T2.delete = 0 AND T2.status = 1 ";
+	$sql .= " GROUP BY T1.category_id, T2.category_id ";
+	$objQuery->query($sql);
+	
+	//»Ò¥«¥Æ¥´¥êÆâ¤Î¾¦ÉÊ¿ô¤ò½¸·×¤¹¤ë
+	$arrCat = $objQuery->getAll("SELECT * FROM dtb_category");
+	
+	$sql = "";
+	foreach($arrCat as $key => $val){
+		
+		// »ÒID°ìÍ÷¤ò¼èÆÀ
+		$arrRet = sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $val['category_id']);	
+		$line = sfGetCommaList($arrRet);
+		
+		$sql = " INSERT INTO dtb_category_total_count(category_id, product_count) ";
+		$sql .= " SELECT ?, SUM(product_count) FROM dtb_category_count ";
+		$sql .= " WHERE category_id IN (" . $line . ")";
+				
+		$objQuery->query($sql, array($val['category_id']));
+	}
+}
+
+// 2¤Ä¤ÎÇÛÎó¤òÍÑ¤¤¤ÆÏ¢ÁÛÇÛÎó¤òºîÀ®¤¹¤ë
+function sfarrCombine($arrKeys, $arrValues) {
+
+	if(count($arrKeys) <= 0 and count($arrValues) <= 0) return array();
+	
+    $keys = array_values($arrKeys);
+    $vals = array_values($arrValues); 
+	
+    $max = max( count( $keys ), count( $vals ) ); 
+    $combine_ary = array(); 
+    for($i=0; $i<$max; $i++) { 
+        $combine_ary[$keys[$i]] = $vals[$i]; 
+    } 
+    if(is_array($combine_ary)) return $combine_ary; 
+    
+	return false; 
+}
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤é»ÒIDÇÛÎó¤ò¼èÆÀ¤¹¤ë */
+function sfGetChildrenArray($table, $pid_name, $id_name, $id) {
+	$objQuery = new SC_Query();
+	$col = $pid_name . "," . $id_name;
+ 	$arrData = $objQuery->select($col, $table);
+	
+	$arrPID = array();
+	$arrPID[] = $id;
+	$arrChildren = array();
+	$arrChildren[] = $id;
+	
+	$arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID);
+	
+	while(count($arrRet) > 0) {
+		$arrChildren = array_merge($arrChildren, $arrRet);
+		$arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrRet);
+	}
+	
+	return $arrChildren;
+}
+
+/* ¿ÆIDÄ¾²¼¤Î»ÒID¤ò¤¹¤Ù¤Æ¼èÆÀ¤¹¤ë */
+function sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID) {
+	$arrChildren = array();
+	$max = count($arrData);
+	
+	for($i = 0; $i < $max; $i++) {
+		foreach($arrPID as $val) {
+			if($arrData[$i][$pid_name] == $val) {
+				$arrChildren[] = $arrData[$i][$id_name];
+			}
+		}
+	}	
+	return $arrChildren;
+}
+
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤é¿ÆIDÇÛÎó¤ò¼èÆÀ¤¹¤ë */
+function sfGetParentsArray($table, $pid_name, $id_name, $id) {
+	$objQuery = new SC_Query();
+	$col = $pid_name . "," . $id_name;
+ 	$arrData = $objQuery->select($col, $table);
+	
+	$arrParents = array();
+	$arrParents[] = $id;
+	$child = $id;
+	
+	$ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $child);
+
+	while($ret != "") {
+		$arrParents[] = $ret;
+		$ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $ret);
+	}
+	
+	$arrParents = array_reverse($arrParents);
+	
+	return $arrParents;
+}
+
+/* »ÒID½êÂ°¤¹¤ë¿ÆID¤ò¼èÆÀ¤¹¤ë */
+function sfGetParentsArraySub($arrData, $pid_name, $id_name, $child) {
+	$max = count($arrData);
+	$parent = "";
+	for($i = 0; $i < $max; $i++) {
+		if($arrData[$i][$id_name] == $child) {
+			$parent = $arrData[$i][$pid_name];
+			break;
+		}
+	}
+	return $parent;
+}
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤éÍ¿¤¨¤é¤ì¤¿ID¤Î·»Äï¤ò¼èÆÀ¤¹¤ë */
+function sfGetBrothersArray($arrData, $pid_name, $id_name, $arrPID) {
+	$max = count($arrData);
+	
+	$arrBrothers = array();
+	foreach($arrPID as $id) {
+		// ¿ÆID¤ò¸¡º÷¤¹¤ë
+		for($i = 0; $i < $max; $i++) {
+			if($arrData[$i][$id_name] == $id) {
+				$parent = $arrData[$i][$pid_name];
+				break;
+			}
+		}
+		// ·»ÄïID¤ò¸¡º÷¤¹¤ë
+		for($i = 0; $i < $max; $i++) {
+			if($arrData[$i][$pid_name] == $parent) {
+				$arrBrothers[] = $arrData[$i][$id_name];
+			}
+		}					
+	}
+	return $arrBrothers;
+}
+
+/* ³¬ÁØ¹½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤éÍ¿¤¨¤é¤ì¤¿ID¤ÎÄ¾Â°¤Î»Ò¤ò¼èÆÀ¤¹¤ë */
+function sfGetUnderChildrenArray($arrData, $pid_name, $id_name, $parent) {
+	$max = count($arrData);
+	
+	$arrChildren = array();
+	// »ÒID¤ò¸¡º÷¤¹¤ë
+	for($i = 0; $i < $max; $i++) {
+		if($arrData[$i][$pid_name] == $parent) {
+			$arrChildren[] = $arrData[$i][$id_name];
+		}
+	}					
+	return $arrChildren;
+}
+
+
+// ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ
+function sfGetCatTree($parent_category_id, $count_check = false) {
+	$objQuery = new SC_Query();
+	$col = "*";
+	$from = "dtb_category left join dtb_category_total_count using (category_id)";
+	// ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯
+	if($count_check) {
+		$where = "delete = 0 AND product_count > 0";
+	} else {
+		$where = "delete = 0";
+	}
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, $from, $where);
+	
+	$arrParentID = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id);
+		
+	foreach($arrRet as $key => $array) {
+		foreach($arrParentID as $val) {
+			if($array['category_id'] == $val) {
+				$arrRet[$key]['display'] = 1;
+				break;
+			}
+		}
+	}
+	return $arrRet;
+}
+
+// ¿Æ¥«¥Æ¥´¥ê¡¼¤òÏ¢·ë¤·¤¿Ê¸»úÎó¤ò¼èÆÀ¤¹¤ë
+function sfGetCatCombName($category_id){
+	// ¾¦ÉÊ¤¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ
+	$objQuery = new SC_Query();
+	$arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);	
+	$ConbName = "";
+	
+	// ¥«¥Æ¥´¥ê¡¼Ì¾¾Î¤ò¼èÆÀ¤¹¤ë
+	foreach($arrCatID as $key => $val){
+		$sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
+		$arrVal = array($val);
+		$CatName = $objQuery->getOne($sql,$arrVal);
+		$ConbName .= $CatName . ' | ';
+	}
+	// ºÇ¸å¤Î ¡Ã ¤ò¥«¥Ã¥È¤¹¤ë
+	$ConbName = substr_replace($ConbName, "", strlen($ConbName) - 2, 2);
+	
+	return $ConbName;
+}
+
+// »ØÄê¤·¤¿¥«¥Æ¥´¥ê¡¼ID¤ÎÂç¥«¥Æ¥´¥ê¡¼¤ò¼èÆÀ¤¹¤ë
+function GetFirstCat($category_id){
+	// ¾¦ÉÊ¤¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ
+	$objQuery = new SC_Query();
+	$arrRet = array();
+	$arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);	
+	$arrRet['id'] = $arrCatID[0];
+	
+	// ¥«¥Æ¥´¥ê¡¼Ì¾¾Î¤ò¼èÆÀ¤¹¤ë
+	$sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
+	$arrVal = array($arrRet['id']);
+	$arrRet['name'] = $objQuery->getOne($sql,$arrVal);
+	
+	return $arrRet;
+}
+
+/* ¥Ç¥Ð¥Ã¥°ÍÑ ------------------------------------------------------------------------------------------------*/
+function sfPrintR($obj) {
+	print("<div style='font-size: 12px'>\n");
+	print("<strong>**¥Ç¥Ð¥Ã¥°Ãæ**</strong><br />\n");
+	print("<pre>\n");
+	print_r($obj);
+	print("</pre>\n");
+	print("<strong>**¥Ç¥Ð¥Ã¥°Ãæ**</strong></div>\n");
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/lib/gdthumb.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/lib/gdthumb.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/lib/gdthumb.php	(revision 1328)
@@ -0,0 +1,214 @@
+<?php
+/* 
+
+¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡
+GD¼«Æ°¥µ¥à¥Í¥¤¥ëºîÀ® + ÃæÀî½¤Àµ2006/02/03
+
+Copyright 2002- Akihiro Asai. All rights reserved.
+
+http://aki.adam.ne.jp
+aki@mx3.adam.ne.jp
+
+¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡¢¡
+
+¢¢ µ¡Ç½³µÍ×
+¡¦»ØÄê¤µ¤ì¤¿¥¤¥á¡¼¥¸¤Î¥µ¥à¥Í¥¤¥ë¤òÉ½¼¨¤·¤Þ¤¹¡£
+¡¦½ÐÎÏ¤¹¤ëÂç¤­¤µ¤ò»ØÄê¤¹¤ë»ö¤¬¤Ç¤­¤Þ¤¹¡£
+¡¦½ÐÎÏ¤µ¤ì¤ë¥¤¥á¡¼¥¸¤Î¥¢¥¹¥Ú¥¯¥ÈÈæ¤Ï°Ý»ý¤µ¤ì¤Þ¤¹¡£
+
+¢¢ »ÈÍÑÊýË¡
+»ØÄê¤Ï gdthumb.php?path=xxx/xxx.[ jpg | png | gif ]&mw=xx&mh=xx
+¢¨ pass¤ÎÉôÊ¬¤Ë¤Ï²èÁü¤Ø¤Î¥Ñ¥¹¤ò»ØÄê
+¢¨ mw¤ËÉ½¼¨²èÁü¤ÎºÇÂç²£Éý¡¢mh¤ËÉ½¼¨²èÁü¤ÎºÇÂç²£Éý¤ò³°Éô¤è¤ê»ØÄê²ÄÇ½¡£
+¢¨ »ØÄê¤·¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï¥Ç¥Õ¥©¥ë¥È¤ÎÀßÄêÃÍ¤òºÎÍÑ¡£
+¡ú¥¯¥é¥¹¤È¤·¤Æ»ÈÍÑ¤¹¤ë¾ì¹ç¤Ï¡¢¡Ö¥¯¥é¥¹¤È¤·¤Æ»ÈÍÑ¤¹¤ë¾ì¹ç¤Ë¤Ï¡¦¡¦¡¦¡×°Ê¹ß¤ò¥³¥á¥ó¥È¥¢¥¦¥È¤·¤Æ²¼¤µ¤¤¡£
+
+¢¢ ¹¹¿·ÍúÎò
+2002/08/19 ºÇÂç½ÄÉý¤ÎÉôÊ¬¤ò°ìÉô¼êÄ¾¤·
+2003/01/31 ¥Ç¥Õ¥©¥ë¥È¤Ç¥¢¥¹¥Ú¥¯¥ÈÈæ¤¬¸ÇÄê
+2003/04/11 ºÇÂç²£Éý¤ÈºÇÂç½ÄÉý¤ò³°Éô¤è¤ê»ØÄê²ÄÇ½
+2003/04/25 GD2ÍÑ¤Ë´Ø¿ôÊÑ¹¹
+2003/06/21 GD1/2¤ò¥Ð¡¼¥¸¥ç¥ó¤Ë±þ¤¸¤ÆÊÑ¹¹¤Ç¤­¤ë¤è¤¦¤Ë½¤Àµ
+2003/06/25 imageCopyResampled¤ÎÉôÊ¬¤ò½¤Àµ
+2004/01/28 ¥¹¥¯¥ê¥×¥ÈÁ´ÂÎ¤ò½ñ¤­Ä¾¤·¡£°ú¿ô¡Öpass¡×¤ò¡Öpath¡×¤ËÊÑ¹¹¡£
+2005/12/08 ´Ø¿ô¤Î¼«Æ°È½ÊÌ gif·Á¼°¤ËÂÐ±þ Æ©²ágif¡¦Æ©²ápng¤ËÂÐ±þ¡ÊGD2.0.1°Ê¹ß¡Ë  
+*/
+
+// ¥¯¥é¥¹¤È¤·¤Æ»ÈÍÑ¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢°Ê²¼¤Î6¹Ô¤ò¥³¥á¥ó¥È¥¢¥¦¥È
+/*
+$objg = new gdthumb();
+list($Ck, $Msg) = $objg->Main($_GET["path"], $_GET["mw"], $_GET["mh"]);
+if(!$Ck) { // ¥¨¥é¡¼¤Î¾ì¹ç
+	header("Content-Type: text/html; charset=euc-jp");
+	print $Msg;
+}
+*/
+
+class gdthumb {
+	
+	var $imgMaxWidth;
+	var $imgMaxHeight;
+	var $gdVer;
+	
+	/*
+	* ¥³¥ó¥¹¥È¥é¥¯¥¿
+	*/
+	function gdthumb() {
+		
+		// ¥¹¥¯¥ê¥×¥È¤Î¥Ç¥Õ¥©¥ë¥ÈÀßÄê
+		
+		// ²èÁü¤ÎºÇÂç²£Éý
+		$this->imgMaxWidth = 240; // 1°Ê¾å¤ÎÃÍ
+		
+		// ²èÁü¤ÎºÇÂç½ÄÉý
+		$this->imgMaxHeight = 0; // »ØÄê¤·¤Ê¤¤¾ì¹ç¤Ï0 »ØÄê¤¹¤ë¾ì¹ç¤Ï1°Ê¾å¤ÎÃÍ
+		
+	}
+	
+	/*
+	* ¥µ¥à¥Í¥¤¥ë²èÁü¤ÎºîÀ®
+	* string $path
+	* integer $width
+	* integer $height
+	*/
+	function Main($path, $width, $height, $dst_file) {
+		
+		if(!isset($path)) {
+			return array(0, "¥¤¥á¡¼¥¸¤Î¥Ñ¥¹¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+		}
+		
+		if(!file_exists($path)) {
+			return array(0, "»ØÄê¤µ¤ì¤¿¥Ñ¥¹¤Ë¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£");
+		}
+		
+		// ²èÁü¤ÎÂç¤­¤µ¤ò¥»¥Ã¥È
+		if($width) $this->imgMaxWidth = $width;
+		if($height) $this->imgMaxHeight = $height;
+		
+		$size = @GetimageSize($path);
+		$re_size = $size;
+		
+		//¥¢¥¹¥Ú¥¯¥ÈÈæ¸ÇÄê½èÍý
+		if($this->imgMaxWidth != 0) {
+			$tmp_w = $size[0] / $this->imgMaxWidth;
+		}
+		
+		if($this->imgMaxHeight != 0) {
+			$tmp_h = $size[1] / $this->imgMaxHeight;
+		}
+		
+		if($tmp_w > 1 || $tmp_h > 1) {
+			if($this->imgMaxHeight == 0) {
+				if($tmp_w > 1) {
+					$re_size[0] = $this->imgMaxWidth;
+					$re_size[1] = $size[1] * $this->imgMaxWidth / $size[0];
+				}
+			} else {
+				if($tmp_w > $tmp_h) {
+					$re_size[0] = $this->imgMaxWidth;
+					$re_size[1] = $size[1] * $this->imgMaxWidth / $size[0];
+				} else {
+					$re_size[1] = $this->imgMaxHeight;
+					$re_size[0] = $size[0] * $this->imgMaxHeight / $size[1];
+				}
+			}
+		}
+		
+		$imagecreate = function_exists("imagecreatetruecolor") ? "imagecreatetruecolor" : "imagecreate";
+		$imageresize = function_exists("imagecopyresampled") ? "imagecopyresampled" : "imagecopyresized";
+		
+		switch($size[2]) {
+			
+			// gif·Á¼°
+			case "1":
+				if(function_exists("imagecreatefromgif")) {
+					$src_im = imagecreatefromgif($path);
+					$dst_im = $imagecreate($re_size[0], $re_size[1]);
+					
+					$transparent = imagecolortransparent($src_im);
+					$colorstotal = imagecolorstotal ($src_im);
+					
+					$dst_im = imagecreate($re_size[0], $re_size[1]);
+					if (0 <= $transparent && $transparent < $colorstotal) {
+						imagepalettecopy ($dst_im, $src_im);
+						imagefill ($dst_im, 0, 0, $transparent);
+						imagecolortransparent ($dst_im, $transparent);
+					}
+          			imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+									
+					if(function_exists("imagegif")) {
+						$dst_file = $dst_file . ".gif";
+						imagegif($dst_im, $dst_file);
+						imagedestroy($src_im);
+						imagedestroy($dst_im);
+					} else {
+						$dst_file = $dst_file . ".png";						
+						imagepng($dst_im, $dst_file);
+						imagedestroy($src_im);
+						imagedestroy($dst_im);
+					}
+				} else {
+					// ¥µ¥à¥Í¥¤¥ëºîÀ®ÉÔ²Ä¤Î¾ì¹ç¡Êµì¥Ð¡¼¥¸¥ç¥óÂÐºö¡Ë
+					$dst_im = imageCreate($re_size[0], $re_size[1]);
+					imageColorAllocate($dst_im, 255, 255, 214); //ÇØ·Ê¿§
+					
+					// ÏÈÀþ¤ÈÊ¸»ú¿§¤ÎÀßÄê
+					$black = imageColorAllocate($dst_im, 0, 0, 0);
+					$red = imageColorAllocate($dst_im, 255, 0, 0);
+					
+					imagestring($dst_im, 5, 10, 10, "GIF $size[0]x$size[1]", $red);
+					imageRectangle ($dst_im, 0, 0, ($re_size[0]-1), ($re_size[1]-1), $black);
+					$dst_file = $dst_file . ".png";
+					imagepng($dst_im, $dst_file);
+					imagedestroy($src_im);
+					imagedestroy($dst_im);
+				}
+				break;
+				
+			// jpg·Á¼°
+			case "2": 
+			
+				$src_im = imageCreateFromJpeg($path);
+				$dst_im = $imagecreate($re_size[0], $re_size[1]);
+				imagecopyresized( $dst_im, $src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+				
+				$dst_file = $dst_file . ".jpg";
+				imageJpeg($dst_im, $dst_file);
+				imagedestroy($src_im);
+				imagedestroy($dst_im);
+      			
+				break;
+    
+			// png·Á¼°    
+			case "3": 
+
+				$src_im = imagecreatefrompng($path);
+				
+				$colortransparent = imagecolortransparent($src_im);
+				if ($colortransparent > -1) {
+					$dst_im = $imagecreate($re_size[0], $re_size[1]);
+					imagepalettecopy($dst_im, $src_im);
+					imagefill($dst_im, 0, 0, $colortransparent);
+					imagecolortransparent($dst_im, $colortransparent);
+					imagecopyresized($dst_im,$src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+				} else {				
+					$dst_im = $imagecreate($re_size[0], $re_size[1]);
+					imagecopyresized($dst_im,$src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+					imagetruecolortopalette($dst_im, false, imagecolorstotal($src_im));
+				}				
+			
+				$dst_file = $dst_file . ".png";
+				imagepng($dst_im, $dst_file);
+				imagedestroy($src_im);
+				imagedestroy($dst_im);
+				
+				break;
+				
+			default:
+				return array(0, "¥¤¥á¡¼¥¸¤Î·Á¼°¤¬ÉÔÌÀ¤Ç¤¹¡£");
+		}
+
+		return array(1, $dst_file);
+	}
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/lib/glib.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/lib/glib.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/lib/glib.php	(revision 1328)
@@ -0,0 +1,187 @@
+<?php
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfDownloadCsv
+ * [³µÍ×] °ú¿ô¥Ç¡¼¥¿¤òCSV¤È¤·¤Æ¡¢¥¯¥é¥¤¥¢¥ó¥È¤Ë¥À¥¦¥ó¥í¡¼¥É¤µ¤»¤ë
+ * [°ú¿ô] 1:¥Ø¥Ã¥ÀÊ¸»úÎó 2:CSV¥Ç¡¼¥¿
+ * [ÌáÃÍ] -
+ * [°ÍÂ¸] -
+ * [Ãí¼á] °ú¿ô¤Ï£±¡¤£²¤È¤â¥«¥ó¥Þ¶èÀÚ¤ê¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È
+ *----------------------------------------------------------------------*/
+function gfDownloadCsv($header, $contents){
+	
+	$fiest_name = date("YmdHis") .".csv";
+	
+	/* HTTP¥Ø¥Ã¥À¤Î½ÐÎÏ */
+	Header("Content-disposition: attachment; filename=${fiest_name}");
+	Header("Content-type: application/octet-stream; name=${fiest_name}");
+	
+	$return = $header.$contents;
+	if (mb_detect_encoding($return) == 'EUC-JP'){						//Ê¸»ú¥³¡¼¥ÉÊÑ´¹
+		$return = mb_convert_encoding($return,'SJIS','EUC-JP');
+		$return = str_replace( array( "\r\n", "\r" ), "\n", $return);	// ²þ¹ÔÊýË¡¤ÎÅý°ì
+	}
+	echo $return;
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfSetCsv
+ * [³µÍ×] °ú¿ô¤ÎÇÛÎó¤òCSV·Á¼°¤ËÊÑ´¹¤¹¤ë
+ * [°ú¿ô] 1:CSV¤Ë¤¹¤ëÇÛÎó 2:°ú¿ô1¤¬Ï¢ÁÛÇÛÎó»þ¤ÎÅº¤¨»ú¤ò»ØÄê¤·¤¿ÇÛÎó
+ * [ÌáÃÍ] CSV¥Ç¡¼¥¿
+ * [°ÍÂ¸] -
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfSetCsv( $array, $arrayIndex = "" ){	
+	//°ú¿ô$arrayIndex¤Ï¡¢$array¤¬Ï¢ÁÛÇÛÎó¤Î¤È¤­¤ËÅº¤¨»ú¤ò»ØÄê¤·¤Æ¤ä¤ë¤¿¤á¤Ë»ÈÍÑ¤¹¤ë
+	
+	$return = "";
+	for ($i=0; $i<count($array); $i++){
+		
+		for ($j=0; $j<count($array[$i]); $j++ ){
+			if ( $j > 0 ) $return .= ",";
+			$return .= "\"";			
+			if ( $arrayIndex ){
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$arrayIndex[$j]] )) ."\"";			
+			} else {
+				$return .= mb_ereg_replace("<","¡ã",mb_ereg_replace( "\"","\"\"",$array[$i][$j] )) ."\"";
+			}
+		}
+		$return .= "\n";			
+	}
+	
+	return $return;
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfGetAge
+ * [³µÍ×] ÆüÉÕ¤è¤êÇ¯Îð¤ò·×»»¤¹¤ë¡£
+ * [°ú¿ô] 1:ÆüÉÕÊ¸»úÎó(yyyy/mm/dd¡¢yyyy-mm-dd hh:mm:ssÅù)
+ * [ÌáÃÍ] Ç¯Îð¤Î¿ôÃÍ
+ * [°ÍÂ¸] -
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfGetAge($dbdate)
+{
+    $ty = date("Y");
+    $tm = date("m");
+    $td = date("d");
+    list($by, $bm, $bd) = split("[-/ ]", $dbdate);
+    $age = $ty - $by;
+	if($tm * 100 + $td < $bm * 100 + $bd) $age--;
+    return $age;
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfDebugLog
+ * [³µÍ×] ¥í¥°¥Õ¥¡¥¤¥ë¤ËÊÑ¿ô¤Î¾ÜºÙ¤ò½ÐÎÏ¤¹¤ë¡£
+ * [°ú¿ô] ÂÐ¾Ý¤È¤Ê¤ëÊÑ¿ô
+ * [ÌáÃÍ] ¤Ê¤·
+ * [°ÍÂ¸] gfPrintLog
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfDebugLog($obj){
+		gfPrintLog("*** start Debug ***");
+		ob_start();
+		print_r($obj);
+		$buffer = ob_get_contents();
+		ob_end_clean();
+		$fp = fopen(LOG_PATH, "a+");
+		fwrite( $fp, $buffer."\n" );
+		fclose( $fp );
+		gfPrintLog("*** end Debug ***");
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfPrintLog
+ * [³µÍ×] ¥í¥°¥Õ¥¡¥¤¥ë¤ËÆü»þ¡¢½èÍý¥Õ¥¡¥¤¥ëÌ¾¡¢¥á¥Ã¥»¡¼¥¸¤ò½ÐÎÏ
+ * [°ú¿ô] É½¼¨¤·¤¿¤¤¥á¥Ã¥»¡¼¥¸
+ * [ÌáÃÍ] ¤Ê¤·
+ * [°ÍÂ¸] ¤Ê¤·
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfPrintLog($mess, $path = '') {
+	// ÆüÉÕ¤Î¼èÆÀ
+	$today = date("Y/m/d H:i:s");
+	// ½ÐÎÏ¥Ñ¥¹¤ÎºîÀ®
+	if ($path == "") {
+		$path = LOG_PATH;
+	}
+	
+	// ¥¨¥¹¥±¡¼¥×¤µ¤ì¤Æ¤¤¤ëÊ¸»ú¤ò¤â¤È¤ËÌá¤¹
+	$trans_tbl = get_html_translation_table (HTML_ENTITIES);
+    $trans_tbl = array_flip ($trans_tbl);
+    $mess = strtr($mess, $trans_tbl);
+	
+	$fp = fopen($path, "a+");
+	if($fp) {
+		fwrite( $fp, $today." [".$_SERVER['PHP_SELF']."] ".$mess." from ". $_SERVER['REMOTE_ADDR']. "\n" );
+		fclose( $fp );
+	}
+}
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] gfMakePassword
+ * [³µÍ×] ¥é¥ó¥À¥à¥Ñ¥¹¥ï¡¼¥ÉÀ¸À®¡Ê±Ñ¿ô»ú¡Ë
+ * [°ú¿ô] ¥Ñ¥¹¥ï¡¼¥É¤Î·å¿ô
+ * [ÌáÃÍ] ¥é¥ó¥À¥àÀ¸À®¤µ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É
+ * [°ÍÂ¸] ¤Ê¤·
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gfMakePassword($pwLength) {
+	
+	// Íð¿ôÉ½¤Î¥·¡¼¥É¤ò·èÄê
+	srand((double)microtime() * 54234853);
+	
+	// ¥Ñ¥¹¥ï¡¼¥ÉÊ¸»úÎó¤ÎÇÛÎó¤òºîÀ®
+	$character = "abcdefghkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ2345679";
+	$pw = preg_split("//", $character, 0, PREG_SPLIT_NO_EMPTY);
+	
+	$password = "";
+	for($i = 0; $i<$pwLength; $i++ ) {
+		$password .= $pw[array_rand($pw, 1)];
+	}
+
+	return $password;
+} 
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] sf_explodeExt
+ * [³µÍ×] ¥Õ¥¡¥¤¥ë¤Î³ÈÄ¥»Ò¼èÆÀ
+ * [°ú¿ô] ¥Õ¥¡¥¤¥ëÌ¾
+ * [ÌáÃÍ] ³ÈÄ¥»Ò
+ * [°ÍÂ¸] ¤Ê¤·
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------*/
+function gf_explodeExt($fileName) {
+	$ext1 = explode(".", $fileName);
+	$ext2 = $ext1[count($ext1) - 1];
+	$ext2 = strtolower($ext2);
+	return $ext2;
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------
+ * [Ì¾¾Î] gfMailHeaderAddr
+ * [³µÍ×] ÆþÎÏ¤µ¤ì¤¿¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¥á¡¼¥ë´Ø¿ôÍÑ¤Î°¸Àè¤ËÊÑ´¹
+ * [°ú¿ô] ¡Ö¥á¡¼¥ë¥¢¥É¥ì¥¹¡×¤Þ¤¿¤Ï¡ÖÌ¾Á°<¥á¡¼¥ë¥¢¥É¥ì¥¹>¡×¡¢Ê£¿ô¥¢¥É¥ì¥¹»ØÄê»þ¤Ï¥«¥ó¥Þ¶èÀÚ¤ê¤Ç»ØÄê¤¹¤ë¡£
+ * [ÌáÃÍ] ¡Ö¥á¡¼¥ë¥¢¥É¥ì¥¹¡×¤Þ¤¿¤Ï¡ÖJIS_MIME¤Ë¥³¡¼¥ÉÊÑ´¹¤·¤¿Ì¾Á° <¥á¡¼¥ë¥¢¥É¥ì¥¹>¡×¡¢Ê£¿ô¥¢¥É¥ì¥¹»ØÄê»þ¤Ï¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊÖµÑ¤¹¤ë¡£
+ * [°ÍÂ¸] ¤Ê¤·
+ * [Ãí¼á] -
+ *----------------------------------------------------------------------------------------------------------------------*/
+
+function gfMailHeaderAddr($str) {
+	$addrs = explode(",", $str); //¥¢¥É¥ì¥¹¤òÇÛÎó¤ËÆþ¤ì¤ë
+    foreach ($addrs as $addr) {
+        if (preg_match("/^(.+)<(.+)>$/", $addr, $matches)) {
+            //°ú¿ô¤¬¡ÖÌ¾Á°<¥á¡¼¥ë¥¢¥É¥ì¥¹>¡×¤Î¾ì¹ç
+            $mailaddrs[] = mb_encode_mimeheader(trim($matches[1]))." <".trim($matches[2]).">";
+        } else {
+            //¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î¤ß¤Î¾ì¹ç
+            $mailaddrs[] =  trim($addr);
+        }
+    }
+    return implode(", ", $mailaddrs); //Ê£¿ô¥¢¥É¥ì¥¹¤Ï¥«¥ó¥Þ¶èÀÚ¤ê¤Ë¤¹¤ë
+} 
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/lib/thumb.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/lib/thumb.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/lib/thumb.php	(revision 1328)
@@ -0,0 +1,161 @@
+<?php
+# MakeThumb(½ÐÎÏ¸µ²èÁü¥Ñ¥¹¡Ê¥Õ¥¡¥¤¥ëÌ¾¤Þ¤Ç¡Ë, ½ÐÎÏÀè¥Õ¥©¥ë¥À¡Ê/home/hoge/ ¤Ê¤É¡Ë , ºÇÂç²£Éý , ºÇÂç½ÄÉý , ¿·¥Õ¥¡¥¤¥ëÌ¾¡Ë
+function MakeThumb($FromImgPath , $ToImgPath , $tmpMW , $tmpMH, $newFileName = ''){
+
+# ¢¡¡þ¢¡¡¡¥Ç¥Õ¥©¥ë¥ÈÃÍ¤ÎÀßÄê¡¡¢¡¡þ¢¡
+# É¬Í×¤Ë±þ¤¸¤ÆÊÑ¹¹¤·¤Æ²¼¤µ¤¤¡£
+
+# ²èÁü¤ÎºÇÂç²£Éý¡ÊÃ±°Ì¡§¥Ô¥¯¥»¥ë¡Ë
+$ThmMaxWidth = 500;
+
+# ²èÁü¤ÎºÇÂç½ÄÉý¡ÊÃ±°Ì¡§¥Ô¥¯¥»¥ë¡Ë
+$ThmMaxHeight = 500;
+
+# ¥µ¥à¥Í¥¤¥ë²èÁü¤ÎÀÜÆ¬Ê¸»ú
+$PreWord = $head;
+
+# ¢¡¡þ¢¡¡¡ÀßÄê¤³¤³¤Þ¤Ç¡¡¢¡¡þ¢¡
+
+	//³ÈÄ¥»Ò¼èÆÀ
+	if (!$ext) {
+		$array_ext = explode(".", $FromImgPath);
+		$ext = $array_ext[count($array_ext) - 1];
+	}
+	
+	$MW = $ThmMaxWidth;
+	if($tmpMW) $MW = $tmpMW; # $MW¤ËºÇÂç²£Éý¥»¥Ã¥È	
+	
+	$MH = $ThmMaxHeight;
+	if($tmpMH) $MH = $tmpMH; # $MH¤ËºÇÂç½ÄÉý¥»¥Ã¥È
+	
+	if(empty($FromImgPath) || empty($ToImgPath)){ # ¥¨¥é¡¼½èÍý
+		return array(0,"½ÐÎÏ¸µ²èÁü¥Ñ¥¹¡¢¤Þ¤¿¤Ï½ÐÎÏÀè¥Õ¥©¥ë¥À¤¬»ØÄê¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+	}
+	
+	if(!file_exists($FromImgPath)){ # ¥¨¥é¡¼½èÍý
+		return array(0,"½ÐÎÏ¸µ²èÁü¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£");
+	}
+	
+	$size = @GetImageSize($FromImgPath);
+	$re_size = $size;
+	
+	if(!$size[2] || $size[2] > 3){ # ²èÁü¤Î¼ïÎà¤¬ÉÔÌÀ or swf
+		return array(0,"²èÁü·Á¼°¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+	}
+
+	//¥¢¥¹¥Ú¥¯¥ÈÈæ¸ÇÄê½èÍý
+	$tmp_w = $size[0] / $MW;
+	
+	if($MH != 0){
+		$tmp_h = $size[1] / $MH;
+	}
+	
+	if($tmp_w > 1 || $tmp_h > 1){
+		if($MH == 0){
+			if($tmp_w > 1){
+				$re_size[0] = $MW;
+				$re_size[1] = $size[1] * $MW / $size[0];
+			}
+		} else {
+			if($tmp_w > $tmp_h){
+				$re_size[0] = $MW;
+				$re_size[1] = $size[1] * $MW / $size[0];
+			} else {
+				$re_size[1] = $MH;
+				$re_size[0] = $size[0] * $MH / $size[1];
+			}
+		}
+	}	
+	
+	# ¥µ¥à¥Í¥¤¥ë²èÁü¥Õ¥¡¥¤¥ëÌ¾ºîÀ®½èÍý
+	$tmp = array_pop(explode("/",$FromImgPath)); # /¤Î°ìÈÖºÇ¸å¤òÀÚ¤ê½Ð¤·
+	$FromFileName = array_shift(explode(".",$tmp)); # .¤Ç¶èÀÚ¤é¤ì¤¿ÉôÊ¬¤òÀÚ¤ê½Ð¤·
+	$ToFile = $PreWord.$FromFileName; # ³ÈÄ¥»Ò°Ê³°¤ÎÉôÊ¬¤Þ¤Ç¤òºîÀ®
+	
+	$ImgNew = imagecreatetruecolor($re_size[0],$re_size[1]);
+	
+	switch($size[2]) {
+	 	case "1": //gif·Á¼°
+			if($tmp_w <= 1 && $tmp_h <= 1){
+				if ( $newFileName ) {
+					$ToFile = $newFileName;
+				} elseif  ($ext) {
+					$ToFile .= "." . $ext;
+				} else {
+					$ToFile .= ".gif";
+				}
+				if(!@copy($FromImgPath , $ToImgPath.$ToFile)) { # ¥¨¥é¡¼½èÍý
+					return array(0,"¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+				}
+				ImageDestroy($ImgNew);
+				return array(1,$ToFile);
+			}
+					
+			ImageColorAllocate($ImgNew,255,235,214); //ÇØ·Ê¿§
+			$black = ImageColorAllocate($ImgNew,0,0,0);
+			$red = ImageColorAllocate($ImgNew,255,0,0);
+			Imagestring($ImgNew,4,5,5,"GIF $size[0]x$size[1]", $red);
+			ImageRectangle ($ImgNew,0,0,($re_size[0]-1),($re_size[1]-1),	$black);
+			
+			if ( $newFileName ) {
+				$ToFile = $newFileName;
+			} elseif($ext) {
+				$ToFile .= "." . $ext;
+			} else {
+				$ToFile .= ".png";
+			}
+			$TmpPath = $ToImgPath.$ToFile;
+			@Imagepng($ImgNew,$TmpPath);
+			if(!@file_exists($TmpPath)){ # ²èÁü¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+				return array(0,"²èÁü¤Î½ÐÎÏ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+			}
+			ImageDestroy($ImgNew);
+			return array(1,$ToFile);
+			
+	 	case "2": //jpg·Á¼°
+			$ImgDefault = ImageCreateFromJpeg($FromImgPath);
+			//ImageCopyResized( $ImgNew,$ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
+			ImageCopyResampled( $ImgNew,$ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
+
+			if ( $newFileName ) {
+				$ToFile = $newFileName;
+			} elseif($ext) {
+				$ToFile .= "." . $ext;
+			} else {
+				$ToFile .= ".jpg";
+			}
+			$TmpPath = $ToImgPath.$ToFile;
+			@ImageJpeg($ImgNew,$TmpPath);
+			if(!@file_exists($TmpPath)){ # ²èÁü¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+				return array(0,"²èÁü¤Î½ÐÎÏ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>${ImgNew}<br>${TmpPath}");
+			}
+			$RetVal = $ToFile;
+	 		break;
+	 		
+	 	case "3": //png·Á¼°
+			$ImgDefault = ImageCreateFromPNG($FromImgPath);
+			//ImageCopyResized($ImgNew, $ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
+			ImageCopyResampled($ImgNew, $ImgDefault, 0, 0, 0, 0,$re_size[0], $re_size[1],$size[0], $size[1]);
+			
+			if ( $newFileName ) {
+				$ToFile = $newFileName;
+			} elseif ($ext) {
+				$ToFile .= "." . $ext;
+			} else {
+				$ToFile .= ".png";
+			}
+			$TmpPath = $ToImgPath.$ToFile;
+			@ImagePNG($ImgNew,$TmpPath );
+			if(!@file_exists($TmpPath)){ # ²èÁü¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+				return array(0,"²èÁü¤Î½ÐÎÏ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+			}
+			$RetVal = $ToFile;
+			break;
+	}
+	
+	ImageDestroy($ImgDefault);
+	ImageDestroy($ImgNew);
+	
+	return array(1,$RetVal);
+}
+?>
Index: /temp/tags/eccube-0_9_2beta/data/smarty_extends/function.html_checkboxes_ex.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/smarty_extends/function.html_checkboxes_ex.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/smarty_extends/function.html_checkboxes_ex.php	(revision 1328)
@@ -0,0 +1,169 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_checkboxes} function plugin
+ *
+ * File:       function.html_checkboxes.php<br>
+ * Type:       function<br>
+ * Name:       html_checkboxes<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of checkbox input types<br>
+ * Input:<br>
+ *           - name       (optional) - string default "checkbox"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each checkbox
+ *           - assign     (optional) - assign the output as an array to this variable
+ * Examples:
+ * <pre>
+ * {html_checkboxes values=$ids output=$names}
+ * {html_checkboxes values=$ids name='box' separator='<br>' output=$names}
+ * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_checkboxes_ex($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+
+    $name = 'checkbox';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+	$label_ids = true;
+    $output = null;
+
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+			case 'tags':
+				$$_key = split("\|", $_val);
+				break;
+            case 'name':
+            case 'separator':
+                $$_key = $_val;
+                break;
+
+            case 'labels':
+			case 'label_ids':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'checked':
+            case 'selected':
+                $selected = array_map('strval', array_values((array)$_val));
+                break;
+
+            case 'checkboxes':
+                $smarty->trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    settype($selected, 'array');
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_checkboxes_output_ex($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $tags);
+
+
+    } else {
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_checkboxes_output_ex($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $tags);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+}
+
+function smarty_function_html_checkboxes_output_ex($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $tags) {
+	$_output = '';
+		
+    $_output .= '<input type="checkbox" name="'
+        . smarty_function_escape_special_chars($name) . '[]" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+	
+	if ($labels && $label_ids) {
+		$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+		$_output .= ' id="' . $_id . '"';
+	}
+	
+    if (in_array((string)$value, $selected)) {
+        $_output .= ' checked="checked"';
+    }
+    $_output .= $extra . ' />';
+	
+	$_output .= $tags[0];
+	
+	if ($labels) {
+		if($label_ids) {
+			$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+			$_output .= '<label for="' . $_id . '">';
+		} else {
+			$_output .= '<label>';			
+		}
+	}
+	
+	// ÃÍ¤òÁÞÆþ
+	$_output .= $output;
+	
+	$_output .= $tags[1];
+	
+    if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/data/smarty_extends/function.html_radios_ex.php
===================================================================
--- /temp/tags/eccube-0_9_2beta/data/smarty_extends/function.html_radios_ex.php	(revision 1328)
+++ /temp/tags/eccube-0_9_2beta/data/smarty_extends/function.html_radios_ex.php	(revision 1328)
@@ -0,0 +1,171 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {html_radios} function plugin
+ *
+ * File:       function.html_radios.php<br>
+ * Type:       function<br>
+ * Name:       html_radios<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of radio input types<br>
+ * Input:<br>
+ *           - name       (optional) - string default "radio"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each radio button
+ *           - assign     (optional) - assign the output as an array to this variable
+ * Examples:
+ * <pre>
+ * {html_radios values=$ids output=$names}
+ * {html_radios values=$ids name='box' separator='<br>' output=$names}
+ * {html_radios values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_radios_ex($params, &$smarty)
+{
+    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
+   
+    $name = 'radio';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+    $label_ids = true;
+    $output = null;
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+			case 'tags':
+				$$_key = split("\|", $_val);
+				break;
+            case 'name':
+            case 'separator':
+                $$_key = (string)$_val;
+                break;
+
+            case 'checked':
+            case 'selected':
+                if(is_array($_val)) {
+                    $smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
+                } else {
+                    $selected = (string)$_val;
+                }
+                break;
+
+            case 'labels':
+            case 'label_ids':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'radios':
+                $smarty->trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+			
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    $smarty->trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_radios_output_ex($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $tags);
+
+    } else {
+
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_radios_output_ex($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $tags);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $smarty->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+
+}
+
+function smarty_function_html_radios_output_ex($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $tags) {
+   $_output = '';
+  
+   $_output .= '<input type="radio" name="'
+        . smarty_function_escape_special_chars($name) . '" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+  	
+   if ($labels && $label_ids) {
+	   $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+	   $_output .= ' id="' . $_id . '"';
+   }
+    if ((string)$value == $selected) {
+        $_output .= ' checked="checked"';
+    }
+	
+	$_output .= $extra . ' />';
+    
+	$_output .= $tags[0];
+		
+	if ($labels) {
+      if($label_ids) {
+		  $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+          $_output .= '<label for="' . $_id . '">';
+      } else {
+          $_output .= '<label>';           
+      }
+    }
+	
+	// ÃÍ¤òÁÞÆþ
+	$_output .= $output;
+	
+	$_output .= $tags[1];
+	
+	if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
Index: /temp/tags/eccube-0_9_2beta/.buildpath
===================================================================
--- /temp/tags/eccube-0_9_2beta/.buildpath	(revision 1327)
+++ /temp/tags/eccube-0_9_2beta/.buildpath	(revision 1327)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path=""/>
+	<classpathentry kind="con" path="org.trustudio.php.launching.PHP_CONTAINER"/>
+	<classpathentry kind="output" path=""/>
+</classpath>
