Index: /branches/mobile/.project
===================================================================
--- /branches/mobile/.project	(revision 10565)
+++ /branches/mobile/.project	(revision 10565)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>mobile</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: /branches/mobile/html/preview/index.php
===================================================================
--- /branches/mobile/html/preview/index.php	(revision 5934)
+++ /branches/mobile/html/preview/index.php	(revision 5934)
@@ -0,0 +1,28 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/mypage/history.php
===================================================================
--- /branches/mobile/html/mypage/history.php	(revision 6080)
+++ /branches/mobile/html/mypage/history.php	(revision 6080)
@@ -0,0 +1,88 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = USER_PATH . 'templates/mypage/history.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/¹ØÆþÍúÎò¾ÜºÙ";
+		$this->tpl_navi = USER_PATH . '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 = "del_flg = 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', 'deliv_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: /branches/mobile/html/mypage/refusal.php
===================================================================
--- /branches/mobile/html/mypage/refusal.php	(revision 6081)
+++ /branches/mobile/html/mypage/refusal.php	(revision 6081)
@@ -0,0 +1,63 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = USER_PATH . 'templates/mypage/refusal.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(ÆþÎÏ¥Ú¡¼¥¸)";
+		$this->tpl_navi = USER_PATH . '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 = USER_PATH . 'templates/mypage/refusal_confirm.tpl';
+	$objPage->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(³ÎÇ§¥Ú¡¼¥¸)";
+
+	break;
+	
+	case 'complete':
+	//²ñ°÷ºï½ü
+	$objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id')));
+
+	$where = "email ILIKE ?";
+	if (DB_TYPE == "mysql")	$where = sfChangeILIKE($where);
+	
+	$objQuery->delete("dtb_customer_mail", $where, array($objCustomer->getValue('email')));
+	$objCustomer->EndSession();
+	//´°Î»¥Ú¡¼¥¸¤Ø
+	header("Location: ./refusal_complete.php");
+	exit;
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /branches/mobile/html/mypage/delivery.php
===================================================================
--- /branches/mobile/html/mypage/delivery.php	(revision 6080)
+++ /branches/mobile/html/mypage/delivery.php	(revision 6080)
@@ -0,0 +1,80 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = USER_PATH . 'templates/mypage/delivery.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/¤ªÆÏ¤±ÀèÄÉ²Ã¥ÊÑ¹¹";
+		$this->tpl_navi = USER_PATH . '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: /branches/mobile/html/mypage/change.php
===================================================================
--- /branches/mobile/html/mypage/change.php	(revision 6081)
+++ /branches/mobile/html/mypage/change.php	(revision 6081)
@@ -0,0 +1,345 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+//¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¾¦ÉÊ¸¡º÷¤ò¼Â¹Ô¤¹¤ë¡£¡ÊEC¥­¥Ã¥ÈÆ°ºî»î¸³ÍÑ¤Î³«È¯¡Ë
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = USER_PATH . 'templates/mypage/change.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(ÆþÎÏ¥Ú¡¼¥¸)';
+		$this->tpl_navi = USER_PATH . '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","del_flg=0 AND email=?", array($objPage->arrForm['email']));
+			if ($email_cnt > 0){
+				$email_flag = false;
+			}
+		}
+		//¥¨¥é¡¼¤Ê¤·¤Ç¤«¤Ä¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬½ÅÊ£¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
+		if ($objPage->arrErr == "" && $email_flag == true){
+			//³ÎÇ§¥Ú¡¼¥¸¤Ø
+			$objPage->tpl_mainpage = USER_PATH . '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","del_flg=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'])){
+		$birth = split(" ", $arrForm["birth"]);
+		list($year, $month, $day) = split("-",$birth[0]);
+		
+		$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"] = sha1($array["password"] . ":" . AUTH_MAGIC);
+	$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: /branches/mobile/html/mypage/login_check.php
===================================================================
--- /branches/mobile/html/mypage/login_check.php	(revision 5934)
+++ /branches/mobile/html/mypage/login_check.php	(revision 5934)
@@ -0,0 +1,60 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg = 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: /branches/mobile/html/mypage/index.php
===================================================================
--- /branches/mobile/html/mypage/index.php	(revision 6080)
+++ /branches/mobile/html/mypage/index.php	(revision 6080)
@@ -0,0 +1,83 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+//¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¾¦ÉÊ¸¡º÷¤ò¼Â¹Ô¤¹¤ë¡£¡ÊEC¥­¥Ã¥ÈÆ°ºî»î¸³ÍÑ¤Î³«È¯¡Ë
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = USER_PATH . 'templates/mypage/index.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/¹ØÆþÍúÎò°ìÍ÷';
+		$this->tpl_navi = USER_PATH . '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 = "del_flg = 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: /branches/mobile/html/mypage/login.php
===================================================================
--- /branches/mobile/html/mypage/login.php	(revision 6080)
+++ /branches/mobile/html/mypage/login.php	(revision 6080)
@@ -0,0 +1,63 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = USER_PATH . '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: /branches/mobile/html/mypage/refusal_complete.php
===================================================================
--- /branches/mobile/html/mypage/refusal_complete.php	(revision 6080)
+++ /branches/mobile/html/mypage/refusal_complete.php	(revision 6080)
@@ -0,0 +1,35 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = USER_PATH . 'templates/mypage/refusal_complete.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(´°Î»¥Ú¡¼¥¸)";
+		$this->tpl_navi = USER_PATH . '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: /branches/mobile/html/mypage/change_complete.php
===================================================================
--- /branches/mobile/html/mypage/change_complete.php	(revision 6080)
+++ /branches/mobile/html/mypage/change_complete.php	(revision 6080)
@@ -0,0 +1,39 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = USER_PATH . 'templates/mypage/change_complete.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(´°Î»¥Ú¡¼¥¸)';
+		$this->tpl_navi = USER_PATH . '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: /branches/mobile/html/mypage/delivery_addr.php
===================================================================
--- /branches/mobile/html/mypage/delivery_addr.php	(revision 8425)
+++ /branches/mobile/html/mypage/delivery_addr.php	(revision 8425)
@@ -0,0 +1,165 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+session_start();
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = USER_PATH . 'templates/mypage/delivery_addr.tpl';
+		$this->tpl_title = "¿·¤·¤¤¤ªÆÏ¤±Àè¤ÎÄÉ²Ã¥ÊÑ¹¹";
+		global $arrPref;
+		$this->arrPref = $arrPref;
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView(false);
+$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: /branches/mobile/html/upgrade/index.php
===================================================================
--- /branches/mobile/html/upgrade/index.php	(revision 8450)
+++ /branches/mobile/html/upgrade/index.php	(revision 8450)
@@ -0,0 +1,62 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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 = DATA_PATH . "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: /branches/mobile/html/admin/system/rank.php
===================================================================
--- /branches/mobile/html/admin/system/rank.php	(revision 5934)
+++ /branches/mobile/html/admin/system/rank.php	(revision 5934)
@@ -0,0 +1,76 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/system/check.php
===================================================================
--- /branches/mobile/html/admin/system/check.php	(revision 5934)
+++ /branches/mobile/html/admin/system/check.php	(revision 5934)
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ *		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: /branches/mobile/html/admin/system/input.php
===================================================================
--- /branches/mobile/html/admin/system/input.php	(revision 10160)
+++ /branches/mobile/html/admin/system/input.php	(revision 10160)
@@ -0,0 +1,199 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg <> 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 del_flg <> 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'] = sha1($_POST['password'] . ":" . AUTH_MAGIC);
+	$sqlval['authority'] = $_POST['authority'];
+	$sqlval['rank']=  $oquery->max("dtb_member", "rank") + 1;
+	$sqlval['work'] = "1"; // ²ÔÆ¯¤ËÀßÄê
+	$sqlval['del_flg'] = "0";	// ºï½ü¥Õ¥é¥°¤òOFF¤ËÀßÄê
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['create_date'] = "now()";
+	$sqlval['update_date'] = "now()";
+	// 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'] = sha1($_POST['password'] . ":" . AUTH_MAGIC);
+	}
+	$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: /branches/mobile/html/admin/system/bkup.php
===================================================================
--- /branches/mobile/html/admin/system/bkup.php	(revision 10146)
+++ /branches/mobile/html/admin/system/bkup.php	(revision 10146)
@@ -0,0 +1,624 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+require_once(DATA_PATH. "module/Tar.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = 'system/bkup.tpl';
+		$this->tpl_subnavi = 'system/subnavi.tpl';
+		$this->tpl_mainno = 'system';		
+		$this->tpl_subno = 'bkup';
+		$this->tpl_subtitle = '¥Ð¥Ã¥¯¥¢¥Ã¥×´ÉÍý';
+		
+		$this->bkup_dir = USER_PATH . "bkup/";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+// ¥»¥Ã¥·¥ç¥ó¥¯¥é¥¹
+$objSess = new SC_Session();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Æ¡¼¥Ö¥ë¤¬¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë
+lfCreateBkupTable();
+
+switch($_POST['mode']) {
+// ¥Ð¥Ã¥¯¥¢¥Ã¥×¤òºîÀ®¤¹¤ë
+case 'bkup':
+	// ÆþÎÏÊ¸»úÎó¤ÎÊÑ´¹
+	$arrData = lfConvertParam($_POST);
+
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfCheckError($arrData);
+
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð¥Ð¥Ã¥¯¥¢¥Ã¥×½èÍý¤ò¹Ô¤¦	
+	if (count($arrErr) <= 0) {
+		// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Õ¥¡¥¤¥ëºîÀ®
+		$arrErr = lfCreateBkupData($arrData['bkup_name']);
+		
+		// DB¤Ë¥Ç¡¼¥¿¹¹¿·
+		if (count($arrErr) <= 0) {
+			lfUpdBkupData($arrData);
+		}else{
+			$arrForm = $arrData;
+		}
+		
+		$objPage->tpl_onload = "alert('¥Ð¥Ã¥¯¥¢¥Ã¥×´°Î»¤·¤Þ¤·¤¿');";
+	}else{
+		$arrForm = $arrData;
+	}
+
+	break;
+	
+// ¥ê¥¹¥È¥¢
+case 'restore':
+case 'restore_config':
+	if ($_POST['mode'] == 'restore_config') {
+		$objPage->mode = "restore_config";
+	}
+
+	lfRestore($_POST['list_name']);
+
+	break;
+	
+// ºï½ü
+case 'delete':
+	$del_file = $objPage->bkup_dir.$_POST['list_name'] . ".tar.gz";
+	// ¥Õ¥¡¥¤¥ë¤Îºï½ü
+	if(is_file($del_file)){
+		$ret = unlink($del_file);
+	}
+
+	// DB¤«¤éºï½ü
+	$delsql = "DELETE FROM dtb_bkup WHERE bkup_name = ?";
+	$objQuery->query($delsql, array($_POST['list_name']));
+
+	break;
+	
+// ¥À¥¦¥ó¥í¡¼¥É
+case 'download' :
+	$filename = $_POST['list_name'] . ".tar.gz";
+	$dl_file = $objPage->bkup_dir.$_POST['list_name'] . ".tar.gz";
+	
+	// ¥À¥¦¥ó¥í¡¼¥É³«»Ï
+	Header("Content-disposition: attachment; filename=${filename}");
+	Header("Content-type: application/octet-stream; name=${filename}");
+	header("Content-Length: " .filesize($dl_file)); 
+	readfile ($dl_file);
+	exit();
+	break;
+
+default:
+	break;
+}
+
+// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë
+$arrBkupList = lfGetBkupData("ORDER BY create_date DESC");
+// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ËÅÏ¤¹¥Ç¡¼¥¿¤ò¥»¥Ã¥È
+$objPage->arrErr = $arrErr;
+$objPage->arrForm = $arrForm;
+$objPage->arrBkupList = $arrBkupList;
+
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display(MAIN_FRAME);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+
+//-------------------------------------------------------------------------------------------------------
+/* ¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹ */
+function lfConvertParam($array) {
+	/*
+	 *	Ê¸»úÎó¤ÎÊÑ´¹
+	 *	K :  ¡ÖÈ¾³Ñ(ÊÝ¶¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
+	 *	C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
+	 *	V :  ÂùÅÀÉÕ¤­¤ÎÊ¸»ú¤ò°ìÊ¸»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍÑ¤·¤Þ¤¹	
+	 *	n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖÈ¾³Ñ(ÊÝ¶¸)¡×¤ËÊÑ´¹
+	 *  a :  Á´³Ñ±Ñ¿ô»ú¤òÈ¾³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
+	 */
+	$arrConvList['bkup_name'] = "a";
+	$arrConvList['bkup_memo'] = "KVa";
+	
+	// Ê¸»úÊÑ´¹
+	foreach ($arrConvList as $key => $val) {
+		// POST¤µ¤ì¤Æ¤­¤¿ÃÍ¤Î¤ßÊÑ´¹¤¹¤ë¡£
+		if(isset($array[$key])) {
+			$array[$key] = mb_convert_kana($array[$key] ,$val);
+		}
+	}
+	return $array;
+}
+
+// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfCheckError($array){
+	$objErr = new SC_CheckError($array);
+	
+	$objErr->doFunc(array("¥Ð¥Ã¥¯¥¢¥Ã¥×Ì¾", "bkup_name", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK","NO_SPTAB","ALNUM_CHECK"));
+	$objErr->doFunc(array("¥Ð¥Ã¥¯¥¢¥Ã¥×¥á¥â", "bkup_memo", MTEXT_LEN), array("MAX_LENGTH_CHECK"));
+	
+	// ½ÅÊ£¥Á¥§¥Ã¥¯
+	$ret = lfGetBkupData("WHERE bkup_name = ?", array($array['bkup_name']));
+	if (count($ret) > 0) {
+		$objErr->arrErr['bkup_name'] = "¥Ð¥Ã¥¯¥¢¥Ã¥×Ì¾¤¬½ÅÊ£¤·¤Æ¤¤¤Þ¤¹¡£ÊÌÌ¾¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£";
+	}
+
+	return $objErr->arrErr;
+}
+
+// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Õ¥¡¥¤¥ëºîÀ®
+function lfCreateBkupData($bkup_name){
+	global $objPage;
+	$objQuery = new SC_Query();
+	$csv_data = "";
+	$csv_autoinc = "";
+	$err = true;
+	
+	$bkup_dir = $objPage->bkup_dir;
+	if (!is_dir(dirname($bkup_dir))) $err = mkdir(dirname($bkup_dir));		
+	$bkup_dir = $bkup_dir . $bkup_name . "/";
+
+	// Á´¥Æ¡¼¥Ö¥ë¼èÆÀ
+	$arrTableList = lfGetTableList();
+	
+	// ³Æ¥Æ¡¼¥Ö¥ë¾ðÊó¤ò¼èÆÀ¤¹¤ë
+	foreach($arrTableList as $key => $val){
+		
+		if ($val != "dtb_bkup") {
+			
+			// ¼«Æ°ºÎÈÖ·¿¤Î¹½À®¤ò¼èÆÀ¤¹¤ë
+			$csv_autoinc .= lfGetAutoIncrement($val);
+			
+			// Á´¥Ç¡¼¥¿¤ò¼èÆÀ
+			if ($val == "dtb_pagelayout"){
+				$arrData = $objQuery->getAll("SELECT * FROM $val ORDER BY page_id");
+			}else{
+				$arrData = $objQuery->getAll("SELECT * FROM $val");
+			}
+			
+			// CSV¥Ç¡¼¥¿À¸À®
+			if (count($arrData) > 0) {
+				
+				// ¥«¥é¥à¤òCSV·Á¼°¤ËÀ°¤¨¤ë
+				$arrKyes = sfGetCommaList(array_keys($arrData[0]), false);
+				
+				// ¥Ç¡¼¥¿¤òCSV·Á¼°¤ËÀ°¤¨¤ë
+				$data = "";
+				foreach($arrData as $data_key => $data_val){
+					//$val = str_replace("\"", "\\\"", $val);
+					$data .= lfGetCSVList($arrData[$data_key]);
+
+				}
+				// CSV½ÐÎÏ¥Ç¡¼¥¿À¸À®
+				$csv_data .= $val . "\n";
+				$csv_data .= $arrKyes . "\n";
+				$csv_data .= $data;
+				$csv_data .= "\n";
+			}	
+			
+			// ¥¿¥¤¥à¥¢¥¦¥È¤òËÉ¤°
+			sfFlush();
+		}
+	}
+
+	$csv_file = $bkup_dir . "bkup_data.csv";
+	$csv_autoinc_file = $bkup_dir . "autoinc_data.csv";
+	mb_internal_encoding(CHAR_CODE);
+	// CSV½ÐÎÏ
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë		
+	if (!is_dir(dirname($csv_file))) {
+		$err = mkdir(dirname($csv_file));
+	}
+	if ($err) {
+		// data¤òCSV½ÐÎÏ
+		$fp = fopen($csv_file,"w");
+		if($fp) {
+			if($csv_data != ""){
+				$err = fwrite($fp, $csv_data);
+			}
+			fclose($fp);
+		}
+		
+		// ¼«Æ°ºÎÈÖ¤òCSV½ÐÎÏ
+		$fp = fopen($csv_autoinc_file,"w");
+		if($fp) {
+			if($csv_autoinc != ""){
+				$err = fwrite($fp, $csv_autoinc);
+			}
+			fclose($fp);
+		}
+	}
+
+	// ³Æ¼ï¥Õ¥¡¥¤¥ë¥³¥Ô¡¼
+	if ($err) {
+		// ¾¦ÉÊ²èÁü¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼
+		// ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë		
+		$image_dir = $bkup_dir . "save_image/";
+		if (!is_dir(dirname($image_dir))) $err = mkdir(dirname($image_dir));		
+		$copy_mess = "";
+		$copy_mess = sfCopyDir("../../upload/save_image/",$image_dir, $copy_mess);
+		
+		// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼
+		// ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë		
+		$templates_dir = $bkup_dir . "templates/";
+		if (!is_dir(dirname($templates_dir))) $err = mkdir(dirname($templates_dir));		
+		$copy_mess = "";
+		$copy_mess = sfCopyDir("../../user_data/templates/",$templates_dir, $copy_mess);
+		
+		// ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼
+		// ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë		
+		$inc_dir = $bkup_dir . "include/";
+		if (!is_dir(dirname($inc_dir))) $err = mkdir(dirname($inc_dir));		
+		$copy_mess = "";
+		$copy_mess = sfCopyDir("../../user_data/include/",$inc_dir, $copy_mess);
+	
+		// CSS¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼
+		// ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë		
+		$css_dir = $bkup_dir . "css/";
+		if (!is_dir(dirname($css_dir))) $err = mkdir(dirname($css_dir));		
+		$copy_mess = "";
+		$copy_mess = sfCopyDir("../../user_data/css/",$css_dir, $copy_mess);
+
+		//°µ½Ì¥Õ¥é¥°TRUE¤Ïgzip°µ½Ì¤ò¤ª¤³¤Ê¤¦
+		$tar = new Archive_Tar($objPage->bkup_dir . $bkup_name.".tar.gz", TRUE);
+
+		//bkup¥Õ¥©¥ë¥À¤Ë°ÜÆ°¤¹¤ë
+		chdir($objPage->bkup_dir);
+
+		//°µ½Ì¤ò¤ª¤³¤Ê¤¦
+		$zip = $tar->create("./" . $bkup_name . "/");
+
+		// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Ç¡¼¥¿¤Îºï½ü
+		if ($zip) sfDelFile($bkup_dir);
+	}
+
+	if (!$err) {
+		$arrErr['bkup_name'] = "¥Ð¥Ã¥¯¥¢¥Ã¥×¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+		// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Ç¡¼¥¿¤Îºï½ü
+		sfDelFile($bkup_dir);
+	}
+	
+	return $arrErr;
+}
+
+/* ÇÛÎó¤ÎÍ×ÁÇ¤òCSV¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎÏ¤¹¤ë¡£*/
+function lfGetCSVList($array) {
+	if (count($array) > 0) {
+		foreach($array as $key => $val) {
+			$val = mb_convert_encoding($val, CHAR_CODE, CHAR_CODE);
+			$val = str_replace("\"", "\\\"", $val);
+			$line .= "\"".$val."\",";
+		}
+		$line = ereg_replace(",$", "\n", $line);
+	}else{
+		return false;
+	}
+	return $line;
+}
+
+// Á´¥Æ¡¼¥Ö¥ë¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë
+function lfGetTableList(){
+	$objQuery = new SC_Query();
+	
+	if(DB_TYPE == "pgsql"){
+		$sql = "SELECT tablename FROM pg_tables WHERE tableowner = ? ORDER BY tablename ; ";
+		$arrRet = $objQuery->getAll($sql, array(DB_USER));
+		$arrRet = sfSwapArray($arrRet);
+		$arrRet = $arrRet['tablename'];
+	}else if(DB_TYPE == "mysql"){
+		$sql = "SHOW TABLES;";
+		$arrRet = $objQuery->getAll($sql);
+		$arrRet = sfSwapArray($arrRet);
+		
+		// ¥­¡¼¤ò¼èÆÀ
+		$arrKey = array_keys($arrRet);
+		
+		$arrRet = $arrRet[$arrKey[0]];
+	}
+	return $arrRet;
+}
+
+// ¼«Æ°ºÎÈÖ·¿¤òCSV½ÐÎÏ·Á¼°¤ËÊÑ´¹¤¹¤ë
+function lfGetAutoIncrement($table_name){
+	$arrColList = lfGetColumnList($table_name);
+	$ret = "";
+	
+	if(DB_TYPE == "pgsql"){
+		$match = 'nextval(\'';
+	}else if(DB_TYPE == "mysql"){
+		$match = "auto_incr";
+	}
+
+	foreach($arrColList['col_def'] as $key => $val){
+		
+		if (substr($val,0,9) == $match) {
+			$col = $arrColList['col_name'][$key];
+			$autoVal = lfGetAutoIncrementVal($table_name, $col);
+			$ret .= "$table_name,$col,$autoVal\n";
+		}
+	}
+	
+	return $ret;
+}
+
+// ¥Æ¡¼¥Ö¥ë¹½À®¤ò¼èÆÀ¤¹¤ë
+function lfGetColumnList($table_name){
+	$objQuery = new SC_Query();
+
+	if(DB_TYPE == "pgsql"){
+		$sql = "SELECT 
+					a.attname, t.typname, a.attnotnull, d.adsrc as defval, a.atttypmod,	a.attnum as fldnum,	e.description 
+				FROM 
+					pg_class c,
+					pg_type t,
+					pg_attribute a left join pg_attrdef d on (a.attrelid=d.adrelid and a.attnum=d.adnum)
+								   left join pg_description e on (a.attrelid=e.objoid and a.attnum=e.objsubid)
+				WHERE (c.relname=?) AND (c.oid=a.attrelid) AND (a.atttypid=t.oid) AND a.attnum > 0
+				ORDER BY fldnum";
+		$arrColList = $objQuery->getAll($sql, array($table_name));
+		$arrColList = sfSwapArray($arrColList);
+		
+		$arrRet['col_def'] = $arrColList['defval'];
+		$arrRet['col_name'] = $arrColList['attname'];
+	}else if(DB_TYPE == "mysql"){
+		$sql = "SHOW COLUMNS FROM $table_name";
+		$arrColList = $objQuery->getAll($sql);
+		$arrColList = sfSwapArray($arrColList);
+		
+		$arrRet['col_def'] = $arrColList['Extra'];
+		$arrRet['col_name'] = $arrColList['Field'];
+	}
+	return $arrRet;
+}
+
+// ¼«Æ°ºÎÈÖ·¿¤ÎÃÍ¤ò¼èÆÀ¤¹¤ë
+function lfGetAutoIncrementVal($table_name , $colname = ""){
+	$objQuery = new SC_Query();
+	$ret = "";
+
+	if(DB_TYPE == "pgsql"){
+		$ret = $objQuery->nextval($table_name, $colname) - 1;
+	}else if(DB_TYPE == "mysql"){
+		$sql = "SHOW TABLE STATUS LIKE ?";
+		$arrData = $objQuery->getAll($sql, array($table_name));
+		$ret = $arrData[0]['Auto_increment'];
+	}
+	return $ret;
+}
+
+// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Æ¡¼¥Ö¥ë¤Ë¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+function lfUpdBkupData($data){
+	$objQuery = new SC_Query();
+	
+	$sql = "INSERT INTO dtb_bkup (bkup_name,bkup_memo,create_date) values (?,?,now())";
+	$objQuery->query($sql, array($data['bkup_name'],$data['bkup_memo']));
+}
+
+// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Æ¡¼¥Ö¥ë¤«¤é¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+function lfGetBkupData($where = "", $data = array()){
+	$objQuery = new SC_Query();
+	
+	$sql = "SELECT bkup_name, bkup_memo, create_date FROM dtb_bkup ";
+	if ($where != "")	$sql .= $where;
+	
+	$ret = $objQuery->getall($sql,$data);
+	
+	return $ret;
+}
+
+// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Õ¥¡¥¤¥ë¤ò¥ê¥¹¥È¥¢¤¹¤ë
+function lfRestore($bkup_name){
+	global $objPage;
+	$objQuery = new SC_Query("", false);
+	$csv_data = "";
+	$err = true;
+	
+	$bkup_dir = $objPage->bkup_dir . $bkup_name . "/";
+	
+	//¥Ð¥Ã¥¯¥¢¥Ã¥×¥Õ¥©¥ë¥À¤Ë°ÜÆ°¤¹¤ë
+	chdir($objPage->bkup_dir);
+	
+	//°µ½Ì¥Õ¥é¥°TRUE¤Ïgzip²òÅà¤ò¤ª¤³¤Ê¤¦
+	$tar = new Archive_Tar($bkup_name . ".tar.gz", TRUE);
+	
+	//»ØÄê¤µ¤ì¤¿¥Õ¥©¥ë¥ÀÆâ¤Ë²òÅà¤¹¤ë
+	$err = $tar->extract("./");
+	
+	// Ìµ»ö²òÅà¤Ç¤­¤ì¤Ð¡¢¥ê¥¹¥È¥¢¤ò¹Ô¤¦
+	if ($err) {
+		
+		// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó³«»Ï
+		$objQuery->begin();
+		
+		// DB¤ò¥¯¥ê¥¢
+		$err = lfDeleteAll($objQuery);
+		
+		// INSERT¼Â¹Ô
+		if ($err) $err = lfExeInsertSQL($objQuery, $bkup_dir . "bkup_data.csv");
+
+		// ¼«Æ°ºÎÈÖ¤ÎÃÍ¤ò¥»¥Ã¥È
+		if ($err) lfSetAutoInc($objQuery, $bkup_dir . "autoinc_data.csv");
+
+		// ³Æ¼ï¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+		if ($err) {
+			// ²èÁü¤Î¥³¥Ô¡¼
+			$image_dir = $bkup_dir . "save_image/";
+			$copy_mess = "";
+			$copy_mess = sfCopyDir($image_dir, "../../upload/save_image/", $copy_mess, true);		
+	
+			// ¥Æ¥ó¥×¥ì¡¼¥È¤Î¥³¥Ô¡¼
+			$tmp_dir = $bkup_dir . "templates/";
+			$copy_mess = "";
+			$copy_mess = sfCopyDir($tmp_dir, "../../user_data/templates/", $copy_mess, true);		
+			
+			// ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+			$inc_dir = $bkup_dir . "include/";
+			$copy_mess = "";
+			$copy_mess = sfCopyDir($inc_dir, "../../user_data/include/", $copy_mess, true);		
+			
+			// CSS¤Î¥³¥Ô¡¼
+			$css_dir = $bkup_dir . "css/";
+			$copy_mess = "";
+			$copy_mess = sfCopyDir($css_dir, "../../user_data/css/", $copy_mess, true);		
+
+			// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Ç¡¼¥¿¤Îºï½ü
+			sfDelFile($bkup_dir);
+		}
+
+		// ¥ê¥¹¥È¥¢À®¸ù¤Ê¤é¥³¥ß¥Ã¥È¼ºÇÔ¤Ê¤é¥í¡¼¥ë¥Ð¥Ã¥¯
+		if ($err) {
+			$objQuery->commit();
+			$objPage->restore_msg = "¥ê¥¹¥È¥¢½ªÎ»¤·¤Þ¤·¤¿¡£";
+			$objPage->restore_err = true;
+		}else{
+			$objQuery->rollback();
+			$objPage->restore_msg = "¥ê¥¹¥È¥¢¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+			$objPage->restore_name = $bkup_name;
+			$objPage->restore_err = false;
+		}
+	}
+}
+
+// CSV¥Õ¥¡¥¤¥ë¤«¤é¥¤¥ó¥µ¡¼¥È¼Â¹Ô
+function lfExeInsertSQL($objQuery, $csv){
+	global $objPage;
+
+	$sql = "";
+	$base_sql = "";
+	$tbl_flg = false;
+	$col_flg = false;
+	$ret = true;
+	$pagelayout_flg = false;
+	$mode = $objPage->mode;
+	
+	// csv¥Õ¥¡¥¤¥ë¤«¤é¥Ç¡¼¥¿¤Î¼èÆÀ
+	$fp = fopen($csv, "r");
+	while (!feof($fp)) {
+		$data = fgetcsv($fp, 1000000);
+				
+		//¶õÇò¹Ô¤Î¤È¤­¤Ï¥Æ¡¼¥Ö¥ëÊÑ¹¹
+		if (count($data) <= 1 and $data[0] == "") {
+			$base_sql = "";
+			$tbl_flg = false;
+			$col_flg = false;
+			continue;
+		}
+		
+		// ¥Æ¡¼¥Ö¥ë¥Õ¥é¥°¤¬¤¿¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¥Æ¡¼¥Ö¥ëÌ¾¥»¥Ã¥È
+		if (!$tbl_flg) {
+			$base_sql = "INSERT INTO $data[0] ";
+			$tbl_flg = true;
+			
+			if($data[0] == "dtb_pagelayout"){
+				$pagelayout_flg = true;
+			}
+			
+			continue;
+		}
+		
+		// ¥«¥é¥à¥Õ¥é¥°¤¬¤¿¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¥«¥é¥à¥»¥Ã¥È
+		if (!$col_flg) {
+			if ($mode != "restore_config"){
+				$base_sql .= " ( $data[0] ";
+				for($i = 1; $i < count($data); $i++){
+					$base_sql .= "," . $data[$i];
+				}
+				$base_sql .= " ) ";
+			}
+			$col_flg = true;
+			continue;
+		}
+
+		// ¥¤¥ó¥µ¡¼¥È¤¹¤ëÃÍ¤ò¥»¥Ã¥È
+		$sql = $base_sql . "VALUES ( ? ";
+		for($i = 1; $i < count($data); $i++){
+			$sql .= ", ?";
+		}
+		$sql .= " );";
+		$data = str_replace("\\\"", "\"", $data);
+		$err = $objQuery->query($sql, $data);
+
+		// ¥¨¥é¡¼¤¬¤¢¤ì¤Ð½ªÎ»
+		if ($err->message != ""){
+			sfErrorHeader(">> " . $objQuery->getlastquery(false));
+			return false;
+		}
+		
+		if ($pagelayout_flg) {
+			// dtb_pagelayout¤Î¾ì¹ç¤Ë¤ÏºÇ½é¤Î¥Ç¡¼¥¿¤Ïpage_id = 0¤Ë¤¹¤ë
+			$sql = "UPDATE dtb_pagelayout SET page_id = '0'";
+			$objQuery->query($sql);
+			$pagelayout_flg = false;
+		}
+
+		// ¥¿¥¤¥à¥¢¥¦¥È¤òËÉ¤°
+		sfFlush();
+	}
+	fclose($fp);
+	
+	return $ret;
+}
+
+// ¼«Æ°ºÎÈÖ¤ò¥»¥Ã¥È
+function lfSetAutoInc($objQuery, $csv){
+	// csv¥Õ¥¡¥¤¥ë¤«¤é¥Ç¡¼¥¿¤Î¼èÆÀ
+	$arrCsvData = file($csv);
+
+	foreach($arrCsvData as $key => $val){
+		$arrData = split(",", trim($val));
+		
+		if ($arrData[2] == 0)	$arrData[2] = 1;
+		$objQuery->setval($arrData[0], $arrData[1], $arrData[2]);
+	}
+}
+
+// DB¤òÁ´¤Æ¥¯¥ê¥¢¤¹¤ë
+function lfDeleteAll($objQuery){
+	$ret = true;
+
+	$arrTableList = lfGetTableList();
+	
+	foreach($arrTableList as $key => $val){
+		// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Æ¡¼¥Ö¥ë¤Ïºï½ü¤·¤Ê¤¤
+		if ($val != "dtb_bkup") {
+			$trun_sql = "DELETE FROM $val;";
+			$ret = $objQuery->query($trun_sql);
+			
+			if (!$ret) return $ret;
+		}
+	}
+	
+	return $ret;
+}
+
+// ¥Ð¥Ã¥¯¥¢¥Ã¥×¥Æ¡¼¥Ö¥ë¤òºîÀ®¤¹¤ë
+function lfCreateBkupTable(){
+	$objQuery = new SC_Query();
+	
+	// ¥Æ¡¼¥Ö¥ë¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+	$arrTableList = lfGetTableList();
+
+	if(!in_array("dtb_bkup", $arrTableList)){
+		// Â¸ºß¤·¤Æ¤¤¤Ê¤±¤ì¤ÐºîÀ®
+		$cre_sql = "
+			create table dtb_bkup
+			(
+				bkup_name	text,
+				bkup_memo	text,
+				create_date	timestamp
+			);
+		";
+		
+		$objQuery->query($cre_sql);
+	}
+}
+
+?>
Index: /branches/mobile/html/admin/system/delete.php
===================================================================
--- /branches/mobile/html/admin/system/delete.php	(revision 5934)
+++ /branches/mobile/html/admin/system/delete.php	(revision 5934)
@@ -0,0 +1,52 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg <> 1";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $conn->query($sqlup);
+	return $ret;
+}
+
+// ¥ì¥³¡¼¥É¤Îºï½ü(ºï½ü¥Õ¥é¥°¤òON¤Ë¤¹¤ë)
+function fnDeleteRecord($conn, $id) {
+	// ¥é¥ó¥¯¤òºÇ²¼°Ì¤Ë¤¹¤ë¡¢DEL¥Õ¥é¥°ON
+	$sqlup = "UPDATE dtb_member SET rank = 0, del_flg = 1 WHERE member_id = $id";
+	// UPDATE¤Î¼Â¹Ô
+	$ret = $conn->query($sqlup);
+	return $ret;
+}
+?>
Index: /branches/mobile/html/admin/system/member_csv.php
===================================================================
--- /branches/mobile/html/admin/system/member_csv.php	(revision 5934)
+++ /branches/mobile/html/admin/system/member_csv.php	(revision 5934)
@@ -0,0 +1,46 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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("del_flg <> 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: /branches/mobile/html/admin/system/update.php
===================================================================
--- /branches/mobile/html/admin/system/update.php	(revision 9292)
+++ /branches/mobile/html/admin/system/update.php	(revision 9292)
@@ -0,0 +1,282 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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($file) {
+	global $objPage;
+	
+	$src_path = sfRmDupSlash(UPDATE_HTTP . $file . ".txt");
+	$dst_path = sfRmDupSlash(UPDATE_PATH . $file);
+	$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(ereg("^#", $arrCSV[0])) {
+				continue;
+			}
+						
+			// ¥«¥é¥à¿ô¤¬Àµ¾ï¤Ç¤¢¤Ã¤¿¾ì¹ç¤Î¤ß
+			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['install_sql'] = $arrCSV[7];
+				$sqlval['uninstall_sql'] = $arrCSV[8];				
+				$sqlval['other_files'] = $arrCSV[9];
+				$sqlval['del_flg'] = $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 {
+					// ¿·µ¬¥ì¥³¡¼¥É¤ÎÄÉ²Ã
+					$sqlval['create_date'] = "now()";
+					$objQuery->insert("dtb_update", $sqlval);
+				}
+			}
+		}
+		fclose($fp);
+	}
+}
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½èÍý
+function lfInstallModule() {
+	global $objPage;
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("module_id, extern_php, other_files, install_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]['install_sql'] != "") {
+		// SQLÊ¸¼Â¹Ô¡¢¥Ñ¥é¡¼¥á¡¼¥¿¤Ê¤·¡¢¥¨¥é¡¼Ìµ»ë
+		$arrInstallSql = split(";",$arrRet[0]['install_sql']);
+		foreach($arrInstallSql as $key => $val){
+			if (trim($val) != ""){
+				$ret = $objQuery->query(trim($val),"",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, install_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 = DATA_PATH . $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: /branches/mobile/html/admin/system/load_module.php
===================================================================
--- /branches/mobile/html/admin/system/load_module.php	(revision 7560)
+++ /branches/mobile/html/admin/system/load_module.php	(revision 7560)
@@ -0,0 +1,32 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+require_once(DATA_PATH . "module/Request.php");
+
+// Ç§¾Ú³ÎÇ§
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+if($_GET['module_id'] != ""){
+	$module_id = $_GET['module_id'];
+}elseif($_POST['module_id'] != ""){
+	$module_id = $_POST['module_id'];
+}
+
+if(is_numeric($module_id)) {
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("main_php", "dtb_module", "module_id = ?", array($module_id));
+	$path = MODULE_PATH . $arrRet[0]['main_php'];
+	if(file_exists($path)) {
+		require_once($path);
+		exit;
+	} else {
+		print("¥â¥¸¥å¡¼¥ë¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£:".$path);
+	}
+}
+
+?>
Index: /branches/mobile/html/admin/system/module.php
===================================================================
--- /branches/mobile/html/admin/system/module.php	(revision 8634)
+++ /branches/mobile/html/admin/system/module.php	(revision 8634)
@@ -0,0 +1,321 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+require_once(DATA_PATH . "module/Request.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = 'system/module.tpl';
+		$this->tpl_subnavi = 'system/subnavi.tpl';
+		$this->tpl_mainno = 'system';		
+		$this->tpl_subno = 'module';
+		$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;
+}
+
+$objQuery->setorder("module_id");
+$arrUpdate = $objQuery->select("*", "dtb_module");
+
+$objPage->arrUpdate = $arrUpdate;
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display(MAIN_FRAME);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+//-------------------------------------------------------------------------------------------------------
+// ¹¹¿·¥Õ¥¡¥¤¥ë¤Î¼èÆÀ
+function lfCopyUpdateFile($file) {
+	global $objPage;
+	
+	$src_path = sfRmDupSlash(UPDATE_HTTP . $file . ".txt");
+	$dst_path = sfRmDupSlash(MODULE_PATH . $file);
+	$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 . "module.txt";
+	$fp = @fopen($path, "rb");
+	
+	$arrInsID = array();
+		
+	if(!$fp) {
+		sfErrorHeader(">> " . $path . "¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
+	} else {
+		
+		while (!feof($fp)) {
+			$arrCSV = fgetcsv($fp, UPDATE_CSV_LINE_MAX);
+			
+			// ¥¨¥¹¥±¡¼¥×½èÍý¤ÎÃÖ´¹
+			foreach($arrCSV as $key => $val){
+				$arrCSV[$key] = str_replace('\"', '"', $val);
+			}
+			
+			if(ereg("^#", $arrCSV[0])) {
+				continue;
+			}
+			
+			// ¥«¥é¥à¿ô¤¬Àµ¾ï¤Ç¤¢¤Ã¤¿¾ì¹ç¤Î¤ß
+			if(count($arrCSV) == MODULE_CSV_COL_MAX) {
+					// insert¤¹¤ëmodule_id¤òÇÛÎó¤Ë³ÊÇ¼
+					$arrInsID[] = $arrCSV[0];
+				
+					// ¼èÆÀ¤·¤¿¥¢¥Ã¥×¥Ç¡¼¥È¾ðÊó¤ò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['install_sql'] = $arrCSV[7];
+					$sqlval['uninstall_sql'] = $arrCSV[8];				
+					$sqlval['other_files'] = $arrCSV[9];
+					$sqlval['del_flg'] = $arrCSV[10];
+					$sqlval['update_date'] = "now()";
+					$sqlval['release_date'] = $arrCSV[12];
+					$sqlval['module_x'] = $arrCSV[14];
+					$sqlval['module_y'] = $arrCSV[15];
+					// ¥â¥¸¥å¡¼¥ë¤¬ÂÐ±þ¤·¤Æ¤¤¤ëËÜÂÎ¤Î¥Ð¡¼¥¸¥ç¥ó
+					$sqlval['eccube_version'] = $arrCSV[13];					
+					// ´ûÂ¸¥ì¥³¡¼¥É¤Î¥Á¥§¥Ã¥¯
+					$cnt = $objQuery->count("dtb_module", "module_id = ?", array($sqlval['module_id']));
+					if($cnt > 0) {
+						// ¤¹¤Ç¤Ë¼èÆÀ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¹¹¿·¤¹¤ë¡£	
+						$objQuery->update("dtb_module", $sqlval, "module_id = ?", array($sqlval['module_id']));
+					} else {
+						// ¿·µ¬¥ì¥³¡¼¥É¤ÎÄÉ²Ã
+						$sqlval['create_date'] = "now()";
+						$objQuery->insert("dtb_module", $sqlval);
+					}
+			} else {
+				sfErrorHeader(">> ¥«¥é¥à¿ô¤¬°ìÃ×¤·¤Þ¤»¤ó¡£¡§".count($arrCSV));
+			}
+		}
+		
+		// ÉÔÍ×¤Ê¥Ç¡¼¥¿¤òºï½ü
+		if(count($arrInsID) > 0){
+			$del_sql = "DELETE FROM dtb_module WHERE module_id NOT IN (?";
+			
+			for($i = 1; $i < count($arrInsID); $i++){
+				$del_sql .= ",?";
+			}
+			$del_sql .= ")";
+			
+			$objQuery->query($del_sql, $arrInsID);
+		}
+
+		fclose($fp);
+	}
+}
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½èÍý
+function lfInstallModule() {
+	global $objPage;
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("module_id, extern_php, other_files, install_sql, latest_version", "dtb_module", "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]['install_sql'] != "") {
+		// SQLÊ¸¼Â¹Ô¡¢¥Ñ¥é¡¼¥á¡¼¥¿¤Ê¤·¡¢¥¨¥é¡¼Ìµ»ë
+		$arrInstallSql = split(";",$arrRet[0]['install_sql']);
+		foreach($arrInstallSql as $key => $val){
+			if (trim($val) != ""){
+				$ret = $objQuery->query(trim($val),"",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) {		
+		$path = MODULE_PATH . $arrRet[0]['extern_php'];
+		$sqlval['now_version'] = sfGetFileVersion($path);
+		$sqlval['update_date'] = "now()";
+		$objQuery->update("dtb_module", $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, install_sql, uninstall_sql, latest_version", "dtb_module", "module_id = ?", array($_POST['module_id']));
+	$flg_ok = true;	// ½èÍý¤ÎÀ®¸ùÈ½Äê
+	
+	if(count($arrRet) > 0) {
+		
+		// ¥â¥¸¥å¡¼¥ëÂ¦¤Ëºï½ü¾ðÊó¤òÁ÷¿®¤¹¤ë
+		$req = new HTTP_Request(SITE_URL . "load_module.php");
+		$req->addCookie("PHPSESSID", $_COOKIE["PHPSESSID"]);
+		$req->setMethod(HTTP_REQUEST_METHOD_POST);
+		$req->addPostData("module_id", $arrRet[0]['module_id']);
+		$req->addPostData("mode", "module_del");
+		$req->sendRequest();
+		$req->clearPostData();
+
+		$arrFiles = array();
+		if($arrRet[0]['other_files'] != "") {
+			$arrFiles = split("\|", $arrRet[0]['other_files']);
+		}
+		$arrFiles[] = $arrRet[0]['extern_php'];
+
+		foreach($arrFiles as $val) {
+			$path = MODULE_PATH . $val;
+			// ¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë
+			if(file_exists($path) && 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_module", $sqlval, "module_id = ?", array($arrRet[0]['module_id']));
+	}
+}
+
+?>
Index: /branches/mobile/html/admin/system/index.php
===================================================================
--- /branches/mobile/html/admin/system/index.php	(revision 5934)
+++ /branches/mobile/html/admin/system/index.php	(revision 5934)
@@ -0,0 +1,68 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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("del_flg <> 1 AND member_id <> ". ADMIN_ID);
+
+//´Ê°×¥¯¥¨¥ê¼Â¹Ô¥ª¥Ö¥¸¥§¥¯¥È
+$oquery = new SC_Query();
+// ¹Ô¿ô¤Î¼èÆÀ
+$linemax = $oquery->count("dtb_member", "del_flg <> 1 AND member_id <>".ADMIN_ID);
+
+// ²ÔÆ°Ãæ¤Î·ï¿ô¤ò¼èÆÀ
+$workmax = $oquery->count("dtb_member", "work = 1 AND del_flg <> 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: /branches/mobile/html/admin/contents/inquiry.php
===================================================================
--- /branches/mobile/html/admin/contents/inquiry.php	(revision 5934)
+++ /branches/mobile/html/admin/contents/inquiry.php	(revision 5934)
@@ -0,0 +1,263 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 *, cast(substring(create_date, 1, 10) as date) as disp_date FROM dtb_question WHERE del_flg = 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']) ){
+			$objQuery = new SC_Query();
+			
+			//ÅÐÏ¿
+			$value = serialize($_POST);
+			if (DB_TYPE == "pgsql") {
+				$question_id = $objQuery->nextval('dtb_question', 'question_id');
+			}
+			
+			$sql_val = array( $value, $_POST['title'] ,$question_id );
+			$conn->query("INSERT INTO dtb_question ( question, question_name, question_id, create_date) VALUES (?, ?, ?, now())", $sql_val );
+			$objPage->MESSAGE = "ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿";
+
+			if (DB_TYPE == "mysql") {
+				$question_id = $objQuery->nextval('dtb_question', 'question_id');
+			}
+			
+			$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 del_flg = 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 del_flg = 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", "3000" ), array( "EXIST_CHECK", "MAX_LENGTH_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: /branches/mobile/html/admin/contents/page_edit.php
===================================================================
--- /branches/mobile/html/admin/contents/page_edit.php	(revision 5934)
+++ /branches/mobile/html/admin/contents/page_edit.php	(revision 5934)
@@ -0,0 +1,118 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/contents/index.php
===================================================================
--- /branches/mobile/html/admin/contents/index.php	(revision 5934)
+++ /branches/mobile/html/admin/contents/index.php	(revision 5934)
@@ -0,0 +1,281 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 *, cast(substring(news_date,1, 10) as date) as cast_news_date FROM dtb_news WHERE news_id = ? ";
+	$result = $conn->getAll($sql, array($_POST["news_id"]));
+	foreach($result[0] as $key => $val ){
+		$objPage->$key = $val;
+	}
+	$arrData = split("-",$result[0]["cast_news_date"]);
+	
+	$objPage->selected_year = $arrData[0];
+	$objPage->selected_month =$arrData[1];
+	$objPage->selected_day =  $arrData[2];
+
+	$objPage->edit_mode = "on";
+}
+
+//----¡¡¥Ç¡¼¥¿ºï½ü
+if ( $_POST['mode'] == 'delete' && is_numeric($_POST["news_id"])) {
+	
+	// rank¤ò¼èÆÀ
+	$pre_rank = $conn->getone(" SELECT rank FROM dtb_news WHERE del_flg = 0 AND news_id = ? ", array( $_POST['news_id']  ));
+
+	//-- ºï½ü¤¹¤ë¿·Ãå¾ðÊó°Ê¹ß¤Îrank¤ò1¤Ä·«¤ê¾å¤²¤Æ¤ª¤¯
+	$conn->query("BEGIN");
+	$sql = "UPDATE dtb_news SET rank = rank - 1, update_date = NOW() WHERE del_flg = 0 AND rank > ?";
+	$conn->query( $sql, array( $pre_rank  ) );
+
+	$sql = "UPDATE dtb_news SET rank = 0, del_flg = 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 *, cast(substring(news_date,1, 10) as date) as cast_news_date FROM dtb_news WHERE del_flg = '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 del_flg = '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 del_flg = 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 del_flg = 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 del_flg = 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;
+	}
+	
+	//rank¤ÎºÇÂç+1¤ò¼èÆÀ¤¹¤ë
+	$rank_max = $conn->getone("SELECT MAX(rank) + 1 FROM dtb_news WHERE del_flg = '0'");
+
+	$sql = "INSERT INTO dtb_news (news_date, news_title, creator_id, news_url, link_method, news_comment, rank, create_date, update_date)
+			VALUES ( ?,?,?,?,?,?,?,now(),now())";
+	$arrRegist = array($registDate, $_POST["news_title"], $_SESSION['member_id'],  $_POST["news_url"], $_POST["link_method"], $_POST["news_comment"], $rank_max);
+
+	$conn->query($sql, $arrRegist);
+	
+	// ºÇ½é¤Î1·ïÌÜ¤ÎÅÐÏ¿¤Ïrank¤ËNULL¤¬Æþ¤ë¤Î¤ÇÂÐºö
+	$sql = "UPDATE dtb_news SET rank = 1 WHERE del_flg = 0 AND rank IS NULL";
+	$conn->query($sql);
+}
+
+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: /branches/mobile/html/admin/contents/file_manager.php
===================================================================
--- /branches/mobile/html/admin/contents/file_manager.php	(revision 10071)
+++ /branches/mobile/html/admin/contents/file_manager.php	(revision 10071)
@@ -0,0 +1,207 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+//---- Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = 'contents/file_manager.tpl';
+		$this->tpl_mainno = 'contents';
+		$this->tpl_subnavi = 'contents/subnavi.tpl';
+		$this->tpl_subno = "file";
+		$this->tpl_subtitle = '¥Õ¥¡¥¤¥ë´ÉÍý';		
+	}
+}
+
+// ¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê
+$top_dir = USER_PATH;
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+// ¸½ºß¤Î³¬ÁØ¤ò¼èÆÀ
+if($_POST['mode'] != "") {
+	$now_dir = $_POST['now_file'];
+} else {
+	// ½é´üÉ½¼¨¤Ï¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê(user_data/upload/)¤òÉ½¼¨
+	$now_dir = $top_dir;
+}
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile($now_dir, $now_dir);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+
+switch($_POST['mode']) {
+
+// ¥Õ¥¡¥¤¥ëÉ½¼¨
+case 'view':
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfErrorCheck();
+	if(!is_array($arrErr)) {
+	
+		// ÁªÂò¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ê¤é°ÜÆ°
+		if(is_dir($_POST['select_file'])) {
+			///$now_dir = $_POST['select_file'];
+			// ¥Ä¥ê¡¼Á«°ÜÍÑ¤Îjavascript¤òËä¤á¹þ¤à
+			$arrErr['select_file'] = "¢¨ ¥Ç¥£¥ì¥¯¥È¥ê¤òÉ½¼¨¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£<br/>";
+			
+		} else {
+			// javascript¤ÇÊÌÁëÉ½¼¨(¥Æ¥ó¥×¥ì¡¼¥ÈÂ¦¤ËÅÏ¤¹)
+			$file_url = ereg_replace(USER_PATH, "", $_POST['select_file']);
+			$tpl_onload = "win02('./file_view.php?file=". $file_url ."', 'user_data', '600', '400');";
+		}
+	}
+	break;
+// ¥Õ¥¡¥¤¥ë¥À¥¦¥ó¥í¡¼¥É
+case 'download':
+
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfErrorCheck();
+	if(!is_array($arrErr)) {
+		if(is_dir($_POST['select_file'])) {
+			// ¥Ç¥£¥ì¥¯¥È¥ê¤Î¾ì¹ç¤Ïjavascript¥¨¥é¡¼
+			$arrErr['select_file'] = "¢¨ ¥Ç¥£¥ì¥¯¥È¥ê¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£<br/>";
+		} else {
+			// ¥Õ¥¡¥¤¥ë¥À¥¦¥ó¥í¡¼¥É
+			sfDownloadFile($_POST['select_file']);
+			exit;			
+		}
+	}
+	break;
+// ¥Õ¥¡¥¤¥ëºï½ü
+case 'delete':
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfErrorCheck();
+	if(!is_array($arrErr)) {
+		sfDeleteDir($_POST['select_file']);
+	}
+	break;
+// ¥Õ¥¡¥¤¥ëºîÀ®
+case 'create':
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfCreateErrorCheck();
+	if(!is_array($arrErr)) {
+		$create_dir = ereg_replace("/$", "", $now_dir);
+		// ¥Õ¥¡¥¤¥ëºîÀ®
+		if(!sfCreateFile($create_dir."/".$_POST['create_file'], 0755)) {
+			// ºîÀ®¥¨¥é¡¼
+			$arrErr['create_file'] = "¢¨ ".$_POST['create_file']."¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br/>";
+		} else {
+			$tpl_onload .= "alert('¥Õ¥©¥ë¥À¤òºîÀ®¤·¤Þ¤·¤¿¡£');";
+		}
+	}
+	break;
+// ¥Õ¥¡¥¤¥ë¥¢¥Ã¥×¥í¡¼¥É
+case 'upload':
+	// ²èÁüÊÝÂ¸½èÍý
+	$ret = $objUpFile->makeTempFile('upload_file', false);
+	if($ret != "") {
+		$arrErr['upload_file'] = $ret;
+	} else {
+		$tpl_onload .= "alert('¥Õ¥¡¥¤¥ë¤ò¥¢¥Ã¥×¥í¡¼¥É¤·¤Þ¤·¤¿¡£');";
+	}
+	break;
+// ¥Õ¥©¥ë¥À°ÜÆ°
+case 'move':
+	$now_dir = $_POST['tree_select_file'];
+	break;
+// ½é´üÉ½¼¨
+default :
+	break;
+}
+// ¥È¥Ã¥×¥Ç¥£¥ì¥¯¥È¥ê¤«Ä´ºº
+$is_top_dir = false;
+// ËöÈø¤Î/¤ò¤È¤ë
+$top_dir_check = ereg_replace("/$", "", $top_dir);
+$now_dir_check = ereg_replace("/$", "", $now_dir);
+if($top_dir_check == $now_dir_check) $is_top_dir = true;
+
+// ¸½ºß¤Î³¬ÁØ¤è¤ê°ì¤Ä¾å¤Î³¬ÁØ¤ò¼èÆÀ
+$parent_dir = lfGetParentDir($now_dir);
+
+// ¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥êÇÛ²¼¤Î¥Õ¥¡¥¤¥ë°ìÍ÷¤ò¼èÆÀ
+$objPage->arrFileList = sfGetFileList($now_dir);
+$objPage->tpl_is_top_dir = $is_top_dir;
+$objPage->tpl_parent_dir = $parent_dir;
+$objPage->tpl_now_dir = $now_dir;
+$objPage->tpl_now_file = basename($now_dir);
+$objPage->arrErr = $arrErr;
+$objPage->arrParam = $_POST;
+
+// ¥Ä¥ê¡¼¤òÉ½¼¨¤¹¤ë div¥¿¥°id, ¥Ä¥ê¡¼ÇÛÎóÊÑ¿ôÌ¾, ¸½ºß¥Ç¥£¥ì¥¯¥È¥ê, ÁªÂò¥Ä¥ê¡¼hiddenÌ¾, ¥Ä¥ê¡¼¾õÂÖhiddenÌ¾, mode hiddenÌ¾
+$objPage->tpl_onload .= "fnTreeView('tree', arrTree, '$now_dir', 'tree_select_file', 'tree_status', 'move');$tpl_onload";
+// ¥Ä¥ê¡¼ÇÛÎóºîÀ®ÍÑ javascript
+$arrTree = sfGetFileTree($top_dir, $_POST['tree_status']);
+$objPage->tpl_javascript .= "arrTree = new Array();\n";
+foreach($arrTree as $arrVal) {
+	$objPage->tpl_javascript .= "arrTree[".$arrVal['count']."] = new Array(".$arrVal['count'].", '".$arrVal['type']."', '".$arrVal['path']."', ".$arrVal['rank'].",";
+	if ($arrVal['open']) {
+		$objPage->tpl_javascript .= "true);\n";
+	} else {
+		$objPage->tpl_javascript .= "false);\n";
+	}
+}
+
+// ²èÌÌ¤ÎÉ½¼¨
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfErrorCheck()
+ * ÀâÌÀ¡¡¡§¥¨¥é¡¼¥Á¥§¥Ã¥¯
+ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError($_POST);
+	$objErr->doFunc(array("¥Õ¥¡¥¤¥ë", "select_file"), array("SELECT_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfCreateErrorCheck()
+ * ÀâÌÀ¡¡¡§¥Õ¥¡¥¤¥ëºîÀ®½èÍý¥¨¥é¡¼¥Á¥§¥Ã¥¯
+ */
+function lfCreateErrorCheck() {
+	$objErr = new SC_CheckError($_POST);
+	$objErr->doFunc(array("ºîÀ®¥Õ¥¡¥¤¥ëÌ¾", "create_file"), array("EXIST_CHECK", "FILE_NAME_CHECK_BY_NOUPLOAD"));
+	
+	return $objErr->arrErr;
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfInitFile()
+ * ÀâÌÀ¡¡¡§¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("¥Õ¥¡¥¤¥ë", 'upload_file', array(), FILE_SIZE, true, 0, 0, false);
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfGetParentDir()
+ * °ú¿ô1 ¡§¥Ç¥£¥ì¥¯¥È¥ê
+ * ÀâÌÀ¡¡¡§¿Æ¥Ç¥£¥ì¥¯¥È¥ê¼èÆÀ
+ */
+function lfGetParentDir($dir) {
+	$dir = ereg_replace("/$", "", $dir);
+	$arrDir = split('/', $dir);
+	array_pop($arrDir);
+	foreach($arrDir as $val) {
+		$parent_dir .= "$val/";
+	}
+	$parent_dir = ereg_replace("/$", "", $parent_dir);
+	
+	return $parent_dir;
+}
+?>
Index: /branches/mobile/html/admin/contents/file_view.php
===================================================================
--- /branches/mobile/html/admin/contents/file_view.php	(revision 9924)
+++ /branches/mobile/html/admin/contents/file_view.php	(revision 9924)
@@ -0,0 +1,32 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+// ¥½¡¼¥¹¤È¤·¤ÆÉ½¼¨¤¹¤ë¥Õ¥¡¥¤¥ë¤òÄêµÁ(Ä¾ÀÜ¼Â¹Ô¤·¤Ê¤¤¥Õ¥¡¥¤¥ë)
+$arrViewFile = array(
+					 'html',
+					 'htm',
+					 'tpl',
+					 'php',
+					 'css',
+					 'js',
+);
+
+// ³ÈÄ¥»Ò¼èÆÀ
+$arrResult = split('\.', $_GET['file']);
+$ext = $arrResult[count($arrResult)-1];
+
+// ¥Õ¥¡¥¤¥ëÆâÍÆÉ½¼¨
+if(in_array($ext, $arrViewFile)) {
+	// ¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¹þ¤ó¤ÇÉ½¼¨
+	header("Content-type: text/plain\n\n");
+	print(sfReadFile(USER_PATH.$_GET['file']));
+} else {
+	header("Location: ".USER_URL.$_GET['file']);
+}
+?>
Index: /branches/mobile/html/admin/contents/recommend.php
===================================================================
--- /branches/mobile/html/admin/contents/recommend.php	(revision 8410)
+++ /branches/mobile/html/admin/contents/recommend.php	(revision 8410)
@@ -0,0 +1,143 @@
+<?
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+ 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()";
+		$objPage->arrForm['create_date'] = "NOW()";
+		
+		$objQuery = new SC_Query();
+		$objQuery->insert("dtb_best_products", $objPage->arrForm );
+//		$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.del_flg = 0 ORDER BY rank";
+$arrItems = $conn->getAll($sql);
+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 del_flg = 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() {
+	$objQuery = new SC_Query;
+	$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: /branches/mobile/html/admin/contents/csv_sql.php
===================================================================
--- /branches/mobile/html/admin/contents/csv_sql.php	(revision 9918)
+++ /branches/mobile/html/admin/contents/csv_sql.php	(revision 9918)
@@ -0,0 +1,393 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../../require.php");
+require_once(DATA_PATH . "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['csv_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]['csv_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['table_name'][0];
+}else{
+	$selectTable = $_POST['selectTable'];
+}
+
+// ¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+$arrColList = lfGetColumnList($selectTable);
+$arrColList =  sfSwapArray($arrColList);
+
+// É½¼¨¤µ¤»¤ëÆâÍÆ¤òÊÔ½¸
+foreach ($arrTableList['description'] as $key => $val) {
+	$arrTableList['description'][$key] = $arrTableList['table_name'][$key] . "¡§" . $arrTableList['description'][$key];
+}
+foreach ($arrColList['description'] as $key => $val) {
+	$arrColList['description'][$key] = $arrColList['column_name'][$key] . "¡§" . $arrColList['description'][$key];
+}
+
+
+$arrDiff = array_diff(sfGetColumnList($selectTable), $arrColList["column_name"]); 
+$arrColList["column_name"] = array_merge($arrColList["column_name"], $arrDiff);
+$arrColList["description"] = array_merge($arrColList["description"], $arrDiff);
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¤Ë½ÐÎÏ¤¹¤ë¥Ç¡¼¥¿¤ò¥»¥Ã¥È
+$objPage->arrSqlList = $arrSqlList;																// SQL°ìÍ÷
+$objPage->arrTableList = sfarrCombine($arrTableList['table_name'], $arrTableList['description']);	// ¥Æ¡¼¥Ö¥ë°ìÍ÷
+$objPage->arrColList = sfarrCombine($arrColList['column_name'],$arrColList['description']);			// ¥«¥é¥à°ìÍ÷
+$objPage->selectTable = $selectTable;															// ÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Æ¡¼¥Ö¥ë
+$objPage->sql_id = $sql_id;																		// ÁªÂò¤µ¤ì¤Æ¤¤¤ëSQL
+
+// POST¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¥»¥Ã¥È¤¹¤ë
+if (count($_POST) > 0) {
+	$arrSqlData[0]['sql_name'] = $_POST['sql_name'];
+	$arrSqlData[0]['csv_sql'] = $_POST['csv_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 table_name, description FROM dtb_table_comment WHERE column_name IS NULL ORDER BY table_name";
+	$arrRet = $objQuery->getAll($sql);
+	
+	
+	return $arrRet;
+}
+
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfGetColunmList
+ * ½èÍýÆâÍÆ	¡§¥Æ¡¼¥Ö¥ë¤Î¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô		¡§$selectTable¡§¥Æ¡¼¥Ö¥ëÌ¾¾Î
+ * Ìá¤êÃÍ ¡¡¡§¼èÆÀ·ë²Ì
+ **************************************************************************************************************/
+function lfGetColumnList($selectTable){
+	$objQuery = new SC_Query();
+	$arrRet = array();		// ·ë²Ì¼èÆÀÍÑ
+	$sql = "";
+	$sql .= " SELECT column_name, description FROM dtb_table_comment WHERE table_name = ? AND column_name IS NOT NULL";
+	$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 .= "     sql_name,";
+	$sql .= "     csv_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("Ì¾¾Î", "sql_name"), array("EXIST_CHECK") );
+	$objErr->doFunc( array("SQLÊ¸", "csv_sql", "30000"), array("EXIST_CHECK", "MAX_LENGTH_CHECK") );
+	
+	// SQL¤ÎÂÅÅöÀ­¥Á¥§¥Ã¥¯
+	if ($objErr->arrErr['csv_sql'] == "") {
+		$objsqlErr = lfCheckSQL($data);
+		if ($objsqlErr != "") {
+			$objErr->arrErr["csv_sql"] = "SQLÊ¸¤¬ÉÔÀµ¤Ç¤¹¡£SQLÊ¸¤ò¸«Ä¾¤·¤Æ¤¯¤À¤µ¤¤";
+		}
+	}
+	
+	return $objErr->arrErr;
+
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfCheckSQL
+ * ½èÍýÆâÍÆ	¡§ÆþÎÏ¤µ¤ì¤¿SQLÊ¸¤¬Àµ¤·¤¤¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+ * °ú¿ô		¡§POST¥Ç¡¼¥¿
+ * ÌáÃÍ		¡§¥¨¥é¡¼ÆâÍÆ
+ **************************************************************************************************************/
+function lfCheckSQL($data){
+	$err = "";
+	$objDbConn = new SC_DbConn();
+	$sql = "SELECT " . $data['csv_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 sql_name = ?, csv_sql = ?, update_date = now() WHERE sql_id = ? ";
+			$arrVal= array($arrData['sql_name'], $arrData['csv_sql'], $sql_id);
+		}else{
+			// ¥Ç¡¼¥¿¤Î¿·µ¬ºîÀ®
+			$sql_id = "";
+			$sql = "INSERT INTO dtb_csv_sql (sql_name, csv_sql, create_date, update_date) values (?, ?, now(), now()) ";
+			$arrVal= array($arrData['sql_name'], $arrData['csv_sql']);
+			
+		}
+	}else{
+		// ¥Ç¡¼¥¿¤Î¿·µ¬ºîÀ®
+		$sql = "INSERT INTO dtb_csv_sql (sql_name, csv_sql, create_date, update_date) values (?, ?, now(), now()) ";
+		$arrVal= array($arrData['sql_name'], $arrData['csv_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: /branches/mobile/html/admin/contents/csv.php
===================================================================
--- /branches/mobile/html/admin/contents/csv.php	(revision 6085)
+++ /branches/mobile/html/admin/contents/csv.php	(revision 6085)
@@ -0,0 +1,127 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../../require.php");
+require_once(DATA_PATH . "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, update_date = now() 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: /branches/mobile/html/admin/contents/recommend_search.php
===================================================================
--- /branches/mobile/html/admin/contents/recommend_search.php	(revision 10316)
+++ /branches/mobile/html/admin/contents/recommend_search.php	(revision 10316)
@@ -0,0 +1,148 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = "del_flg = 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, product_id DESC";
+	
+	// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+	$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+	$from = "vw_products_nonclass AS noncls ";
+		
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count("dtb_products", $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, "fnNaviSearchOnlyPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	if(DB_TYPE != "mysql") $objQuery->setlimitoffset($page_max, $startno);
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+
+	// view¤â¹Ê¹þ¤ß¤ò¤«¤±¤ë(mysqlÍÑ)
+	sfViewWhere("&&noncls_where&&", $where, $arrval, $objQuery->order . " " .  $objQuery->setlimitoffset($page_max, $startno, true));
+
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$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: /branches/mobile/html/admin/index.php
===================================================================
--- /branches/mobile/html/admin/index.php	(revision 5934)
+++ /branches/mobile/html/admin/index.php	(revision 5934)
@@ -0,0 +1,19 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/develop/csv.php
===================================================================
--- /branches/mobile/html/admin/develop/csv.php	(revision 7180)
+++ /branches/mobile/html/admin/develop/csv.php	(revision 7180)
@@ -0,0 +1,229 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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, CHAR_CODE, 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;
+		}
+	}
+	
+	if (DB_TYPE == "pgsql") {
+		$product_id = $objQuery->nextval("dtb_products", "product_id");
+		$sqlval['product_id'] = $product_id;
+	}
+	$sqlval['status'] = 1;	// É½¼¨¤ËÀßÄê¤¹¤ë¡£
+	$sqlval['update_date'] = "Now()";
+	$sqlval['create_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	
+	if($_SESSION['member_id'] == "") {
+		$sqlval['creator_id'] = '0';
+	}
+		
+	$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "del_flg = 0 AND category_id = ?", array($sqlval['category_id'])) + 1;
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrRet, $product_id);
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->fast_insert("dtb_products", $sqlval);
+	if (DB_TYPE == "mysql") {
+		$product_id = $objQuery->nextval("dtb_products", "product_id");
+	}
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+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: /branches/mobile/html/admin/develop/upload_csv.php
===================================================================
--- /branches/mobile/html/admin/develop/upload_csv.php	(revision 7180)
+++ /branches/mobile/html/admin/develop/upload_csv.php	(revision 7180)
@@ -0,0 +1,260 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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, CHAR_CODE, 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;
+		}
+	}
+
+	if (DB_TYPE == "pgsql") {
+		$product_id = $objQuery->nextval("dtb_products", "product_id");
+		$sqlval['product_id'] = $product_id;
+	}
+
+	$sqlval['status'] = 1;	// É½¼¨¤ËÀßÄê¤¹¤ë¡£
+	$sqlval['update_date'] = "Now()";
+	$sqlval['create_date'] = "Now()";
+	$sqlval['creator_id'] = $_SESSION['member_id'];
+	$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "del_flg = 0 AND category_id = ?", array($sqlval['category_id'])) + 1;
+	
+	// µ¬³ÊÅÐÏ¿
+	sfInsertProductClass($objQuery, $arrRet, $product_id);
+	
+	gfPrintLog("insert productclass end");
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_products", $sqlval);
+	
+	if (DB_TYPE == "mysql") {
+		$product_id = $objQuery->nextval("dtb_products", "product_id");	
+	}
+	
+	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: /branches/mobile/html/admin/login.php
===================================================================
--- /branches/mobile/html/admin/login.php	(revision 8702)
+++ /branches/mobile/html/admin/login.php	(revision 8702)
@@ -0,0 +1,83 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg <> 1 AND work = 1";
+	$arrcol = array ($_POST['login_id']);
+	// DB¤«¤é°Å¹æ²½¥Ñ¥¹¥ï¡¼¥É¤ò¼èÆÀ¤¹¤ë¡£
+	$data_list = $conn->getAll($sql ,$arrcol); 
+	// ¥Ñ¥¹¥ï¡¼¥É¤Î¼èÆÀ
+	$password = $data_list[0]['password'];
+	// ¥æ¡¼¥¶ÆþÎÏ¥Ñ¥¹¥ï¡¼¥É¤ÎÈ½Äê
+	$ret = sha1($_POST['password'] . ":" . AUTH_MAGIC);
+	
+	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: /branches/mobile/html/admin/logout.php
===================================================================
--- /branches/mobile/html/admin/logout.php	(revision 6147)
+++ /branches/mobile/html/admin/logout.php	(revision 6147)
@@ -0,0 +1,13 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("./require.php");
+
+$objSess = new SC_Session();
+$objSess->logout();
+
+header("Location: " . URL_DIR . "admin/index.php");
+?>
Index: /branches/mobile/html/admin/basis/payment_input.php
===================================================================
--- /branches/mobile/html/admin/basis/payment_input.php	(revision 8476)
+++ /branches/mobile/html/admin/basis/payment_input.php	(revision 8476)
@@ -0,0 +1,189 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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);
+			$objPage->charge_flg = $arrRet["charge_flg"];
+			// 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;
+		$sqlval['create_date'] = 'Now()';
+		$objQuery->insert("dtb_payment", $sqlval);
+	// ´ûÂ¸ÊÔ½¸
+	} else {
+		$where = "payment_id = ?";
+		$objQuery->update("dtb_payment", $sqlval, $where, array($payment_id));
+	}
+}
+
+/*¡¡ÍøÍÑ¾ò·ï¤Î¿ôÃÍ¥Á¥§¥Ã¥¯ */
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+function lfCheckError() {
+	global $objFormParam;
+	
+	// DB¤Î¥Ç¡¼¥¿¤ò¼èÆÀ
+	$arrPaymentData = lfGetData($_POST['payment_id']);
+	
+	// ¼ê¿ôÎÁ¤òÀßÄê¤Ç¤­¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¼ê¿ôÎÁ¤ò0¤Ë¤¹¤ë
+	if($arrPaymentData["charge_flg"] == 2) $objFormParam->setValue("charge", "0");
+	
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	// ÍøÍÑ¾ò·ï(²¼¸Â)¥Á¥§¥Ã¥¯
+	if($arrRet["rule"] < $arrPaymentData["rule_min"] and $arrPaymentData["rule_min"] != ""){
+		$objErr->arrErr["rule"] = "ÍøÍÑ¾ò·ï(²¼¸Â)¤Ï" . $arrPaymentData["rule_min"] ."±ß°Ê¾å¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£<br>";
+	}
+	
+	// ÍøÍÑ¾ò·ï(¾å¸Â)¥Á¥§¥Ã¥¯
+	if($arrRet["upper_rule"] > $arrPaymentData["upper_rule_max"] and $arrPaymentData["upper_rule_max"] != ""){
+		$objErr->arrErr["upper_rule"] = "ÍøÍÑ¾ò·ï(¾å¸Â)¤Ï" . $arrPaymentData["upper_rule_max"] ."±ß°Ê²¼¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£<br>";
+	}
+	
+	// ÍøÍÑ¾ò·ï¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("ÍøÍÑ¾ò·ï(¡Á±ß°Ê¾å)", "ÍøÍÑ¾ò·ï(¡Á±ß°Ê²¼)", "rule", "upper_rule"), array("GREATER_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+
+?>
Index: /branches/mobile/html/admin/basis/kiyaku.php
===================================================================
--- /branches/mobile/html/admin/basis/kiyaku.php	(revision 5934)
+++ /branches/mobile/html/admin/basis/kiyaku.php	(revision 5934)
@@ -0,0 +1,152 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = "del_flg <> 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()";
+	$sqlval['create_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", "del_flg = 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: /branches/mobile/html/admin/basis/payment.php
===================================================================
--- /branches/mobile/html/admin/basis/payment.php	(revision 8376)
+++ /branches/mobile/html/admin/basis/payment.php	(revision 8376)
@@ -0,0 +1,66 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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->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, fix, charge_flg";
+	$where = "del_flg = 0";
+//	$where .= " AND fix = ?";
+	$table = "dtb_payment";
+	$objQuery->setorder("rank DESC");
+	$arrRet = $objQuery->select($col, $table, $where);
+	return $arrRet;
+}
+
+?>
Index: /branches/mobile/html/admin/basis/delivery_input.php
===================================================================
--- /branches/mobile/html/admin/basis/delivery_input.php	(revision 5934)
+++ /branches/mobile/html/admin/basis/delivery_input.php	(revision 5934)
@@ -0,0 +1,189 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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", "deliv_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¤Î¼èÆÀ
+
+		if (DB_TYPE == "pgsql") {
+			$deliv_id = $objQuery->nextval('dtb_deliv', 'deliv_id');
+			$sqlval['deliv_id'] = $deliv_id;
+		}
+		
+		$sqlval['rank'] = $objQuery->max("dtb_deliv", "rank") + 1;
+		$sqlval['create_date'] = 'Now()';
+		// INSERT¤Î¼Â¹Ô
+		$objQuery->insert("dtb_deliv", $sqlval);
+		
+		if (DB_TYPE == "mysql") {
+			$deliv_id = $objQuery->nextval('dtb_deliv', 'deliv_id');			
+		}
+	}
+	
+	$sqlval = array();
+	// ÇÛÁ÷»þ´Ö¤ÎÀßÄê
+	for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
+		$keyname = "deliv_time$cnt";
+		if($arrRet[$keyname] != "") {
+			$sqlval['deliv_id'] = $deliv_id;
+			$sqlval['deliv_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 = "deliv_time";
+	$where = "deliv_id = ?  ORDER BY time_id";
+	$table = "dtb_delivtime";
+	$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
+	$objFormParam->setParamList($arrRet, 'deliv_time');
+	// ÇÛÁ÷ÎÁ¶â¤Î¼èÆÀ
+	$col = "fee";
+	$where = "deliv_id = ? ORDER BY pref";
+	$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: /branches/mobile/html/admin/basis/mail.php
===================================================================
--- /branches/mobile/html/admin/basis/mail.php	(revision 5934)
+++ /branches/mobile/html/admin/basis/mail.php	(revision 5934)
@@ -0,0 +1,109 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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'];
+	
+	$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->query("UPDATE dtb_mailtemplate SET template_id = ?, subject = ?,header = ?, footer = ?,creator_id = ?, update_date = now() WHERE ".$sql_where, $data);
+	}else{
+		$conn->query("INSERT INTO dtb_mailtemplate (template_id,subject,header,footer,creator_id,update_date,create_date) values ( ?,?,?,?,?,now(),now() )", $data);
+	}
+
+}
+
+
+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: /branches/mobile/html/admin/basis/delivery.php
===================================================================
--- /branches/mobile/html/admin/basis/delivery.php	(revision 5934)
+++ /branches/mobile/html/admin/basis/delivery.php	(revision 5934)
@@ -0,0 +1,65 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = "del_flg = 0";
+$table = "dtb_deliv";
+$objQuery->setorder("rank DESC");
+$objPage->arrDelivList = $objQuery->select($col, $table, $where);
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------------------
Index: /branches/mobile/html/admin/basis/tradelaw.php
===================================================================
--- /branches/mobile/html/admin/basis/tradelaw.php	(revision 5934)
+++ /branches/mobile/html/admin/basis/tradelaw.php	(revision 5934)
@@ -0,0 +1,143 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/basis/seo.php
===================================================================
--- /branches/mobile/html/admin/basis/seo.php	(revision 6085)
+++ /branches/mobile/html/admin/basis/seo.php	(revision 6085)
@@ -0,0 +1,172 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../../require.php");
+require_once(DATA_PATH . "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: /branches/mobile/html/admin/basis/index.php
===================================================================
--- /branches/mobile/html/admin/basis/index.php	(revision 9894)
+++ /branches/mobile/html/admin/basis/index.php	(revision 9894)
@@ -0,0 +1,213 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/basis/zip_install.php
===================================================================
--- /branches/mobile/html/admin/basis/zip_install.php	(revision 6353)
+++ /branches/mobile/html/admin/basis/zip_install.php	(revision 6353)
@@ -0,0 +1,104 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+ini_set("max_execution_time", 600);
+
+define("ZIP_CSV_LINE_MAX", 8192);
+define("IMAGE_MAX", 680);	// ²èÁü¤ÎÉ½¼¨¸Ä¿ô
+
+$path = HTML_PATH . "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='".URL_DIR."img/install/main_w.jpg'><br>");
+	MyFlush();
+	
+	// CSV¤Î·ï¿ô¤ò¿ô¤¨¤ë
+	$line = 0;
+	while(!feof($fp)) {
+		fgets($fp, ZIP_CSV_LINE_MAX);
+		$line++;
+	}
+	
+	print("<img src='".URL_DIR."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='".URL_DIR."img/install/graph_1_w.gif'>");
+			MyFlush();
+			$img_cnt++;
+		}
+	}
+	fclose($fp);
+	
+	print("<img src='".URL_DIR."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='".URL_DIR."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: /branches/mobile/html/admin/basis/point.php
===================================================================
--- /branches/mobile/html/admin/basis/point.php	(revision 5934)
+++ /branches/mobile/html/admin/basis/point.php	(revision 5934)
@@ -0,0 +1,103 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/customer/edit.php
===================================================================
--- /branches/mobile/html/admin/customer/edit.php	(revision 6380)
+++ /branches/mobile/html/admin/customer/edit.php	(revision 6380)
@@ -0,0 +1,348 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = DATA_PATH . '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.*, B.mail_flag FROM dtb_customer AS A LEFT OUTER JOIN dtb_customer_mail AS B USING(email)
+			 WHERE A.del_flg = 0 AND A.customer_id = ?";
+	$result = $objConn->getAll($sql, array($_POST["edit_customer_id"]));
+	$objPage->list_data = $result[0];
+	
+	$birth = split(" ", $objPage->list_data["birth"]);
+	$birth = split("-",$birth[0]);
+	
+	$objPage->list_data["year"] = $birth[0];
+	$objPage->list_data["month"] = $birth[1];
+	$objPage->list_data["day"] = $birth[2];
+	
+	$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;
+	global $objQuery;
+	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"] = sha1($array["password"] . ":" . AUTH_MAGIC);
+	} else {
+		unset($arrRegist['password']);
+	}
+
+	$arrRegist["update_date"] = "Now()";
+	$arrRegistMail["update_date"] = "Now()";
+	$arrRegistMail["mail_flag"] = $array["mail_flag"];
+	$arrRegistMail['email'] = $array['email'];
+	//-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+	$objQuery->Insert("dtb_customer", $arrRegist, "customer_id = '" .addslashes($array["customer_id"]). "'");
+	
+	//-- ¥á¥ë¥Þ¥¬ÅÐÏ¿
+	$mailmaga = $objQuery->getAll("SELECT * FROM dtb_customer_mail WHERE email = ?", $array["edit_email"]);
+	
+	if(count($mailmaga) > 0 ){
+		$objQuery->Update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($array["edit_email"]). "'");
+	}else{
+		$arrRegistMail["create_date"] = "Now()";
+		//$arrRegist["create_date"] = date( "Y/m/d H:i:s", time());
+		$objQuery->Insert("dtb_customer_mail", $arrRegistMail);
+	}
+	$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 del_flg = 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: /branches/mobile/html/admin/customer/index.php
===================================================================
--- /branches/mobile/html/admin/customer/index.php	(revision 6085)
+++ /branches/mobile/html/admin/customer/index.php	(revision 6085)
@@ -0,0 +1,432 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+require_once(DATA_PATH . "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 = DATA_PATH . '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" => "cast(birth as date) AS birth", "csv" => "birth", "header" => "ÃÂÀ¸Æü"),
+						20 => array("sql" => "cast(first_buy_date as date) AS first_buy_date", "csv" => "first_buy_date", "header" => "½é²ó¹ØÆþÆü"),
+						21 => array("sql" => "cast(last_buy_date as date) 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" => "cast(create_date as date) AS create_date", "csv" => "create_date", "header" => "ÅÐÏ¿Æü"),
+						26 => array("sql" => "cast(update_date as date) 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 del_flg = 0";
+	$result_customer = $objConn->getAll($sql, array($_POST["edit_customer_id"]));
+
+	if ($result_customer[0]["status"] == 2) {			//ËÜ²ñ°÷ºï½ü
+		$arrDel = array("del_flg" => 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 = "del_flg = 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;
+		}
+		
+		if ($objPage->arrForm['search_pageno'] == 0){
+			$objPage->arrForm['search_pageno'] = 1;
+		}
+		
+		$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 AS noncls WHERE $where)";
+			$sqlval['del_flg'] = 1;
+			$objQuery->update("dtb_products", $sqlval, $where, $arrval);
+
+			$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
+			$result_customer = $objConn->getAll($sql, array($_POST["del_customer_id"]));
+
+			if ($result_customer[0]["status"] == 2) {			//ËÜ²ñ°÷ºï½ü
+				$arrDel = array("del_flg" => 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: /branches/mobile/html/admin/require.php
===================================================================
--- /branches/mobile/html/admin/require.php	(revision 9552)
+++ /branches/mobile/html/admin/require.php	(revision 9552)
@@ -0,0 +1,32 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir . "/../../data/conf/conf.php");
+require_once($include_dir . "/../../data/include/module.inc");
+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");
+require_once($include_dir . "/../../data/include/file_manager.inc");
+// ¥¢¥Ã¥×¥Ç¡¼¥È¤Ç¼èÆÀ¤·¤¿PHP¤òÆÉ¤ß½Ð¤¹
+sfLoadUpdateModule();
+
+?>
Index: /branches/mobile/html/admin/products/category.php
===================================================================
--- /branches/mobile/html/admin/products/category.php	(revision 6344)
+++ /branches/mobile/html/admin/products/category.php	(revision 6344)
@@ -0,0 +1,311 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg = 0";
+	$count = $objQuery->count("dtb_category", $where, array($_POST['category_id']));
+	if($count != 0) {
+		$objPage->arrErr['category_name'] = "¢¨ »Ò¥«¥Æ¥´¥ê¤¬Â¸ºß¤¹¤ë¤¿¤áºï½ü¤Ç¤­¤Þ¤»¤ó¡£<br>";
+	}
+	// ÅÐÏ¿¾¦ÉÊ¤Î¥Á¥§¥Ã¥¯
+	$where = "category_id = ? AND del_flg = 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['create_date'] = "Now()";
+	$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();
+	
+	if($parent_category_id == "") {
+		$parent_category_id = '0';
+	}
+	
+	$col = "category_id, category_name, level, rank";
+	$where = "del_flg = 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 = "del_flg = 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 = "del_flg = 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 del_flg = 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 del_flg = 0";
+	$ret = $objQuery->exec($sql);
+	return $ret;
+}
+?>
Index: /branches/mobile/html/admin/products/upload_rakuten.php
===================================================================
--- /branches/mobile/html/admin/products/upload_rakuten.php	(revision 7180)
+++ /branches/mobile/html/admin/products/upload_rakuten.php	(revision 7180)
@@ -0,0 +1,167 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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, CHAR_CODE, 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: /branches/mobile/html/admin/products/regist_review.php
===================================================================
--- /branches/mobile/html/admin/products/regist_review.php	(revision 5934)
+++ /branches/mobile/html/admin/products/regist_review.php	(revision 5934)
@@ -0,0 +1,32 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/products/product_select.php
===================================================================
--- /branches/mobile/html/admin/products/product_select.php	(revision 10308)
+++ /branches/mobile/html/admin/products/product_select.php	(revision 10308)
@@ -0,0 +1,152 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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 = "del_flg = 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, product_id DESC ";
+	
+	// ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
+	$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+	$from = "vw_products_nonclass AS noncls ";
+		
+	$objQuery = new SC_Query();
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count("dtb_products", $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, "fnNaviSearchOnlyPage", NAVI_PMAX);
+	$objPage->tpl_strnavi = $objNavi->strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	if(DB_TYPE != "mysql") $objQuery->setlimitoffset($page_max, $startno);
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	
+	// view¤â¹Ê¹þ¤ß¤ò¤«¤±¤ë(mysqlÍÑ)
+	sfViewWhere("&&noncls_where&&", $where, $arrval, $objQuery->order . " " .  $objQuery->setlimitoffset($page_max, $startno, true));
+	
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$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: /branches/mobile/html/admin/products/upload_csv.php
===================================================================
--- /branches/mobile/html/admin/products/upload_csv.php	(revision 7180)
+++ /branches/mobile/html/admin/products/upload_csv.php	(revision 7180)
@@ -0,0 +1,203 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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, CHAR_CODE, 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: /branches/mobile/html/admin/products/product.php
===================================================================
--- /branches/mobile/html/admin/products/product.php	(revision 10444)
+++ /branches/mobile/html/admin/products/product.php	(revision 10444)
@@ -0,0 +1,586 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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':
+case 'copy' :
+	// ÊÔ½¸»þ
+	if(sfIsInt($_POST['product_id'])){
+		// DB¤«¤é¾¦ÉÊ¾ðÊó¤ÎÆÉ¹þ
+		$arrForm = lfGetProduct($_POST['product_id']);
+		// DB¥Ç¡¼¥¿¤«¤é²èÁü¥Õ¥¡¥¤¥ëÌ¾¤ÎÆÉ¹þ
+		$objUpFile->setDBFileList($arrForm);
+		
+		if($_POST['mode'] == "copy"){
+			$arrForm["copy_product_id"] = $arrForm["product_id"];
+			$arrForm["product_id"] = "";
+			// ²èÁü¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+			$arrKey = $objUpFile->keyname;
+			$arrSaveFile = $objUpFile->save_file;
+			
+			foreach($arrSaveFile as $key => $val){
+				lfMakeScaleImage($arrKey[$key], $arrKey[$key], true); 
+			}
+		}
+		$objPage->arrForm = $arrForm;
+		
+		// ¾¦ÉÊ¥¹¥Æ¡¼¥¿¥¹¤ÎÊÑ´¹
+		$arrRet = sfSplitCBValue($objPage->arrForm['product_flag'], "product_flag");
+		$objPage->arrForm = array_merge($objPage->arrForm, $arrRet);
+		// DB¤«¤é¤ª¤¹¤¹¤á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß
+		$objPage->arrRecommend = lfPreGetRecommendProducts($_POST['product_id']);
+		
+		// µ¬³ÊÅÐÏ¿¤¢¤ê¤Ê¤·È½Äê
+		$objPage->tpl_nonclass = lfCheckNonClass($_POST['product_id']);
+		lfProductPage();		// ¾¦ÉÊÅÐÏ¿¥Ú¡¼¥¸
+	}
+	break;
+// ¾¦ÉÊÅÐÏ¿¡¦ÊÔ½¸
+case 'edit':
+	// µ¬³ÊÅÐÏ¿¤¢¤ê¤Ê¤·È½Äê
+	$tpl_nonclass = lfCheckNonClass($_POST['product_id']);
+	
+	if($_POST['product_id'] == "" and sfIsInt($_POST['copy_product_id'])){
+		$tpl_nonclass = lfCheckNonClass($_POST['copy_product_id']);
+	}
+	$objPage->tpl_nonclass = $tpl_nonclass;
+	
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$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']);
+
+	// Ãæ¡¢¾®²èÁüÀ¸À®
+	lfSetScaleImage();
+
+	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 AS allcls", "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'];
+			$sqlval['create_date'] = "now()";
+			$sqlval['update_date'] = "now()";
+			$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 AS allcls", "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 AS noncls ";
+	$where = "product_id = ?";
+	
+	// view¤â¹Ê¹þ¤ß(mysqlÂÐ±þ)
+	sfViewWhere("&&noncls_where&&", $where, array($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);
+	
+	
+	// ¥¢¥ó¥«¡¼¤òÀßÄê
+	if($_POST['image_key'] != ""){
+		$anchor_hash = "location.hash='#" . $_POST['image_key'] . "'";
+	}elseif($_POST['anchor_key'] != ""){
+		$anchor_hash = "location.hash='#" . $_POST['anchor_key'] . "'";
+	}
+		
+	$objPage->tpl_onload = "fnCheckSaleLimit('" . DISABLED_RGB . "'); fnCheckStockLimit('" . DISABLED_RGB . "'); " . $anchor_hash;
+}
+
+/* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */
+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_WIDTH, LARGE_IMAGE_HEIGHT);
+	for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö²èÁü$cnt", "sub_image$cnt", array('jpg', 'gif'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_WIDTH, NORMAL_SUBIMAGE_HEIGHT);	
+		$objUpFile->addFile("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü$cnt", "sub_large_image$cnt", array('jpg', 'gif'), IMAGE_SIZE, false, LARGE_SUBIMAGE_WIDTH, LARGE_SUBIMAGE_HEIGHT);
+	}
+	$objUpFile->addFile("¾¦ÉÊÈæ³Ó²èÁü", 'file1', array('jpg', 'gif'), IMAGE_SIZE, false, OTHER_IMAGE1_WIDTH, 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'] == "") {
+		if (DB_TYPE == "pgsql") {
+			$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¤Î¼Â¹Ô
+		$sqlval['create_date'] = "Now()";
+		$objQuery->insert("dtb_products", $sqlval);
+
+		if (DB_TYPE == "mysql") {
+			$product_id = $objQuery->nextval("dtb_products", "product_id");
+			$sqlval['product_id'] = $product_id;
+		}
+		
+		// ¥³¥Ô¡¼¾¦ÉÊ¤Î¾ì¹ç¤Ë¤Ïµ¬³Ê¤â¥³¥Ô¡¼¤¹¤ë
+		if($_POST["copy_product_id"] != "" and sfIsInt($_POST["copy_product_id"])){
+			// dtb_products_class ¤Î¥«¥é¥à¤ò¼èÆÀ
+			$arrColList = sfGetColumnList("dtb_products_class", $objQuery);
+			$arrColList_tmp = array_flip($arrColList);
+
+			// ¥³¥Ô¡¼¤·¤Ê¤¤Îó
+			unset($arrColList[$arrColList_tmp["product_class_id"]]);	 //µ¬³ÊID
+			unset($arrColList[$arrColList_tmp["product_id"]]);			 //¾¦ÉÊID
+
+			$col = sfGetCommaList($arrColList);
+
+			$objQuery->query("INSERT INTO dtb_products_class (product_id, ". $col .") SELECT ?, " . $col. " FROM dtb_products_class WHERE product_id = ? ORDER BY product_class_id", array($product_id, $_POST["copy_product_id"]));
+			
+		}
+
+	} 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;
+}
+
+// ½Ì¾®¤·¤¿²èÁü¤ò¥»¥Ã¥È¤¹¤ë
+function lfSetScaleImage(){
+	
+	$subno = str_replace("sub_large_image", "", $_POST['image_key']);
+	switch ($_POST['image_key']){
+		case "main_large_image":
+			// ¾ÜºÙ¥á¥¤¥ó²èÁü
+			lfMakeScaleImage($_POST['image_key'], "main_image");
+		case "main_image":
+			// °ìÍ÷¥á¥¤¥ó²èÁü
+			lfMakeScaleImage($_POST['image_key'], "main_list_image");
+			break;
+		case "sub_large_image" . $subno:
+			// ¥µ¥Ö¥á¥¤¥ó²èÁü
+			lfMakeScaleImage($_POST['image_key'], "sub_image" . $subno);
+			break;
+		default:
+			break;
+	}
+}
+
+// ½Ì¾®²èÁüÀ¸À®
+function lfMakeScaleImage($from_key, $to_key, $forced = false){
+	global $objUpFile;
+	$arrImageKey = array_flip($objUpFile->keyname);
+	
+	if($objUpFile->temp_file[$arrImageKey[$from_key]]){
+		$from_path = $objUpFile->temp_dir . $objUpFile->temp_file[$arrImageKey[$from_key]];
+	}elseif($objUpFile->save_file[$arrImageKey[$from_key]]){
+		$from_path = $objUpFile->save_dir . $objUpFile->save_file[$arrImageKey[$from_key]];
+	}else{
+		return "";
+	}
+	
+	if(file_exists($from_path)){
+		// ¸µ²èÁü¥µ¥¤¥º¤ò¼èÆÀ
+		list($from_w, $from_h) = getimagesize($from_path);
+		
+		// À¸À®Àè¤Î²èÁü¥µ¥¤¥º¤ò¼èÆÀ
+		$to_w = $objUpFile->width[$arrImageKey[$to_key]];
+		$to_h = $objUpFile->height[$arrImageKey[$to_key]];
+		
+		
+		if($forced) $objUpFile->save_file[$arrImageKey[$to_key]] = "";
+		
+		if(($objUpFile->temp_file[$arrImageKey[$to_key]] == "" and $objUpFile->save_file[$arrImageKey[$to_key]] == "")){
+			$path = $objUpFile->makeThumb($from_path, $to_w, $to_h);
+			$objUpFile->temp_file[$arrImageKey[$to_key]] = basename($path);
+		}
+	}else{
+		return "";
+	}
+}
+
+?>
Index: /branches/mobile/html/admin/products/review.php
===================================================================
--- /branches/mobile/html/admin/products/review.php	(revision 6085)
+++ /branches/mobile/html/admin/products/review.php	(revision 6085)
@@ -0,0 +1,245 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = DATA_PATH . '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 del_flg=1 WHERE review_id=?", array($_POST['review_id']));
+}
+	
+if ($_POST['mode'] == 'search' || $_POST['mode'] == 'csv' || $_POST['mode'] == 'delete'){
+	
+	//ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤¾¦ÉÊ¤ò¸¡º÷
+	$where="A.del_flg = 0 AND B.del_flg = 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']);
+					
+					$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($date)));
+					
+					$where.= " AND A.create_date <= cast('$end_date' as 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: /branches/mobile/html/admin/products/index_csv.php
===================================================================
--- /branches/mobile/html/admin/products/index_csv.php	(revision 8438)
+++ /branches/mobile/html/admin/products/index_csv.php	(revision 8438)
@@ -0,0 +1,141 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once(DATA_PATH . "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 AS prdcls";
+	$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: /branches/mobile/html/admin/products/classcategory.php
===================================================================
--- /branches/mobile/html/admin/products/classcategory.php	(revision 5934)
+++ /branches/mobile/html/admin/products/classcategory.php	(revision 5934)
@@ -0,0 +1,176 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = "del_flg <> 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 = "del_flg <> 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;
+		$sqlval['create_date'] = "now()";
+		$sqlval['update_date'] = "now()";
+		// 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: /branches/mobile/html/admin/products/class.php
===================================================================
--- /branches/mobile/html/admin/products/class.php	(revision 5934)
+++ /branches/mobile/html/admin/products/class.php	(revision 5934)
@@ -0,0 +1,151 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = "del_flg <> 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;
+	$sqlval['create_date'] = "now()";
+	$sqlval['update_date'] = "now()";
+	// 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", "del_flg = 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: /branches/mobile/html/admin/products/product_class.php
===================================================================
--- /branches/mobile/html/admin/products/product_class.php	(revision 5934)
+++ /branches/mobile/html/admin/products/product_class.php	(revision 5934)
@@ -0,0 +1,404 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 AS crs_prd", $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'];
+		$sqlval['create_date'] = "now()";
+		$sqlval['update_date'] = "now()";
+
+		$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 AS crs_cls ";
+		$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 AS crs_cls ";
+		$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 IN (SELECT class_id1 FROM vw_cross_products_class AS crs_prd WHERE product_id = ? GROUP BY class_id1, class_id2) AND T2.class_id IN (SELECT class_id2 FROM vw_cross_products_class AS crs_prd 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, $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'];
+			$sqlval['create_date'] = "now()";
+			$sqlval['update_date'] = "now()";
+			// 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: /branches/mobile/html/admin/products/review_edit.php
===================================================================
--- /branches/mobile/html/admin/products/review_edit.php	(revision 5934)
+++ /branches/mobile/html/admin/products/review_edit.php	(revision 5934)
@@ -0,0 +1,158 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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" => "update_date"),
+								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", "del_flg=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.del_flg = 0 AND B.del_flg = 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: /branches/mobile/html/admin/products/index.php
===================================================================
--- /branches/mobile/html/admin/products/index.php	(revision 10306)
+++ /branches/mobile/html/admin/products/index.php	(revision 10306)
@@ -0,0 +1,360 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = DATA_PATH . '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 = "del_flg = 0";
+	$view_where = "del_flg = 0";
+	
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if (count($objPage->arrErr) == 0) {
+
+		$arrval = array();
+		foreach ($objPage->arrForm as $key => $val) {
+			$val = sfManualEscape($val);
+			
+			if($val == "") {
+				continue;
+			}
+			
+			switch ($key) {
+				case 'search_product_id':	// ¾¦ÉÊID
+					$where .= " AND product_id = ?";
+					$view_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 . ")";
+					$view_where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE classcategory_id1 IN " . $where_in;
+					$view_where .= " OR classcategory_id2 IN" . $where_in . ")";
+					$arrval[] = "%$val%";
+					$arrval[] = "%$val%";
+					$view_where = $where;
+					break;
+				case 'search_name':			// ¾¦ÉÊÌ¾
+					$where .= " AND name ILIKE ?";
+					$view_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";
+						$view_where.= " AND $tmp_where";
+						$arrval = array_merge((array)$arrval, (array)$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)";
+					$view_where .= " AND EXISTS (SELECT product_id FROM dtb_products_class as cls WHERE cls.product_code ILIKE ? AND dtb_products.product_id = cls.product_id GROUP BY cls.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'] . "'";
+					$view_where.= " AND update_date >= '" . $_POST['search_startyear'] . "/" . $_POST['search_startmonth']. "/" .$_POST['search_startday'] . "'";
+					break;
+				case 'search_endyear':		// ÅÐÏ¿¹¹¿·Æü¡ÊTO¡Ë
+					$date = sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
+					$date = date('Y/m/d', strtotime($date) + 86400);
+					$where.= " AND update_date < date('" . $date . "')";
+					$view_where.= " AND update_date < date('" . $date . "')";
+					break;
+				case 'search_product_flag':	//¼ïÊÌ
+					global $arrSTATUS;
+					$search_product_flag = sfSearchCheckBoxes($val);
+					if($search_product_flag != "") {
+						$where.= " AND product_flag LIKE ?";
+						$view_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";
+						$view_where.= " $tmp_where";
+					}
+					break;
+				default:
+					break;
+			}
+		}
+
+		$order = "update_date DESC, product_id 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 AS noncls  WHERE $where)";
+			$sqlval['del_flg'] = 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 AS noncls ";
+
+			// ¹Ô¿ô¤Î¼èÆÀ
+			$linemax = $objQuery->count("dtb_products", $view_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;
+				}
+			}
+
+			// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+			if(DB_TYPE != "mysql") $objQuery->setlimitoffset($page_max, $startno);
+			// É½¼¨½ç½ø
+			$objQuery->setorder($order);
+			
+			// view¤â¹Ê¹þ¤ß¤ò¤«¤±¤ë(mysqlÍÑ)
+			sfViewWhere("&&noncls_where&&", $view_where, $arrval, $objQuery->order . " " .  $objQuery->setlimitoffset($page_max, $startno, true));
+
+			// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+			$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: /branches/mobile/html/admin/products/product_rank.php
===================================================================
--- /branches/mobile/html/admin/products/product_rank.php	(revision 10312)
+++ /branches/mobile/html/admin/products/product_rank.php	(revision 10312)
@@ -0,0 +1,96 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 AS noncls ";
+	$where = "del_flg = 0 AND category_id = ?";
+	
+	// ¹Ô¿ô¤Î¼èÆÀ
+	$linemax = $objQuery->count("dtb_products", $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;	// É½¼¨¥Ú¡¼¥¸ÈÖ¹æ¡Ê¡Ö¾å¤Ø²¼¤Ø¡×É½¼¨È½ÄêÍÑ¡Ë
+			
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	if(DB_TYPE != "mysql") $objQuery->setlimitoffset(SEARCH_PMAX, $startno);
+	
+	$objQuery->setorder("rank DESC");
+	
+	// view¤â¹Ê¹þ¤ß¤ò¤«¤±¤ë(mysqlÍÑ)
+	sfViewWhere("&&noncls_where&&", $where, array($category_id), $objQuery->order . " " .  $objQuery->setlimitoffset(SEARCH_PMAX, $startno, true));
+	
+	$arrRet = $objQuery->select($col, $table, $where, array($category_id));
+	return $arrRet;
+}
+
+?>
Index: /branches/mobile/html/admin/design/index.php
===================================================================
--- /branches/mobile/html/admin/design/index.php	(revision 6226)
+++ /branches/mobile/html/admin/design/index.php	(revision 6226)
@@ -0,0 +1,421 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../../require.php");
+require_once(DATA_PATH . "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: ". URL_DIR . "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 = USER_PATH . "templates/" . $arrPreData[0]['filename'] . '.tpl';
+	if (file_exists($del_tpl)){
+		unlink($del_tpl);	
+	}
+	
+	print(HTML_PATH . $arrPageData[0]['tpl_dir'] . $arrPageData[0]['filename'] . ".tpl");
+		
+	// ¥×¥ì¥Ó¥å¡¼ÍÑtpl¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+	$tplfile = $arrPageData[0]['tpl_dir'] . $arrPageData[0]['filename'];
+	
+	if($tplfile == ""){
+		// tpl¥Õ¥¡¥¤¥ë¤¬¶õ¤Î¾ì¹ç¤Ë¤ÏMY¥Ú¡¼¥¸¤ÈÈ½ÃÇ
+		$tplfile = "user_data/templates/mypage/index";
+	}
+	copy(HTML_PATH . $tplfile . ".tpl", USER_PATH . "templates/" . $filename . ".tpl");
+	
+	// ¹¹¿·¥Ç¡¼¥¿¤Î¼èÆÀ
+	$sql = "select page_name, header_chk, footer_chk from dtb_pagelayout where page_id = ?";
+	$ret = $objDBConn->getAll($sql, array($arrPageData[0]['page_id']));
+
+	// db¥Ç¡¼¥¿¤Î¥³¥Ô¡¼
+	$sql = " update dtb_pagelayout set ";
+	$sql .= "     page_name = ?";
+	$sql .= "     ,header_chk = ?";
+	$sql .= "     ,footer_chk = ?";
+	$sql .= "     ,url = ?";
+	$sql .= "     ,tpl_dir = ?";
+	$sql .= "     ,filename = ?";
+	$sql .= " where page_id = 0";
+	
+	$arrUpdData = array($ret[0]['page_id']
+						,$ret[0]['page_id']
+						,$ret[0]['page_id']
+						,USER_DIR."templates/"
+						,USER_DIR."templates/"
+						,$filename
+						);
+	
+	$objDBConn->query($sql,$arrUpdData);
+}
Index: /branches/mobile/html/admin/design/css.php
===================================================================
--- /branches/mobile/html/admin/design/css.php	(revision 6081)
+++ /branches/mobile/html/admin/design/css.php	(revision 6081)
@@ -0,0 +1,54 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = USER_PATH . "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: /branches/mobile/html/admin/design/header.php
===================================================================
--- /branches/mobile/html/admin/design/header.php	(revision 6085)
+++ /branches/mobile/html/admin/design/header.php	(revision 6085)
@@ -0,0 +1,95 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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'];
+$pre_DIR = USER_INC_PATH . '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", USER_INC_PATH . $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(USER_INC_PATH . "header.tpl", $pre_DIR . "header.tpl");
+	copy(USER_INC_PATH . "footer.tpl", $pre_DIR . "footer.tpl");
+	
+	// ¥Ø¥Ã¥À¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	$header_data = file_get_contents(USER_INC_PATH . "header.tpl");
+	// ¥Õ¥Ã¥¿¡¼¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+	$footer_data = file_get_contents(USER_INC_PATH . "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: /branches/mobile/html/admin/design/main_edit.php
===================================================================
--- /branches/mobile/html/admin/design/main_edit.php	(revision 9027)
+++ /branches/mobile/html/admin/design/main_edit.php	(revision 9027)
@@ -0,0 +1,375 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../../require.php");
+require_once(DATA_PATH . "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 = HTML_PATH . $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 = USER_PATH . "templates/" . $arrPreData[0]['filename'] . '.tpl';
+	if (file_exists($del_tpl)){
+		unlink($del_tpl);	
+	}
+
+	// DB¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤¹¤ë
+	lfEntryPageData($_POST);
+
+	// TPL¥Õ¥¡¥¤¥ëºîÀ®
+	$cre_tpl = USER_PATH . "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 != "") {
+		// ÅÐÏ¿¥Ç¡¼¥¿¤ò¼èÆÀ
+		$sql = "SELECT 0, target_id, bloc_id, bloc_row FROM dtb_blocposition WHERE page_id = ?";
+		$ret = $objDBConn->getAll($sql,array($page_id_old));
+		
+		if (count($ret) > 0) {
+			
+			// blocposition ¤òÊ£À½
+			$sql = " insert into dtb_blocposition (";
+			$sql .= "     page_id,";
+			$sql .= "     target_id,";
+			$sql .= "     bloc_id,";
+			$sql .= "     bloc_row";
+			$sql .= "     )values(?, ?, ?, ?)";
+			
+			// ¼èÆÀ·ï¿ôÊ¸INSERT¼Â¹Ô
+			foreach($ret as $key => $val){
+				$ret = $objDBConn->query($sql,$val);
+			}
+		}
+
+	}
+	
+	$_SESSION['preview'] = "ON";
+	
+	header("location: " . URL_DIR . "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 = USER_PATH . $_POST['url'] . ".php";
+			lfCreatePHPFile($cre_php);
+		}
+
+		// TPL¥Õ¥¡¥¤¥ëºîÀ®
+		$cre_tpl = dirname(USER_PATH . "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 .= "	  ,create_date";
+		$sql .= "	  ,update_date";
+		$sql .= " ) VALUES ( ?,?,?,?,?,?,?,?,now(),now() )";
+		$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###", HTML_PATH . "require.php", $php_data);
+	
+	// php¥Õ¥¡¥¤¥ë¤ÎºîÀ®
+	$fp = fopen($path,"w");
+	fwrite($fp, $php_data);
+	fclose($fp);
+}
Index: /branches/mobile/html/admin/design/template.php
===================================================================
--- /branches/mobile/html/admin/design/template.php	(revision 10534)
+++ /branches/mobile/html/admin/design/template.php	(revision 10534)
@@ -0,0 +1,390 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../../require.php");
+require_once(DATA_PATH . "module/Tar.php");
+require_once(DATA_PATH . "include/file_manager.inc");
+require_once(DATA_PATH . "module/SearchReplace.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¤Ø¥Ç¡¼¥¿¤ò¹¹¿·¤Ë¹Ô¤¯
+switch($_POST['mode']) {
+case 'confirm':
+	// DB¤Ø¥Ç¡¼¥¿¹¹¿·
+	lfUpdData();
+	
+	// ¥Æ¥ó¥×¥ì¡¼¥È¤Î¾å½ñ¤­
+	lfChangeTemplate();
+	
+	// ´°Î»¥á¥Ã¥»¡¼¥¸
+	$objPage->tpl_onload="alert('ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');";
+	break;
+case 'download':
+	lfDownloadTemplate($_POST['check_template']);
+	break;
+default:
+	break;
+}
+
+// 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_PATH . "templates/";
+	$inc_path = USER_PATH . "include/";
+	$css_path = USER_PATH . "css/";
+	
+	$tpl_name = "";
+	$tpl_element = "";
+	
+	$chk_tpl = $_POST['check_template'];
+	$path = $tpl_path . $chk_tpl . "/";
+	$taget_tpl_path = $path . "/templates/";
+	$taget_inc_path = $path . "/include/";
+	$taget_css_path = $path . "/css/";
+	$save_tpl_path = $tpl_path;
+	
+	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;
+	}
+
+	// ²èÁü¥Ñ¥¹¤ò½ñ¤­´¹¤¨
+	$img_path = '<!--{$smarty.const.URL_DIR}-->img/';
+	$displace_path = '<!--{$smarty.const.URL_DIR}-->'. USER_DIR . 'templates/' . $chk_tpl . '/img/';
+	$fs = new File_SearchReplace($img_path, $displace_path, "", $path, true); 
+	$fs->doSearch(); 
+	
+	// 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_inc_path."bloc/", $inc_path . "bloc/");
+
+		// ¥Ø¥Ã¥À¡¼,¥Õ¥Ã¥¿¡¼¥³¥Ô¡¼
+		copy($taget_inc_path . "header.tpl", $inc_path . "header.tpl");
+		copy($taget_inc_path . "footer.tpl", $inc_path . "footer.tpl");
+		
+		// CSS¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+		copy($taget_css_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);
+	}
+
+	// ²èÁü¥Ñ¥¹¤ò¸µ¤ËÌá¤¹	
+	$fs = new File_SearchReplace($displace_path, $img_path, "", $path, true); 
+	$fs->doSearch(); 
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfDownloadTemplate
+ * ½èÍýÆâÍÆ	¡§¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë°µ½Ì¤·¤Æ¥À¥¦¥ó¥í¡¼¥É¤¹¤ë
+ * °ú¿ô1	¡§¥Æ¥ó¥×¥ì¡¼¥È¥³¡¼¥É
+ * Ìá¤êÃÍ	¡§¤Ê¤·
+ **************************************************************************************************************/
+function lfDownloadTemplate($template_code){
+	$filename = $template_code. ".tar.gz";
+	$dl_file = USER_TEMPLATE_PATH.$filename;
+	
+	// IMG¥Õ¥©¥ë¥À¤ò¥³¥Ô¡¼
+	$mess = "";
+	$mess = sfCopyDir(HTML_PATH."img/", USER_TEMPLATE_PATH.$template_code."/img/", $mess);
+	
+	// ¥Õ¥¡¥¤¥ë¤Î°µ½Ì
+	$tar = new Archive_Tar($dl_file, TRUE);
+	// ¥Õ¥¡¥¤¥ë°ìÍ÷¼èÆÀ
+	$arrFileHash = sfGetFileList(USER_TEMPLATE_PATH.$template_code);
+	foreach($arrFileHash as $val) {
+		$arrFileList[] = $val['file_name'];
+	}
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤ò°ÜÆ°
+	chdir(USER_TEMPLATE_PATH.$template_code);
+	
+	//°µ½Ì¤ò¤ª¤³¤Ê¤¦
+	$zip = $tar->create($arrFileList);
+		
+	// ¥À¥¦¥ó¥í¡¼¥É³«»Ï
+	Header("Content-disposition: attachment; filename=${filename}");
+	Header("Content-type: application/octet-stream; name=${dl_file}");
+	header("Content-Length: " .filesize($dl_file)); 
+	readfile ($dl_file);
+	// °µ½Ì¥Õ¥¡¥¤¥ëºï½ü
+	unlink($dl_file);
+	
+	exit();
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§lfFolderCopy
+ * ½èÍýÆâÍÆ	¡§¥Õ¥©¥ë¥À¤ò¥³¥Ô¡¼¤¹¤ë
+ * °ú¿ô1	¡§¥³¥Ô¡¼¸µ¥Ñ¥¹
+ * °ú¿ô2¡¡¡¡¡§¥³¥Ô¡¼Àè¥Ñ¥¹
+ * Ìá¤êÃÍ	¡§¤Ê¤·
+ **************************************************************************************************************/
+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: /branches/mobile/html/admin/design/bloc.php
===================================================================
--- /branches/mobile/html/admin/design/bloc.php	(revision 6204)
+++ /branches/mobile/html/admin/design/bloc.php	(revision 6204)
@@ -0,0 +1,268 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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'] = USER_PATH . $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 = USER_INC_PATH . '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=BLOC_PATH . $arrBlocData[0]['filename']. '.tpl';
+		if (file_exists($del_file)) {
+			unlink($del_file);
+		}
+		
+		// ¥Õ¥¡¥¤¥ëºîÀ®
+		$fp = fopen(BLOC_PATH . $_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 = BLOC_PATH . $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 .= "     ,create_date ";	// ºîÀ®Æü
+		$sql .= "     ,update_date ";	// ¹¹¿·Æü
+		$sql .= " ) VALUES ( ?,?,?,now(),now() )";
+		$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: /branches/mobile/html/admin/design/upload.php
===================================================================
--- /branches/mobile/html/admin/design/upload.php	(revision 10443)
+++ /branches/mobile/html/admin/design/upload.php	(revision 10443)
@@ -0,0 +1,190 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../../require.php");
+require_once(DATA_PATH. "module/Tar.php");
+
+class LC_Page {
+
+	function LC_Page() {
+		$this->tpl_mainpage = 'design/upload.tpl';
+		$this->tpl_subnavi = 'design/subnavi.tpl';
+		$this->tpl_subno = 'template';
+		$this->tpl_subno_template = 'upload';
+		$this->tpl_mainno = "design";
+		$this->tpl_subtitle = '¥¢¥Ã¥×¥í¡¼¥É';
+		$this->template_name = '¥¢¥Ã¥×¥í¡¼¥É';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥¢¥Ã¥×¥í¡¼¥É¤·¤¿¥Õ¥¡¥¤¥ë¤ò¥Õ¥©¥ë¥À
+$new_file_dir = USER_TEMPLATE_PATH.$_POST['template_code'];
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile(TEMPLATE_TEMP_DIR, $new_file_dir);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+
+switch($_POST['mode']) {
+case 'upload':
+	$objFormParam->setParam($_POST);
+	$arrRet = $objFormParam->getHashArray();
+	
+	$objPage->arrErr = lfErrorCheck($arrRet);
+
+	// ¥Õ¥¡¥¤¥ë¤ò°ì»þ¥Õ¥©¥ë¥À¤ØÊÝÂ¸
+	$ret = $objUpFile->makeTempFile('template_file', false);
+	if($ret != "") {
+		$objPage->arrErr['template_file'] = $ret;
+	} else if(count($objPage->arrErr) <= 0) {
+		// ¥Õ¥©¥ë¥ÀºîÀ®
+		$ret = @mkdir($new_file_dir);
+		// °ì»þ¥Õ¥©¥ë¥À¤«¤éÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê¤Ø°ÜÆ°
+		$objUpFile->moveTempFile();
+		// ²òÅà
+		lfUnpacking($new_file_dir, $_FILES['template_file']['name'], $new_file_dir."/");
+		// DB¤Ë¥Æ¥ó¥×¥ì¡¼¥È¾ðÊó¤òÊÝÂ¸
+		lfRegistTemplate($arrRet);
+		// ´°Î»É½¼¨javascript
+		$objPage->tpl_onload = "alert('¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ò¥¢¥Ã¥×¥í¡¼¥É¤·¤Þ¤·¤¿¡£');";
+		// ¥Õ¥©¡¼¥àÃÍ¤ò¥¯¥ê¥¢
+		$objFormParam->setParam(array('template_code' => "", 'template_name' => ""));
+	}
+	break;
+default:
+	break;
+}
+// ²èÌÌ¤ÎÉ½¼¨
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfInitFile()
+ * ÀâÌÀ¡¡¡§¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+ */
+function lfInitFile() {
+	global $objUpFile;
+
+	$objUpFile->addFile("¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë", 'template_file', array(), TEMPLATE_SIZE, true, 0, 0, false);
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfInitParam()
+ * ÀâÌÀ¡¡¡§¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+ */
+function lfInitParam() {
+	global $objFormParam;
+		
+	$objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥È¥³¡¼¥É", "template_code", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK"));
+	$objFormParam->addParam("¥Æ¥ó¥×¥ì¡¼¥ÈÌ¾", "template_name", STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfErrorCheck()
+ * °ú¿ô1 ¡§¥Ñ¥é¥á¡¼¥¿
+ * ÀâÌÀ¡¡¡§¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+ */
+function lfErrorCheck($arrList) {
+	global $objQuery;
+	global $objFormParam;
+	
+	$objErr = new SC_CheckError($arrList);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	if(count($objErr->arrErr) <= 0) {
+		// Æ±Ì¾¤Î¥Õ¥©¥ë¥À¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï¥¨¥é¡¼
+		if(file_exists(USER_TEMPLATE_PATH.$arrList['template_code'])) {
+			$objErr->arrErr['template_code'] = "¢¨ Æ±Ì¾¤Î¥Õ¥¡¥¤¥ë¤¬¤¹¤Ç¤ËÂ¸ºß¤·¤Þ¤¹¡£<br/>";
+		}
+		// DB¤Ë¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¥Á¥§¥Ã¥¯
+		$ret = $objQuery->get("dtb_templates", "template_code", "template_code = ?", array($arrList['template_code']));
+		if($ret != "") {
+			$objErr->arrErr['template_code'] = "¢¨ ¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¥³¡¼¥É¤Ç¤¹¡£<br/>";
+		}
+		// ¥Õ¥¡¥¤¥ë¤Î³ÈÄ¥»Ò¥Á¥§¥Ã¥¯(.tar/tar.gz¤Î¤ßµö²Ä)
+		$errFlag = true;
+		$array_ext = explode(".", $_FILES['template_file']['name']);
+		$ext = $array_ext[ count ( $array_ext ) - 1 ];
+		$ext = strtolower($ext);
+		// .tar¥Á¥§¥Ã¥¯
+		if ($ext == 'tar') {
+			$errFlag = false;
+		}
+
+		$ext = $array_ext[ count ( $array_ext ) - 2 ].".".$ext;
+		$ext = strtolower($ext);
+		// .tar.gz¥Á¥§¥Ã¥¯
+		if ($ext== 'tar.gz') {
+			$errFlag = false;
+		}
+		
+		if($errFlag) {
+			$objErr->arrErr['template_file'] = "¢¨ ¥¢¥Ã¥×¥í¡¼¥É¤¹¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Çµö²Ä¤µ¤ì¤Æ¤¤¤ë·Á¼°¤Ï¡¢tar/tar.gz¤Ç¤¹¡£<br />";		
+		}
+	}
+	
+	return $objErr->arrErr;
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfErrorCheck()
+ * °ú¿ô1 ¡§¥Ñ¥é¥á¡¼¥¿
+ * ÀâÌÀ¡¡¡§¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿ÅÐÏ¿
+ */
+function lfRegistTemplate($arrList) {
+	global $objQuery;
+	
+	// INSERT¤¹¤ëÃÍ¤òºîÀ®¤¹¤ë¡£
+	$sqlval['template_code'] = $arrList['template_code'];
+	$sqlval['template_name'] = $arrList['template_name'];
+	$sqlval['create_date'] = "now()";
+	$sqlval['update_date'] = "now()";
+
+	$objQuery->insert("dtb_templates", $sqlval);
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfUnpacking
+ * °ú¿ô1 ¡§¥Ç¥£¥ì¥¯¥È¥ê
+ * °ú¿ô2 ¡§¥Õ¥¡¥¤¥ë¥Í¡¼¥à
+ * °ú¿ô3 ¡§²òÅà¥Ç¥£¥ì¥¯¥È¥ê
+ * ÀâÌÀ¡¡¡§¥Æ¥ó¥×¥ì¡¼¥È¥Ç¡¼¥¿ÅÐÏ¿
+ */
+function lfUnpacking($dir, $file_name, $unpacking_dir) {
+
+	// °µ½Ì¥Õ¥é¥°TRUE¤Ïgzip²òÅà¤ò¤ª¤³¤Ê¤¦
+	$tar = new Archive_Tar("$dir/$file_name", TRUE);
+
+	// ³ÈÄ¥»Ò¤òÀÚ¤ê¼è¤ë
+	$unpacking_name = ereg_replace("\.tar$", "", $file_name);
+	$unpacking_name = ereg_replace("\.tar\.gz$", "", $file_name);
+
+	// »ØÄê¤µ¤ì¤¿¥Õ¥©¥ë¥ÀÆâ¤Ë²òÅà¤¹¤ë
+	$err = $tar->extractModify($unpacking_dir, $unpacking_name);
+
+	// ¥Õ¥©¥ë¥Àºï½ü
+	@sfDelFile("$dir/$unpacking_name");
+	// °µ½Ì¥Õ¥¡¥¤¥ëºï½ü
+	@unlink("$dir/$file_name");
+
+	return $err;
+}
Index: /branches/mobile/html/admin/order/index.php
===================================================================
--- /branches/mobile/html/admin/order/index.php	(revision 6085)
+++ /branches/mobile/html/admin/order/index.php	(revision 6085)
@@ -0,0 +1,332 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = DATA_PATH . '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 = "del_flg = 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['del_flg'] = 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: /branches/mobile/html/admin/order/mail_view.php
===================================================================
--- /branches/mobile/html/admin/order/mail_view.php	(revision 5934)
+++ /branches/mobile/html/admin/order/mail_view.php	(revision 5934)
@@ -0,0 +1,33 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/order/index_csv.php
===================================================================
--- /branches/mobile/html/admin/order/index_csv.php	(revision 6085)
+++ /branches/mobile/html/admin/order/index_csv.php	(revision 6085)
@@ -0,0 +1,63 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once(DATA_PATH . "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: /branches/mobile/html/admin/order/mail.php
===================================================================
--- /branches/mobile/html/admin/order/mail.php	(revision 5934)
+++ /branches/mobile/html/admin/order/mail.php	(revision 5934)
@@ -0,0 +1,117 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/admin/order/status.php
===================================================================
--- /branches/mobile/html/admin/order/status.php	(revision 8502)
+++ /branches/mobile/html/admin/order/status.php	(revision 8502)
@@ -0,0 +1,160 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 '6':
+					lfStatusMove(6,$_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="del_flg=0 AND status=?";
+	$order = "order_id DESC";
+	
+	$linemax = $objQuery->count("dtb_order", "del_flg = 0 AND status=?", array($status));
+	$objPage->tpl_linemax = $linemax;
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
+	$page_max = ORDER_STATUS_MAX;
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($pageno, $linemax, $page_max, "fnNaviSearchOnlyPage", 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 del_flg=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: /branches/mobile/html/admin/order/edit.php
===================================================================
--- /branches/mobile/html/admin/order/edit.php	(revision 7777)
+++ /branches/mobile/html/admin/order/edit.php	(revision 7777)
@@ -0,0 +1,334 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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', 'deliv_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);
+		
+		// ¤½¤ÎÂ¾»ÙÊ§¤¤¾ðÊó¤òÉ½¼¨
+		if($objPage->arrDisp["memo02"] != "") $objPage->arrDisp["payment_info"] = unserialize($objPage->arrDisp["memo02"]);
+		if($objPage->arrDisp["memo01"] == PAYMENT_CREDIT_ID){
+			$objPage->arrDisp["payment_type"] = "¥¯¥ì¥¸¥Ã¥È·èºÑ";
+		}elseif($objPage->arrDisp["memo01"] == PAYMENT_CONVENIENCE_ID){
+			$objPage->arrDisp["payment_type"] = "¥³¥ó¥Ó¥Ë·èºÑ";
+		}else{
+			$objPage->arrDisp["payment_type"] = "¤ª»ÙÊ§¤¤";
+		}
+	}
+}
+
+// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+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 deliv_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: /branches/mobile/html/admin/home.php
===================================================================
--- /branches/mobile/html/admin/home.php	(revision 6284)
+++ /branches/mobile/html/admin/home.php	(revision 6284)
@@ -0,0 +1,191 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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);
+
+// DB¥Ð¡¼¥¸¥ç¥ó¤Î¼èÆÀ
+$objPage->db_version = sfGetDBVersion();
+
+// PHP¥Ð¡¼¥¸¥ç¥ó¤Î¼èÆÀ
+$objPage->php_version = "PHP " . phpversion();
+
+// ¸½ºß¤Î²ñ°÷¿ô
+$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();
+
+// ¿·µ¬¼õÉÕ°ìÍ÷
+$arrNewOrder = lfGetNewOrder();
+
+foreach ($arrNewOrder as $key => $val){
+	$arrNewOrder[$key]['create_date'] = str_replace("-", "/", substr($val['create_date'], 0,19));
+	
+}
+$objPage->arrNewOrder = $arrNewOrder;
+
+// ¤ªÃÎ¤é¤»°ìÍ÷¤Î¼èÆÀ
+$objPage->arrInfo = lfGetInfo();
+
+$objView->assignobj($objPage);
+$objView->display(MAIN_FRAME);
+//---------------------------------------------------------
+
+// ²ñ°÷¿ô
+function lfGetCustomerCnt($conn){
+	
+	$sql = "SELECT COUNT(customer_id) FROM dtb_customer WHERE del_flg = 0 AND status = 2";
+	$return = $conn->getOne($sql);
+	return $return;
+}
+
+// ºòÆü¤ÎÇä¾å¹â¡¦Çä¾å·ï¿ô
+function lfGetOrderYesterday($conn, $method){
+	if ( $method == 'SUM' or $method == 'COUNT'){
+		// postgresql ¤È mysql ¤È¤ÇSQL¤ò¤ï¤±¤ë
+		if (DB_TYPE == "pgsql") {
+			$sql = "SELECT ".$method."(total) FROM dtb_order
+					 WHERE del_flg = 0 AND to_char(create_date,'YYYY/MM/DD') = to_char(now() - interval '1 days','YYYY/MM/DD')";
+		}else if (DB_TYPE == "mysql") {
+			$sql = "SELECT ".$method."(total) FROM dtb_order
+					 WHERE del_flg = 0 AND cast(substring(create_date,1, 10) as date) = DATE_ADD(current_date, interval -1 day)";
+		}
+		$return = $conn->getOne($sql);
+	}
+	return $return;
+}
+
+function lfGetOrderMonth($conn, $method){
+
+	$month = date("Y/m", mktime());
+	
+	if ( $method == 'SUM' or $method == 'COUNT'){
+	// postgresql ¤È mysql ¤È¤ÇSQL¤ò¤ï¤±¤ë
+	if (DB_TYPE == "pgsql") {
+		$sql = "SELECT ".$method."(total) FROM dtb_order
+				 WHERE del_flg = 0 AND to_char(create_date,'YYYY/MM') = ? 
+				 AND to_char(create_date,'YYYY/MM/DD') <> to_char(now(),'YYYY/MM/DD')";
+	}else if (DB_TYPE == "mysql") {
+		$sql = "SELECT ".$method."(total) FROM dtb_order
+				 WHERE del_flg = 0 AND cast(substring(create_date,1,7) as date) = ? 
+				 AND cast(substring(create_date,1, 10) as date) <> cast(substring(now(),1, 10) as date)";
+	}
+		$return = $conn->getOne($sql, array($month));
+	}
+	return $return;
+}
+
+function lfGetTotalCustomerPoint() {
+	$objQuery = new SC_Query();
+	$col = "SUM(point)";
+	$where = "del_flg = 0";
+	$from = "dtb_customer";
+	$ret = $objQuery->get($from, $col, $where);
+	return $ret;	
+}
+
+function lfGetReviewYesterday($conn){
+	// postgresql ¤È mysql ¤È¤ÇSQL¤ò¤ï¤±¤ë
+	if (DB_TYPE == "pgsql") {
+		$sql = "SELECT COUNT(*) FROM dtb_review 
+				 WHERE del_flg=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')";
+	}else if (DB_TYPE == "mysql") {
+		$sql = "SELECT COUNT(*) FROM dtb_review 
+				 WHERE del_flg = 0 AND cast(substring(create_date,1, 10) as date) = DATE_ADD(current_date, interval -1 day)
+				 AND cast(substring(create_date,1, 10) as date) != cast(substring(now(),1, 10) as date)";
+	}
+	$return = $conn->getOne($sql);
+	return $return;
+}
+
+function lfGetReviewNonDisp($conn){
+	$sql = "SELECT COUNT(*) FROM dtb_review WHERE del_flg=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 AS name01, ord.order_name02 AS name02, 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.= "create_date AS create_date";
+	$from = "dtb_order AS ord";
+	$where = "del_flg = 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: /branches/mobile/html/admin/batch/daily.php
===================================================================
--- /branches/mobile/html/admin/batch/daily.php	(revision 8327)
+++ /branches/mobile/html/admin/batch/daily.php	(revision 8327)
@@ -0,0 +1,323 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+$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 del_flg = 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);
+		
+		// ¥¿¥¤¥à¥¢¥¦¥È¤òËÉ¤°
+		sfFlush();
+	}
+}
+
+// ¥ê¥¢¥ë¥¿¥¤¥à¤Ç½¸·×¤ò¼Â»Ü¤¹¤ë¡£½¸·×¤¬½ªÎ»¤·¤Æ¤¤¤ë¥ì¥³¡¼¥É¤Ï¼Â»Ü¤·¤Ê¤¤¡£
+/*
+	$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($start, $end) {
+	$from = " FROM dtb_order AS T1 LEFT JOIN dtb_customer AS T2 USING ( customer_id ) ";
+	$where = " WHERE T1.del_flg = 0 AND T1.create_date BETWEEN '$start' AND '$end' ";
+
+/*	mysql¤Ç¤âÌäÂê¤Ê¤¤¤è¤¦¤Ë½¤Àµ
+	$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;
+	$sql.= $where;		// ¼õÃíºîÀ®Æü¤Ç¸¡º÷¤¹¤ë
+*/
+	$sql = "SELECT ";
+	$sql.= "COUNT(*) AS total_order, ";
+	$sql.= "(SELECT sum(cnt) FROM (SELECT COUNT(*) AS cnt $from $where AND T1.customer_id = 0) AS nonmember ) AS nonmember, ";
+	$sql.= "(SELECT sum(cnt) FROM (SELECT COUNT(*) AS cnt $from $where AND T1.customer_id <> 0) AS member ) AS member, ";
+	$sql.= "(SELECT sum(cnt) FROM (SELECT COUNT(*) AS cnt $from $where AND T1.order_sex = 1) AS men ) AS men, ";
+	$sql.= "(SELECT sum(cnt) FROM (SELECT COUNT(*) AS cnt $from $where AND T1.order_sex = 2) AS women ) AS women, ";
+	$sql.= "(SELECT sum(cnt) FROM (SELECT COUNT(*) AS cnt $from $where AND T1.order_sex = 1 AND T2.customer_id <> 0) AS men_member ) AS men_member, ";
+	$sql.= "(SELECT sum(cnt) FROM (SELECT COUNT(*) AS cnt $from $where AND T1.order_sex = 1 AND T2.customer_id = 0) AS men_nonmember ) AS men_nonmember, ";
+	$sql.= "(SELECT sum(cnt) FROM (SELECT COUNT(*) AS cnt $from $where AND T1.order_sex = 2 AND T2.customer_id <> 0) AS women_member ) AS women_member, ";
+	$sql.= "(SELECT sum(cnt) FROM (SELECT COUNT(*) AS cnt $from $where AND T1.order_sex = 2 AND T2.customer_id = 0) AS women_nonmember ) AS women_nonmember, ";
+	$sql.= "SUM(total) AS total, ";
+	$sql.= "(AVG(total)) AS total_average ";
+	$sql.= $from;
+	$sql.= $where;		// ¼õÃíºîÀ®Æü¤Ç¸¡º÷¤¹¤ë
+
+	return $sql;
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(ÆüÊÌ)
+function lfBatOrderDaily($time) {
+	global $arrWDAY;
+	
+	// ½¸·×ÂÐ¾ÝÆü¤ò¼èÆÀ¤¹¤ë
+	$date = date("Y-m-d", $time);
+	
+	$start = $date . " 00:00:00";
+	$end = $date . " 23:59:59";
+	
+	$sql = lfGetOrderDailySQL($start,$end);
+	
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->getall($sql);	
+		
+	$sqlval = $arrRet[0];
+	
+	// ¶õÊ¸»ú¤ò"0"¤ËÊÑ´¹
+	foreach($sqlval as $key => $val) {
+		if ($val == "") {
+			$sqlval[$key] = "0";
+		}
+	}
+	
+	$sqlval['create_date'] = 'now()';
+	$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) {
+	
+	// ½¸·×ÂÐ¾ÝÆü¤ò¼èÆÀ¤¹¤ë
+	$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);
+		$sql = lfGetOrderDailySQL($sdate, $edate);
+		$arrRet = $objQuery->getall($sql);
+		$sqlval = $arrRet[0];
+		// ¶õÊ¸»ú¤ò"0"¤ËÊÑ´¹
+		foreach($sqlval as $key => $val) {
+			if ($val == "") {
+				$sqlval[$key] = "0";
+			}
+		}
+		$sqlval['create_date'] = "now()";
+		$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, (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 del_flg = 0 ";
+
+	$end_date = date("Y/m/d", time()); 
+	$start_date = date("Y/m/d",strtotime("-10 year" ,strtotime($end_date)));
+	$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($end_date)));
+	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i <= $age_loop; $i++) {
+		$where = $base_where . " AND order_birth >= cast('$start_date' as date)";
+		$start_age = $i * 10;
+		if($i < $age_loop) {
+			$end_age = $start_age+9;
+			$where = $where . " AND order_birth < cast('$end_date' as date)";
+		}else{
+			$where = $base_where . " AND order_birth < cast('$end_date' as date)";
+			$end_age = 999;
+		}
+		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 1);
+		$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($start_date)));
+		$start_date = date("Y/m/d",strtotime("-10 year",strtotime($start_date)));
+	}
+	
+	// ÃÂÀ¸ÆüÆþÎÏ¤Ê¤·
+	$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 del_flg = 0";
+	$where = $base_where . " AND (to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) BETWEEN ? AND ?) ";
+
+	$end_date = date("Y/m/d", time()); 
+	$start_date = date("Y/m/d",strtotime("-10 year" ,strtotime($end_date)));
+	$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($end_date)));
+	// Ç¯ÎðËè¤Ë½¸·×¤¹¤ë¡£
+	for($i = 0; $i <= $age_loop; $i++) {
+		$where = $base_where . " AND order_birth >= cast('$start_date' as date)";
+		$start_age = $i * 10;
+		if($i < $age_loop) {
+			$end_age = $start_age+9;
+			$where = $where . " AND order_birth < cast('$end_date' as date)";
+		}else{
+			$where = $base_where . " AND order_birth < cast('$end_date' as date)";
+			$end_age = 999;
+		}
+		lfBatOrderAgeSub($sql . $where, $start, $end, $start_age, $end_age, 0);
+		$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($start_date)));
+		$start_date = date("Y/m/d",strtotime("-10 year",strtotime($start_date)));
+	}
+	
+	// ÃÂÀ¸ÆüÆþÎÏ¤Ê¤·
+	$where = $base_where . " AND order_birth IS NULL AND del_flg = 0";
+	lfBatOrderAgeSub($sql . $where, $start, $end, NULL, NULL, 0);	
+}
+
+// Çä¾å¤²½¸·×¥Ð¥Ã¥Á½èÍý(Ç¯ÎðÊÌ) ÅÐÏ¿ÉôÊ¬
+function lfBatOrderAgeSub($sql, $start, $end, $start_age, $end_age, $member) {
+	$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['create_date'] = "now()";
+	$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);
+}
+
+// Ê¸»úÎó¤ËSingleQuotation¤òÉÕÍ¿¤¹¤ë
+function lfSingleQuot($value){
+	$ret = "";
+	if (DB_TYPE == "mysql") {
+		$ret = $value;
+	}else{
+		$ret = "'" . $value . "'";
+	} 
+	
+	return $ret;
+}
+
+?>
Index: /branches/mobile/html/admin/mail/htmlmail_select.php
===================================================================
--- /branches/mobile/html/admin/mail/htmlmail_select.php	(revision 5934)
+++ /branches/mobile/html/admin/mail/htmlmail_select.php	(revision 5934)
@@ -0,0 +1,135 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = "del_flg = 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 AS noncls ";
+		
+	$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: /branches/mobile/html/admin/mail/htmlmail.php
===================================================================
--- /branches/mobile/html/admin/mail/htmlmail.php	(revision 5934)
+++ /branches/mobile/html/admin/mail/htmlmail.php	(revision 5934)
@@ -0,0 +1,369 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg = 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: /branches/mobile/html/admin/mail/inc_mailmagazine.php
===================================================================
--- /branches/mobile/html/admin/mail/inc_mailmagazine.php	(revision 5934)
+++ /branches/mobile/html/admin/mail/inc_mailmagazine.php	(revision 5934)
@@ -0,0 +1,265 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * 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 AS allcls 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 AS allcls 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 del_flg = 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: /branches/mobile/html/admin/mail/index.php
===================================================================
--- /branches/mobile/html/admin/mail/index.php	(revision 6410)
+++ /branches/mobile/html/admin/mail/index.php	(revision 6410)
@@ -0,0 +1,416 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = DATA_PATH . '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 = "dtb_customer.customer_id,
+			dtb_customer.name01,
+			dtb_customer.name02,
+			dtb_customer.kana01,
+			dtb_customer.kana02,
+			dtb_customer.sex,
+			dtb_customer.email,
+			dtb_customer.tel01,
+			dtb_customer.tel02,
+			dtb_customer.tel03,
+			dtb_customer.pref,
+			dtb_customer_mail.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);
+			if(MELMAGA_SEND == true) {			
+				header("Location: " . URL_DIR . "admin/mail/sendmail.php?mode=now");
+				exit;
+			} else {
+				sfErrorHeader(">> ËÜ¥µ¥¤¥È¤Ç¤Ï¥á¥ë¥Þ¥¬ÇÛ¿®¤Ï¹Ô¤¨¤Þ¤»¤ó¡£");
+			}
+		}
+	}
+	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 = "dtb_order.customer_id, dtb_order.order_id";
+		$from = "dtb_order LEFT JOIN dtb_order_detail USING(order_id)";
+		$where = "product_code LIKE ? AND del_flg = 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;
+	
+	$objQuery = new SC_Query();
+		
+	$objSelect = new SC_CustomerList( lfConvertParam($arrData, $arrSearchColumn), "magazine" );
+	$search_data = $conn->getAll($objSelect->getListMailMagazine(), $objSelect->arrVal);
+	$dataCnt = count($search_data);
+	
+	$dtb_send_history = array();
+	if (DB_TYPE == "pgsql") {
+		$dtb_send_history["send_id"] = $objQuery->nextval('dtb_send_history', 'send_id');
+	}
+	$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);
+	$dtb_send_history["update_date"] = "now()";
+	$dtb_send_history["create_date"] = "now()";
+	$objQuery->insert("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: /branches/mobile/html/admin/mail/template_input.php
===================================================================
--- /branches/mobile/html/admin/mail/template_input.php	(revision 5934)
+++ /branches/mobile/html/admin/mail/template_input.php	(revision 5934)
@@ -0,0 +1,130 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg = 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'];
+	$sqlval['update_date'] = "now()";
+
+	if ( $id ){
+		$query->update("dtb_mailmaga_template", $sqlval, "template_id=".$id );
+	} else {
+		$sqlval['create_date'] = "now()";
+		$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: /branches/mobile/html/admin/mail/template.php
===================================================================
--- /branches/mobile/html/admin/mail/template.php	(revision 5934)
+++ /branches/mobile/html/admin/mail/template.php	(revision 5934)
@@ -0,0 +1,54 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg = 1 WHERE template_id = ?";
+	$conn->query($sql, array($_GET['id']));
+	sfReload();
+}
+
+
+$sql = "SELECT *, (substring(create_date, 1, 19)) as disp_date FROM dtb_mailmaga_template WHERE del_flg = 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: /branches/mobile/html/admin/mail/sendmail.php
===================================================================
--- /branches/mobile/html/admin/mail/sendmail.php	(revision 6406)
+++ /branches/mobile/html/admin/mail/sendmail.php	(revision 6406)
@@ -0,0 +1,169 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir."/../require.php");
+$conn = new SC_DbConn();
+$objSite = new SC_SiteInfo($conn);
+
+if(MELMAGA_SEND != true) {
+	exit;
+}
+
+if($_GET['mode'] == 'now') {
+	//----¡¡Ì¤Á÷¿®¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+	$time_data = $conn->getAll( "SELECT send_id FROM dtb_send_history  WHERE complete_count = 0 AND del_flg = 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 del_flg = 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: " . URL_DIR . "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: /branches/mobile/html/admin/mail/history.php
===================================================================
--- /branches/mobile/html/admin/mail/history.php	(revision 5943)
+++ /branches/mobile/html/admin/mail/history.php	(revision 5943)
@@ -0,0 +1,66 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg = 1 WHERE send_id = ?";
+	$conn->query($sql, array($_GET['send_id']) );
+	sfReload();
+
+}	
+	$col = "*";
+	$from = "dtb_send_history";
+	
+	$where .= " del_flg = ?";
+	$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: /branches/mobile/html/admin/mail/preview.php
===================================================================
--- /branches/mobile/html/admin/mail/preview.php	(revision 5934)
+++ /branches/mobile/html/admin/mail/preview.php	(revision 5934)
@@ -0,0 +1,100 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 AS allcls 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: /branches/mobile/html/admin/total/index.php
===================================================================
--- /branches/mobile/html/admin/total/index.php	(revision 10400)
+++ /branches/mobile/html/admin/total/index.php	(revision 10400)
@@ -0,0 +1,820 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = URL_DIR.'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'] = "²ñ°÷ÊÌ½¸·×";
+		
+		// ¥­¥ã¥Ã¥·¥å²óÈò¤Î¤¿¤á¤ËÆüÉÕ¤òÅÏ¤¹
+		$this->cashtime = time();
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objSess = new SC_Session();
+// Ç§¾Ú²ÄÈÝ¤ÎÈ½Äê
+sfIsSuccess($objSess);
+
+// ÆþÎÏ´ü´Ö¤ò¥»¥Ã¥·¥ç¥ó¤Ëµ­Ï¿¤¹¤ë
+lfSaveDateSession();
+
+if($_GET['draw_image'] != ""){
+	define(DRAW_IMAGE , true);
+}else{
+	define(DRAW_IMAGE , false);
+}
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+$objFormParam->setParam($_POST);
+$objFormParam->setParam($_GET);
+
+// ¸¡º÷¥ï¡¼¥É¤Î°ú¤­·Ñ¤®
+foreach ($_POST as $key => $val) {
+	if (ereg("^search_", $key)) {
+		$objPage->arrHidden[$key] = $val;		
+	}
+}
+
+$mode = $objFormParam->getValue('mode');
+switch($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 = $objFormParam->getValue('search_startyear') . "/" . $objFormParam->getValue('search_startmonth') . "/" . $objFormParam->getValue('search_startday');
+				break;
+			case 'search_endyear':
+				$edate = $objFormParam->getValue('search_endyear') . "/" . $objFormParam->getValue('search_endmonth') . "/" . $objFormParam->getValue('search_endday');
+				break;
+			case 'search_startyear_m':
+				list($sdate, $edate) = sfTermMonth($objFormParam->getValue('search_startyear_m'), $objFormParam->getValue('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, true, $mode);
+			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($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($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, $page);
+			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, $page = "") {
+	
+	$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 && $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");
+	$objFormParam->addParam("", "mode");
+
+}
+
+/* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */
+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();
+		
+		// ¥°¥é¥Õ¤Î½ÐÎÏ
+		if(DRAW_IMAGE){
+			$objGraphLine->outputGraph();
+			exit();
+		}
+
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$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;
+		
+		$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();
+		
+		// ¥°¥é¥Õ¤Î½ÐÎÏ
+		if(DRAW_IMAGE){
+			$objGraphPie->outputGraph();
+			exit();
+		}
+
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$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;
+		
+		$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();
+		
+		if(DRAW_IMAGE){
+			$objGraphBar->outputGraph();
+			exit();
+		}
+		
+		// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤òÊÖ¤¹
+		$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 ";
+		}
+		$edate = date("Y/m/d",strtotime("1 day" ,strtotime($edate)));	
+		$where.= " $col_date < date('" . $edate ."')";
+	}
+	
+	// ²ñ°÷¡¢Èó²ñ°÷¤ÎÈ½Äê
+	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, (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 del_flg = 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 del_flg = 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, $mode = "") {
+	list($where, $arrval) = lfGetWhereMember('create_date', $sdate, $edate, $type);
+	
+	$sql = "SELECT T1.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($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, (AVG(total)) AS total_average ";
+	$sql.= "FROM dtb_customer AS T1 LEFT JOIN dtb_order AS T2 USING ( customer_id ) WHERE $where AND T2.del_flg = 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, (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 ";
+			}
+			$edate_next = date("Y/m/d",strtotime("1 day" ,strtotime($edate)));
+			$where.= " order_date < date('" . $edate_next ."')";
+		}
+		
+		// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+		$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: /branches/mobile/html/admin/total/class/SC_GraphLine.php
===================================================================
--- /branches/mobile/html/admin/total/class/SC_GraphLine.php	(revision 6578)
+++ /branches/mobile/html/admin/total/class/SC_GraphLine.php	(revision 6578)
@@ -0,0 +1,288 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+$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) + 30;
+			$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;
+				
+				if ($bar) $bar_margin = -15;
+
+				$this->setText(FONT_SIZE, $x_pos + $this->x_margin + $bar_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: /branches/mobile/html/admin/total/class/SC_GraphBase.php
===================================================================
--- /branches/mobile/html/admin/total/class/SC_GraphBase.php	(revision 7208)
+++ /branches/mobile/html/admin/total/class/SC_GraphBase.php	(revision 7208)
@@ -0,0 +1,226 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+/*
+$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", CHAR_CODE);
+		$text = mb_convert_encoding($text, CHAR_CODE);
+		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", CHAR_CODE);
+		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: /branches/mobile/html/admin/total/class/SC_GraphPie.php
===================================================================
--- /branches/mobile/html/admin/total/class/SC_GraphPie.php	(revision 5934)
+++ /branches/mobile/html/admin/total/class/SC_GraphPie.php	(revision 5934)
@@ -0,0 +1,200 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+$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: /branches/mobile/html/admin/total/class/config.php
===================================================================
--- /branches/mobile/html/admin/total/class/config.php	(revision 6588)
+++ /branches/mobile/html/admin/total/class/config.php	(revision 6588)
@@ -0,0 +1,96 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ *	¶¦ÄÌ 
+*/
+// TTF¥Õ¥©¥ó¥È¥Õ¥¡¥¤¥ë
+define("FONT_PATH", DATA_PATH . "fonts/wlmaru20044.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", -5);		// 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(0, 0, 0);
+// Ê¸»ú¿§
+$ARR_TEXT_COLOR = array(0, 0, 0);
+// ÇØ·Ê¥«¥é¡¼
+$ARR_BG_COLOR = array(255,255,255);	
+// ¥¿¥¤¥È¥ëÊ¸»ú¿§
+$ARR_TITLE_COLOR = array(0, 0, 0);
+// ¥°¥ê¥Ã¥ÉÀþ¿§
+$ARR_GRID_COLOR = array(200, 200, 200);
+// ¥Þ¡¼¥¯¤Î¿§
+$ARR_MARK_COLOR = array(130, 130, 255);
+
+
+?>
Index: /branches/mobile/html/admin/total/class/lib.php
===================================================================
--- /branches/mobile/html/admin/total/class/lib.php	(revision 7180)
+++ /branches/mobile/html/admin/total/class/lib.php	(revision 7180)
@@ -0,0 +1,61 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+// ±ß¤ÎÃæ¿´ÅÀ¤ÈÄ¾·Â¤«¤é¸Ì¤Î½ªÃ¼ºÂÉ¸¤ò»»½Ð¤¹¤ë¡£
+/*
+	$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", CHAR_CODE);
+	// É½¼¨³ÑÅÙ	
+	$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: /branches/mobile/html/admin/total/class/SC_GraphBar.php
===================================================================
--- /branches/mobile/html/admin/total/class/SC_GraphBar.php	(revision 6578)
+++ /branches/mobile/html/admin/total/class/SC_GraphBar.php	(revision 6578)
@@ -0,0 +1,83 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+$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: /branches/mobile/html/admin/total/index_sub.php
===================================================================
--- /branches/mobile/html/admin/total/index_sub.php	(revision 5934)
+++ /branches/mobile/html/admin/total/index_sub.php	(revision 5934)
@@ -0,0 +1,246 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/cart/index.php
===================================================================
--- /branches/mobile/html/cart/index.php	(revision 10399)
+++ /branches/mobile/html/cart/index.php	(revision 10399)
@@ -0,0 +1,113 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 = URL_DIR.'css/layout/cartin/index.css';	// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'cart/index.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = "¥«¥´¤ÎÃæ¤ò¸«¤ë";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView(false);
+$objCartSess = new SC_CartSession("", false);
+$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: " . 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;
+
+// Á°ÊÇ¤ÎURL¤ò¼èÆÀ
+$objPage->tpl_prev_url = $objCartSess->getPrevURL();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/contact/index.php
===================================================================
--- /branches/mobile/html/contact/index.php	(revision 10398)
+++ /branches/mobile/html/contact/index.php	(revision 10398)
@@ -0,0 +1,208 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/contact/complete.php
===================================================================
--- /branches/mobile/html/contact/complete.php	(revision 10399)
+++ /branches/mobile/html/contact/complete.php	(revision 10399)
@@ -0,0 +1,27 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css[1] = URL_DIR.'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: /branches/mobile/html/abouts/index.php
===================================================================
--- /branches/mobile/html/abouts/index.php	(revision 10399)
+++ /branches/mobile/html/abouts/index.php	(revision 10399)
@@ -0,0 +1,30 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/regist/index.php
===================================================================
--- /branches/mobile/html/regist/index.php	(revision 10399)
+++ /branches/mobile/html/regist/index.php	(revision 10399)
@@ -0,0 +1,196 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+//---- ¥Ú¡¼¥¸É½¼¨¥¯¥é¥¹
+class LC_Page {
+	
+	var $arrSession;
+	var $tpl_mainpage;
+	var $arrPref;
+
+	function LC_Page() {
+		$this->tpl_css = URL_DIR.'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"]));
+
+	/* ¹ØÆþ»þ¤Î¼«Æ°²ñ°÷ÅÐÏ¿¤Ï¹Ô¤ï¤Ê¤¤¤¿¤áDEL
+	// ¹ØÆþ»þÅÐÏ¿¤Î¾ì¹ç¡¢¤½¤Î²ó¤Î¹ØÆþ¤ò²ñ°÷¹ØÆþ¤È¤ß¤Ê¤¹¡£
+	// ²ñ°÷¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+	$where1 = "secret_key = ? AND status = 2";
+	$customer = $objQuery->select("*", "dtb_customer", $where1, array($secret));
+	// ½é²ó¹ØÆþ¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+	$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 del_flg = 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: /branches/mobile/html/regist/complete.php
===================================================================
--- /branches/mobile/html/regist/complete.php	(revision 10399)
+++ /branches/mobile/html/regist/complete.php	(revision 10399)
@@ -0,0 +1,27 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = 'regist/complete.tpl';
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/index.php
===================================================================
--- /branches/mobile/html/index.php	(revision 10399)
+++ /branches/mobile/html/index.php	(revision 10399)
@@ -0,0 +1,30 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("./require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_css = URL_DIR.'css/layout/index.css';						// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = HTML_PATH . "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: /branches/mobile/html/inquiry/index.php
===================================================================
--- /branches/mobile/html/inquiry/index.php	(revision 5934)
+++ /branches/mobile/html/inquiry/index.php	(revision 5934)
@@ -0,0 +1,243 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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]; 
+				}
+			}
+			$objPage->arrForm['create_date'] = "now()";
+			// £Ä£ÂÅÐÏ¿
+			$objQuery = new SC_Query();
+			$objQuery->insert("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: /branches/mobile/html/entry/kiyaku.php
===================================================================
--- /branches/mobile/html/entry/kiyaku.php	(revision 5934)
+++ /branches/mobile/html/entry/kiyaku.php	(revision 5934)
@@ -0,0 +1,39 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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", "del_flg <> 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: /branches/mobile/html/entry/index.php
===================================================================
--- /branches/mobile/html/entry/index.php	(revision 10399)
+++ /branches/mobile/html/entry/index.php	(revision 10399)
@@ -0,0 +1,328 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = URL_DIR.'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"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
+	
+	$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È¯¹Ô
+	$arrRegist["create_date"] = "now()"; 	// ºîÀ®Æü
+	$arrRegist["update_date"] = "now()"; 	// ¹¹¿·Æü
+	$arrRegist["first_buy_date"] = "";	 	// ºÇ½é¤Î¹ØÆþÆü
+	
+	//-- ²¾ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+
+	$objQuery = new SC_Query();
+	$objQuery->insert("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; 
+	}
+	$arrRegistMail["update_date"] = "now()";
+	
+	// Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¾ì¹ç
+	if ($mailResult == 1) {		
+		$objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");			
+	} else {				//¡¡¿·µ¬ÅÐÏ¿¤Î¾ì¹ç
+		$arrRegistMail["create_date"] = "now()";
+		$objQuery->insert("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, del_flg", "dtb_customer","email ILIKE ? ORDER BY del_flg", array($array["email"]));
+				
+		if(count($arrRet) > 0) {
+			if($arrRet[0]['del_flg'] != '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: /branches/mobile/html/entry/complete.php
===================================================================
--- /branches/mobile/html/entry/complete.php	(revision 10399)
+++ /branches/mobile/html/entry/complete.php	(revision 10399)
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/frontparts/login_check.php
===================================================================
--- /branches/mobile/html/frontparts/login_check.php	(revision 5934)
+++ /branches/mobile/html/frontparts/login_check.php	(revision 5934)
@@ -0,0 +1,75 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg = 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: /branches/mobile/html/frontparts/bloc/best5.php
===================================================================
--- /branches/mobile/html/frontparts/bloc/best5.php	(revision 8385)
+++ /branches/mobile/html/frontparts/bloc/best5.php	(revision 8385)
@@ -0,0 +1,43 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+class LC_Best5Page {
+	function LC_Best5Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = BLOC_PATH . 'best5.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_Best5Page();
+$objSubView = new SC_SiteView();
+$objSiteInfo = $objView->objSiteInfo;
+
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objSiteInfo = new SC_SiteInfo();
+$objSubPage->arrInfo = $objSiteInfo->data;
+
+//¤ª¤¹¤¹¤á¾¦ÉÊÉ½¼¨
+$objSubPage->arrBestProducts = lfGetRanking();
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+//¤ª¤¹¤¹¤á¾¦ÉÊ¸¡º÷
+function lfGetRanking(){
+	$objQuery = new SC_Query();
+	
+	$col = "A.*, name, price02_min, price01_min, main_list_image ";
+	$from = "dtb_best_products AS A INNER JOIN vw_products_allclass AS allcls using(product_id)";
+	$where = "status = 1";
+	$order = "rank";
+	$objQuery->setorder($order);
+	
+	$arrBestProducts = $objQuery->select($col, $from, $where);
+		
+	return $arrBestProducts;
+}
+
+?>
Index: /branches/mobile/html/frontparts/bloc/login.php
===================================================================
--- /branches/mobile/html/frontparts/bloc/login.php	(revision 6772)
+++ /branches/mobile/html/frontparts/bloc/login.php	(revision 6772)
@@ -0,0 +1,58 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+class LC_LoginPage {
+	var $tpl_login_email;
+	function LC_LoginPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = BLOC_PATH . '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: /branches/mobile/html/frontparts/bloc/search_products.php
===================================================================
--- /branches/mobile/html/frontparts/bloc/search_products.php	(revision 6080)
+++ /branches/mobile/html/frontparts/bloc/search_products.php	(revision 6080)
@@ -0,0 +1,34 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+class LC_SearchProductsPage {
+	function LC_SearchProductsPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = BLOC_PATH . '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: /branches/mobile/html/frontparts/bloc/cart.php
===================================================================
--- /branches/mobile/html/frontparts/bloc/cart.php	(revision 6372)
+++ /branches/mobile/html/frontparts/bloc/cart.php	(revision 6372)
@@ -0,0 +1,66 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+class LC_CartPage {
+	function LC_CartPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = BLOC_PATH . 'cart.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_CartPage();
+$objSubView = new SC_SiteView();
+$objCart = new SC_CartSession();
+$objSiteInfo = new SC_SiteInfo;
+
+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: /branches/mobile/html/frontparts/bloc/news.php
===================================================================
--- /branches/mobile/html/frontparts/bloc/news.php	(revision 6080)
+++ /branches/mobile/html/frontparts/bloc/news.php	(revision 6080)
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+class LC_NewsPage {
+	function LC_NewsPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = BLOC_PATH . '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 *, cast(substring(news_date,1,10) as date) as news_date_disp FROM dtb_news WHERE del_flg = '0' ORDER BY rank DESC";
+	$list_data = $conn->getAll($sql);
+	return $list_data;	
+}
+?>
Index: /branches/mobile/html/frontparts/bloc/category.php
===================================================================
--- /branches/mobile/html/frontparts/bloc/category.php	(revision 6080)
+++ /branches/mobile/html/frontparts/bloc/category.php	(revision 6080)
@@ -0,0 +1,61 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+class LC_CatPage {
+	function LC_CatPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = BLOC_PATH . '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 = "del_flg = 0 AND product_count > 0";
+	} else {
+		$where = "del_flg = 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: /branches/mobile/html/require.php
===================================================================
--- /branches/mobile/html/require.php	(revision 11409)
+++ /branches/mobile/html/require.php	(revision 11409)
@@ -0,0 +1,52 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir . "/../data/conf/conf.php");	
+require_once($include_dir . "/../data/include/module.inc");
+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/class/GC_MobileUserAgent.php");
+require_once($include_dir . "/../data/class/GC_MobileEmoji.php");
+require_once($include_dir . "/../data/include/page_layout.inc");
+
+// ¥¢¥Ã¥×¥Ç¡¼¥È¤Ç¼èÆÀ¤·¤¿PHP¤òÆÉ¤ß½Ð¤¹
+sfLoadUpdateModule();
+
+// ·ÈÂÓÃ¼Ëö¤Î¾ì¹ç¤Ï mobile °Ê²¼¤Ø¥ê¥À¥¤¥ì¥¯¥È¤¹¤ë¡£
+if (GC_MobileUserAgent::isMobile()) {
+	if (preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['REQUEST_URI'], $matches)) {
+		$path = $matches[1];
+	} else {
+		$path = '';
+	}
+	header("Location: " . URL_DIR . "mobile/$path");
+	exit;
+}
+
+// ³¨Ê¸»úÊÑ´¹ (½üµî) ¥Õ¥£¥ë¥¿¡¼¤òÁÈ¤ß¹þ¤à¡£
+ob_start(array('GC_MobileEmoji', 'handler'));
+?>
Index: /branches/mobile/html/install/user_data/templates/default1/css/contents.css
===================================================================
--- /branches/mobile/html/install/user_data/templates/default1/css/contents.css	(revision 10501)
+++ /branches/mobile/html/install/user_data/templates/default1/css/contents.css	(revision 10501)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+ 
+@charset "<!--{$smarty.const.CHAR_CODE}-->";
+
+/*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: /branches/mobile/html/install/user_data/css/contents.css
===================================================================
--- /branches/mobile/html/install/user_data/css/contents.css	(revision 7187)
+++ /branches/mobile/html/install/user_data/css/contents.css	(revision 7187)
@@ -0,0 +1,78 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+@charset "<!--{$smarty.const.CHAR_CODE}-->";
+
+/*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: /branches/mobile/html/install/index.php
===================================================================
--- /branches/mobile/html/install/index.php	(revision 11457)
+++ /branches/mobile/html/install/index.php	(revision 11457)
@@ -0,0 +1,877 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+$INSTALL_DIR = realpath(dirname( __FILE__));
+require_once("../../data/module/Request.php");
+
+define("INSTALL_LOG", "./temp/install.log");
+
+class LC_Page {
+	function LC_Page() {
+		$this->arrDB_TYPE = array(
+			'pgsql' => 'PostgreSQL',
+			'mysql' => 'MySQL'	
+		);
+		$this->arrDB_PORT = array(
+			'pgsql' => '',
+			'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();
+	$dsn = $arrRet['db_type']."://".$arrRet['db_user'].":".$arrRet['db_password']."@".$arrRet['db_server'].":".$arrRet['db_port']."/".$arrRet['db_name'];
+	
+	/*
+		lfAddTable¤Ï¡¢¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×Åù¤ÇÄÉ²Ã¥Æ¡¼¥Ö¥ë¤¬È¯À¸¤·¤¿¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
+		¡Ê£Ä£Â¹½À®¤Î²¼°Ì¸ß´¹¤Î¤¿¤á¥¹¥­¥Ã¥×»þ¤â¶¯À©¡Ë
+	*/
+	// ¥Æ¡¼¥Ö¥ë¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤ËÄÉ²Ã¤µ¤ì¤ë¡£
+	$objPage->arrErr = lfAddTable("dtb_session", $dsn);	// ¥»¥Ã¥·¥ç¥ó´ÉÍý¥Æ¡¼¥Ö¥ë
+	// ¥Æ¡¼¥Ö¥ë¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤ËÄÉ²Ã¤µ¤ì¤ë¡£
+	$objPage->arrErr = lfAddTable("dtb_module", $dsn);	// ¥»¥Ã¥·¥ç¥ó´ÉÍý¥Æ¡¼¥Ö¥ë
+	// ¥Æ¡¼¥Ö¥ë¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤ËÄÉ²Ã¤µ¤ì¤ë¡£
+	$objPage->arrErr = lfAddTable("dtb_mobile_kara_mail", $dsn);	// ¶õ¥á¡¼¥ë´ÉÍý¥Æ¡¼¥Ö¥ë
+	// ¥Æ¡¼¥Ö¥ë¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤ËÄÉ²Ã¤µ¤ì¤ë¡£
+	$objPage->arrErr = lfAddTable("dtb_mobile_ext_session_id", $dsn);	// ¥»¥Ã¥·¥ç¥óID´ÉÍý¥Æ¡¼¥Ö¥ë
+	
+	// ¥«¥é¥à¤òÄÉ²Ã
+	lfAddColumn($dsn);
+
+	if(count($objPage->arrErr) == 0) {
+		// ¥¹¥­¥Ã¥×¤¹¤ë¾ì¹ç¤Ë¤Ï¼¡²èÌÌ¤ØÁ«°Ü
+		$skip = $_POST["db_skip"];
+		if ($skip == "on") {
+			// ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÀ¸À®
+			lfMakeConfigFile();
+			//$objPage = lfDispComplete($objPage);
+			$objPage = lfDispStep4($objPage);
+			break;
+		}
+	}
+	
+	// ¥Æ¡¼¥Ö¥ë¤ÎºîÀ®
+	$objPage->arrErr = lfExecuteSQL("./sql/create_table_".$arrRet['db_type'].".sql", $dsn); 
+	if(count($objPage->arrErr) == 0) {
+		$objPage->tpl_message.="¡û¡§¥Æ¡¼¥Ö¥ë¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+	} else {
+		$objPage->tpl_message.="¡ß¡§¥Æ¡¼¥Ö¥ë¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+	}
+
+	// ¥Ó¥å¡¼¤ÎºîÀ®
+	if(count($objPage->arrErr) == 0 and $arrRet['db_type'] == 'pgsql') {
+		// ¥Ó¥å¡¼¤ÎºîÀ®
+		$objPage->arrErr = lfExecuteSQL("./sql/create_view.sql", $dsn); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥Ó¥å¡¼¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥Ó¥å¡¼¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ½é´ü¥Ç¡¼¥¿¤ÎºîÀ®
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./sql/insert_data.sql", $dsn); 
+		
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§½é´ü¥Ç¡¼¥¿¤ÎºîÀ®¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§½é´ü¥Ç¡¼¥¿¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./sql/column_comment.sql", $dsn); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥«¥é¥à¥³¥á¥ó¥È¤Î½ñ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}	
+	
+	// ¥Æ¡¼¥Ö¥ë¥³¥á¥ó¥È¤Î½ñ¹þ¤ß
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./sql/table_comment.sql", $dsn); 
+		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 = 'step4';
+	} else {
+		$objPage = lfDispStep3($objPage);
+	}
+	break;
+case 'step4':
+	$objPage = lfDispStep4($objPage);
+	break;
+	
+// ¥Æ¡¼¥Ö¥ëÎàºï½ü
+case 'drop':
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objDBParam->getHashArray();
+	$dsn = $arrRet['db_type']."://".$arrRet['db_user'].":".$arrRet['db_password']."@".$arrRet['db_server'].":".$arrRet['db_port']."/".$arrRet['db_name'];
+	
+	// ÄÉ²Ã¥Æ¡¼¥Ö¥ë¤¬¤¢¤ì¤Ðºï½ü¤¹¤ë¡£
+	lfDropTable("dtb_module", $dsn);
+	lfDropTable("dtb_session", $dsn);
+		
+	if ($arrRet['db_type'] == 'pgsql'){
+		// ¥Ó¥å¡¼¤Îºï½ü
+		$objPage->arrErr = lfExecuteSQL("./sql/drop_view.sql", $dsn, false); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥Ó¥å¡¼¤Îºï½ü¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥Ó¥å¡¼¤Îºï½ü¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}
+
+	// ¥Æ¡¼¥Ö¥ë¤Îºï½ü
+	if(count($objPage->arrErr) == 0) {
+		$objPage->arrErr = lfExecuteSQL("./sql/drop_table.sql", $dsn, false); 
+		if(count($objPage->arrErr) == 0) {
+			$objPage->tpl_message.="¡û¡§¥Æ¡¼¥Ö¥ë¤Îºï½ü¤ËÀ®¸ù¤·¤Þ¤·¤¿¡£<br>";
+		} else {
+			$objPage->tpl_message.="¡ß¡§¥Æ¡¼¥Ö¥ë¤Îºï½ü¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";		
+		}
+	}
+	$objPage = lfDispStep3($objPage);
+	break;
+// ´°Î»²èÌÌ
+case 'complete':
+	// ¥·¥ç¥Ã¥×¥Þ¥¹¥¿¾ðÊó¤Î½ñ¤­¹þ¤ß
+	$arrRet =  $objDBParam->getHashArray();
+	
+	$dsn = $arrRet['db_type']."://".$arrRet['db_user'].":".$arrRet['db_password']."@".$arrRet['db_server'].":".$arrRet['db_port']."/".$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);		
+	}
+
+	// ´ÉÍý¼ÔÅÐÏ¿
+	$login_id = $objWebParam->getValue('login_id');
+	$login_pass = sha1($objWebParam->getValue('login_pass') . ":" . AUTH_MAGIC);
+	
+	$sql = "DELETE FROM dtb_member WHERE login_id = ?";
+	$objQuery->query($sql, array($login_id));	
+
+	$sql = "INSERT INTO dtb_member (name, login_id, password, creator_id, authority, work, del_flg, rank, create_date, update_date)
+			VALUES ('´ÉÍý¼Ô',?,?,0,0,1,0,1, now(), now());";
+	
+	$objQuery->query($sql, array($login_id, $login_pass));		
+	
+	global $GLOBAL_ERR;
+	$GLOBAL_ERR = "";
+	$objPage = lfDispComplete($objPage);
+	
+	// ¥µ¥¤¥È¾ðÊó¤òÁ÷¿®¤·¤Æ¤âÎÉ¤¤¾ì¹ç¤Ë¤ÏÁ÷¤ë
+	if($_POST['send_info'] == "true"){
+		$req = new HTTP_Request("http://www.ec-cube.net/mall/use_site.php");
+		$req->setMethod(HTTP_REQUEST_METHOD_POST);
+		
+		$arrSendData = array();
+		foreach($_POST as $key => $val){
+			if (ereg("^senddata_*", $key)){
+				$arrSendDataTmp = array(str_replace("senddata_", "", $key) => $val);
+				$arrSendData = array_merge($arrSendData, $arrSendDataTmp);
+			}
+		}
+		
+		$req->addPostDataArray($arrSendData);
+		
+		if (!PEAR::isError($req->sendRequest())) {
+			$response1 = $req->getResponseBody();
+		} else {
+			$response1 = "";
+		}
+		$req->clearPostData();
+	}
+	
+	break;
+case 'return_step0':
+	$objPage = lfDispStep0($objPage);
+	break;	
+case 'return_step1':
+	$objPage = lfDispStep1($objPage);
+	break;
+case 'return_step2':
+	$objPage = lfDispStep2($objPage);
+	break;
+case 'return_step3':
+	$objPage = lfDispStep3($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->arrHidden['db_skip'] = $_POST['db_skip'];
+	$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->arrHidden['db_skip'] = $_POST['db_skip'];
+	$objPage->tpl_mainpage = 'step0.tpl';
+	$objPage->tpl_mode = 'step0';
+	
+	// ¥×¥í¥°¥é¥à¤Ç½ñ¹þ¤ß¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥ì¥¯¥È¥ê
+	$arrWriteFile = array(
+		"../../data/install.inc",
+		"../../data/install_mobile.inc",
+		"../user_data",
+		"../upload",
+		"../mobile/converted_images",
+		"../../data/Smarty/templates_c",
+		"../../data/downloads",
+		"../../data/logs"
+	);
+	
+	$mess = "";
+	$err_file = false;
+	foreach($arrWriteFile as $val) {
+		if(file_exists($val)) {
+			$mode = lfGetFileMode($val);
+			$real_path = realpath($val);
+						
+			// ¥Ç¥£¥ì¥¯¥È¥ê¤Î¾ì¹ç
+			if(is_dir($val)) {
+				if($mode == "777") {
+					$mess.= ">> ¡û¡§$real_path($mode) <br>¥¢¥¯¥»¥¹¸¢¸Â¤ÏÀµ¾ï¤Ç¤¹¡£<br>";					
+				} else {
+					$mess.= ">> ¡ß¡§$real_path($mode) <br>¥æ¡¼¥¶½ñ¹þ¤ß¸¢¸Â(777)¤òÉÕÍ¿¤·¤Æ²¼¤µ¤¤¡£<br>";
+					$err_file = true;										
+				}
+			} else {
+				if($mode == "666") {
+					$mess.= ">> ¡û¡§$real_path($mode) <br>¥¢¥¯¥»¥¹¸¢¸Â¤ÏÀµ¾ï¤Ç¤¹¡£<br>";					
+				} else {
+					$mess.= ">> ¡ß¡§$real_path($mode) <br>¥æ¡¼¥¶½ñ¹þ¤ß¸¢¸Â(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 = "../upload/save_image";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../upload/temp_image";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../upload/graph_image";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../upload/csv";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../../data/downloads/module";
+		if(!file_exists($path)) {
+			mkdir($path);
+		}
+		$path = "../../data/downloads/update";
+		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->arrHidden['db_skip'] = $_POST['db_skip'];
+	$objPage->tpl_mainpage = 'step0_1.tpl';
+	$objPage->tpl_mode = 'step0_1';
+	// ¥Õ¥¡¥¤¥ë¥³¥Ô¡¼
+	$objPage->copy_mess = sfCopyDir("./user_data/", "../user_data/", $objPage->copy_mess);
+	$objPage->copy_mess = sfCopyDir("./save_image/", "../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->arrHidden['db_skip'] = $_POST['db_skip'];
+	$objPage->tpl_mainpage = 'step1.tpl';
+	$objPage->tpl_mode = 'step1';
+	return $objPage;
+}
+
+// STEP2²èÌÌ¤ÎÉ½¼¨
+function lfDispStep2($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	$objPage->arrHidden['db_skip'] = $_POST['db_skip'];
+	$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_db_skip = $_POST['db_skip'];
+	$objPage->tpl_mainpage = 'step3.tpl';
+	$objPage->tpl_mode = 'step3';
+	return $objPage;
+}
+
+// STEP4²èÌÌ¤ÎÉ½¼¨
+function lfDispStep4($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+
+	$normal_url = $objWebParam->getValue('normal_url');
+	// ¸ìÈø¤Ë'/'¤ò¤Ä¤±¤ë
+	if (!ereg("/$", $normal_url)) $normal_url = $normal_url . "/";
+
+	$arrDbParam = $objDBParam->getHashArray();
+	$dsn = $arrDbParam['db_type']."://".$arrDbParam['db_user'].":".$arrDbParam['db_password']."@".$arrDbParam['db_server'].":".$arrDbParam['db_port']."/".$arrDbParam['db_name'];
+
+	$objPage->tpl_site_url = $normal_url;
+	$objPage->tpl_shop_name = $objWebParam->getValue('shop_name');
+	$objPage->tpl_cube_ver = ECCUBE_VERSION;
+	$objPage->tpl_php_ver = phpversion();
+	$objPage->tpl_db_ver = sfGetDBVersion($dsn);
+	$objPage->tpl_db_skip = $_POST['db_skip'];
+	$objPage->tpl_mainpage = 'step4.tpl';
+	$objPage->tpl_mode = 'complete';
+	return $objPage;
+}
+
+// ´°Î»²èÌÌ¤ÎÉ½¼¨
+function lfDispComplete($objPage) {
+	global $objWebParam;
+	global $objDBParam;
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = $objWebParam->getHashArray();
+	// hidden¤ËÆþÎÏÃÍ¤òÊÝ»ý
+	$objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
+	$objPage->arrHidden['db_skip'] = $_POST['db_skip'];
+	$objPage->tpl_mainpage = 'complete.tpl';
+	$objPage->tpl_mode = 'complete';
+	
+	$secure_url = $objWebParam->getValue('secure_url');
+	// ¸ìÈø¤Ë'/'¤ò¤Ä¤±¤ë
+	if (!ereg("/$", $secure_url)) {
+		$secure_url = $secure_url . "/";
+	}
+	$objPage->tpl_sslurl = $secure_url;		
+	return $objPage;
+}
+
+// WEB¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+function lfInitWebParam($objWebParam) {
+	
+	if(defined('HTML_PATH')) {
+		$install_dir = HTML_PATH;
+	} else {
+		$install_dir = realpath(dirname( __FILE__) . "/../") . "/";
+	}
+	
+	if(defined('SITE_URL')) {
+		$normal_url = SITE_URL;
+	} else {
+		$dir = ereg_replace("install/.*$", "", $_SERVER['REQUEST_URI']);
+		$normal_url = "http://" . $_SERVER['HTTP_HOST'] . $dir;
+	}
+	
+	if(defined('SSL_URL')) {
+		$secure_url = SSL_URL;
+	} else {
+		$dir = ereg_replace("install/.*$", "", $_SERVER['REQUEST_URI']);
+		$secure_url = "http://" . $_SERVER['HTTP_HOST'] . $dir;
+	}
+
+	// Å¹Ì¾¡¢´ÉÍý¼Ô¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¼èÆÀ¤¹¤ë¡£(ºÆ¥¤¥ó¥¹¥È¡¼¥ë»þ)
+	if(defined('DEFAULT_DSN')) {
+		$ret = sfTabaleExists("dtb_baseinfo", DEFAULT_DSN);
+		if($ret) {
+			$objQuery = new SC_Query();
+			$arrRet = $objQuery->select("shop_name, email01", "dtb_baseinfo");
+			$shop_name = $arrRet[0]['shop_name'];
+			$admin_mail = $arrRet[0]['email01'];
+		}
+	}
+
+	$objWebParam->addParam("Å¹Ì¾", "shop_name", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $shop_name);
+	$objWebParam->addParam("´ÉÍý¼Ô¡§¥á¡¼¥ë¥¢¥É¥ì¥¹", "admin_mail", MTEXT_LEN, "", array("EXIST_CHECK","EMAIL_CHECK","EMAIL_CHAR_CHECK","MAX_LENGTH_CHECK"), $admin_mail);
+	$objWebParam->addParam("´ÉÍý¼Ô¡§¥í¥°¥¤¥óID", "login_id", MTEXT_LEN, "", array("EXIST_CHECK","EXIST_CHECK", "ALNUM_CHECK"));
+	$objWebParam->addParam("´ÉÍý¼Ô¡§¥Ñ¥¹¥ï¡¼¥É", "login_pass", MTEXT_LEN, "", array("EXIST_CHECK","EXIST_CHECK", "ALNUM_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("MAX_LENGTH_CHECK"));	
+	
+	return $objWebParam;
+}
+
+// DB¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+function lfInitDBParam($objDBParam) {
+		
+	if(defined('DB_SERVER')) {
+		$db_server = DB_SERVER;
+	} else {
+		$db_server = "127.0.0.1";
+	}
+	
+	if(defined('DB_TYPE')) {
+		$db_type = DB_TYPE;
+	} else {
+		$db_type = "";
+	}
+	
+	if(defined('DB_PORT')) {
+		$db_port = DB_PORT;
+	} else {
+		$db_port = "";
+	}
+		
+	if(defined('DB_NAME')) {
+		$db_name = DB_NAME;
+	} else {
+		$db_name = "eccube_db";
+	}
+		
+	if(defined('DB_USER')) {
+		$db_user = DB_USER;
+	} else {
+		$db_user = "eccube_db_user";				
+	}
+			
+	$objDBParam->addParam("DB¤Î¼ïÎà", "db_type", INT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $db_type);
+	$objDBParam->addParam("DB¥µ¡¼¥Ð", "db_server", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $db_server);
+	$objDBParam->addParam("DB¥Ý¡¼¥È", "db_port", INT_LEN, "", array("MAX_LENGTH_CHECK"), $db_port);
+	$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();
+	
+	// ¥Ç¥£¥ì¥¯¥È¥êÌ¾¤Î¤ß¼èÆÀ¤¹¤ë
+	$normal_dir = ereg_replace("^https?://[a-zA-Z0-9_~=&\?\.\-]+", "", $arrRet['normal_url']);
+	$secure_dir = ereg_replace("^https?://[a-zA-Z0-9_~=&\?\.\-]+", "", $arrRet['secure_url']);
+	
+	if($normal_dir != $secure_dir) {
+		$objErr->arrErr['normal_url'] = "URL¤Ë°Û¤Ê¤ë³¬ÁØ¤ò»ØÄê¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£";
+		$objErr->arrErr['secure_url'] = "URL¤Ë°Û¤Ê¤ë³¬ÁØ¤ò»ØÄê¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£";		
+	}
+	
+	// ¥í¥°¥¤¥óID¥Á¥§¥Ã¥¯
+	$objErr->doFunc(array("´ÉÍý¼Ô¡§¥í¥°¥¤¥óID",'login_id',ID_MIN_LEN , ID_MAX_LEN) ,array("NUM_RANGE_CHECK"));
+	
+	// ¥Ñ¥¹¥ï¡¼¥É¤Î¥Á¥§¥Ã¥¯
+	$objErr->doFunc( array("´ÉÍý¼Ô¡§¥Ñ¥¹¥ï¡¼¥É",'login_pass',4 ,15 ) ,array( "NUM_RANGE_CHECK" ) );	
+	
+	return $objErr->arrErr;
+}
+
+// ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯
+function lfCheckDBError($objFormParam) {
+	global $objPage;
+	
+	// ÆþÎÏ¥Ç¡¼¥¿¤òÅÏ¤¹¡£
+	$arrRet =  $objFormParam->getHashArray();
+	
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+	
+	if(count($objErr->arrErr) == 0) {
+		// ÀÜÂ³³ÎÇ§
+		$dsn = $arrRet['db_type']."://".$arrRet['db_user'].":".$arrRet['db_password']."@".$arrRet['db_server'].":".$arrRet['db_port']."/".$arrRet['db_name'];
+		// Debug¥â¡¼¥É»ØÄê
+		$options['debug'] = PEAR_DB_DEBUG;
+		$objDB = DB::connect($dsn, $options);
+		// ÀÜÂ³À®¸ù
+		if(!PEAR::isError($objDB)) {
+			// ¥Ç¡¼¥¿¥Ù¡¼¥¹¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤Î¼èÆÀ
+			$objPage->tpl_db_version = sfGetDBVersion($dsn);			
+		} else {
+			$objErr->arrErr['all'] = ">> " . $objDB->message . "<br>";
+			// ¥¨¥é¡¼Ê¸¤ò¼èÆÀ¤¹¤ë
+			ereg("\[(.*)\]", $objDB->userinfo, $arrKey);
+			$objErr->arrErr['all'].= $arrKey[0] . "<br>";
+			gfPrintLog($objDB->userinfo, INSTALL_LOG);
+		}
+	}
+	return $objErr->arrErr;
+}
+
+// SQLÊ¸¤Î¼Â¹Ô
+function lfExecuteSQL($filepath, $dsn, $disp_err = true) {
+	$arrErr = array();
+	
+	if(!file_exists($filepath)) {
+		$arrErr['all'] = ">> ¥¹¥¯¥ê¥×¥È¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó";
+	} else {
+  		if($fp = fopen($filepath,"r")) {
+			$sql = fread($fp, filesize($filepath));
+			fclose($fp);
+		}
+		// Debug¥â¡¼¥É»ØÄê
+		$options['debug'] = PEAR_DB_DEBUG;
+		$objDB = DB::connect($dsn, $options);
+		// ÀÜÂ³¥¨¥é¡¼
+		if(!PEAR::isError($objDB)) {
+			// ²þ¹Ô¡¢¥¿¥Ö¤ò1¥¹¥Ú¡¼¥¹¤ËÊÑ´¹
+			$sql = preg_replace("/[\r\n\t]/"," ",$sql);
+			$sql_split = split(";",$sql);
+			foreach($sql_split as $key => $val){
+				if (trim($val) != "") {
+					$ret = $objDB->query($val);
+					if(PEAR::isError($ret) && $disp_err) {
+						$arrErr['all'] = ">> " . $ret->message . "<br>";
+						// ¥¨¥é¡¼Ê¸¤ò¼èÆÀ¤¹¤ë
+						ereg("\[(.*)\]", $ret->userinfo, $arrKey);
+						$arrErr['all'].= $arrKey[0] . "<br>";
+						$objPage->update_mess.=">> ¥Æ¡¼¥Ö¥ë¹½À®¤ÎÊÑ¹¹¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br>";
+						gfPrintLog($ret->userinfo, INSTALL_LOG);
+					}
+				}
+			}			
+		} else {
+			$arrErr['all'] = ">> " . $objDB->message;
+			gfPrintLog($objDB->userinfo, INSTALL_LOG);
+		}
+	}
+	return $arrErr;
+}
+
+// ÀßÄê¥Õ¥¡¥¤¥ë¤ÎºîÀ®
+function lfMakeConfigFile() {
+	global $objWebParam;
+	global $objDBParam;
+	
+	$root_dir = $objWebParam->getValue('install_dir');
+	// ¸ìÈø¤Ë'/'¤ò¤Ä¤±¤ë
+	if (!ereg("/$", $root_dir)) {
+		$root_dir = $root_dir . "/";
+	}
+	
+	$normal_url = $objWebParam->getValue('normal_url');
+	// ¸ìÈø¤Ë'/'¤ò¤Ä¤±¤ë
+	if (!ereg("/$", $normal_url)) {
+		$normal_url = $normal_url . "/";
+	}
+	
+	$secure_url = $objWebParam->getValue('secure_url');
+	// ¸ìÈø¤Ë'/'¤ò¤Ä¤±¤ë
+	if (!ereg("/$", $secure_url)) {
+		$secure_url = $secure_url . "/";
+	}
+	
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤Î¼èÆÀ
+	$url_dir = ereg_replace("^https?://[a-zA-Z0-9_~=&\?\.\-]+", "", $normal_url);
+	
+	$data_path = $root_dir . "../data/";
+	$filepath = $data_path . "install.inc";
+	
+	$config_data = 
+	"<?php\n".
+	"    define ('ECCUBE_INSTALL', 'ON');\n" .
+	"    define ('HTML_PATH', '" . $root_dir . "');\n" .	 
+	"    define ('SITE_URL', '" . $normal_url . "');\n" .
+	"    define ('SSL_URL', '" . $secure_url . "');\n" .
+	"    define ('URL_DIR', '" . $url_dir . "');\n" .	
+	"    define ('DOMAIN_NAME', '" . $objWebParam->getValue('domain') . "');\n" .
+	"    define ('DB_TYPE', '" . $objDBParam->getValue('db_type') . "');\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" .
+	"    define ('DB_PORT', '" . $objDBParam->getValue('db_port') .  "');\n" .
+	"    define ('DATA_PATH', '".$data_path."');\n" .
+	"?>";
+	
+	if($fp = fopen($filepath,"w")) {
+		fwrite($fp, $config_data);
+		fclose($fp);
+	}
+
+	// ¥â¥Ð¥¤¥ëÈÇ¤ÎÀßÄê¥Õ¥¡¥¤¥ë install_mobile.inc ¤òºîÀ®¤¹¤ë¡£
+	$filepath = $data_path . "install_mobile.inc";
+	
+	$config_data = 
+	"<?php\n".
+	"    define ('ECCUBE_INSTALL', 'ON');\n" .
+	"    define ('HTML_PATH', '" . $root_dir . "mobile/');\n" .	 
+	"    define ('PC_HTML_PATH', '" . $root_dir . "');\n" .	 
+	"    define ('SITE_URL', '" . $normal_url . "mobile/');\n" .
+	"    define ('PC_SITE_URL', '" . $normal_url . "');\n" .
+	"    define ('SSL_URL', '" . $secure_url . "mobile/');\n" .
+	"    define ('PC_SSL_URL', '" . $secure_url . "');\n" .
+	"    define ('URL_DIR', '" . $url_dir . "mobile/');\n" .	
+	"    define ('PC_URL_DIR', '" . $url_dir . "');\n" .	
+	"    define ('DOMAIN_NAME', '" . $objWebParam->getValue('domain') . "');\n" .
+	"    define ('DB_TYPE', '" . $objDBParam->getValue('db_type') . "');\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" .
+	"    define ('DB_PORT', '" . $objDBParam->getValue('db_port') .  "');\n" .
+	"    define ('DATA_PATH', '".$data_path."');\n" .
+	"?>";
+	
+	if($fp = fopen($filepath,"w")) {
+		fwrite($fp, $config_data);
+		fclose($fp);
+	}
+}
+
+// ¥Æ¡¼¥Ö¥ë¤ÎÄÉ²Ã¡Ê´û¤Ë¥Æ¡¼¥Ö¥ë¤¬Â¸ºß¤¹¤ë¾ì¹ç¤ÏºîÀ®¤·¤Ê¤¤¡Ë
+function lfAddTable($table_name, $dsn) {
+	$arrErr = array();
+	if(!sfTabaleExists($table_name, $dsn)) {
+		list($db_type) = split(":", $dsn);
+		$sql_path = "./sql/add/". $table_name . "_" .$db_type .".sql";
+		$arrErr = lfExecuteSQL($sql_path, $dsn);
+	}
+	return $arrErr;
+}
+
+// ¥Æ¡¼¥Ö¥ë¤Îºï½ü¡Ê´û¤Ë¥Æ¡¼¥Ö¥ë¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Î¤ßºï½ü¤¹¤ë¡Ë
+function lfDropTable($table_name, $dsn) {
+	$arrErr = array();
+	if(sfTabaleExists($table_name, $dsn)) {
+		// Debug¥â¡¼¥É»ØÄê
+		$options['debug'] = PEAR_DB_DEBUG;
+		$objDB = DB::connect($dsn, $options);
+		// ÀÜÂ³À®¸ù
+		if(!PEAR::isError($objDB)) {
+			$objDB->query("DROP TABLE " . $table_name);
+		} else {
+			$arrErr['all'] = ">> " . $objDB->message . "<br>";
+			// ¥¨¥é¡¼Ê¸¤ò¼èÆÀ¤¹¤ë
+			ereg("\[(.*)\]", $objDB->userinfo, $arrKey);
+			$arrErr['all'].= $arrKey[0] . "<br>";
+			gfPrintLog($objDB->userinfo, INSTALL_LOG);
+		}
+	}
+	return $arrErr;
+}
+
+// ¥«¥é¥à¤ÎÄÉ²Ã¡Ê´û¤Ë¥«¥é¥à¤¬Â¸ºß¤¹¤ë¾ì¹ç¤ÏºîÀ®¤·¤Ê¤¤¡Ë
+function lfAddColumn($dsn) {
+	global $objDBParam;
+
+	// ¼õÃí¥Æ¡¼¥Ö¥ë	
+	sfColumnExists("dtb_order", "memo01", "text", $dsn, true);	
+	sfColumnExists("dtb_order", "memo02", "text", $dsn, true);
+	sfColumnExists("dtb_order", "memo03", "text", $dsn, true);
+	sfColumnExists("dtb_order", "memo04", "text", $dsn, true);
+	sfColumnExists("dtb_order", "memo05", "text", $dsn, true);
+	sfColumnExists("dtb_order", "memo06", "text", $dsn, true);
+	sfColumnExists("dtb_order", "memo07", "text", $dsn, true);
+	sfColumnExists("dtb_order", "memo08", "text", $dsn, true);
+	sfColumnExists("dtb_order", "memo09", "text", $dsn, true);
+	sfColumnExists("dtb_order", "memo10", "text", $dsn, true);
+
+	// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë	
+	sfColumnExists("dtb_order_temp", "order_id", "text", $dsn, true);	
+	sfColumnExists("dtb_order_temp", "memo01", "text", $dsn, true);	
+	sfColumnExists("dtb_order_temp", "memo02", "text", $dsn, true);
+	sfColumnExists("dtb_order_temp", "memo03", "text", $dsn, true);
+	sfColumnExists("dtb_order_temp", "memo04", "text", $dsn, true);
+	sfColumnExists("dtb_order_temp", "memo05", "text", $dsn, true);
+	sfColumnExists("dtb_order_temp", "memo06", "text", $dsn, true);
+	sfColumnExists("dtb_order_temp", "memo07", "text", $dsn, true);
+	sfColumnExists("dtb_order_temp", "memo08", "text", $dsn, true);
+	sfColumnExists("dtb_order_temp", "memo09", "text", $dsn, true);
+	sfColumnExists("dtb_order_temp", "memo10", "text", $dsn, true);
+
+	// »ÙÊ§¾ðÊó¥Æ¡¼¥Ö¥ë
+	sfColumnExists("dtb_payment", "charge_flg", "int2 default 1", $dsn, true);	
+	sfColumnExists("dtb_payment", "rule_min", "numeric", $dsn, true);	
+	sfColumnExists("dtb_payment", "upper_rule_max", "numeric", $dsn, true);	
+	sfColumnExists("dtb_payment", "module_id", "int4", $dsn, true);	
+	sfColumnExists("dtb_payment", "module_path", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo01", "text", $dsn, true);	
+	sfColumnExists("dtb_payment", "memo02", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo03", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo04", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo05", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo06", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo07", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo08", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo09", "text", $dsn, true);
+	sfColumnExists("dtb_payment", "memo10", "text", $dsn, true);
+
+	// ¸ÜµÒ
+	if (!sfColumnExists("dtb_customer", "mobile_phone_id", "", $dsn)) {
+		sfColumnExists("dtb_customer", "mobile_phone_id", "text", $dsn, true);
+		$objQuery = new SC_Query($dsn);
+		if ($objDBParam->getValue('db_type') == 'mysql') {
+			$objQuery->query("CREATE INDEX dtb_customer_mobile_phone_id_key ON dtb_customer (mobile_phone_id(64))");
+		} else {
+			$objQuery->query("CREATE INDEX dtb_customer_mobile_phone_id_key ON dtb_customer (mobile_phone_id)");
+		}
+	}
+
+	// ¸ÜµÒ¥á¡¼¥ë
+	if ($objDBParam->getValue('db_type') == 'mysql') {
+		sfColumnExists("dtb_customer_mail", "secret_key", "varchar(50) unique", $dsn, true);
+	} else {
+		sfColumnExists("dtb_customer_mail", "secret_key", "text unique", $dsn, true);
+	}
+}
+
+?>
Index: /branches/mobile/html/install/sql/add/dtb_mobile_ext_session_id_mysql.sql
===================================================================
--- /branches/mobile/html/install/sql/add/dtb_mobile_ext_session_id_mysql.sql	(revision 11409)
+++ /branches/mobile/html/install/sql/add/dtb_mobile_ext_session_id_mysql.sql	(revision 11409)
@@ -0,0 +1,19 @@
+CREATE TABLE dtb_mobile_ext_session_id (
+    session_id text NOT NULL,
+    param_key text,
+    param_value text,
+    url text,
+    create_date timestamp NOT NULL DEFAULT now()
+);
+
+CREATE INDEX dtb_mobile_ext_session_id_param_key_key ON dtb_mobile_ext_session_id (param_key(64));
+CREATE INDEX dtb_mobile_ext_session_id_param_value_key ON dtb_mobile_ext_session_id (param_value(64));
+CREATE INDEX dtb_mobile_ext_session_id_url_key ON dtb_mobile_ext_session_id (url(64));
+CREATE INDEX dtb_mobile_ext_session_id_create_date_key ON dtb_mobile_ext_session_id (create_date);
+
+INSERT INTO dtb_table_comment (table_name, description) VALUES ('dtb_mobile_ext_session_id', '¥»¥Ã¥·¥ç¥óID´ÉÍý');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'session_id', '¥»¥Ã¥·¥ç¥óID');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'param_key', '¥Ñ¥é¥á¡¼¥¿Ì¾');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'param_value', '¥Ñ¥é¥á¡¼¥¿ÃÍ');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'url', 'URL');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'create_date', 'ºîÀ®Æü»þ');
Index: /branches/mobile/html/install/sql/add/dtb_mobile_ext_session_id_pgsql.sql
===================================================================
--- /branches/mobile/html/install/sql/add/dtb_mobile_ext_session_id_pgsql.sql	(revision 11409)
+++ /branches/mobile/html/install/sql/add/dtb_mobile_ext_session_id_pgsql.sql	(revision 11409)
@@ -0,0 +1,19 @@
+CREATE TABLE dtb_mobile_ext_session_id (
+    session_id text NOT NULL,
+    param_key text,
+    param_value text,
+    url text,
+    create_date timestamp NOT NULL DEFAULT now()
+);
+
+CREATE INDEX dtb_mobile_ext_session_id_param_key_key ON dtb_mobile_ext_session_id (param_key);
+CREATE INDEX dtb_mobile_ext_session_id_param_value_key ON dtb_mobile_ext_session_id (param_value);
+CREATE INDEX dtb_mobile_ext_session_id_url_key ON dtb_mobile_ext_session_id (url);
+CREATE INDEX dtb_mobile_ext_session_id_create_date_key ON dtb_mobile_ext_session_id (create_date);
+
+INSERT INTO dtb_table_comment (table_name, description) VALUES ('dtb_mobile_ext_session_id', '¥»¥Ã¥·¥ç¥óID´ÉÍý');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'session_id', '¥»¥Ã¥·¥ç¥óID');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'param_key', '¥Ñ¥é¥á¡¼¥¿Ì¾');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'param_value', '¥Ñ¥é¥á¡¼¥¿ÃÍ');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'url', 'URL');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_ext_session_id', 'create_date', 'ºîÀ®Æü»þ');
Index: /branches/mobile/html/install/sql/add/dtb_mobile_kara_mail_mysql.sql
===================================================================
--- /branches/mobile/html/install/sql/add/dtb_mobile_kara_mail_mysql.sql	(revision 11406)
+++ /branches/mobile/html/install/sql/add/dtb_mobile_kara_mail_mysql.sql	(revision 11406)
@@ -0,0 +1,22 @@
+CREATE TABLE dtb_mobile_kara_mail (
+    kara_mail_id serial PRIMARY KEY,
+    session_id text NOT NULL,
+    token text NOT NULL,
+    next_url text NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    email text,
+    receive_date timestamp
+);
+
+CREATE INDEX dtb_mobile_kara_mail_token_key ON dtb_mobile_kara_mail (token(64));
+CREATE INDEX dtb_mobile_kara_mail_create_date_key ON dtb_mobile_kara_mail (create_date);
+CREATE INDEX dtb_mobile_kara_mail_receive_date_key ON dtb_mobile_kara_mail (receive_date);
+
+INSERT INTO dtb_table_comment (table_name, description) VALUES ('dtb_mobile_kara_mail', '¶õ¥á¡¼¥ë´ÉÍý');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'kara_mail_id', '¶õ¥á¡¼¥ë´ÉÍýID');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'session_id', '¥»¥Ã¥·¥ç¥óID');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'token', '¥È¡¼¥¯¥ó');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'next_url', '¼¡¥Ú¡¼¥¸URL');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'create_date', 'ºîÀ®Æü»þ');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'email', '¥á¡¼¥ë¥¢¥É¥ì¥¹');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'receive_date', '¼õ¿®Æü»þ');
Index: /branches/mobile/html/install/sql/add/dtb_mobile_kara_mail_pgsql.sql
===================================================================
--- /branches/mobile/html/install/sql/add/dtb_mobile_kara_mail_pgsql.sql	(revision 11409)
+++ /branches/mobile/html/install/sql/add/dtb_mobile_kara_mail_pgsql.sql	(revision 11409)
@@ -0,0 +1,22 @@
+CREATE TABLE dtb_mobile_kara_mail (
+    kara_mail_id serial PRIMARY KEY,
+    session_id text NOT NULL,
+    token text NOT NULL,
+    next_url text NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    email text,
+    receive_date timestamp
+);
+
+CREATE INDEX dtb_mobile_kara_mail_token_key ON dtb_mobile_kara_mail (token);
+CREATE INDEX dtb_mobile_kara_mail_create_date_key ON dtb_mobile_kara_mail (create_date);
+CREATE INDEX dtb_mobile_kara_mail_receive_date_key ON dtb_mobile_kara_mail (receive_date);
+
+INSERT INTO dtb_table_comment (table_name, description) VALUES ('dtb_mobile_kara_mail', '¶õ¥á¡¼¥ë´ÉÍý');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'kara_mail_id', '¶õ¥á¡¼¥ë´ÉÍýID');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'session_id', '¥»¥Ã¥·¥ç¥óID');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'token', '¥È¡¼¥¯¥ó');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'next_url', '¼¡¥Ú¡¼¥¸URL');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'create_date', 'ºîÀ®Æü»þ');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'email', '¥á¡¼¥ë¥¢¥É¥ì¥¹');
+INSERT INTO dtb_table_comment (table_name, column_name, description) VALUES ('dtb_mobile_kara_mail', 'receive_date', '¼õ¿®Æü»þ');
Index: /branches/mobile/html/input_zip.php
===================================================================
--- /branches/mobile/html/input_zip.php	(revision 8424)
+++ /branches/mobile/html/input_zip.php	(revision 8424)
@@ -0,0 +1,81 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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(false);
+
+// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+$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: /branches/mobile/html/rss/product.php
===================================================================
--- /branches/mobile/html/rss/product.php	(revision 6705)
+++ /branches/mobile/html/rss/product.php	(revision 6705)
@@ -0,0 +1,175 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+//¶¦ÄÌÉôÉÊ¤ÎÆÉ¤ß¹þ¤ß
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = "rss/product.tpl";
+		$this->encode = "UTF-8";
+		$this->title = "¾¦ÉÊ°ìÍ÷¾ðÊó";
+	}
+}
+
+$objQuery = new SC_Query();
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteInfo = new SC_SiteInfo();
+
+//Å¹ÊÞ¾ðÊó¤ò¥»¥Ã¥È
+$arrSiteInfo = $objSiteInfo->data;
+
+//¾¦ÉÊID¤ò¼èÆÀ
+$product_id = $_GET['product_id'];
+$mode = $_GET['mode'];
+
+if(($product_id != "" and is_numeric($product_id)) or $mode == "all"){
+	//¾¦ÉÊ¾ÜºÙ¤ò¼èÆÀ
+	($mode == "all") ? $arrProduct = lfGetProductsDetail($objQuery, $mode) : $arrProduct = lfGetProductsDetail($objQuery, $product_id);
+
+	// ÃÍ¤Î¥»¥Ã¥È¤·Ä¾¤·
+	foreach($arrProduct as $key => $val){
+		//¾¦ÉÊ²Á³Ê¤òÀÇ¹þ¤ß¤ËÊÔ½¸
+		$arrProduct[$key]["price02"] = sfPreTax($arrProduct[$key]["price02"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
+		
+		// ²èÁü¥Õ¥¡¥¤¥ë¤ÎURL¥»¥Ã¥È
+		(file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_list_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
+		$arrProduct[$key]["main_list_image"] = $dir . $arrProduct[$key]["main_list_image"];
+		(file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
+		$arrProduct[$key]["main_image"] = $dir . $arrProduct[$key]["main_image"];
+		(file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_large_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
+		$arrProduct[$key]["main_large_image"] = $dir . $arrProduct[$key]["main_large_image"];
+		
+		// ¥Ý¥¤¥ó¥È·×»»
+		$arrProduct[$key]["point"] = sfPrePoint($arrProduct[$key]["price02"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]);
+	}
+}elseif($mode == "list"){
+	//¾¦ÉÊ°ìÍ÷¤ò¼èÆÀ
+	$arrProduct = $objQuery->getall("SELECT product_id, name AS product_name FROM dtb_products");
+}else{
+	$arrProduct = lfGetProductsAllclass($objQuery);
+	
+	// ÃÍ¤Î¥»¥Ã¥È¤·Ä¾¤·
+	foreach($arrProduct as $key => $val){
+		//¾¦ÉÊ²Á³Ê¤òÀÇ¹þ¤ß¤ËÊÔ½¸
+		$arrProduct[$key]["price01_max"] = sfPreTax($arrProduct[$key]["price01_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
+		$arrProduct[$key]["price01_min"] = sfPreTax($arrProduct[$key]["price01_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
+		$arrProduct[$key]["price02_max"] = sfPreTax($arrProduct[$key]["price02_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
+		$arrProduct[$key]["price02_min"] = sfPreTax($arrProduct[$key]["price02_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
+		
+		// ²èÁü¥Õ¥¡¥¤¥ë¤ÎURL¥»¥Ã¥È
+		(file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_list_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
+		$arrProduct[$key]["main_list_image"] = $dir . $arrProduct[$key]["main_list_image"];
+		(file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
+		$arrProduct[$key]["main_image"] = $dir . $arrProduct[$key]["main_image"];
+		(file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_large_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
+		$arrProduct[$key]["main_large_image"] = $dir . $arrProduct[$key]["main_large_image"];
+		
+		// ¥Ý¥¤¥ó¥È·×»»
+		$arrProduct[$key]["point_max"] = sfPrePoint($arrProduct[$key]["price02_max"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]);
+		$arrProduct[$key]["point_min"] = sfPrePoint($arrProduct[$key]["price02_min"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]);
+	}
+}
+
+//¾¦ÉÊ¾ðÊó¤ò¥»¥Ã¥È
+$objPage->arrProduct = $arrProduct;
+if(is_array(sfswaparray($arrProduct))){
+	$objPage->arrProductKeys = array_keys(sfswaparray($arrProduct));
+}
+
+//Å¹ÊÞ¾ðÊó¤ò¥»¥Ã¥È
+$objPage->arrSiteInfo = $arrSiteInfo;
+
+//¥»¥Ã¥È¤·¤¿¥Ç¡¼¥¿¤ò¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ë½ÐÎÏ
+$objView->assignobj($objPage);
+
+//¥­¥ã¥Ã¥·¥å¤·¤Ê¤¤(Ç°¤Î¤¿¤á)
+header("Paragrama: no-cache");
+
+//XML¥Æ¥­¥¹¥È(¤³¤ì¤¬¤Ê¤¤¤ÈÀµ¾ï¤ËRSS¤È¤·¤ÆÇ§¼±¤·¤Æ¤¯¤ì¤Ê¤¤¥Ä¡¼¥ë¤¬¤¢¤ë¤¿¤á)
+header("Content-type: application/xml");
+DETAIL_P_HTML;
+
+//²èÌÌÉ½¼¨
+$objView->display($objPage->tpl_mainpage, true);
+
+//---------------------------------------------------------------------------------------------------------------------
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾:lfGetProducts
+ * ÀâÌÀ¡¡:¾¦ÉÊ¾ðÊó¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô£±:$objQuery		DBÁàºî¥¯¥é¥¹
+ * °ú¿ô£²:$product_id	¾¦ÉÊID
+ * Ìá¤êÃÍ:$arrProduct	¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹
+ **************************************************************************************************************/
+function lfGetProductsDetail($objQuery, $product_id = "all"){
+	$sql = "";
+	$sql .= "SELECT ";
+	$sql .= "	prod.product_id ";
+	$sql .= "	,prod.name AS product_name ";
+	$sql .= "	,prod.category_id ";
+	$sql .= "	,prod.point_rate ";
+	$sql .= "	,prod.comment3 ";
+	$sql .= "	,prod.main_list_comment ";
+	$sql .= "	,prod.main_list_image ";
+	$sql .= "	,prod.main_comment ";
+	$sql .= "	,prod.main_image ";
+	$sql .= "	,prod.main_large_image ";
+	$sql .= "	,cls.product_code ";
+	$sql .= "	,cls.price01 ";
+	$sql .= "	,cls.price02 ";
+	$sql .= "	,cls.classcategory_id1 ";
+	$sql .= "	,cls.classcategory_id2 ";
+	$sql .= "	,(SELECT name FROM dtb_classcategory AS clscat WHERE clscat.classcategory_id = cls.classcategory_id1) AS classcategory_name1 ";
+	$sql .= "	,(SELECT name FROM dtb_classcategory AS clscat WHERE clscat.classcategory_id = cls.classcategory_id2) AS classcategory_name2 ";
+	$sql .= "	,(SELECT category_name FROM dtb_category AS cat WHERE cat.category_id = prod.category_id) AS category_name";
+	$sql .= " FROM dtb_products AS prod, dtb_products_class AS cls";
+	$sql .= " WHERE prod.product_id = cls.product_id AND prod.del_flg = 0 AND prod.status = 1";
+	
+	if($product_id != "all"){
+		$sql .= " AND prod.product_id = ?";
+		$arrval = array($product_id);
+	}
+	$sql .= " ORDER BY prod.product_id, cls.classcategory_id1, cls.classcategory_id2";
+	$arrProduct = $objQuery->getall($sql, $arrval);
+	return $arrProduct;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾:lfGetProductsAllclass
+ * ÀâÌÀ¡¡:¾¦ÉÊ¾ðÊó¤ò¼èÆÀ¤¹¤ë(vw_products_allclass»ÈÍÑ)
+ * °ú¿ô£±:$objQuery		DBÁàºî¥¯¥é¥¹
+ * Ìá¤êÃÍ:$arrProduct	¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹
+ **************************************************************************************************************/
+function lfGetProductsAllclass($objQuery){
+	$sql = "";
+	$sql .= "SELECT  
+				product_id
+				,name as product_name
+				,category_id
+				,point_rate
+				,comment3
+				,main_list_comment
+				,main_image
+				,main_list_image
+				,product_code_min
+				,product_code_max
+				,price01_min
+				,price01_max
+				,price02_min
+				,price02_max
+				,(SELECT category_name FROM dtb_category AS cat WHERE cat.category_id = allcls.category_id) AS category_name
+				,(SELECT main_large_image FROM dtb_products AS prod WHERE prod.product_id = allcls.product_id) AS main_large_image
+			FROM  vw_products_allclass as allcls
+			WHERE allcls.del_flg = 0 AND allcls.status = 1";
+	$sql .= " ORDER BY allcls.product_id";
+	$arrProduct = $objQuery->getall($sql);
+	return $arrProduct;
+}
+
+
+?>
Index: /branches/mobile/html/rss/index.php
===================================================================
--- /branches/mobile/html/rss/index.php	(revision 7263)
+++ /branches/mobile/html/rss/index.php	(revision 7263)
@@ -0,0 +1,88 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+//¶¦ÄÌÉôÉÊ¤ÎÆÉ¤ß¹þ¤ß
+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->timestamp = sf_mktime("r", $arrNews[0]['HOUR'], $arrNews[0]['MINUTE'], $arrNews[0]['SECOND'], $arrNews[0]['MONTH'], $arrNews[0]['DAY'], $arrNews[0]['YEAR']);
+
+//Å¹Ì¾¤ò¥»¥Ã¥È
+$objPage->site_title = $arrNews[0]['shop_name'];
+
+//ÂåÉ½Email¥¢¥É¥ì¥¹¤ò¥»¥Ã¥È
+$objPage->email = $arrNews[0]['email'];
+
+//¥»¥Ã¥È¤·¤¿¥Ç¡¼¥¿¤ò¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ë½ÐÎÏ
+$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 ";							//¿·Ãå¾ðÊóËÜÊ¸
+	
+	if (DB_TYPE == "pgsql") {
+		$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 ";	//ÆüÉÕ(ÉÃ)
+	}else if (DB_TYPE == "mysql") {
+		$col .= "     ,DATE_FORMAT(news_date, '%Y') AS YEAR ";		//ÆüÉÕ(Ç¯)
+		$col .= "     ,DATE_FORMAT(news_date, '%m') AS MONTH ";		//ÆüÉÕ(·î)
+		$col .= "     ,DATE_FORMAT(news_date, '%d') AS DAY ";		//ÆüÉÕ(Æü)
+		$col .= "     ,DATE_FORMAT(news_date, '%H') AS HOUR ";		//ÆüÉÕ(»þ´Ö)
+		$col .= "     ,DATE_FORMAT(news_date, '%i') AS MINUTE ";	//ÆüÉÕ(Ê¬)
+		$col .= "     ,DATE_FORMAT(news_date, '%s') 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 = "del_flg = '0'";
+	$order = "rank DESC";
+	$objQuery->setorder($order);
+	$arrNews = $objQuery->select($col,$from,$where);
+	return $arrNews;
+}
+
+?>
Index: /branches/mobile/html/mobile/.htaccess
===================================================================
--- /branches/mobile/html/mobile/.htaccess	(revision 11407)
+++ /branches/mobile/html/mobile/.htaccess	(revision 11407)
@@ -0,0 +1,5 @@
+php_flag mbstring.encoding_translation 0
+php_value output_handler null
+php_value variables_order EGPS
+php_flag session.auto_start 0
+php_flag session.use_trans_sid 1
Index: /branches/mobile/html/mobile/mypage/index.php
===================================================================
--- /branches/mobile/html/mobile/mypage/index.php	(revision 11457)
+++ /branches/mobile/html/mobile/mypage/index.php	(revision 11457)
@@ -0,0 +1,95 @@
+<?php
+/*
+ * MyPage
+ */
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = 'mypage/index.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/¹ØÆþÍúÎò°ìÍ÷';
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+// ¥í¥°¥¤¥ó½èÍý
+if($_POST['mode'] == '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'])) {
+			// ¥í¥°¥¤¥ó¤¬À®¸ù¤·¤¿¾ì¹ç¤Ï·ÈÂÓÃ¼ËöID¤òÊÝÂ¸¤¹¤ë¡£
+			$objCustomer->updateMobilePhoneId();
+
+			// ·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¥³¥Ô¡¼¤¹¤ë¡£
+			$objCustomer->updateEmailMobile();
+
+			// ·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+			if (!$objCustomer->hasValue('email_mobile')) {
+				header('Location: ' . gfAddSessionId('../entry/email_mobile.php'));
+				exit;
+			}
+		} else {
+			$objQuery = new SC_Query;
+			$where = "email = ? AND status = 1 AND del_flg = 0";
+			$ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
+			
+			if($ret > 0) {
+				sfDispSiteError(TEMP_LOGIN_ERROR);
+			} else {
+				sfDispSiteError(SITE_LOGIN_ERROR);
+			}
+		}
+	}
+}
+
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if(!isset($_SESSION['customer'])) {
+	$objPage->tpl_mainpage = 'mypage/login.tpl';
+	$objView->assignArray($objFormParam->getHashArray());
+	$objView->assignArray(array("arrErr" => $arrErr));
+}else {
+	//¥Þ¥¤¥Ú¡¼¥¸¥È¥Ã¥×¸ÜµÒ¾ðÊóÉ½¼¨ÍÑ
+	$objPage->CustomerName1 = $objCustomer->getvalue('name01');
+	$objPage->CustomerName2 = $objCustomer->getvalue('name02');
+}
+
+$objView->assignobj($objPage);				//$objpageÆâ¤ÎÁ´¤Æ¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤òsmarty¤Ë³ÊÇ¼
+$objView->display(SITE_FRAME);				//¥Ñ¥¹¤È¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤Î¸Æ¤Ó½Ð¤·¡¢¼Â¹Ô
+
+//-------------------------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("µ­²±¤¹¤ë", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("¥á¡¼¥ë¥¢¥É¥ì¥¹", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+}
+?>
Index: /branches/mobile/html/mobile/mypage/refusal_complete.php
===================================================================
--- /branches/mobile/html/mobile/mypage/refusal_complete.php	(revision 11418)
+++ /branches/mobile/html/mobile/mypage/refusal_complete.php	(revision 11418)
@@ -0,0 +1,31 @@
+<?php
+/*
+ * Âà²ñ´°Î»
+ */
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = 'mypage/refusal_complete.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(´°Î»¥Ú¡¼¥¸)";
+		$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: /branches/mobile/html/mobile/mypage/order.php
===================================================================
--- /branches/mobile/html/mobile/mypage/order.php	(revision 11418)
+++ /branches/mobile/html/mobile/mypage/order.php	(revision 11418)
@@ -0,0 +1,41 @@
+<?
+/*
+ * ÍúÎò¤«¤éÃíÊ¸¤ò¼èÆÀ¡¦ÅÐÏ¿¤·¡¢¥«¡¼¥È¤ËÁ«°Ü¤¹¤ë¡£
+ */
+require_once("../require.php");
+
+$objCustomer = new SC_Customer();
+$objCartSess = new SC_CartSession();
+
+//¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+$arrDisp = lfGetOrderDetail($_POST['order_id']);
+
+//¥í¥°¥¤¥ó¤·¤Æ¤¤¤Ê¤¤¡¢¤Þ¤¿¤ÏDB¤Ë¾ðÊó¤¬Ìµ¤¤¾ì¹ç
+if (!$objCustomer->isLoginSuccess() or count($arrDisp) == 0){
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+for($num = 0; $num < count($arrDisp); $num++) {
+	$product_id = $arrDisp[$num]['product_id'];
+	$cate_id1 = $arrDisp[$num]['classcategory_id1'];
+	$cate_id2 = $arrDisp[$num]['classcategory_id2'];
+	$quantity = $arrDisp[$num]['quantity'];
+
+	$objCartSess->addProduct(array($product_id, $cate_id1, $cate_id2), $quantity);
+}
+
+header("Location: " . gfAddSessionId(URL_CART_TOP));
+
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+// ¼õÃí¾ÜºÙ¥Ç¡¼¥¿¤Î¼èÆÀ
+function lfGetOrderDetail($order_id) {
+	$objQuery = new SC_Query();
+	$col = "product_id, classcategory_id1, classcategory_id2, quantity";
+	$where = "order_id = ?";
+	$objQuery->setorder("classcategory_id1, classcategory_id2");
+	$arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
+	return $arrRet;
+}
+
+?>
Index: /branches/mobile/html/mobile/mypage/change_complete.php
===================================================================
--- /branches/mobile/html/mobile/mypage/change_complete.php	(revision 11418)
+++ /branches/mobile/html/mobile/mypage/change_complete.php	(revision 11418)
@@ -0,0 +1,38 @@
+<?php
+/*
+ * ÊÑ¹¹´°Î»
+ */
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = 'mypage/change_complete.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹(´°Î»¥Ú¡¼¥¸)';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objCustomer = new SC_Customer();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+//¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾õÂÖ¤Ë¹¹¿·¤¹¤ë
+$objCustomer->updateSession();
+
+//¥í¥°¥¤¥óÈ½Äê
+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: /branches/mobile/html/mobile/mypage/history.php
===================================================================
--- /branches/mobile/html/mobile/mypage/history.php	(revision 11418)
+++ /branches/mobile/html/mobile/mypage/history.php	(revision 11418)
@@ -0,0 +1,68 @@
+<?php
+/*
+ * MyPage
+ */
+
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page() {
+		$this->tpl_mainpage = 'mypage/history.tpl';
+		$this->tpl_title = 'MY¥Ú¡¼¥¸/¹ØÆþÍúÎò°ìÍ÷';
+		session_cache_limiter('private-no-expire');
+	}
+}
+
+define ("HISTORY_NUM", 5);
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+$pageNo = isset($_GET['pageno']) ? $_GET['pageno'] : 0;
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, "mypage/index.php");
+
+// ¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if(!isset($_SESSION['customer'])) {
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+$col = "order_id, create_date, payment_id, payment_total";
+$from = "dtb_order";
+$where = "del_flg = 0 AND customer_id=?";
+$arrval = array($objCustomer->getvalue('customer_id'));
+$order = "order_id DESC";
+
+$linemax = $objQuery->count($from, $where, $arrval);
+$objPage->tpl_linemax = $linemax;
+
+// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+$objQuery->setlimitoffset(HISTORY_NUM, $pageNo);
+// É½¼¨½ç½ø
+$objQuery->setorder($order);
+
+//¹ØÆþÍúÎò¤Î¼èÆÀ
+$objPage->arrOrder = $objQuery->select($col, $from, $where, $arrval);
+
+// next
+if ($pageNo + HISTORY_NUM < $linemax) {
+	$next = "<a href='history.php?pageno=" . ($pageNo + HISTORY_NUM) . "'>¼¡¤Ø¢ª</a>";
+} else {
+	$next = "¼¡¤Ø¢ª";
+}
+
+// previous
+if ($pageNo - HISTORY_NUM > 0) {
+	$previous = "<a href='history.php?pageno=" . ($pageNo - HISTORY_NUM) . "'>¢«Á°</a>";
+} elseif ($pageNo == 0) {
+	$previous = "¢«Á°";
+} else {
+	$previous = "<a href='history.php?pageno=0'>¢«Á°</a>";
+}
+
+$objPage->tpl_strnavi = $previous . " | " . $next;
+$objView->assignobj($objPage);				//$objpageÆâ¤ÎÁ´¤Æ¤Î¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤òsmarty¤Ë³ÊÇ¼
+$objView->display(SITE_FRAME);				//¥Ñ¥¹¤È¥Æ¥ó¥×¥ì¡¼¥ÈÊÑ¿ô¤Î¸Æ¤Ó½Ð¤·¡¢¼Â¹Ô
+?>
Index: /branches/mobile/html/mobile/mypage/refusal.php
===================================================================
--- /branches/mobile/html/mobile/mypage/refusal.php	(revision 11418)
+++ /branches/mobile/html/mobile/mypage/refusal.php	(revision 11418)
@@ -0,0 +1,54 @@
+<?php
+/*
+ * Âà²ñ½èÍý
+ */
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = 'mypage/refusal.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/Âà²ñ¼êÂ³¤­(ÆþÎÏ¥Ú¡¼¥¸)";
+		//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");
+
+if (isset($_POST['no'])) {
+	header("Location: " . gfAddSessionId("index.php"));
+	exit;
+} elseif (isset($_POST['complete'])){
+	//²ñ°÷ºï½ü
+	$objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id')));
+
+	$where = "email ILIKE ?";
+	if (DB_TYPE == "mysql")	$where = sfChangeILIKE($where);
+
+	$objQuery->delete("dtb_customer_mail", $where, array($objCustomer->getValue('email')));
+	$objCustomer->EndSession();
+	//´°Î»¥Ú¡¼¥¸¤Ø
+	header("Location: " . gfAddSessionId("refusal_complete.php"));
+	exit;
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /branches/mobile/html/mobile/mypage/history_detail.php
===================================================================
--- /branches/mobile/html/mobile/mypage/history_detail.php	(revision 11418)
+++ /branches/mobile/html/mobile/mypage/history_detail.php	(revision 11418)
@@ -0,0 +1,84 @@
+<?php
+/*
+ * ÍúÎò
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'mypage/history_detail.tpl';
+		$this->tpl_title = "MY¥Ú¡¼¥¸/¹ØÆþÍúÎò¾ÜºÙ";
+		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 = "del_flg = 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() or $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', 'deliv_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: /branches/mobile/html/mobile/mypage/change.php
===================================================================
--- /branches/mobile/html/mobile/mypage/change.php	(revision 11418)
+++ /branches/mobile/html/mobile/mypage/change.php	(revision 11418)
@@ -0,0 +1,470 @@
+<?php
+/*
+ * ¾ðÊóÊÑ¹¹
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'mypage/change.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title .= 'ÅÐÏ¿ÊÑ¹¹(1/3)';			//¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+	}
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$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")));
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+$objPage->arrPref = $arrPref;
+$objPage->arrJob = $arrJob;
+$objPage->arrReminder = $arrReminder;
+$objPage->arrYear = $objDate->getYear('', 1950);	//¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
+$objPage->arrMonth = $objDate->getMonth();
+$objPage->arrDay = $objDate->getDay();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$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" => "email_mobile", "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" ),
+						 );
+
+//---- ÅÐÏ¿½ü³°ÍÑ¥«¥é¥àÇÛÎó
+$arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
+
+$objPage->arrForm = lfGetCustomerData();
+$objPage->arrForm['password'] = DEFAULT_PASSWORD;
+
+if ($_SERVER["REQUEST_METHOD"] == "POST") {
+
+	//-- POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
+	$objPage->arrForm = array_merge($objPage->arrForm, $_POST);
+
+	if($objPage->arrForm['year'] == '----') {
+		$objPage->arrForm['year'] = '';
+	}
+	
+	$objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	
+	//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+	$objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+
+	//--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	if ($_POST["mode"] == "set1") {
+		$objPage->arrErr = lfErrorCheck1($objPage->arrForm);
+		$objPage->tpl_mainpage = 'mypage/change.tpl';
+		$objPage->tpl_title = 'ÅÐÏ¿ÊÑ¹¹(1/3)';
+	} elseif ($_POST["mode"] == "set2") {
+		$objPage->arrErr = lfErrorCheck2($objPage->arrForm);
+		$objPage->tpl_mainpage = 'mypage/set1.tpl';
+		$objPage->tpl_title = 'ÅÐÏ¿ÊÑ¹¹(2/3)';
+	} else {
+		$objPage->arrErr = lfErrorCheck3($objPage->arrForm);
+		$objPage->tpl_mainpage = 'mypage/set2.tpl';
+		$objPage->tpl_title = 'ÅÐÏ¿ÊÑ¹¹(3/3)';
+	}
+
+	if ($objPage->arrErr || $_POST["mode"] == "return") {		// ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+		foreach($objPage->arrForm as $key => $val) {
+			$objPage->$key = $val;
+		}
+
+		//-- ¥Ç¡¼¥¿¤ÎÀßÄê
+		if ($_POST["mode"] == "set1") {
+			$checkVal = array("email", "password", "reminder", "reminder_answer", "name01", "name02", "kana01", "kana02");
+			foreach($objPage->arrForm as $key => $val) {
+				if ($key != "mode" && $key != "subm" & !in_array($key, $checkVal)) $objPage->list_data[ $key ] = $val;
+			}
+
+		} elseif ($_POST["mode"] == "set2") {
+			$checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
+			foreach($objPage->arrForm as $key => $val) {
+				if ($key != "mode" && $key != "subm" & !in_array($key, $checkVal)) $objPage->list_data[ $key ] = $val;
+			}
+		} else {
+			$checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03");
+			foreach($objPage->arrForm as $key => $val) {
+				if ($key != "mode" && $key != "subm" & !in_array($key, $checkVal)) $objPage->list_data[ $key ] = $val;
+			}
+		}
+
+
+	} else {
+
+		//--¡¡¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê
+		if ($_POST["mode"] == "set1") {
+			$objPage->tpl_mainpage = 'mypage/set1.tpl';
+			$objPage->tpl_title = 'ÅÐÏ¿ÊÑ¹¹(2/3)';
+		} elseif ($_POST["mode"] == "set2") {
+			$objPage->tpl_mainpage = 'mypage/set2.tpl';
+			$objPage->tpl_title = 'ÅÐÏ¿ÊÑ¹¹(3/3)';
+
+			$address = lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
+
+			$objPage->arrForm['pref'] = @$address[0]['state'];
+			$objPage->arrForm['addr01'] = @$address[0]['city'] . @$address[0]['town'];
+		} elseif ($_POST["mode"] == "confirm") {
+			//¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨
+			$passlen = strlen($objPage->arrForm['password']);
+			$objPage->passlen = lfPassLen($passlen);
+			
+			//¥á¡¼¥ë¼õ¤±¼è¤ê
+			if ($objPage->arrForm['mail_flag'] = "ON") {
+				$objPage->arrForm['mail_flag']  = "2";
+			}
+
+			$objPage->tpl_mainpage = 'mypage/change_confirm.tpl';
+			$objPage->tpl_title = 'ÅÐÏ¿ÊÑ¹¹(³ÎÇ§¥Ú¡¼¥¸)';
+
+		}
+
+		//-- ¥Ç¡¼¥¿ÀßÄê
+		unset($objPage->list_data);
+		foreach($_POST as $key => $val) {
+			if ($key != "mode" && $key != "subm") $objPage->list_data[ $key ] = $val;
+		}
+
+
+		//--¡¡²¾ÅÐÏ¿¤È´°Î»²èÌÌ
+		if ($_POST["mode"] == "complete") {
+
+			//-- ÆþÎÏ¥Ç¡¼¥¿¤ÎÊÑ´¹
+			$arrForm = lfConvertParam($_POST, $arrRegistColumn);
+			$arrForm['email'] = strtolower($arrForm['email']);		// email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
+	
+			//¥¨¥é¡¼¥Á¥§¥Ã¥¯
+			$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+			$email_flag = true;
+
+			if($objPage->arrForm['email'] != $objCustomer->getValue('email')) {
+				//¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î½ÅÊ£¥Á¥§¥Ã¥¯
+				$email_cnt = $objQuery->count("dtb_customer","del_flg=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: " . gfAddSessionId("change_complete.php"));
+				exit;
+			} else {
+				sfDispSiteError(CUSTOMER_ERROR);
+			}
+
+		}
+	}
+}
+
+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"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
+	
+	$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È¯¹Ô
+	$arrRegist["create_date"] = "now()"; 	// ºîÀ®Æü
+	$arrRegist["update_date"] = "now()"; 	// ¹¹¿·Æü
+	$arrRegist["first_buy_date"] = "";	 	// ºÇ½é¤Î¹ØÆþÆü
+	
+	// ·ÈÂÓ¥á¡¼¥ë¥¢¥É¥ì¥¹
+	$arrRegist['email_mobile'] = $arrRegist['email'];
+
+	//-- ²¾ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+
+	$objQuery = new SC_Query();
+	$objQuery->insert("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; 
+	}
+	$arrRegistMail["update_date"] = "now()";
+	
+	// Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¾ì¹ç
+	if ($mailResult == 1) {		
+		$objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");			
+	} else {				//¡¡¿·µ¬ÅÐÏ¿¤Î¾ì¹ç
+		$arrRegistMail["create_date"] = "now()";
+		$objQuery->insert("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) {
+	$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("¤ªÅÅÏÃÈÖ¹æ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("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤Î¼ÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿¤È¤­¤ÎÅú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	return $objErr->arrErr;
+	
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck1($array) {
+
+	global $objConn;
+	global $objCustomer;
+	$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('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
+
+	//¸½²ñ°÷¤ÎÈ½Äê ¢ª¡¡¸½²ñ°÷¤â¤·¤¯¤Ï²¾ÅÐÏ¿Ãæ¤Ï¡¢¥á¥¢¥É°ì°Õ¤¬Á°Äó¤Ë¤Ê¤Ã¤Æ¤ë¤Î¤ÇÆ±¤¸¥á¥¢¥É¤ÇÅÐÏ¿ÉÔ²Ä
+	$array["customer_id"] = $objCustomer->getValue('customer_id');
+	if (strlen($array["email"]) > 0) {
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("email, update_date, del_flg", "dtb_customer","customer_id <> ? and (email ILIKE ? OR email_mobile ILIKE ?) ORDER BY del_flg", array($array["customer_id"], $array["email"], $array["email"]));
+
+		if(count($arrRet) > 0) {
+			if($arrRet[0]['del_flg'] != '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("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_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","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck2($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+	
+	$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("¤´À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("SELECT_CHECK", "CHECK_DATE"));
+	
+	return $objErr->arrErr;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck3($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+	
+	$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","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"));
+	
+	return $objErr->arrErr;
+}
+
+//³ÎÇ§¥Ú¡¼¥¸ÍÑ¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨ÍÑ
+
+function lfPassLen($passlen){
+	$ret = "";
+	for ($i=0;$i<$passlen;true){
+	$ret.="*";
+	$i++;
+	}
+	return $ret;
+}
+
+
+// Í¹ÊØÈÖ¹æ¤«¤é½»½ê¤Î¼èÆÀ
+function lfGetAddress($zipcode) {
+	global $arrPref;
+
+	$conn = new SC_DBconn(ZIP_DSN);
+
+	// Í¹ÊØÈÖ¹æ¸¡º÷Ê¸ºîÀ®
+	$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);
+
+	/*
+		ÁíÌ³¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
+		°Ê²¼¤Î¤è¤¦¤ÊÊ¸»úÎó¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç	ÂÐºö¤¹¤ë¡£
+		¡¦¡Ê£±¡¦£±£¹ÃúÌÜ¡Ë
+		¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
+	*/
+	$town =  $data_list[0]['town'];
+	$town = ereg_replace("¡Ê.*¡Ë$","",$town);
+	$town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
+	$data_list[0]['town'] = $town;
+	$data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
+
+	return $data_list;
+}
+
+//¸ÜµÒ¾ðÊó¤Î¼èÆÀ
+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'])){
+		$birth = split(" ", $arrForm["birth"]);
+		list($year, $month, $day) = split("-",$birth[0]);
+		
+		$arrForm['year'] = $year;
+		$arrForm['month'] = $month;
+		$arrForm['day'] = $day;
+		
+	}
+	return $arrForm;
+}
+
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/redirect.php
===================================================================
--- /branches/mobile/html/mobile/redirect.php	(revision 11406)
+++ /branches/mobile/html/mobile/redirect.php	(revision 11406)
@@ -0,0 +1,18 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¶õ¥á¡¼¥ë¤ÎÊÖ¿®¤«¤é¤ÎÁ«°Ü
+ */
+
+define('SKIP_MOBILE_INIT', true);
+require_once 'require.php';
+
+if (isset($_GET['token'])) {
+	$next_url = gfFinishKaraMail($_GET['token']);
+}
+
+if (isset($next_url) && $next_url !== false) {
+	header("Location: $next_url");
+} else {
+	header('Location: ' . SITE_URL);
+}
+?>
Index: /branches/mobile/html/mobile/shopping/confirm.php
===================================================================
--- /branches/mobile/html/mobile/shopping/confirm.php	(revision 11409)
+++ /branches/mobile/html/mobile/shopping/confirm.php	(revision 11409)
@@ -0,0 +1,120 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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;
+$objQuery = new SC_Query();
+
+// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿µ­Ï¿¤¬¤¢¤ë¤«È½Äê
+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);
+
+// ¥«¡¼ÅÔÆâ¤Î¾¦ÉÊ¤ÎÇä¤êÀÚ¤ì¥Á¥§¥Ã¥¯
+$objCartSess->chkSoldOut($objCartSess->getCartList());
+
+// ²ñ°÷¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($objCustomer->isLoginSuccess()) {
+	$objPage->tpl_login = '1';
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+}
+
+// ·èºÑ¶èÊ¬¤ò¼èÆÀ¤¹¤ë
+$payment_type = "";
+if(sfColumnExists("dtb_payment", "memo01")){
+	// MEMO03¤ËÃÍ¤¬Æþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢¥â¥¸¥å¡¼¥ëÄÉ²Ã¤µ¤ì¤¿¤â¤Î¤È¤ß¤Ê¤¹
+	$sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
+	$arrPayment = $objQuery->getall($sql, array($arrData['payment_id']));
+	$payment_type = $arrPayment[0]["memo03"];
+}
+$objPage->payment_type = $payment_type;
+
+
+switch($_POST['mode']) {
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . gfAddSessionId(URL_SHOP_PAYMENT));
+	exit;
+	break;
+case 'confirm':
+	// ¤³¤Î»þÅÀ¤Ç¥ª¡¼¥À¡¼ID¤ò³ÎÊÝ¤·¤Æ¤ª¤¯¡Ê¥¯¥ì¥¸¥Ã¥È¡¢¥³¥ó¥Ó¥Ë·èºÑ¤ÇÉ¬Í×¤Ê¤¿¤á¡Ë
+	// postgresql¤Èmysql¤È¤Ç½èÍý¤òÊ¬¤±¤ë
+	if (DB_TYPE == "pgsql") {
+		$order_id = $objQuery->nextval("dtb_order","order_id");
+	}elseif (DB_TYPE == "mysql") {
+		$order_id = $objQuery->get_auto_increment("dtb_order");
+	}
+	$arrData["order_id"] = $order_id;
+	
+	// ½¸·×·ë²Ì¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+	sfRegistTempOrder($uniqid, $arrData);
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	
+	// ·èºÑÊýË¡¤Ë¤è¤ê²èÌÌÀÚÂØ
+	if($payment_type != "") {
+		$_SESSION["payment_id"] = $arrData['payment_id'];
+		header("Location: " . gfAddSessionId(URL_SHOP_MODULE));
+	}else{
+		header("Location: " . gfAddSessionId(URL_SHOP_COMPLETE));
+	}
+	break;
+default:
+	break;
+}
+
+
+$objPage->arrData = $arrData;
+$objPage->arrInfo = $arrInfo;
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/shopping/deliv_addr.php
===================================================================
--- /branches/mobile/html/mobile/shopping/deliv_addr.php	(revision 11454)
+++ /branches/mobile/html/mobile/shopping/deliv_addr.php	(revision 11454)
@@ -0,0 +1,277 @@
+<?php
+/**
+ * ÇÛÁ÷Àè¤ÎÄÉ²Ã
+ */
+require_once("../require.php");
+
+class LC_Page{
+	function LC_Page(){
+		$this->tpl_mainpage = 'shopping/deliv_addr.tpl';
+		$this->tpl_title = "¿·¤·¤¤¤ªÆÏ¤±Àè¤ÎÄÉ²Ã";
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView(false);
+$objQuery = new SC_Query();
+$objCustomer = new SC_Customer();
+$objConn = new SC_DBConn();
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+
+//¥í¥°¥¤¥óÈ½Äê
+if (!$objCustomer->isLoginSuccess()){
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+$objPage->arrForm = $_POST;
+$objPage->arrPref = $arrPref;
+//-- ¥Ç¡¼¥¿ÀßÄê
+foreach($_POST as $key => $val) {
+	if ($key != "mode") $objPage->list_data[ $key ] = $val;
+}
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+//ÊÌ¤Î¤ªÆÏ¤±Àè£Ä£ÂÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
+$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 'set1':
+		$objPage->arrErr = lfErrorCheck1($objPage->arrForm);
+		if (count($objPage->arrErr) == 0) {
+			$objPage->tpl_mainpage = 'shopping/set1.tpl';
+
+			// Í¹ÊØÈÖ¹æ¤«¤é½»½ê¤Î¼èÆÀ
+			$address = lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
+
+			$objPage->arrForm['pref'] = @$address[0]['state'];
+			$objPage->arrForm['addr01'] = @$address[0]['city'] . @$address[0]['town'];
+		}
+		break;
+	case 'set2':
+		$objPage->arrErr = lfErrorCheck2($objPage->arrForm);
+		if (count($objPage->arrErr) == 0) {
+			$objPage->tpl_mainpage = 'shopping/set2.tpl';
+		} else {
+			$objPage->tpl_mainpage = 'shopping/set1.tpl';
+
+			$checkVal = array("pref", "addr01", "addr02", "addr03", "tel01", "tel02", "tel03");
+			//-- ¥Ç¡¼¥¿ÀßÄê
+			unset($objPage->list_data);
+			foreach($_POST as $key => $val) {
+				if ($key != "mode" && !in_array($key, $checkVal)) $objPage->list_data[ $key ] = $val;
+			}
+		}
+		break;
+	case 'complete':
+		$objPage->arrErr = lfErrorCheck($objPage->arrForm);
+		if (count($objPage->arrErr) == 0) {
+			// ÅÐÏ¿
+			$other_deliv_id = lfRegistData($_POST,$arrRegistColumn);
+
+			// ÅÐÏ¿ºÑ¤ß¤ÎÊÌ¤Î¤ªÆÏ¤±Àè¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë½ñ¤­¹þ¤à
+			lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id);
+
+			// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+			$objSiteSess->setRegistFlag();
+			// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸¤Ø°ÜÆ°
+			header("Location: " . gfAddSessionId(URL_SHOP_PAYMENT));
+			exit;
+		} else {
+			sfDispSiteError(CUSTOMER_ERROR);
+		}
+		break;
+	default:
+		$deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id')));
+		if ($deliv_count >= DELIV_ADDR_MAX){
+			sfDispSiteError(FREE_ERROR_MSG, "", false, "ºÇÂçÅÐÏ¿·ï¿ô¤òÄ¶¤¨¤Æ¤¤¤Þ¤¹¡£");
+		}
+}
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-------------------------------------------------------------------------------------------------------------
+
+/* ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+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 lfErrorCheck1() {
+	$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"));
+	return $objErr->arrErr;
+	
+}
+
+/* ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
+function lfErrorCheck2() {
+	$objErr = new SC_CheckError();
+	
+	$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);
+
+		$sqlse = "SELECT max(other_deliv_id) FROM dtb_other_deliv WHERE customer_id = ?";
+		$array['other_deliv_id'] = $objConn->getOne($sqlse, array($arrRegist['customer_id']));
+	}
+
+	$objConn->query("COMMIT");
+
+	return $array['other_deliv_id'];
+}
+
+//----¡¡¼èÆÀÊ¸»úÎó¤ÎÊÑ´¹
+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 lfGetAddress($zipcode) {
+	global $arrPref;
+
+	$conn = new SC_DBconn(ZIP_DSN);
+
+	// Í¹ÊØÈÖ¹æ¸¡º÷Ê¸ºîÀ®
+	$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);
+
+	/*
+		ÁíÌ³¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
+		°Ê²¼¤Î¤è¤¦¤ÊÊ¸»úÎó¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç	ÂÐºö¤¹¤ë¡£
+		¡¦¡Ê£±¡¦£±£¹ÃúÌÜ¡Ë
+		¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
+	*/
+	$town =  $data_list[0]['town'];
+	$town = ereg_replace("¡Ê.*¡Ë$","",$town);
+	$town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
+	$data_list[0]['town'] = $town;
+	$data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
+
+	return $data_list;
+}
+
+/* ÊÌ¤Î¤ªÆÏ¤±Àè½»½ê¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
+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);
+}
+
+?>
Index: /branches/mobile/html/mobile/shopping/payment.php
===================================================================
--- /branches/mobile/html/mobile/shopping/payment.php	(revision 11409)
+++ /branches/mobile/html/mobile/shopping/payment.php	(revision 11409)
@@ -0,0 +1,333 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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);
+
+// ¥«¡¼ÅÔÆâ¤Î¾¦ÉÊ¤ÎÇä¤êÀÚ¤ì¥Á¥§¥Ã¥¯
+$objCartSess->chkSoldOut($objCartSess->getCartList());
+
+switch($_POST['mode']) {
+case 'confirm':
+	// ÆþÎÏÃÍ¤ÎÊÑ´¹
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($objPage->arrData );
+	// ÆþÎÏ¥¨¥é¡¼¤Ê¤·
+	if(count($objPage->arrErr) == 0) {
+		// DB¤Ø¤Î¥Ç¡¼¥¿ÅÐÏ¿
+		lfRegistData($uniqid);
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+		header("Location: " . gfAddSessionId(URL_SHOP_CONFIRM));
+		exit;
+	}else{
+		// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
+		$uniqid = $objSiteSess->getUniqId();
+		// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¤Î¾ðÊó¤ò³ÊÇ¼
+		lfSetOrderTempData($uniqid);
+	}
+	break;
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Èó²ñ°÷¤Î¾ì¹ç
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . gfAddSessionId(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', 'deliv_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("rank DESC");
+	//ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤»ÙÊ§ÊýË¡¤ò¼èÆÀ
+	$arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", "del_flg = 0 AND deliv_id IN (SELECT deliv_id FROM dtb_deliv WHERE del_flg = 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, deliv_time", "dtb_delivtime", $where, array($time_id));
+	return (array($arrRet[0]['deliv_id'], $arrRet[0]['deliv_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: /branches/mobile/html/mobile/shopping/load_payment_module.php
===================================================================
--- /branches/mobile/html/mobile/shopping/load_payment_module.php	(revision 11409)
+++ /branches/mobile/html/mobile/shopping/load_payment_module.php	(revision 11409)
@@ -0,0 +1,42 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objQuery = new SC_Query();
+
+// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿µ­Ï¿¤¬¤¢¤ë¤«È½Äê
+sfIsPrePage($objSiteSess);
+
+// ¥¢¥¯¥»¥¹¤ÎÀµÅöÀ­¤ÎÈ½Äê
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+$payment_id = $_SESSION["payment_id"];
+
+// »ÙÊ§¤¤ID¤¬Ìµ¤¤¾ì¹ç¤Ë¤Ï¥¨¥é¡¼
+if($payment_id == ""){
+	sfDispSiteError(PAGE_ERROR, "", true);
+}
+
+// ·èºÑ¾ðÊó¤ò¼èÆÀ¤¹¤ë
+if(sfColumnExists("dtb_payment", "memo01")){
+	$sql = "SELECT module_path, memo01, memo02, memo03, memo04, memo05, memo06, memo07, memo08, memo09, memo10 FROM dtb_payment WHERE payment_id = ?";
+	$arrPayment = $objQuery->getall($sql, array($payment_id));
+}
+
+if(count($arrPayment) > 0) {
+	$path = $arrPayment[0]['module_path'];
+	if(file_exists($path)) {
+		require_once($path);
+		exit;
+	} else {
+		sfDispSiteError(FREE_ERROR_MSG, "", true, "¥â¥¸¥å¡¼¥ë¥Õ¥¡¥¤¥ë¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br />¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£");
+	}
+}
+
+?>
Index: /branches/mobile/html/mobile/shopping/deliv.php
===================================================================
--- /branches/mobile/html/mobile/shopping/deliv.php	(revision 11457)
+++ /branches/mobile/html/mobile/shopping/deliv.php	(revision 11457)
@@ -0,0 +1,315 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) &&
+		   !$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) {
+			// ²¾ÅÐÏ¿¤ÎÈ½Äê
+			$objQuery = new SC_Query;
+			$where = "email = ? AND status = 1 AND del_flg = 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: " . gfAddSessionId(URL_SHOP_TOP));
+		exit;
+	}
+
+	// ¥í¥°¥¤¥ó¤¬À®¸ù¤·¤¿¾ì¹ç¤Ï·ÈÂÓÃ¼ËöID¤òÊÝÂ¸¤¹¤ë¡£
+	$objCustomer->updateMobilePhoneId();
+
+	// ·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¥³¥Ô¡¼¤¹¤ë¡£
+	$objCustomer->updateEmailMobile();
+
+	// ·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+	if (!$objCustomer->hasValue('email_mobile')) {
+		header('Location: ' . gfAddSessionId('../entry/email_mobile.php'));
+		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: " . gfAddSessionId(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: " . gfAddSessionId(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, zip01, zip02";
+$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, zip01, zip02";
+$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: /branches/mobile/html/mobile/shopping/index.php
===================================================================
--- /branches/mobile/html/mobile/shopping/index.php	(revision 11409)
+++ /branches/mobile/html/mobile/shopping/index.php	(revision 11409)
@@ -0,0 +1,248 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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: " . gfAddSessionId('deliv.php'));
+	exit;
+}
+
+// ·ÈÂÓÃ¼ËöID¤¬°ìÃ×¤¹¤ë²ñ°÷¤¬Â¸ºß¤¹¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+$objPage->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId();
+
+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: " . gfAddSessionId(URL_SHOP_PAYMENT));
+		exit;		
+	}
+	
+	break;
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+	header("Location: " . gfAddSessionId(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) {
+		$sqlval['create_date'] = 'Now()';
+		$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: /branches/mobile/html/mobile/shopping/complete.php
===================================================================
--- /branches/mobile/html/mobile/shopping/complete.php	(revision 11409)
+++ /branches/mobile/html/mobile/shopping/complete.php	(revision 11409)
@@ -0,0 +1,524 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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 = "¤´ÃíÊ¸´°Î»";
+		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();
+
+// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿¤«È½Äê
+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');
+	}
+
+	//¤½¤ÎÂ¾¾ðÊó¤Î¼èÆÀ
+	$other_data = $objQuery->get("dtb_order", "memo02", "order_id = ? ", array($order_id));
+	if($other_data != "") {
+		$arrOther = unserialize($other_data);
+		
+		// ¥Ç¡¼¥¿¤òÊÔ½¸
+		foreach($arrOther as $key => $val){
+			// URL¤Î¾ì¹ç¤Ë¤Ï¥ê¥ó¥¯¤Ä¤­¤ÇÉ½¼¨¤µ¤»¤ë
+			if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $val["value"])) {
+				$arrOther[$key]["value"] = "<a href='#' onClick=\"window.open('". $val["value"] . "'); \" >" . $val["value"] ."</a>";
+			}
+		}
+				
+		$objPage->arrOther = $arrOther;
+		
+	}
+	
+	// ¥¢¥Õ¥£¥ê¥¨¥¤¥ÈÍÑ¥³¥ó¥Ð¡¼¥¸¥ç¥ó¥¿¥°¤ÎÀßÄê
+	$objPage->tpl_conv_page = AFF_SHOPPING_COMPLETE;
+	$objPage->tpl_aff_option = "order_id=$order_id";
+	//¹ç·×²Á³Ê¤Î¼èÆÀ
+	$total = $objQuery->get("dtb_order", "total", "order_id = ? ", array($order_id));
+	if($total != "") {
+		$objPage->tpl_aff_option.= "|total=$total";
+	}
+}
+
+$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, $objQuery);
+	} else {
+		//¹ØÆþ»þ¶¯À©²ñ°÷ÅÐÏ¿
+		switch(PURCHASE_CUSTOMER_REGIST) {
+		//Ìµ¸ú
+		case '0':
+			// ¹ØÆþ»þ²ñ°÷ÅÐÏ¿
+			if($arrData['member_check'] == '1') {
+				// ²¾²ñ°÷ÅÐÏ¿
+				$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
+				// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+				lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
+			}
+			break;
+		//Í­¸ú
+		case '1':
+			// ²¾²ñ°÷ÅÐÏ¿
+			$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
+			// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+			lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
+			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();
+	$sqlval['create_date'] = "now()";
+	$sqlval['update_date'] = "now()";
+	$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;
+	}
+
+	$objQuery = new SC_Query();
+	$objQuery->begin();	
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®ÍÑ¥Æ¡¼¥Ö¥ëÅÐÏ¿
+	lfRegistNonCustomer($arrData['order_email'], $mail_flag, $objQuery);
+	$objQuery->commit();
+
+	//¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+	$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']);	// ¥ê¥Þ¥¤¥ó¥À¡¼Åú¤¨
+
+	// ÃíÊ¸¥¹¥Æ¡¼¥¿¥¹:»ØÄê¤¬Ìµ¤±¤ì¤Ð¿·µ¬¼õÉÕ¤ËÀßÄê
+	if($sqlval["status"] == ""){
+		$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'];
+	}
+	
+	$order_id = $arrData['order_id'];		// ¥ª¡¼¥À¡¼ID
+	$sqlval['create_date'] = 'now()';		// ¼õÃíÆü
+	
+	// ¥²¥Ã¥È¤ÎÃÍ¤ò¥¤¥ó¥µ¡¼¥È
+	//$sqlval = lfGetInsParam($sqlval);
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_order", $sqlval);
+	
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®´õË¾¾ðÊó¤ÎÅÐÏ¿
+	lfRegistNonCustomer($arrData['order_email'], $arrData['mail_flag'], $objQuery);
+	
+	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['del_flg'] = 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) {
+	$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) {
+	// ²ñ°÷¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+	if(!sfCheckCustomerMailMaga($email)) {
+		$where = "email = ?";
+		$objQuery->delete("dtb_customer_mail", $where, array($email));
+		$sqlval['email'] = $email;
+		$sqlval['mail_flag'] = $mail_flag;
+		$sqlval['create_date'] = "now()";
+		$sqlval['update_date'] = "now()";
+		$objQuery->insert("dtb_customer_mail", $sqlval);
+	}
+}
+
+// ºß¸Ë¤ò¸º¤é¤¹½èÍý
+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, "", true);
+	// ÌµÀ©¸Â¤Î¾ì¹ç¡¢ºß¸Ë¤Ï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);
+	}
+}
+
+// GET¤ÎÃÍ¤ò¥¤¥ó¥µ¡¼¥ÈÍÑ¤ËÀ°¤¨¤ë
+function lfGetInsParam($sqlVal){
+	
+	foreach($_GET as $key => $val){
+		// ¥«¥é¥à¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+		if(sfColumnExists("dtb_order", $key)) $sqlVal[$key] = $val;
+	}
+	
+	return $sqlVal;
+}
+
+?>
Index: /branches/mobile/html/mobile/unsupported/index.php
===================================================================
--- /branches/mobile/html/mobile/unsupported/index.php	(revision 11403)
+++ /branches/mobile/html/mobile/unsupported/index.php	(revision 11403)
@@ -0,0 +1,24 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = '';			// ¥á¥¤¥óCSS¥Ñ¥¹
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_mainpage = 'unsupported/index.tpl';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/cart/index.php
===================================================================
--- /branches/mobile/html/mobile/cart/index.php	(revision 11406)
+++ /branches/mobile/html/mobile/cart/index.php	(revision 11406)
@@ -0,0 +1,115 @@
+<?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 = "¶ºÞ¤ÎÃæ¤ò¸«¤ë";
+	}
+}
+
+// Çã¤¤Êª¤òÂ³¤±¤ë¾ì¹ç
+if($_REQUEST['continue']) {
+	header("Location: " . gfAddSessionId(URL_SITE_TOP) );
+	exit;
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView(false);
+$objCartSess = new SC_CartSession("", false);
+$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: " . gfAddSessionId(URL_SHOP_TOP));
+		exit;
+	}
+	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;
+
+// Á°ÊÇ¤ÎURL¤ò¼èÆÀ
+$objPage->tpl_prev_url = $objCartSess->getPrevURL();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/contact/index.php
===================================================================
--- /branches/mobile/html/mobile/contact/index.php	(revision 11406)
+++ /branches/mobile/html/mobile/contact/index.php	(revision 11406)
@@ -0,0 +1,26 @@
+<?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();			// Å¹ÊÞ´ðËÜ¾ðÊó
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->assignarray($CONF);
+$objView->display(SITE_FRAME);
+
+//------------------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/magazine/confirm.php
===================================================================
--- /branches/mobile/html/mobile/magazine/confirm.php	(revision 11418)
+++ /branches/mobile/html/mobile/magazine/confirm.php	(revision 11418)
@@ -0,0 +1,186 @@
+<?php
+/**
+ * ¥á¥ë¥Þ¥¬³ÎÇ§
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'magazine/confirm.tpl';
+		$this->tpl_title .= '¥á¥ë¥Þ¥¬³ÎÇ§';
+	}
+}
+
+$objPage = new LC_Page();
+$objConn = new SC_DbConn();
+$objPage->arrForm = $_POST;
+
+// ÅÐÏ¿
+if (isset($_REQUEST['btnRegist'])) {
+	$objPage->arrErr = lfMailErrorCheck($objPage->arrForm, "regist");
+
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð
+	if (count($objPage->arrErr) == 0) {
+		// ³ÎÇ§
+		$objPage->arrForm['kind'] = '¥á¥ë¥Þ¥¬ÅÐÏ¿';
+		$objPage->arrForm['type'] = 'regist';
+		$objPage->arrForm['mail'] = $objPage->arrForm['regist'];
+	} else {
+		$objPage->tpl_mainpage = 'magazine/index.tpl';
+		$objPage->tpl_title = '¥á¥ë¥Þ¥¬ÅÐÏ¿¡¦²ò½ü';
+	}
+// ²ò½ü
+} elseif (isset($_REQUEST['btnCancel'])) {
+	$objPage->arrErr = lfMailErrorCheck($objPage->arrForm, "cancel");
+
+	// ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð
+	if (count($objPage->arrErr) == 0) {
+		// ³ÎÇ§
+		$objPage->arrForm['kind'] = '¥á¥ë¥Þ¥¬²ò½ü';
+		$objPage->arrForm['type'] = 'cancel';
+		$objPage->arrForm['mail'] = $objPage->arrForm['cancel'];
+	} else {
+		$objPage->tpl_mainpage = 'magazine/index.tpl';
+		$objPage->tpl_title = '¥á¥ë¥Þ¥¬ÅÐÏ¿¡¦²ò½ü';
+	}
+// ´°Î»
+} elseif ($_REQUEST['mode'] == 'regist' or $_REQUEST['mode'] == 'cancel') {
+
+	//¡¡ÅÐÏ¿
+	if ($_REQUEST['mode'] == 'regist') {
+		$uniqId = lfRegistData($_POST["email"]);
+		$subject = sfMakesubject('¥á¥ë¥Þ¥¬ÅÐÏ¿¤Î¤´³ÎÇ§');
+	//¡¡²ò½ü
+	} elseif ($_REQUEST['mode'] == 'cancel') {
+		$uniqId = lfGetSecretKey($_POST["email"]);
+		$subject = sfMakesubject('¥á¥ë¥Þ¥¬²ò½ü¤Î¤´³ÎÇ§');
+	}
+	$CONF = sf_getBasisData();
+	$objPage->CONF = $CONF;
+	$objPage->tpl_url = gfAddSessionId(SSL_URL . "magazine/" . $_REQUEST['mode'] . ".php?id=" . $uniqId);
+	
+	$objMailText = new SC_SiteView();
+	$objMailText->assignobj($objPage);
+	$toCustomerMail = $objMailText->fetch("mail_templates/mailmagazine_" . $_REQUEST['mode'] . ".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
+														);
+	// °¸Àè¤ÎÀßÄê
+	$objMail->setTo($_POST["email"], $_POST["email"]);
+	$objMail->sendMail();
+
+	// ´°Î»¥Ú¡¼¥¸¤Ë°ÜÆ°¤µ¤»¤ë¡£
+	header("Location:" . gfAddSessionId("./complete.php"));
+	exit;
+} else {
+	sfDispSiteError(CUSTOMER_ERROR);
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfMailErrorCheck($array, $dataName) {
+	$objErr = new SC_CheckError($array);
+	$objErr->doFunc(
+				array('¥á¡¼¥ë¥¢¥É¥ì¥¹', $dataName, MTEXT_LEN) ,
+				array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", 
+					"SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
+
+	// ÆþÎÏ¥¨¥é¡¼¤¬¤Ê¤±¤ì¤Ð
+	if (count($objErr->arrErr) == 0) {
+		// ¥á¥ë¥Þ¥¬¤ÎÅÐÏ¿Í­Ìµ
+		$flg = lfIsRegistData($array[$dataName]);
+
+		// ÅÐÏ¿¤Î»þ
+		if ($dataName == 'regist' and $flg == true) {
+			$objErr->arrErr[$dataName] = "´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£<br>";
+		// ²ò½ü¤Î»þ
+		} elseif ($dataName == 'cancel' and $flg == false) {
+			$objErr->arrErr[$dataName] = "¥á¥ë¥Þ¥¬ÅÐÏ¿¤¬¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br>";
+		}
+	}
+
+	return $objErr->arrErr;
+}
+
+
+//---- ¥á¥ë¥Þ¥¬ÅÐÏ¿
+function lfRegistData ($email) {
+	global $objConn;
+
+	$count = 1;
+	while ($count != 0) {
+		$uniqid = sfGetUniqRandomId("t");
+		$count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_mail WHERE secret_key = ?", array($uniqid));
+	}
+	
+	$arrRegist["email"] = $email;			// ¥á¡¼¥ë¥¢¥É¥ì¥¹
+	$arrRegist["mail_flag"] = 5;			// ÅÐÏ¿¾õÂÖ
+	$arrRegist["secret_key"] = $uniqid;		// IDÈ¯¹Ô
+	$arrRegist["create_date"] = "now()"; 	// ºîÀ®Æü
+	$arrRegist["update_date"] = "now()"; 	// ¹¹¿·Æü
+
+	//-- ²¾ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+
+	$objQuery = new SC_Query();
+	$objQuery->insert("dtb_customer_mail", $arrRegist);
+
+	//--¡¡´û¤Ë¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¤«¤ÎÈ½Äê
+	$sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
+	$mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
+
+	if ($mailResult == 1) {		
+		$objQuery->update("dtb_customer_mail", $arrRegist, "email = '" .addslashes($arrRegist["email"]). "'");			
+	} else {
+		$objQuery->insert("dtb_customer_mail", $arrRegist);		
+	}
+	$objConn->query("COMMIT");
+
+	return $uniqid;
+}
+
+// ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥­¡¼¤Î¼èÆÀ
+function lfGetSecretKey ($email) {
+	global $objConn;
+
+	$sql = "SELECT secret_key FROM dtb_customer_mail WHERE email = ?";
+	return $objConn->getOne($sql, array($email));
+}
+
+// ´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«
+function lfIsRegistData ($email) {
+	global $objConn;
+
+	$sql = "SELECT email, mail_flag FROM dtb_customer_mail WHERE email = ?";
+	$mailResult = $objConn->getRow($sql, array($email));
+
+	// NULL¤â¹ØÆÉ¤È¤ß¤Ê¤¹
+	if (count($mailResult) == 0 or ($mailResult[1] != null and $mailResult[1] <= 2 )) {
+		return false;
+	} else {
+		return true;
+	}
+}
+
+
+?>
Index: /branches/mobile/html/mobile/magazine/regist.php
===================================================================
--- /branches/mobile/html/mobile/magazine/regist.php	(revision 11418)
+++ /branches/mobile/html/mobile/magazine/regist.php	(revision 11418)
@@ -0,0 +1,58 @@
+<?php
+/**
+ * ¥á¥ë¥Þ¥¬ÅÐÏ¿
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'magazine/regist.tpl';
+		$this->tpl_title .= '¥á¥ë¥Þ¥¬ÅÐÏ¿´°Î»';
+	}
+}
+
+$objPage = new LC_Page();
+$objQuery = new SC_Query();
+
+// secret_key¤Î¼èÆÀ
+$key = $_GET['id'];
+
+if (empty($key) or !lfExistKey($key))  {
+	sfDispSiteError(PAGE_ERROR);
+} else {
+	lfChangeData($key);
+}
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+// ¥á¥ë¥Þ¥¬¤ÎÅÐÏ¿¤ò´°Î»¤µ¤»¤ë
+function lfChangeData($key) {
+	global $objQuery;
+
+	$arrUpdate['mail_flag'] = 2;
+	$arrUpdate['secret_key'] = NULL;
+	$result = $objQuery->update("dtb_customer_mail", $arrUpdate, "secret_key = '" .addslashes($key). "'");
+}
+
+// ¥­¡¼¤¬Â¸ºß¤¹¤ë¤«¤É¤¦¤«
+function lfExistKey($key) {
+	global $objQuery;
+
+	$sql = "SELECT count(*) FROM dtb_customer_mail WHERE secret_key = ?";
+	$result = $objQuery->getOne($sql, array($key));
+
+	if ($result == 1) {
+		return true;
+	} else {
+		return false;
+	}
+}
+
+
+?>
Index: /branches/mobile/html/mobile/magazine/cancel.php
===================================================================
--- /branches/mobile/html/mobile/magazine/cancel.php	(revision 11418)
+++ /branches/mobile/html/mobile/magazine/cancel.php	(revision 11418)
@@ -0,0 +1,58 @@
+<?php
+/**
+ * ¥á¥ë¥Þ¥¬²ò½ü
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'magazine/cancel.tpl';
+		$this->tpl_title .= '¥á¥ë¥Þ¥¬²ò½ü´°Î»';
+	}
+}
+
+$objPage = new LC_Page();
+$objQuery = new SC_Query();
+
+// secret_key¤Î¼èÆÀ
+$key = $_GET['id'];
+
+if (empty($key) or !lfExistKey($key))  {
+	sfDispSiteError(PAGE_ERROR);
+} else {
+	lfChangeData($key);
+}
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+// ¥á¥ë¥Þ¥¬¤Î²ò½ü¤ò´°Î»¤µ¤»¤ë
+function lfChangeData($key) {
+	global $objQuery;
+
+	$arrUpdate['mail_flag'] = 3;
+	$arrUpdate['secret_key'] = NULL;
+	$result = $objQuery->update("dtb_customer_mail", $arrUpdate, "secret_key = '" .addslashes($key). "'");
+}
+
+// ¥­¡¼¤¬Â¸ºß¤¹¤ë¤«¤É¤¦¤«
+function lfExistKey($key) {
+	global $objQuery;
+
+	$sql = "SELECT count(*) FROM dtb_customer_mail WHERE secret_key = ?";
+	$result = $objQuery->getOne($sql, array($key));
+
+	if ($result == 1) {
+		return true;
+	} else {
+		return false;
+	}
+}
+
+
+?>
Index: /branches/mobile/html/mobile/magazine/index.php
===================================================================
--- /branches/mobile/html/mobile/magazine/index.php	(revision 11418)
+++ /branches/mobile/html/mobile/magazine/index.php	(revision 11418)
@@ -0,0 +1,27 @@
+<?php
+/**
+ * ¥á¥ë¥Þ¥¬ÅÐÏ¿¡¦²ò½ü¡¡¥È¥Ã¥×¥Ú¡¼¥¸
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'magazine/index.tpl';
+		$this->tpl_title .= '¥á¥ë¥Þ¥¬ÅÐÏ¿¡¦²ò½ü';
+	}
+}
+
+$objPage = new LC_Page();
+$objPage->arrForm = $_POST;
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/magazine/complete.php
===================================================================
--- /branches/mobile/html/mobile/magazine/complete.php	(revision 11418)
+++ /branches/mobile/html/mobile/magazine/complete.php	(revision 11418)
@@ -0,0 +1,19 @@
+<?php
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'magazine/complete.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title .= '¥á¥ë¥Þ¥¬ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';			//¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//----------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/guide/kiyaku.php
===================================================================
--- /branches/mobile/html/mobile/guide/kiyaku.php	(revision 11406)
+++ /branches/mobile/html/mobile/guide/kiyaku.php	(revision 11406)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¤´ÍøÍÑµ¬Ìó
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'guide/kiyaku.tpl';	// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¤´ÍøÍÑµ¬Ìó';
+	}
+}
+
+$objPage = new LC_Page();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+// ÍøÍÑµ¬Ìó¤ò¼èÆÀ¤¹¤ë¡£
+lfGetKiyaku(intval(@$_GET['page']), $objPage);
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+/**
+ * ÍøÍÑµ¬Ìó¤ò¼èÆÀ¤·¡¢¥Ú¡¼¥¸¥ª¥Ö¥¸¥§¥¯¥È¤Ë³ÊÇ¼¤¹¤ë¡£
+ *
+ * @param integer $index µ¬Ìó¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
+ * @param object &$objPage ¥Ú¡¼¥¸¥ª¥Ö¥¸¥§¥¯¥È
+ * @return void
+ */
+function lfGetKiyaku($index, &$objPage)
+{
+	$objQuery = new SC_Query();
+	$objQuery->setorder('rank DESC');
+	$arrRet = $objQuery->select('kiyaku_title, kiyaku_text', 'dtb_kiyaku', 'del_flg <> 1');
+
+	$number = count($arrRet);
+	if ($number > 0) {
+		$last = $number - 1;
+	} else {
+		$last = 0;
+	}
+
+	if ($index < 0) {
+		$index = 0;
+	} elseif ($index > $last) {
+		$index = $last;
+	}
+
+	$objPage->tpl_kiyaku_title = @$arrRet[$index]['kiyaku_title'];
+	$objPage->tpl_kiyaku_text = @$arrRet[$index]['kiyaku_text'];
+	$objPage->tpl_kiyaku_index = $index;
+	$objPage->tpl_kiyaku_last_index = $last;
+	$objPage->tpl_kiyaku_is_first = $index <= 0;
+	$objPage->tpl_kiyaku_is_last = $index >= $last;
+}
+?>
Index: /branches/mobile/html/mobile/guide/privacy.php
===================================================================
--- /branches/mobile/html/mobile/guide/privacy.php	(revision 11406)
+++ /branches/mobile/html/mobile/guide/privacy.php	(revision 11406)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¥×¥é¥¤¥Ð¥·¡¼¥Ý¥ê¥·¡¼
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'guide/privacy.tpl';	// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¥×¥é¥¤¥Ð¥·¡¼¥Ý¥ê¥·¡¼';
+	}
+}
+
+$objPage = new LC_Page();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/guide/usage.php
===================================================================
--- /branches/mobile/html/mobile/guide/usage.php	(revision 11406)
+++ /branches/mobile/html/mobile/guide/usage.php	(revision 11406)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¤´ÍøÍÑÊýË¡
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'guide/usage.tpl';	// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¤´ÍøÍÑÊýË¡';
+	}
+}
+
+$objPage = new LC_Page();
+
+switch (@$_GET['page']) {
+case '1':
+case '2':
+case '3':
+case '4':
+	$objPage->tpl_mainpage = 'guide/usage' . $_GET['page'] . '.tpl';
+	break;
+}
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/guide/index.php
===================================================================
--- /branches/mobile/html/mobile/guide/index.php	(revision 11406)
+++ /branches/mobile/html/mobile/guide/index.php	(revision 11406)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¤´ÍøÍÑ¥¬¥¤¥É
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'guide/index.tpl';	// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¤´ÍøÍÑ¥¬¥¤¥É';
+	}
+}
+
+$objPage = new LC_Page();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/guide/charge.php
===================================================================
--- /branches/mobile/html/mobile/guide/charge.php	(revision 11406)
+++ /branches/mobile/html/mobile/guide/charge.php	(revision 11406)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/ÄÌ¿®ÎÁ¤Ë¤Ä¤¤¤Æ
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'guide/charge.tpl';	// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = 'ÄÌ¿®ÎÁ¤Ë¤Ä¤¤¤Æ';
+	}
+}
+
+$objPage = new LC_Page();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/guide/about.php
===================================================================
--- /branches/mobile/html/mobile/guide/about.php	(revision 11406)
+++ /branches/mobile/html/mobile/guide/about.php	(revision 11406)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/±¿±Ä²ñ¼Ò¾Ò²ð
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'guide/about.tpl';	// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¥×¥é¥¤¥Ð¥·¡¼¥Ý¥ê¥·¡¼';
+	}
+}
+
+$objPage = new LC_Page();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/index.php
===================================================================
--- /branches/mobile/html/mobile/index.php	(revision 11398)
+++ /branches/mobile/html/mobile/index.php	(revision 11398)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¥È¥Ã¥×¥Ú¡¼¥¸
+ */
+
+require_once('./require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = '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: /branches/mobile/html/mobile/regist/index.php
===================================================================
--- /branches/mobile/html/mobile/regist/index.php	(revision 11411)
+++ /branches/mobile/html/mobile/regist/index.php	(revision 11411)
@@ -0,0 +1,196 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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: " . gfAddSessionId("./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"]));
+
+	/* ¹ØÆþ»þ¤Î¼«Æ°²ñ°÷ÅÐÏ¿¤Ï¹Ô¤ï¤Ê¤¤¤¿¤áDEL
+	// ¹ØÆþ»þÅÐÏ¿¤Î¾ì¹ç¡¢¤½¤Î²ó¤Î¹ØÆþ¤ò²ñ°÷¹ØÆþ¤È¤ß¤Ê¤¹¡£
+	// ²ñ°÷¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+	$where1 = "secret_key = ? AND status = 2";
+	$customer = $objQuery->select("*", "dtb_customer", $where1, array($secret));
+	// ½é²ó¹ØÆþ¾ðÊó¤ÎÆÉ¤ß¹þ¤ß
+	$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 del_flg = 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: /branches/mobile/html/mobile/regist/complete.php
===================================================================
--- /branches/mobile/html/mobile/regist/complete.php	(revision 11412)
+++ /branches/mobile/html/mobile/regist/complete.php	(revision 11412)
@@ -0,0 +1,31 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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();
+
+// ¥«¡¼¥È¤¬¶õ¤«¤É¤¦¤«¤ò³ÎÇ§¤¹¤ë¡£
+$objCartSess = new SC_CartSession("", false);
+$objPage->tpl_cart_empty = count($objCartSess->getCartList()) < 1;
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+?>
Index: /branches/mobile/html/mobile/forgot/index.php
===================================================================
--- /branches/mobile/html/mobile/forgot/index.php	(revision 11411)
+++ /branches/mobile/html/mobile/forgot/index.php	(revision 11411)
@@ -0,0 +1,160 @@
+<?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_title = '¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿Êý';
+		$this->tpl_mainno = '';
+	}
+}
+
+$conn = new SC_DBConn();
+$objPage = new LC_Page();
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+$objView = new SC_SiteView();
+$objSess = new SC_Session();
+$CONF = sf_getBasisData();					// Å¹ÊÞ´ðËÜ¾ðÊó
+// ¥¯¥Ã¥­¡¼´ÉÍý¥¯¥é¥¹
+$objCookie = new SC_Cookie(COOKIE_EXPIRE);
+
+if (isset($_SESSION['mobile']['kara_mail_from'])) {
+	if (!isset($_POST['mode'])) {
+		$_POST['mode'] = 'mail_check';
+	}
+	$_POST['email'] = $_SESSION['mobile']['kara_mail_from'];
+}
+
+if ( $_POST['mode'] == 'mail_check' ){
+	//¥á¥¢¥ÉÆþÎÏ»þ
+	$_POST['email'] = strtolower($_POST['email']);
+	$sql = "SELECT * FROM dtb_customer WHERE (email ILIKE ? OR email_mobile ILIKE ?) AND status = 2 AND del_flg = 0";
+	$result = $conn->getAll($sql, array($_POST['email'], $_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 del_flg = 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 ? OR email_mobile ILIKE ?) AND del_flg = 0";
+		$result = $conn->getAll($sql, array($_SESSION['forgot']['email'], $_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( sha1($objPage->temp_password . ":" . AUTH_MAGIC) ,$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');
+}
+
+// ¶õ¥á¡¼¥ëÍÑ¤Î¥È¡¼¥¯¥ó¤òºîÀ®¡£
+if (MOBILE_USE_KARA_MAIL) {
+	$token = gfPrepareKaraMail('forgot/index.php');
+	if ($token !== false) {
+		$objPage->tpl_kara_mail_to = MOBILE_KARA_MAIL_ADDRESS_USER . MOBILE_KARA_MAIL_ADDRESS_DELIMITER . 'forgot_' . $token . '@' . MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
+	}
+}
+
+//----¡¡¥Ú¡¼¥¸É½¼¨
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+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: /branches/mobile/html/mobile/entry/kiyaku.php
===================================================================
--- /branches/mobile/html/mobile/entry/kiyaku.php	(revision 11409)
+++ /branches/mobile/html/mobile/entry/kiyaku.php	(revision 11409)
@@ -0,0 +1,50 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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();
+
+$offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
+$next = $offset;
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+// µ¬ÌóÆâÍÆ¤Î¼èÆÀ
+$objQuery = new SC_Query();
+$count = $objQuery->count("dtb_kiyaku", "del_flg <> 1");
+$objQuery->setorder("rank DESC");
+$objQuery->setlimitoffset(1, $offset);
+$arrRet = $objQuery->select("kiyaku_title, kiyaku_text", "dtb_kiyaku", "del_flg <> 1");
+
+if($count > $offset + 1){
+	$next++;
+} else {
+	$next = -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->assign("offset", $next);
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/entry/email_mobile.php
===================================================================
--- /branches/mobile/html/mobile/entry/email_mobile.php	(revision 11415)
+++ /branches/mobile/html/mobile/entry/email_mobile.php	(revision 11415)
@@ -0,0 +1,110 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/·ÈÂÓ¥á¡¼¥ëÅÐÏ¿
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'entry/email_mobile.tpl';
+		$this->tpl_title = '·ÈÂÓ¥á¡¼¥ëÅÐÏ¿';
+		/*
+		 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;
+$objFormParam = new SC_FormParam;
+
+if (isset($_SESSION['mobile']['kara_mail_from'])) {
+	$_SERVER['REQUEST_METHOD'] = 'POST';
+	$_POST['email_mobile'] = $_SESSION['mobile']['kara_mail_from'];
+}
+
+lfInitParam($objFormParam);
+
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+	$objFormParam->setParam($_POST);
+	$objFormParam->convParam();
+	$objPage->arrErr = lfCheckError($objFormParam, $objCustomer);
+
+	if (empty($arrRet)) {
+		lfRegister($objFormParam, $objCustomer);
+		$objPage->tpl_mainpage = 'entry/email_mobile_complete.tpl';
+		$objPage->tpl_title = '·ÈÂÓ¥á¡¼¥ëÅÐÏ¿´°Î»';
+	}
+}
+
+// ¶õ¥á¡¼¥ëÍÑ¤Î¥È¡¼¥¯¥ó¤òºîÀ®¤¹¤ë¡£
+if (MOBILE_USE_KARA_MAIL) {
+	$token = gfPrepareKaraMail('entry/email_mobile.php');
+	if ($token !== false) {
+		$objPage->tpl_kara_mail_to = MOBILE_KARA_MAIL_ADDRESS_USER . MOBILE_KARA_MAIL_ADDRESS_DELIMITER . 'entry_' . $token . '@' . MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
+	}
+}
+
+$objPage->tpl_name = $objCustomer->getValue('name01');
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+function lfInitParam(&$objFormParam) {
+	$objFormParam->addParam('¥á¡¼¥ë¥¢¥É¥ì¥¹', 'email_mobile', MTEXT_LEN, 'a',
+		array('NO_SPTAB', 'EXIST_CHECK', 'MAX_LENGTH_CHECK', 'CHANGE_LOWER', 'EMAIL_CHAR_CHECK', 'MOBILE_EMAIL_CHECK'));
+}
+
+function lfCheckError(&$objFormParam, &$objCustomer) {
+	$arrRet = $objFormParam->getHashArray();
+	$objErr = new SC_CheckError($arrRet);
+	$objErr->arrErr = $objFormParam->checkError();
+
+	if (count($objErr->arrErr) > 0) {
+		return $objErr->arrErr;
+	}
+
+	$email_mobile = $objFormParam->getValue('email_mobile');
+	$customer_id = $objCustomer->getValue('customer_id');
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select('email, email_mobile, update_date, del_flg', 'dtb_customer', '(email ILIKE ? OR email_mobile ILIKE ?) AND customer_id <> ? ORDER BY del_flg', array($email_mobile, $email_mobile, $customer_id));
+
+	if (count($arrRet) > 0) {
+		if ($arrRet[0]['del_flg'] != '1') {
+			// ²ñ°÷¤Ç¤¢¤ë¾ì¹ç
+			$objErr->arrErr['email_mobile'] .= '¢¨ ¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£<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_mobile'] .= '¢¨ Âà²ñ¤«¤é°ìÄê´ü´Ö¤Î´Ö¤Ï¡¢Æ±¤¸¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò»ÈÍÑ¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br>';
+			}
+		}
+	}
+
+	return $objErr->arrErr;
+}
+
+function lfRegister(&$objFormParam, &$objCustomer)
+{
+	$customer_id = $objCustomer->getValue('customer_id');
+	$email_mobile = $objFormParam->getValue('email_mobile');
+
+	$objQuery = new SC_Query();
+	$objQuery->update('dtb_customer', array('email_mobile' => $email_mobile), 'customer_id = ?', array($customer_id));
+
+	$objCustomer->setValue('email_mobile', $email_mobile);
+}
+?>
Index: /branches/mobile/html/mobile/entry/index.php
===================================================================
--- /branches/mobile/html/mobile/entry/index.php	(revision 11413)
+++ /branches/mobile/html/mobile/entry/index.php	(revision 11413)
@@ -0,0 +1,441 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'entry/index.tpl';		// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title .= '²ñ°÷ÅÐÏ¿(1/3)';			//¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
+	}
+}
+
+//---- ¥Ú¡¼¥¸½é´üÀßÄê
+$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();
+
+// ¶õ¥á¡¼¥ë
+if (isset($_SESSION['mobile']['kara_mail_from'])) {
+	$objPage->tpl_kara_mail_from = $_POST['email'] = $_SESSION['mobile']['kara_mail_from'];
+} elseif (MOBILE_USE_KARA_MAIL) {
+	$token = gfPrepareKaraMail('entry/index.php');
+	if ($token !== false) {
+		$objPage->tpl_mainpage = 'entry/mail.tpl';
+		$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(¶õ¥á¡¼¥ë)';
+		$objPage->tpl_kara_mail_to = MOBILE_KARA_MAIL_ADDRESS_USER . MOBILE_KARA_MAIL_ADDRESS_DELIMITER . 'entry_' . $token . '@' . MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
+		$objPage->tpl_from_address = $CONF['email03'];
+	}
+}
+
+//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 = lfConvertParam($objPage->arrForm, $arrRegistColumn);
+
+	//--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	if ($_POST["mode"] == "set1") {
+		$objPage->arrErr = lfErrorCheck1($objPage->arrForm);
+		$objPage->tpl_mainpage = 'entry/index.tpl';
+		$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(1/3)';
+	} elseif ($_POST["mode"] == "set2") {
+		$objPage->arrErr = lfErrorCheck2($objPage->arrForm);
+		$objPage->tpl_mainpage = 'entry/set1.tpl';
+		$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(2/3)';
+	} else {
+		$objPage->arrErr = lfErrorCheck3($objPage->arrForm);
+		$objPage->tpl_mainpage = 'entry/set2.tpl';
+		$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(3/3)';
+	}
+
+	if ($objPage->arrErr || $_POST["mode"] == "return") {		// ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
+		foreach($objPage->arrForm as $key => $val) {
+			$objPage->$key = $val;
+		}
+
+		//-- ¥Ç¡¼¥¿¤ÎÀßÄê
+		if ($_POST["mode"] == "set1") {
+			$checkVal = array("email", "password", "reminder", "reminder_answer", "name01", "name02", "kana01", "kana02");
+			foreach($objPage->arrForm as $key => $val) {
+				if ($key != "mode" && $key != "subm" & !in_array($key, $checkVal)) $objPage->list_data[ $key ] = $val;
+			}
+
+		} elseif ($_POST["mode"] == "set2") {
+			$checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
+			foreach($objPage->arrForm as $key => $val) {
+				if ($key != "mode" && $key != "subm" & !in_array($key, $checkVal)) $objPage->list_data[ $key ] = $val;
+			}
+		} else {
+			$checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03");
+			foreach($objPage->arrForm as $key => $val) {
+				if ($key != "mode" && $key != "subm" & !in_array($key, $checkVal)) $objPage->list_data[ $key ] = $val;
+			}
+		}
+
+
+	} else {
+
+		//--¡¡¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê
+		if ($_POST["mode"] == "set1") {
+			$objPage->tpl_mainpage = 'entry/set1.tpl';
+			$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(2/3)';
+		} elseif ($_POST["mode"] == "set2") {
+			$objPage->tpl_mainpage = 'entry/set2.tpl';
+			$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(3/3)';
+
+			$address = lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
+			$objView->assign("pref", @$address[0]['state']);
+			$objView->assign("addr01", @$address[0]['city'] . @$address[0]['town']);
+		} elseif ($_POST["mode"] == "confirm") {
+			//¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨
+			$passlen = strlen($objPage->arrForm['password']);
+			$objPage->passlen = lfPassLen($passlen);
+			
+			//¥á¡¼¥ë¼õ¤±¼è¤ê
+			if ($objPage->arrForm['mail_flag'] = "ON") {
+				$objPage->arrForm['mail_flag']  = "2";
+			}
+
+			$objPage->tpl_mainpage = 'entry/confirm.tpl';
+			$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(³ÎÇ§¥Ú¡¼¥¸)';
+
+		}
+
+		//-- ¥Ç¡¼¥¿ÀßÄê
+		unset($objPage->list_data);
+		foreach($objPage->arrForm as $key => $val) {
+			if ($key != "mode" && $key != "subm") $objPage->list_data[ $key ] = $val;
+		}
+
+
+		//--¡¡²¾ÅÐÏ¿¤È´°Î»²èÌÌ
+		if ($_POST["mode"] == "complete") {
+			$objPage->uniqid = lfRegistData ($objPage->arrForm, $arrRegistColumn, $arrRejectRegistColumn);
+
+			// ¶õ¥á¡¼¥ë¤ò¼õ¿®ºÑ¤ß¤Î¾ì¹ç¤Ï¤¹¤°¤ËËÜÅÐÏ¿´°Î»¤Ë¤¹¤ë¡£
+			if (isset($_SESSION['mobile']['kara_mail_from'])) {
+				header("Location:" . gfAddSessionId(URL_DIR . "regist/index.php?mode=regist&id=" . $objPage->uniqid));
+				exit;
+			}
+
+			$objPage->tpl_mainpage = 'entry/complete.tpl';
+			$objPage->tpl_title = '²ñ°÷ÅÐÏ¿(´°Î»¥Ú¡¼¥¸)';
+
+			sfMobileSetExtSessionId('id', $objPage->uniqid, 'regist/index.php');
+
+			//¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+			$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:" . gfAddSessionId("./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"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
+	
+	$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È¯¹Ô
+	$arrRegist["create_date"] = "now()"; 	// ºîÀ®Æü
+	$arrRegist["update_date"] = "now()"; 	// ¹¹¿·Æü
+	$arrRegist["first_buy_date"] = "";	 	// ºÇ½é¤Î¹ØÆþÆü
+	
+	// ·ÈÂÓ¥á¡¼¥ë¥¢¥É¥ì¥¹
+	$arrRegist['email_mobile'] = $arrRegist['email'];
+
+	//-- ²¾ÅÐÏ¿¼Â¹Ô
+	$objConn->query("BEGIN");
+
+	$objQuery = new SC_Query();
+	$objQuery->insert("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; 
+	}
+	$arrRegistMail["update_date"] = "now()";
+	
+	// Èó²ñ°÷¤Ç¥á¥ë¥Þ¥¬ÅÐÏ¿¤·¤Æ¤¤¤ë¾ì¹ç
+	if ($mailResult == 1) {		
+		$objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");			
+	} else {				//¡¡¿·µ¬ÅÐÏ¿¤Î¾ì¹ç
+		$arrRegistMail["create_date"] = "now()";
+		$objQuery->insert("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 lfErrorCheck1($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('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
+
+	//¸½²ñ°÷¤ÎÈ½Äê ¢ª¡¡¸½²ñ°÷¤â¤·¤¯¤Ï²¾ÅÐÏ¿Ãæ¤Ï¡¢¥á¥¢¥É°ì°Õ¤¬Á°Äó¤Ë¤Ê¤Ã¤Æ¤ë¤Î¤ÇÆ±¤¸¥á¥¢¥É¤ÇÅÐÏ¿ÉÔ²Ä
+	if (strlen($array["email"]) > 0) {
+		$objQuery = new SC_Query();
+		$arrRet = $objQuery->select("email, update_date, del_flg", "dtb_customer","email ILIKE ? OR email_mobile ILIKE ? ORDER BY del_flg", array($array["email"], $array["email"]));
+				
+		if(count($arrRet) > 0) {
+			if($arrRet[0]['del_flg'] != '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("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_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","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck2($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+	
+	$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("¤´À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK")); 
+	$objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("SELECT_CHECK", "CHECK_DATE"));
+	
+	return $objErr->arrErr;
+}
+
+//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+function lfErrorCheck3($array) {
+
+	global $objConn;
+	$objErr = new SC_CheckError($array);
+	
+	$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","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"));
+	
+	return $objErr->arrErr;
+}
+
+//³ÎÇ§¥Ú¡¼¥¸ÍÑ¥Ñ¥¹¥ï¡¼¥ÉÉ½¼¨ÍÑ
+
+function lfPassLen($passlen){
+	$ret = "";
+	for ($i=0;$i<$passlen;true){
+	$ret.="*";
+	$i++;
+	}
+	return $ret;
+}
+
+
+// Í¹ÊØÈÖ¹æ¤«¤é½»½ê¤Î¼èÆÀ
+function lfGetAddress($zipcode) {
+	global $arrPref;
+
+	$conn = new SC_DBconn(ZIP_DSN);
+
+	// Í¹ÊØÈÖ¹æ¸¡º÷Ê¸ºîÀ®
+	$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);
+
+	/*
+		ÁíÌ³¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
+		°Ê²¼¤Î¤è¤¦¤ÊÊ¸»úÎó¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç	ÂÐºö¤¹¤ë¡£
+		¡¦¡Ê£±¡¦£±£¹ÃúÌÜ¡Ë
+		¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
+	*/
+	$town =  $data_list[0]['town'];
+	$town = ereg_replace("¡Ê.*¡Ë$","",$town);
+	$town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
+	$data_list[0]['town'] = $town;
+	$data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
+
+	return $data_list;
+}
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/entry/complete.php
===================================================================
--- /branches/mobile/html/mobile/entry/complete.php	(revision 11409)
+++ /branches/mobile/html/mobile/entry/complete.php	(revision 11409)
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/mobile/entry/new.php
===================================================================
--- /branches/mobile/html/mobile/entry/new.php	(revision 11409)
+++ /branches/mobile/html/mobile/entry/new.php	(revision 11409)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * ¿·µ¬ÅÐÏ¿
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'entry/new.tpl';	// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objPage = new LC_Page();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objView = new SC_SiteView();
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/mobile/frontparts/bloc/news.php
===================================================================
--- /branches/mobile/html/mobile/frontparts/bloc/news.php	(revision 11398)
+++ /branches/mobile/html/mobile/frontparts/bloc/news.php	(revision 11398)
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+class LC_NewsPage {
+	function LC_NewsPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/bloc/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 *, cast(substring(news_date,1,10) as date) as news_date_disp FROM dtb_news WHERE del_flg = '0' ORDER BY rank DESC";
+	$list_data = $conn->getAll($sql);
+	return $list_data;	
+}
+?>
Index: /branches/mobile/html/mobile/frontparts/bloc/category.php
===================================================================
--- /branches/mobile/html/mobile/frontparts/bloc/category.php	(revision 11398)
+++ /branches/mobile/html/mobile/frontparts/bloc/category.php	(revision 11398)
@@ -0,0 +1,53 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¥á¥¤¥ó¥«¥Æ¥´¥ê¡¼
+ */
+
+class LC_CatPage {
+	function LC_CatPage() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/bloc/category.tpl';	// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+	}
+}
+
+$objSubPage = new LC_CatPage();
+$objSubView = new SC_SiteView();
+
+$objSubPage = lfGetMainCat(true, $objSubPage);
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+// ¥á¥¤¥ó¥«¥Æ¥´¥ê¡¼¤Î¼èÆÀ
+function lfGetMainCat($count_check = false, $objSubPage) {
+	$objQuery = new SC_Query();
+	$col = "*";
+	$from = "dtb_category left join dtb_category_total_count using (category_id)";
+	// ¥á¥¤¥ó¥«¥Æ¥´¥ê¡¼¤È¤½¤ÎÄ¾²¼¤Î¥«¥Æ¥´¥ê¡¼¤ò¼èÆÀ¤¹¤ë¡£
+	$where = 'level <= 2 AND del_flg = 0';
+	// ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯
+	if($count_check) {
+		$where .= " AND product_count > 0";
+	}
+	$objQuery->setoption("ORDER BY rank DESC");
+	$arrRet = $objQuery->select($col, $from, $where);
+
+	// ¥á¥¤¥ó¥«¥Æ¥´¥ê¡¼¤òÃê½Ð¤¹¤ë¡£
+	$arrMainCat = array();
+	foreach ($arrRet as $cat) {
+		if ($cat['level'] != 1) {
+			continue;
+		}
+
+		// »Ò¥«¥Æ¥´¥ê¡¼¤ò»ý¤Ä¤«¤É¤¦¤«¤òÄ´¤Ù¤ë¡£
+		$arrChildrenID = sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $cat['category_id']);
+		$cat['has_children'] = count($arrChildrenID) > 0;
+		$arrMainCat[] = $cat;
+	}
+
+	$objSubPage->arrCat = $arrMainCat;
+	return $objSubPage;
+}
+?>
Index: /branches/mobile/html/mobile/frontparts/bloc/best5.php
===================================================================
--- /branches/mobile/html/mobile/frontparts/bloc/best5.php	(revision 11398)
+++ /branches/mobile/html/mobile/frontparts/bloc/best5.php	(revision 11398)
@@ -0,0 +1,43 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+class LC_Best5Page {
+	function LC_Best5Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_mainpage = 'frontparts/bloc/best5.tpl';	// ¥á¥¤¥ó
+	}
+}
+
+$objSubPage = new LC_Best5Page();
+$objSubView = new SC_SiteView();
+$objSiteInfo = $objView->objSiteInfo;
+
+// ´ðËÜ¾ðÊó¤òÅÏ¤¹
+$objSiteInfo = new SC_SiteInfo();
+$objSubPage->arrInfo = $objSiteInfo->data;
+
+//¤ª¤¹¤¹¤á¾¦ÉÊÉ½¼¨
+$objSubPage->arrBestProducts = lfGetRanking();
+
+$objSubView->assignobj($objSubPage);
+$objSubView->display($objSubPage->tpl_mainpage);
+//-----------------------------------------------------------------------------------------------------------------------------------
+//¤ª¤¹¤¹¤á¾¦ÉÊ¸¡º÷
+function lfGetRanking(){
+	$objQuery = new SC_Query();
+	
+	$col = "A.*, name, price02_min, price01_min, main_list_image ";
+	$from = "dtb_best_products AS A INNER JOIN vw_products_allclass AS allcls using(product_id)";
+	$where = "status = 1";
+	$order = "rank";
+	$objQuery->setorder($order);
+	
+	$arrBestProducts = $objQuery->select($col, $from, $where);
+		
+	return $arrBestProducts;
+}
+
+?>
Index: /branches/mobile/html/mobile/require.php
===================================================================
--- /branches/mobile/html/mobile/require.php	(revision 11418)
+++ /branches/mobile/html/mobile/require.php	(revision 11418)
@@ -0,0 +1,39 @@
+<?php
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir . "/../../data/conf/mobile.conf");
+require_once($include_dir . "/../../data/include/module.inc");
+require_once($include_dir . "/../../data/include/mobile.inc");
+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/class/GC_MobileUserAgent.php");
+require_once($include_dir . "/../../data/class/GC_MobileEmoji.php");
+require_once($include_dir . "/../../data/class/GC_MobileImage.php");
+require_once($include_dir . "/../../data/include/page_layout.inc");
+
+// ¥¢¥Ã¥×¥Ç¡¼¥È¤Ç¼èÆÀ¤·¤¿PHP¤òÆÉ¤ß½Ð¤¹
+sfLoadUpdateModule();
+
+// ¥â¥Ð¥¤¥ë¥µ¥¤¥ÈÍÑ¤Î½é´ü½èÍý¤ò¼Â¹Ô¤¹¤ë¡£
+if (!defined('SKIP_MOBILE_INIT')) {
+	sfMobileInit();
+}
+?>
Index: /branches/mobile/html/mobile/products/search.php
===================================================================
--- /branches/mobile/html/mobile/products/search.php	(revision 11398)
+++ /branches/mobile/html/mobile/products/search.php	(revision 11398)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¾¦ÉÊ¸¡º÷¥Õ¥©¡¼¥à
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'products/search.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: /branches/mobile/html/mobile/products/category_list.php
===================================================================
--- /branches/mobile/html/mobile/products/category_list.php	(revision 11398)
+++ /branches/mobile/html/mobile/products/category_list.php	(revision 11398)
@@ -0,0 +1,89 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¥«¥Æ¥´¥ê¡¼°ìÍ÷
+ */
+
+require_once('../require.php');
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'products/category_list.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		$this->tpl_title = '¥«¥Æ¥´¥ê°ìÍ÷¥Ú¡¼¥¸';
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+
+// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
+$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
+
+// ¥«¥Æ¥´¥ê¡¼¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
+lfGetCategories(@$_GET['category_id'], true, $objPage);
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+/**
+ * ÁªÂò¤µ¤ì¤¿¥«¥Æ¥´¥ê¡¼¤È¤½¤Î»Ò¥«¥Æ¥´¥ê¡¼¤Î¾ðÊó¤ò¼èÆÀ¤·¡¢
+ * ¥Ú¡¼¥¸¥ª¥Ö¥¸¥§¥¯¥È¤Ë³ÊÇ¼¤¹¤ë¡£
+ *
+ * @param string $category_id ¥«¥Æ¥´¥ê¡¼ID
+ * @param boolean $count_check Í­¸ú¤Ê¾¦ÉÊ¤¬¤Ê¤¤¥«¥Æ¥´¥ê¡¼¤ò½ü¤¯¤«¤É¤¦¤«
+ * @param object &$objPage ¥Ú¡¼¥¸¥ª¥Ö¥¸¥§¥¯¥È
+ * @return void
+ */
+function lfGetCategories($category_id, $count_check = false, &$objPage) {
+	// ¥«¥Æ¥´¥ê¡¼¤ÎÀµ¤·¤¤ID¤ò¼èÆÀ¤¹¤ë¡£
+	$category_id = sfGetCategoryId('', $category_id);
+	if ($category_id == 0) {
+		sfDispSiteError(CATEGORY_NOT_FOUND);
+	}
+
+	$arrCategory = null;	// ÁªÂò¤µ¤ì¤¿¥«¥Æ¥´¥ê¡¼
+	$arrChildren = array();	// »Ò¥«¥Æ¥´¥ê¡¼
+
+	$arrAll = sfGetCatTree($category_id, $count_check);
+	foreach ($arrAll as $category) {
+		// ÁªÂò¤µ¤ì¤¿¥«¥Æ¥´¥ê¡¼¤Î¾ì¹ç
+		if ($category['category_id'] == $category_id) {
+			$arrCategory = $category;
+			continue;
+		}
+
+		// ´Ø·¸¤Î¤Ê¤¤¥«¥Æ¥´¥ê¡¼¤Ï¥¹¥­¥Ã¥×¤¹¤ë¡£
+		if ($category['parent_category_id'] != $category_id) {
+			continue;
+		}
+
+		// »Ò¥«¥Æ¥´¥ê¡¼¤Î¾ì¹ç¤Ï¡¢Â¹¥«¥Æ¥´¥ê¡¼¤¬Â¸ºß¤¹¤ë¤«¤É¤¦¤«¤òÄ´¤Ù¤ë¡£
+		$arrGrandchildrenID = sfGetUnderChildrenArray($arrAll, 'parent_category_id', 'category_id', $category['category_id']);
+		$category['has_children'] = count($arrGrandchildrenID) > 0;
+		$arrChildren[] = $category;
+	}
+
+	if (!isset($arrCategory)) {
+		sfDispSiteError(CATEGORY_NOT_FOUND);
+	}
+
+	// »Ò¥«¥Æ¥´¥ê¡¼¤Î¾¦ÉÊ¿ô¤ò¹ç·×¤¹¤ë¡£
+	$children_product_count = 0;
+	foreach ($arrChildren as $category) {
+		$children_product_count += $category['product_count'];
+	}
+
+	// ÁªÂò¤µ¤ì¤¿¥«¥Æ¥´¥ê¡¼¤ËÄ¾Â°¤Î¾¦ÉÊ¤¬¤¢¤ë¾ì¹ç¤Ï¡¢»Ò¥«¥Æ¥´¥ê¡¼¤ÎÀèÆ¬¤ËÄÉ²Ã¤¹¤ë¡£
+	if ($arrCategory['product_count'] > $children_product_count) {
+		$arrCategory['product_count'] -= $children_product_count;	// »Ò¥«¥Æ¥´¥ê¡¼¤Î¾¦ÉÊ¿ô¤ò½ü¤¯¡£
+		$arrCategory['has_children'] = false;	// ¾¦ÉÊ°ìÍ÷¥Ú¡¼¥¸¤ËÁ«°Ü¤µ¤»¤ë¤¿¤á¡£
+		array_unshift($arrChildren, $arrCategory);
+	}
+
+	// ·ë²Ì¤ò³ÊÇ¼¤¹¤ë¡£
+	$objPage->arrCategory = $arrCategory;
+	$objPage->arrChildren = $arrChildren;
+}
+?>
Index: /branches/mobile/html/mobile/products/list.php
===================================================================
--- /branches/mobile/html/mobile/products/list.php	(revision 11398)
+++ /branches/mobile/html/mobile/products/list.php	(revision 11398)
@@ -0,0 +1,406 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¾¦ÉÊ°ìÍ÷
+ */
+
+require_once('../require.php');
+
+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 = "products/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'], "del_flg = 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->setPrevURL($_SERVER['REQUEST_URI']);
+			$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
+			header("Location: " . URL_CART_TOP);
+			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 = "products/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 = "del_flg = 0 AND status = 1 ";
+	// ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREÊ¸»úÎó¼èÆÀ
+	if ( $category_id ) {
+		$where .= 'AND category_id = ?';
+		$arrval = array($category_id);
+	}
+		
+	// ¾¦ÉÊÌ¾¤ò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 AS allcls", $where, $arrval);
+	$objPage->tpl_linemax = $linemax;	// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX);
+	
+	$strnavi = $objNavi->strnavi;
+	$strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi);
+	$objPage->tpl_strnavi = $strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;					// ³«»Ï¹Ô
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($disp_num, $startno);
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $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 AS prdcls";
+		$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 = "del_flg = 0";
+	$order = "payment_id";
+	$objQuery->setorder($order);
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+?>
Index: /branches/mobile/html/mobile/products/detail.php
===================================================================
--- /branches/mobile/html/mobile/products/detail.php	(revision 11408)
+++ /branches/mobile/html/mobile/products/detail.php	(revision 11408)
@@ -0,0 +1,482 @@
+<?php
+
+require_once("../require.php");
+require_once(DATA_PATH . "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 = "del_flg = 0";
+} else {
+	$where = "del_flg = 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 {
+		//±ÜÍ÷ÍúÎò¤ÎÃæ¤Ç°ìÈÖ¸Å¤¤¤â¤Î¤òºï½ü¤·¤Æ¿·µ¬ÄÉ²Ã
+		$oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?";
+		$old = $objQuery->getone($oldsql, array($objCustomer->getValue("customer_id")));
+		$where = "customer_id = ? AND update_date = ? ";
+		$arrval = array($objCustomer->getValue("customer_id"), $old);
+		//ºï½ü
+		$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 'select':
+	// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if($objPage->tpl_classcat_find1) {
+		// template¤ÎÊÑ¹¹
+		$objPage->tpl_mainpage = "products/select_find1.tpl";
+		break;
+	}
+
+case 'select2':
+	$objPage->arrErr = lfCheckError();
+
+	// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if($objPage->tpl_classcat_find1 and $objPage->arrErr['classcategory_id1']) {
+		// template¤ÎÊÑ¹¹
+		$objPage->tpl_mainpage = "products/select_find1.tpl";
+		break;
+	}
+
+	// µ¬³Ê2¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if($objPage->tpl_classcat_find2) {
+		$objPage->arrErr = array();
+
+		$objPage->tpl_mainpage = "products/select_find2.tpl";
+		break;
+	}
+
+case 'selectItem':
+	$objPage->arrErr = lfCheckError();
+
+	// µ¬³Ê1¤¬ÀßÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if($objPage->tpl_classcat_find2 and $objPage->arrErr['classcategory_id2']) {
+		// template¤ÎÊÑ¹¹
+		$objPage->tpl_mainpage = "products/select_find2.tpl";
+		break;
+	}
+	// ¾¦ÉÊ¿ô¤ÎÁªÂò¤ò¹Ô¤¦
+	$objPage->tpl_mainpage = "products/select_item.tpl";
+	break;
+
+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->setPrevURL($_SERVER['REQUEST_URI']);
+		$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $objFormParam->getValue('quantity'));
+
+		header("Location: " . gfAddSessionId(URL_CART_TOP));
+
+		exit;
+	}
+	break;
+		
+default:
+	break;
+}
+
+$objQuery = new SC_Query();
+// DB¤«¤é¾¦ÉÊ¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
+$arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id));
+$objPage->arrProduct = $arrRet[0];
+
+// ¾¦ÉÊ¥³¡¼¥É¤Î¼èÆÀ
+$code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code";
+$arrProductCode = $objQuery->getall($code_sql, array($tmp_id));
+$arrProductCode = sfswaparray($arrProductCode);
+$objPage->arrProductCode = $arrProductCode["product_code"];
+
+// ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ
+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, true);
+// »ÙÊ§ÊýË¡¤Î¼èÆÀ
+$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);
+
+// ³ÈÂç²èÁü¤Î¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ò¥»¥Ã¥È
+list($large_width, $large_height) = getimagesize(IMAGE_SAVE_DIR . basename($objPage->arrFile["main_large_image"]["filepath"]));
+$objPage->tpl_large_width = $large_width + 60;
+$objPage->tpl_large_height = $large_height + 80;
+
+$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 = "";
+	
+	$arrSele1 = array();
+	$arrSele2 = 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'];
+			$arrSele1[$classcat_id1] = $arrClassCatName[$classcat_id1];
+		}
+
+		// µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ
+		if($arrProductsClass[$i]['classcategory_id1'] == $_POST['classcategory_id1'] and $classcat_id2 != $arrProductsClass[$i]['classcategory_id2']) {
+			$classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
+			$arrSele2[$classcat_id2] = $arrClassCatName[$classcat_id2];
+		}
+
+		$list_id++;
+
+		// ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ
+		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 = $arrSele1;
+	$objPage->arrClassCat2 = $arrSele2;
+	
+	//$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 AS prdcls";
+		$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 = "del_flg = 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  AS allcls", $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()';
+	$sqlval['update_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 allcls ";
+	$where = "del_flg = 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 = "del_flg = 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 = "del_flg = 0";
+	$order = "payment_id";
+	$objQuery->setorder($order);
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+?>
Index: /branches/mobile/html/__default.php
===================================================================
--- /branches/mobile/html/__default.php	(revision 10399)
+++ /branches/mobile/html/__default.php	(revision 10399)
@@ -0,0 +1,21 @@
+<?php
+require_once("###require###");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤ºÊÑ¹¹¤¹¤ë **/
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/load_module.php
===================================================================
--- /branches/mobile/html/load_module.php	(revision 8547)
+++ /branches/mobile/html/load_module.php	(revision 8547)
@@ -0,0 +1,28 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("./require.php");
+require_once(DATA_PATH . "module/Request.php");
+
+if($_GET['module_id'] != ""){
+	$module_id = $_GET['module_id'];
+}elseif($_POST['module_id'] != ""){
+	$module_id = $_POST['module_id'];
+}
+
+if(is_numeric($module_id)) {
+	$objQuery = new SC_Query();
+	$arrRet = $objQuery->select("main_php", "dtb_module", "module_id = ?", array($module_id));
+	$path = MODULE_PATH . $arrRet[0]['main_php'];
+	if(file_exists($path)) {
+		require_once($path);
+		exit;
+	} else {
+		print("¥â¥¸¥å¡¼¥ë¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£:".$path);
+	}
+}
+
+?>
Index: /branches/mobile/html/order/index.php
===================================================================
--- /branches/mobile/html/order/index.php	(revision 10399)
+++ /branches/mobile/html/order/index.php	(revision 10399)
@@ -0,0 +1,35 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/js/win_op.js
===================================================================
--- /branches/mobile/html/js/win_op.js	(revision 5934)
+++ /branches/mobile/html/js/win_op.js	(revision 5934)
@@ -0,0 +1,43 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+<!--
+	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: /branches/mobile/html/js/flash.js
===================================================================
--- /branches/mobile/html/js/flash.js	(revision 5934)
+++ /branches/mobile/html/js/flash.js	(revision 5934)
@@ -0,0 +1,104 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+// **************  ÀßÄêÉôÊ¬ *******************
+
+	// 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: /branches/mobile/html/js/navi.js
===================================================================
--- /branches/mobile/html/js/navi.js	(revision 10405)
+++ /branches/mobile/html/js/navi.js	(revision 10405)
@@ -0,0 +1,41 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+	var preLoadFlag = "false";
+
+	function preLoadImg(URL){
+
+		arrImgList = new Array (
+			URL+"img/header/basis_on.jpg",URL+"img/header/product_on.jpg",URL+"img/header/customer_on.jpg",URL+"img/header/order_on.jpg",
+			URL+"img/header/sales_on.jpg",URL+"img/header/mail_on.jpg",URL+"img/header/contents_on.jpg",
+			URL+"img/header/mainpage_on.gif",URL+"img/header/sitecheck_on.gif",URL+"img/header/logout.gif",
+			URL+"img/contents/btn_search_on.jpg",URL+"img/contents/btn_regist_on.jpg",
+			URL+"img/contents/btn_csv_on.jpg",URL+"img/contents/arrow_left.jpg",URL+"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: /branches/mobile/html/js/dragdrop.js
===================================================================
--- /branches/mobile/html/js/dragdrop.js	(revision 5934)
+++ /branches/mobile/html/js/dragdrop.js	(revision 5934)
@@ -0,0 +1,201 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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: /branches/mobile/html/js/site.js
===================================================================
--- /branches/mobile/html/js/site.js	(revision 9523)
+++ /branches/mobile/html/js/site.js	(revision 9523)
@@ -0,0 +1,356 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+// ¿Æ¥¦¥£¥ó¥É¥¦¤ÎÂ¸ºß³ÎÇ§
+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 fnSetFormVal(form, key, val) {
+	document.forms[form][key].value = val;
+}
+
+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) {
+		return;
+	}
+	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();
+}
+
+//Ê¸»ú¿ô¤ò¥«¥¦¥ó¥È¤¹¤ë¡£
+//°ú¿ô1¡§¥Õ¥©¡¼¥àÌ¾¾Î
+//°ú¿ô2¡§Ê¸»ú¿ô¥«¥¦¥ó¥ÈÂÐ¾Ý
+//°ú¿ô3¡§¥«¥¦¥ó¥È·ë²Ì³ÊÇ¼ÂÐ¾Ý
+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: /branches/mobile/html/js/layout_design.js
===================================================================
--- /branches/mobile/html/js/layout_design.js	(revision 5934)
+++ /branches/mobile/html/js/layout_design.js	(revision 5934)
@@ -0,0 +1,680 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+// ¥µ¥¤¥º´ÉÍý¥¯¥é¥¹¤ÎÄêµÁ
+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 ) {
+
+	if (typeof(elm.attributes[ attrname ]) != 'undefined') {
+	    return elm.attributes[ attrname ].nodeValue;
+	}
+
+/*
+//	if (typeof(elm.attributes.getNamedItem(attrname)) != 'object'){
+		val = "";
+		if((typeof ScriptEngineMajorVersion)=='function')
+		{
+			if( Math.floor(ScriptEngineMajorVersion()) == 5 &&
+				navigator.userAgent.indexOf("Win")!=-1) //win-e5ÂÐ±þ
+				{
+				val = elm.attributes.item(attrname)
+				}
+			else
+			{
+				val = elm.attributes.getNamedItem(attrname)
+			}
+		} else {
+			val = elm.attributes.getNamedItem(attrname)
+		}
+		
+		alert(val.value);
+		
+		return val.value;
+//	}
+*/
+}
+
+// ÃÍ¤ò¥»¥Ã¥È
+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 alerttest(msg, x, y){
+ 	alert(msg);
+}
+
+// ÇÛÎó¤ÎºîÀ®
+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 = 1; 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: /branches/mobile/html/js/admin.js
===================================================================
--- /branches/mobile/html/js/admin.js	(revision 9742)
+++ /branches/mobile/html/js/admin.js	(revision 9742)
@@ -0,0 +1,417 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+// ´ÉÍý¼Ô¥á¥ó¥Ð¡¼¤òÄÉ²Ã¤¹¤ë¡£
+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();
+}
+
+// ¥Ú¡¼¥¸¥Ê¥Ó¤Ç»ÈÍÑ¤¹¤ë(mode = searchÀìÍÑ)
+function fnNaviSearchOnlyPage(pageno) {
+	document.form1['search_pageno'].value = pageno;
+	document.form1['mode'].value = 'search';
+	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 = '<FONT Color="#FFFF99"> << É½¼¨ </FONT>';
+	}else{
+		document.form1[disp_flg].value="";
+		document.getElementById(disp_id).style.display="";
+		document.getElementById(inner_id).innerHTML = ' <FONT Color="#FFFF99"> >> ÈóÉ½¼¨ </FONT>'; 
+	}
+}
+
+
+
+	
Index: /branches/mobile/html/js/css.js
===================================================================
--- /branches/mobile/html/js/css.js	(revision 5934)
+++ /branches/mobile/html/js/css.js	(revision 5934)
@@ -0,0 +1,88 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+ 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: /branches/mobile/html/js/file_manager.js
===================================================================
--- /branches/mobile/html/js/file_manager.js	(revision 10036)
+++ /branches/mobile/html/js/file_manager.js	(revision 10036)
@@ -0,0 +1,231 @@
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+var IMG_FOLDER_CLOSE   = "../../img/admin/contents/folder_close.gif";		// ¥Õ¥©¥ë¥À¥¯¥í¡¼¥º»þ²èÁü
+var IMG_FOLDER_OPEN    = "../../img/admin/contents/folder_open.gif";		// ¥Õ¥©¥ë¥À¥ª¡¼¥×¥ó»þ²èÁü
+var IMG_PLUS           = "../../img/admin/contents/plus.gif";				// ¥×¥é¥¹¥é¥¤¥ó
+var IMG_MINUS          = "../../img/admin/contents/minus.gif";				// ¥Þ¥¤¥Ê¥¹¥é¥¤¥ó
+var IMG_NORMAL         = "../../img/admin/contents/space.gif";				// ¥¹¥Ú¡¼¥¹
+
+var tree = "";						// À¸À®HTML³ÊÇ¼
+var count = 0;						// ¥ë¡¼¥×¥«¥¦¥ó¥¿
+var arrTreeStatus = new Array();	// ¥Ä¥ê¡¼¾õÂÖÊÝ»ý
+var old_select_id = '';				// Á°²óÁªÂò¤·¤Æ¤¤¤¿¥Õ¥¡¥¤¥ë
+var selectFileHidden = "";			// ÁªÂò¤·¤¿¥Õ¥¡¥¤¥ë¤ÎhiddenÌ¾
+var treeStatusHidden = "";			// ¥Ä¥ê¡¼¾õÂÖÊÝÂ¸ÍÑ¤ÎhiddenÌ¾
+var modeHidden = "";				// mode¥»¥Ã¥ÈhiddenÌ¾
+
+// ¥Ä¥ê¡¼É½¼¨
+function fnTreeView(view_id, arrTree, openFolder, selectHidden, treeHidden, mode) {
+	selectFileHidden = selectHidden;
+	treeStatusHidden = treeHidden;
+	modeHidden = mode;
+	
+	for(i = 0; i < arrTree.length; i++) {
+		
+		id = arrTree[i][0];
+		level = arrTree[i][3];
+		
+		if(i == 0) {
+			old_id = "0";
+			old_level = 0;
+		} else {
+			old_id = arrTree[i-1][0];
+			old_level = arrTree[i-1][3];
+		}
+	
+		// ³¬ÁØ¾å¤ØÌá¤ë
+		if(level <= (old_level - 1)) {
+			tmp_level = old_level - level;
+			for(up_roop = 0; up_roop <= tmp_level; up_roop++) {
+				tree += '</div>';
+			}
+		}
+		
+		// Æ±°ì³¬ÁØ¤Ç¼¡¤Î¥Õ¥©¥ë¥À¤Ø
+		if(id != old_id && level == old_level) tree += '</div>';
+	
+		// ³¬ÁØ¤ÎÊ¬¤À¤±¥¹¥Ú¡¼¥¹¤òÆþ¤ì¤ë
+		for(space_cnt = 0; space_cnt < arrTree[i][3]; space_cnt++) {
+			tree += "&nbsp;&nbsp;&nbsp;";
+		}
+
+		// ³¬ÁØ²èÁü¤ÎÉ½¼¨¡¦ÈóÉ½¼¨½èÍý
+		if(arrTree[i][4]) {
+			if(arrTree[i][1] == '_parent') {
+				rank_img = IMG_MINUS;
+			} else {
+				rank_img = IMG_NORMAL;
+			}
+			// ³«¤­¾õÂÖ¤òÊÝ»ý
+			arrTreeStatus.push(arrTree[i][2]);
+			display = 'block';
+		} else {
+			if(arrTree[i][1] == '_parent') {
+				rank_img = IMG_PLUS;
+			} else {
+				rank_img = IMG_NORMAL;
+			}
+			display = 'none';
+		}
+
+		arrFileSplit = arrTree[i][2].split("/");
+		file_name = arrFileSplit[arrFileSplit.length-1];
+
+		// ¥Õ¥©¥ë¥À¤Î²èÁü¤òÁªÂò
+		if(arrTree[i][2] == openFolder) {
+			folder_img = IMG_FOLDER_OPEN;
+			file_name = "<b>" + file_name + "</b>";
+		} else {
+			folder_img = IMG_FOLDER_CLOSE;
+		}
+
+		// ³¬ÁØ²èÁü¤Ë»Ò¶¡¤¬¤¤¤¿¤é¥ª¥ó¥¯¥ê¥Ã¥¯½èÍý¤ò¤Ä¤±¤ë
+		if(rank_img != IMG_NORMAL) {
+			tree += '<a href="javascript:fnTreeMenu(\'tree'+ i +'\',\'rank_img'+ i +'\',\''+ arrTree[i][2] +'\')"><img src="'+ rank_img +'" border="0" name="rank_img'+ i +'" id="rank_img'+ i +'">';
+		} else {
+			tree += '<img src="'+ rank_img +'" border="0" name="rank_img'+ i +'" id="rank_img'+ i +'">';
+		}
+		tree += '<a href="javascript:fnFolderOpen(\''+ arrTree[i][2] +'\')"><img src="'+ folder_img +'" border="0" name="tree_img'+ i +'" id="tree_img'+ i +'">&nbsp;'+ file_name +'</a><br/>';
+		tree += '<div id="tree'+ i +'" style="display:'+ display +'">';
+	
+	}
+	fnDrow(view_id, tree);
+	//document.tree_form.tree_test2.focus();	
+}
+
+// Tree¾õÂÖ¤òhidden¤Ë¥»¥Ã¥È
+function setTreeStatus(name) {
+	var tree_status = "";
+	for(i=0; i < arrTreeStatus.length ;i++) {
+		if(i != 0) tree_status += '|';
+		tree_status += arrTreeStatus[i];
+	}
+	document.form1[name].value = tree_status;
+}
+
+// Tree¾õÂÖ¤òºï½ü¤¹¤ë(ÊÄ¤¸¤ë¾õÂÖ¤Ø)
+function fnDelTreeStatus(path) {
+	for(i=0; i < arrTreeStatus.length ;i++) {
+		if(arrTreeStatus[i] == path) {
+			arrTreeStatus[i] = "";
+		}
+	}
+}
+// ¥Ä¥ê¡¼ÉÁ²è
+function fnDrow(id, tree) {
+	// ¥Ö¥é¥¦¥¶¼èÆÀ
+	MyBR = fnGetMyBrowser();
+	// ¥Ö¥é¥¦¥¶»ö¤Ë½èÍý¤òÀÚ¤êÊ¬¤±
+	switch(myBR) {
+		// IE4¤Î»þ¤ÎÉ½¼¨
+		case 'I4':
+			document.all(id).innerHTML = tree;
+			break;
+		// NN4¤Î»þ¤ÎÉ½¼¨
+		case 'N4':
+			document.layers[id].document.open();
+			document.layers[id].document.write("<div>");
+			document.layers[id].document.write(tree);
+			document.layers[id].document.write("</div>");
+			document.layers[id].document.close();
+			break;
+		default:
+			document.getElementById(id).innerHTML=tree;
+			break;
+	}
+}
+
+// ³¬ÁØ¥Ä¥ê¡¼¥á¥Ë¥å¡¼É½¼¨¡¦ÈóÉ½¼¨½èÍý
+function fnTreeMenu(tName, imgName, path) {
+
+	tMenu = document.all[tName].style;
+
+	if(tMenu.display == 'none') {
+		fnChgImg(IMG_MINUS, imgName);
+		tMenu.display = "block";
+		// ³¬ÁØ¤Î³«¤¤¤¿¾õÂÖ¤òÊÝ»ý
+		arrTreeStatus.push(path);
+
+	} else {
+		fnChgImg(IMG_PLUS, imgName);
+		tMenu.display = "none";
+		// ÊÄ¤¸¾õÂÖ¤òÊÝ»ý
+		fnDelTreeStatus(path);
+	}
+}
+
+// ¥Õ¥¡¥¤¥ë¥ê¥¹¥È¥À¥Ö¥ë¥¯¥ê¥Ã¥¯½èÍý
+function fnDbClick(arrTree, path, is_dir, now_dir, is_parent) {
+
+	if(is_dir) {
+		if(!is_parent) {
+			for(cnt = 0; cnt < arrTree.length; cnt++) {
+				if(now_dir == arrTree[cnt][2]) {
+					open_flag = false;
+					for(status_cnt = 0; status_cnt < arrTreeStatus.length; status_cnt++) {
+						if(arrTreeStatus[status_cnt] == arrTree[cnt][2]) open_flag = true;
+					}
+					if(!open_flag) fnTreeMenu('tree'+cnt, 'rank_img'+cnt, arrTree[cnt][2]);
+				}
+			}
+		}
+		fnFolderOpen(path);
+	} else {
+		// Download
+		fnModeSubmit('download','','');
+	}
+}
+
+// ¥Õ¥©¥ë¥À¥ª¡¼¥×¥ó½èÍý
+function fnFolderOpen(path) {
+
+	// ¥¯¥ê¥Ã¥¯¤·¤¿¥Õ¥©¥ë¥À¾ðÊó¤òÊÝ»ý
+	document.form1[selectFileHidden].value = path;
+	// tree¤Î¾õÂÖ¤ò¥»¥Ã¥È
+	setTreeStatus(treeStatusHidden);
+	// submit
+	fnModeSubmit(modeHidden,'','');
+}
+
+
+// ±ÜÍ÷¥Ö¥é¥¦¥¶¼èÆÀ
+function fnGetMyBrowser() {
+	myOP = window.opera;            // OP
+	myN6 = document.getElementById; // N6
+	myIE = document.all;            // IE
+	myN4 = document.layers;         // N4
+	if      (myOP) myBR="O6";       // OP6°Ê¾å
+	else if (myIE) myBR="I4";       // IE4°Ê¾å
+	else if (myN6) myBR="N6";       // NS6°Ê¾å
+	else if (myN4) myBR="N4";       // NN4
+	else           myBR="";         // ¤½¤ÎÂ¾
+		
+	return myBR;
+}
+
+// img¥¿¥°¤Î²èÁüÊÑ¹¹
+function fnChgImg(fileName,imgName){
+	document.getElementById(imgName).src = fileName;
+}
+
+// ¥Õ¥¡¥¤¥ëÁªÂò
+function fnSelectFile(id, val) {
+	if(old_select_id != '') document.getElementById(old_select_id).style.backgroundColor = '';
+	document.getElementById(id).style.backgroundColor = val;
+	old_select_id = id;
+}
+
+// ÇØ·Ê¿§¤òÊÑ¤¨¤ë
+function fnChangeBgColor(id, val) {
+	if (old_select_id != id) {
+		document.getElementById(id).style.backgroundColor = val;
+	}
+}
+
+// test
+function view_test(id) {
+	document.getElementById(id).value=tree
+}
Index: /branches/mobile/html/error.php
===================================================================
--- /branches/mobile/html/error.php	(revision 5934)
+++ /branches/mobile/html/error.php	(revision 5934)
@@ -0,0 +1,27 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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: /branches/mobile/html/test/uehara/captcha/ajax_captcha/auth.html
===================================================================
--- /branches/mobile/html/test/uehara/captcha/ajax_captcha/auth.html	(revision 10486)
+++ /branches/mobile/html/test/uehara/captcha/ajax_captcha/auth.html	(revision 10486)
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<script language="JavaScript" type="text/javascript" src="auth.js"></script>
+	</head>
+	<body>
+	<!--認証結果-->
+	<div id="result">&nbsp;</div>
+	<!--認証フォーム-->
+	<form id="form1" name="form1">
+		<table> 
+			<tr>
+				<td colspan="2">■下に表示される値を入力して下さい。</td>
+			</tr>
+			<tr>
+				<td><img id="code" src="create_image.php" /></td>
+			<tr>
+				<td><input id="input_data" type="text" name="input_data" value="" maxlength="10" size="32" /></td>
+			</tr>
+			<tr>
+				<td><input type="button" value="認証実行" onclick="auth(document.form1)" /></td>
+			</tr>
+		</table> 
+	</form>
+	</body>
+</html>
Index: /branches/mobile/html/test/uehara/captcha/ajax_captcha/result.php
===================================================================
--- /branches/mobile/html/test/uehara/captcha/ajax_captcha/result.php	(revision 10485)
+++ /branches/mobile/html/test/uehara/captcha/ajax_captcha/result.php	(revision 10485)
@@ -0,0 +1,28 @@
+<?php
+
+// セッションスタート
+session_start();
+
+// 入力値を受け取る
+$input_data = $_POST["input_data"];
+$session_data = $_SESSION["code"];
+
+// 正しくデータが送られてきているか
+if ($input_data == "" || $session_data == "") { 
+	echo "<font color=\"red\">値を入力して下さい。</font>";
+	exit;
+}
+
+// 入力値が正しいかチェック
+if ($input_data == $session_data) {
+	
+	// ここに認証成功時の処理を書いて下さい。
+	echo "<font color=\"blue\">認証成功！！</font>";
+
+} else {
+
+	// ここに認証失敗時の処理を書いて下さい。
+	echo "<font color=\"red\">認証失敗！！</font>";
+
+}
+?>
Index: /branches/mobile/html/test/uehara/captcha/ajax_captcha/create_image.php
===================================================================
--- /branches/mobile/html/test/uehara/captcha/ajax_captcha/create_image.php	(revision 10489)
+++ /branches/mobile/html/test/uehara/captcha/ajax_captcha/create_image.php	(revision 10489)
@@ -0,0 +1,32 @@
+<?php
+
+// セッションスタート
+session_start();
+
+// 画像イメージ生成 
+// ランダムな文字列を生成
+$md5_hash = md5(rand(0,999)); 
+// 文字列を５桁にする 
+$code = substr($md5_hash, 15, 5); 
+// セッションに生成されたコードを保存
+$_SESSION["code"] = $code;
+
+$image = ImageCreate(120, 20);  
+
+// 色の定義 
+$white = ImageColorAllocate($image, 255, 255, 255); 
+$grey = ImageColorAllocate($image, 204, 204, 204); 
+
+// 背景色
+ImageFill($image, 0, 0, $grey); 
+
+// 生成したコードを表示
+ImageString($image, 5, 30, 3, $code, $white); 
+
+// jpagで出力 
+header("Content-Type: image/jpeg"); 
+ImageJpeg($image); 
+ImageDestroy($image); 
+
+exit; 
+?>
Index: /branches/mobile/html/test/uehara/captcha/ajax_captcha/auth.js
===================================================================
--- /branches/mobile/html/test/uehara/captcha/ajax_captcha/auth.js	(revision 10484)
+++ /branches/mobile/html/test/uehara/captcha/ajax_captcha/auth.js	(revision 10484)
@@ -0,0 +1,60 @@
+RESULT_PAGE_PHP = 'result.php';			// 結果ページ表示PHP
+CREATE_IMAGE_PHP = 'create_image.php';	// 画像生成PHP
+RESULT_TEXT_ID = 'result';				// 結果文字表示場所ID(HTMLで定義)
+CODE_IMG = 'code';						// コード表示IMGタグのID
+
+// ブラウザによってXmlHttpRequestのObjectを振り分ける 
+function getXmlHttpRequestObject() {
+	if (window.XMLHttpRequest) {
+ 		// Mozilla, Safariなど
+		return new XMLHttpRequest();
+	} else if (window.ActiveXObject) {
+		// IE
+		return new ActiveXObject("Microsoft.XMLHTTP");
+	} else {
+		// 非対応
+		alert("ブラウザがXmlHttpRequestに対応していません！！");
+	}
+}
+
+// オブジェクト生成
+var receiveReq = getXmlHttpRequestObject();
+
+// リクエスト処理
+function makeRequest(url, param) {
+	// 受信完了かまだopenメソッドが呼び出されていない
+	if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
+		// サーバとの通信を開始
+		receiveReq.open("POST", url, true);
+		// サーバーからの応答時の処理を定義（結果のページへの反映）
+		receiveReq.onreadystatechange = updatePage; 
+
+		// ヘッダー定義
+		receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+		receiveReq.setRequestHeader("Content-length", param.length);
+		receiveReq.setRequestHeader("Connection", "close");
+
+		// 送信
+		receiveReq.send(param);
+	}   
+}
+
+// サーバーからの応答時の処理
+function updatePage() {
+	// 受信が完了していたら実行
+	if (receiveReq.readyState == 4) {
+		// 設定したIDへ生成した文字列をセット
+		document.getElementById(RESULT_TEXT_ID).innerHTML = receiveReq.responseText;
+		// コード画像を変化させる
+		img = document.getElementById(CODE_IMG); 
+		// キャッシュを回避するためにランダムな値をつける
+		img.src = CREATE_IMAGE_PHP + '?' + Math.random();
+	}
+}
+
+// 認証処理実行
+function auth(forms) {
+	var postData = forms.input_data.name + "=" + encodeURIComponent( forms.input_data.value );
+	// リクエスト実行
+	makeRequest(RESULT_PAGE_PHP, postData);
+}
Index: /branches/mobile/html/test/uehara/time_test.php
===================================================================
--- /branches/mobile/html/test/uehara/time_test.php	(revision 8329)
+++ /branches/mobile/html/test/uehara/time_test.php	(revision 8329)
@@ -0,0 +1,11 @@
+<?php
+
+	$end_date = date("Y/m/d", time()); 
+	$start_date = date("Y/m/d",strtotime("-10 year" ,strtotime($end_date)));
+	$end_date = date("Y/m/d",strtotime("1 day" ,strtotime($end_date)));
+	for($i=0; $i<20; $i++) {
+		$start_date = date("Y/m/d",strtotime("-10 year",strtotime($start_date)));
+		echo $start_date."<br/>\n";
+	}
+
+?>
Index: /branches/mobile/html/test/uehara/test.php
===================================================================
--- /branches/mobile/html/test/uehara/test.php	(revision 10391)
+++ /branches/mobile/html/test/uehara/test.php	(revision 10391)
@@ -0,0 +1,15 @@
+<?php
+require_once("../../require.php");
+require_once(DATA_PATH. "module/Tar.php");
+
+//°µ½Ì¥Õ¥é¥°TRUE¤Ïgzip²òÅà¤ò¤ª¤³¤Ê¤¦
+$tar = new Archive_Tar(USER_TEMPLATE_PATH."bbb/eccube-1.0.2beta.tar.gz", TRUE);
+//»ØÄê¤µ¤ì¤¿¥Õ¥©¥ë¥ÀÆâ¤Ë²òÅà¤¹¤ë
+$err = $tar->extractModify(USER_TEMPLATE_PATH."bbb/", "eccube-1.0.2beta");
+
+	// ³ÈÄ¥»Ò¤òÀÚ¤ê¼è¤ë
+	$file_name = ereg_replace("\.tar$", "", "bbb/eccube-1.0.2beta.tar.gz");
+	$file_name = ereg_replace("\.tar\.gz$", "", $file_name);
+
+echo $file_name;	
+?>
Index: /branches/mobile/html/test/uehara/tree.php
===================================================================
--- /branches/mobile/html/test/uehara/tree.php	(revision 9552)
+++ /branches/mobile/html/test/uehara/tree.php	(revision 9552)
@@ -0,0 +1,156 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../../require.php");
+
+class LC_Page{
+	function LC_Page() {
+	}
+}
+
+$top_dir = USER_PATH;
+
+$objPage = new LC_Page();
+$objView = new SC_UserView("./templates");
+$objQuery = new SC_Query();
+
+// ¸½ºß¤Î³¬ÁØ¤ò¼èÆÀ
+if($_POST['mode'] != "") {
+	$now_dir = $_POST['now_file'];
+} else {
+	// ½é´üÉ½¼¨¤Ï¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê(user_data/upload/)¤òÉ½¼¨
+	$now_dir = $top_dir;
+}
+
+// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+$objUpFile = new SC_UploadFile($now_dir, $now_dir);
+// ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+lfInitFile();
+
+switch($_POST['mode']) {
+
+// ¥Õ¥¡¥¤¥ëÉ½¼¨
+case 'view':
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfErrorCheck();
+	if(!is_array($arrErr)) {
+	
+		// ÁªÂò¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ê¤é°ÜÆ°
+		if(is_dir($_POST['select_file'])) {
+			///$now_dir = $_POST['select_file'];
+			// ¥Ä¥ê¡¼Á«°ÜÍÑ¤Îjavascript¤òËä¤á¹þ¤à
+			$arrErr['view'] = "¢¨ ¥Ç¥£¥ì¥¯¥È¥ê¤òÉ½¼¨¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£";
+			
+		} else {
+			// javascript¤ÇÊÌÁëÉ½¼¨(¥Æ¥ó¥×¥ì¡¼¥ÈÂ¦¤ËÅÏ¤¹)
+			$file_url = ereg_replace(USER_PATH, "", $_POST['select_file']);
+			$objPage->tpl_javascript = "win02('./file_view.php?file=". $file_url ."', 'user_data', '600', '400');";
+		}
+	}
+	break;
+// ¥Õ¥¡¥¤¥ë¥À¥¦¥ó¥í¡¼¥É
+case 'download':
+
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfErrorCheck();
+	if(!is_array($arrErr)) {
+		if(is_dir($_POST['select_file'])) {
+			// ¥Ç¥£¥ì¥¯¥È¥ê¤Î¾ì¹ç¤Ïjavascript¥¨¥é¡¼
+			$arrErr['download'] = "¢¨ ¥Ç¥£¥ì¥¯¥È¥ê¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£";
+		} else {
+			// ¥Õ¥¡¥¤¥ë¥À¥¦¥ó¥í¡¼¥É
+			sfDownloadFile($_POST['select_file']);
+			exit;			
+		}
+	}
+	break;
+// ¥Õ¥¡¥¤¥ëºï½ü
+case 'delete':
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfErrorCheck();
+	if(!is_array($arrErr)) {
+		sfDeleteDir($_POST['select_file']);
+	}
+	break;
+// ¥Õ¥¡¥¤¥ëºîÀ®
+case 'create':
+	// ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrErr = lfCreateErrorCheck();
+	if(!is_array($arrErr)) {
+		$create_dir = ereg_replace("/$", "", $now_dir);
+		// ¥Õ¥¡¥¤¥ëºîÀ®
+		if(!sfCreateFile($create_dir."/".$_POST['create_file'], 0755)) {
+			// ºîÀ®¥¨¥é¡¼
+			$arrErr['create'] = "¢¨ ".$_POST['create_file']."¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
+		} else {
+			$objPage->tpl_javascript = "alert('¥Õ¥©¥ë¥À¤òºîÀ®¤·¤Þ¤·¤¿¡£');";
+		}
+	}
+	break;
+// ¥Õ¥¡¥¤¥ë¥¢¥Ã¥×¥í¡¼¥É
+case 'upload':
+	// ²èÁüÊÝÂ¸½èÍý
+	$ret = $objUpFile->makeTempFile('upload_file', false);
+	if($ret != "") {
+		$arrErr['upload_file'] = $ret;
+	} else {
+		$objPage->tpl_javascript = "alert('¥Õ¥¡¥¤¥ë¤ò¥¢¥Ã¥×¥í¡¼¥É¤·¤Þ¤·¤¿¡£');";
+	}
+	break;
+// ¥Õ¥©¥ë¥À°ÜÆ°
+case 'move':
+	$now_dir = $_POST['tree_select_file'];
+	break;
+// ½é´üÉ½¼¨
+default :
+	break;
+}
+
+
+// ¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥êÇÛ²¼¤Î¥Õ¥¡¥¤¥ë°ìÍ÷¤ò¼èÆÀ
+$objPage->arrFileList = sfGetFileList($now_dir);
+$objPage->tpl_now_file = $now_dir;
+$objPage->arrErr = $arrErr;
+$objPage->arrParam = $_POST;
+$objPage->arrTree = sfGetFileTree($top_dir, $_POST['tree_status']);
+$objPage->$tpl_onload .= "fnTreeView('tree', arrTree, '$now_dir')";
+
+$objView->assignobj($objPage);
+$objView->display("tree.tpl");
+
+//-----------------------------------------------------------------------------------------------------------------------------------
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfErrorCheck()
+ * ÀâÌÀ¡¡¡§¥¨¥é¡¼¥Á¥§¥Ã¥¯
+ */
+function lfErrorCheck() {
+	$objErr = new SC_CheckError($_POST);
+	$objErr->doFunc(array("¥Õ¥¡¥¤¥ë", "select_file"), array("SELECT_CHECK"));
+	
+	return $objErr->arrErr;
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfCreateErrorCheck()
+ * ÀâÌÀ¡¡¡§¥Õ¥¡¥¤¥ëºîÀ®½èÍý¥¨¥é¡¼¥Á¥§¥Ã¥¯
+ */
+function lfCreateErrorCheck() {
+	$objErr = new SC_CheckError($_POST);
+	$objErr->doFunc(array("ºîÀ®¥Õ¥¡¥¤¥ë", "create_file"), array("EXIST_CHECK", "FILE_NAME_CHECK_BY_NOUPLOAD"));
+	
+	return $objErr->arrErr;
+}
+
+/* 
+ * ´Ø¿ôÌ¾¡§lfInitFile()
+ * ÀâÌÀ¡¡¡§¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½
+ */
+function lfInitFile() {
+	global $objUpFile;
+	$objUpFile->addFile("¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë", 'upload_file', array(), FILE_SIZE, true, 0, 0, false);
+}
+?>
Index: /branches/mobile/html/test/uehara/js/tree.js
===================================================================
--- /branches/mobile/html/test/uehara/js/tree.js	(revision 9548)
+++ /branches/mobile/html/test/uehara/js/tree.js	(revision 9548)
@@ -0,0 +1,194 @@
+var IMG_FOLDER_CLOSE   = "./img/folder_close.gif";				// ¥Õ¥©¥ë¥À¥¯¥í¡¼¥º»þ²èÁü
+var IMG_FOLDER_OPEN    = "./img/folder_open.gif";				// ¥Õ¥©¥ë¥À¥ª¡¼¥×¥ó»þ²èÁü
+var IMG_PLUS           = "./img/plus.gif";						// ¥×¥é¥¹¥é¥¤¥ó
+var IMG_MINUS          = "./img/minus.gif";						// ¥Þ¥¤¥Ê¥¹¥é¥¤¥ó
+var IMG_NORMAL         = "./img/normal.gif";					// ¥Î¡¼¥Þ¥ë¥é¥¤¥ó
+
+var tree = "";						// À¸À®HTML³ÊÇ¼
+var count = 0;						// ¥ë¡¼¥×¥«¥¦¥ó¥¿
+var arrTreeStatus = new Array();	// ¥Ä¥ê¡¼¾õÂÖÊÝ»ý
+var old_select_id = '';				// Á°²óÁªÂò¤·¤Æ¤¤¤¿¥Õ¥¡¥¤¥ë
+
+// ¥Ä¥ê¡¼É½¼¨
+function fnTreeView(view_id, arrTree, openFolder) {
+
+	//tree += '<form name="tree_form">';
+	for(i = 0; i < arrTree.length; i++) {
+		
+		id = arrTree[i][0];
+		level = arrTree[i][3];
+		
+		if(i == 0) {
+			old_id = "0";
+			old_level = 0;
+		} else {
+			old_id = arrTree[i-1][0];
+			old_level = arrTree[i-1][3];
+		}
+	
+		// ³¬ÁØ¾å¤ØÌá¤ë
+		if(level <= (old_level - 1)) {
+			tmp_level = old_level - level;
+			for(up_roop = 0; up_roop <= tmp_level; up_roop++) {
+				tree += '</div>';
+			}
+		}
+		
+		// Æ±°ì³¬ÁØ¤Ç¼¡¤Î¥Õ¥©¥ë¥À¤Ø
+		if(id != old_id && level == old_level) tree += '</div>';
+	
+		// ³¬ÁØ¤ÎÊ¬¤À¤±¥¹¥Ú¡¼¥¹¤òÆþ¤ì¤ë
+		for(space_cnt = 0; space_cnt < arrTree[i][3]; space_cnt++) {
+			tree += "&nbsp;&nbsp;&nbsp;";
+		}
+
+		// ³¬ÁØ²èÁü¤ÎÉ½¼¨¡¦ÈóÉ½¼¨½èÍý
+		if(arrTree[i][4]) {
+			if(arrTree[i][1] == '_parent') {
+				rank_img = IMG_MINUS;
+			} else {
+				rank_img = IMG_NORMAL;
+			}
+			// ³«¤­¾õÂÖ¤òÊÝ»ý
+			arrTreeStatus.push(arrTree[i][2]);
+			display = 'block';
+		} else {
+			if(arrTree[i][1] == '_parent') {
+				rank_img = IMG_PLUS;
+			} else {
+				rank_img = IMG_NORMAL;
+			}
+			display = 'none';
+		}
+		
+		// ¥Õ¥©¥ë¥À¤Î²èÁü¤òÁªÂò
+		if(arrTree[i][2] == openFolder) {
+			folder_img = IMG_FOLDER_OPEN;
+		} else {
+			folder_img = IMG_FOLDER_CLOSE;
+		}
+
+		arrFileSplit = arrTree[i][2].split("/");
+		file_name = arrFileSplit[arrFileSplit.length-1];
+
+		// ³¬ÁØ²èÁü¤¬¥Î¡¼¥Þ¥ë¤Î»þ¤Î¤ß¥ª¥ó¥¯¥ê¥Ã¥¯½èÍý¤ò¤Ä¤±¤ë
+		if(rank_img != IMG_NORMAL) {
+			tree += '<input type="image" src="'+ rank_img +'" border="0" name="rank_img'+ i +'" id="rank_img'+ i +'" onclick="fnTreeMenu(\'tree'+ i +'\',\'rank_img'+ i +'\',\''+ arrTree[i][2] +'\')">';
+		} else {
+			tree += '<img src="'+ rank_img +'" border="0" name="rank_img'+ i +'" id="rank_img'+ i +'">';
+		}
+		tree += '<input type="image" src="'+ folder_img +'" border="0" name="tree_img'+ i +'" id="tree_img'+ i +'" onclick="fnFolderOpen(\''+ arrTree[i][2] +'\')">&nbsp;'+ file_name +'<br/>';
+		tree += '<div id="tree'+ i +'" style="display:'+ display +'">';
+	
+	}
+	//tree += '</form>';
+	fnDrow(view_id, tree);
+	//document.tree_form.tree_test2.focus();	
+}
+
+// Tree¾õÂÖ¤òhidden¤Ë¥»¥Ã¥È
+function setTreeStatus(name) {
+	var tree_status = "";
+	for(i=0; i < arrTreeStatus.length ;i++) {
+		if(i != 0) tree_status += '|';
+		tree_status += arrTreeStatus[i];
+	}
+	document.form1[name].value = tree_status;
+}
+
+// Tree¾õÂÖ¤òºï½ü¤¹¤ë(ÊÄ¤¸¤ë¾õÂÖ¤Ø)
+function fnDelTreeStatus(path) {
+	for(i=0; i < arrTreeStatus.length ;i++) {
+		if(arrTreeStatus[i] == path) {
+			arrTreeStatus[i] = "";
+		}
+	}
+}
+// ¥Ä¥ê¡¼ÉÁ²è
+function fnDrow(id, tree) {
+	// ¥Ö¥é¥¦¥¶¼èÆÀ
+	MyBR = fnGetMyBrowser();
+	// ¥Ö¥é¥¦¥¶»ö¤Ë½èÍý¤òÀÚ¤êÊ¬¤±
+	switch(myBR) {
+		// IE4¤Î»þ¤ÎÉ½¼¨
+		case 'I4':
+			document.all(id).innerHTML = tree;
+			break;
+		// NN4¤Î»þ¤ÎÉ½¼¨
+		case 'N4':
+			document.layers[id].document.open();
+			document.layers[id].document.write("<div>");
+			document.layers[id].document.write(tree);
+			document.layers[id].document.write("</div>");
+			document.layers[id].document.close();
+			break;
+		default:
+			document.getElementById(id).innerHTML=tree;
+			break;
+	}
+}
+
+// ³¬ÁØ¥Ä¥ê¡¼¥á¥Ë¥å¡¼É½¼¨¡¦ÈóÉ½¼¨½èÍý
+function fnTreeMenu(tName, imgName, path) {
+
+	tMenu = document.all[tName].style;
+
+	if(tMenu.display == 'none') {
+		fnChgImg(IMG_MINUS, imgName);
+		tMenu.display = "block";
+		// ³¬ÁØ¤Î³«¤¤¤¿¾õÂÖ¤òÊÝ»ý
+		arrTreeStatus.push(path);
+
+	} else {
+		fnChgImg(IMG_PLUS, imgName);
+		tMenu.display = "none";
+		// ÊÄ¤¸¾õÂÖ¤òÊÝ»ý
+		fnDelTreeStatus(path);
+	}
+}
+
+// ¥Õ¥©¥ë¥À¥ª¡¼¥×¥ó½èÍý
+function fnFolderOpen(path) {
+
+	// ¥¯¥ê¥Ã¥¯¤·¤¿¥Õ¥©¥ë¥À¾ðÊó¤òÊÝ»ý
+	document.form1['tree_select_file'].value = path;
+	// tree¤Î¾õÂÖ¤ò¥»¥Ã¥È
+	setTreeStatus('tree_status');
+	// submit
+	fnModeSubmit('move','','');
+}
+
+
+// ±ÜÍ÷¥Ö¥é¥¦¥¶¼èÆÀ
+function fnGetMyBrowser() {
+	myOP = window.opera;            // OP
+	myN6 = document.getElementById; // N6
+	myIE = document.all;            // IE
+	myN4 = document.layers;         // N4
+	if      (myOP) myBR="O6";       // OP6°Ê¾å
+	else if (myIE) myBR="I4";       // IE4°Ê¾å
+	else if (myN6) myBR="N6";       // NS6°Ê¾å
+	else if (myN4) myBR="N4";       // NN4
+	else           myBR="";         // ¤½¤ÎÂ¾
+		
+	return myBR;
+}
+
+// img¥¿¥°¤Î²èÁüÊÑ¹¹
+function fnChgImg(fileName,imgName){
+	document.getElementById(imgName).src = fileName;
+}
+
+// ¥Õ¥¡¥¤¥ëÁªÂò
+function fnSelectFile(id, val) {
+	if(old_select_id != '') document.getElementById(old_select_id).style.backgroundColor = '';
+	document.getElementById(id).style.backgroundColor = val;
+	old_select_id = id;
+}
+
+// ÇØ·Ê¿§¤òÊÑ¤¨¤ë
+function fnChangeBgColor(id, val) {
+	if (old_select_id != id) {
+		document.getElementById(id).style.backgroundColor = val;
+	}
+}
Index: /branches/mobile/html/test/uehara/file_view.php
===================================================================
--- /branches/mobile/html/test/uehara/file_view.php	(revision 8731)
+++ /branches/mobile/html/test/uehara/file_view.php	(revision 8731)
@@ -0,0 +1,32 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../../require.php");
+
+// ¥½¡¼¥¹¤È¤·¤ÆÉ½¼¨¤¹¤ë¥Õ¥¡¥¤¥ë¤òÄêµÁ(Ä¾ÀÜ¼Â¹Ô¤·¤Ê¤¤¥Õ¥¡¥¤¥ë)
+$arrViewFile = array(
+					 'html',
+					 'htm',
+					 'tpl',
+					 'php',
+					 'css',
+					 'js',
+);
+
+// ³ÈÄ¥»Ò¼èÆÀ
+$arrResult = split('\.', $_GET['file']);
+$ext = $arrResult[count($arrResult)-1];
+
+// ¥Õ¥¡¥¤¥ëÆâÍÆÉ½¼¨
+if(in_array($ext, $arrViewFile)) {
+	// ¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¹þ¤ó¤ÇÉ½¼¨
+	header("Content-type: text/plain\n\n");
+	print(sfReadFile(USER_PATH.$_GET['file']));
+} else {
+	header("Location: ".USER_URL.$_GET['file']);
+}
+?>
Index: /branches/mobile/html/test/kakinaka/int.php
===================================================================
--- /branches/mobile/html/test/kakinaka/int.php	(revision 9536)
+++ /branches/mobile/html/test/kakinaka/int.php	(revision 9536)
@@ -0,0 +1,11 @@
+<?php
+require_once("../../require.php");
+
+$test = "-1a";
+
+$val = sfIsInt($test);
+
+print($val);
+
+
+?>
Index: /branches/mobile/html/test/kakinaka/tax.php
===================================================================
--- /branches/mobile/html/test/kakinaka/tax.php	(revision 9892)
+++ /branches/mobile/html/test/kakinaka/tax.php	(revision 9892)
@@ -0,0 +1,9 @@
+<?php
+
+require_once("../../require.php");
+
+
+echo "»Í¼Î¸ÞÆþ¡§" . sfRound(5.499599,5) . "<br>";
+
+
+?>
Index: /branches/mobile/html/test/kakinaka/treecheck.php
===================================================================
--- /branches/mobile/html/test/kakinaka/treecheck.php	(revision 7226)
+++ /branches/mobile/html/test/kakinaka/treecheck.php	(revision 7226)
@@ -0,0 +1,11 @@
+<?php
+
+require_once("../../require.php");
+
+$objView = new SC_UserView("./templates/");
+
+sfprintr($_POST);
+
+$objView->display("treecheck.tpl")
+
+?>
Index: /branches/mobile/html/test/kakinaka/auth_http.php
===================================================================
--- /branches/mobile/html/test/kakinaka/auth_http.php	(revision 10097)
+++ /branches/mobile/html/test/kakinaka/auth_http.php	(revision 10097)
@@ -0,0 +1,31 @@
+<?php  
+require_once($include_dir . "/pear/Auth_HTTP.php");	// PEAR¤ÎAuth_HTTP¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß¹þ¤ß
+
+//define("DSN", "pgsql://kakinaka_db_user:password@kakinaka.ec-cube.net/kakinaka_db");
+define("DSN", "mysql://eccube_db_user:password@210.18.212.165:3308/eccube_db");
+
+// ¥Ç¡¼¥¿¥Ù¡¼¥¹ÀÜÂ³¥ª¥×¥·¥ç¥ó¤ÎÀßÄê
+$arrDbConn = array(
+	'dsn'=>DSN,
+	'table'=>"dtb_member",              // ¥Æ¡¼¥Ö¥ëÌ¾ 
+	'usernamecol'=>"login_id",			// ¥æ¡¼¥¶Ì¾¤Î¥«¥é¥à
+	'passwordcol'=>"password",			// ¥Ñ¥¹¥ï¡¼¥É¤Î¥«¥é¥à
+	'cryptType'=>"none",				// ¥Ñ¥¹¥ï¡¼¥É¤Î°Å¹æ²½·Á¼°(°Å¹æ²½¤Ê¤·¤Î¤È¤­¤Ïnone)
+	'db_fields'=>"*",					// ¤½¤ÎÂ¾¤Î¥«¥é¥à¤ò¼èÆÀ¤¹¤ë¾ì¹ç¤Ë¤Ï¥«¥é¥à¤ò»ØÄê¤¹¤ë
+);
+
+$objAuthHttp = new Auth_HTTP("DB", $arrDbConn);		// ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®
+
+$objAuthHttp->setRealm('user realm');				// ÎÎ°è (realm) Ì¾
+$objAuthHttp->setCancelText('ÀÜÂ³¥¨¥é¡¼'); 		   	// Ç§¾Ú¼ºÇÔ»þ¡¢É½¼¨¤µ¤ì¤ë¥á¥Ã¥»¡¼¥¸
+
+$objAuthHttp->start();								// Ç§¾Ú³«»Ï
+
+// Ç§¾Ú¥Á¥§¥Ã¥¯(À®¸ù¡§TRUE¡¡¼ºÇÔ¡§FALSE)
+if($objAuthHttp->getAuth())				
+{
+	echo "Ç§¾ÚÀ®¸ù";
+	echo "¤è¤¦¤³¤½ " . $objAuthHttp->getAuthData('name') . "¤µ¤ó";	// ¼èÆÀ¤·¤¿¥Ç¡¼¥¿¤ò»ÈÍÑ¤¹¤ë
+}
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/PEAR.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/PEAR.php	(revision 10055)
+++ /branches/mobile/html/test/kakinaka/pear/PEAR.php	(revision 10055)
@@ -0,0 +1,1095 @@
+<?php
+/**
+ * PEAR, the PHP Extension and Application Repository
+ *
+ * PEAR class and PEAR_Error 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   pear
+ * @package    PEAR
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Greg Beaver <cellog@php.net>
+ * @copyright  1997-2006 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/PEAR
+ * @since      File available since Release 0.1
+ */
+
+/**#@+
+ * ERROR constants
+ */
+define('PEAR_ERROR_RETURN',     1);
+define('PEAR_ERROR_PRINT',      2);
+define('PEAR_ERROR_TRIGGER',    4);
+define('PEAR_ERROR_DIE',        8);
+define('PEAR_ERROR_CALLBACK',  16);
+/**
+ * WARNING: obsolete
+ * @deprecated
+ */
+define('PEAR_ERROR_EXCEPTION', 32);
+/**#@-*/
+define('PEAR_ZE2', (function_exists('version_compare') &&
+                    version_compare(zend_version(), "2-dev", "ge")));
+
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+    define('OS_WINDOWS', true);
+    define('OS_UNIX',    false);
+    define('PEAR_OS',    'Windows');
+} else {
+    define('OS_WINDOWS', false);
+    define('OS_UNIX',    true);
+    define('PEAR_OS',    'Unix'); // blatant assumption
+}
+
+// instant backwards compatibility
+if (!defined('PATH_SEPARATOR')) {
+    if (OS_WINDOWS) {
+        define('PATH_SEPARATOR', ';');
+    } else {
+        define('PATH_SEPARATOR', ':');
+    }
+}
+
+$GLOBALS['_PEAR_default_error_mode']     = PEAR_ERROR_RETURN;
+$GLOBALS['_PEAR_default_error_options']  = E_USER_NOTICE;
+$GLOBALS['_PEAR_destructor_object_list'] = array();
+$GLOBALS['_PEAR_shutdown_funcs']         = array();
+$GLOBALS['_PEAR_error_handler_stack']    = array();
+
+@ini_set('track_errors', true);
+
+/**
+ * Base class for other PEAR classes.  Provides rudimentary
+ * emulation of destructors.
+ *
+ * If you want a destructor in your class, inherit PEAR and make a
+ * destructor method called _yourclassname (same name as the
+ * constructor, but with a "_" prefix).  Also, in your constructor you
+ * have to call the PEAR constructor: $this->PEAR();.
+ * The destructor method will be called without parameters.  Note that
+ * at in some SAPI implementations (such as Apache), any output during
+ * the request shutdown (in which destructors are called) seems to be
+ * discarded.  If you need to get any debug information from your
+ * destructor, use error_log(), syslog() or something similar.
+ *
+ * IMPORTANT! To use the emulated destructors you need to create the
+ * objects by reference: $obj =& new PEAR_child;
+ *
+ * @category   pear
+ * @package    PEAR
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Greg Beaver <cellog@php.net>
+ * @copyright  1997-2006 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 1.4.6
+ * @link       http://pear.php.net/package/PEAR
+ * @see        PEAR_Error
+ * @since      Class available since PHP 4.0.2
+ * @link        http://pear.php.net/manual/en/core.pear.php#core.pear.pear
+ */
+class PEAR
+{
+    // {{{ properties
+
+    /**
+     * Whether to enable internal debug messages.
+     *
+     * @var     bool
+     * @access  private
+     */
+    var $_debug = false;
+
+    /**
+     * Default error mode for this object.
+     *
+     * @var     int
+     * @access  private
+     */
+    var $_default_error_mode = null;
+
+    /**
+     * Default error options used for this object when error mode
+     * is PEAR_ERROR_TRIGGER.
+     *
+     * @var     int
+     * @access  private
+     */
+    var $_default_error_options = null;
+
+    /**
+     * Default error handler (callback) for this object, if error mode is
+     * PEAR_ERROR_CALLBACK.
+     *
+     * @var     string
+     * @access  private
+     */
+    var $_default_error_handler = '';
+
+    /**
+     * Which class to use for error objects.
+     *
+     * @var     string
+     * @access  private
+     */
+    var $_error_class = 'PEAR_Error';
+
+    /**
+     * An array of expected errors.
+     *
+     * @var     array
+     * @access  private
+     */
+    var $_expected_errors = array();
+
+    // }}}
+
+    // {{{ constructor
+
+    /**
+     * Constructor.  Registers this object in
+     * $_PEAR_destructor_object_list for destructor emulation if a
+     * destructor object exists.
+     *
+     * @param string $error_class  (optional) which class to use for
+     *        error objects, defaults to PEAR_Error.
+     * @access public
+     * @return void
+     */
+    function PEAR($error_class = null)
+    {
+        $classname = strtolower(get_class($this));
+        if ($this->_debug) {
+            print "PEAR constructor called, class=$classname\n";
+        }
+        if ($error_class !== null) {
+            $this->_error_class = $error_class;
+        }
+        while ($classname && strcasecmp($classname, "pear")) {
+            $destructor = "_$classname";
+            if (method_exists($this, $destructor)) {
+                global $_PEAR_destructor_object_list;
+                $_PEAR_destructor_object_list[] = &$this;
+                if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
+                    register_shutdown_function("_PEAR_call_destructors");
+                    $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
+                }
+                break;
+            } else {
+                $classname = get_parent_class($classname);
+            }
+        }
+    }
+
+    // }}}
+    // {{{ destructor
+
+    /**
+     * Destructor (the emulated type of...).  Does nothing right now,
+     * but is included for forward compatibility, so subclass
+     * destructors should always call it.
+     *
+     * See the note in the class desciption about output from
+     * destructors.
+     *
+     * @access public
+     * @return void
+     */
+    function _PEAR() {
+        if ($this->_debug) {
+            printf("PEAR destructor called, class=%s\n", strtolower(get_class($this)));
+        }
+    }
+
+    // }}}
+    // {{{ getStaticProperty()
+
+    /**
+    * If you have a class that's mostly/entirely static, and you need static
+    * properties, you can use this method to simulate them. Eg. in your method(s)
+    * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
+    * You MUST use a reference, or they will not persist!
+    *
+    * @access public
+    * @param  string $class  The calling classname, to prevent clashes
+    * @param  string $var    The variable to retrieve.
+    * @return mixed   A reference to the variable. If not set it will be
+    *                 auto initialised to NULL.
+    */
+    function &getStaticProperty($class, $var)
+    {
+        static $properties;
+        return $properties[$class][$var];
+    }
+
+    // }}}
+    // {{{ registerShutdownFunc()
+
+    /**
+    * Use this function to register a shutdown method for static
+    * classes.
+    *
+    * @access public
+    * @param  mixed $func  The function name (or array of class/method) to call
+    * @param  mixed $args  The arguments to pass to the function
+    * @return void
+    */
+    function registerShutdownFunc($func, $args = array())
+    {
+        $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
+    }
+
+    // }}}
+    // {{{ isError()
+
+    /**
+     * Tell whether a value is a PEAR error.
+     *
+     * @param   mixed $data   the value to test
+     * @param   int   $code   if $data is an error object, return true
+     *                        only if $code is a string and
+     *                        $obj->getMessage() == $code or
+     *                        $code is an integer and $obj->getCode() == $code
+     * @access  public
+     * @return  bool    true if parameter is an error
+     */
+    function isError($data, $code = null)
+    {
+        if (is_a($data, 'PEAR_Error')) {
+            if (is_null($code)) {
+                return true;
+            } elseif (is_string($code)) {
+                return $data->getMessage() == $code;
+            } else {
+                return $data->getCode() == $code;
+            }
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ setErrorHandling()
+
+    /**
+     * Sets how errors generated by this object should be handled.
+     * Can be invoked both in objects and statically.  If called
+     * statically, setErrorHandling sets the default behaviour for all
+     * PEAR objects.  If called in an object, setErrorHandling sets
+     * the default behaviour for that object.
+     *
+     * @param int $mode
+     *        One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
+     *        PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
+     *        PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
+     *
+     * @param mixed $options
+     *        When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
+     *        of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
+     *
+     *        When $mode is PEAR_ERROR_CALLBACK, this parameter is expected
+     *        to be the callback function or method.  A callback
+     *        function is a string with the name of the function, a
+     *        callback method is an array of two elements: the element
+     *        at index 0 is the object, and the element at index 1 is
+     *        the name of the method to call in the object.
+     *
+     *        When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is
+     *        a printf format string used when printing the error
+     *        message.
+     *
+     * @access public
+     * @return void
+     * @see PEAR_ERROR_RETURN
+     * @see PEAR_ERROR_PRINT
+     * @see PEAR_ERROR_TRIGGER
+     * @see PEAR_ERROR_DIE
+     * @see PEAR_ERROR_CALLBACK
+     * @see PEAR_ERROR_EXCEPTION
+     *
+     * @since PHP 4.0.5
+     */
+
+    function setErrorHandling($mode = null, $options = null)
+    {
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $setmode     = &$this->_default_error_mode;
+            $setoptions  = &$this->_default_error_options;
+        } else {
+            $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
+            $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
+        }
+
+        switch ($mode) {
+            case PEAR_ERROR_EXCEPTION:
+            case PEAR_ERROR_RETURN:
+            case PEAR_ERROR_PRINT:
+            case PEAR_ERROR_TRIGGER:
+            case PEAR_ERROR_DIE:
+            case null:
+                $setmode = $mode;
+                $setoptions = $options;
+                break;
+
+            case PEAR_ERROR_CALLBACK:
+                $setmode = $mode;
+                // class/object method callback
+                if (is_callable($options)) {
+                    $setoptions = $options;
+                } else {
+                    trigger_error("invalid error callback", E_USER_WARNING);
+                }
+                break;
+
+            default:
+                trigger_error("invalid error mode", E_USER_WARNING);
+                break;
+        }
+    }
+
+    // }}}
+    // {{{ expectError()
+
+    /**
+     * This method is used to tell which errors you expect to get.
+     * Expected errors are always returned with error mode
+     * PEAR_ERROR_RETURN.  Expected error codes are stored in a stack,
+     * and this method pushes a new element onto it.  The list of
+     * expected errors are in effect until they are popped off the
+     * stack with the popExpect() method.
+     *
+     * Note that this method can not be called statically
+     *
+     * @param mixed $code a single error code or an array of error codes to expect
+     *
+     * @return int     the new depth of the "expected errors" stack
+     * @access public
+     */
+    function expectError($code = '*')
+    {
+        if (is_array($code)) {
+            array_push($this->_expected_errors, $code);
+        } else {
+            array_push($this->_expected_errors, array($code));
+        }
+        return sizeof($this->_expected_errors);
+    }
+
+    // }}}
+    // {{{ popExpect()
+
+    /**
+     * This method pops one element off the expected error codes
+     * stack.
+     *
+     * @return array   the list of error codes that were popped
+     */
+    function popExpect()
+    {
+        return array_pop($this->_expected_errors);
+    }
+
+    // }}}
+    // {{{ _checkDelExpect()
+
+    /**
+     * This method checks unsets an error code if available
+     *
+     * @param mixed error code
+     * @return bool true if the error code was unset, false otherwise
+     * @access private
+     * @since PHP 4.3.0
+     */
+    function _checkDelExpect($error_code)
+    {
+        $deleted = false;
+
+        foreach ($this->_expected_errors AS $key => $error_array) {
+            if (in_array($error_code, $error_array)) {
+                unset($this->_expected_errors[$key][array_search($error_code, $error_array)]);
+                $deleted = true;
+            }
+
+            // clean up empty arrays
+            if (0 == count($this->_expected_errors[$key])) {
+                unset($this->_expected_errors[$key]);
+            }
+        }
+        return $deleted;
+    }
+
+    // }}}
+    // {{{ delExpect()
+
+    /**
+     * This method deletes all occurences of the specified element from
+     * the expected error codes stack.
+     *
+     * @param  mixed $error_code error code that should be deleted
+     * @return mixed list of error codes that were deleted or error
+     * @access public
+     * @since PHP 4.3.0
+     */
+    function delExpect($error_code)
+    {
+        $deleted = false;
+
+        if ((is_array($error_code) && (0 != count($error_code)))) {
+            // $error_code is a non-empty array here;
+            // we walk through it trying to unset all
+            // values
+            foreach($error_code as $key => $error) {
+                if ($this->_checkDelExpect($error)) {
+                    $deleted =  true;
+                } else {
+                    $deleted = false;
+                }
+            }
+            return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
+        } elseif (!empty($error_code)) {
+            // $error_code comes alone, trying to unset it
+            if ($this->_checkDelExpect($error_code)) {
+                return true;
+            } else {
+                return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
+            }
+        } else {
+            // $error_code is empty
+            return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
+        }
+    }
+
+    // }}}
+    // {{{ raiseError()
+
+    /**
+     * This method is a wrapper that returns an instance of the
+     * configured error class with this object's default error
+     * handling applied.  If the $mode and $options parameters are not
+     * specified, the object's defaults are used.
+     *
+     * @param mixed $message a text error message or a PEAR error object
+     *
+     * @param int $code      a numeric error code (it is up to your class
+     *                  to define these if you want to use codes)
+     *
+     * @param int $mode      One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
+     *                  PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
+     *                  PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
+     *
+     * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
+     *                  specifies the PHP-internal error level (one of
+     *                  E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
+     *                  If $mode is PEAR_ERROR_CALLBACK, this
+     *                  parameter specifies the callback function or
+     *                  method.  In other error modes this parameter
+     *                  is ignored.
+     *
+     * @param string $userinfo If you need to pass along for example debug
+     *                  information, this parameter is meant for that.
+     *
+     * @param string $error_class The returned error object will be
+     *                  instantiated from this class, if specified.
+     *
+     * @param bool $skipmsg If true, raiseError will only pass error codes,
+     *                  the error message parameter will be dropped.
+     *
+     * @access public
+     * @return object   a PEAR error object
+     * @see PEAR::setErrorHandling
+     * @since PHP 4.0.5
+     */
+    function &raiseError($message = null,
+                         $code = null,
+                         $mode = null,
+                         $options = null,
+                         $userinfo = null,
+                         $error_class = null,
+                         $skipmsg = false)
+    {
+        // The error is yet a PEAR error object
+        if (is_object($message)) {
+            $code        = $message->getCode();
+            $userinfo    = $message->getUserInfo();
+            $error_class = $message->getType();
+            $message->error_message_prefix = '';
+            $message     = $message->getMessage();
+        }
+
+        if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
+            if ($exp[0] == "*" ||
+                (is_int(reset($exp)) && in_array($code, $exp)) ||
+                (is_string(reset($exp)) && in_array($message, $exp))) {
+                $mode = PEAR_ERROR_RETURN;
+            }
+        }
+        // No mode given, try global ones
+        if ($mode === null) {
+            // Class error handler
+            if (isset($this) && isset($this->_default_error_mode)) {
+                $mode    = $this->_default_error_mode;
+                $options = $this->_default_error_options;
+            // Global error handler
+            } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
+                $mode    = $GLOBALS['_PEAR_default_error_mode'];
+                $options = $GLOBALS['_PEAR_default_error_options'];
+            }
+        }
+
+        if ($error_class !== null) {
+            $ec = $error_class;
+        } elseif (isset($this) && isset($this->_error_class)) {
+            $ec = $this->_error_class;
+        } else {
+            $ec = 'PEAR_Error';
+        }
+        if ($skipmsg) {
+            $a = &new $ec($code, $mode, $options, $userinfo);
+            return $a;
+        } else {
+            $a = &new $ec($message, $code, $mode, $options, $userinfo);
+            return $a;
+        }
+    }
+
+    // }}}
+    // {{{ throwError()
+
+    /**
+     * Simpler form of raiseError with fewer options.  In most cases
+     * message, code and userinfo are enough.
+     *
+     * @param string $message
+     *
+     */
+    function &throwError($message = null,
+                         $code = null,
+                         $userinfo = null)
+    {
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $a = &$this->raiseError($message, $code, null, null, $userinfo);
+            return $a;
+        } else {
+            $a = &PEAR::raiseError($message, $code, null, null, $userinfo);
+            return $a;
+        }
+    }
+
+    // }}}
+    function staticPushErrorHandling($mode, $options = null)
+    {
+        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
+        $def_options = &$GLOBALS['_PEAR_default_error_options'];
+        $stack[] = array($def_mode, $def_options);
+        switch ($mode) {
+            case PEAR_ERROR_EXCEPTION:
+            case PEAR_ERROR_RETURN:
+            case PEAR_ERROR_PRINT:
+            case PEAR_ERROR_TRIGGER:
+            case PEAR_ERROR_DIE:
+            case null:
+                $def_mode = $mode;
+                $def_options = $options;
+                break;
+
+            case PEAR_ERROR_CALLBACK:
+                $def_mode = $mode;
+                // class/object method callback
+                if (is_callable($options)) {
+                    $def_options = $options;
+                } else {
+                    trigger_error("invalid error callback", E_USER_WARNING);
+                }
+                break;
+
+            default:
+                trigger_error("invalid error mode", E_USER_WARNING);
+                break;
+        }
+        $stack[] = array($mode, $options);
+        return true;
+    }
+
+    function staticPopErrorHandling()
+    {
+        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
+        $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
+        array_pop($stack);
+        list($mode, $options) = $stack[sizeof($stack) - 1];
+        array_pop($stack);
+        switch ($mode) {
+            case PEAR_ERROR_EXCEPTION:
+            case PEAR_ERROR_RETURN:
+            case PEAR_ERROR_PRINT:
+            case PEAR_ERROR_TRIGGER:
+            case PEAR_ERROR_DIE:
+            case null:
+                $setmode = $mode;
+                $setoptions = $options;
+                break;
+
+            case PEAR_ERROR_CALLBACK:
+                $setmode = $mode;
+                // class/object method callback
+                if (is_callable($options)) {
+                    $setoptions = $options;
+                } else {
+                    trigger_error("invalid error callback", E_USER_WARNING);
+                }
+                break;
+
+            default:
+                trigger_error("invalid error mode", E_USER_WARNING);
+                break;
+        }
+        return true;
+    }
+
+    // {{{ pushErrorHandling()
+
+    /**
+     * Push a new error handler on top of the error handler options stack. With this
+     * you can easily override the actual error handler for some code and restore
+     * it later with popErrorHandling.
+     *
+     * @param mixed $mode (same as setErrorHandling)
+     * @param mixed $options (same as setErrorHandling)
+     *
+     * @return bool Always true
+     *
+     * @see PEAR::setErrorHandling
+     */
+    function pushErrorHandling($mode, $options = null)
+    {
+        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $def_mode    = &$this->_default_error_mode;
+            $def_options = &$this->_default_error_options;
+        } else {
+            $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
+            $def_options = &$GLOBALS['_PEAR_default_error_options'];
+        }
+        $stack[] = array($def_mode, $def_options);
+
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $this->setErrorHandling($mode, $options);
+        } else {
+            PEAR::setErrorHandling($mode, $options);
+        }
+        $stack[] = array($mode, $options);
+        return true;
+    }
+
+    // }}}
+    // {{{ popErrorHandling()
+
+    /**
+    * Pop the last error handler used
+    *
+    * @return bool Always true
+    *
+    * @see PEAR::pushErrorHandling
+    */
+    function popErrorHandling()
+    {
+        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        array_pop($stack);
+        list($mode, $options) = $stack[sizeof($stack) - 1];
+        array_pop($stack);
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $this->setErrorHandling($mode, $options);
+        } else {
+            PEAR::setErrorHandling($mode, $options);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ loadExtension()
+
+    /**
+    * OS independant PHP extension load. Remember to take care
+    * on the correct extension name for case sensitive OSes.
+    *
+    * @param string $ext The extension name
+    * @return bool Success or not on the dl() call
+    */
+    function loadExtension($ext)
+    {
+        if (!extension_loaded($ext)) {
+            // if either returns true dl() will produce a FATAL error, stop that
+            if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
+                return false;
+            }
+            if (OS_WINDOWS) {
+                $suffix = '.dll';
+            } elseif (PHP_OS == 'HP-UX') {
+                $suffix = '.sl';
+            } elseif (PHP_OS == 'AIX') {
+                $suffix = '.a';
+            } elseif (PHP_OS == 'OSX') {
+                $suffix = '.bundle';
+            } else {
+                $suffix = '.so';
+            }
+            return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
+        }
+        return true;
+    }
+
+    // }}}
+}
+
+// {{{ _PEAR_call_destructors()
+
+function _PEAR_call_destructors()
+{
+    global $_PEAR_destructor_object_list;
+    if (is_array($_PEAR_destructor_object_list) &&
+        sizeof($_PEAR_destructor_object_list))
+    {
+        reset($_PEAR_destructor_object_list);
+        if (@PEAR::getStaticProperty('PEAR', 'destructlifo')) {
+            $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
+        }
+        while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
+            $classname = get_class($objref);
+            while ($classname) {
+                $destructor = "_$classname";
+                if (method_exists($objref, $destructor)) {
+                    $objref->$destructor();
+                    break;
+                } else {
+                    $classname = get_parent_class($classname);
+                }
+            }
+        }
+        // Empty the object list to ensure that destructors are
+        // not called more than once.
+        $_PEAR_destructor_object_list = array();
+    }
+
+    // Now call the shutdown functions
+    if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) {
+        foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) {
+            call_user_func_array($value[0], $value[1]);
+        }
+    }
+}
+
+// }}}
+/**
+ * Standard PEAR error class for PHP 4
+ *
+ * This class is supserseded by {@link PEAR_Exception} in PHP 5
+ *
+ * @category   pear
+ * @package    PEAR
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Gregory Beaver <cellog@php.net>
+ * @copyright  1997-2006 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 1.4.6
+ * @link       http://pear.php.net/manual/en/core.pear.pear-error.php
+ * @see        PEAR::raiseError(), PEAR::throwError()
+ * @since      Class available since PHP 4.0.2
+ */
+class PEAR_Error
+{
+    // {{{ properties
+
+    var $error_message_prefix = '';
+    var $mode                 = PEAR_ERROR_RETURN;
+    var $level                = E_USER_NOTICE;
+    var $code                 = -1;
+    var $message              = '';
+    var $userinfo             = '';
+    var $backtrace            = null;
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * PEAR_Error constructor
+     *
+     * @param string $message  message
+     *
+     * @param int $code     (optional) error code
+     *
+     * @param int $mode     (optional) error mode, one of: PEAR_ERROR_RETURN,
+     * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
+     * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
+     *
+     * @param mixed $options   (optional) error level, _OR_ in the case of
+     * PEAR_ERROR_CALLBACK, the callback function or object/method
+     * tuple.
+     *
+     * @param string $userinfo (optional) additional user/debug info
+     *
+     * @access public
+     *
+     */
+    function PEAR_Error($message = 'unknown error', $code = null,
+                        $mode = null, $options = null, $userinfo = null)
+    {
+        if ($mode === null) {
+            $mode = PEAR_ERROR_RETURN;
+        }
+        $this->message   = $message;
+        $this->code      = $code;
+        $this->mode      = $mode;
+        $this->userinfo  = $userinfo;
+        if (function_exists("debug_backtrace")) {
+            if (@!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) {
+                $this->backtrace = debug_backtrace();
+            }
+        }
+        if ($mode & PEAR_ERROR_CALLBACK) {
+            $this->level = E_USER_NOTICE;
+            $this->callback = $options;
+        } else {
+            if ($options === null) {
+                $options = E_USER_NOTICE;
+            }
+            $this->level = $options;
+            $this->callback = null;
+        }
+        if ($this->mode & PEAR_ERROR_PRINT) {
+            if (is_null($options) || is_int($options)) {
+                $format = "%s";
+            } else {
+                $format = $options;
+            }
+            printf($format, $this->getMessage());
+        }
+        if ($this->mode & PEAR_ERROR_TRIGGER) {
+            trigger_error($this->getMessage(), $this->level);
+        }
+        if ($this->mode & PEAR_ERROR_DIE) {
+            $msg = $this->getMessage();
+            if (is_null($options) || is_int($options)) {
+                $format = "%s";
+                if (substr($msg, -1) != "\n") {
+                    $msg .= "\n";
+                }
+            } else {
+                $format = $options;
+            }
+            die(sprintf($format, $msg));
+        }
+        if ($this->mode & PEAR_ERROR_CALLBACK) {
+            if (is_callable($this->callback)) {
+                call_user_func($this->callback, $this);
+            }
+        }
+        if ($this->mode & PEAR_ERROR_EXCEPTION) {
+            trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
+            eval('$e = new Exception($this->message, $this->code);throw($e);');
+        }
+    }
+
+    // }}}
+    // {{{ getMode()
+
+    /**
+     * Get the error mode from an error object.
+     *
+     * @return int error mode
+     * @access public
+     */
+    function getMode() {
+        return $this->mode;
+    }
+
+    // }}}
+    // {{{ getCallback()
+
+    /**
+     * Get the callback function/method from an error object.
+     *
+     * @return mixed callback function or object/method array
+     * @access public
+     */
+    function getCallback() {
+        return $this->callback;
+    }
+
+    // }}}
+    // {{{ getMessage()
+
+
+    /**
+     * Get the error message from an error object.
+     *
+     * @return  string  full error message
+     * @access public
+     */
+    function getMessage()
+    {
+        return ($this->error_message_prefix . $this->message);
+    }
+
+
+    // }}}
+    // {{{ getCode()
+
+    /**
+     * Get error code from an error object
+     *
+     * @return int error code
+     * @access public
+     */
+     function getCode()
+     {
+        return $this->code;
+     }
+
+    // }}}
+    // {{{ getType()
+
+    /**
+     * Get the name of this error/exception.
+     *
+     * @return string error/exception name (type)
+     * @access public
+     */
+    function getType()
+    {
+        return get_class($this);
+    }
+
+    // }}}
+    // {{{ getUserInfo()
+
+    /**
+     * Get additional user-supplied information.
+     *
+     * @return string user-supplied information
+     * @access public
+     */
+    function getUserInfo()
+    {
+        return $this->userinfo;
+    }
+
+    // }}}
+    // {{{ getDebugInfo()
+
+    /**
+     * Get additional debug information supplied by the application.
+     *
+     * @return string debug information
+     * @access public
+     */
+    function getDebugInfo()
+    {
+        return $this->getUserInfo();
+    }
+
+    // }}}
+    // {{{ getBacktrace()
+
+    /**
+     * Get the call backtrace from where the error was generated.
+     * Supported with PHP 4.3.0 or newer.
+     *
+     * @param int $frame (optional) what frame to fetch
+     * @return array Backtrace, or NULL if not available.
+     * @access public
+     */
+    function getBacktrace($frame = null)
+    {
+        if (defined('PEAR_IGNORE_BACKTRACE')) {
+            return null;
+        }
+        if ($frame === null) {
+            return $this->backtrace;
+        }
+        return $this->backtrace[$frame];
+    }
+
+    // }}}
+    // {{{ addUserInfo()
+
+    function addUserInfo($info)
+    {
+        if (empty($this->userinfo)) {
+            $this->userinfo = $info;
+        } else {
+            $this->userinfo .= " ** $info";
+        }
+    }
+
+    // }}}
+    // {{{ toString()
+
+    /**
+     * Make a string representation of this object.
+     *
+     * @return string a string with an object summary
+     * @access public
+     */
+    function toString() {
+        $modes = array();
+        $levels = array(E_USER_NOTICE  => 'notice',
+                        E_USER_WARNING => 'warning',
+                        E_USER_ERROR   => 'error');
+        if ($this->mode & PEAR_ERROR_CALLBACK) {
+            if (is_array($this->callback)) {
+                $callback = (is_object($this->callback[0]) ?
+                    strtolower(get_class($this->callback[0])) :
+                    $this->callback[0]) . '::' .
+                    $this->callback[1];
+            } else {
+                $callback = $this->callback;
+            }
+            return sprintf('[%s: message="%s" code=%d mode=callback '.
+                           'callback=%s prefix="%s" info="%s"]',
+                           strtolower(get_class($this)), $this->message, $this->code,
+                           $callback, $this->error_message_prefix,
+                           $this->userinfo);
+        }
+        if ($this->mode & PEAR_ERROR_PRINT) {
+            $modes[] = 'print';
+        }
+        if ($this->mode & PEAR_ERROR_TRIGGER) {
+            $modes[] = 'trigger';
+        }
+        if ($this->mode & PEAR_ERROR_DIE) {
+            $modes[] = 'die';
+        }
+        if ($this->mode & PEAR_ERROR_RETURN) {
+            $modes[] = 'return';
+        }
+        return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
+                       'prefix="%s" info="%s"]',
+                       strtolower(get_class($this)), $this->message, $this->code,
+                       implode("|", $modes), $levels[$this->level],
+                       $this->error_message_prefix,
+                       $this->userinfo);
+    }
+
+    // }}}
+}
+
+/*
+ * Local Variables:
+ * mode: php
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/POP3.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/POP3.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/POP3.php	(revision 10038)
@@ -0,0 +1,143 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against a POP3 server
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Stefan Ekman <stekman@sedata.org> 
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Mika Tuupola <tuupola@appelsiini.net> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.2.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once 'Auth/Container.php';
+/**
+ * Include PEAR package for error handling
+ */
+require_once 'PEAR.php';
+/**
+ * Include PEAR Net_POP3 package
+ */
+require_once 'Net/POP3.php';
+
+/**
+ * Storage driver for Authentication on a POP3 server.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Mika Tuupola <tuupola@appelsiini.net> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.2.0
+ */
+class Auth_Container_POP3 extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * POP3 Server
+     * @var string
+     */
+    var $server='localhost';
+
+    /**
+     * POP3 Server port
+     * @var string
+     */
+    var $port='110';
+
+    /**
+     * POP3 Authentication method
+     *
+     * Prefered POP3 authentication method. Acceptable values:
+     *      Boolean TRUE    - Use Net_POP3's autodetection
+     *      String 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'
+     *                      - Attempt this authentication style first
+     *                        then fallback to autodetection.
+     * @var mixed 
+     */
+    var $method=true;
+
+    // }}}
+    // {{{ Auth_Container_POP3() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * @param  $server string server or server:port combination
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_POP3($server=null)
+    {
+        if (isset($server)) {
+            if (is_array($server)) {
+                if (isset($server['host'])) {
+                    $this->server = $server['host'];
+                }
+                if (isset($server['port'])) {
+                    $this->port = $server['port'];
+                }
+                if (isset($server['method'])) {
+                    $this->method = $server['method'];
+                }
+            } else {
+                if (strstr($server, ':')) {
+                    $serverparts = explode(':', trim($server));
+                    $this->server = $serverparts[0];
+                    $this->port = $serverparts[1];
+                } else {
+                    $this->server = $server;
+                }
+            }
+        }
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Try to login to the POP3 server
+     *
+     * @param   string Username
+     * @param   string Password
+     * @return  boolean
+     */
+    function fetchData($username, $password)
+    {
+        $pop3 =& new Net_POP3();
+        $res = $pop3->connect($this->server, $this->port, $this->method);
+        if (!$res) {
+            return $res;
+        }
+        $result = $pop3->login($username, $password);
+        $pop3->disconnect();
+        return $result;
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/SAP.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/SAP.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/SAP.php	(revision 10038)
@@ -0,0 +1,177 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against a SAP system using the SAPRFC PHP extension.
+ *
+ * Requires the SAPRFC ext available at http://saprfc.sourceforge.net/
+ *
+ * PHP version 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Stoyan Stefanov <ssttoo@gmail.com>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.4.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once 'Auth/Container.php';
+/**
+ * Include PEAR for error handling
+ */
+require_once 'PEAR.php';
+
+/**
+ * Performs authentication against a SAP system using the SAPRFC PHP extension.
+ *
+ * When the option GETSSO2 is TRUE (default)
+ * the Single Sign-On (SSO) ticket is retrieved
+ * and stored as an Auth attribute called 'sap'
+ * in order to be reused for consecutive connections.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Stoyan Stefanov <ssttoo@gmail.com>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @since      Class available since Release 1.4.0
+ */
+class Auth_Container_SAP extends Auth_Container {
+
+    // {{{ properties
+    
+    /**
+     * @var array Default options
+     */
+    var $options = array(
+        'CLIENT'    => '000',
+        'LANG'      => 'EN',
+        'GETSSO2'   => true,
+    );
+
+    // }}}
+    // {{{ Auth_Container_SAP()
+
+    /**
+     * Class constructor. Checks that required options
+     * are present and that the SAPRFC extension is loaded
+     *
+     * Options that can be passed and their defaults:
+     * <pre>
+     * array(
+     *   'ASHOST' => "",
+     *   'SYSNR'  => "",
+     *   'CLIENT' => "000",
+     *   'GWHOST' =>"",
+     *   'GWSERV' =>"",
+     *   'MSHOST' =>"",
+     *   'R3NAME' =>"",
+     *   'GROUP'  =>"",
+     *   'LANG'   =>"EN",
+     *   'TRACE'  =>"",
+     *   'GETSSO2'=> true
+     * )
+     * </pre>
+     *
+     * @param array array of options.
+     * @return void
+     */
+    function Auth_Container_SAP($options)
+    {
+        $saprfc_loaded = PEAR::loadExtension('saprfc');
+        if (!$saprfc_loaded) {
+            return PEAR::raiseError('Cannot use SAP authentication, '
+                    .'SAPRFC extension not loaded!');
+        }
+        if (empty($options['R3NAME']) && empty($options['ASHOST'])) {
+            return PEAR::raiseError('R3NAME or ASHOST required for authentication');
+        }
+        $this->options = array_merge($this->options, $options);
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Performs username and password check
+     *
+     * @param string Username
+     * @param string Password
+     * @return boolean TRUE on success (valid user), FALSE otherwise
+     */
+    function fetchData($username, $password)
+    {
+        $connection_options = $this->options;
+        $connection_options['USER'] = $username;
+        $connection_options['PASSWD'] = $password;
+        $rfc = saprfc_open($connection_options);
+        if (!$rfc) {
+            $message = "Couldn't connect to the SAP system.";
+            $error = $this->getError();
+            if ($error['message']) {
+                $message .= ': ' . $error['message'];
+            }
+            PEAR::raiseError($message, null, null, null, @$erorr['all']);
+            return false;
+        } else {
+            if (!empty($this->options['GETSSO2'])) {
+                if ($ticket = @saprfc_get_ticket($rfc)) {
+                    $this->options['MYSAPSSO2'] = $ticket;
+                    unset($this->options['GETSSO2']);
+                    $this->_auth_obj->setAuthData('sap', $this->options);
+                } else {
+                    PEAR::raiseError("SSO ticket retrieval failed");
+                }
+            }
+            @saprfc_close($rfc);
+            return true;
+        }
+    
+    }
+
+    // }}}
+    // {{{ getError()
+
+    /**
+     * Retrieves the last error from the SAP connection
+     * and returns it as an array.
+     *
+     * @return array Array of error information
+     */
+    function getError()
+    {
+
+        $error = array();
+        $sap_error = saprfc_error();
+        if (empty($err)) {
+            return $error;
+        }
+        $err = explode("n", $sap_error);
+        foreach ($err AS $line) {
+            $item = split(':', $line);
+            $error[strtolower(trim($item[0]))] = trim($item[1]);
+        }
+        $error['all'] = $sap_error;
+        return $error;
+    }
+
+    // }}}
+
+}
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/MDB2.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/MDB2.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/MDB2.php	(revision 10038)
@@ -0,0 +1,571 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against PEAR MDB2
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Lorenzo Alberton <l.alberton@quipo.it> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.3.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once 'Auth/Container.php';
+/**
+ * Include PEAR MDB2 package
+ */
+require_once 'MDB2.php';
+
+/**
+ * Storage driver for fetching login data from a database
+ *
+ * This storage driver can use all databases which are supported
+ * by the PEAR MDB2 abstraction layer to fetch login data.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Lorenzo Alberton <l.alberton@quipo.it>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.3.0
+ */
+class Auth_Container_MDB2 extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Additional options for the storage container
+     * @var array
+     */
+    var $options = array();
+
+    /**
+     * MDB object
+     * @var object
+     */
+    var $db = null;
+    var $dsn = '';
+
+    /**
+     * User that is currently selected from the DB.
+     * @var string
+     */
+    var $activeUser = '';
+
+    // }}}
+    // {{{ Auth_Container_MDB2() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * Initate connection to the database via PEAR::MDB2
+     *
+     * @param  string Connection data or MDB2 object
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_MDB2($dsn)
+    {
+        $this->_setDefaults();
+
+        if (is_array($dsn)) {
+            $this->_parseOptions($dsn);
+            if (empty($this->options['dsn'])) {
+                PEAR::raiseError('No connection parameters specified!');
+            }
+        } else {
+            $this->options['dsn'] = $dsn;
+        }
+    }
+
+    // }}}
+    // {{{ _connect()
+
+    /**
+     * Connect to database by using the given DSN string
+     *
+     * @access private
+     * @param  mixed DSN string | array | mdb object
+     * @return mixed  Object on error, otherwise bool
+     */
+    function _connect($dsn)
+    {
+        if (is_string($dsn) || is_array($dsn)) {
+            $this->db =& MDB2::connect($dsn, $this->options['db_options']);
+        } elseif (is_subclass_of($dsn, 'MDB2_Driver_Common')) {
+            $this->db = $dsn;
+        } elseif (is_object($dsn) && MDB2::isError($dsn)) {
+            return PEAR::raiseError($dsn->getMessage(), $dsn->code);
+        } else {
+            return PEAR::raiseError('The given dsn was not valid in file ' . __FILE__ . ' at line ' . __LINE__,
+                                    41,
+                                    PEAR_ERROR_RETURN,
+                                    null,
+                                    null
+                                    );
+
+        }
+
+        if (MDB2::isError($this->db) || PEAR::isError($this->db)) {
+            return PEAR::raiseError($this->db->getMessage(), $this->db->code);
+        }
+        
+        if ($this->options['auto_quote']) {
+            $this->options['final_table'] = $this->db->quoteIdentifier($this->options['table'], true);
+            $this->options['final_usernamecol'] = $this->db->quoteIdentifier($this->options['usernamecol'], true);
+            $this->options['final_passwordcol'] = $this->db->quoteIdentifier($this->options['passwordcol'], true);
+        } else {
+            $this->options['final_table'] = $this->options['table'];
+            $this->options['final_usernamecol'] = $this->options['usernamecol'];
+            $this->options['final_passwordcol'] = $this->options['passwordcol'];
+        }
+                
+        return true;
+    }
+
+    // }}}
+    // {{{ _prepare()
+
+    /**
+     * Prepare database connection
+     *
+     * This function checks if we have already opened a connection to
+     * the database. If that's not the case, a new connection is opened.
+     *
+     * @access private
+     * @return mixed True or a MDB error object.
+     */
+    function _prepare()
+    {
+        if (is_subclass_of($this->db, 'MDB2_Driver_Common')) {
+            return true;
+        }
+        return $this->_connect($this->options['dsn']);
+    }
+
+    // }}}
+    // {{{ query()
+
+    /**
+     * Prepare query to the database
+     *
+     * This function checks if we have already opened a connection to
+     * the database. If that's not the case, a new connection is opened.
+     * After that the query is passed to the database.
+     *
+     * @access public
+     * @param  string Query string
+     * @return mixed  a MDB_result object or MDB_OK on success, a MDB
+     *                or PEAR error on failure
+     */
+    function query($query)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return $err;
+        }
+        return $this->db->exec($query);
+    }
+
+    // }}}
+    // {{{ _setDefaults()
+
+    /**
+     * Set some default options
+     *
+     * @access private
+     * @return void
+     */
+    function _setDefaults()
+    {
+        $this->options['table']       = 'auth';
+        $this->options['usernamecol'] = 'username';
+        $this->options['passwordcol'] = 'password';
+        $this->options['dsn']         = '';
+        $this->options['db_fields']   = '';
+        $this->options['cryptType']   = 'md5';
+        $this->options['db_options']  = array();
+        $this->options['auto_quote']  = true;
+    }
+
+    // }}}
+    // {{{ _parseOptions()
+
+    /**
+     * Parse options passed to the container class
+     *
+     * @access private
+     * @param  array
+     */
+    function _parseOptions($array)
+    {
+        foreach ($array as $key => $value) {
+            if (isset($this->options[$key])) {
+                $this->options[$key] = $value;
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _quoteDBFields()
+
+    /**
+     * Quote the db_fields option to avoid the possibility of SQL injection.
+     *
+     * @access private
+     * @return string A properly quoted string that can be concatenated into a
+     * SELECT clause.
+     */
+    function _quoteDBFields()
+    {
+        if (isset($this->options['db_fields'])) {
+            if (is_array($this->options['db_fields'])) {
+                if ($this->options['auto_quote']) {
+                    $fields = array();
+                    foreach ($this->options['db_fields'] as $field) {
+                        $fields[] = $this->db->quoteIdentifier($field, true);
+                    }
+                    return implode(', ', $fields);
+                } else {
+                    return implode(', ', $this->options['db_fields']);
+                }
+            } else {
+                if (strlen($this->options['db_fields']) > 0) {
+                    if ($this->options['auto_quote']) {
+                        return $this->db->quoteIdentifier($this->options['db_fields'], true);
+                    } else {
+                        return $this->options['db_fields'];
+                    }
+                }
+            }
+        }
+
+        return '';
+    }
+    
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Get user information from database
+     *
+     * This function uses the given username to fetch
+     * the corresponding login data from the database
+     * table. If an account that matches the passed username
+     * and password is found, the function returns true.
+     * Otherwise it returns false.
+     *
+     * @param   string Username
+     * @param   string Password
+     * @param   boolean If true password is secured using a md5 hash
+     *                  the frontend and auth are responsible for making sure the container supports
+     *                  challenge response password authentication
+     * @return  mixed  Error object or boolean
+     */
+    function fetchData($username, $password, $isChallengeResponse=false)
+    {
+        // Prepare for a database query
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        //Check if db_fields contains a *, if so assume all columns are selected
+        if (is_string($this->options['db_fields'])
+            && strstr($this->options['db_fields'], '*')) {
+            $sql_from = '*';
+        } else {
+            $sql_from = $this->options['final_usernamecol'].
+                ", ".$this->options['final_passwordcol'];
+
+            if (strlen($fields = $this->_quoteDBFields()) > 0) {
+                $sql_from .= ', '.$fields;
+            }
+        }
+        $query = sprintf("SELECT %s FROM %s WHERE %s = %s",
+                         $sql_from,
+                         $this->options['final_table'],
+                         $this->options['final_usernamecol'],
+                         $this->db->quote($username, 'text')
+                         );
+
+        $res = $this->db->queryRow($query, null, MDB2_FETCHMODE_ASSOC);
+        if (MDB2::isError($res) || PEAR::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        }
+        if (!is_array($res)) {
+            $this->activeUser = '';
+            return false;
+        }
+
+        // Perform trimming here before the hashing
+        $password = trim($password, "\r\n");
+        $res[$this->options['passwordcol']] = trim($res[$this->options['passwordcol']], "\r\n");
+        // If using Challenge Response md5 the pass with the secret
+        if ($isChallengeResponse) {
+            $res[$this->options['passwordcol']] =
+                md5($res[$this->options['passwordcol']].$this->_auth_obj->session['loginchallenege']);
+            // UGLY cannot avoid without modifying verifyPassword
+            if ($this->options['cryptType'] == 'md5') {
+                $res[$this->options['passwordcol']] = md5($res[$this->options['passwordcol']]);
+            }
+        }
+        if ($this->verifyPassword($password,
+                                  $res[$this->options['passwordcol']],
+                                  $this->options['cryptType'])) {
+            // Store additional field values in the session
+            foreach ($res as $key => $value) {
+                if ($key == $this->options['passwordcol'] ||
+                    $key == $this->options['usernamecol']) {
+                    continue;
+                }
+                // Use reference to the auth object if exists
+                // This is because the auth session variable can change so a static call to setAuthData does not make sense
+                $this->_auth_obj->setAuthData($key, $value);
+            }
+            return true;
+        }
+
+        $this->activeUser = $res[$this->options['usernamecol']];
+        return false;
+    }
+
+    // }}}
+    // {{{ listUsers()
+
+    /**
+     * Returns a list of users from the container
+     *
+     * @return mixed array|PEAR_Error
+     * @access public
+     */
+    function listUsers()
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        $retVal = array();
+
+        //Check if db_fields contains a *, if so assume all columns are selected
+        if (   is_string($this->options['db_fields'])
+            && strstr($this->options['db_fields'], '*')) {
+            $sql_from = '*';
+        } else {
+            $sql_from = $this->options['final_usernamecol'].
+                ", ".$this->options['final_passwordcol'];
+
+            if (strlen($fields = $this->_quoteDBFields()) > 0) {
+                $sql_from .= ', '.$fields;
+            }
+        }
+
+        $query = sprintf('SELECT %s FROM %s',
+                         $sql_from,
+                         $this->options['final_table']
+                         );
+
+        $res = $this->db->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+        if (MDB2::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        } else {
+            foreach ($res as $user) {
+                $user['username'] = $user[$this->options['usernamecol']];
+                $retVal[] = $user;
+            }
+        }
+        return $retVal;
+    }
+
+    // }}}
+    // {{{ addUser()
+
+    /**
+     * Add user to the storage container
+     *
+     * @access public
+     * @param  string Username
+     * @param  string Password
+     * @param  mixed  Additional information that are stored in the DB
+     *
+     * @return mixed True on success, otherwise error object
+     */
+    function addUser($username, $password, $additional = "")
+    {
+
+        // Prepare for a database query
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        if (isset($this->options['cryptType']) && $this->options['cryptType'] == 'none') {
+            $cryptFunction = 'strval';
+        } elseif (isset($this->options['cryptType']) && function_exists($this->options['cryptType'])) {
+            $cryptFunction = $this->options['cryptType'];
+        } else {
+            $cryptFunction = 'md5';
+        }
+
+        $password = $cryptFunction($password);
+
+        $additional_key   = '';
+        $additional_value = '';
+
+        if (is_array($additional)) {
+            foreach ($additional as $key => $value) {
+                if ($this->options['auto_quote']) {
+                    $additional_key   .= ', ' . $this->db->quoteIdentifier($key, true);
+                } else {
+                    $additional_key   .= ', ' . $key;
+                }
+                $additional_value .= ', ' . $this->db->quote($value, 'text');
+            }
+        }
+
+        $query = sprintf("INSERT INTO %s (%s, %s%s) VALUES (%s, %s%s)",
+                         $this->options['final_table'],
+                         $this->options['final_usernamecol'],
+                         $this->options['final_passwordcol'],
+                         $additional_key,
+                         $this->db->quote($username, 'text'),
+                         $this->db->quote($password, 'text'),
+                         $additional_value
+                         );
+
+        $res = $this->query($query);
+
+        if (MDB2::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->code);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ removeUser()
+
+    /**
+     * Remove user from the storage container
+     *
+     * @access public
+     * @param  string Username
+     *
+     * @return mixed True on success, otherwise error object
+     */
+    function removeUser($username)
+    {
+        // Prepare for a database query
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        $query = sprintf("DELETE FROM %s WHERE %s = %s",
+                         $this->options['final_table'],
+                         $this->options['final_usernamecol'],
+                         $this->db->quote($username, 'text')
+                         );
+
+        $res = $this->query($query);
+
+        if (MDB2::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->code);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ changePassword()
+
+    /**
+     * Change password for user in the storage container
+     *
+     * @param string Username
+     * @param string The new password (plain text)
+     */
+    function changePassword($username, $password)
+    {
+        // Prepare for a database query
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        if (isset($this->options['cryptType']) && $this->options['cryptType'] == 'none') {
+            $cryptFunction = 'strval';
+        } elseif (isset($this->options['cryptType']) && function_exists($this->options['cryptType'])) {
+            $cryptFunction = $this->options['cryptType'];
+        } else {
+            $cryptFunction = 'md5';
+        }
+
+        $password = $cryptFunction($password);
+
+        $query = sprintf("UPDATE %s SET %s = %s WHERE %s = %s",
+                         $this->options['final_table'],
+                         $this->options['final_passwordcol'],
+                         $this->db->quote($password, 'text'),
+                         $this->options['final_usernamecol'],
+                         $this->db->quote($username, 'text')
+                         );
+
+        $res = $this->query($query);
+
+        if (MDB2::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->code);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ supportsChallengeResponse()
+
+    /**
+     * Determine if this container supports
+     * password authentication with challenge response
+     *
+     * @return bool
+     * @access public
+     */
+    function supportsChallengeResponse()
+    {
+        return in_array($this->options['cryptType'], array('md5', 'none', ''));
+    }
+
+    // }}}
+    // {{{ getCryptType()
+
+    /**
+     * Returns the selected crypt type for this container
+     *
+     * @return string Function used to crypt the password
+     */
+    function getCryptType()
+    {
+        return $this->options['cryptType'];
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/DB.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/DB.php	(revision 10045)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/DB.php	(revision 10045)
@@ -0,0 +1,579 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against PEAR DB
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+$include_dir = realpath(dirname( __FILE__));
+require_once $include_dir . '/../Container.php';
+/**
+ * Include PEAR DB
+ */
+require_once 'DB.php';
+
+/**
+ * Storage driver for fetching login data from a database
+ *
+ * This storage driver can use all databases which are supported
+ * by the PEAR DB abstraction layer to fetch login data.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ */
+class Auth_Container_DB extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Additional options for the storage container
+     * @var array
+     */
+    var $options = array();
+
+    /**
+     * DB object
+     * @var object
+     */
+    var $db = null;
+    var $dsn = '';
+
+    /**
+     * User that is currently selected from the DB.
+     * @var string
+     */
+    var $activeUser = '';
+
+    // }}}
+    // {{{ Auth_Container_DB [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * Save the initial options passed to the container. Initiation of the DB
+     * connection is no longer performed here and is only done when needed.
+     *
+     * @param  string Connection data or DB object
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_DB($dsn)
+    {
+        $this->_setDefaults();
+
+        if (is_array($dsn)) {
+            $this->_parseOptions($dsn);
+
+            if (empty($this->options['dsn'])) {
+                PEAR::raiseError('No connection parameters specified!');
+            }
+        } else {
+            $this->options['dsn'] = $dsn;
+        }
+    }
+
+    // }}}
+    // {{{ _connect()
+
+    /**
+     * Connect to database by using the given DSN string
+     *
+     * @access private
+     * @param  string DSN string
+     * @return mixed  Object on error, otherwise bool
+     */
+    function _connect($dsn)
+    {
+        if (is_string($dsn) || is_array($dsn)) {
+            $this->db = DB::Connect($dsn, $this->options['db_options']);
+        } elseif (is_subclass_of($dsn, 'db_common')) {
+            $this->db = $dsn;
+        } elseif (DB::isError($dsn)) {
+            return PEAR::raiseError($dsn->getMessage(), $dsn->getCode());
+        } else {
+            return PEAR::raiseError('The given dsn was not valid in file ' . __FILE__ . ' at line ' . __LINE__,
+                                    41,
+                                    PEAR_ERROR_RETURN,
+                                    null,
+                                    null
+                                    );
+        }
+
+        if (DB::isError($this->db) || PEAR::isError($this->db)) {
+            return PEAR::raiseError($this->db->getMessage(), $this->db->getCode());
+        } else {
+            return true;
+        }
+    }
+
+    // }}}
+    // {{{ _prepare()
+
+    /**
+     * Prepare database connection
+     *
+     * This function checks if we have already opened a connection to
+     * the database. If that's not the case, a new connection is opened.
+     *
+     * @access private
+     * @return mixed True or a DB error object.
+     */
+    function _prepare()
+    {
+        if (!DB::isConnection($this->db)) {
+            $res = $this->_connect($this->options['dsn']);
+            if (DB::isError($res) || PEAR::isError($res)) {
+                return $res;
+            }
+        }
+        if ($this->options['auto_quote'] && $this->db->dsn['phptype'] != 'sqlite') {
+            $this->options['final_table'] = $this->db->quoteIdentifier($this->options['table']);
+            $this->options['final_usernamecol'] = $this->db->quoteIdentifier($this->options['usernamecol']);
+            $this->options['final_passwordcol'] = $this->db->quoteIdentifier($this->options['passwordcol']);
+        } else {
+            $this->options['final_table'] = $this->options['table'];
+            $this->options['final_usernamecol'] = $this->options['usernamecol'];
+            $this->options['final_passwordcol'] = $this->options['passwordcol'];
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ query()
+
+    /**
+     * Prepare query to the database
+     *
+     * This function checks if we have already opened a connection to
+     * the database. If that's not the case, a new connection is opened.
+     * After that the query is passed to the database.
+     *
+     * @access public
+     * @param  string Query string
+     * @return mixed  a DB_result object or DB_OK on success, a DB
+     *                or PEAR error on failure
+     */
+    function query($query)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return $err;
+        }
+        return $this->db->query($query);
+    }
+
+    // }}}
+    // {{{ _setDefaults()
+
+    /**
+     * Set some default options
+     *
+     * @access private
+     * @return void
+     */
+    function _setDefaults()
+    {
+        $this->options['table']       = 'auth';
+        $this->options['usernamecol'] = 'username';
+        $this->options['passwordcol'] = 'password';
+        $this->options['dsn']         = '';
+        $this->options['db_fields']   = '';
+        $this->options['cryptType']   = 'md5';
+        $this->options['db_options']  = array();
+        $this->options['auto_quote']  = true;
+    }
+
+    // }}}
+    // {{{ _parseOptions()
+
+    /**
+     * Parse options passed to the container class
+     *
+     * @access private
+     * @param  array
+     */
+    function _parseOptions($array)
+    {
+        foreach ($array as $key => $value) {
+            if (isset($this->options[$key])) {
+                $this->options[$key] = $value;
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _quoteDBFields()
+
+    /**
+     * Quote the db_fields option to avoid the possibility of SQL injection.
+     *
+     * @access private
+     * @return string A properly quoted string that can be concatenated into a
+     * SELECT clause.
+     */
+    function _quoteDBFields()
+    {
+        if (isset($this->options['db_fields'])) {
+            if (is_array($this->options['db_fields'])) {
+                if ($this->options['auto_quote']) {
+                    $fields = array();
+                    foreach ($this->options['db_fields'] as $field) {
+                        $fields[] = $this->db->quoteIdentifier($field);
+                    }
+                    return implode(', ', $fields);
+                } else {
+                    return implode(', ', $this->options['db_fields']);
+                }
+            } else {
+                if (strlen($this->options['db_fields']) > 0) {
+                    if ($this->options['auto_quote']) {
+                        return $this->db->quoteIdentifier($this->options['db_fields']);
+                    } else {
+                        return $this->options['db_fields'];
+                    }
+                }
+            }
+        }
+
+        return '';
+    }
+    
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Get user information from database
+     *
+     * This function uses the given username to fetch
+     * the corresponding login data from the database
+     * table. If an account that matches the passed username
+     * and password is found, the function returns true.
+     * Otherwise it returns false.
+     *
+     * @param   string Username
+     * @param   string Password
+     * @param   boolean If true password is secured using a md5 hash
+     *                  the frontend and auth are responsible for making sure the container supports
+     *                  challenge response password authentication
+     * @return  mixed  Error object or boolean
+     */
+    function fetchData($username, $password, $isChallengeResponse=false)
+    {
+        // Prepare for a database query
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        // Find if db_fields contains a *, if so assume all columns are selected
+        if (is_string($this->options['db_fields'])
+            && strstr($this->options['db_fields'], '*')) {
+            $sql_from = "*";
+        } else {
+            $sql_from = $this->options['final_usernamecol'].
+                ", ".$this->options['final_passwordcol'];
+
+            if (strlen($fields = $this->_quoteDBFields()) > 0) {
+                $sql_from .= ', '.$fields;
+            }
+        }
+
+        $query = "SELECT ".$sql_from.
+                " FROM ".$this->options['final_table'].
+                " WHERE ".$this->options['final_usernamecol']." = ".$this->db->quoteSmart($username);
+
+        $res = $this->db->getRow($query, null, DB_FETCHMODE_ASSOC);
+
+        if (DB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        }
+
+        if (!is_array($res)) {
+            $this->activeUser = '';
+            return false;
+        }
+
+        // Perform trimming here before the hashihg
+        $password = trim($password, "\r\n");
+        $res[$this->options['passwordcol']] = trim($res[$this->options['passwordcol']], "\r\n");
+
+        // If using Challenge Response md5 the pass with the secret
+        if ($isChallengeResponse) {
+            $res[$this->options['passwordcol']] = md5($res[$this->options['passwordcol']]
+                    .$this->_auth_obj->session['loginchallenege']);
+            
+            // UGLY cannot avoid without modifying verifyPassword
+            if ($this->options['cryptType'] == 'md5') {
+                $res[$this->options['passwordcol']] = md5($res[$this->options['passwordcol']]);
+            }
+            
+            //print " Hashed Password [{$res[$this->options['passwordcol']]}]<br/>\n";
+        }
+
+        if ($this->verifyPassword($password,
+                                  $res[$this->options['passwordcol']],
+                                  $this->options['cryptType'])) {
+            // Store additional field values in the session
+            foreach ($res as $key => $value) {
+                if ($key == $this->options['passwordcol'] ||
+                    $key == $this->options['usernamecol']) {
+                    continue;
+                }
+                // Use reference to the auth object if exists
+                // This is because the auth session variable can change so a 
+                // static call to setAuthData does not make sence
+                $this->_auth_obj->setAuthData($key, $value);
+            }
+            return true;
+        }
+        $this->activeUser = $res[$this->options['usernamecol']];
+        return false;
+    }
+
+    // }}}
+    // {{{ listUsers()
+
+    /**
+     * Returns a list of users from the container
+     *
+     * @return mixed
+     * @access public
+     */
+    function listUsers()
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        $retVal = array();
+
+        // Find if db_fields contains a *, if so assume all col are selected
+        if (   is_string($this->options['db_fields'])
+            && strstr($this->options['db_fields'], '*')) {
+            $sql_from = "*";
+        } else {
+            $sql_from = $this->options['final_usernamecol'].
+                ", ".$this->options['final_passwordcol'];
+
+            if (strlen($fields = $this->_quoteDBFields()) > 0) {
+                $sql_from .= ', '.$fields;
+            }
+        }
+
+        $query = sprintf("SELECT %s FROM %s",
+                         $sql_from,
+                         $this->options['final_table']
+                         );
+        $res = $this->db->getAll($query, null, DB_FETCHMODE_ASSOC);
+
+        if (DB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        } else {
+            foreach ($res as $user) {
+                $user['username'] = $user[$this->options['usernamecol']];
+                $retVal[] = $user;
+            }
+        }
+        return $retVal;
+    }
+
+    // }}}
+    // {{{ addUser()
+
+    /**
+     * Add user to the storage container
+     *
+     * @access public
+     * @param  string Username
+     * @param  string Password
+     * @param  mixed  Additional information that are stored in the DB
+     *
+     * @return mixed True on success, otherwise error object
+     */
+    function addUser($username, $password, $additional = "")
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        if (   isset($this->options['cryptType']) 
+            && $this->options['cryptType'] == 'none') {
+            $cryptFunction = 'strval';
+        } elseif (   isset($this->options['cryptType']) 
+                  && function_exists($this->options['cryptType'])) {
+            $cryptFunction = $this->options['cryptType'];
+        } else {
+            $cryptFunction = 'md5';
+        }
+
+        $password = $cryptFunction($password);
+
+        $additional_key   = '';
+        $additional_value = '';
+
+        if (is_array($additional)) {
+            foreach ($additional as $key => $value) {
+                if ($this->options['auto_quote']) {
+                    $additional_key .= ', ' . $this->db->quoteIdentifier($key);
+                } else {
+                    $additional_key .= ', ' . $key;
+                }
+                $additional_value .= ", " . $this->db->quoteSmart($value);
+            }
+        }
+
+        $query = sprintf("INSERT INTO %s (%s, %s%s) VALUES (%s, %s%s)",
+                         $this->options['final_table'],
+                         $this->options['final_usernamecol'],
+                         $this->options['final_passwordcol'],
+                         $additional_key,
+                         $this->db->quoteSmart($username),
+                         $this->db->quoteSmart($password),
+                         $additional_value
+                         );
+
+        $res = $this->query($query);
+
+        if (DB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        } else {
+            return true;
+        }
+    }
+
+    // }}}
+    // {{{ removeUser()
+
+    /**
+     * Remove user from the storage container
+     *
+     * @access public
+     * @param  string Username
+     *
+     * @return mixed True on success, otherwise error object
+     */
+    function removeUser($username)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        $query = sprintf("DELETE FROM %s WHERE %s = %s",
+                         $this->options['final_table'],
+                         $this->options['final_usernamecol'],
+                         $this->db->quoteSmart($username)
+                         );
+
+        $res = $this->query($query);
+
+        if (DB::isError($res)) {
+           return PEAR::raiseError($res->getMessage(), $res->getCode());
+        } else {
+          return true;
+        }
+    }
+
+    // }}}
+    // {{{ changePassword()
+
+    /**
+     * Change password for user in the storage container
+     *
+     * @param string Username
+     * @param string The new password (plain text)
+     */
+    function changePassword($username, $password)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        if (   isset($this->options['cryptType']) 
+            && $this->options['cryptType'] == 'none') {
+            $cryptFunction = 'strval';
+        } elseif (   isset($this->options['cryptType']) 
+                  && function_exists($this->options['cryptType'])) {
+            $cryptFunction = $this->options['cryptType'];
+        } else {
+            $cryptFunction = 'md5';
+        }
+
+        $password = $cryptFunction($password);
+
+        $query = sprintf("UPDATE %s SET %s = %s WHERE %s = %s",
+                         $this->options['final_table'],
+                         $this->options['final_passwordcol'],
+                         $this->db->quoteSmart($password),
+                         $this->options['final_usernamecol'],
+                         $this->db->quoteSmart($username)
+                         );
+
+        $res = $this->query($query);
+
+        if (DB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        } else {
+            return true;
+        }
+    }
+
+    // }}}
+    // {{{ supportsChallengeResponse()
+
+    /**
+     * Determine if this container supports
+     * password authentication with challenge response
+     *
+     * @return bool
+     * @access public
+     */
+    function supportsChallengeResponse()
+    {
+        return in_array($this->options['cryptType'], array('md5', 'none', ''));
+    }
+
+    // }}}
+    // {{{ getCryptType()
+
+    /**
+      * Returns the selected crypt type for this container
+      */
+    function getCryptType()
+    {
+        return($this->options['cryptType']);
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/IMAP.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/IMAP.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/IMAP.php	(revision 10038)
@@ -0,0 +1,206 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against IMAP servers
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Jeroen Houben <jeroen@terena.nl> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.2.0
+ */
+
+/**
+ * Include Auth_Container base class 
+ */
+require_once "Auth/Container.php";
+
+/**
+ * Include PEAR class for error handling
+ */
+require_once "PEAR.php";
+
+/**
+ * Storage driver for fetching login data from an IMAP server
+ *
+ * This class is based on LDAP containers, but it very simple.
+ * By default it connects to localhost:143
+ * The constructor will first check if the host:port combination is
+ * actually reachable. This behaviour can be disabled.
+ * It then tries to create an IMAP stream (without opening a mailbox)
+ * If you wish to pass extended options to the connections, you may
+ * do so by specifying protocol options.
+ *
+ * To use this storage containers, you have to use the
+ * following syntax:
+ *
+ * <?php
+ * ...
+ * $params = array(
+ * 'host'       => 'mail.example.com',
+ * 'port'       => 143,
+ * );
+ * $myAuth = new Auth('IMAP', $params);
+ * ...
+ *
+ * By default we connect without any protocol options set. However, some
+ * servers require you to connect with the notls or norsh options set.
+ * To do this you need to add the following value to the params array:
+ * 'baseDSN'   => '/imap/notls/norsh'
+ *
+ * To connect to an SSL IMAP server:
+ * 'baseDSN'   => '/imap/ssl'
+ *
+ * To connect to an SSL IMAP server with a self-signed certificate:
+ * 'baseDSN'   => '/imap/ssl/novalidate-cert'
+ *
+ * Further options may be available and can be found on the php site at
+ * http://www.php.net/manual/function.imap-open.php
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Jeroen Houben <jeroen@terena.nl>
+ * @author     Cipriano Groenendal <cipri@campai.nl>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.2.0
+ */
+class Auth_Container_IMAP extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Options for the class
+     * @var array
+     */
+    var $options = array();
+
+    // }}}
+    // {{{ Auth_Container_IMAP() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * @param  $params  associative array with host, port, baseDSN, checkServer
+     *                  and userattr key
+     * @return object Returns an error object if something went wrong
+     * @todo Use PEAR Net_IMAP if IMAP extension not loaded
+     */
+    function Auth_Container_IMAP($params)
+    {
+        if (!extension_loaded('imap')) {
+            return PEAR::raiseError('Cannot use IMAP authentication, '
+                    .'IMAP extension not loaded!', 41, PEAR_ERROR_DIE);
+        }
+        $this->_setDefaults();
+
+        // set parameters (if any)
+        if (is_array($params)) {
+            $this->_parseOptions($params);
+        }
+
+        if ($this->options['checkServer']) {
+            $this->_checkServer($this->options['timeout']);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ _setDefaults()
+
+    /**
+     * Set some default options
+     *
+     * @access private
+     */
+    function _setDefaults()
+    {
+        $this->options['host'] = 'localhost';
+        $this->options['port'] = 143;
+        $this->options['baseDSN'] = '';
+        $this->options['checkServer'] = true;
+        $this->options['timeout'] = 20;
+    }
+
+    // }}}
+    // {{{ _checkServer()
+
+    /**
+     * Check if the given server and port are reachable
+     *
+     * @access private
+     */
+    function _checkServer() {
+        $fp = @fsockopen ($this->options['host'], $this->options['port'],
+                          $errno, $errstr, $this->options['timeout']);
+        if (is_resource($fp)) {
+            @fclose($fp);
+        } else {
+            $message = "Error connecting to IMAP server "
+                . $this->options['host']
+                . ":" . $this->options['port'];
+            return PEAR::raiseError($message, 41);
+        }
+    }
+
+    // }}}
+    // {{{ _parseOptions()
+
+    /**
+     * Parse options passed to the container class
+     *
+     * @access private
+     * @param  array
+     */
+    function _parseOptions($array)
+    {
+        foreach ($array as $key => $value) {
+            $this->options[$key] = $value;
+        }
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Try to open a IMAP stream using $username / $password
+     *
+     * @param  string Username
+     * @param  string Password
+     * @return boolean
+     */
+    function fetchData($username, $password)
+    {
+        $dsn = '{'.$this->options['host'].':'.$this->options['port'].$this->options['baseDSN'].'}';
+        $conn = @imap_open ($dsn, $username, $password, OP_HALFOPEN);
+        if (is_resource($conn)) {
+            $this->activeUser = $username;
+            @imap_close($conn);
+            return true;
+        } else {
+            $this->activeUser = '';
+            return false;
+        }
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/PEAR.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/PEAR.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/PEAR.php	(revision 10038)
@@ -0,0 +1,103 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against PEAR website
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.3.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once 'Auth/Container.php';
+/**
+ * Include PEAR XML_RPC
+ */
+require_once 'XML/RPC.php';
+
+/**
+ * Storage driver for authenticating against PEAR website
+ *
+ * This driver provides a method for authenticating against the pear.php.net
+ * authentication system.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.3.0
+ */
+class Auth_Container_Pear extends Auth_Container
+{
+
+    // {{{ Auth_Container_Pear() [constructor]
+
+    /**
+     * Constructor
+     *
+     * Currently does nothing
+     * 
+     * @return void
+     */
+    function Auth_Container_Pear()
+    {
+    
+    }
+
+    // }}}
+    // {{{ fetchData()
+    
+    /**
+     * Get user information from pear.php.net
+     *
+     * This function uses the given username and password to authenticate
+     * against the pear.php.net website
+     *
+     * @param string    Username
+     * @param string    Password
+     * @return mixed    Error object or boolean
+     */
+    function fetchData($username, $password)
+    {
+        $rpc = new XML_RPC_Client('/xmlrpc.php', 'pear.php.net');
+        $rpc_message = new XML_RPC_Message("user.info", array(new XML_RPC_Value($username, "string")) );
+        
+        // Error Checking howto ???
+        $result = $rpc->send($rpc_message);
+        $value = $result->value();
+        $userinfo = xml_rpc_decode($value);
+        if ($userinfo['password'] == md5($password)) {
+            $this->activeUser = $userinfo['handle'];
+            foreach ($userinfo as $uk=>$uv) {
+                $this->_auth_obj->setAuthData($uk, $uv);
+            }
+            return true;
+        }
+        return false;
+    }
+
+    // }}}
+    
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/RADIUS.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/RADIUS.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/RADIUS.php	(revision 10038)
@@ -0,0 +1,180 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against RADIUS servers
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Michael Bretterklieber <michael@bretterklieber.com> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.2.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once "Auth/Container.php";
+/**
+ * Include PEAR Auth_RADIUS package
+ */
+require_once "Auth/RADIUS.php";
+
+/**
+ * Storage driver for authenticating users against RADIUS servers.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Michael Bretterklieber <michael@bretterklieber.com>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.2.0
+ */
+class Auth_Container_RADIUS extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Contains a RADIUS object
+     * @var object
+     */
+    var $radius;
+    
+    /**
+     * Contains the authentication type
+     * @var string
+     */
+    var $authtype;    
+
+    // }}}
+    // {{{ Auth_Container_RADIUS() [constructor]
+
+    /**
+     * Constructor of the container class.
+     *
+     * $options can have these keys:
+     * 'servers'    an array containing an array: servername, port,
+     *              sharedsecret, timeout, maxtries
+     * 'configfile' The filename of the configuration file
+     * 'authtype'   The type of authentication, one of: PAP, CHAP_MD5,
+     *              MSCHAPv1, MSCHAPv2, default is PAP
+     *
+     * @param  $options associative array
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_RADIUS($options)
+    {
+        $this->authtype = 'PAP';
+        if (isset($options['authtype'])) {
+            $this->authtype = $options['authtype'];
+        }
+        $classname = 'Auth_RADIUS_' . $this->authtype;
+        if (!class_exists($classname)) {
+            PEAR::raiseError("Unknown Authtype, please use one of: "
+                    ."PAP, CHAP_MD5, MSCHAPv1, MSCHAPv2!", 41, PEAR_ERROR_DIE);
+        }
+        
+        $this->radius = new $classname;
+
+        if (isset($options['configfile'])) {
+            $this->radius->setConfigfile($options['configfile']);
+        }
+
+        $servers = $options['servers'];
+        if (is_array($servers)) {
+            foreach ($servers as $server) {
+                $servername     = $server[0];
+                $port           = isset($server[1]) ? $server[1] : 0;
+                $sharedsecret   = isset($server[2]) ? $server[2] : 'testing123';
+                $timeout        = isset($server[3]) ? $server[3] : 3;
+                $maxtries       = isset($server[4]) ? $server[4] : 3;
+                $this->radius->addServer($servername, $port, $sharedsecret, $timeout, $maxtries);
+            }
+        }
+        
+        if (!$this->radius->start()) {
+            PEAR::raiseError($this->radius->getError(), 41, PEAR_ERROR_DIE);
+        }
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Authenticate
+     *
+     * @param  string Username
+     * @param  string Password
+     * @return bool   true on success, false on reject
+     */
+    function fetchData($username, $password, $challenge = null)
+    {
+        switch($this->authtype) {
+        case 'CHAP_MD5':
+        case 'MSCHAPv1':
+            if (isset($challenge)) {
+                $this->radius->challenge = $challenge;
+                $this->radius->chapid    = 1;
+                $this->radius->response  = pack('H*', $password);
+            } else {
+                require_once 'Crypt/CHAP.php';
+                $classname = 'Crypt_' . $this->authtype;
+                $crpt = new $classname;
+                $crpt->password = $password;
+                $this->radius->challenge = $crpt->challenge;
+                $this->radius->chapid    = $crpt->chapid;
+                $this->radius->response  = $crpt->challengeResponse();
+                break;
+            }
+
+        case 'MSCHAPv2':
+            require_once 'Crypt/CHAP.php';
+            $crpt = new Crypt_MSCHAPv2;
+            $crpt->username = $username;
+            $crpt->password = $password;
+            $this->radius->challenge     = $crpt->authChallenge;
+            $this->radius->peerChallenge = $crpt->peerChallenge;
+            $this->radius->chapid        = $crpt->chapid;
+            $this->radius->response      = $crpt->challengeResponse();
+            break;
+
+        default:
+            $this->radius->password = $password;
+            break;
+        }
+
+        $this->radius->username = $username;
+
+        $this->radius->putAuthAttributes();
+        $result = $this->radius->send();
+        if (PEAR::isError($result)) {
+            return false;
+        }
+
+        $this->radius->getAttributes();
+//      just for debugging
+//      $this->radius->dumpAttributes();
+
+        return $result;
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/SOAP5.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/SOAP5.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/SOAP5.php	(revision 10038)
@@ -0,0 +1,267 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against a SOAP service using PHP5 SoapClient
+ *
+ * PHP version 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Based upon Auth_Container_SOAP by Bruno Pedro <bpedro@co.sapo.pt>
+ * @author     Marcel Oelke <puRe@rednoize.com>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @since      File available since Release 1.4.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once "Auth/Container.php";
+/**
+ * Include PEAR package for error handling
+ */
+require_once "PEAR.php";
+
+/**
+ * Storage driver for fetching login data from SOAP using the PHP5 Builtin SOAP
+ * functions. This is a modification of the SOAP Storage driver from Bruno Pedro
+ * thats using the PEAR SOAP Package.
+ *
+ * This class takes one parameter (options), where
+ * you specify the following fields: 
+ *  * location and uri, or wsdl file
+ *  * method to call on the SOAP service
+ *  * usernamefield, the name of the parameter where the username is supplied
+ *  * passwordfield, the name of the parameter where the password is supplied
+ *  * matchpassword, whether to look for the password in the response from
+ *                   the function call or assume that no errors means user
+ *                   authenticated.
+ *
+ * See http://www.php.net/manual/en/ref.soap.php for further details
+ * on options for the PHP5 SoapClient which are passed through.
+ *
+ * Example usage without WSDL:
+ *
+ * <?php
+ *
+ * $options = array (
+ *       'wsdl'           => NULL,
+ *       'location'       => 'http://your.soap.service/endpoint',
+ *       'uri'            => 'urn:/Your/Namespace',
+ *       'method'         => 'checkAuth',        
+ *       'usernamefield'  => 'username',
+ *       'passwordfield'  => 'password',
+ *       'matchpasswords' => false,          
+ *       '_features' => array (
+ *           'extra_parameter'    => 'example_value',
+ *           'another_parameter'  => 'foobar'
+ *       )
+ *   );
+ *
+ * $auth = new Auth('SOAP5', $options);
+ * $auth->start();
+ *
+ * ?>
+ *
+ * Example usage with WSDL:
+ *
+ * <?php
+ *
+ * $options = array (
+ *       'wsdl'           => 'http://your.soap.service/wsdl',
+ *       'method'         => 'checkAuth',        
+ *       'usernamefield'  => 'username',
+ *       'passwordfield'  => 'password',
+ *       'matchpasswords' => false,          
+ *       '_features' => array (
+ *           'extra_parameter'    => 'example_value',
+ *           'another_parameter'  => 'foobar'
+ *       )
+ *   );
+ *
+ * $auth = new Auth('SOAP5', $options);
+ * $auth->start();
+ *
+ * ?>
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Based upon Auth_Container_SOAP by Bruno Pedro <bpedro@co.sapo.pt>
+ * @author     Marcel Oelke <puRe@rednoize.com>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @since      Class available since Release 1.4.0
+ */
+class Auth_Container_SOAP5 extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Required options for the class
+     * @var array
+     * @access private
+     */
+    var $_requiredOptions = array(
+            'location', 
+            'uri',
+            'method',
+            'usernamefield',
+            'passwordfield',
+            'wsdl',
+            );
+
+    /**
+     * Options for the class
+     * @var array
+     * @access private
+     */
+    var $_options = array();
+
+    /**
+     * Optional SOAP features
+     * @var array
+     * @access private
+     */
+    var $_features = array();
+
+    /**
+     * The SOAP response
+     * @var array
+     * @access public
+     */
+    var $soapResponse = array();
+     
+    // }}}
+    // {{{ Auth_Container_SOAP5()
+
+    /**
+     * Constructor of the container class
+     *
+     * @param  $options, associative array with endpoint, namespace, method,
+     *                   usernamefield, passwordfield and optional features
+     */
+    function Auth_Container_SOAP5($options)
+    {
+        $this->_setDefaults();
+
+        foreach ($options as $name => $value) {
+            $this->_options[$name] = $value;
+        }
+
+        if (!empty($this->_options['_features'])) {
+            $this->_features = $this->_options['_features'];
+            unset($this->_options['_features']);
+        }        
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Fetch data from SOAP service
+     *
+     * Requests the SOAP service for the given username/password
+     * combination.
+     *
+     * @param  string Username
+     * @param  string Password
+     * @return mixed Returns the SOAP response or false if something went wrong
+     */
+    function fetchData($username, $password)
+    {        
+        $result = $this->_validateOptions();
+        if (PEAR::isError($result))
+            return $result;
+
+        // create a SOAP client
+        $soapClient = new SoapClient($this->_options["wsdl"], $this->_options);
+        
+        $params = array();        
+        // first, assign the optional features
+        foreach ($this->_features as $fieldName => $fieldValue) {
+            $params[$fieldName] = $fieldValue;
+        }
+        // assign username and password ...
+        $params[$this->_options['usernamefield']] = $username;
+        $params[$this->_options['passwordfield']] = $password;                
+                
+        try {
+            $this->soapResponse = $soapClient->__soapCall($this->_options['method'], $params);
+                        
+            if ($this->_options['matchpasswords']) {
+                // check if passwords match
+                if ($password == $this->soapResponse[$this->_options['passwordfield']]) {
+                    return true;
+                } else {
+                    return false;
+                }
+            } else {                
+                return true;
+            }
+        } catch (SoapFault $e) {
+            return PEAR::raiseError("Error retrieving authentication data. Received SOAP Fault: ".$e->faultstring, $e->faultcode);
+        }        
+    }
+
+    // }}}
+    // {{{ _validateOptions()
+    
+    /**
+     * Validate that the options passed to the container class are enough for us to proceed
+     *
+     * @access private
+     * @param  array
+     */
+    function _validateOptions($array)
+    {
+        if (   (   is_null($this->options['wsdl'])
+                && is_null($this->options['location'])
+                && is_null($this->options['uri']))
+            || (   is_null($this->options['wsdl'])
+                && (   is_null($this->options['location'])
+                    || is_null($this->options['uri'])))) {
+            return PEAR::raiseError('Either a WSDL file or a location/uri pair must be specified.');
+        }
+        if (is_null($this->options['method'])) {
+            return PEAR::raiseError('A method to call on the soap service must be specified.');
+        }
+        return true;
+    }
+    
+    // }}}
+    // {{{ _setDefaults()
+
+    /**
+     * Set some default options
+     *
+     * @access private
+     * @return void
+     */
+    function _setDefaults()
+    {
+        $this->options['wsdl']           = null;
+        $this->options['location']       = null;
+        $this->options['uri']            = null;
+        $this->options['method']         = null;
+        $this->options['usernamefield']  = 'username';
+        $this->options['passwordfield']  = 'password';
+        $this->options['matchpasswords'] = true;
+    }
+
+    // }}}
+        
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/vpopmail.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/vpopmail.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/vpopmail.php	(revision 10038)
@@ -0,0 +1,87 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against vpopmail setups
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Stanislav Grozev <tacho@orbitel.bg> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.2.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once "Auth/Container.php";
+/**
+ * Include PEAR package for error handling
+ */
+require_once "PEAR.php";
+
+/**
+ * Storage driver for fetching login data from vpopmail
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Stanislav Grozev <tacho@orbitel.bg>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.2.0
+ */
+class Auth_Container_vpopmail extends Auth_Container {
+
+    // {{{ Constructor
+
+    /**
+     * Constructor of the container class
+     *
+     * @return void
+     */
+    function Auth_Container_vpopmail()
+    {
+        if (!extension_loaded('vpopmail')) {
+            return PEAR::raiseError('Cannot use VPOPMail authentication, '
+                    .'VPOPMail extension not loaded!', 41, PEAR_ERROR_DIE);
+        }
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Get user information from vpopmail
+     *
+     * @param   string Username - has to be valid email address
+     * @param   string Password
+     * @return  boolean
+     */
+    function fetchData($username, $password)
+    {
+        $userdata = array();
+        $userdata = preg_split("/@/", $username, 2);
+        $result = @vpopmail_auth_user($userdata[0], $userdata[1], $password);
+
+        return $result;
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/KADM5.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/KADM5.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/KADM5.php	(revision 10038)
@@ -0,0 +1,170 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for Authentication on a Kerberos V server.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Andrew Teixeira <ateixeira@gmail.com>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.4.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once 'Auth/Container.php';
+/**
+ * Include PEAR for error handling
+ */
+require_once 'PEAR.php';
+
+/**
+ * Storage driver for Authentication on a Kerberos V server.
+ *
+ * Available options:
+ * hostname:        The hostname of the kerberos server
+ * realm:           The Kerberos V realm
+ * timeout:         The timeout for checking the server
+ * checkServer:     Set to true to check if the server is running when
+ *                  constructing the object
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Andrew Teixeira <ateixeira@gmail.com>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.4.0
+ */
+class Auth_Container_KADM5 extends Auth_Container {
+
+    // {{{ properties
+
+    /**
+     * Options for the class
+     * @var string
+     */
+    var $options = array();
+
+    // }}}
+    // {{{ Auth_Container_KADM5()
+
+    /**
+     * Constructor of the container class
+     *
+     * $options can have these keys:
+     * 'hostname'    The hostname of the kerberos server
+     * 'realm'       The Kerberos V realm
+     * 'timeout'     The timeout for checking the server
+     * 'checkServer' Set to true to check if the server is running when
+     *               constructing the object
+     *
+     * @param  $options associative array
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_KADM5($options) {
+        if (!extension_loaded('kadm5')) {
+            return PEAR::raiseError("Cannot use Kerberos V authentication, KADM5 extension not loaded!", 41, PEAR_ERROR_DIE);
+        }
+        
+        $this->_setDefaults();
+        
+        if (isset($options['hostname'])) {
+            $this->options['hostname'] = $options['hostname'];
+        }
+        if (isset($options['realm'])) {
+            $this->options['realm'] = $options['realm'];
+        }
+        if (isset($options['timeout'])) {
+            $this->options['timeout'] = $options['timeout'];
+        }
+        if (isset($options['checkServer'])) {
+            $this->options['checkServer'] = $options['checkServer'];
+        }
+        
+        if ($this->options['checkServer']) {
+            $this->_checkServer();
+        }
+    }
+
+    // }}}
+    // {{{ fetchData()
+    
+    /**
+     * Try to login to the KADM5 server
+     *
+     * @param   string Username
+     * @param   string Password
+     * @return  boolean
+     */
+    function fetchData($username, $password) {
+        if ( ($username == NULL) || ($password == NULL) ) {
+            return false;
+        }
+        
+        $server = $this->options['hostname'];
+        $realm = $this->options['realm'];
+        $check = @kadm5_init_with_password($server, $realm, $username, $password);
+        
+        if ($check == false) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+    
+    // }}}
+    // {{{ _setDefaults()
+    
+    /**
+     * Set some default options
+     *
+     * @access private
+     */
+    function _setDefaults() {
+        $this->options['hostname'] = 'localhost';
+        $this->options['realm'] = NULL;
+        $this->options['timeout'] = 10;
+        $this->options['checkServer'] = false;
+    }
+    
+    // }}}
+    // {{{ _checkServer()
+    
+    /**
+     * Check if the given server and port are reachable
+     *
+     * @access private
+     */
+    function _checkServer() {
+        $fp = @fsockopen ($this->options['host'], 88, $errno, $errstr, $this->options['timeout']);
+        if (is_resource($fp)) {
+            @fclose($fp);
+        } else {
+            $message = "Error connecting to Kerberos V server "
+                .$this->options['host'].":".$this->options['port'];
+            return PEAR::raiseError($message, 41, PEAR_ERROR_DIE);
+        }
+    }
+    
+    // }}}
+
+}
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/MDB.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/MDB.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/MDB.php	(revision 10038)
@@ -0,0 +1,573 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against PEAR MDB
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Lorenzo Alberton <l.alberton@quipo.it> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.2.3
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once 'Auth/Container.php';
+/**
+ * Include PEAR MDB package
+ */
+require_once 'MDB.php';
+
+/**
+ * Storage driver for fetching login data from a database
+ *
+ * This storage driver can use all databases which are supported
+ * by the PEAR MDB abstraction layer to fetch login data.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Lorenzo Alberton <l.alberton@quipo.it>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.2.3
+ */
+class Auth_Container_MDB extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Additional options for the storage container
+     * @var array
+     */
+    var $options = array();
+
+    /**
+     * MDB object
+     * @var object
+     */
+    var $db = null;
+    var $dsn = '';
+
+    /**
+     * User that is currently selected from the DB.
+     * @var string
+     */
+    var $activeUser = '';
+
+    // }}}
+    // {{{ Auth_Container_MDB() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * Initate connection to the database via PEAR::MDB
+     *
+     * @param  string Connection data or MDB object
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_MDB($dsn)
+    {
+        $this->_setDefaults();
+
+        if (is_array($dsn)) {
+            $this->_parseOptions($dsn);
+            if (empty($this->options['dsn'])) {
+                PEAR::raiseError('No connection parameters specified!');
+            }
+        } else {
+            $this->options['dsn'] = $dsn;
+        }
+    }
+
+    // }}}
+    // {{{ _connect()
+
+    /**
+     * Connect to database by using the given DSN string
+     *
+     * @access private
+     * @param  mixed DSN string | array | mdb object
+     * @return mixed  Object on error, otherwise bool
+     */
+    function _connect($dsn)
+    {
+        if (is_string($dsn) || is_array($dsn)) {
+            $this->db =& MDB::connect($dsn, $this->options['db_options']);
+        } elseif (is_subclass_of($dsn, 'mdb_common')) {
+            $this->db = $dsn;
+        } elseif (is_object($dsn) && MDB::isError($dsn)) {
+            return PEAR::raiseError($dsn->getMessage(), $dsn->code);
+        } else {
+            return PEAR::raiseError('The given dsn was not valid in file ' . __FILE__ . ' at line ' . __LINE__,
+                                    41,
+                                    PEAR_ERROR_RETURN,
+                                    null,
+                                    null
+                                    );
+
+        }
+
+        if (MDB::isError($this->db) || PEAR::isError($this->db)) {
+            return PEAR::raiseError($this->db->getMessage(), $this->db->code);
+        }
+
+        if ($this->options['auto_quote']) {
+            $this->options['final_table'] = $this->db->quoteIdentifier($this->options['table']);
+            $this->options['final_usernamecol'] = $this->db->quoteIdentifier($this->options['usernamecol']);
+            $this->options['final_passwordcol'] = $this->db->quoteIdentifier($this->options['passwordcol']);
+        } else {
+            $this->options['final_table'] = $this->options['table'];
+            $this->options['final_usernamecol'] = $this->options['usernamecol'];
+            $this->options['final_passwordcol'] = $this->options['passwordcol'];
+        }
+
+        return true;
+    }
+
+    // }}}
+    // {{{ _prepare()
+
+    /**
+     * Prepare database connection
+     *
+     * This function checks if we have already opened a connection to
+     * the database. If that's not the case, a new connection is opened.
+     *
+     * @access private
+     * @return mixed True or a MDB error object.
+     */
+    function _prepare()
+    {
+        if (is_subclass_of($this->db, 'mdb_common')) {
+            return true;
+        }
+        return $this->_connect($this->options['dsn']);
+    }
+
+    // }}}
+    // {{{ query()
+
+    /**
+     * Prepare query to the database
+     *
+     * This function checks if we have already opened a connection to
+     * the database. If that's not the case, a new connection is opened.
+     * After that the query is passed to the database.
+     *
+     * @access public
+     * @param  string Query string
+     * @return mixed  a MDB_result object or MDB_OK on success, a MDB
+     *                or PEAR error on failure
+     */
+    function query($query)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return $err;
+        }
+        return $this->db->query($query);
+    }
+
+    // }}}
+    // {{{ _setDefaults()
+
+    /**
+     * Set some default options
+     *
+     * @access private
+     * @return void
+     */
+    function _setDefaults()
+    {
+        $this->options['table']       = 'auth';
+        $this->options['usernamecol'] = 'username';
+        $this->options['passwordcol'] = 'password';
+        $this->options['dsn']         = '';
+        $this->options['db_fields']   = '';
+        $this->options['cryptType']   = 'md5';
+        $this->options['db_options']  = array();
+        $this->options['auto_quote']  = true;
+    }
+
+    // }}}
+    // {{{ _parseOptions()
+
+    /**
+     * Parse options passed to the container class
+     *
+     * @access private
+     * @param  array
+     */
+    function _parseOptions($array)
+    {
+        foreach ($array as $key => $value) {
+            if (isset($this->options[$key])) {
+                $this->options[$key] = $value;
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _quoteDBFields()
+
+    /**
+     * Quote the db_fields option to avoid the possibility of SQL injection.
+     *
+     * @access private
+     * @return string A properly quoted string that can be concatenated into a
+     * SELECT clause.
+     */
+    function _quoteDBFields()
+    {
+        if (isset($this->options['db_fields'])) {
+            if (is_array($this->options['db_fields'])) {
+                if ($this->options['auto_quote']) {
+                    $fields = array();
+                    foreach ($this->options['db_fields'] as $field) {
+                        $fields[] = $this->db->quoteIdentifier($field);
+                    }
+                    return implode(', ', $fields);
+                } else {
+                    return implode(', ', $this->options['db_fields']);
+                }
+            } else {
+                if (strlen($this->options['db_fields']) > 0) {
+                    if ($this->options['auto_quote']) {
+                        return $this->db->quoteIdentifier($this->options['db_fields']);
+                    } else {
+                        return $this->options['db_fields'];
+                    }
+                }
+            }
+        }
+
+        return '';
+    }
+    
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Get user information from database
+     *
+     * This function uses the given username to fetch
+     * the corresponding login data from the database
+     * table. If an account that matches the passed username
+     * and password is found, the function returns true.
+     * Otherwise it returns false.
+     *
+     * @param   string Username
+     * @param   string Password
+     * @param   boolean If true password is secured using a md5 hash
+     *                  the frontend and auth are responsible for making sure the container supports
+     *                  challenge response password authentication
+     * @return  mixed  Error object or boolean
+     */
+    function fetchData($username, $password, $isChallengeResponse=false)
+    {
+        // Prepare for a database query
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        //Check if db_fields contains a *, if so assume all columns are selected
+        if (is_string($this->options['db_fields'])
+            && strstr($this->options['db_fields'], '*')) {
+            $sql_from = '*';
+        } else {
+            $sql_from = $this->options['final_usernamecol'].
+                ", ".$this->options['final_passwordcol'];
+
+            if (strlen($fields = $this->_quoteDBFields()) > 0) {
+                $sql_from .= ', '.$fields;
+            }
+        }
+
+        $query = sprintf("SELECT %s FROM %s WHERE %s = %s",
+                         $sql_from,
+                         $this->options['final_table'],
+                         $this->options['final_usernamecol'],
+                         $this->db->getTextValue($username)
+                         );
+
+        $res = $this->db->getRow($query, null, null, null, MDB_FETCHMODE_ASSOC);
+
+        if (MDB::isError($res) || PEAR::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        }
+        if (!is_array($res)) {
+            $this->activeUser = '';
+            return false;
+        }
+
+        // Perform trimming here before the hashing
+        $password = trim($password, "\r\n");
+        $res[$this->options['passwordcol']] = trim($res[$this->options['passwordcol']], "\r\n");
+        
+        // If using Challenge Response md5 the pass with the secret
+        if ($isChallengeResponse) {
+            $res[$this->options['passwordcol']] =
+                md5($res[$this->options['passwordcol']].$this->_auth_obj->session['loginchallenege']);
+            // UGLY cannot avoid without modifying verifyPassword
+            if ($this->options['cryptType'] == 'md5') {
+                $res[$this->options['passwordcol']] = md5($res[$this->options['passwordcol']]);
+            }
+        }
+        
+        if ($this->verifyPassword($password,
+                                  $res[$this->options['passwordcol']],
+                                  $this->options['cryptType'])) {
+            // Store additional field values in the session
+            foreach ($res as $key => $value) {
+                if ($key == $this->options['passwordcol'] ||
+                    $key == $this->options['usernamecol']) {
+                    continue;
+                }
+                // Use reference to the auth object if exists
+                // This is because the auth session variable can change so a static
+                // call to setAuthData does not make sense
+                $this->_auth_obj->setAuthData($key, $value);
+            }
+            return true;
+        }
+
+        $this->activeUser = $res[$this->options['usernamecol']];
+        return false;
+    }
+
+    // }}}
+    // {{{ listUsers()
+
+    /**
+     * Returns a list of users from the container
+     *
+     * @return mixed array|PEAR_Error
+     * @access public
+     */
+    function listUsers()
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        $retVal = array();
+
+        //Check if db_fields contains a *, if so assume all columns are selected
+        if (   is_string($this->options['db_fields'])
+            && strstr($this->options['db_fields'], '*')) {
+            $sql_from = '*';
+        } else {
+            $sql_from = $this->options['final_usernamecol']
+                .', '.$this->options['final_passwordcol'];
+            
+            if (strlen($fields = $this->_quoteDBFields()) > 0) {
+                $sql_from .= ', '.$fields;
+            }
+        }
+
+        $query = sprintf('SELECT %s FROM %s',
+                         $sql_from,
+                         $this->options['final_table']
+                         );
+
+        $res = $this->db->getAll($query, null, null, null, MDB_FETCHMODE_ASSOC);
+
+        if (MDB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        } else {
+            foreach ($res as $user) {
+                $user['username'] = $user[$this->options['usernamecol']];
+                $retVal[] = $user;
+            }
+        }
+        return $retVal;
+    }
+
+    // }}}
+    // {{{ addUser()
+
+    /**
+     * Add user to the storage container
+     *
+     * @access public
+     * @param  string Username
+     * @param  string Password
+     * @param  mixed  Additional information that are stored in the DB
+     *
+     * @return mixed True on success, otherwise error object
+     */
+    function addUser($username, $password, $additional = "")
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        if (isset($this->options['cryptType']) && $this->options['cryptType'] == 'none') {
+            $cryptFunction = 'strval';
+        } elseif (isset($this->options['cryptType']) && function_exists($this->options['cryptType'])) {
+            $cryptFunction = $this->options['cryptType'];
+        } else {
+            $cryptFunction = 'md5';
+        }
+
+        $password = $cryptFunction($password);
+
+        $additional_key   = '';
+        $additional_value = '';
+
+        if (is_array($additional)) {
+            foreach ($additional as $key => $value) {
+                if ($this->options['auto_quote']) {
+                    $additional_key   .= ', ' . $this->db->quoteIdentifier($key);
+                } else {
+                    $additional_key   .= ', ' . $key;
+                }
+                $additional_value .= ', ' . $this->db->getTextValue($value);
+            }
+        }
+
+        $query = sprintf("INSERT INTO %s (%s, %s%s) VALUES (%s, %s%s)",
+                         $this->options['final_table'],
+                         $this->options['final_usernamecol'],
+                         $this->options['final_passwordcol'],
+                         $additional_key,
+                         $this->db->getTextValue($username),
+                         $this->db->getTextValue($password),
+                         $additional_value
+                         );
+
+        $res = $this->query($query);
+
+        if (MDB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->code);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ removeUser()
+
+    /**
+     * Remove user from the storage container
+     *
+     * @access public
+     * @param  string Username
+     *
+     * @return mixed True on success, otherwise error object
+     */
+    function removeUser($username)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        $query = sprintf("DELETE FROM %s WHERE %s = %s",
+                         $this->options['final_table'],
+                         $this->options['final_usernamecol'],
+                         $this->db->getTextValue($username)
+                         );
+
+        $res = $this->query($query);
+
+        if (MDB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->code);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ changePassword()
+
+    /**
+     * Change password for user in the storage container
+     *
+     * @param string Username
+     * @param string The new password (plain text)
+     */
+    function changePassword($username, $password)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        if (isset($this->options['cryptType']) && $this->options['cryptType'] == 'none') {
+            $cryptFunction = 'strval';
+        } elseif (isset($this->options['cryptType']) && function_exists($this->options['cryptType'])) {
+            $cryptFunction = $this->options['cryptType'];
+        } else {
+            $cryptFunction = 'md5';
+        }
+
+        $password = $cryptFunction($password);
+
+        $query = sprintf("UPDATE %s SET %s = %s WHERE %s = %s",
+                         $this->options['final_table'],
+                         $this->options['final_passwordcol'],
+                         $this->db->getTextValue($password),
+                         $this->options['final_usernamecol'],
+                         $this->db->getTextValue($username)
+                         );
+
+        $res = $this->query($query);
+
+        if (MDB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->code);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ supportsChallengeResponse()
+
+    /**
+     * Determine if this container supports
+     * password authentication with challenge response
+     *
+     * @return bool
+     * @access public
+     */
+    function supportsChallengeResponse()
+    {
+        return in_array($this->options['cryptType'], array('md5', 'none', ''));
+    }
+
+    // }}}
+    // {{{ getCryptType()
+
+    /**
+     * Returns the selected crypt type for this container
+     *
+     * @return string Function used to crypt the password
+     */
+    function getCryptType()
+    {
+        return $this->options['cryptType'];
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/SOAP.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/SOAP.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/SOAP.php	(revision 10038)
@@ -0,0 +1,228 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against a SOAP service
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Bruno Pedro <bpedro@co.sapo.pt> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.2.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once "Auth/Container.php";
+/**
+ * Include PEAR package for error handling
+ */
+require_once "PEAR.php";
+/**
+ * Include PEAR SOAP_Client
+ */
+require_once 'SOAP/Client.php';
+
+/**
+ * Storage driver for fetching login data from SOAP
+ *
+ * This class takes one parameter (options), where
+ * you specify the following fields: endpoint, namespace,
+ * method, encoding, usernamefield and passwordfield.
+ *
+ * You can use specify features of your SOAP service
+ * by providing its parameters in an associative manner by
+ * using the '_features' array through the options parameter.
+ *
+ * The 'matchpassword' option should be set to false if your
+ * webservice doesn't return (username,password) pairs, but
+ * instead returns error when the login is invalid.
+ *
+ * Example usage:
+ *
+ * <?php
+ *
+ * ...
+ *
+ * $options = array (
+ *             'endpoint' => 'http://your.soap.service/endpoint',
+ *             'namespace' => 'urn:/Your/Namespace',
+ *             'method' => 'get',
+ *             'encoding' => 'UTF-8',
+ *             'usernamefield' => 'login',
+ *             'passwordfield' => 'password',
+ *             'matchpasswords' => false,
+ *             '_features' => array (
+ *                             'example_feature' => 'example_value',
+ *                             'another_example'  => ''
+ *                             )
+ *             );
+ * $auth = new Auth('SOAP', $options, 'loginFunction');
+ * $auth->start();
+ *
+ * ...
+ *
+ * ?>
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Bruno Pedro <bpedro@co.sapo.pt>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.2.0
+ */
+class Auth_Container_SOAP extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Required options for the class
+     * @var array
+     * @access private
+     */
+    var $_requiredOptions = array(
+            'endpoint',
+            'namespace',
+            'method',
+            'encoding',
+            'usernamefield',
+            'passwordfield',
+            );
+
+    /**
+     * Options for the class
+     * @var array
+     * @access private
+     */
+    var $_options = array();
+
+    /**
+     * Optional SOAP features
+     * @var array
+     * @access private
+     */
+    var $_features = array();
+
+    /**
+     * The SOAP response
+     * @var array
+     * @access public
+     */
+     var $soapResponse = array();
+
+    /**
+     * The SOAP client
+     * @var mixed
+     * @access public
+     */
+     var $soapClient = null;
+
+    // }}}
+    // {{{ Auth_Container_SOAP() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * @param  $options, associative array with endpoint, namespace, method,
+     *                   usernamefield, passwordfield and optional features
+     */
+    function Auth_Container_SOAP($options)
+    {
+        $this->_options = $options;
+        if (!isset($this->_options['matchpasswords'])) {
+            $this->_options['matchpasswords'] = true;
+        }
+        if (!empty($this->_options['_features'])) {
+            $this->_features = $this->_options['_features'];
+            unset($this->_options['_features']);
+        }
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Fetch data from SOAP service
+     *
+     * Requests the SOAP service for the given username/password
+     * combination.
+     *
+     * @param  string Username
+     * @param  string Password
+     * @return mixed Returns the SOAP response or false if something went wrong
+     */
+    function fetchData($username, $password)
+    {
+        // check if all required options are set
+        if (array_intersect($this->_requiredOptions, array_keys($this->_options)) != $this->_requiredOptions) {
+            return false;
+        } else {
+            // create a SOAP client and set encoding
+            $this->soapClient = new SOAP_Client($this->_options['endpoint']);
+            $this->soapClient->setEncoding($this->_options['encoding']);
+        }
+
+        // set the trace option if requested
+        if (isset($this->_options['trace'])) {
+            $this->soapClient->__options['trace'] = true;
+        }
+
+        // set the timeout option if requested
+        if (isset($this->_options['timeout'])) {
+            $this->soapClient->__options['timeout'] = $this->_options['timeout'];
+        }
+
+        // assign username and password fields
+        $usernameField = new SOAP_Value($this->_options['usernamefield'],'string', $username);
+        $passwordField = new SOAP_Value($this->_options['passwordfield'],'string', $password);
+        $SOAPParams = array($usernameField, $passwordField);
+
+        // assign optional features
+        foreach ($this->_features as $fieldName => $fieldValue) {
+            $SOAPParams[] = new SOAP_Value($fieldName, 'string', $fieldValue);
+        }
+
+        // make SOAP call
+        $this->soapResponse = $this->soapClient->call(
+                $this->_options['method'],
+                $SOAPParams,
+                array('namespace' => $this->_options['namespace'])
+                );
+
+        if (!PEAR::isError($this->soapResponse)) {
+            if ($this->_options['matchpasswords']) {
+                // check if passwords match
+                if ($password == $this->soapResponse->{$this->_options['passwordfield']}) {
+                    return true;
+                } else {
+                    return false;
+                }
+            } else {
+                return true;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/DBLite.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/DBLite.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/DBLite.php	(revision 10038)
@@ -0,0 +1,298 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Reduced storage driver for use against PEAR DB
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.3.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once 'Auth/Container.php';
+/**
+ * Include PEAR DB package
+ */
+require_once 'DB.php';
+
+/**
+ * A lighter storage driver for fetching login data from a database
+ *
+ * This driver is derived from the DB storage container but
+ * with the user manipulation function removed for smaller file size
+ * by the PEAR DB abstraction layer to fetch login data.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.3.0
+ */
+class Auth_Container_DBLite extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Additional options for the storage container
+     * @var array
+     */
+    var $options = array();
+
+    /**
+     * DB object
+     * @var object
+     */
+    var $db = null;
+    var $dsn = '';
+
+    /**
+     * User that is currently selected from the DB.
+     * @var string
+     */
+    var $activeUser = '';
+
+    // }}}
+    // {{{ Auth_Container_DBLite() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * Initate connection to the database via PEAR::DB
+     *
+     * @param  string Connection data or DB object
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_DBLite($dsn)
+    {
+        $this->options['table']       = 'auth';
+        $this->options['usernamecol'] = 'username';
+        $this->options['passwordcol'] = 'password';
+        $this->options['dsn']         = '';
+        $this->options['db_fields']   = '';
+        $this->options['cryptType']   = 'md5';
+        $this->options['db_options']  = array();
+        $this->options['auto_quote']  = true;
+
+        if (is_array($dsn)) {
+            $this->_parseOptions($dsn);
+            if (empty($this->options['dsn'])) {
+                PEAR::raiseError('No connection parameters specified!');
+            }
+        } else {
+            $this->options['dsn'] = $dsn;
+        }
+    }
+
+    // }}}
+    // {{{ _connect()
+
+    /**
+     * Connect to database by using the given DSN string
+     *
+     * @access private
+     * @param  string DSN string
+     * @return mixed  Object on error, otherwise bool
+     */
+    function _connect(&$dsn)
+    {
+        if (is_string($dsn) || is_array($dsn)) {
+            $this->db =& DB::connect($dsn, $this->options['db_options']);
+        } elseif (is_subclass_of($dsn, "db_common")) {
+            $this->db =& $dsn;
+        } else {
+            return PEAR::raiseError("Invalid dsn or db object given");
+        }
+
+        if (DB::isError($this->db) || PEAR::isError($this->db)) {
+            return PEAR::raiseError($this->db->getMessage(), $this->db->getCode());
+        } else {
+            return true;
+        }
+    }
+
+    // }}}
+    // {{{ _prepare()
+
+    /**
+     * Prepare database connection
+     *
+     * This function checks if we have already opened a connection to
+     * the database. If that's not the case, a new connection is opened.
+     *
+     * @access private
+     * @return mixed True or a DB error object.
+     */
+    function _prepare()
+    {
+        if (!DB::isConnection($this->db)) {
+            $res = $this->_connect($this->options['dsn']);
+            if (DB::isError($res) || PEAR::isError($res)) {
+                return $res;
+            }
+        }
+        if ($this->options['auto_quote'] && $this->db->dsn['phptype'] != 'sqlite') {
+            $this->options['final_table'] = $this->db->quoteIdentifier($this->options['table']);
+            $this->options['final_usernamecol'] = $this->db->quoteIdentifier($this->options['usernamecol']);
+            $this->options['final_passwordcol'] = $this->db->quoteIdentifier($this->options['passwordcol']);
+        } else {
+            $this->options['final_table'] = $this->options['table'];
+            $this->options['final_usernamecol'] = $this->options['usernamecol'];
+            $this->options['final_passwordcol'] = $this->options['passwordcol'];
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ _parseOptions()
+
+    /**
+     * Parse options passed to the container class
+     *
+     * @access private
+     * @param  array
+     */
+    function _parseOptions($array)
+    {
+        foreach ($array as $key => $value) {
+            if (isset($this->options[$key])) {
+                $this->options[$key] = $value;
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _quoteDBFields()
+
+    /**
+     * Quote the db_fields option to avoid the possibility of SQL injection.
+     *
+     * @access private
+     * @return string A properly quoted string that can be concatenated into a
+     * SELECT clause.
+     */
+    function _quoteDBFields()
+    {
+        if (isset($this->options['db_fields'])) {
+            if (is_array($this->options['db_fields'])) {
+                if ($this->options['auto_quote']) {
+                    $fields = array();
+                    foreach ($this->options['db_fields'] as $field) {
+                        $fields[] = $this->db->quoteIdentifier($field);
+                    }
+                    return implode(', ', $fields);
+                } else {
+                    return implode(', ', $this->options['db_fields']);
+                }
+            } else {
+                if (strlen($this->options['db_fields']) > 0) {
+                    if ($this->options['auto_quote']) {
+                        return $this->db->quoteIdentifier($this->options['db_fields']);
+                    } else {
+                        $this->options['db_fields'];
+                    }
+                }
+            }
+        }
+
+        return '';
+    }
+    
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Get user information from database
+     *
+     * This function uses the given username to fetch
+     * the corresponding login data from the database
+     * table. If an account that matches the passed username
+     * and password is found, the function returns true.
+     * Otherwise it returns false.
+     *
+     * @param   string Username
+     * @param   string Password
+     * @return  mixed  Error object or boolean
+     */
+    function fetchData($username, $password)
+    {
+        // Prepare for a database query
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        // Find if db_fields contains a *, if so assume all col are selected
+        if (is_string($this->options['db_fields'])
+            && strstr($this->options['db_fields'], '*')) {
+            $sql_from = "*";
+        } else {
+            $sql_from = $this->options['final_usernamecol'].
+                ", ".$this->options['final_passwordcol'];
+
+            if (strlen($fields = $this->_quoteDBFields()) > 0) {
+                $sql_from .= ', '.$fields;
+            }
+        }
+        
+        $query = "SELECT ".$sql_from.
+                " FROM ".$this->options['final_table'].
+                " WHERE ".$this->options['final_usernamecol']." = ".$this->db->quoteSmart($username);
+        $res = $this->db->getRow($query, null, DB_FETCHMODE_ASSOC);
+
+        if (DB::isError($res)) {
+            return PEAR::raiseError($res->getMessage(), $res->getCode());
+        }
+        if (!is_array($res)) {
+            $this->activeUser = '';
+            return false;
+        }
+        if ($this->verifyPassword(trim($password, "\r\n"),
+                                  trim($res[$this->options['passwordcol']], "\r\n"),
+                                  $this->options['cryptType'])) {
+            // Store additional field values in the session
+            foreach ($res as $key => $value) {
+                if ($key == $this->options['passwordcol'] ||
+                    $key == $this->options['usernamecol']) {
+                    continue;
+                }
+                // Use reference to the auth object if exists
+                // This is because the auth session variable can change so a static call to setAuthData does not make sence
+                if (is_object($this->_auth_obj)) {
+                    $this->_auth_obj->setAuthData($key, $value);
+                } else {
+                    Auth::setAuthData($key, $value);
+                }
+            }
+            $this->activeUser = $res[$this->options['usernamecol']];
+            return true;
+        }
+        $this->activeUser = $res[$this->options['usernamecol']];
+        return false;
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/SMBPasswd.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/SMBPasswd.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/SMBPasswd.php	(revision 10038)
@@ -0,0 +1,177 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against Samba password files
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Michael Bretterklieber <michael@bretterklieber.com> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.2.3
+ */
+
+/**
+ * Include PEAR File_SMBPasswd
+ */
+require_once "File/SMBPasswd.php";
+/**
+ * Include Auth_Container Base file
+ */
+require_once "Auth/Container.php";
+/**
+ * Include PEAR class for error handling
+ */
+require_once "PEAR.php";
+
+/**
+ * Storage driver for fetching login data from an SAMBA smbpasswd file.
+ *
+ * This storage container can handle SAMBA smbpasswd files.
+ *
+ * Example:
+ * $a = new Auth("SMBPasswd", '/usr/local/private/smbpasswd');
+ * $a->start();
+ * if ($a->getAuth()) {
+ *     printf ("AUTH OK<br>\n");
+ *     $a->logout();
+ * }
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Michael Bretterklieber <michael@bretterklieber.com>
+ * @author     Adam Ashley <aashley@php.net>
+ * @package    Auth
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.2.3
+ */
+class Auth_Container_SMBPasswd extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * File_SMBPasswd object
+     * @var object
+     */
+    var $pwfile;
+
+    // }}}
+
+    // {{{ Auth_Container_SMBPasswd() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * @param  $filename   string filename for a passwd type file
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_SMBPasswd($filename)
+    {
+        $this->pwfile = new File_SMBPasswd($filename,0);
+
+        if (!$this->pwfile->load()) {
+            PEAR::raiseError("Error while reading file contents.", 41, PEAR_ERROR_DIE);
+            return;
+        }
+
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Get user information from pwfile
+     *
+     * @param   string Username
+     * @param   string Password
+     * @return  boolean
+     */
+    function fetchData($username, $password)
+    {
+        return $this->pwfile->verifyAccount($username, $password);
+    }
+
+    // }}}
+    // {{{ listUsers()
+    
+    function listUsers()
+    {
+        return $this->pwfile->getAccounts();
+    }
+
+    // }}}
+    // {{{ addUser()
+
+    /**
+     * Add a new user to the storage container
+     *
+     * @param string Username
+     * @param string Password
+     * @param array  Additional information
+     *
+     * @return boolean
+     */
+    function addUser($username, $password, $additional = '')
+    {
+        $res = $this->pwfile->addUser($user, $additional['userid'], $pass);
+        if ($res === true) {
+            return $this->pwfile->save();
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ removeUser()
+
+    /**
+     * Remove user from the storage container
+     *
+     * @param string Username
+     */
+    function removeUser($username)
+    {
+        $res = $this->pwfile->delUser($username);
+        if ($res === true) {
+            return $this->pwfile->save();
+        }
+        return $res;
+    }
+
+    // }}}
+    // {{{ changePassword()
+
+    /**
+     * Change password for user in the storage container
+     *
+     * @param string Username
+     * @param string The new password 
+     */
+    function changePassword($username, $password)
+    {
+         $res = $this->pwfile->modUser($username, '', $password);
+         if ($res === true) {
+             return $this->pwfile->save();
+         }
+         return $res;
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/Array.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/Array.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/Array.php	(revision 10038)
@@ -0,0 +1,159 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against a PHP Array
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     georg_1 at have2 dot com
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @since      File available since Release 1.4.0
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once "Auth/Container.php";
+/**
+ * Include PEAR package for error handling
+ */
+require_once "PEAR.php";
+
+/**
+ * Storage driver for fetching authentication data from a PHP Array
+ *
+ * This container takes two options when configuring:
+ *
+ * cryptType:   The crypt used to store the password. Currently recognised
+ *              are: none, md5 and crypt. default: none
+ * users:       A named array of usernames and passwords.
+ *              Ex:
+ *              array(
+ *                  'guest' => '084e0343a0486ff05530df6c705c8bb4', // password guest
+ *                  'georg' => 'fc77dba827fcc88e0243404572c51325'  // password georg
+ *              )
+ *
+ * Usage Example:
+ * <?php
+ * $AuthOptions = array(
+ *      'users' => array(
+ *          'guest' => '084e0343a0486ff05530df6c705c8bb4', // password guest
+ *          'georg' => 'fc77dba827fcc88e0243404572c51325'  // password georg
+ *      ),
+ *      'cryptType'=>'md5',
+ *  );
+ *
+ * $auth = new Auth("Array", $AuthOptions);
+ * ?>
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     georg_1 at have2 dot com
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @since      File available since Release 1.4.0
+ */
+
+class Auth_Container_Array extends Auth_Container {
+
+    // {{{ properties
+
+    /**
+     * The users and their password to authenticate against
+     *
+     * @var array $users
+     */
+    var $users;
+
+    /**
+     * The cryptType used on the passwords
+     *
+     * @var string $cryptType
+     */
+    var $cryptType = 'none';
+
+    // }}}
+    // {{{ Auth_Container_Array()
+
+    /**
+     * Constructor for Array Container
+     *
+     * @param array $data Options for the container
+     * @return void
+     */
+    function Auth_Container_Array($data)
+    {
+        if (!is_array($data)) {
+            PEAR::raiseError('The options for Auth_Container_Array must be an array');
+        } 
+        if (isset($data['users']) && is_array($data['users'])) {
+            $this->users = $data['users'];
+        } else {
+            $this->users = array();
+            PEAR::raiseError('Auth_Container_Array: no user data found inoptions array');
+        } 
+        if (isset($data['cryptType'])) {
+            $this->cryptType = $data['cryptType'];
+        } 
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Get user information from array
+     *
+     * This function uses the given username to fetch the corresponding
+     * login data from the array. If an account that matches the passed
+     * username and password is found, the function returns true.
+     * Otherwise it returns false.
+     *
+     * @param  string Username
+     * @param  string Password
+     * @return boolean|PEAR_Error Error object or boolean
+     */
+    function fetchData($user, $pass)
+    {
+        if (   isset($this->users[$user])
+            && $this->verifyPassword($pass, $this->users[$user], $this->cryptType)) {
+            return true;
+        }
+        return false;
+    } 
+
+    // }}}
+    // {{{ listUsers()
+
+    /**
+     * Returns a list of users available within the container
+     *
+     * @return array
+     */
+    function listUsers()
+    {
+        $ret = array();
+        foreach ($this->users as $username => $password) {
+            $ret[]['username'] = $username;
+        } 
+        return $ret;
+    } 
+
+    // }}}
+
+} 
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/File.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/File.php	(revision 10059)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/File.php	(revision 10059)
@@ -0,0 +1,306 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against a generic password file
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Stefan Ekman <stekman@sedata.org> 
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Mika Tuupola <tuupola@appelsiini.net> 
+ * @author     Michael Wallner <mike@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ */
+
+/**
+ * Include PEAR File_Passwd package
+ */
+$include_dir = realpath(dirname( __FILE__));
+require_once $include_dir . "/../../File/Passwd.php";
+/**
+ * Include Auth_Container base class
+ */
+require_once $include_dir . "/../Container.php";
+/**
+ * Include PEAR package for error handling
+ */
+//require_once $include_dir . "/../../PEAR.php";
+
+/**
+ * Storage driver for fetching login data from an encrypted password file.
+ *
+ * This storage container can handle CVS pserver style passwd files.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Stefan Ekman <stekman@sedata.org> 
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Mika Tuupola <tuupola@appelsiini.net> 
+ * @author     Michael Wallner <mike@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ */
+class Auth_Container_File extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Path to passwd file
+     * 
+     * @var string
+     */
+    var $pwfile = '';
+
+    /**
+     * Options for container
+     *
+     * @var array
+     */
+    var $options = array();
+
+    // }}}
+    // {{{ Auth_Container_File() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * @param  string $filename             path to passwd file
+     * @return object Auth_Container_File   new Auth_Container_File object
+     */
+    function Auth_Container_File($filename) {
+        $this->_setDefaults();
+        
+        // Only file is a valid option here
+        if(is_array($filename)) {
+            $this->pwfile = $filename['file'];
+            $this->_parseOptions($filename);
+        } else {
+            $this->pwfile = $filename;
+        }
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Authenticate an user
+     *
+     * @param   string  username
+     * @param   string  password
+     * @return  mixed   boolean|PEAR_Error
+     */
+    function fetchData($user, $pass)
+    {
+        return File_Passwd::staticAuth($this->options['type'], $this->pwfile, $user, $pass);
+    }
+
+    // }}}
+    // {{{ listUsers()
+    
+    /**
+     * List all available users
+     * 
+     * @return   array
+     */
+    function listUsers()
+    {
+        $pw_obj = &$this->_load();
+        if (PEAR::isError($pw_obj)) {
+            return array();
+        }
+
+        $users  = $pw_obj->listUser();
+        if (!is_array($users)) {
+            return array();
+        }
+
+        foreach ($users as $key => $value) {
+            $retVal[] = array("username" => $key, 
+                              "password" => $value['passwd'],
+                              "cvsuser"  => $value['system']);
+        }
+
+        return $retVal;
+    }
+
+    // }}}
+    // {{{ addUser()
+
+    /**
+     * Add a new user to the storage container
+     *
+     * @param string username
+     * @param string password
+     * @param mixed  Additional parameters to File_Password_*::addUser()
+     *
+     * @return boolean
+     */
+    function addUser($user, $pass, $additional='')
+    {
+        $params = array($user, $pass);
+        if (is_array($additional)) {
+            foreach ($additional as $item) {
+                $params[] = $item;
+            }
+        } else {
+            $params[] = $additional;
+        }
+
+        $pw_obj = &$this->_load();
+        if (PEAR::isError($pw_obj)) {
+            return false;
+        }
+        
+        $res = call_user_func_array(array(&$pw_obj, 'addUser'), $params);
+        if (PEAR::isError($res)) {
+            return false;
+        }
+        
+        $res = $pw_obj->save();
+        if (PEAR::isError($res)) {
+            return false;
+        }
+        
+        return true;
+    }
+
+    // }}}
+    // {{{ removeUser()
+
+    /**
+     * Remove user from the storage container
+     *
+     * @param   string  Username
+     * @return  boolean
+     */
+    function removeUser($user)
+    {
+        $pw_obj = &$this->_load();
+        if (PEAR::isError($pw_obj)) {
+            return false;
+        }
+        
+        $res = $pw_obj->delUser($user);
+        if (PEAR::isError($res)) {
+            return false;
+        }
+        
+        $res = $pw_obj->save();
+        if (PEAR::isError($res)) {
+            return false;
+        }
+        
+        return true;
+    }
+
+    // }}}
+    // {{{ changePassword()
+
+    /**
+     * Change password for user in the storage container
+     *
+     * @param string Username
+     * @param string The new password 
+     */
+    function changePassword($username, $password)
+    {
+        $pw_obj = &$this->_load();
+        if (PEAR::isError($pw_obj)) {
+            return false;
+        }
+        
+        $res = $pw_obj->changePasswd($username, $password);
+        if (PEAR::isError($res)) {
+            return false;
+        }
+        
+        $res = $pw_obj->save();
+        if (PEAR::isError($res)) {
+            return false;
+        }
+        
+        return true;
+    }
+
+    // }}}
+    // {{{ _load()
+    
+    /**
+     * Load and initialize the File_Passwd object
+     * 
+     * @return  object  File_Passwd_Cvs|PEAR_Error
+     */
+    function &_load()
+    {
+        static $pw_obj;
+        
+        if (!isset($pw_obj)) {
+            $pw_obj = File_Passwd::factory($this->options['type']);
+            if (PEAR::isError($pw_obj)) {
+                return $pw_obj;
+            }
+            
+            $pw_obj->setFile($this->pwfile);
+            
+            $res = $pw_obj->load();
+            if (PEAR::isError($res)) {
+                return $res;
+            }
+        }
+        
+        return $pw_obj;
+    }
+
+    // }}}
+    // {{{ _setDefaults()
+
+    /**
+     * Set some default options
+     *
+     * @access private
+     * @return void
+     */
+    function _setDefaults()
+    {
+        $this->options['type']       = 'Cvs';
+    }
+
+    // }}}
+    // {{{ _parseOptions()
+
+    /**
+     * Parse options passed to the container class
+     *
+     * @access private
+     * @param  array
+     */
+    function _parseOptions($array)
+    {
+        foreach ($array as $key => $value) {
+            if (isset($this->options[$key])) {
+                $this->options[$key] = $value;
+            }
+        }
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container/LDAP.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container/LDAP.php	(revision 10038)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container/LDAP.php	(revision 10038)
@@ -0,0 +1,773 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Storage driver for use against an LDAP server
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Jan Wagner <wagner@netsols.de> 
+ * @author     Adam Ashley <aashley@php.net>
+ * @author     Hugues Peeters <hugues.peeters@claroline.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ */
+
+/**
+ * Include Auth_Container base class
+ */
+require_once "Auth/Container.php";
+/**
+ * Include PEAR package for error handling
+ */
+require_once "PEAR.php";
+
+/**
+ * Storage driver for fetching login data from LDAP
+ *
+ * This class is heavily based on the DB and File containers. By default it
+ * connects to localhost:389 and searches for uid=$username with the scope
+ * "sub". If no search base is specified, it will try to determine it via
+ * the namingContexts attribute. It takes its parameters in a hash, connects
+ * to the ldap server, binds anonymously, searches for the user, and tries
+ * to bind as the user with the supplied password. When a group was set, it
+ * will look for group membership of the authenticated user. If all goes
+ * well the authentication was successful.
+ *
+ * Parameters:
+ *
+ * host:        localhost (default), ldap.netsols.de or 127.0.0.1
+ * port:        389 (default) or 636 or whereever your server runs
+ * url:         ldap://localhost:389/
+ *              useful for ldaps://, works only with openldap2 ?
+ *              it will be preferred over host and port
+ * version:     LDAP version to use, ususally 2 (default) or 3,
+ *              must be an integer!
+ * referrals:   If set, determines whether the LDAP library automatically
+ *              follows referrals returned by LDAP servers or not. Possible
+ *              values are true (default) or false.
+ * binddn:      If set, searching for user will be done after binding
+ *              as this user, if not set the bind will be anonymous.
+ *              This is reported to make the container work with MS
+ *              Active Directory, but should work with any server that
+ *              is configured this way.
+ *              This has to be a complete dn for now (basedn and
+ *              userdn will not be appended).
+ * bindpw:      The password to use for binding with binddn
+ * basedn:      the base dn of your server
+ * userdn:      gets prepended to basedn when searching for user
+ * userscope:   Scope for user searching: one, sub (default), or base
+ * userattr:    the user attribute to search for (default: uid)
+ * userfilter:  filter that will be added to the search filter
+ *              this way: (&(userattr=username)(userfilter))
+ *              default: (objectClass=posixAccount)
+ * attributes:  array of additional attributes to fetch from entry.
+ *              these will added to auth data and can be retrieved via
+ *              Auth::getAuthData(). An empty array will fetch all attributes,
+ *              array('') will fetch no attributes at all (default)
+ *              If you add 'dn' as a value to this array, the users DN that was
+ *              used for binding will be added to auth data as well.
+ * attrformat:  The returned format of the additional data defined in the
+ *              'attributes' option. Two formats are available.
+ *              LDAP returns data formatted in a
+ *              multidimensional array where each array starts with a
+ *              'count' element providing the number of attributes in the
+ *              entry, or the number of values for attributes. When set
+ *              to this format, the only way to retrieve data from the
+ *              Auth object is by calling getAuthData('attributes').
+ *              AUTH returns data formatted in a
+ *              structure more compliant with other Auth Containers,
+ *              where each attribute element can be directly called by
+ *              getAuthData() method from Auth.
+ *              For compatibily with previous LDAP container versions,
+ *              the default format is LDAP.
+ * groupdn:     gets prepended to basedn when searching for group
+ * groupattr:   the group attribute to search for (default: cn)
+ * groupfilter: filter that will be added to the search filter when
+ *              searching for a group:
+ *              (&(groupattr=group)(memberattr=username)(groupfilter))
+ *              default: (objectClass=groupOfUniqueNames)
+ * memberattr : the attribute of the group object where the user dn
+ *              may be found (default: uniqueMember)
+ * memberisdn:  whether the memberattr is the dn of the user (default)
+ *              or the value of userattr (usually uid)
+ * group:       the name of group to search for
+ * groupscope:  Scope for group searching: one, sub (default), or base
+ * start_tls:   enable/disable the use of START_TLS encrypted connection 
+ *              (default: false)
+ * debug:       Enable/Disable debugging output (default: false)
+ * try_all:     Whether to try all user accounts returned from the search
+ *              or just the first one. (default: false)
+ *
+ * To use this storage container, you have to use the following syntax:
+ *
+ * <?php
+ * ...
+ *
+ * $a1 = new Auth("LDAP", array(
+ *       'host' => 'localhost',
+ *       'port' => '389',
+ *       'version' => 3,
+ *       'basedn' => 'o=netsols,c=de',
+ *       'userattr' => 'uid'
+ *       'binddn' => 'cn=admin,o=netsols,c=de',
+ *       'bindpw' => 'password'));
+ *
+ * $a2 = new Auth('LDAP', array(
+ *       'url' => 'ldaps://ldap.netsols.de',
+ *       'basedn' => 'o=netsols,c=de',
+ *       'userscope' => 'one',
+ *       'userdn' => 'ou=People',
+ *       'groupdn' => 'ou=Groups',
+ *       'groupfilter' => '(objectClass=posixGroup)',
+ *       'memberattr' => 'memberUid',
+ *       'memberisdn' => false,
+ *       'group' => 'admin'
+ *       ));
+ *
+ * $a3 = new Auth('LDAP', array(
+ *       'host' => 'ldap.netsols.de',
+ *       'port' => 389,
+ *       'version' => 3,
+ *       'referrals' => false,
+ *       'basedn' => 'dc=netsols,dc=de',
+ *       'binddn' => 'cn=Jan Wagner,cn=Users,dc=netsols,dc=de',
+ *       'bindpw' => 'password',
+ *       'userattr' => 'samAccountName',
+ *       'userfilter' => '(objectClass=user)',
+ *       'attributes' => array(''),
+ *       'group' => 'testing',
+ *       'groupattr' => 'samAccountName',
+ *       'groupfilter' => '(objectClass=group)',
+ *       'memberattr' => 'member',
+ *       'memberisdn' => true,
+ *       'groupdn' => 'cn=Users',
+ *       'groupscope' => 'one',
+ *       'debug' => true);
+ *
+ * The parameter values have to correspond
+ * to the ones for your LDAP server of course.
+ *
+ * When talking to a Microsoft ActiveDirectory server you have to
+ * use 'samaccountname' as the 'userattr' and follow special rules
+ * to translate the ActiveDirectory directory names into 'basedn'.
+ * The 'basedn' for the default 'Users' folder on an ActiveDirectory
+ * server for the ActiveDirectory Domain (which is not related to
+ * its DNS name) "win2000.example.org" would be:
+ * "CN=Users, DC=win2000, DC=example, DC=org'
+ * where every component of the domain name becomes a DC attribute
+ * of its own. If you want to use a custom users folder you have to
+ * replace "CN=Users" with a sequence of "OU" attributes that specify
+ * the path to your custom folder in reverse order.
+ * So the ActiveDirectory folder
+ *   "win2000.example.org\Custom\Accounts"
+ * would become
+ *   "OU=Accounts, OU=Custom, DC=win2000, DC=example, DC=org'
+ *
+ * It seems that binding anonymously to an Active Directory
+ * is not allowed, so you have to set binddn and bindpw for
+ * user searching.
+ * 
+ * LDAP Referrals need to be set to false for AD to work sometimes.
+ *
+ * Example a3 shows a full blown and tested example for connection to 
+ * Windows 2000 Active Directory with group mebership checking
+ *
+ * Note also that if you want an encrypted connection to an MS LDAP 
+ * server, then, on your webserver, you must specify 
+ *        TLS_REQCERT never
+ * in /etc/ldap/ldap.conf or in the webserver user's ~/.ldaprc (which
+ * may or may not be read depending on your configuration).
+ *
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Jan Wagner <wagner@netsols.de>
+ * @author     Adam Ashley <aashley@php.net>
+ * @author     Hugues Peeters <hugues.peeters@claroline.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ */
+class Auth_Container_LDAP extends Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * Options for the class
+     * @var array
+     */
+    var $options = array();
+
+    /**
+     * Connection ID of LDAP Link
+     * @var string
+     */
+    var $conn_id = false;
+
+    // }}}
+
+    // {{{ Auth_Container_LDAP() [constructor]
+
+    /**
+     * Constructor of the container class
+     *
+     * @param  $params, associative hash with host,port,basedn and userattr key
+     * @return object Returns an error object if something went wrong
+     */
+    function Auth_Container_LDAP($params)
+    {
+        if (false === extension_loaded('ldap')) {
+            return PEAR::raiseError('Auth_Container_LDAP: LDAP Extension not loaded',
+                    41, PEAR_ERROR_DIE);
+        }
+
+        $this->_setDefaults();
+
+        if (is_array($params)) {
+            $this->_parseOptions($params);
+        }
+    }
+
+    // }}}
+    // {{{ _prepare()
+
+    /**
+     * Prepare LDAP connection
+     *
+     * This function checks if we have already opened a connection to
+     * the LDAP server. If that's not the case, a new connection is opened.
+     *
+     * @access private
+     * @return mixed True or a PEAR error object.
+     */
+    function _prepare()
+    {
+        if (!$this->_isValidLink()) {
+            $res = $this->_connect();
+            if (PEAR::isError($res)) {
+                return $res;
+            }
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ _connect()
+
+    /**
+     * Connect to the LDAP server using the global options
+     *
+     * @access private
+     * @return object  Returns a PEAR error object if an error occurs.
+     */
+    function _connect()
+    {
+        // connect
+        if (isset($this->options['url']) && $this->options['url'] != '') {
+            $this->_debug('Connecting with URL', __LINE__);
+            $conn_params = array($this->options['url']);
+        } else {
+            $this->_debug('Connecting with host:port', __LINE__);
+            $conn_params = array($this->options['host'], $this->options['port']);
+        }
+
+        if (($this->conn_id = @call_user_func_array('ldap_connect', $conn_params)) === false) {
+            return PEAR::raiseError('Auth_Container_LDAP: Could not connect to server.', 41);
+        }
+        $this->_debug('Successfully connected to server', __LINE__);
+
+        // switch LDAP version
+        if (is_numeric($this->options['version']) && $this->options['version'] > 2) {
+            $this->_debug("Switching to LDAP version {$this->options['version']}", __LINE__);
+            @ldap_set_option($this->conn_id, LDAP_OPT_PROTOCOL_VERSION, $this->options['version']);
+        
+            // start TLS if available
+            if (isset($this->options['start_tls']) && $this->options['start_tls']) {           
+                $this->_debug("Starting TLS session", __LINE__);
+                if (@ldap_start_tls($this->conn_id) === false) {
+                    return PEAR::raiseError('Auth_Container_LDAP: Could not start tls.', 41);
+                }
+            }
+        }
+
+        // switch LDAP referrals
+        if (is_bool($this->options['referrals'])) {
+          $this->_debug("Switching LDAP referrals to " . (($this->options['referrals']) ? 'true' : 'false'), __LINE__);
+          @ldap_set_option($this->conn_id, LDAP_OPT_REFERRALS, $this->options['referrals']);
+        }
+
+        // bind with credentials or anonymously
+        if (strlen($this->options['binddn']) && strlen($this->options['bindpw'])) {
+            $this->_debug('Binding with credentials', __LINE__);
+            $bind_params = array($this->conn_id, $this->options['binddn'], $this->options['bindpw']);
+        } else {
+            $this->_debug('Binding anonymously', __LINE__);
+            $bind_params = array($this->conn_id);
+        }
+
+        // bind for searching
+        if ((@call_user_func_array('ldap_bind', $bind_params)) === false) {
+            $this->_debug();
+            $this->_disconnect();
+            return PEAR::raiseError("Auth_Container_LDAP: Could not bind to LDAP server.", 41);
+        }
+        $this->_debug('Binding was successful', __LINE__);
+
+        return true;
+    }
+
+    // }}}
+    // {{{ _disconnect()
+
+    /**
+     * Disconnects (unbinds) from ldap server
+     *
+     * @access private
+     */
+    function _disconnect()
+    {
+        if ($this->_isValidLink()) {
+            $this->_debug('disconnecting from server');
+            @ldap_unbind($this->conn_id);
+        }
+    }
+
+    // }}}
+    // {{{ _getBaseDN()
+
+    /**
+     * Tries to find Basedn via namingContext Attribute
+     *
+     * @access private
+     */
+    function _getBaseDN()
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        if ($this->options['basedn'] == "" && $this->_isValidLink()) {
+            $this->_debug("basedn not set, searching via namingContexts.", __LINE__);
+
+            $result_id = @ldap_read($this->conn_id, "", "(objectclass=*)", array("namingContexts"));
+
+            if (@ldap_count_entries($this->conn_id, $result_id) == 1) {
+
+                $this->_debug("got result for namingContexts", __LINE__);
+
+                $entry_id = @ldap_first_entry($this->conn_id, $result_id);
+                $attrs = @ldap_get_attributes($this->conn_id, $entry_id);
+                $basedn = $attrs['namingContexts'][0];
+
+                if ($basedn != "") {
+                    $this->_debug("result for namingContexts was $basedn", __LINE__);
+                    $this->options['basedn'] = $basedn;
+                }
+            }
+            @ldap_free_result($result_id);
+        }
+
+        // if base ist still not set, raise error
+        if ($this->options['basedn'] == "") {
+            return PEAR::raiseError("Auth_Container_LDAP: LDAP search base not specified!", 41);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ _isValidLink()
+
+    /**
+     * determines whether there is a valid ldap conenction or not
+     *
+     * @accessd private
+     * @return boolean
+     */
+    function _isValidLink()
+    {
+        if (is_resource($this->conn_id)) {
+            if (get_resource_type($this->conn_id) == 'ldap link') {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ _setDefaults()
+
+    /**
+     * Set some default options
+     *
+     * @access private
+     */
+    function _setDefaults()
+    {
+        $this->options['url']         = '';
+        $this->options['host']        = 'localhost';
+        $this->options['port']        = '389';
+        $this->options['version']     = 2;
+        $this->options['referrals']   = true;
+        $this->options['binddn']      = '';
+        $this->options['bindpw']      = '';
+        $this->options['basedn']      = '';
+        $this->options['userdn']      = '';
+        $this->options['userscope']   = 'sub';
+        $this->options['userattr']    = 'uid';
+        $this->options['userfilter']  = '(objectClass=posixAccount)';
+        $this->options['attributes']  = array(''); // no attributes
+     // $this->options['attrformat']  = 'LDAP'; // returns attribute array as PHP LDAP functions return it
+        $this->options['attrformat']  = 'AUTH'; // returns attribute like other Auth containers
+        $this->options['group']       = '';
+        $this->options['groupdn']     = '';
+        $this->options['groupscope']  = 'sub';
+        $this->options['groupattr']   = 'cn';
+        $this->options['groupfilter'] = '(objectClass=groupOfUniqueNames)';
+        $this->options['memberattr']  = 'uniqueMember';
+        $this->options['memberisdn']  = true;
+        $this->options['start_tls']   = false;
+        $this->options['debug']       = false;
+        $this->options['try_all']     = false; // Try all user ids returned not just the first one
+    }
+
+    // }}}
+    // {{{ _parseOptions()
+
+    /**
+     * Parse options passed to the container class
+     *
+     * @access private
+     * @param  array
+     */
+    function _parseOptions($array)
+    {
+        $array = $this->_setV12OptionsToV13($array);
+
+        foreach ($array as $key => $value) {
+            if (array_key_exists($key, $this->options)) {
+                if ($key == 'attributes') {
+                    if (is_array($value)) {
+                        $this->options[$key] = $value;
+                    } else {
+                        $this->options[$key] = explode(',', $value);
+                    }
+                } else {
+                    $this->options[$key] = $value;
+                }
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _setV12OptionsToV13()
+
+    /**
+     * Adapt deprecated options from Auth 1.2 LDAP to Auth 1.3 LDAP
+     * 
+     * @author Hugues Peeters <hugues.peeters@claroline.net>
+     * @access private
+     * @param array
+     * @return array
+     */
+    function _setV12OptionsToV13($array)
+    {
+        if (isset($array['useroc']))
+            $array['userfilter'] = "(objectClass=".$array['useroc'].")";
+        if (isset($array['groupoc']))
+            $array['groupfilter'] = "(objectClass=".$array['groupoc'].")";
+        if (isset($array['scope']))
+            $array['userscope'] = $array['scope'];
+
+        return $array;
+    }
+
+    // }}}
+    // {{{ _scope2function()
+
+    /**
+     * Get search function for scope
+     *
+     * @param  string scope
+     * @return string ldap search function
+     */
+    function _scope2function($scope)
+    {
+        switch($scope) {
+        case 'one':
+            $function = 'ldap_list';
+            break;
+        case 'base':
+            $function = 'ldap_read';
+            break;
+        default:
+            $function = 'ldap_search';
+            break;
+        }
+        return $function;
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Fetch data from LDAP server
+     *
+     * Searches the LDAP server for the given username/password
+     * combination.  Escapes all LDAP meta characters in username
+     * before performing the query.
+     *
+     * @param  string Username
+     * @param  string Password
+     * @return boolean
+     */
+    function fetchData($username, $password)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        $err = $this->_getBaseDN();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        // UTF8 Encode username for LDAPv3
+        if (@ldap_get_option($this->conn_id, LDAP_OPT_PROTOCOL_VERSION, $ver) && $ver == 3) {
+            $this->_debug('UTF8 encoding username for LDAPv3', __LINE__);
+            $username = utf8_encode($username);
+        }
+
+        // make search filter
+        $filter = sprintf('(&(%s=%s)%s)',
+                          $this->options['userattr'],
+                          $this->_quoteFilterString($username),
+                          $this->options['userfilter']);
+
+        // make search base dn
+        $search_basedn = $this->options['userdn'];
+        if ($search_basedn != '' && substr($search_basedn, -1) != ',') {
+            $search_basedn .= ',';
+        }
+        $search_basedn .= $this->options['basedn'];
+
+        // attributes
+        $attributes = $this->options['attributes'];
+
+        // make functions params array
+        $func_params = array($this->conn_id, $search_basedn, $filter, $attributes);
+
+        // search function to use
+        $func_name = $this->_scope2function($this->options['userscope']);
+
+        $this->_debug("Searching with $func_name and filter $filter in $search_basedn", __LINE__);
+
+        // search
+        if (($result_id = @call_user_func_array($func_name, $func_params)) === false) {
+            $this->_debug('User not found', __LINE__);
+        } elseif (@ldap_count_entries($this->conn_id, $result_id) >= 1) { // did we get some possible results?
+
+            $this->_debug('User(s) found', __LINE__);
+
+            $first = true;
+            $entry_id = null;
+
+            do {
+                
+                // then get the user dn
+                if ($first) {
+                    $entry_id = @ldap_first_entry($this->conn_id, $result_id);
+                    $first = false;
+                } else {
+                    $entry_id = @ldap_next_entry($this->conn_id, $entry_id);
+                    if ($entry_id === false)
+                        break;
+                }
+                $user_dn  = @ldap_get_dn($this->conn_id, $entry_id);
+
+                // as the dn is not fetched as an attribute, we save it anyway
+                if (is_array($attributes) && in_array('dn', $attributes)) {
+                    $this->_debug('Saving DN to AuthData', __LINE__);
+                    $this->_auth_obj->setAuthData('dn', $user_dn);
+                }
+            
+                // fetch attributes
+                if ($attributes = @ldap_get_attributes($this->conn_id, $entry_id)) {
+
+                    if (is_array($attributes) && isset($attributes['count']) &&
+                         $attributes['count'] > 0) {
+
+                        // ldap_get_attributes() returns a specific multi dimensional array
+                        // format containing all the attributes and where each array starts
+                        // with a 'count' element providing the number of attributes in the
+                        // entry, or the number of values for attribute. For compatibility
+                        // reasons, it remains the default format returned by LDAP container
+                        // setAuthData().
+                        // The code below optionally returns attributes in another format,
+                        // more compliant with other Auth containers, where each attribute
+                        // element are directly set in the 'authData' list. This option is
+                        // enabled by setting 'attrformat' to
+                        // 'AUTH' in the 'options' array.
+                        // eg. $this->options['attrformat'] = 'AUTH'
+
+                        if ( strtoupper($this->options['attrformat']) == 'AUTH' ) {
+                            $this->_debug('Saving attributes to Auth data in AUTH format', __LINE__);
+                            unset ($attributes['count']);
+                            foreach ($attributes as $attributeName => $attributeValue ) {
+                                if (is_int($attributeName)) continue;
+                                if (is_array($attributeValue) && isset($attributeValue['count'])) {
+                                    unset ($attributeValue['count']);
+                                }
+                                if (count($attributeValue)<=1) $attributeValue = $attributeValue[0];
+                                $this->_auth_obj->setAuthData($attributeName, $attributeValue);
+                            }
+                        }
+                        else
+                        {
+                            $this->_debug('Saving attributes to Auth data in LDAP format', __LINE__);
+                            $this->_auth_obj->setAuthData('attributes', $attributes);
+                        }
+                    }
+                }
+                @ldap_free_result($result_id);
+
+                // need to catch an empty password as openldap seems to return TRUE
+                // if anonymous binding is allowed
+                if ($password != "") {
+                    $this->_debug("Bind as $user_dn", __LINE__);
+
+                    // try binding as this user with the supplied password
+                    if (@ldap_bind($this->conn_id, $user_dn, $password)) {
+                        $this->_debug('Bind successful', __LINE__);
+
+                        // check group if appropiate
+                        if (strlen($this->options['group'])) {
+                            // decide whether memberattr value is a dn or the username
+                            $this->_debug('Checking group membership', __LINE__);
+                            $return = $this->checkGroup(($this->options['memberisdn']) ? $user_dn : $username);
+                            $this->_disconnect();
+                            return $return;
+                        } else {
+                            $this->_debug('Authenticated', __LINE__);
+                            $this->_disconnect();
+                            return true; // user authenticated
+                        } // checkGroup
+                    } // bind
+                } // non-empty password
+            } while ($this->options['try_all'] == true); // interate through entries
+        } // get results
+        // default
+        $this->_debug('NOT authenticated!', __LINE__);
+        $this->_disconnect();
+        return false;
+    }
+
+    // }}}
+    // {{{ checkGroup()
+
+    /**
+     * Validate group membership
+     *
+     * Searches the LDAP server for group membership of the
+     * supplied username.  Quotes all LDAP filter meta characters in
+     * the user name before querying the LDAP server.
+     *
+     * @param  string Distinguished Name of the authenticated User
+     * @return boolean
+     */
+    function checkGroup($user)
+    {
+        $err = $this->_prepare();
+        if ($err !== true) {
+            return PEAR::raiseError($err->getMessage(), $err->getCode());
+        }
+
+        // make filter
+        $filter = sprintf('(&(%s=%s)(%s=%s)%s)',
+                          $this->options['groupattr'],
+                          $this->options['group'],
+                          $this->options['memberattr'],
+                          $this->_quoteFilterString($user),
+                          $this->options['groupfilter']);
+
+        // make search base dn
+        $search_basedn = $this->options['groupdn'];
+        if ($search_basedn != '' && substr($search_basedn, -1) != ',') {
+            $search_basedn .= ',';
+        }
+        $search_basedn .= $this->options['basedn'];
+
+        $func_params = array($this->conn_id, $search_basedn, $filter,
+                             array($this->options['memberattr']));
+        $func_name = $this->_scope2function($this->options['groupscope']);
+
+        $this->_debug("Searching with $func_name and filter $filter in $search_basedn", __LINE__);
+
+        // search
+        if (($result_id = @call_user_func_array($func_name, $func_params)) != false) {
+            if (@ldap_count_entries($this->conn_id, $result_id) == 1) {
+                @ldap_free_result($result_id);
+                $this->_debug('User is member of group', __LINE__);
+                return true;
+            }
+        }
+        // default
+        $this->_debug('User is NOT member of group', __LINE__);
+        return false;
+    }
+
+    // }}}
+    // {{{ _debug()
+
+    /**
+     * Outputs debugging messages
+     *
+     * @access private
+     * @param string Debugging Message
+     * @param integer Line number
+     */
+    function _debug($msg = '', $line = 0)
+    {
+        if ($this->options['debug'] == true) {
+            if ($msg == '' && $this->_isValidLink()) {
+                $msg = 'LDAP_Error: ' . @ldap_err2str(@ldap_errno($this->_conn_id));
+            }
+            print("$line: $msg <br />");
+        }
+    }
+
+    // }}}
+    // {{{ _quoteFilterString()
+
+    /**
+     * Escapes LDAP filter special characters as defined in RFC 2254.
+     *
+     * @access private
+     * @param string Filter String
+     */
+    function _quoteFilterString($filter_str)
+    {
+        $metas        = array(  '\\',  '*',  '(',  ')',   "\x00");
+        $quoted_metas = array('\\\\', '\*', '\(', '\)', "\\\x00");
+        return str_replace($metas, $quoted_metas, $filter_str);
+    }
+
+    // }}}
+
+}
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Container.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Container.php	(revision 10040)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Container.php	(revision 10040)
@@ -0,0 +1,224 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Auth_Container Base Class
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ */
+
+/**
+ * Storage class for fetching login data
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ */
+class Auth_Container
+{
+
+    // {{{ properties
+
+    /**
+     * User that is currently selected from the storage container.
+     *
+     * @access public
+     */
+    var $activeUser = "";
+
+    // }}}
+    // {{{ Auth_Container() [constructor]
+
+    /**
+     * Constructor
+     *
+     * Has to be overwritten by each storage class
+     *
+     * @access public
+     */
+    function Auth_Container()
+    {
+    }
+
+    // }}}
+    // {{{ fetchData()
+
+    /**
+     * Fetch data from storage container
+     *
+     * Has to be overwritten by each storage class
+     *
+     * @access public
+     */
+    function fetchData($username, $password, $isChallengeResponse=false)
+    {
+    }
+
+    // }}}
+    // {{{ verifyPassword()
+
+    /**
+     * Crypt and verfiy the entered password
+     *
+     * @param  string Entered password
+     * @param  string Password from the data container (usually this password
+     *                is already encrypted.
+     * @param  string Type of algorithm with which the password from
+     *                the container has been crypted. (md5, crypt etc.)
+     *                Defaults to "md5".
+     * @return bool   True, if the passwords match
+     */
+    function verifyPassword($password1, $password2, $cryptType = "md5")
+    {
+        switch ($cryptType) {
+            case "crypt" :
+                return ((string)crypt($password1, $password2) === (string)$password2);
+                break;
+            case "none" :
+            case "" :
+                return ((string)$password1 === (string)$password2);
+                break;
+            case "md5" :
+                return ((string)md5($password1) === (string)$password2);
+                break;
+            default :
+                if (function_exists($cryptType)) {
+                    return ((string)$cryptType($password1) === (string)$password2);
+                } elseif (method_exists($this,$cryptType)) { 
+                    return ((string)$this->$cryptType($password1) === (string)$password2);
+                } else {
+                    return false;
+                }
+                break;
+        }
+    }
+
+    // }}}
+    // {{{ supportsChallengeResponse()
+    
+    /**
+      * Returns true if the container supports Challenge Response 
+      * password authentication
+      */
+    function supportsChallengeResponse()
+    {
+        return(false);
+    }
+
+    // }}}
+    // {{{ getCryptType()
+    
+    /**
+      * Returns the crypt current crypt type of the container
+      *
+      * @return string
+      */
+    function getCryptType()
+    {
+        return('');
+    }
+
+    // }}}
+    // {{{ listUsers()
+
+    /**
+     * List all users that are available from the storage container
+     */
+    function listUsers()
+    {
+        return AUTH_METHOD_NOT_SUPPORTED;
+    }
+
+    // }}}
+    // {{{ getUser()
+
+    /**
+     * Returns a user assoc array
+     *
+     * Containers which want should overide this
+     *
+     * @param string The username
+     */
+    function getUser($username)
+    {
+        $users = $this->listUsers();
+        if ($users === AUTH_METHOD_NOT_SUPPORTED) {
+            return AUTH_METHOD_NOT_SUPPORTED;
+        }
+        for ($i=0; $c = count($users), $i<$c; $i++) {
+            if ($users[$i]['username'] == $username) {
+                return $users[$i];
+            }
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ addUser()
+
+    /**
+     * Add a new user to the storage container
+     *
+     * @param string Username
+     * @param string Password
+     * @param array  Additional information
+     *
+     * @return boolean
+     */
+    function addUser($username, $password, $additional=null)
+    {
+        return AUTH_METHOD_NOT_SUPPORTED;
+    }
+
+    // }}}
+    // {{{ removeUser()
+
+    /**
+     * Remove user from the storage container
+     *
+     * @param string Username
+     */
+    function removeUser($username)
+    {
+        return AUTH_METHOD_NOT_SUPPORTED;
+    }
+
+    // }}}
+    // {{{ changePassword()
+
+    /**
+     * Change password for user in the storage container
+     *
+     * @param string Username
+     * @param string The new password
+     */
+    function changePassword($username, $password)
+    {
+        return AUTH_METHOD_NOT_SUPPORTED;
+    }
+
+    // }}}
+
+}
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Frontend/Html.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Frontend/Html.php	(revision 10040)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Frontend/Html.php	(revision 10040)
@@ -0,0 +1,142 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Standard Html Login form
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.3.0
+ */
+
+/**
+ * Standard Html Login form
+ * 
+ * @category   Authentication
+ * @package    Auth
+ * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.3.0
+ */
+class Auth_Frontend_Html {
+    
+    // {{{ render()
+
+    /**
+     * Displays the login form
+     *
+     * @param object The calling auth instance
+     * @param string The previously used username
+     * @return void
+     */
+    function render(&$caller, $username = '') {
+        $loginOnClick = 'return true;';
+        
+        // Try To Use Challene response
+        // TODO javascript might need some improvement for work on other browsers
+        if($caller->advancedsecurity && $caller->storage->supportsChallengeResponse() ) {
+
+            // Init the secret cookie
+            $caller->session['loginchallenege'] = md5(microtime());
+
+            print "\n";
+            print '<script language="JavaScript">'."\n";
+
+            include 'Auth/Frontend/md5.js';
+
+            print "\n";
+            print ' function securePassword() { '."\n";
+            print '   var pass = document.getElementById(\''.$caller->getPostPasswordField().'\');'."\n";
+            print '   var secret = document.getElementById(\'authsecret\')'."\n";
+            //print '   alert(pass);alert(secret); '."\n";
+
+            // If using md5 for password storage md5 the password before 
+            // we hash it with the secret
+            // print '   alert(pass.value);';
+            if ($caller->storage->getCryptType() == 'md5' ) {
+                print '   pass.value = hex_md5(pass.value); '."\n";
+                #print '   alert(pass.value);';
+            }
+
+            print '   pass.value = hex_md5(pass.value+\''.$caller->session['loginchallenege'].'\'); '."\n";
+            // print '   alert(pass.value);';
+            print '   secret.value = 1;'."\n";
+            print '   var doLogin = document.getElementById(\'doLogin\')'."\n";
+            print '   doLogin.disabled = true;'."\n";
+            print '   return true;';
+            print ' } '."\n";
+            print '</script>'."\n";;
+            print "\n";
+
+            $loginOnClick = ' return securePassword(); ';
+        }
+
+        print '<center>'."\n";
+
+        $status = '';
+        if (!empty($caller->status) && $caller->status == AUTH_EXPIRED) {
+            $status = '<i>Your session has expired. Please login again!</i>'."\n";
+        } else if (!empty($caller->status) && $caller->status == AUTH_IDLED) {
+            $status = '<i>You have been idle for too long. Please login again!</i>'."\n";
+        } else if (!empty ($caller->status) && $caller->status == AUTH_WRONG_LOGIN) {
+            $status = '<i>Wrong login data!</i>'."\n";
+        } else if (!empty ($caller->status) && $caller->status == AUTH_SECURITY_BREACH) {
+            $status = '<i>Security problem detected. </i>'."\n";
+        }
+        
+        print '<form method="post" action="'.$caller->server['PHP_SELF'].'" '
+            .'onSubmit="'.$loginOnClick.'">'."\n";
+        print '<table border="0" cellpadding="2" cellspacing="0" '
+            .'summary="login form" align="center" >'."\n";
+        print '<tr>'."\n";
+        print '    <td colspan="2" bgcolor="#eeeeee"><strong>Login </strong>'
+            .$status.'</td>'."\n";
+        print '</tr>'."\n";
+        print '<tr>'."\n";
+        print '    <td>Username:</td>'."\n";
+        print '    <td><input type="text" id="'.$caller->getPostUsernameField()
+            .'" name="'.$caller->getPostUsernameField().'" value="' . $username 
+            .'" /></td>'."\n";
+        print '</tr>'."\n";
+        print '<tr>'."\n";
+        print '    <td>Password:</td>'."\n";
+        print '    <td><input type="password" id="'.$caller->getPostPasswordField()
+            .'" name="'.$caller->getPostPasswordField().'" /></td>'."\n";
+        print '</tr>'."\n";
+        print '<tr>'."\n";
+        
+        //onClick=" '.$loginOnClick.' "
+        print '    <td colspan="2" bgcolor="#eeeeee"><input value="Login" '
+            .'id="doLogin" name="doLogin" type="submit" /></td>'."\n";
+        print '</tr>'."\n";
+        print '</table>'."\n";
+
+        // Might be a good idea to make the variable name variable 
+        print '<input type="hidden" id="authsecret" name="authsecret" value="" />';
+        print '</form>'."\n";
+        print '</center>'."\n";
+    }
+
+    // }}}
+    
+}
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Frontend/md5.js
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Frontend/md5.js	(revision 10040)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Frontend/md5.js	(revision 10040)
@@ -0,0 +1,256 @@
+/*
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
+ * Digest Algorithm, as defined in RFC 1321.
+ * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for more info.
+ */
+
+/*
+ * Configurable variables. You may need to tweak these to be compatible with
+ * the server-side, but the defaults work in most cases.
+ */
+var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
+var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
+var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */
+
+/*
+ * These are the functions you'll usually want to call
+ * They take string arguments and return either hex or base-64 encoded strings
+ */
+function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
+function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
+function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
+function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
+function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
+function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
+
+/*
+ * Perform a simple self-test to see if the VM is working
+ */
+function md5_vm_test()
+{
+  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
+}
+
+/*
+ * Calculate the MD5 of an array of little-endian words, and a bit length
+ */
+function core_md5(x, len)
+{
+  /* append padding */
+  x[len >> 5] |= 0x80 << ((len) % 32);
+  x[(((len + 64) >>> 9) << 4) + 14] = len;
+
+  var a =  1732584193;
+  var b = -271733879;
+  var c = -1732584194;
+  var d =  271733878;
+
+  for(var i = 0; i < x.length; i += 16)
+  {
+    var olda = a;
+    var oldb = b;
+    var oldc = c;
+    var oldd = d;
+
+    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
+    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
+    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
+    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
+    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
+    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
+    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
+    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
+    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
+    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
+    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
+    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
+    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
+    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
+    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
+    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
+
+    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
+    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
+    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
+    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
+    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
+    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
+    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
+    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
+    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
+    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
+    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
+    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
+    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
+    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
+    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
+    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
+
+    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
+    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
+    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
+    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
+    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
+    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
+    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
+    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
+    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
+    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
+    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
+    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
+    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
+    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
+    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
+    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
+
+    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
+    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
+    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
+    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
+    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
+    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
+    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
+    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
+    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
+    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
+    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
+    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
+    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
+    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
+    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
+    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
+
+    a = safe_add(a, olda);
+    b = safe_add(b, oldb);
+    c = safe_add(c, oldc);
+    d = safe_add(d, oldd);
+  }
+  return Array(a, b, c, d);
+
+}
+
+/*
+ * These functions implement the four basic operations the algorithm uses.
+ */
+function md5_cmn(q, a, b, x, s, t)
+{
+  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
+}
+function md5_ff(a, b, c, d, x, s, t)
+{
+  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
+}
+function md5_gg(a, b, c, d, x, s, t)
+{
+  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
+}
+function md5_hh(a, b, c, d, x, s, t)
+{
+  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
+}
+function md5_ii(a, b, c, d, x, s, t)
+{
+  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
+}
+
+/*
+ * Calculate the HMAC-MD5, of a key and some data
+ */
+function core_hmac_md5(key, data)
+{
+  var bkey = str2binl(key);
+  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
+
+  var ipad = Array(16), opad = Array(16);
+  for(var i = 0; i < 16; i++)
+  {
+    ipad[i] = bkey[i] ^ 0x36363636;
+    opad[i] = bkey[i] ^ 0x5C5C5C5C;
+  }
+
+  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
+  return core_md5(opad.concat(hash), 512 + 128);
+}
+
+/*
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
+ * to work around bugs in some JS interpreters.
+ */
+function safe_add(x, y)
+{
+  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+  return (msw << 16) | (lsw & 0xFFFF);
+}
+
+/*
+ * Bitwise rotate a 32-bit number to the left.
+ */
+function bit_rol(num, cnt)
+{
+  return (num << cnt) | (num >>> (32 - cnt));
+}
+
+/*
+ * Convert a string to an array of little-endian words
+ * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
+ */
+function str2binl(str)
+{
+  var bin = Array();
+  var mask = (1 << chrsz) - 1;
+  for(var i = 0; i < str.length * chrsz; i += chrsz)
+    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
+  return bin;
+}
+
+/*
+ * Convert an array of little-endian words to a string
+ */
+function binl2str(bin)
+{
+  var str = "";
+  var mask = (1 << chrsz) - 1;
+  for(var i = 0; i < bin.length * 32; i += chrsz)
+    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
+  return str;
+}
+
+/*
+ * Convert an array of little-endian words to a hex string.
+ */
+function binl2hex(binarray)
+{
+  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
+  var str = "";
+  for(var i = 0; i < binarray.length * 4; i++)
+  {
+    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
+           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
+  }
+  return str;
+}
+
+/*
+ * Convert an array of little-endian words to a base-64 string
+ */
+function binl2b64(binarray)
+{
+  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+  var str = "";
+  for(var i = 0; i < binarray.length * 4; i += 3)
+  {
+    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
+                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
+                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
+    for(var j = 0; j < 4; j++)
+    {
+      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
+      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
+    }
+  }
+  return str;
+}
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Auth.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Auth.php	(revision 10040)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Auth.php	(revision 10040)
@@ -0,0 +1,30 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Provide compatibility with previous Auth include location.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @deprecated File deprecated since Release 1.2.0
+ */
+
+/**
+ * Include Auth package
+ */
+require_once 'Auth.php';
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Controller.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Controller.php	(revision 10040)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Controller.php	(revision 10040)
@@ -0,0 +1,302 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Auth Controller
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.3.0
+ */
+
+/**
+ * Controlls access to a group of php access 
+ * and redirects to a predefined login page as 
+ * needed
+ *
+ * In all pages
+ * <code>
+ * include_once('Auth.php');
+ * include_once('Auth/Controller.php');
+ * $_auth = new Auth('File', 'passwd');
+ * $authController = new Auth_Controller($_auth, 'login.php', 'index.php');
+ * $authController->start();
+ * </code>
+ *
+ * In login.php
+ * <code>
+ * include_once('Auth.php');
+ * include_once('Auth/Controller.php');
+ * $_auth = new Auth('File', 'passwd');
+ * $authController = new Auth_Controller($_auth, 'login.php', 'index.php');
+ * $authController->start();
+ * if( $authController->isAuthorised() ){
+ *   $authController->redirectBack();
+ * }  
+ * </code>
+ *
+ * @category   Authentication
+ * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.3.0
+ */
+class Auth_Controller
+{
+
+    // {{{ properties
+
+    /** 
+     * The Auth instance this controller is managing
+     *
+     * @var object Auth
+     */
+    var $auth = null;
+    
+    /**
+     * The login URL
+     * @var string
+     * */
+    var $login = null;
+    
+    /**
+     * The default index page to use when the caller page is not set
+     *
+     * @var string 
+     */
+    var $default = null;
+    
+    /** 
+     * If this is set to true after a succesfull login the 
+     * Auth_Controller::redirectBack() is invoked automatically 
+     *
+     * @var boolean
+     */
+    var $autoRedirectBack = false;
+
+    // }}}
+    // {{{ Auth_Controller() [constructor]
+    
+    /**
+     * Constructor
+     *
+     * @param Auth An auth instance
+     * @param string The login page
+     * @param string The default page to go to if return page is not set
+     * @param array Some rules about which urls need to be sent to the login page
+     * @return void
+     * @todo Add a list of urls which need redirection
+     */
+    function Auth_Controller(&$auth_obj, $login='login.php', $default='index.php', $accessList=array())
+    {
+        $this->auth =& $auth_obj;
+        $this->_loginPage = $login;
+        $this->_defaultPage = $default;
+        @session_start();
+        if (!empty($_GET['return']) && $_GET['return'] && !strstr($_GET['return'], $this->_loginPage)) {
+            $this->auth->setAuthData('returnUrl', $_GET['return']);
+        }
+
+        if(!empty($_GET['authstatus']) && $this->auth->status == '') {
+            $this->auth->status = $_GET['authstatus'];
+        }
+    }
+
+    // }}}
+    // {{{ setAutoRedirectBack()
+    
+    /** 
+     * Enables auto redirection when login is done
+     * 
+     * @param bool Sets the autoRedirectBack flag to this
+     * @see Auth_Controller::autoRedirectBack
+     * @return void
+     */
+    function setAutoRedirectBack($flag = true)
+    {
+        $this->autoRedirectBack = $flag;
+    }
+
+    // }}}
+    // {{{ redirectBack()
+    
+    /**
+     * Redirects Back to the calling page
+     *
+     * @return void
+     */
+    function redirectBack()
+    {
+        // If redirectback go there
+        // else go to the default page
+        
+        $returnUrl = $this->auth->getAuthData('returnUrl');
+        if(!$returnUrl) {
+            $returnUrl = $this->_defaultPage;
+        }
+        
+        // Add some entropy to the return to make it unique
+        // avoind problems with cached pages and proxies
+        if(strpos($returnUrl, '?') === false) {
+            $returnUrl .= '?';
+        }
+        $returnUrl .= uniqid('');
+
+        // Track the auth status
+        if($this->auth->status != '') {
+            $url .= '&authstatus='.$this->auth->status;
+        }        
+        header('Location:'.$returnUrl);
+        print("You could not be redirected to <a href=\"$returnUrl\">$returnUrl</a>");
+    }
+
+    // }}}
+    // {{{ redirectLogin()
+    
+    /**
+      * Redirects to the login Page if not authorised
+      * 
+      * put return page on the query or in auth
+      *
+      * @return void
+      */
+    function redirectLogin()
+    {
+        // Go to the login Page
+        
+        // For Auth, put some check to avoid infinite redirects, this should at least exclude
+        // the login page
+        
+        $url = $this->_loginPage;
+        if(strpos($url, '?') === false) {
+            $url .= '?';
+        }
+
+        if(!strstr($_SERVER['PHP_SELF'], $this->_loginPage)) {
+            $url .= 'return='.urlencode($_SERVER['PHP_SELF']);
+        }
+
+        // Track the auth status
+        if($this->auth->status != '') {
+            $url .= '&authstatus='.$this->auth->status;
+        }
+
+        header('Location:'.$url);
+        print("You could not be redirected to <a href=\"$url\">$url</a>");
+    }
+
+    // }}}
+    // {{{ start()
+    
+    /**
+      * Starts the Auth Procedure
+      *
+      * If the page requires login the user is redirected to the login page
+      * otherwise the Auth::start is called to initialize Auth
+      *
+      * @return void
+      * @todo Implement an access list which specifies which urls/pages need login and which do not
+      */
+    function start()
+    {
+        // Check the accessList here
+        // ACL should be a list of urls with allow/deny
+        // If allow set allowLogin to false
+        // Some wild card matching should be implemented ?,*
+        if(!strstr($_SERVER['PHP_SELF'], $this->_loginPage) && !$this->auth->checkAuth()) {
+            $this->redirectLogin();
+        } else {
+            $this->auth->start();
+            // Logged on and on login page
+            if(strstr($_SERVER['PHP_SELF'], $this->_loginPage) && $this->auth->checkAuth()){
+                $this->autoRedirectBack ? 
+                    $this->redirectBack() :
+                    null ;
+            }
+        }
+        
+        
+    }
+
+    // }}}
+    // {{{ isAuthorised()
+  
+    /**
+      * Checks is the user is logged on
+      * @see Auth::checkAuth()
+      */
+    function isAuthorised()
+    {
+        return($this->auth->checkAuth());
+    }
+
+    // }}}
+    // {{{ checkAuth()
+
+    /**
+      * Proxy call to auth
+      * @see Auth::checkAuth()
+      */
+    function checkAuth()
+    {
+        return($this->auth->checkAuth());
+    }
+
+    // }}}
+    // {{{ logout()
+
+    /**
+      * Proxy call to auth
+      * @see Auth::logout()
+      */
+    function logout()
+    {
+        return($this->auth->logout());
+    }
+
+    // }}}
+    // {{{ getUsername()
+
+    /**
+      * Proxy call to auth
+      * @see Auth::getUsername()
+      */
+    function getUsername()
+    {
+        return($this->auth->getUsername());
+    }
+
+    // }}}
+    // {{{ getStatus()
+
+    /**
+      * Proxy call to auth
+      * @see Auth::getStatus()
+      */
+    function getStatus()
+    {
+        return($this->auth->getStatus());
+    }
+
+    // }}}
+
+}
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Anonymous.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Anonymous.php	(revision 10040)
+++ /branches/mobile/html/test/kakinaka/pear/Auth/Auth/Anonymous.php	(revision 10040)
@@ -0,0 +1,138 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * Anonymous authentication support
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ * @since      File available since Release 1.3.0
+ */
+
+/**
+ * Include Auth package
+ */
+require_once 'Auth.php';
+
+/**
+ * Anonymous Authentication
+ * 
+ * This class provides anonymous authentication if username and password 
+ * were not supplied
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Yavor Shahpasov <yavo@netsmart.com.cy>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ * @since      Class available since Release 1.3.0
+ */
+class Auth_Anonymous extends Auth 
+{
+
+    // {{{ properties
+
+    /**
+     * Whether to allow anonymous authentication
+     *
+     * @var boolean
+     */
+    var $allow_anonymous = true;
+
+    /**
+     * Username to use for anonymous user
+     *
+     * @var string
+     */
+    var $anonymous_username = 'anonymous';
+
+    // }}}
+    // {{{ Auth_Anonymous() [constructor]
+    
+    /**
+     * Pass all parameters to Parent Auth class
+     * 
+     * Set up the storage driver.
+     *
+     * @param string    Type of the storage driver
+     * @param mixed     Additional options for the storage driver
+     *                  (example: if you are using DB as the storage
+     *                   driver, you have to pass the dsn string here)
+     *
+     * @param string    Name of the function that creates the login form
+     * @param boolean   Should the login form be displayed if neccessary?
+     * @return void
+     * @see Auth::Auth()
+     */
+    function Auth_Anonymous($storageDriver, $options = '', $loginFunction = '', $showLogin = true) {
+        parent::Auth($storageDriver, $options, $loginFunction, $showLogin);
+    }
+
+    // }}}
+    // {{{ login()
+    
+    /**
+     * Login function
+     * 
+     * If no username & password is passed then login as the username
+     * provided in $this->anonymous_username else call standard login()
+     * function.
+     *
+     * @return void
+     * @access private
+     * @see Auth::login()
+     */
+    function login() {
+        if (   $this->allow_anonymous 
+            && empty($this->username) 
+            && empty($this->password) ) {
+            $this->setAuth($this->anonymous_username);
+            if (is_callable($this->loginCallback)) {
+                call_user_func_array($this->loginCallback, array($this->username, $this) );
+            }
+        } else {
+            // Call normal login system
+            parent::login();
+        }
+    }
+
+    // }}}
+    // {{{ forceLogin()
+    
+    /**
+     * Force the user to login
+     *
+     * Calling this function forces the user to provide a real username and
+     * password before continuing.
+     *
+     * @return void
+     */
+    function forceLogin() {
+        $this->allow_anonymous = false;
+        if( !empty($this->session['username']) && $this->session['username'] == $this->anonymous_username ) {
+            $this->logout();
+        }
+    }
+
+    // }}}
+
+}
+
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth_HTTP.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth_HTTP.php	(revision 10044)
+++ /branches/mobile/html/test/kakinaka/pear/Auth_HTTP.php	(revision 10044)
@@ -0,0 +1,795 @@
+<?php
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2004 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Martin Jansen <mj@php.net>                                  |
+// |          Rui Hirokawa <hirokawa@php.net>                             |
+// |          David Costa  <gurugeek@php.net>                             |
+// +----------------------------------------------------------------------+
+//
+//  $Id$ 
+//
+
+require_once "Auth.php";
+
+define('AUTH_HTTP_NONCE_TIME_LEN', 16);
+define('AUTH_HTTP_NONCE_HASH_LEN', 32);
+
+// {{{ class Auth_HTTP
+
+/**
+ * PEAR::Auth_HTTP
+ *
+ * The PEAR::Auth_HTTP class provides methods for creating an
+ * HTTP authentication system based on RFC-2617 using PHP.
+ *
+ * Instead of generating an HTML driven form like PEAR::Auth
+ * does, this class sends header commands to the clients which
+ * cause them to present a login box like they are e.g. used
+ * in Apache's .htaccess mechanism.
+ *
+ * This class requires the PEAR::Auth package.
+ *
+ * @notes The HTTP Digest Authentication part is based on
+ *  authentication class written by Tom Pike <tom.pike@xiven.com>
+ *
+ * @author  Martin Jansen <mj@php.net>
+ * @author  Rui Hirokawa <hirokawa@php.net>
+ * @author  David Costa <gurugeek@php.net>
+ * @package Auth_HTTP
+ * @extends Auth
+ * @version $Revision$
+ */
+class Auth_HTTP extends Auth
+{
+   
+    // {{{ properties
+
+    /**
+     * Authorization method: 'basic' or 'digest'
+     *
+     * @access public
+     * @var    string
+     */
+    var $authType = 'basic';
+ 
+    /**
+     * Name of the realm for Basic Authentication
+     *
+     * @access public
+     * @var    string
+     * @see    drawLogin()
+     */
+    var $realm = "protected area";
+
+    /**
+     * Text to send if user hits cancel button
+     *
+     * @access public
+     * @var    string
+     * @see    drawLogin()
+     */
+    var $CancelText = "Error 401 - Access denied";
+
+    /**
+     * option array
+     *
+     * @access public
+     * @var    array
+     */
+    var $options = array();
+
+    /**
+     * flag to indicate the nonce was stale. 
+     *
+     * @access public
+     * @var    bool
+     */
+    var $stale = false;
+
+    /**
+     * opaque string for digest authentication
+     *
+     * @access public
+     * @var    string
+     */
+    var $opaque = 'dummy';
+
+    /**
+     * digest URI
+     *
+     * @access public
+     * @var    string
+     */
+    var $uri = '';
+
+    /**
+     * authorization info returned by the client
+     *
+     * @access public
+     * @var    array
+     */
+    var $auth = array();
+
+    /**
+     * next nonce value
+     *
+     * @access public
+     * @var    string
+     */
+    var $nextNonce = '';
+
+    /**
+     * nonce value
+     *
+     * @access public
+     * @var    string
+     */
+    var $nonce = '';
+
+    /**
+     * Holds a reference to the global server variable
+     * @var array
+     */
+    var $server;
+
+    /**
+     * Holds a reference to the global post variable
+     * @var array
+     */
+    var $post;
+
+    /**
+     * Holds a reference to the global cookie variable
+     * @var array
+     */
+    var $cookie;
+
+
+    // }}}
+    // {{{ Constructor
+
+    /**
+     * Constructor
+     *
+     * @param string    Type of the storage driver
+     * @param mixed     Additional options for the storage driver
+     *                  (example: if you are using DB as the storage
+     *                   driver, you have to pass the dsn string here)
+     *
+     * @return void
+     */
+    function Auth_HTTP($storageDriver, $options = '') 
+    {
+        /* set default values for options */
+        $this->options = array('cryptType' => 'md5',
+                               'algorithm' => 'MD5',
+                               'qop' => 'auth-int,auth',
+                               'opaquekey' => 'moo',
+                               'noncekey' => 'moo',
+                               'digestRealm' => 'protected area',
+                               'forceDigestOnly' => false,
+                               'nonceLife' => 300,
+                               'sessionSharing' => true,
+                               );
+		
+        if (!empty($options['authType'])) {
+            $this->authType = strtolower($options['authType']);
+        }
+		
+        if (is_array($options)) {
+            foreach($options as $key => $value) {
+                if (array_key_exists( $key, $this->options)) {
+                    $this->options[$key] = $value;
+                }
+            }
+		
+            if (!empty($this->options['opaquekey'])) {
+                $this->opaque = md5($this->options['opaquekey']);
+            }
+        }
+		
+		$this->Auth($storageDriver, $options);
+	}
+	
+	// }}}
+    // {{{ assignData()
+
+    /**
+     * Assign values from $PHP_AUTH_USER and $PHP_AUTH_PW or 'Authorization' header
+     * to internal variables and sets the session id based
+     * on them
+     *
+     * @access public
+     * @return void
+     */
+    function assignData()
+    {
+        if (method_exists($this, '_importGlobalVariable')) {
+            $this->server = &$this->_importGlobalVariable('server');
+        }
+        
+        
+        if ($this->authType == 'basic') {
+            if (!empty($this->server['PHP_AUTH_USER'])) {
+                $this->username = $this->server['PHP_AUTH_USER'];
+            }
+            
+            if (!empty($this->server['PHP_AUTH_PW'])) {
+                $this->password = $this->server['PHP_AUTH_PW'];
+            }
+            
+            /**
+             * Try to get authentication information from IIS
+             */
+            if  (empty($this->username) && empty($this->password)) {
+                if (!empty($this->server['HTTP_AUTHORIZATION'])) {
+                    list($this->username, $this->password) = 
+                        explode(':', base64_decode(substr($this->server['HTTP_AUTHORIZATION'], 6)));
+                }
+            }
+        } elseif ($this->authType == 'digest') {
+            $this->username = '';
+            $this->password = '';
+
+            $this->digest_header = null;
+            if (!empty($this->server['PHP_AUTH_DIGEST'])) {
+                $this->digest_header = substr($this->server['PHP_AUTH_DIGEST'],
+                                              strpos($this->server['PHP_AUTH_DIGEST'],' ')+1);
+            } else {
+                $headers = getallheaders();
+                if(isset($headers['Authorization']) && !empty($headers['Authorization'])) {
+                    $this->digest_header = substr($headers['Authorization'],
+                                                  strpos($headers['Authorization'],' ')+1);
+                }
+            }
+
+            if($this->digest_header) {
+                $authtemp = explode(',', $this->digest_header);
+                $auth = array();
+                foreach($authtemp as $key => $value) {
+                    $value = trim($value);
+                    if(strpos($value,'=') !== false) {
+                        $lhs = substr($value,0,strpos($value,'='));
+                        $rhs = substr($value,strpos($value,'=')+1);
+                        if(substr($rhs,0,1) == '"' && substr($rhs,-1,1) == '"') {
+                            $rhs = substr($rhs,1,-1);
+                        }
+                        $auth[$lhs] = $rhs;
+                    }
+                }
+            }
+            if (!isset($auth['uri']) || !isset($auth['realm'])) {
+                return;
+            }
+            
+            if ($this->selfURI() == $auth['uri']) {
+                $this->uri = $auth['uri'];
+                if (substr($headers['Authorization'],0,7) == 'Digest ') {
+                    
+                    $this->authType = 'digest';
+
+                    if (!isset($auth['nonce']) || !isset($auth['username']) || 
+                  !isset($auth['response']) || !isset($auth['qop']) || 
+                  !isset($auth['nc']) || !isset($auth['cnonce'])){
+                        return;
+                    }
+
+               if ($auth['qop'] != 'auth' && $auth['qop'] != 'auth-int') {
+                        return;
+               }
+                    
+                    $this->stale = $this->_judgeStale($auth['nonce']);
+
+               if ($this->nextNonce == false) {
+                  return;
+               }
+
+                    $this->username = $auth['username'];
+                    $this->password = $auth['response'];
+                    $this->auth['nonce'] = $auth['nonce'];
+                    
+               $this->auth['qop'] = $auth['qop'];
+               $this->auth['nc'] = $auth['nc'];
+               $this->auth['cnonce'] = $auth['cnonce'];
+
+                    if (isset($auth['opaque'])) {
+                        $this->auth['opaque'] = $auth['opaque'];
+                    }
+                    
+                } elseif (substr($headers['Authorization'],0,6) == 'Basic ') {
+                    if ($this->options['forceDigestOnly']) {
+                        return; // Basic authentication is not allowed.
+                    }
+                    
+                    $this->authType = 'basic';
+                    list($username, $password) = 
+                        explode(':',base64_decode(substr($headers['Authorization'],6)));
+                    $this->username = $username;
+                    $this->password = $password;
+                }
+            }
+        } else {
+            return PEAR::raiseError('authType is invalid.');
+        }
+
+        if ($this->options['sessionSharing'] && 
+            isset($this->username) && isset($this->password)) {
+            session_id(md5('Auth_HTTP' . $this->username . $this->password));
+        }
+        
+        /**
+         * set sessionName for AUTH, so that the sessionName is different 
+         * for distinct realms 
+         */
+         $this->_sessionName = "_authhttp".md5($this->realm);
+    }
+
+    // }}}
+    // {{{ login()
+
+    /**
+     * Login function
+     *
+     * @access private
+     * @return void
+     */
+    function login() 
+    {
+        $login_ok = false;
+        if (method_exists($this, '_loadStorage')) {
+            $this->_loadStorage();
+        }
+        $this->storage->_auth_obj->_sessionName =& $this->_sessionName;
+
+        /**
+         * When the user has already entered a username,
+         * we have to validate it.
+         */
+        if (!empty($this->username) && !empty($this->password)) {
+            if ($this->authType == 'basic' && !$this->options['forceDigestOnly']) {
+                if (true === $this->storage->fetchData($this->username, $this->password)) {
+                    $login_ok = true;
+                }
+            } else { /* digest authentication */
+
+                if (!$this->getAuth() || $this->getAuthData('a1') == null) {
+                    /* 
+                     * note:
+                     *  - only PEAR::DB is supported as container.
+                     *  - password should be stored in container as plain-text 
+                     *    (if $options['cryptType'] == 'none') or 
+                     *     A1 hashed form (md5('username:realm:password')) 
+                     *    (if $options['cryptType'] == 'md5')
+                     */
+                    $dbs = $this->storage;
+                    if (!DB::isConnection($dbs->db)) {
+                        $dbs->_connect($dbs->options['dsn']);
+                    }
+                    
+                    $query = 'SELECT '.$dbs->options['passwordcol']." FROM ".$dbs->options['table'].
+                        ' WHERE '.$dbs->options['usernamecol']." = '".
+                        $dbs->db->quoteString($this->username)."' ";
+                    
+                    $pwd = $dbs->db->getOne($query); // password stored in container.
+                    
+                    if (DB::isError($pwd)) {
+                        return PEAR::raiseError($pwd->getMessage(), $pwd->getCode());
+                    }
+                    
+                    if ($this->options['cryptType'] == 'none') {
+                        $a1 = md5($this->username.':'.$this->options['digestRealm'].':'.$pwd);
+                    } else {
+                        $a1 = $pwd;
+                    }
+                    
+                    $this->setAuthData('a1', $a1, true);
+                } else {
+                    $a1 = $this->getAuthData('a1');
+                }
+                
+                $login_ok = $this->validateDigest($this->password, $a1);
+                if ($this->nextNonce == false) {
+                    $login_ok = false;
+                }
+            }
+            
+            if (!$login_ok && is_callable($this->loginFailedCallback)) {
+                call_user_func($this->loginFailedCallback,$this->username, $this);
+            }
+        }
+        
+        if (!empty($this->username) && $login_ok) {
+            $this->setAuth($this->username);
+            if (is_callable($this->loginCallback)) {
+                call_user_func($this->loginCallback,$this->username, $this);
+            }
+        }
+        
+        /**
+         * If the login failed or the user entered no username,
+         * output the login screen again.
+         */
+        if (!empty($this->username) && !$login_ok) {
+            $this->status = AUTH_WRONG_LOGIN;
+        }
+        
+        if ((empty($this->username) || !$login_ok) && $this->showLogin) {
+            $this->drawLogin($this->storage->activeUser);
+            return;
+        }
+
+      if (!empty($this->username) && $login_ok && $this->authType == 'digest'
+         && $this->auth['qop'] == 'auth') { 
+         $this->authenticationInfo();
+      }
+    }
+    
+    // }}}
+    // {{{ drawLogin()
+
+    /**
+     * Launch the login box
+     *
+     * @param  string $username  Username
+     * @return void
+     * @access private
+     */
+    function drawLogin($username = "")
+    {
+        /**
+         * Send the header commands
+         */
+        if ($this->authType == 'basic') {
+            header("WWW-Authenticate: Basic realm=\"".$this->realm."\"");
+            header('HTTP/1.0 401 Unauthorized');            
+        } else if ($this->authType == 'digest') {
+            $this->nonce = $this->_getNonce();
+
+            $wwwauth = 'WWW-Authenticate: Digest ';
+            $wwwauth .= 'qop="'.$this->options['qop'].'", ';
+            $wwwauth .= 'algorithm='.$this->options['algorithm'].', ';
+            $wwwauth .= 'realm="'.$this->options['digestRealm'].'", ';
+            $wwwauth .= 'nonce="'.$this->nonce.'", ';
+            if ($this->stale) {
+                $wwwauth .= 'stale=true, ';
+            }
+            if (!empty($this->opaque)) {
+                $wwwauth .= 'opaque="'.$this->opaque.'"' ;
+            }
+            $wwwauth .= "\r\n";
+            if (!$this->options['forceDigestOnly']) {
+                $wwwauth .= 'WWW-Authenticate: Basic realm="'.$this->realm.'"';
+            }
+            header($wwwauth);
+            header('HTTP/1.0 401 Unauthorized');            
+        }
+
+        /**
+         * This code is only executed if the user hits the cancel
+         * button or if he enters wrong data 3 times.
+         */
+        if ($this->stale) {
+            echo 'Stale nonce value, please re-authenticate.';
+        } else {
+            echo $this->CancelText;
+        }
+        exit;
+    }
+
+    // }}}
+    // {{{ setRealm()
+
+    /**
+     * Set name of the current realm
+     *
+     * @access public
+     * @param  string $realm  Name of the realm
+     * @param  string $digestRealm  Name of the realm for digest authentication
+     * @return void
+     */
+    function setRealm($realm, $digestRealm = '')
+    {
+        $this->realm = $realm;
+        if (!empty($digestRealm)) {
+            $this->options['digestRealm'] = $digestRealm;
+        }
+    }
+
+    // }}}
+    // {{{ setCancelText()
+
+    /**
+     * Set the text to send if user hits the cancel button
+     *
+     * @access public
+     * @param  string $text  Text to send
+     * @return void
+     */
+    function setCancelText($text)
+    {
+        $this->CancelText = $text;
+    }
+
+    // }}}
+    // {{{ validateDigest()
+    
+    /**
+     * judge if the client response is valid.
+     *
+     * @access private
+     * @param  string $response  client response
+     * @param  string $a1 password or hashed password stored in container
+     * @return bool true if success, false otherwise
+     */
+    function validateDigest($response, $a1)    
+    {
+        if (method_exists($this, '_importGlobalVariable')) {
+            $this->server = &$this->_importGlobalVariable('server');
+        }
+
+        $a2unhashed = $this->server['REQUEST_METHOD'].":".$this->selfURI();
+        if($this->auth['qop'] == 'auth-int') {
+            if(isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
+                // In PHP < 4.3 get raw POST data from this variable
+                $body = $GLOBALS["HTTP_RAW_POST_DATA"];
+            } else if($lines = @file('php://input')) {
+                // In PHP >= 4.3 get raw POST data from this file
+                $body = implode("\n", $lines);
+            } else {
+                if (method_exists($this, '_importGlobalVariable')) {
+                    $this->post = &$this->_importGlobalVariable('post');
+                }
+                $body = '';
+                foreach($this->post as $key => $value) {
+                    if($body != '') $body .= '&';
+                    $body .= rawurlencode($key) . '=' . rawurlencode($value);
+                }
+            }
+
+            $a2unhashed .= ':'.md5($body);
+        }
+        
+        $a2 = md5($a2unhashed);
+        $combined = $a1.':'.
+            $this->auth['nonce'].':'.
+            $this->auth['nc'].':'.
+            $this->auth['cnonce'].':'.
+            $this->auth['qop'].':'.
+            $a2;
+        $expectedResponse = md5($combined);
+        
+        if(!isset($this->auth['opaque']) || $this->auth['opaque'] == $this->opaque) {
+            if($response == $expectedResponse) { // password is valid
+                if(!$this->stale) {
+                    return true;
+                } else {
+                    $this->drawLogin();
+                }
+            }
+        }
+        
+        return false;
+    }
+    
+    // }}}
+    // {{{ _judgeStale()
+    
+    /**
+     * judge if nonce from client is stale.
+     *
+     * @access private
+     * @param  string $nonce  nonce value from client
+     * @return bool stale
+     */
+    function _judgeStale($nonce) 
+    {
+        $stale = false;
+        
+        if(!$this->_decodeNonce($nonce, $time, $hash_cli)) {
+         $this->nextNonce = false;
+         $stale = true;
+            return $stale;
+        }
+
+        if ($time < time() - $this->options['nonceLife']) {
+         $this->nextNonce = $this->_getNonce();
+            $stale = true;
+        } else {
+         $this->nextNonce = $nonce;
+      }
+
+        return $stale;
+    }
+    
+    // }}}
+    // {{{ _nonceDecode()
+    
+    /**
+     * decode nonce string
+     *
+     * @access private
+     * @param  string $nonce nonce value from client
+     * @param  string $time decoded time
+     * @param  string $hash decoded hash
+     * @return bool false if nonce is invalid
+     */
+    function _decodeNonce($nonce, &$time, &$hash) 
+    {
+        if (method_exists($this, '_importGlobalVariable')) {
+            $this->server = &$this->_importGlobalVariable('server');
+        }
+
+        if (strlen($nonce) != AUTH_HTTP_NONCE_TIME_LEN + AUTH_HTTP_NONCE_HASH_LEN) {
+            return false;
+        }
+
+        $time =  base64_decode(substr($nonce, 0, AUTH_HTTP_NONCE_TIME_LEN));
+        $hash_cli = substr($nonce, AUTH_HTTP_NONCE_TIME_LEN, AUTH_HTTP_NONCE_HASH_LEN);
+
+        $hash = md5($time . $this->server['HTTP_USER_AGENT'] . $this->options['noncekey']);
+
+        if ($hash_cli != $hash) {
+            return false;
+        }
+        
+        return true;
+    }
+
+    // }}}
+    // {{{ _getNonce()
+    
+    /**
+     * return nonce to detect timeout
+     *
+     * @access private
+     * @return string nonce value
+     */
+    function _getNonce() 
+    {
+        if (method_exists($this, '_importGlobalVariable')) {
+            $this->server = &$this->_importGlobalVariable('server');
+        }
+
+        $time = time();
+        $hash = md5($time . $this->server['HTTP_USER_AGENT'] . $this->options['noncekey']);
+
+        return base64_encode($time) . $hash;  
+    }
+
+    // }}}
+    // {{{ authenticationInfo()
+    
+    /**
+     * output HTTP Authentication-Info header
+     *
+     * @notes md5 hash of contents is required if 'qop' is 'auth-int'
+     *
+     * @access private
+     * @param string MD5 hash of content
+     */
+    function authenticationInfo($contentMD5 = '') {
+        
+        if($this->getAuth() && ($this->getAuthData('a1') != null)) {
+            $a1 = $this->getAuthData('a1');
+
+            // Work out authorisation response
+            $a2unhashed = ":".$this->selfURI();
+            if($this->auth['qop'] == 'auth-int') {
+                $a2unhashed .= ':'.$contentMD5;
+            }
+            $a2 = md5($a2unhashed);
+            $combined = $a1.':'.
+                        $this->nonce.':'.
+                        $this->auth['nc'].':'.
+                        $this->auth['cnonce'].':'.
+                        $this->auth['qop'].':'.
+                        $a2;
+            
+            // Send authentication info
+            $wwwauth = 'Authentication-Info: ';
+            if($this->nonce != $this->nextNonce) {
+                $wwwauth .= 'nextnonce="'.$this->nextNonce.'", ';
+            }
+            $wwwauth .= 'qop='.$this->auth['qop'].', ';
+            $wwwauth .= 'rspauth="'.md5($combined).'", ';
+            $wwwauth .= 'cnonce="'.$this->auth['cnonce'].'", ';
+            $wwwauth .= 'nc='.$this->auth['nc'].'';
+            header($wwwauth);
+        }
+    }
+    // }}}
+    // {{{ setOption()
+    /**
+     * set authentication option
+     *
+     * @access public
+     * @param mixed $name key of option
+     * @param mixed $value value of option
+     * @return void
+     */
+    function setOption($name, $value = null) 
+    {
+        if (is_array($name)) {
+            foreach($name as $key => $value) {
+                if (array_key_exists( $key, $this->options)) {
+                    $this->options[$key] = $value;
+                }
+            }
+        } else {
+            if (array_key_exists( $name, $this->options)) {
+                    $this->options[$name] = $value;
+            }
+        }
+    }
+
+    // }}}
+    // {{{ getOption()
+    /**
+     * get authentication option
+     *
+     * @access public
+     * @param string $name key of option
+     * @return mixed option value
+     */
+    function getOption($name) 
+    {
+        if (array_key_exists( $name, $this->options)) {
+            return $this->options[$name];
+        }
+        if ($name == 'CancelText') {
+            return $this->CancelText;
+        }
+        if ($name == 'Realm') {
+            return $this->realm;
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ selfURI()
+    /**
+     * get self URI
+     *
+     * @access public
+     * @return string self URI
+     */
+    function selfURI() 
+    {
+        if (method_exists($this, '_importGlobalVariable')) {
+            $this->server = &$this->_importGlobalVariable('server');
+        }
+
+        if (preg_match("/MSIE/",$this->server['HTTP_USER_AGENT'])) {
+            // query string should be removed for MSIE
+            $uri = preg_replace("/^(.*)\?/","\\1",$this->server['REQUEST_URI']);
+        } else {
+            $uri = $this->server['REQUEST_URI'];
+        }
+        return $uri;
+    }
+
+    // }}}
+
+}
+
+// }}}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+?>
Index: /branches/mobile/html/test/kakinaka/pear/Auth.php
===================================================================
--- /branches/mobile/html/test/kakinaka/pear/Auth.php	(revision 10043)
+++ /branches/mobile/html/test/kakinaka/pear/Auth.php	(revision 10043)
@@ -0,0 +1,1079 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
+
+/**
+ * The main include file for Auth package
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.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   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/Auth
+ */
+
+/**
+ * Returned if session exceeds idle time
+ */
+define('AUTH_IDLED',                    -1);
+/**
+ * Returned if session has expired
+ */
+define('AUTH_EXPIRED',                  -2);
+/** 
+ * Returned if container is unable to authenticate user/password pair
+ */
+define('AUTH_WRONG_LOGIN',              -3);
+/**
+ * Returned if a container method is not supported.
+ */
+define('AUTH_METHOD_NOT_SUPPORTED',     -4);
+/**
+ * Returned if new Advanced security system detects a breach
+ */
+define('AUTH_SECURITY_BREACH',          -5);
+
+/**
+ * PEAR::Auth
+ *
+ * The PEAR::Auth class provides methods for creating an
+ * authentication system using PHP.
+ *
+ * @category   Authentication
+ * @package    Auth
+ * @author     Martin Jansen <mj@php.net>
+ * @author     Adam Ashley <aashley@php.net>
+ * @copyright  2001-2006 The PHP Group
+ * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
+ * @version    Release: 1.4.2  File: $Revision$
+ * @link       http://pear.php.net/package/Auth
+ */
+class Auth {
+
+    // {{{ properties
+
+    /**
+     * Auth lifetime in seconds
+     *
+     * If this variable is set to 0, auth never expires
+     *
+     * @var  integer
+     * @see  setExpire(), checkAuth()
+     */
+    var $expire = 0;
+
+    /**
+     * Has the auth session expired?
+     *
+     * @var   bool
+     * @see   checkAuth()
+     */
+    var $expired = false;
+
+    /**
+     * Maximum idletime in seconds
+     *
+     * The difference to $expire is, that the idletime gets
+     * refreshed each time checkAuth() is called. If this
+     * variable is set to 0, idletime is never checked.
+     *
+     * @var integer
+     * @see setIdle(), checkAuth()
+     */
+    var $idle = 0;
+
+    /**
+     * Is the maximum idletime over?
+     *
+     * @var boolean
+     * @see checkAuth()
+     */
+    var $idled = false;
+
+    /**
+     * Storage object
+     *
+     * @var object
+     * @see Auth(), validateLogin()
+     */
+    var $storage = '';
+
+    /**
+     * User-defined function that creates the login screen
+     *
+     * @var string
+     */
+    var $loginFunction = '';
+
+    /**
+     * Should the login form be displayed
+     *
+     * @var   bool
+     * @see   setShowlogin()
+     */
+    var $showLogin = true;
+    
+    /**
+      * Is Login Allowed from this page
+      *
+      * @var  bool
+      * @see setAllowLogin
+      */
+    var $allowLogin = true;
+
+    /**
+     * Current authentication status
+     *
+     * @var string
+     */
+    var $status = '';
+
+    /**
+     * Username
+     *
+     * @var string
+     */
+    var $username = '';
+
+    /**
+     * Password
+     *
+     * @var string
+     */
+    var $password = '';
+
+    /**
+     * Login callback function name
+     *
+     * @var string
+     * @see setLoginCallback()
+     */
+    var $loginCallback = '';
+
+    /**
+     * Failed Login callback function name
+     *
+     * @var string
+     * @see setFailedLoginCallback()
+     */
+    var $loginFailedCallback = '';
+
+    /**
+     * Logout callback function name
+     *
+     * @var string
+     * @see setLogoutCallback()
+     */
+    var $logoutCallback = '';
+
+    /**
+     * Auth session-array name
+     *
+     * @var string
+     */
+    var $_sessionName = '_authsession';
+
+    /**
+     * Package Version
+     *
+     * @var string
+     */
+    var $version = "@version@";
+
+    /**
+     * Flag to use advanced security
+     * When set extra checks will be made to see if the 
+     * user's IP or useragent have changed across requests. 
+     * Turned off by default to preserve BC.
+     *
+     * @var boolean
+     */     
+    var $advancedsecurity = false;
+
+    /**
+     * Username key in POST array
+     *
+     * @var string
+     */
+    var $_postUsername = 'username';
+
+    /**
+     * Password key in POST array
+     *
+     * @var string
+     */
+    var $_postPassword = 'password';
+
+    /**
+     * Holds a reference to the session auth variable
+     * @var array
+     */
+    var $session;
+
+    /**
+     * Holds a reference to the global server variable
+     * @var array
+     */
+    var $server;
+
+    /**
+     * Holds a reference to the global post variable
+     * @var array
+     */
+    var $post;
+
+    /**
+     * Holds a reference to the global cookie variable
+     * @var array
+     */
+    var $cookie;
+
+    /**
+     * A hash to hold various superglobals as reference
+     * @var array
+     */
+    var $authdata;
+    
+    /**
+      * How many times has checkAuth been called
+      * var int
+      */
+    var $authChecks = 0;
+
+    // }}}
+    // {{{ Auth() [constructor]
+
+    /**
+     * Constructor
+     *
+     * Set up the storage driver.
+     *
+     * @param string    Type of the storage driver
+     * @param mixed     Additional options for the storage driver
+     *                  (example: if you are using DB as the storage
+     *                   driver, you have to pass the dsn string here)
+     *
+     * @param string    Name of the function that creates the login form
+     * @param boolean   Should the login form be displayed if neccessary?
+     * @return void
+     */
+    function Auth($storageDriver, $options = '', $loginFunction = '', $showLogin = true)
+    {
+        $this->applyAuthOptions($options);
+
+        // Start the session suppress error if already started
+        if(!session_id()){
+            @session_start();
+            if(!session_id()) {
+                // Throw error
+                include_once 'PEAR.php';
+                PEAR::throwError('Session could not be started by Auth, '
+                        .'possibly headers are already sent, try putting '
+                        .'ob_start in the beginning of your script');
+            }
+        }
+
+        // Make Sure Auth session variable is there
+        if(!isset($_SESSION[$this->_sessionName])) {
+            $_SESSION[$this->_sessionName] = array();
+        }
+
+        // Assign Some globals to internal references, this will replace _importGlobalVariable
+        $this->session =& $_SESSION[$this->_sessionName];
+        $this->server =& $_SERVER;
+        $this->post =& $_POST;
+        $this->cookie =& $_COOKIE;
+
+        if ($loginFunction != '' && is_callable($loginFunction)) {
+            $this->loginFunction = $loginFunction;
+        }
+
+        if (is_bool($showLogin)) {
+            $this->showLogin = $showLogin;
+        }
+
+        if (is_object($storageDriver)) {
+            $this->storage =& $storageDriver;
+            // Pass a reference to auth to the container, ugly but works
+            // this is used by the DB container to use method setAuthData not staticaly.
+            $this->storage->_auth_obj =& $this;
+        } else {
+            // $this->storage = $this->_factory($storageDriver, $options);
+            // 
+            $this->storage_driver = $storageDriver;
+            $this->storage_options =& $options;
+        }
+    }
+
+    // }}}
+    // {{{ applyAuthOptions()
+
+    /**
+      * Set the Auth options 
+      *
+      * Some options which are Auth specific will be applied
+      * the rest will be left for usage by the container
+      * 
+      * @param array    An array of Auth options
+      * @return array   The options which were not applied
+      * @access private
+      */
+    function &applyAuthOptions(&$options)
+    {
+        if(is_array($options)){
+            if (!empty($options['sessionName'])) {
+                $this->_sessionName = $options['sessionName'];
+                unset($options['sessionName']);
+            }
+            if (isset($options['allowLogin'])) {
+                $this->allowLogin = $options['allowLogin'];
+                unset($options['allowLogin']);
+            }
+            if (!empty($options['postUsername'])) {
+                $this->_postUsername = $options['postUsername'];
+                unset($options['postUsername']);
+            }
+            if (!empty($options['postPassword'])) {
+                $this->_postPassword = $options['postPassword'];
+                unset($options['postPassword']);
+            }
+            if (isset($options['advancedsecurity'])) {
+                $this->advancedsecurity = $options['advancedsecurity'];
+                unset($options['advancedsecurity']);
+            }
+        }
+        return($options);
+    }
+
+    // }}}
+    // {{{ _loadStorage()
+    
+    /**
+      * Load Storage Driver if not already loaded
+      *
+      * Suspend storage instantiation to make Auth lighter to use 
+      * for calls which do not require login
+      *
+      * @return bool    True if the conainer is loaded, false if the container
+      *                 is already loaded
+      * @access private
+      */
+    function _loadStorage()
+    {
+        if(!is_object($this->storage)) {
+            $this->storage =& $this->_factory($this->storage_driver, 
+                    $this->storage_options);
+            $this->storage->_auth_obj =& $this;
+            return(true);
+        }
+        return(false);
+    }
+
+    // }}}
+    // {{{ _factory()
+
+    /**
+     * Return a storage driver based on $driver and $options
+     *
+     * @static
+     * @param  string $driver  Type of storage class to return
+     * @param  string $options Optional parameters for the storage class
+     * @return object Object   Storage object
+     * @access private
+     */
+    function &_factory($driver, $options = '')
+    {
+        $storage_class = 'Auth_Container_' . $driver;
+        include_once 'Auth/Container/' . $driver . '.php';
+        $obj =& new $storage_class($options);
+        return $obj;
+    }
+
+    // }}}
+    // {{{ assignData()
+
+    /**
+     * Assign data from login form to internal values
+     *
+     * This function takes the values for username and password
+     * from $HTTP_POST_VARS/$_POST and assigns them to internal variables.
+     * If you wish to use another source apart from $HTTP_POST_VARS/$_POST,
+     * you have to derive this function.
+     *
+     * @global $HTTP_POST_VARS, $_POST
+     * @see    Auth
+     * @return void
+     * @access private
+     */
+    function assignData()
+    {
+        if (   isset($this->post[$this->_postUsername]) 
+            && $this->post[$this->_postUsername] != '') {
+            $this->username = (get_magic_quotes_gpc() == 1 
+                    ? stripslashes($this->post[$this->_postUsername]) 
+                    : $this->post[$this->_postUsername]);
+        }
+        if (   isset($this->post[$this->_postPassword]) 
+            && $this->post[$this->_postPassword] != '') {
+            $this->password = (get_magic_quotes_gpc() == 1 
+                    ? stripslashes($this->post[$this->_postPassword]) 
+                    : $this->post[$this->_postPassword] );
+        }
+    }
+
+    // }}}
+    // {{{ start()
+
+    /**
+     * Start new auth session
+     *
+     * @return void
+     * @access public
+     */
+    function start()
+    {
+        $this->assignData();
+        if (!$this->checkAuth() && $this->allowLogin) {
+            $this->login();
+        }
+    }
+
+    // }}}
+    // {{{ login()
+
+    /**
+     * Login function
+     *
+     * @return void
+     * @access private
+     */
+    function login()
+    {
+        $login_ok = false;
+        $this->_loadStorage();
+        
+        // Check if using challenge response
+        (isset($this->post['authsecret']) && $this->post['authsecret'] == 1) 
+            ? $usingChap = true 
+            : $usingChap = false;
+
+        
+        // When the user has already entered a username, we have to validate it.
+        if (!empty($this->username)) {
+            if (true === $this->storage->fetchData($this->username, $this->password, $usingChap)) {
+                $this->session['challengekey'] = md5($this->username.$this->password);
+                $login_ok = true;
+            }
+        }
+
+        if (!empty($this->username) && $login_ok) {
+            $this->setAuth($this->username);
+            if (is_callable($this->loginCallback)) {
+                call_user_func_array($this->loginCallback, array($this->username, &$this));
+            }
+        }
+
+        // If the login failed or the user entered no username, 
+        // output the login screen again.
+        if (!empty($this->username) && !$login_ok) {
+            $this->status = AUTH_WRONG_LOGIN;
+            if (is_callable($this->loginFailedCallback)) {
+                call_user_func_array($this->loginFailedCallback, array($this->username, &$this));
+            }
+        }
+
+        if ((empty($this->username) || !$login_ok) && $this->showLogin) {
+            if (is_callable($this->loginFunction)) {
+                call_user_func_array($this->loginFunction, array($this->username, $this->status, &$this));
+            } else {
+                // BC fix Auth used to use drawLogin for this
+                // call is sub classes implement this
+                if (is_callable(array($this, 'drawLogin'))) {
+                    return $this->drawLogin($this->username, $this);
+                }
+
+                // New Login form
+                include_once 'Auth/Frontend/Html.php';
+                return Auth_Frontend_Html::render($this, $this->username);
+            }
+        } else {
+            return;
+        }
+    }
+
+    // }}}
+    // {{{ setExpire()
+
+    /**
+     * Set the maximum expire time
+     *
+     * @param  integer time in seconds
+     * @param  bool    add time to current expire time or not
+     * @return void
+     * @access public
+     */
+    function setExpire($time, $add = false)
+    {
+        $add ? $this->expire += $time : $this->expire = $time;
+    }
+
+    // }}}
+    // {{{ setIdle()
+
+    /**
+     * Set the maximum idle time
+     *
+     * @param  integer time in seconds
+     * @param  bool    add time to current maximum idle time or not
+     * @return void
+     * @access public
+     */
+    function setIdle($time, $add = false)
+    {
+        $add ? $this->idle += $time : $this->idle = $time;
+    }
+
+    // }}}
+    // {{{ setSessionName()
+
+    /**
+     * Set name of the session to a customized value.
+     *
+     * If you are using multiple instances of PEAR::Auth
+     * on the same domain, you can change the name of
+     * session per application via this function.
+     * This will chnage the name of the session variable 
+     * auth uses to store it's data in the session
+     *
+     * @param  string New name for the session
+     * @return void
+     * @access public
+     */
+    function setSessionName($name = 'session')
+    {
+        $this->_sessionName = '_auth_'.$name;
+        $this->session =& $_SESSION[$this->_sessionName];
+    }
+
+    // }}}
+    // {{{ setShowLogin()
+
+    /**
+     * Should the login form be displayed if neccessary?
+     *
+     * @param  bool    show login form or not
+     * @return void
+     * @access public
+     */
+    function setShowLogin($showLogin = true)
+    {
+        $this->showLogin = $showLogin;
+    }
+
+    // }}}
+    // {{{ setAllowLogin()
+
+    /**
+     * Should the login form be displayed if neccessary?
+     *
+     * @param  bool    show login form or not
+     * @return void
+     * @access public
+     */
+    function setAllowLogin($allowLogin = true)
+    {
+        $this->allowLogin = $allowLogin;
+    }
+
+    // }}}
+    // {{{ setLoginCallback()
+    
+    /**
+     * Register a callback function to be called on user login.
+     * The function will receive two parameters, the username and a reference to the auth object.
+     *
+     * @param  string  callback function name
+     * @return void
+     * @see    setLogoutCallback()
+     * @access public
+     */
+    function setLoginCallback($loginCallback)
+    {
+        $this->loginCallback = $loginCallback;
+    }
+
+    // }}}
+    // {{{ setFailedLoginCallback()
+
+    /**
+     * Register a callback function to be called on failed user login.
+     * The function will receive a single parameter, the username and a reference to the auth object.
+     *
+     * @param  string  callback function name
+     * @return void
+     * @access public
+     */
+    function setFailedLoginCallback($loginFailedCallback)
+    {
+        $this->loginFailedCallback = $loginFailedCallback;
+    }
+
+    // }}}
+    // {{{ setLogoutCallback()
+
+    /**
+     * Register a callback function to be called on user logout.
+     * The function will receive three parameters, the username and a reference to the auth object.
+     *
+     * @param  string  callback function name
+     * @return void
+     * @see    setLoginCallback()
+     * @access public
+     */
+    function setLogoutCallback($logoutCallback)
+    {
+        $this->logoutCallback = $logoutCallback;
+    }
+
+    // }}}
+    // {{{ setAuthData()
+
+    /**
+     * Register additional information that is to be stored
+     * in the session.
+     *
+     * @param  string  Name of the data field
+     * @param  mixed   Value of the data field
+     * @param  boolean Should existing data be overwritten? (default
+     *                 is true)
+     * @return void
+     * @access public
+     */
+    function setAuthData($name, $value, $overwrite = true)
+    {
+        if (!empty($this->session['data'][$name]) && $overwrite == false) {
+            return;
+        }
+        $this->session['data'][$name] = $value;
+    }
+
+    // }}}
+    // {{{ getAuthData()
+
+    /**
+     * Get additional information that is stored in the session.
+     *
+     * If no value for the first parameter is passed, the method will
+     * return all data that is currently stored.
+     *
+     * @param  string Name of the data field
+     * @return mixed  Value of the data field.
+     * @access public
+     */
+    function getAuthData($name = null)
+    {
+        if (!isset($this->session['data'])) {
+            return null;
+        }    
+        if(!isset($name)) {
+            return $this->session['data'];
+        }
+        if (isset($name) && isset($this->session['data'][$name])) {
+            return $this->session['data'][$name];
+        }
+        return null;        
+    }
+
+    // }}}
+    // {{{ setAuth()
+
+    /**
+     * Register variable in a session telling that the user
+     * has logged in successfully
+     *
+     * @param  string Username
+     * @return void
+     * @access public
+     */
+    function setAuth($username)
+    {
+    
+        // #2021 - Change the session id to avoid session fixation attacks php 4.3.3 > 
+        session_regenerate_id(true);
+
+        if (!isset($this->session) || !is_array($this->session)) {
+            $this->session = array();
+        }
+
+        if (!isset($this->session['data'])) {
+            $this->session['data'] = array();
+        }
+
+        $this->session['sessionip'] = isset($this->server['REMOTE_ADDR']) 
+            ? $this->server['REMOTE_ADDR'] 
+            : '';
+        $this->session['sessionuseragent'] = isset($this->server['HTTP_USER_AGENT']) 
+            ? $this->server['HTTP_USER_AGENT'] 
+            : '';
+
+        // This should be set by the container to something more safe
+        // Like md5(passwd.microtime)
+        if(empty($this->session['challengekey'])) {
+            $this->session['challengekey'] = md5($username.microtime());
+        }
+
+        $this->session['challengecookie'] = md5($this->session['challengekey'].microtime());
+        setcookie('authchallenge', $this->session['challengecookie']);
+
+        $this->session['registered'] = true;
+        $this->session['username']   = $username;
+        $this->session['timestamp']  = time();
+        $this->session['idle']       = time();
+    }
+
+    // }}}
+    // {{{ setAdvancedSecurity()
+    
+    /**
+      * Enables advanced security checks
+      *
+      * Currently only ip change and useragent change 
+      * are detected
+      * @todo Add challenge cookies - Create a cookie which changes every time 
+      *       and contains some challenge key which the server can verify with
+      *       a session var cookie might need to be crypted (user pass)
+      * @param bool Enable or disable
+      * @return void
+      * @access public
+      */
+    function setAdvancedSecurity($flag=true)
+    {
+        $this->advancedsecurity = $flag;
+    }
+
+    // }}}
+    // {{{ checkAuth()
+
+    /**
+     * Checks if there is a session with valid auth information.
+     *
+     * @access public
+     * @return boolean  Whether or not the user is authenticated.
+     */
+    function checkAuth()
+    {
+        $this->authChecks++;
+        if (isset($this->session)) {
+            // Check if authentication session is expired
+            if (   $this->expire > 0
+                && isset($this->session['timestamp'])
+                && ($this->session['timestamp'] + $this->expire) < time()) {
+                $this->expired = true;
+                $this->status = AUTH_EXPIRED;
+                $this->logout();
+                return false;
+            }
+
+            // Check if maximum idle time is reached
+            if (   $this->idle > 0
+                && isset($this->session['idle']) 
+                && ($this->session['idle'] + $this->idle) < time()) {
+                $this->idled = true;
+                $this->status = AUTH_IDLED;
+                $this->logout();
+                return false;
+            }
+
+            if (   isset($this->session['registered']) 
+                && isset($this->session['username']) 
+                && $this->session['registered'] == true 
+                && $this->session['username'] != '') {
+                Auth::updateIdle();
+
+                if ($this->advancedsecurity) {
+                    
+                    // Only Generate the challenge once
+                    if($this->authChecks == 1) {
+                        $this->session['challengecookieold'] = $this->session['challengecookie'];
+                        $this->session['challengecookie'] = md5($this->session['challengekey'].microtime());
+                        setcookie('authchallenge', $this->session['challengecookie']);
+                    }
+                    
+                    // Check for ip change
+                    if (   isset($this->server['REMOTE_ADDR']) 
+                        && $this->session['sessionip'] != $this->server['REMOTE_ADDR']) {
+                        // Check if the IP of the user has changed, if so we 
+                        // assume a man in the middle attack and log him out
+                        $this->expired = true;
+                        $this->status = AUTH_SECURITY_BREACH;
+                        $this->logout();
+                        return false;
+                    }
+                    
+                    // Check for useragent change
+                    if (   isset($this->server['HTTP_USER_AGENT']) 
+                        && $this->session['sessionuseragent'] != $this->server['HTTP_USER_AGENT']) {
+                        // Check if the User-Agent of the user has changed, if 
+                        // so we assume a man in the middle attack and log him out
+                        $this->expired = true;
+                        $this->status = AUTH_SECURITY_BREACH;
+                        $this->logout();
+                        return false;
+                    }
+    
+                    // Check challenge cookie here, if challengecookieold is not set 
+                    // this is the first time and check is skipped
+                    // TODO when user open two pages similtaneuly (open in new window,open 
+                    // in tab) auth breach is caused find out a way around that if possible
+                    if (   isset($this->session['challengecookieold']) 
+                        && $this->session['challengecookieold'] != $this->cookie['authchallenge']) {
+                        $this->expired = true;
+                        $this->status = AUTH_SECURITY_BREACH;
+                        $this->logout();
+                        $this->login();
+                        return false;
+                    }
+                }
+
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ staticCheckAuth() [static]
+
+    /**
+     * Statically checks if there is a session with valid auth information.
+     *
+     * @access public
+     * @see checkAuth
+     * @return boolean  Whether or not the user is authenticated.
+     * @static
+     */
+    function staticCheckAuth($options = null)
+    {
+        static $staticAuth;
+        if(!isset($staticAuth)) {
+            $staticAuth = new Auth('null', $options);
+        }
+        return $staticAuth->checkAuth();
+    }
+
+    // }}}
+    // {{{ getAuth()
+
+    /**
+     * Has the user been authenticated?
+     *
+     * @access public
+     * @return bool  True if the user is logged in, otherwise false.
+     */
+    function getAuth()
+    {
+        return $this->checkAuth();
+    }
+
+    // }}}
+    // {{{ logout()
+
+    /**
+     * Logout function
+     *
+     * This function clears any auth tokens in the currently
+     * active session and executes the logout callback function,
+     * if any
+     *
+     * @access public
+     * @return void
+     */
+    function logout()
+    {
+        if (is_callable($this->logoutCallback)) {
+            call_user_func_array($this->logoutCallback, array($this->session['username'], &$this));
+        }
+
+        $this->username = '';
+        $this->password = '';
+        
+        $this->session = null;
+    }
+
+    // }}}
+    // {{{ updateIdle()
+
+    /**
+     * Update the idletime
+     *
+     * @access private
+     * @return void
+     */
+    function updateIdle()
+    {
+        $this->session['idle'] = time();
+    }
+
+    // }}}
+    // {{{ getUsername()
+
+    /**
+     * Get the username
+     *
+     * @return string
+     * @access public
+     */
+    function getUsername()
+    {
+        if (isset($this->session['username'])) {
+            return($this->session['username']);
+        }
+        return('');
+    }
+
+    // }}}
+    // {{{ getStatus()
+
+    /**
+     * Get the current status
+     *
+     * @return string
+     * @access public
+     */
+    function getStatus()
+    {
+        return $this->status;
+    }
+
+    // }}}
+    // {{{ getPostUsernameField()
+    
+    /**
+     * Gets the post varible used for the username
+     * 
+     * @return string
+     * @access public
+     */
+    function getPostUsernameField()
+    {
+        return($this->_postUsername);
+    }
+
+    // }}}
+    // {{{ getPostPasswordField()
+
+    /**
+     * Gets the post varible used for the username
+     * 
+     * @return string
+     * @access public
+     */
+    function getPostPasswordField()
+    {
+        return($this->_postPassword);
+    }
+
+    // }}}
+    // {{{ sessionValidThru()
+
+    /**
+     * Returns the time up to the session is valid
+     *
+     * @access public
+     * @return integer
+     */
+    function sessionValidThru()
+    {
+        if (!isset($this->session['idle'])) {
+            return 0;
+        }
+        if ($this->idle == 0) {
+            return 0;
+        }
+        return ($this->session['idle'] + $this->idle);
+    }
+
+    // }}}
+    // {{{ listUsers()
+
+    /**
+     * List all users that are currently available in the storage
+     * container
+     *
+     * @access public
+     * @return array
+     */
+    function listUsers()
+    {
+        $this->_loadStorage();
+        return $this->storage->listUsers();
+    }
+
+    // }}}
+    // {{{ addUser()
+
+    /**
+     * Add user to the storage container
+     *
+     * @access public
+     * @param  string Username
+     * @param  string Password
+     * @param  mixed  Additional parameters
+     * @return mixed  True on success, PEAR error object on error
+     *                and AUTH_METHOD_NOT_SUPPORTED otherwise.
+     */
+    function addUser($username, $password, $additional = '')
+    {
+        $this->_loadStorage();
+        return $this->storage->addUser($username, $password, $additional);
+    }
+
+    // }}}
+    // {{{ removeUser()
+
+    /**
+     * Remove user from the storage container
+     *
+     * @access public
+     * @param  string Username
+     * @return mixed  True on success, PEAR error object on error
+     *                and AUTH_METHOD_NOT_SUPPORTED otherwise.
+     */
+    function removeUser($username)
+    {
+        $this->_loadStorage();
+        return $this->storage->removeUser($username);
+    }
+
+    // }}}
+    // {{{ changePassword()
+
+    /**
+     * Change password for user in the storage container
+     *
+     * @access public
+     * @param string Username
+     * @param string The new password 
+     * @return mixed True on success, PEAR error object on error
+     *               and AUTH_METHOD_NOT_SUPPORTED otherwise.
+     */
+    function changePassword($username, $password)
+    {
+        $this->_loadStorage();
+        return $this->storage->changePassword($username, $password);
+    }
+
+    // }}}
+
+}
+?>
Index: /branches/mobile/html/test/kakinaka/css/local/tree.css
===================================================================
--- /branches/mobile/html/test/kakinaka/css/local/tree.css	(revision 7223)
+++ /branches/mobile/html/test/kakinaka/css/local/tree.css	(revision 7223)
@@ -0,0 +1,99 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/* first or middle sibling, no children */
+.ygtvtn {
+	width:16px; height:22px; 
+	background: url(../../img/default/tn.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, collapsable */
+.ygtvtm {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../img/default/tm.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, collapsable, hover */
+.ygtvtmh {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../img/default/tmh.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, expandable */
+.ygtvtp {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../img/default/tp.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, expandable, hover */
+.ygtvtph {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../img/default/tph.gif) 0 0 no-repeat; 
+}
+
+/* last sibling, no children */
+.ygtvln {
+	width:16px; height:22px; 
+	background: url(../../img/default/ln.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, collapsable */
+.ygtvlm {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../img/default/lm.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, collapsable, hover */
+.ygtvlmh {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../img/default/lmh.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, expandable */
+.ygtvlp { 
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../img/default/lp.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, expandable, hover */
+.ygtvlph { 
+	width:16px; height:22px; cursor:pointer ;
+	background: url(../../img/default/lph.gif) 0 0 no-repeat; 
+}
+
+/* Loading icon */
+.ygtvloading { 
+	width:16px; height:22px; 
+	background: url(../../img/default/loading.gif) 0 0 no-repeat; 
+}
+
+/* the style for the empty cells that are used for rendering the depth 
+ * of the node */
+.ygtvdepthcell { 
+	width:16px; height:22px; 
+	background: url(../../img/default/vline.gif) 0 0 no-repeat; 
+}
+
+.ygtvblankdepthcell { width:16px; height:22px; }
+
+/* the style of the div around each node */
+.ygtvitem { }  
+
+/* the style of the div around each node's collection of children */
+.ygtvchildren {  }  
+* html .ygtvchildren { height:2%; }  
+
+/* the style of the text label in ygTextNode */
+.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { 
+	margin-left:2px;
+	text-decoration: none;
+    background-color: white;
+}
+
+.ygtvspacer { height: 10px; width: 10px; margin: 2px; }
Index: /branches/mobile/html/test/kakinaka/css/check/tree.css
===================================================================
--- /branches/mobile/html/test/kakinaka/css/check/tree.css	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/css/check/tree.css	(revision 7213)
@@ -0,0 +1,58 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/* first or middle sibling, no children */
+.ygtvtn {background: url(../../img/default/tn.gif) 0 0 no-repeat; width:16px; height:22px; }
+
+/* first or middle sibling, collapsable */
+.ygtvtm {background: url(../../img/default/tm.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
+/* first or middle sibling, collapsable, hover */
+.ygtvtmh {background: url(../../img/default/tmh.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
+/* first or middle sibling, expandable */
+.ygtvtp {background: url(../../img/default/tp.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
+/* first or middle sibling, expandable, hover */
+.ygtvtph {background: url(../../img/default/tph.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
+/* last sibling, no children */
+.ygtvln {background: url(../../img/default/ln.gif) 0 0 no-repeat; width:16px; height:22px; }
+
+/* Last sibling, collapsable */
+.ygtvlm {background: url(../../img/default/lm.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
+/* Last sibling, collapsable, hover */
+.ygtvlmh {background: url(../../img/default/lmh.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
+/* Last sibling, expandable */
+.ygtvlp { background: url(../../img/default/lp.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
+/* Last sibling, expandable, hover */
+.ygtvlph { background: url(../../img/default/lph.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
+/* Loading icon */
+.ygtvloading { background: url(../../img/default/loading.gif) 0 0 no-repeat; width:16px; height:22px; }
+
+/* the style for the empty cells that are used for rendering the depth 
+ * of the node */
+.ygtvdepthcell { background: url(../../img/default/vline.gif) 0 0 no-repeat; width:16px; height:22px; }
+
+.ygtvblankdepthcell { width:16px; height:22px; }
+
+/* the style of the div around each node */
+.ygtvitem { }  
+
+/* the style of the div around each node's collection of children */
+.ygtvchildren { }  
+* html .ygtvchildren { height:1%; }  
+
+/* the style of the text label in ygTextNode */
+.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { 
+	margin-left:2px;
+	text-decoration: none;
+}
+
+.ygtvcheck0 { background: url(../../img/check/check0.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+.ygtvcheck1 { background: url(../../img/check/check1.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+.ygtvcheck2 { background: url(../../img/check/check2.gif) 0 0 no-repeat; width:16px; height:22px; cursor:pointer }
+
Index: /branches/mobile/html/test/kakinaka/css/folders/tree.css
===================================================================
--- /branches/mobile/html/test/kakinaka/css/folders/tree.css	(revision 7223)
+++ /branches/mobile/html/test/kakinaka/css/folders/tree.css	(revision 7223)
@@ -0,0 +1,55 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/* first or middle sibling, no children */
+.ygtvtn { background: url(../../img/folders/tn.gif) 0 0 no-repeat; width:17px; height:22px; }
+
+/* first or middle sibling, collapsable */
+.ygtvtm { background: url(../../img/folders/tm.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
+
+/* first or middle sibling, collapsable, hover */
+.ygtvtmh { background: url(../../img/folders/tmh.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
+
+/* first or middle sibling, expandable */
+.ygtvtp { background: url(../../img/folders/tp.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
+
+/* first or middle sibling, expandable, hover */
+.ygtvtph { background: url(../../img/folders/tph.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
+
+/* last sibling, no children */
+.ygtvln { background: url(../../img/folders/ln.gif) 0 0 no-repeat; width:17px; height:22px; }
+
+/* Last sibling, collapsable */
+.ygtvlm { background: url(../../img/folders/lm.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
+
+/* Last sibling, collapsable, hover */
+.ygtvlmh { background: url(../../img/folders/lmh.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
+
+/* Last sibling, expandable */
+.ygtvlp { background: url(../../img/folders/lp.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
+
+/* Last sibling, expandable, hover */
+.ygtvlph { background: url(../../img/folders/lph.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
+
+/* Loading icon */
+.ygtvloading { background: url(../../img/folders/loading.gif) 0 0 no-repeat; width:16px; height:22px; }
+
+/* the style for the empty cells that are used for rendering the depth 
+ * of the node */
+.ygtvdepthcell { background: url(../../img/folders/vline.gif) 0 0 no-repeat; width:17px; height:22px; }
+
+.ygtvblankdepthcell { width:17px; height:22px; }
+
+/* the style of the div around each node */
+.ygtvitem { }  
+
+/* the style of the div around each node's collection of children */
+.ygtvchildren { }  
+* html .ygtvchildren { height:1%; }  
+
+/* the style of the text label in ygTextNode */
+.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { 
+	margin-left:2px;
+	text-decoration: none;
+}
+
+
Index: /branches/mobile/html/test/kakinaka/css/code.css
===================================================================
--- /branches/mobile/html/test/kakinaka/css/code.css	(revision 7223)
+++ /branches/mobile/html/test/kakinaka/css/code.css	(revision 7223)
@@ -0,0 +1,103 @@
+
+/************* CSS for dp.SyntaxHighlighter ***************************/
+
+/* Main style for the table */
+
+.dp-highlighter {
+	width: 95%;
+	overflow: auto;
+	line-height: 100% !important;
+	margin: 0px 0px 10px 0px;
+}
+
+.dp-highlighter table {
+	width: 100%;
+	margin: 0px 0px 2px 0px;
+	border-collapse: collapse;
+	border-bottom: 2px solid #eee;
+	background-color:#fff;
+}
+
+.dp-highlighter tbody.hide { display: none; }
+.dp-highlighter tbody.show { display: table-row-group; _display: block; }
+
+.dp-highlighter td 
+{
+	font-family: Courier New;
+	font-size: 12px;
+}
+
+/* Styles for the tools */
+
+.dp-highlighter .tools-corner {
+	background-color: #eee;
+	font-size: 9px;
+}
+
+.dp-highlighter .tools {
+	background-color: #eee;
+	padding: 3px 8px 3px 10px;
+	border-bottom: 1px solid gray;
+	font: 11px Verdana, Geneva, Arial, Helvetica, sans-serif;
+	color: silver;
+}
+
+.dp-highlighter .tools-corner {
+	background-color: #eee;
+}
+
+.dp-highlighter .tools a {
+	font-size: 9px;
+    color: #aaaaaa;
+	text-decoration: none;
+}
+
+.dp-highlighter .tools a:hover {
+	color: red;
+	text-decoration: underline;
+}
+
+/* Gutter with line number */
+
+.dp-highlighter .gutter {
+	padding-right: 5px; 
+	padding-left: 10px; 
+	width: 5px;
+	background-color: #eee; 
+	border-right: 1px solid #cccccc; 
+	color: gray;
+	text-align: right;
+	vertical-align: top;
+}
+
+/* Single line style */
+
+.dp-highlighter .line1, .line2 {
+	padding-left: 10px;
+    /*
+	border-bottom: 1px solid #F7F7F7;
+    */
+	white-space:nowrap;
+}
+
+.dp-highlighter .line2 {
+    /*
+	background-color: #F7F7F7;
+    */
+}
+
+.dp-xml {}
+.dp-xml .cdata { color: #ff1493; }
+.dp-xml .comments { color: green; }
+.dp-xml .tag { color: blue; }
+.dp-xml .tag-name { color: black; font-weight: bold; }
+.dp-xml .attribute { color: red; }
+.dp-xml .attribute-value { color: blue; }
+
+.dp-c {}
+.dp-c .comment { color: green; }
+.dp-c .string { color: blue; }
+.dp-c .preprocessor { color: gray; }
+.dp-c .keyword { color: blue; }
+.dp-c .vars { color: #d00; }
+
Index: /branches/mobile/html/test/kakinaka/css/default/tree.css
===================================================================
--- /branches/mobile/html/test/kakinaka/css/default/tree.css	(revision 7223)
+++ /branches/mobile/html/test/kakinaka/css/default/tree.css	(revision 7223)
@@ -0,0 +1,98 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/* first or middle sibling, no children */
+.ygtvtn {
+	width:16px; height:22px; 
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/tn.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, collapsable */
+.ygtvtm {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/tm.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, collapsable, hover */
+.ygtvtmh {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/tmh.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, expandable */
+.ygtvtp {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/tp.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, expandable, hover */
+.ygtvtph {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/tph.gif) 0 0 no-repeat; 
+}
+
+/* last sibling, no children */
+.ygtvln {
+	width:16px; height:22px; 
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/ln.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, collapsable */
+.ygtvlm {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/lm.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, collapsable, hover */
+.ygtvlmh {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/lmh.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, expandable */
+.ygtvlp { 
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/lp.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, expandable, hover */
+.ygtvlph { 
+	width:16px; height:22px; cursor:pointer ;
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/lph.gif) 0 0 no-repeat; 
+}
+
+/* Loading icon */
+.ygtvloading { 
+	width:16px; height:22px; 
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/loading.gif) 0 0 no-repeat; 
+}
+
+/* the style for the empty cells that are used for rendering the depth 
+ * of the node */
+.ygtvdepthcell { 
+	width:16px; height:22px; 
+	background: url(../../../../../../../i/us/nt/widg/tree/dflt/vline.gif) 0 0 no-repeat; 
+}
+
+.ygtvblankdepthcell { width:16px; height:22px; }
+
+/* the style of the div around each node */
+.ygtvitem { }  
+
+/* the style of the div around each node's collection of children */
+.ygtvchildren { }  
+* html .ygtvchildren { height:2%; }  
+
+/* the style of the text label in ygTextNode */
+.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { 
+	margin-left:2px;
+	text-decoration: none;
+}
+
+.ygtvspacer { height: 10px; width: 10px; margin: 2px; }
Index: /branches/mobile/html/test/kakinaka/css/menu/tree.css
===================================================================
--- /branches/mobile/html/test/kakinaka/css/menu/tree.css	(revision 7223)
+++ /branches/mobile/html/test/kakinaka/css/menu/tree.css	(revision 7223)
@@ -0,0 +1,58 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/* first or middle sibling, no children */
+.ygtvtn { width:1em; height:20px; }
+
+/* first or middle sibling, collapsable */
+.ygtvtm { background: url(../../img/menu/collapse.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer }
+
+/* first or middle sibling, collapsable, hover */
+.ygtvtmh { background: url(../../img/menu/collapseh.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer }
+
+/* first or middle sibling, expandable */
+.ygtvtp { background: url(../../img/menu/expand.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer }
+
+/* first or middle sibling, expandable, hover */
+.ygtvtph { background: url(../../img/menu/expandh.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer }
+
+/* last sibling, no children */
+.ygtvln { width:1em; height:20px; }
+
+/* Last sibling, collapsable */
+.ygtvlm { background: url(../../img/menu/collapse.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer }
+
+/* Last sibling, collapsable, hover */
+.ygtvlmh { background: url(../../img/menu/collapseh.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer }
+
+/* Last sibling, expandable */
+.ygtvlp { background: url(../../img/menu/expand.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer }
+
+/* Last sibling, expandable, hover */
+.ygtvlph { background: url(../../img/menu/expandh.gif) 0 6px no-repeat; width:1em; height:22px; cursor:pointer }
+
+/* Loading icon */
+.ygtvloading { background: url(../../img/menu/loading.gif) 0 6px no-repeat; width:1em; height:22px; }
+
+/* the style for the empty cells that are used for rendering the depth 
+ * of the node */
+.ygtvdepthcell { width:1em; height:20px; }
+
+.ygtvblankdepthcell { width:1em; height:20px; }
+
+/* the style of the div around each node */
+.ygtvitem { border: 0px solid grey; }  
+
+/* the style of the div around each node's collection of children */
+.ygtvchildren { }  
+* html .ygtvchildren { height:1%; }  
+
+/* the style of the text label in ygTextNode */
+.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { 
+	/*
+	margin-left:2px;
+	text-decoration: none;
+	*/
+	font-size: 12px;
+}
+
+
Index: /branches/mobile/html/test/kakinaka/css/screen.css
===================================================================
--- /branches/mobile/html/test/kakinaka/css/screen.css	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/css/screen.css	(revision 7213)
@@ -0,0 +1,112 @@
+html, body { padding: 0px 0px 10px 0px; border: 0; margin: 0; }
+body { font: normal 11px verdana, sans-serif; color: #333; line-height: 19px; margin: 0; }
+#container { clear: both; text-align: left; padding: 0 0; margin: 0 0; }
+#containerTop { height:48px; }
+#pad {  padding: 0px 20px 0px 20px; }
+a { text-decoration: underline; color: #46546C; }
+a:hover { text-decoration: underline; color: #4d77c3; }
+h1, h2, h3, h4, h5, h6 { font-family: palatino, georgia, "Times New Roman", serif; }
+h2 { font-size:16px; font-weight: bold; margin: 0 0 11px 0; }
+.border_2px { border: 1px solid #D8D8D8; padding: 2px; background: #fff; }
+.border_5px { border: 1px solid #D8D8D8; padding: 5px; background: #fff; margin: 0 0 4px 0; }
+img { padding: 0; margin: 0; border: 0; }
+form { padding: 0; margin: 0; }
+.input { width: 85px; font-size: 9px; }
+.submit { font-size: 9px; }
+#pageTitle { position:absolute;top:10px;left:90px; }
+#pageTitle H3 {	font-size:14pt; color:#666666 }
+#header h1 { float:left; margin-top: 19px; margin-left: 50px;  }
+#header h1 a { display: block; height: 19px; text-decoration: none; }
+#header { height:  60px; border: 0px solid #CFFB00; margin-bottom:0px; }
+#header h4 { position: relative; float: right; font-size:11px; 
+             letter-spacing: 1px; top: 10px; right: 30px; 
+             line-height: 15px; padding: 0 0 0 13px; margin: 0px; }
+#content { float: left; width: 500px; min-height:400px; padding:10px 0px; border: 0px solid #C13B00;
+           margin-left: 50px; top:0px; }
+#content h1 { font-size:18px; margin:0px;      }
+.newsItem { padding-bottom:25px; margin-bottom:25px; overflow: hidden; }
+.newsItem h3 { font-size:18px; margin:0px; }
+.newsItem h3 a { text-decoration:none; color:#6A7981; }
+.newsItem h3 a:hover { text-decoration:underline; color:#000; }
+.newsItemFooter, .newsItemFooter a { font-size:9px; color:#999; font-weight:normal; }
+.newsItemFooter a:hover { color:#222; }
+#footer { padding: 0px 0px 20px 0px; clear: both; color: #999; border-top:0px #CCC solid; margin:0px 26px 0px 30px }
+#footer a { color: #999; }
+#footer a:hover { color: #222; }
+#footerContainer { clear: both; }
+
+#rightbar {
+    float: right;
+    padding: 5px 5px 5px 5px;
+    width: 304px; /* for IE5-Win */
+    width: 300px;
+    border: 1px solid #333333;
+    position:relative;
+    right:48px;
+    top:0px;
+    background-color:#eeeeee;
+    }
+#rightbar h2, #rightbar h3 {
+    font-size:12px;
+    text-align:center;
+    color:#FFF;
+    
+    border-bottom:#848B8F solid 1px;
+    border-right:#949B9F solid 1px;
+    border-top:#eee solid 1px;
+    padding:1px;
+    margin:0px 0px 0px 0px;
+    background-color:#383e45;
+    width:100%;
+    }
+#rightbar h2 a, #rightbar h3 a {
+    font-size:12px;
+    color:#FFF;
+    text-decoration:none;
+    display:block;
+    }
+#rightBarPad {
+    margin:0px;
+    }
+#sidenav {
+    margin: 0px 0;
+    border-bottom: 1px solid #ddd;
+    }
+#sidenav ul {
+    margin: 0; 
+    padding: 0; 
+    border: 0;
+    
+    }
+#sidenav ul li {
+    list-style: none; 
+    list-style-image: none !important;
+    margin: 0; 
+    padding:0;
+    }
+#sidenav ul li a {
+   text-decoration: none;
+   padding: 5px 0px 5px 0px;
+   color: #4C5250;
+   display: block;
+   width: 187px;
+   font-size: 11px !important;   
+   font-weight: bold;
+   border-top: 1px solid #ddd;
+   border-bottom: 1px solid #aaa;
+   border-left: 1px solid #C7CBD0;
+   text-shadow: -2px -2px 0px #FFF;
+}
+   
+
+#sidenav ul li a:hover {
+
+/* background: url(../img/navHover2.png) top no-repeat; */
+border-top: 1px solid #A1AAAF;
+border-bottom: 1px solid #CCC;
+border-right: 0px solid #C3C7CA;
+border-left: 1px solid #C3C7CA;
+text-shadow: 4px 4px 0px #C3C7CA;
+}
+
+.ylogo { position:absolute;top:5px;left:5px }
Index: /branches/mobile/html/test/kakinaka/table.html
===================================================================
--- /branches/mobile/html/test/kakinaka/table.html	(revision 9385)
+++ /branches/mobile/html/test/kakinaka/table.html	(revision 9385)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="Shift_JIS"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+<head>
+<title>¥µ¥¤¥É¡¦¥á¥Ë¥å¡¼ ´°À®¿Þ</title>
+<style type="text/css">
+#sample{
+	width:210px;
+	list-style-type:none;
+}#sample,#sample li,#sample li a{
+	margin:0;
+	padding:0;
+}#sample li{
+	_display:block;
+}#sample li a{
+	width:200px;
+	display:block;
+	border:1px solid #3cc;
+	background:#aff;
+	text-decoration:none;
+}#sample li a:hover{
+	border:1px solid #c33;
+	background:#faa;
+}
+
+
+#sample2 a{
+	_display:block;
+	width:100%;
+	height:100%;
+	valign:middle;
+}
+</style>
+</head>
+<body>
+
+<ul id="sample">
+<li><a href="">¥Û¡¼¥à</a></li>
+<li><a href="">ÊÉ»æ</a></li>
+<li><a href="">Æüµ­</a></li>
+<li><a href="">·Ç¼¨ÈÄ</a></li>
+<li><a href="">¼«¸Ê¾Ò²ð</a></li>
+</ul>
+
+<table>
+<tr><td align="center" valign="middle" id="sample2" width=500 height=500>
+<!--¥á¥¤¥ó²èÁü--><a href="/ec-cube/products/detail.php" onclick="win01('./detail_image.php?product_id=1&image=main_large_image','detail_image','560', '171'); return false;" target="_blank"><img src="/ec-cube/upload/save_image/11291046_456ce67123860.gif" alt="¥¢¥¤¥¹¥¯¥ê¡¼¥à" /></a>
+</td></tr>
+<tr><td><a href="">ÊÉ»æ</a></td></tr>
+<tr><td><a href="">Æüµ­</a></td></tr>
+<tr><td><a href="">·Ç¼¨ÈÄ</a></td></tr>
+<tr><td><a href="">¼«¸Ê¾Ò²ð</a></td></tr>
+</table>
+
+</div>
+
+<hr title="°Ê²¼¤Ï¡¢¸«½Ð¤·¤ØÌá¤ë¥ê¥ó¥¯¤ÈºÇ½ª¹¹¿·Æü¡¢Ãøºî¸¢¾ðÊó¤Ç¤¹¡£" />
+
+<script type="text/javascript">
+aanc()
+</script>
+<noscript>
+<div><img src="http://cgi34.plala.or.jp/go_west/acc/acclog.cgi?referrer=noscript&amp;width=-&amp;height=-&amp;color=-" width="1" height="1" alt="" /></div>
+</noscript>
+
+<address>
+<a href="#main" id="totop">page top</a><br />
+ºÇ½ª¹¹¿·Æü¡§2004Ç¯10·î03Æü<br />
+<a href="../../cop.htm">Copyright &copy; 2002-2004 ¤Ð¤¢¤É All Rights Reserved.</a>
+</address>
+
+<ul id="gtocb">
+	<li><a href="http://www6.plala.or.jp/go_west/" accesskey="h"><acronym title="¾å°Ì¥µ¥¤¥È¤Ø¡£¤³¤Î¥µ¥¤¥È¤Î¥È¥Ã¥×¥Ú¡¼¥¸¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£">Home[H]</a></acronym></li>
+	<li><a href="../../index.html" accesskey="f"><acronym title="¤³¤Î¥µ¥¤¥È¤Î¥È¥Ã¥×¥Ú¡¼¥¸¤Ø">Front[F]</a></acronym></li>
+	<li><a href="../../guide/index.html" accesskey="s"><acronym title="Ã¦½é¿´¼Ô¹ÖºÂ">Stepup[S]</a></acronym></li>
+	<li><a href="../../ref/index.html" accesskey="r"><acronym title="(¤Û¤Ü)ÌÖÍåÅª¤Ê¥ê¥Õ¥¡¥ì¥ó¥¹">Reference[R]</a></acronym></li>
+	<li><a href="../../tip/index.html" accesskey="c"><acronym title="CSS-HTMLÂÐÈæÉ½¡¢ÏÀÍý¤Ø¤Î°Ü¹Ô¼ê°ú¤­¡¢DOCTYPE¥¹¥¤¥Ã¥Á¡¢ÏÂÌõÅù">Column[C]</a></acronym></li>
+</ul>
+
+</body>
+</html>
Index: /branches/mobile/html/test/kakinaka/script.php
===================================================================
--- /branches/mobile/html/test/kakinaka/script.php	(revision 8397)
+++ /branches/mobile/html/test/kakinaka/script.php	(revision 8397)
@@ -0,0 +1,12 @@
+<?php
+
+require_once("../../require.php");
+
+$objView = new SC_UserView("./templates/");
+
+//sfprintr($_SERVER);
+
+$objView->display("script.tpl")
+
+
+?>
Index: /branches/mobile/html/test/kakinaka/epsilon_check.php
===================================================================
--- /branches/mobile/html/test/kakinaka/epsilon_check.php	(revision 8652)
+++ /branches/mobile/html/test/kakinaka/epsilon_check.php	(revision 8652)
@@ -0,0 +1,49 @@
+<?php
+require_once("../../require.php");
+require_once(MODULE_PATH . "mdl_epsilon/mdl_epsilon.inc");
+require_once(DATA_PATH . "module/Request.php");
+
+$objQuery = new SC_Query();
+/*
+// trans_code ¤ò»ØÄê¤µ¤ì¤Æ¤¤¤Æ³î¤Ä¡¢Æþ¶âºÑ¤ß¤Î¾ì¹ç
+if($_POST["trans_code"] != "" and $_POST["paid"] == 1 and $_POST["order_number"] != ""){
+	// ¥¹¥Æ¡¼¥¿¥¹¤òÆþ¶âºÑ¤ß¤ËÊÑ¹¹¤¹¤ë
+	$sql = "UPDATE dtb_order SET status = 6, update_date = now() WHERE order_id = ? AND memo04 = ? ";
+	$objQuery->query($sql, array($_POST["order_number"], $_POST["trans_code"]));
+	
+	// POST¤ÎÆâÍÆ¤òÁ´¤Æ¥í¥°ÊÝÂ¸
+	$log_path = DATA_PATH . "logs/epsilon.log";
+	gfPrintLog("epsilon conveni start---------------------------------------------------------", $log_path);
+	foreach($_POST as $key => $val){
+		gfPrintLog( "\t" . $key . " => " . $val, $log_path);
+	}
+	gfPrintLog("epsilon conveni end-----------------------------------------------------------", $log_path);
+*/
+
+    // URI¤«¤é³Æ¾ðÊó¤ò¼èÆÀ
+    $info = parse_url( $_SERVER["REQUEST_URI"] );
+    $scheme = $info['scheme'];
+    $host = $info['host'];
+    $port = $info['port'];
+    $path = $info['path'];
+
+	$req =& new HTTP_Request($_SERVER["REQUEST_URI"]);
+	$req->addHeader("Content-Type", "text/plan");
+	
+echo "Content-Type: text/plain
+
+1";
+
+//	$req->setBody($body);
+//	sfprintr($info);
+	
+	$req->clearPostData();
+	
+	if (PEAR::isError($req)) {
+	    echo $req->getMessage();
+	} else {
+	    echo $req->getResponseBody();
+	}
+//}
+
+?>
Index: /branches/mobile/html/test/kakinaka/top_default.css
===================================================================
--- /branches/mobile/html/test/kakinaka/top_default.css	(revision 7019)
+++ /branches/mobile/html/test/kakinaka/top_default.css	(revision 7019)
@@ -0,0 +1,518 @@
+/* ===================================================================================
+
+????
+
+???????????
+
+??????????
+
+????????
+
+	???
+
+	????????
+	
+	???????? ?????
+	
+	???????
+	
+?????????
+	
+	????????????
+	
+	????????
+	
+????
+
+=================================================================================== */
+
+
+/* ????
+------------------------------------------------------------------------------------*/
+body,
+h1,h2,h3,h4,h5,h6,
+ul,ol,li,
+dl,dt,dd,
+p,
+img,
+form {
+	margin: 0;
+	padding: 0;
+	text-align: center;
+	list-style-type: none;
+	border: none;
+	/*font-size: 12px;*/
+	/*font-family: "?????? Pro W3", "?? ?????", Osaka;*/
+	color: #333333;}
+
+p {
+	font-size: 12px;
+}
+a,
+a:link {
+	color: #0033FF;
+	text-decoration: underline;}
+
+a:visited {
+	color: #990066;}
+
+a:hover,
+a:active {
+	color: #0099ff;}
+/*
+img {
+	vertical-align: top;}
+*/
+.red-text,
+.price {
+	font-size: 12px;
+	color: #FF0000;}
+
+.float-clear {
+	clear: both;
+	line-height: 0;
+	font-size: 0;}
+
+.float-clear-1 {
+	height: 1px;
+	clear: both;
+	line-height: 0;
+	font-size: 0;}
+
+
+/* ???????????
+------------------------------------------------------------------------------------*/
+div#wraper,
+div#wraper div#header,
+div#wraper div#container,
+div#wraper div#footer {
+	width: 780px;
+	margin: 0 auto;
+	text-align: left;}
+
+div#wraper div#container div#left-column {
+	width: 180px;
+	float: left;}
+
+div#wraper div#container div#main-column {
+	width: 600px;
+	float: left;}
+
+
+/* ??????????
+------------------------------------------------------------------------------------*/
+div#header {
+	padding: 6px 0 10px 0;
+	background: url(../../img/renewal/head_topbar.gif) left top no-repeat;}
+	
+div#header div#upper-block {
+	height: 88px;
+	background: url(../../img/renewal/head_kitasan.jpg) right top no-repeat;}
+
+div#header h1 {
+	width: 137px;
+	float: left;}
+
+div#header ul {
+	text-align: left;}
+
+div#header ul li {
+	display: inline;}
+
+
+/* ????????
+------------------------------------------------------------------------------------*/
+div#left-column div#left-container {
+	padding: 0 10px 0 0;}
+	
+div#left-column div#left-container p,
+div#left-column div#left-container li {
+	font-size: 11px;}
+
+
+/* ???
+---------------------------------------- */
+div#left-column div#left-container div#search-box {
+	height: 63px;
+	background: url(../../img/renewal/left_column_search_bg.gif) left bottom no-repeat #226EBC;}
+
+div#left-column div#left-container div#search-box ul li {
+	text-align: left;}
+
+div#left-column div#left-container div#search-box ul li input {
+	margin: 0;
+	padding: 0;}
+
+div#left-column div#left-container div#search-box ul li.txt-area {
+	padding: 3px 0 0 0px;
+	text-align: center;}
+
+
+/* ????????
+---------------------------------------- */
+div#left-column div#left-container div#my-menu {
+	padding: 0px 0 0 0;
+	background-image: url(../../img/renewal/left_column_my_bg_middle.gif);
+	background-position: 0 30px;
+	background-repeat: repeat-y;}
+
+div#left-column div#left-container div#my-menu ul {
+	padding: 10px 0 0 0;
+	float: none !important;
+	float: left;
+	background-color: #ffffff;}
+
+div#left-column div#left-container div#my-menu ul li {
+	height: auto !important;
+	height: 22px;
+	float: left;
+	min-height: 22px;
+	background: url(../../img/renewal/left_column_my_ttlbg.gif) right top no-repeat #226EBC;}
+
+div#left-column div#left-container div#my-menu ul li#my-ttl {
+	width: 76px;}
+
+div#left-column div#left-container div#my-menu ul li#login {
+	width: 94px;
+	padding: 0px 0 0 0;
+	font-size: 12px;
+	text-align: right;}
+
+div#left-column div#left-container div#my-menu ul li#login a,
+div#left-column div#left-container div#my-menu ul li#login a:link,
+div#left-column div#left-container div#my-menu ul li#login a:visited {
+	display: block;
+	padding: 4px 10px 0 0;
+	color: #FFFFFF;}
+
+div#left-column div#left-container div#my-menu ul li#login a:hover,
+div#left-column div#left-container div#my-menu ul li#login a:active {
+	color: #FFFF00;}
+
+div#left-column div#left-container div#my-menu p {
+	padding: 7px;
+	clear: both;
+	text-align: left;}
+
+div#left-column div#left-container div#my-menu p#my-btn {
+	padding: 0 0 10px 0;
+	text-align: center;
+	background: url(../../img/renewal/left_column_my_bg.gif) left bottom no-repeat;} 
+
+
+/* ???????? ?????
+---------------------------------------- */
+
+div#left-column div#left-container div#my-menu p#member-name {
+	padding: 10px 0 ;
+	text-align: center;
+	font-size: 12px;}
+
+div#left-column div#left-container div#my-menu p#member-name span {
+	color: #6A9735;}
+
+div#left-column div#left-container div#my-menu ul#member-point {
+	padding: 0px 10px 15px 10px;
+	text-align: center;
+	float: none;
+	background: url(../../img/renewal/left_column_my_bg.gif) left bottom no-repeat;} 
+
+div#left-column div#left-container div#my-menu ul#member-point li {
+	height: auto;
+	min-height: inherit;
+	padding: 0;
+	float: none;
+	background: #ffffff;
+	font-size: 12px;
+	text-align: center;}
+
+div#left-column div#left-container div#my-menu ul#member-point li#top-bar {
+	padding: 10px 0 0 0;
+	border-top: 1px solid #A7C8ED;}
+
+
+
+/* ???????
+---------------------------------------- */
+div#left-column div#left-container div.box01,
+div#left-column div#left-container div.box02,
+div#left-column div#left-container div.box03 {
+	padding: 0 0 10px 0;
+	background: url(../../img/renewal/left_column_box_bgbottom.gif) left bottom no-repeat #DCEAFA;}
+
+div#left-column div#left-container div.box01 h2,
+div#left-column div#left-container div.box02 h2,
+div#left-column div#left-container div.box03 h2 {
+	padding: 10px 0 0 0;
+	background-color: #ffffff;}
+
+div#left-column div#left-container div.box01 ul,
+div#left-column div#left-container div.box02 ul,
+div#left-column div#left-container div.box03 ul {
+	padding: 5px 10px 0 10px;}
+
+div#left-column div#left-container div.box01 ul li,
+div#left-column div#left-container div.box02 ul li,
+div#left-column div#left-container div.box03 ul li {
+	text-align: left;}
+
+div#left-column div#left-container div.box01 ul li.price {
+	font-size: 12px;
+	text-align: center;
+	color: #FF0000;}
+
+div#left-column div#left-container div.box01 p {
+	padding: 16px 0 0 0;
+	background: url(../../img/renewal/left_column_box01_arrow.gif) 50% 2px no-repeat;}
+
+div#left-column div#left-container div.box02 div#box2-dott {
+	height: 1px;
+	padding-bottom: 5px;
+	background: url(../../img/renewal/left_column_box_dott.gif) center bottom no-repeat;}
+
+div#left-column div#left-container div.box02 h2 {
+position: relative;}
+
+div#left-column div#left-container div.box02 ul li {
+position: relative;}
+
+div#left-column div#left-container div.box02 ul li.item-image {
+	width: 75px;
+	float: left;}
+
+div#left-column div#left-container div.box03 p {
+	padding: 5px 0 0 0;
+	color: #FF0000;}
+
+div#left-column div#left-container div.box04 {
+	padding: 10px 0 10px 0;
+	clear: both;}
+
+
+/* ?????????
+------------------------------------------------------------------------------------*/
+div#main-column {
+	width: 600px;}
+
+div#main-column h2#top-banner {
+	padding: 0 0 10px 0;}
+
+
+
+
+/* ????????????
+---------------------------------------- */
+div#main-column div#box-nav {
+	padding: 10px 0 0 0;}
+
+div#main-column div#box-nav div {
+	width: 200px;
+	float: left;}
+
+div#main-column div#box-nav div dl {}
+
+div#main-column div#box-nav div dl dt {
+	text-align: left;}
+
+div#main-column div#box-nav div dl dt img,
+div#main-column div#box-nav div p img {
+	border: #ddd solid 1px;
+	border-width: 1px 0;}
+
+div#main-column div#box-nav div dl dd {}
+
+div#main-column div#box-nav div dl dd ul {
+	padding: 5px 0 10px 0;}
+
+div#main-column div#box-nav div dl dd ul li {
+	padding: 2px 0 2px 1em;
+	text-align: left;}
+
+div#main-column div#nav-left {
+	font-size: 12px;
+}
+
+div#main-column div#nav-center {
+	font-size: 12px;
+}
+
+div#main-column div#nav-right {
+	font-size: 12px;
+}
+
+
+/* ????????
+---------------------------------------- */
+div#main-column div.box01 {
+	width: 600px;}
+
+div#main-column div.box01 h2 {
+	width: 600px;}
+
+div#main-column div.box01 ul {
+	width: 600px;
+	padding: 10px 0 0 0;}
+
+div#main-column div.box01 ul li {
+	padding: 0 10px 0 0;
+	float: left;}
+
+div#main-column div.box01 ul li.img01 {
+	width: 130px;}
+
+div#main-column div.box01 ul li.img02 {
+	width: 281px;}
+
+div#main-column div.box01 ul li.img03 {
+	width: 159px;}
+
+div#main-column div.box01 ul li.img03 span {
+	display: block;
+	padding: 10px 0 0 0;}
+
+div#main-column div.box02 {
+	width: 600px;}
+
+div#main-column div.box02 h2 {
+	width: 600px;
+	padding: 10px 0 5px 0;}
+
+div#main-column div.box02 ul {
+	width: 120px;
+	float: left;
+	background-color:}
+
+div#main-column div.box02 ul li {
+	padding: 0 3px 3px 0;
+	text-align: left;}
+
+div#main-column div.box02 ul li.item-txt {
+	height: auto !important;
+	height: 60px;
+	min-height: 60px;
+	font-size: 12px;
+	}
+
+div#main-column div.box02 p {
+	clear: both;
+	padding: 5px 0 0 0;
+	text-align: right;}
+
+div#main-column div.box03 {
+	width: 600px;
+	font-size: 12px;
+	padding: 0 0 10px 0;}
+
+div#main-column div.box03 h2 {
+	padding: 5px 0 7px 0;
+	clear: both;}
+
+div#main-column div.box03 div {
+	height: 220px;
+	width: 600px;
+	overflow: auto;
+	padding: 0;
+	margin: 0;
+	border: 1px #cccccc solid;
+	border-width: 1px 0 1px 0;}
+
+div#main-column div.box03 div ul {
+	padding: 0;
+	margin: 0;}
+
+div#main-column div.box03 div ul li {
+	padding: 5px 0 5px 10px;
+	border: 1px #cccccc solid;
+	border-width: 1px 0 0 1px;}
+
+div#main-column div.box03 div ul li.bg-gray {
+	background-color: #eeeeee;}
+
+div#main-column div.box03 div ul li span.day {
+	width: 60px;
+	text-align: left;
+	float: left;
+	color: #FF0000;}
+
+div#main-column div.box03 div ul li span.topic-txt {
+	width: 400px;
+	text-align: left;}
+
+div#main-column div.box03 div ul li p {}
+
+
+/* ????
+------------------------------------------------------------------------------------*/
+div#footer {}
+
+div#footer div {}
+
+div#footer div.top-list {
+	padding: 6px 0;
+	font-size: 12px;
+	background: url(../../img/renewal/foot_bg_top.gif) center top no-repeat #D3D3D3;}
+
+div#footer div.middle-list {
+	padding: 6px 0;
+	font-size: 12px;
+	background: url(../../img/renewal/foot_bg_middle.gif) center top repeat-y #D2E3EC;}
+
+div#footer div.bottom-list {
+	background: url(../../img/renewal/foot_bg_bottom2.gif) center bottom repeat-y #AECBDA;
+	border: 1px solid #D6D6D6;
+	border-width: 1px 0;}
+
+div#footer div ul li {
+	display: inline;}
+
+div#footer div.bottom-list ul li {
+	display: block;
+	padding: 10px 0 10px 0;
+	float: left;
+	text-align: left;
+	font-size: 10px;}
+
+div#footer div.bottom-list ul li p {
+	font-size: 10px;
+	text-align: left;}
+
+div#footer div.bottom-list ul li.bottom-list01 {
+	width: 225px;}
+
+div#footer div.bottom-list ul li.bottom-list01 p {
+	text-align: left;}
+
+div#footer div.bottom-list ul li.bottom-list01 p.bottom-img01 {
+	width: 55px;
+	float: left;
+	text-align: center;}
+
+div#footer div.bottom-list ul li.bottom-list02 {
+	width: 178px;}
+
+div#footer div.bottom-list ul li.bottom-list02 p {
+	padding: 0 0 0 10px;}
+
+div#footer div.bottom-list ul li.bottom-list03 {
+	width: 250px;}
+
+div#footer div.bottom-list ul li.bottom-list03 p {
+	padding: 0 10px 0 0;
+	text-align: left;}
+
+div#footer div.bottom-list ul li.bottom-list03 p.bottom-img03 {
+	width: 130px;
+	padding: 0;
+	float: left;
+	text-align: center;}
+
+div#footer div.bottom-list ul li.bottom-list04 {
+	width: 127px;
+	text-align: center;}
+
+div#footer p#footer-copy {
+	clear: both;
+	padding: 10px 0;
+	text-align: center;}
+
+
Index: /branches/mobile/html/test/kakinaka/index.php
===================================================================
--- /branches/mobile/html/test/kakinaka/index.php	(revision 9299)
+++ /branches/mobile/html/test/kakinaka/index.php	(revision 9299)
@@ -0,0 +1,35 @@
+<?php
+
+require_once("../../require.php");
+
+$objView = new SC_UserView("./templates/");
+$objImage = new SC_Image(IMAGE_TEMP_DIR);
+
+//---- ¥Ú¡¼¥¸É½¼¨ÍÑ¥¯¥é¥¹
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'customer/release_set.tpl';
+		$this->tpl_mainno = 'release_set';
+		$this->tpl_subnavi = 'customer/subnavi.tpl';
+		$this->tpl_subno = 'release_set';
+		
+		global $arrRelease;
+		$this->arrRelease = $arrRelease;
+	}
+}
+
+exit();
+
+//---- ¥Ú¡¼¥¸É½¼¨ÍÑ¥¯¥é¥¹
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'customer/release_set.tpl';
+		$this->tpl_mainno = 'release_set';
+		$this->tpl_subnavi = 'customer/subnavi.tpl';
+		$this->tpl_subno = 'release_set';
+		
+		global $arrRelease;
+		$this->arrRelease = $arrRelease;
+	}
+}
+?>
Index: /branches/mobile/html/test/kakinaka/session.php
===================================================================
--- /branches/mobile/html/test/kakinaka/session.php	(revision 6672)
+++ /branches/mobile/html/test/kakinaka/session.php	(revision 6672)
@@ -0,0 +1,10 @@
+<?php
+
+require_once("../../require.php");
+
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+
+sfprintr($_SESSION);
+
+?>
Index: /branches/mobile/html/test/kakinaka/js/dom/dom.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/dom/dom.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/dom/dom.js	(revision 7213)
@@ -0,0 +1,899 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+Version: 0.11.3
+*/
+
+/**
+ * @class Provides helper methods for DOM elements.
+ */
+YAHOO.util.Dom = function() {
+   var ua = navigator.userAgent.toLowerCase();
+   var isOpera = (ua.indexOf('opera') > -1);
+   var isSafari = (ua.indexOf('safari') > -1);
+   var isIE = (window.ActiveXObject);
+
+   var id_counter = 0;
+   var util = YAHOO.util; // internal shorthand
+   var property_cache = {}; // to cache case conversion for set/getStyle
+
+   var toCamel = function(property) {
+      var convert = function(prop) {
+         var test = /(-[a-z])/i.exec(prop);
+         return prop.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());
+      };
+
+      while(property.indexOf('-') > -1) {
+         property = convert(property);
+      }
+
+      return property;
+      //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
+   };
+
+   var toHyphen = function(property) {
+      if (property.indexOf('-') > -1) { // assume hyphen
+         return property;
+      }
+
+      var converted = '';
+      for (var i = 0, len = property.length;i < len; ++i) {
+         if (property.charAt(i) == property.charAt(i).toUpperCase()) {
+            converted = converted + '-' + property.charAt(i).toLowerCase();
+         } else {
+            converted = converted + property.charAt(i);
+         }
+      }
+
+      return converted;
+      //return property.replace(/([a-z])([A-Z]+)/g, function(m0, m1, m2) {return (m1 + '-' + m2.toLowerCase())});
+   };
+
+   // improve performance by only looking up once
+   var cacheConvertedProperties = function(property) {
+      property_cache[property] = {
+         camel: toCamel(property),
+         hyphen: toHyphen(property)
+      };
+   };
+
+   return {
+      /**
+       * Returns an HTMLElement reference
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @return {HTMLElement/Array} A DOM reference to an HTML element or an array of HTMLElements.
+       */
+      get: function(el) {
+         if (!el) { return null; } // nothing to work with
+
+         if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is
+            return el;
+         }
+
+         if (typeof el == 'string') { // ID
+            return document.getElementById(el);
+         }
+         else { // array of ID's and/or elements
+            var collection = [];
+            for (var i = 0, len = el.length; i < len; ++i) {
+               collection[collection.length] = util.Dom.get(el[i]);
+            }
+
+            return collection;
+         }
+
+         return null; // safety, should never happen
+      },
+
+      /**
+       * Normalizes currentStyle and ComputedStyle.
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @param {String} property The style property whose value is returned.
+       * @return {String/Array} The current value of the style property for the element(s).
+       */
+      getStyle: function(el, property) {
+         var f = function(el) {
+            var value = null;
+            var dv = document.defaultView;
+
+            if (!property_cache[property]) {
+               cacheConvertedProperties(property);
+            }
+
+            var camel = property_cache[property]['camel'];
+            var hyphen = property_cache[property]['hyphen'];
+
+            if (property == 'opacity' && el.filters) {// IE opacity
+               value = 1;
+               try {
+                  value = el.filters.item('DXImageTransform.Microsoft.Alpha').opacity / 100;
+               } catch(e) {
+                  try {
+                     value = el.filters.item('alpha').opacity / 100;
+                  } catch(e) {}
+               }
+            } else if (el.style[camel]) { // camelCase for valid styles
+               value = el.style[camel];
+            }
+            else if (isIE && el.currentStyle && el.currentStyle[camel]) { // camelCase for currentStyle; isIE to workaround broken Opera 9 currentStyle
+               value = el.currentStyle[camel];
+            }
+            else if ( dv && dv.getComputedStyle ) { // hyphen-case for computedStyle
+               var computed = dv.getComputedStyle(el, '');
+
+               if (computed && computed.getPropertyValue(hyphen)) {
+                  value = computed.getPropertyValue(hyphen);
+               }
+            }
+
+            return value;
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Wrapper for setting style properties of HTMLElements.  Normalizes "opacity" across modern browsers.
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @param {String} property The style property to be set.
+       * @param {String} val The value to apply to the given property.
+       */
+      setStyle: function(el, property, val) {
+         if (!property_cache[property]) {
+            cacheConvertedProperties(property);
+         }
+
+         var camel = property_cache[property]['camel'];
+
+         var f = function(el) {
+            switch(property) {
+               case 'opacity' :
+                  if (isIE && typeof el.style.filter == 'string') { // in case not appended
+                     el.style.filter = 'alpha(opacity=' + val * 100 + ')';
+
+                     if (!el.currentStyle || !el.currentStyle.hasLayout) {
+                        el.style.zoom = 1; // when no layout or cant tell
+                     }
+                  } else {
+                     el.style.opacity = val;
+                     el.style['-moz-opacity'] = val;
+                     el.style['-khtml-opacity'] = val;
+                  }
+
+                  break;
+               default :
+                  el.style[camel] = val;
+            }
+
+
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Gets the current position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+       @ return {Array} The XY position of the element(s)
+       */
+      getXY: function(el) {
+         var f = function(el) {
+
+         // has to be part of document to have pageXY
+            if (el.offsetParent === null || this.getStyle(el, 'display') == 'none') {
+               return false;
+            }
+
+            var parentNode = null;
+            var pos = [];
+            var box;
+
+            if (el.getBoundingClientRect) { // IE
+               box = el.getBoundingClientRect();
+               var doc = document;
+               if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
+                  doc = parent.document;
+
+                  if ( !this.isAncestor(doc.documentElement, el) ) {
+                     return false;
+                  }
+
+               }
+
+               var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
+               var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
+
+               return [box.left + scrollLeft, box.top + scrollTop];
+            }
+            else { // safari, opera, & gecko
+               pos = [el.offsetLeft, el.offsetTop];
+               parentNode = el.offsetParent;
+               if (parentNode != el) {
+                  while (parentNode) {
+                     pos[0] += parentNode.offsetLeft;
+                     pos[1] += parentNode.offsetTop;
+                     parentNode = parentNode.offsetParent;
+                  }
+               }
+               if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases
+                  pos[0] -= document.body.offsetLeft;
+                  pos[1] -= document.body.offsetTop;
+               }
+            }
+
+            if (el.parentNode) { parentNode = el.parentNode; }
+            else { parentNode = null; }
+
+            while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')
+            { // account for any scrolled ancestors
+               if (util.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug
+                  pos[0] -= parentNode.scrollLeft;
+                  pos[1] -= parentNode.scrollTop;
+               }
+
+               if (parentNode.parentNode) { parentNode = parentNode.parentNode; }
+               else { parentNode = null; }
+            }
+
+
+            return pos;
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Gets the current X position of an element based on page coordinates.  The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+       * @return {String/Array} The X position of the element(s)
+       */
+      getX: function(el) {
+         var f = function(el) {
+            return util.Dom.getXY(el)[0];
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Gets the current Y position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+       * @return {String/Array} The Y position of the element(s)
+       */
+      getY: function(el) {
+         var f = function(el) {
+            return util.Dom.getXY(el)[1];
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Set the position of an html element in page coordinates, regardless of how the element is positioned.
+       * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+       * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
+       * @param {Boolean} noRetry By default we try and set the position a second time if the first fails
+       */
+      setXY: function(el, pos, noRetry) {
+         var f = function(el) {
+            var style_pos = this.getStyle(el, 'position');
+            if (style_pos == 'static') { // default to relative
+               this.setStyle(el, 'position', 'relative');
+               style_pos = 'relative';
+            }
+
+            var pageXY = this.getXY(el);
+            if (pageXY === false) { // has to be part of doc to have pageXY
+               return false;
+            }
+
+            var delta = [ // assuming pixels; if not we will have to retry
+               parseInt( this.getStyle(el, 'left'), 10 ),
+               parseInt( this.getStyle(el, 'top'), 10 )
+            ];
+
+            if ( isNaN(delta[0]) ) {// in case of 'auto'
+               delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
+            }
+            if ( isNaN(delta[1]) ) { // in case of 'auto'
+               delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
+            }
+
+            if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
+            if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
+
+            var newXY = this.getXY(el);
+
+            // if retry is true, try one more time if we miss
+            if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) {
+               this.setXY(el, pos, true);
+            }
+
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Set the X position of an html element in page coordinates, regardless of how the element is positioned.
+       * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @param {Int} x to use as the X coordinate for the element(s).
+       */
+      setX: function(el, x) {
+         util.Dom.setXY(el, [x, null]);
+      },
+
+      /**
+       * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
+       * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @param {Int} x to use as the Y coordinate for the element(s).
+       */
+      setY: function(el, y) {
+         util.Dom.setXY(el, [null, y]);
+      },
+
+      /**
+       * Returns the region position of the given element.
+       * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @return {Region/Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
+       */
+      getRegion: function(el) {
+         var f = function(el) {
+            var region = new YAHOO.util.Region.getRegion(el);
+            return region;
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Returns the width of the client (viewport).
+       * Now using getViewportWidth.  This interface left intact for back compat.
+       * @return {Int} The width of the viewable area of the page.
+       */
+      getClientWidth: function() {
+         return util.Dom.getViewportWidth();
+      },
+
+      /**
+       * Returns the height of the client (viewport).
+       * Now using getViewportHeight.  This interface left intact for back compat.
+       * @return {Int} The height of the viewable area of the page.
+       */
+      getClientHeight: function() {
+         return util.Dom.getViewportHeight();
+      },
+
+      /**
+       * Returns a array of HTMLElements with the given class
+       * For optimized performance, include a tag and/or root node if possible
+       * @param {String} className The class name to match against
+       * @param {String} tag (optional) The tag name of the elements being collected
+       * @param {String/HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
+       * @return {Array} An array of elements that have the given class name
+       */
+      getElementsByClassName: function(className, tag, root) {
+         var method = function(el) { return util.Dom.hasClass(el, className) };
+         return util.Dom.getElementsBy(method, tag, root);
+      },
+
+      /**
+       * Determines whether an HTMLElement has the given className
+       * @param {String/HTMLElement/Array} el The element or collection to test
+       * @param {String} className the class name to search for
+       * @return {Boolean/Array} A boolean value or array of boolean values
+       */
+      hasClass: function(el, className) {
+         var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+
+         var f = function(el) {
+            return re.test(el['className']);
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Adds a class name to a given element or collection of elements
+       * @param {String/HTMLElement/Array} el The element or collection to add the class to
+       * @param {String} className the class name to add to the class attribute
+       */
+      addClass: function(el, className) {
+         var f = function(el) {
+            if (this.hasClass(el, className)) { return; } // already present
+
+
+            el['className'] = [el['className'], className].join(' ');
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Removes a class name from a given element or collection of elements
+       * @param {String/HTMLElement/Array} el The element or collection to remove the class from
+       * @param {String} className the class name to remove from the class attribute
+       */
+      removeClass: function(el, className) {
+         var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
+
+         var f = function(el) {
+            if (!this.hasClass(el, className)) { return; } // not present
+
+
+            var c = el['className'];
+            el['className'] = c.replace(re, ' ');
+            if ( this.hasClass(el, className) ) { // in case of multiple adjacent
+               this.removeClass(el, className);
+            }
+
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Replace a class with another class for a given element or collection of elements.
+       * If no oldClassName is present, the newClassName is simply added.
+       * @param {String/HTMLElement/Array} el The element or collection to remove the class from
+       * @param {String} oldClassName the class name to be replaced
+       * @param {String} newClassName the class name that will be replacing the old class name
+       */
+      replaceClass: function(el, oldClassName, newClassName) {
+         if (oldClassName === newClassName) { // avoid infinite loop
+            return false;
+         };
+
+         var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
+
+         var f = function(el) {
+
+            if ( !this.hasClass(el, oldClassName) ) {
+               this.addClass(el, newClassName); // just add it if nothing to replace
+               return; // note return
+            }
+
+            el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');
+
+            if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
+               this.replaceClass(el, oldClassName, newClassName);
+            }
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Generates a unique ID
+       * @param {String/HTMLElement/Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present)
+       * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen")
+       * @return {String/Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
+       */
+      generateId: function(el, prefix) {
+         prefix = prefix || 'yui-gen';
+         el = el || {};
+
+         var f = function(el) {
+            if (el) {
+               el = util.Dom.get(el);
+            } else {
+               el = {}; // just generating ID in this case
+            }
+
+            if (!el.id) {
+               el.id = prefix + id_counter++;
+            } // dont override existing
+
+
+            return el.id;
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy
+       * @param {String/HTMLElement} haystack The possible ancestor
+       * @param {String/HTMLElement} needle The possible descendent
+       * @return {Boolean} Whether or not the haystack is an ancestor of needle
+       */
+      isAncestor: function(haystack, needle) {
+         haystack = util.Dom.get(haystack);
+         if (!haystack || !needle) { return false; }
+
+         var f = function(needle) {
+            if (haystack.contains && !isSafari) { // safari "contains" is broken
+               return haystack.contains(needle);
+            }
+            else if ( haystack.compareDocumentPosition ) {
+               return !!(haystack.compareDocumentPosition(needle) & 16);
+            }
+            else { // loop up and test each parent
+               var parent = needle.parentNode;
+
+               while (parent) {
+                  if (parent == haystack) {
+                     return true;
+                  }
+                  else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
+                     return false;
+                  }
+
+                  parent = parent.parentNode;
+               }
+               return false;
+            }
+         };
+
+         return util.Dom.batch(needle, f, util.Dom, true);
+      },
+
+      /**
+       * Determines whether an HTMLElement is present in the current document
+       * @param {String/HTMLElement} el The element to search for
+       * @return {Boolean} Whether or not the element is present in the current document
+       */
+      inDocument: function(el) {
+         var f = function(el) {
+            return this.isAncestor(document.documentElement, el);
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Returns a array of HTMLElements that pass the test applied by supplied boolean method
+       * For optimized performance, include a tag and/or root node if possible
+       * @param {Function} method A boolean method to test elements with
+       * @param {String} tag (optional) The tag name of the elements being collected
+       * @param {String/HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
+       */
+      getElementsBy: function(method, tag, root) {
+         tag = tag || '*';
+         root = util.Dom.get(root) || document;
+
+         var nodes = [];
+         var elements = root.getElementsByTagName(tag);
+
+         if ( !elements.length && (tag == '*' && root.all) ) {
+            elements = root.all; // IE < 6
+         }
+
+         for (var i = 0, len = elements.length; i < len; ++i)
+         {
+            if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
+         }
+
+
+         return nodes;
+      },
+
+      /**
+       * Returns an array of elements that have had the supplied method applied.
+       * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) )
+       * @param {String/HTMLElement/Array} el (optional) An element or array of elements to apply the method to
+       * @param {Function} method The method to apply to the element(s)
+       * @param {Generic} (optional) o An optional arg that is passed to the supplied method
+       * @param {Boolean} (optional) override Whether or not to override the scope of "method" with "o"
+       * @return {HTMLElement/Array} The element(s) with the method applied
+       */
+      batch: function(el, method, o, override) {
+         var id = el;
+         el = util.Dom.get(el);
+
+         var scope = (override) ? o : window;
+
+         if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
+            if (!el) {
+               return false;
+            }
+            return method.call(scope, el, o);
+         }
+
+         var collection = [];
+
+         for (var i = 0, len = el.length; i < len; ++i) {
+            if (!el[i]) {
+               id = id[i];
+            }
+            collection[collection.length] = method.call(scope, el[i], o);
+         }
+
+         return collection;
+      },
+
+      /**
+       * Returns the height of the document.
+       * @return {Int} The height of the actual document (which includes the body and its margin).
+       */
+      getDocumentHeight: function() {
+         var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;
+         var marginTop = parseInt(util.Dom.getStyle(document.body, 'marginTop'), 10);
+         var marginBottom = parseInt(util.Dom.getStyle(document.body, 'marginBottom'), 10);
+
+         var mode = document.compatMode;
+
+         if ( (mode || isIE) && !isOpera ) { // (IE, Gecko)
+            switch (mode) {
+               case 'CSS1Compat': // Standards mode
+                  scrollHeight = ((window.innerHeight && window.scrollMaxY) ?  window.innerHeight+window.scrollMaxY : -1);
+                  windowHeight = [document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a, b){return(a-b);})[1];
+                  bodyHeight = document.body.offsetHeight + marginTop + marginBottom;
+                  break;
+
+               default: // Quirks
+                  scrollHeight = document.body.scrollHeight;
+                  bodyHeight = document.body.clientHeight;
+            }
+         } else { // Safari & Opera
+            scrollHeight = document.documentElement.scrollHeight;
+            windowHeight = self.innerHeight;
+            bodyHeight = document.documentElement.clientHeight;
+         }
+
+         var h = [scrollHeight,windowHeight,bodyHeight].sort(function(a, b){return(a-b);});
+         return h[2];
+      },
+
+      /**
+       * Returns the width of the document.
+       * @return {Int} The width of the actual document (which includes the body and its margin).
+       */
+      getDocumentWidth: function() {
+         var docWidth=-1,bodyWidth=-1,winWidth=-1;
+         var marginRight = parseInt(util.Dom.getStyle(document.body, 'marginRight'), 10);
+         var marginLeft = parseInt(util.Dom.getStyle(document.body, 'marginLeft'), 10);
+
+         var mode = document.compatMode;
+
+         if (mode || isIE) { // (IE, Gecko, Opera)
+            switch (mode) {
+               case 'CSS1Compat': // Standards mode
+                  docWidth = document.documentElement.clientWidth;
+                  bodyWidth = document.body.offsetWidth + marginLeft + marginRight;
+                  break;
+
+               default: // Quirks
+                  bodyWidth = document.body.clientWidth;
+                  docWidth = document.body.scrollWidth;
+                  break;
+            }
+         } else { // Safari
+            docWidth = document.documentElement.clientWidth;
+            bodyWidth = document.body.offsetWidth + marginLeft + marginRight;
+         }
+
+         var w = Math.max(docWidth, bodyWidth);
+         return w;
+      },
+
+      /**
+       * Returns the current height of the viewport.
+       * @return {Int} The height of the viewable area of the page (excludes scrollbars).
+       */
+      getViewportHeight: function() {
+         var height = -1;
+         var mode = document.compatMode;
+
+         if ( (mode || isIE) && !isOpera ) {
+            switch (mode) { // (IE, Gecko)
+               case 'CSS1Compat': // Standards mode
+                  height = document.documentElement.clientHeight;
+                  break;
+
+               default: // Quirks
+                  height = document.body.clientHeight;
+            }
+         } else { // Safari, Opera
+            height = self.innerHeight;
+         }
+
+         return height;
+      },
+
+      /**
+       * Returns the current width of the viewport.
+       * @return {Int} The width of the viewable area of the page (excludes scrollbars).
+       */
+
+      getViewportWidth: function() {
+         var width = -1;
+         var mode = document.compatMode;
+
+         if (mode || isIE) { // (IE, Gecko, Opera)
+            switch (mode) {
+            case 'CSS1Compat': // Standards mode
+               width = document.documentElement.clientWidth;
+               break;
+
+            default: // Quirks
+               width = document.body.clientWidth;
+            }
+         } else { // Safari
+            width = self.innerWidth;
+         }
+         return width;
+      }
+   };
+}();
+
+/**
+ * @class A region is a representation of an object on a grid.  It is defined
+ * by the top, right, bottom, left extents, so is rectangular by default.  If
+ * other shapes are required, this class could be extended to support it.
+ *
+ * @param {int} t the top extent
+ * @param {int} r the right extent
+ * @param {int} b the bottom extent
+ * @param {int} l the left extent
+ * @constructor
+ */
+YAHOO.util.Region = function(t, r, b, l) {
+
+    /**
+     * The region's top extent
+     * @type int
+     */
+    this.top = t;
+
+    /**
+     * The region's top extent as index, for symmetry with set/getXY
+     * @type int
+     */
+    this[1] = t;
+
+    /**
+     * The region's right extent
+     * @type int
+     */
+    this.right = r;
+
+    /**
+     * The region's bottom extent
+     * @type int
+     */
+    this.bottom = b;
+
+    /**
+     * The region's left extent
+     * @type int
+     */
+    this.left = l;
+
+    /**
+     * The region's left extent as index, for symmetry with set/getXY
+     * @type int
+     */
+    this[0] = l;
+};
+
+/**
+ * Returns true if this region contains the region passed in
+ *
+ * @param  {Region}  region The region to evaluate
+ * @return {boolean}        True if the region is contained with this region,
+ *                          else false
+ */
+YAHOO.util.Region.prototype.contains = function(region) {
+    return ( region.left   >= this.left   &&
+             region.right  <= this.right  &&
+             region.top    >= this.top    &&
+             region.bottom <= this.bottom    );
+
+};
+
+/**
+ * Returns the area of the region
+ *
+ * @return {int} the region's area
+ */
+YAHOO.util.Region.prototype.getArea = function() {
+    return ( (this.bottom - this.top) * (this.right - this.left) );
+};
+
+/**
+ * Returns the region where the passed in region overlaps with this one
+ *
+ * @param  {Region} region The region that intersects
+ * @return {Region}        The overlap region, or null if there is no overlap
+ */
+YAHOO.util.Region.prototype.intersect = function(region) {
+    var t = Math.max( this.top,    region.top    );
+    var r = Math.min( this.right,  region.right  );
+    var b = Math.min( this.bottom, region.bottom );
+    var l = Math.max( this.left,   region.left   );
+
+    if (b >= t && r >= l) {
+        return new YAHOO.util.Region(t, r, b, l);
+    } else {
+        return null;
+    }
+};
+
+/**
+ * Returns the region representing the smallest region that can contain both
+ * the passed in region and this region.
+ *
+ * @param  {Region} region The region that to create the union with
+ * @return {Region}        The union region
+ */
+YAHOO.util.Region.prototype.union = function(region) {
+    var t = Math.min( this.top,    region.top    );
+    var r = Math.max( this.right,  region.right  );
+    var b = Math.max( this.bottom, region.bottom );
+    var l = Math.min( this.left,   region.left   );
+
+    return new YAHOO.util.Region(t, r, b, l);
+};
+
+/**
+ * toString
+ * @return string the region properties
+ */
+YAHOO.util.Region.prototype.toString = function() {
+    return ( "Region {"    +
+             "top: "       + this.top    +
+             ", right: "   + this.right  +
+             ", bottom: "  + this.bottom +
+             ", left: "    + this.left   +
+             "}" );
+};
+
+/**
+ * Returns a region that is occupied by the DOM element
+ *
+ * @param  {HTMLElement} el The element
+ * @return {Region}         The region that the element occupies
+ * @static
+ */
+YAHOO.util.Region.getRegion = function(el) {
+    var p = YAHOO.util.Dom.getXY(el);
+
+    var t = p[1];
+    var r = p[0] + el.offsetWidth;
+    var b = p[1] + el.offsetHeight;
+    var l = p[0];
+
+    return new YAHOO.util.Region(t, r, b, l);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @class
+ *
+ * A point is a region that is special in that it represents a single point on
+ * the grid.
+ *
+ * @param {int} x The X position of the point
+ * @param {int} y The Y position of the point
+ * @constructor
+ * @extends Region
+ */
+YAHOO.util.Point = function(x, y) {
+   if (x instanceof Array) { // accept output from Dom.getXY
+      y = x[1];
+      x = x[0];
+   }
+
+    /**
+     * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
+     * @type int
+     */
+
+    this.x = this.right = this.left = this[0] = x;
+
+    /**
+     * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
+     * @type int
+     */
+    this.y = this.top = this.bottom = this[1] = y;
+};
+
+YAHOO.util.Point.prototype = new YAHOO.util.Region();
+
Index: /branches/mobile/html/test/kakinaka/js/dom/dom-min.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/dom/dom-min.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/dom/dom-min.js	(revision 7213)
@@ -0,0 +1,1 @@
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.  Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ YAHOO.util.Dom=function(){var ua=navigator.userAgent.toLowerCase();var isOpera=(ua.indexOf('opera')>-1);var isSafari=(ua.indexOf('safari')>-1);var isIE=(window.ActiveXObject);var id_counter=0;var util=YAHOO.util;var property_cache={};var toCamel=function(property){var convert=function(prop){var test=/(-[a-z])/i.exec(prop);return prop.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());};while(property.indexOf('-')>-1){property=convert(property);}return property;};var toHyphen=function(property){if(property.indexOf('-')>-1){return property;}var converted='';for(var i=0,len=property.length;i<len;++i){if(property.charAt(i)==property.charAt(i).toUpperCase()){converted=converted+'-'+property.charAt(i).toLowerCase();}else{converted=converted+property.charAt(i);}}return converted;};var cacheConvertedProperties=function(property){property_cache[property]={camel:toCamel(property),hyphen:toHyphen(property)};};return{get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=util.Dom.get(el[i]);}return collection;}return null;},getStyle:function(el,property){var f=function(el){var value=null;var dv=document.defaultView;if(!property_cache[property]){cacheConvertedProperties(property);}var camel=property_cache[property]['camel'];var hyphen=property_cache[property]['hyphen'];if(property=='opacity'&&el.filters){value=1;try{value=el.filters.item('DXImageTransform.Microsoft.Alpha').opacity/100;}catch(e){try{value=el.filters.item('alpha').opacity/100;}catch(e){}}}else if(el.style[camel]){value=el.style[camel];}else if(isIE&&el.currentStyle&&el.currentStyle[camel]){value=el.currentStyle[camel];}else if(dv&&dv.getComputedStyle){var computed=dv.getComputedStyle(el,'');if(computed&&computed.getPropertyValue(hyphen)){value=computed.getPropertyValue(hyphen);}}return value;};return util.Dom.batch(el,f,util.Dom,true);},setStyle:function(el,property,val){if(!property_cache[property]){cacheConvertedProperties(property);}var camel=property_cache[property]['camel'];var f=function(el){switch(property){case'opacity':if(isIE&&typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}else{el.style.opacity=val;el.style['-moz-opacity']=val;el.style['-khtml-opacity']=val;}break;default:el.style[camel]=val;}};util.Dom.batch(el,f,util.Dom,true);},getXY:function(el){var f=function(el){if(el.offsetParent===null||this.getStyle(el,'display')=='none'){return false;}var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}}if(isSafari&&this.getStyle(el,'position')=='absolute'){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){parentNode=el.parentNode;}else{parentNode=null;}while(parentNode&&parentNode.tagName.toUpperCase()!='BODY'&&parentNode.tagName.toUpperCase()!='HTML'){if(util.Dom.getStyle(parentNode,'display')!='inline'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}if(parentNode.parentNode){parentNode=parentNode.parentNode;}else{parentNode=null;}}return pos;};return util.Dom.batch(el,f,util.Dom,true);},getX:function(el){var f=function(el){return util.Dom.getXY(el)[0];};return util.Dom.batch(el,f,util.Dom,true);},getY:function(el){var f=function(el){return util.Dom.getXY(el)[1];};return util.Dom.batch(el,f,util.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}var pageXY=this.getXY(el);if(pageXY===false){return false;}var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}};util.Dom.batch(el,f,util.Dom,true);},setX:function(el,x){util.Dom.setXY(el,[x,null]);},setY:function(el,y){util.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new YAHOO.util.Region.getRegion(el);return region;};return util.Dom.batch(el,f,util.Dom,true);},getClientWidth:function(){return util.Dom.getViewportWidth();},getClientHeight:function(){return util.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return util.Dom.hasClass(el,className)};return util.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el['className']);};return util.Dom.batch(el,f,util.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}el['className']=[el['className'],className].join(' ');};util.Dom.batch(el,f,util.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}var c=el['className'];el['className']=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};util.Dom.batch(el,f,util.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(oldClassName===newClassName){return false;};var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return;}el['className']=el['className'].replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};util.Dom.batch(el,f,util.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=util.Dom.get(el);}else{el={};}if(!el.id){el.id=prefix+id_counter++;}return el.id;};return util.Dom.batch(el,f,util.Dom,true);},isAncestor:function(haystack,needle){haystack=util.Dom.get(haystack);if(!haystack||!needle){return false;}var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}else if(!parent.tagName||parent.tagName.toUpperCase()=='HTML'){return false;}parent=parent.parentNode;}return false;}};return util.Dom.batch(needle,f,util.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return util.Dom.batch(el,f,util.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';root=util.Dom.get(root)||document;var nodes=[];var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}return nodes;},batch:function(el,method,o,override){var id=el;el=util.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return method.call(scope,el,o);}var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=id[i];}collection[collection.length]=method.call(scope,el[i],o);}return collection;},getDocumentHeight:function(){var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;var marginTop=parseInt(util.Dom.getStyle(document.body,'marginTop'),10);var marginBottom=parseInt(util.Dom.getStyle(document.body,'marginBottom'),10);var mode=document.compatMode;if((mode||isIE)&&!isOpera){switch(mode){case'CSS1Compat':scrollHeight=((window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:-1);windowHeight=[document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a,b){return(a-b);})[1];bodyHeight=document.body.offsetHeight+marginTop+marginBottom;break;default:scrollHeight=document.body.scrollHeight;bodyHeight=document.body.clientHeight;}}else{scrollHeight=document.documentElement.scrollHeight;windowHeight=self.innerHeight;bodyHeight=document.documentElement.clientHeight;}var h=[scrollHeight,windowHeight,bodyHeight].sort(function(a,b){return(a-b);});return h[2];},getDocumentWidth:function(){var docWidth=-1,bodyWidth=-1,winWidth=-1;var marginRight=parseInt(util.Dom.getStyle(document.body,'marginRight'),10);var marginLeft=parseInt(util.Dom.getStyle(document.body,'marginLeft'),10);var mode=document.compatMode;if(mode||isIE){switch(mode){case'CSS1Compat':docWidth=document.documentElement.clientWidth;bodyWidth=document.body.offsetWidth+marginLeft+marginRight;break;default:bodyWidth=document.body.clientWidth;docWidth=document.body.scrollWidth;break;}}else{docWidth=document.documentElement.clientWidth;bodyWidth=document.body.offsetWidth+marginLeft+marginRight;}var w=Math.max(docWidth,bodyWidth);return w;},getViewportHeight:function(){var height=-1;var mode=document.compatMode;if((mode||isIE)&&!isOpera){switch(mode){case'CSS1Compat':height=document.documentElement.clientHeight;break;default:height=document.body.clientHeight;}}else{height=self.innerHeight;}return height;},getViewportWidth:function(){var width=-1;var mode=document.compatMode;if(mode||isIE){switch(mode){case'CSS1Compat':width=document.documentElement.clientWidth;break;default:width=document.body.clientWidth;}}else{width=self.innerWidth;}return width;}};}();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();
Index: /branches/mobile/html/test/kakinaka/js/dom/dom-debug.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/dom/dom-debug.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/dom/dom-debug.js	(revision 7213)
@@ -0,0 +1,933 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+Version: 0.11.3
+*/
+
+/**
+ * @class Provides helper methods for DOM elements.
+ */
+YAHOO.util.Dom = function() {
+   var ua = navigator.userAgent.toLowerCase();
+   var isOpera = (ua.indexOf('opera') > -1);
+   var isSafari = (ua.indexOf('safari') > -1);
+   var isIE = (window.ActiveXObject);
+
+   var id_counter = 0;
+   var util = YAHOO.util; // internal shorthand
+   var property_cache = {}; // to cache case conversion for set/getStyle
+   var logger = {};
+   logger.log = function() {YAHOO.log.apply(window, arguments)};
+
+   var toCamel = function(property) {
+      var convert = function(prop) {
+         var test = /(-[a-z])/i.exec(prop);
+         return prop.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());
+      };
+
+      while(property.indexOf('-') > -1) {
+         property = convert(property);
+      }
+
+      return property;
+      //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
+   };
+
+   var toHyphen = function(property) {
+      if (property.indexOf('-') > -1) { // assume hyphen
+         return property;
+      }
+
+      var converted = '';
+      for (var i = 0, len = property.length;i < len; ++i) {
+         if (property.charAt(i) == property.charAt(i).toUpperCase()) {
+            converted = converted + '-' + property.charAt(i).toLowerCase();
+         } else {
+            converted = converted + property.charAt(i);
+         }
+      }
+
+      return converted;
+      //return property.replace(/([a-z])([A-Z]+)/g, function(m0, m1, m2) {return (m1 + '-' + m2.toLowerCase())});
+   };
+
+   // improve performance by only looking up once
+   var cacheConvertedProperties = function(property) {
+      property_cache[property] = {
+         camel: toCamel(property),
+         hyphen: toHyphen(property)
+      };
+   };
+
+   return {
+      /**
+       * Returns an HTMLElement reference
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @return {HTMLElement/Array} A DOM reference to an HTML element or an array of HTMLElements.
+       */
+      get: function(el) {
+         if (!el) { return null; } // nothing to work with
+
+         if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is
+            logger.log('get(' + el + ') returning ' + el, 'info', 'Dom');
+            return el;
+         }
+
+         if (typeof el == 'string') { // ID
+            logger.log('get("' + el + '") returning ' + document.getElementById(el), 'info', 'Dom');
+            return document.getElementById(el);
+         }
+         else { // array of ID's and/or elements
+            var collection = [];
+            for (var i = 0, len = el.length; i < len; ++i) {
+               collection[collection.length] = util.Dom.get(el[i]);
+            }
+
+            logger.log('get("' + el + '") returning ' + collection, 'info', 'Dom');
+            return collection;
+         }
+
+         logger.log('element ' + el + ' not found', 'error', 'Dom');
+         return null; // safety, should never happen
+      },
+
+      /**
+       * Normalizes currentStyle and ComputedStyle.
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @param {String} property The style property whose value is returned.
+       * @return {String/Array} The current value of the style property for the element(s).
+       */
+      getStyle: function(el, property) {
+         var f = function(el) {
+            var value = null;
+            var dv = document.defaultView;
+
+            if (!property_cache[property]) {
+               cacheConvertedProperties(property);
+            }
+
+            var camel = property_cache[property]['camel'];
+            var hyphen = property_cache[property]['hyphen'];
+
+            if (property == 'opacity' && el.filters) {// IE opacity
+               value = 1;
+               try {
+                  value = el.filters.item('DXImageTransform.Microsoft.Alpha').opacity / 100;
+               } catch(e) {
+                  try {
+                     value = el.filters.item('alpha').opacity / 100;
+                  } catch(e) {}
+               }
+            } else if (el.style[camel]) { // camelCase for valid styles
+               value = el.style[camel];
+            }
+            else if (isIE && el.currentStyle && el.currentStyle[camel]) { // camelCase for currentStyle; isIE to workaround broken Opera 9 currentStyle
+               value = el.currentStyle[camel];
+            }
+            else if ( dv && dv.getComputedStyle ) { // hyphen-case for computedStyle
+               var computed = dv.getComputedStyle(el, '');
+
+               if (computed && computed.getPropertyValue(hyphen)) {
+                  value = computed.getPropertyValue(hyphen);
+               }
+            }
+
+            logger.log('getStyle ' + property + ' returning ' + value, 'info', 'Dom');
+            return value;
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Wrapper for setting style properties of HTMLElements.  Normalizes "opacity" across modern browsers.
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @param {String} property The style property to be set.
+       * @param {String} val The value to apply to the given property.
+       */
+      setStyle: function(el, property, val) {
+         if (!property_cache[property]) {
+            cacheConvertedProperties(property);
+         }
+
+         var camel = property_cache[property]['camel'];
+
+         var f = function(el) {
+            switch(property) {
+               case 'opacity' :
+                  if (isIE && typeof el.style.filter == 'string') { // in case not appended
+                     el.style.filter = 'alpha(opacity=' + val * 100 + ')';
+
+                     if (!el.currentStyle || !el.currentStyle.hasLayout) {
+                        el.style.zoom = 1; // when no layout or cant tell
+                     }
+                  } else {
+                     el.style.opacity = val;
+                     el.style['-moz-opacity'] = val;
+                     el.style['-khtml-opacity'] = val;
+                  }
+
+                  break;
+               default :
+                  el.style[camel] = val;
+            }
+
+            logger.log('setStyle setting ' + property + ' to ' + val, 'info', 'Dom');
+
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Gets the current position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+       @ return {Array} The XY position of the element(s)
+       */
+      getXY: function(el) {
+         var f = function(el) {
+
+         // has to be part of document to have pageXY
+            if (el.offsetParent === null || this.getStyle(el, 'display') == 'none') {
+               logger.log('getXY failed: element not available', 'error', 'Dom');
+               return false;
+            }
+
+            var parentNode = null;
+            var pos = [];
+            var box;
+
+            if (el.getBoundingClientRect) { // IE
+               box = el.getBoundingClientRect();
+               var doc = document;
+               if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
+                  doc = parent.document;
+
+                  if ( !this.isAncestor(doc.documentElement, el) ) {
+                     logger.log('getXY failed: element not available', 'error', 'Dom');
+                     return false;
+                  }
+
+               }
+
+               var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
+               var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
+
+               return [box.left + scrollLeft, box.top + scrollTop];
+            }
+            else { // safari, opera, & gecko
+               pos = [el.offsetLeft, el.offsetTop];
+               parentNode = el.offsetParent;
+               if (parentNode != el) {
+                  while (parentNode) {
+                     pos[0] += parentNode.offsetLeft;
+                     pos[1] += parentNode.offsetTop;
+                     parentNode = parentNode.offsetParent;
+                  }
+               }
+               if (isSafari && this.getStyle(el, 'position') == 'absolute' ) { // safari doubles in some cases
+                  pos[0] -= document.body.offsetLeft;
+                  pos[1] -= document.body.offsetTop;
+               }
+            }
+
+            if (el.parentNode) { parentNode = el.parentNode; }
+            else { parentNode = null; }
+
+            while (parentNode && parentNode.tagName.toUpperCase() != 'BODY' && parentNode.tagName.toUpperCase() != 'HTML')
+            { // account for any scrolled ancestors
+               if (util.Dom.getStyle(parentNode, 'display') != 'inline') { // work around opera inline scrollLeft/Top bug
+                  pos[0] -= parentNode.scrollLeft;
+                  pos[1] -= parentNode.scrollTop;
+               }
+
+               if (parentNode.parentNode) { parentNode = parentNode.parentNode; }
+               else { parentNode = null; }
+            }
+
+            logger.log('getXY returning ' + pos, 'info', 'Dom');
+
+            return pos;
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Gets the current X position of an element based on page coordinates.  The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+       * @return {String/Array} The X position of the element(s)
+       */
+      getX: function(el) {
+         var f = function(el) {
+            return util.Dom.getXY(el)[0];
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Gets the current Y position of an element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+       * @return {String/Array} The Y position of the element(s)
+       */
+      getY: function(el) {
+         var f = function(el) {
+            return util.Dom.getXY(el)[1];
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Set the position of an html element in page coordinates, regardless of how the element is positioned.
+       * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
+       * @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
+       * @param {Boolean} noRetry By default we try and set the position a second time if the first fails
+       */
+      setXY: function(el, pos, noRetry) {
+         var f = function(el) {
+            var style_pos = this.getStyle(el, 'position');
+            if (style_pos == 'static') { // default to relative
+               this.setStyle(el, 'position', 'relative');
+               style_pos = 'relative';
+            }
+
+            var pageXY = this.getXY(el);
+            if (pageXY === false) { // has to be part of doc to have pageXY
+               logger.log('setXY failed: element not available', 'error', 'Dom');
+               return false;
+            }
+
+            var delta = [ // assuming pixels; if not we will have to retry
+               parseInt( this.getStyle(el, 'left'), 10 ),
+               parseInt( this.getStyle(el, 'top'), 10 )
+            ];
+
+            if ( isNaN(delta[0]) ) {// in case of 'auto'
+               delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
+            }
+            if ( isNaN(delta[1]) ) { // in case of 'auto'
+               delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
+            }
+
+            if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
+            if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
+
+            var newXY = this.getXY(el);
+
+            // if retry is true, try one more time if we miss
+            if (!noRetry && (newXY[0] != pos[0] || newXY[1] != pos[1]) ) {
+               this.setXY(el, pos, true);
+            }
+
+            logger.log('setXY setting position to ' + pos, 'info', 'Dom');
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Set the X position of an html element in page coordinates, regardless of how the element is positioned.
+       * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @param {Int} x to use as the X coordinate for the element(s).
+       */
+      setX: function(el, x) {
+         util.Dom.setXY(el, [x, null]);
+      },
+
+      /**
+       * Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
+       * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @param {Int} x to use as the Y coordinate for the element(s).
+       */
+      setY: function(el, y) {
+         util.Dom.setXY(el, [null, y]);
+      },
+
+      /**
+       * Returns the region position of the given element.
+       * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+       * @param {String/HTMLElement/Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
+       * @return {Region/Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
+       */
+      getRegion: function(el) {
+         var f = function(el) {
+            var region = new YAHOO.util.Region.getRegion(el);
+            logger.log('getRegion returning ' + region, 'info', 'Dom');
+            return region;
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Returns the width of the client (viewport).
+       * Now using getViewportWidth.  This interface left intact for back compat.
+       * @return {Int} The width of the viewable area of the page.
+       */
+      getClientWidth: function() {
+         return util.Dom.getViewportWidth();
+      },
+
+      /**
+       * Returns the height of the client (viewport).
+       * Now using getViewportHeight.  This interface left intact for back compat.
+       * @return {Int} The height of the viewable area of the page.
+       */
+      getClientHeight: function() {
+         return util.Dom.getViewportHeight();
+      },
+
+      /**
+       * Returns a array of HTMLElements with the given class
+       * For optimized performance, include a tag and/or root node if possible
+       * @param {String} className The class name to match against
+       * @param {String} tag (optional) The tag name of the elements being collected
+       * @param {String/HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
+       * @return {Array} An array of elements that have the given class name
+       */
+      getElementsByClassName: function(className, tag, root) {
+         var method = function(el) { return util.Dom.hasClass(el, className) };
+         return util.Dom.getElementsBy(method, tag, root);
+      },
+
+      /**
+       * Determines whether an HTMLElement has the given className
+       * @param {String/HTMLElement/Array} el The element or collection to test
+       * @param {String} className the class name to search for
+       * @return {Boolean/Array} A boolean value or array of boolean values
+       */
+      hasClass: function(el, className) {
+         var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
+
+         var f = function(el) {
+            logger.log('hasClass returning ' + re.test(el['className']), 'info', 'Dom');
+            return re.test(el['className']);
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Adds a class name to a given element or collection of elements
+       * @param {String/HTMLElement/Array} el The element or collection to add the class to
+       * @param {String} className the class name to add to the class attribute
+       */
+      addClass: function(el, className) {
+         var f = function(el) {
+            if (this.hasClass(el, className)) { return; } // already present
+
+            logger.log('addClass adding ' + className, 'info', 'Dom');
+
+            el['className'] = [el['className'], className].join(' ');
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Removes a class name from a given element or collection of elements
+       * @param {String/HTMLElement/Array} el The element or collection to remove the class from
+       * @param {String} className the class name to remove from the class attribute
+       */
+      removeClass: function(el, className) {
+         var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
+
+         var f = function(el) {
+            if (!this.hasClass(el, className)) { return; } // not present
+
+            logger.log('removeClass removing ' + className, 'info', 'Dom');
+
+            var c = el['className'];
+            el['className'] = c.replace(re, ' ');
+            if ( this.hasClass(el, className) ) { // in case of multiple adjacent
+               this.removeClass(el, className);
+            }
+
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Replace a class with another class for a given element or collection of elements.
+       * If no oldClassName is present, the newClassName is simply added.
+       * @param {String/HTMLElement/Array} el The element or collection to remove the class from
+       * @param {String} oldClassName the class name to be replaced
+       * @param {String} newClassName the class name that will be replacing the old class name
+       */
+      replaceClass: function(el, oldClassName, newClassName) {
+         if (oldClassName === newClassName) { // avoid infinite loop
+            return false;
+         };
+
+         var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
+
+         var f = function(el) {
+            logger.log('replaceClass replacing ' + oldClassName + ' with ' + newClassName, 'info', 'Dom');
+
+            if ( !this.hasClass(el, oldClassName) ) {
+               this.addClass(el, newClassName); // just add it if nothing to replace
+               return; // note return
+            }
+
+            el['className'] = el['className'].replace(re, ' ' + newClassName + ' ');
+
+            if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
+               this.replaceClass(el, oldClassName, newClassName);
+            }
+         };
+
+         util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Generates a unique ID
+       * @param {String/HTMLElement/Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present)
+       * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen")
+       * @return {String/Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
+       */
+      generateId: function(el, prefix) {
+         prefix = prefix || 'yui-gen';
+         el = el || {};
+
+         var f = function(el) {
+            if (el) {
+               el = util.Dom.get(el);
+            } else {
+               el = {}; // just generating ID in this case
+            }
+
+            if (!el.id) {
+               el.id = prefix + id_counter++;
+               logger.log('generateId generating ' + el.id, 'info', 'Dom');
+            } // dont override existing
+
+            logger.log('generateId returning ' + el.id, 'info', 'Dom');
+
+            return el.id;
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy
+       * @param {String/HTMLElement} haystack The possible ancestor
+       * @param {String/HTMLElement} needle The possible descendent
+       * @return {Boolean} Whether or not the haystack is an ancestor of needle
+       */
+      isAncestor: function(haystack, needle) {
+         haystack = util.Dom.get(haystack);
+         if (!haystack || !needle) { return false; }
+
+         var f = function(needle) {
+            if (haystack.contains && !isSafari) { // safari "contains" is broken
+               logger.log('isAncestor returning ' + haystack.contains(needle), 'info', 'Dom');
+               return haystack.contains(needle);
+            }
+            else if ( haystack.compareDocumentPosition ) {
+               logger.log('isAncestor returning ' + !!(haystack.compareDocumentPosition(needle) & 16), 'info', 'Dom');
+               return !!(haystack.compareDocumentPosition(needle) & 16);
+            }
+            else { // loop up and test each parent
+               var parent = needle.parentNode;
+
+               while (parent) {
+                  if (parent == haystack) {
+                     logger.log('isAncestor returning true', 'info', 'Dom');
+                     return true;
+                  }
+                  else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
+                     logger.log('isAncestor returning false', 'info', 'Dom');
+                     return false;
+                  }
+
+                  parent = parent.parentNode;
+               }
+               logger.log('isAncestor returning false', 'info', 'Dom');
+               return false;
+            }
+         };
+
+         return util.Dom.batch(needle, f, util.Dom, true);
+      },
+
+      /**
+       * Determines whether an HTMLElement is present in the current document
+       * @param {String/HTMLElement} el The element to search for
+       * @return {Boolean} Whether or not the element is present in the current document
+       */
+      inDocument: function(el) {
+         var f = function(el) {
+            return this.isAncestor(document.documentElement, el);
+         };
+
+         return util.Dom.batch(el, f, util.Dom, true);
+      },
+
+      /**
+       * Returns a array of HTMLElements that pass the test applied by supplied boolean method
+       * For optimized performance, include a tag and/or root node if possible
+       * @param {Function} method A boolean method to test elements with
+       * @param {String} tag (optional) The tag name of the elements being collected
+       * @param {String/HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
+       */
+      getElementsBy: function(method, tag, root) {
+         tag = tag || '*';
+         root = util.Dom.get(root) || document;
+
+         var nodes = [];
+         var elements = root.getElementsByTagName(tag);
+
+         if ( !elements.length && (tag == '*' && root.all) ) {
+            elements = root.all; // IE < 6
+         }
+
+         for (var i = 0, len = elements.length; i < len; ++i)
+         {
+            if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
+         }
+
+         logger.log('getElementsBy returning ' + nodes, 'info', 'Dom');
+
+         return nodes;
+      },
+
+      /**
+       * Returns an array of elements that have had the supplied method applied.
+       * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) )
+       * @param {String/HTMLElement/Array} el (optional) An element or array of elements to apply the method to
+       * @param {Function} method The method to apply to the element(s)
+       * @param {Generic} (optional) o An optional arg that is passed to the supplied method
+       * @param {Boolean} (optional) override Whether or not to override the scope of "method" with "o"
+       * @return {HTMLElement/Array} The element(s) with the method applied
+       */
+      batch: function(el, method, o, override) {
+         var id = el;
+         el = util.Dom.get(el);
+
+         var scope = (override) ? o : window;
+
+         if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
+            if (!el) {
+               logger.log(id + ' not available', 'error', 'Dom');
+               return false;
+            }
+            return method.call(scope, el, o);
+         }
+
+         var collection = [];
+
+         for (var i = 0, len = el.length; i < len; ++i) {
+            if (!el[i]) {
+               id = id[i];
+               logger.log(id + ' not available', 'error', 'Dom');
+            }
+            collection[collection.length] = method.call(scope, el[i], o);
+         }
+
+         return collection;
+      },
+
+      /**
+       * Returns the height of the document.
+       * @return {Int} The height of the actual document (which includes the body and its margin).
+       */
+      getDocumentHeight: function() {
+         var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;
+         var marginTop = parseInt(util.Dom.getStyle(document.body, 'marginTop'), 10);
+         var marginBottom = parseInt(util.Dom.getStyle(document.body, 'marginBottom'), 10);
+
+         var mode = document.compatMode;
+
+         if ( (mode || isIE) && !isOpera ) { // (IE, Gecko)
+            switch (mode) {
+               case 'CSS1Compat': // Standards mode
+                  scrollHeight = ((window.innerHeight && window.scrollMaxY) ?  window.innerHeight+window.scrollMaxY : -1);
+                  windowHeight = [document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a, b){return(a-b);})[1];
+                  bodyHeight = document.body.offsetHeight + marginTop + marginBottom;
+                  break;
+
+               default: // Quirks
+                  scrollHeight = document.body.scrollHeight;
+                  bodyHeight = document.body.clientHeight;
+            }
+         } else { // Safari & Opera
+            scrollHeight = document.documentElement.scrollHeight;
+            windowHeight = self.innerHeight;
+            bodyHeight = document.documentElement.clientHeight;
+         }
+
+         var h = [scrollHeight,windowHeight,bodyHeight].sort(function(a, b){return(a-b);});
+         logger.log('getDocumentHeight returning ' + h[2], 'info', 'Dom');
+         return h[2];
+      },
+
+      /**
+       * Returns the width of the document.
+       * @return {Int} The width of the actual document (which includes the body and its margin).
+       */
+      getDocumentWidth: function() {
+         var docWidth=-1,bodyWidth=-1,winWidth=-1;
+         var marginRight = parseInt(util.Dom.getStyle(document.body, 'marginRight'), 10);
+         var marginLeft = parseInt(util.Dom.getStyle(document.body, 'marginLeft'), 10);
+
+         var mode = document.compatMode;
+
+         if (mode || isIE) { // (IE, Gecko, Opera)
+            switch (mode) {
+               case 'CSS1Compat': // Standards mode
+                  docWidth = document.documentElement.clientWidth;
+                  bodyWidth = document.body.offsetWidth + marginLeft + marginRight;
+                  break;
+
+               default: // Quirks
+                  bodyWidth = document.body.clientWidth;
+                  docWidth = document.body.scrollWidth;
+                  break;
+            }
+         } else { // Safari
+            docWidth = document.documentElement.clientWidth;
+            bodyWidth = document.body.offsetWidth + marginLeft + marginRight;
+         }
+
+         var w = Math.max(docWidth, bodyWidth);
+         logger.log('getDocumentWidth returning ' + w[2], 'info', 'Dom');
+         return w;
+      },
+
+      /**
+       * Returns the current height of the viewport.
+       * @return {Int} The height of the viewable area of the page (excludes scrollbars).
+       */
+      getViewportHeight: function() {
+         var height = -1;
+         var mode = document.compatMode;
+
+         if ( (mode || isIE) && !isOpera ) {
+            switch (mode) { // (IE, Gecko)
+               case 'CSS1Compat': // Standards mode
+                  height = document.documentElement.clientHeight;
+                  break;
+
+               default: // Quirks
+                  height = document.body.clientHeight;
+            }
+         } else { // Safari, Opera
+            height = self.innerHeight;
+         }
+
+         logger.log('getViewportHeight returning ' + height, 'info', 'Dom');
+         return height;
+      },
+
+      /**
+       * Returns the current width of the viewport.
+       * @return {Int} The width of the viewable area of the page (excludes scrollbars).
+       */
+
+      getViewportWidth: function() {
+         var width = -1;
+         var mode = document.compatMode;
+
+         if (mode || isIE) { // (IE, Gecko, Opera)
+            switch (mode) {
+            case 'CSS1Compat': // Standards mode
+               width = document.documentElement.clientWidth;
+               break;
+
+            default: // Quirks
+               width = document.body.clientWidth;
+            }
+         } else { // Safari
+            width = self.innerWidth;
+         }
+         logger.log('getViewportWidth returning ' + width, 'info', 'Dom');
+         return width;
+      }
+   };
+}();
+
+/**
+ * @class A region is a representation of an object on a grid.  It is defined
+ * by the top, right, bottom, left extents, so is rectangular by default.  If
+ * other shapes are required, this class could be extended to support it.
+ *
+ * @param {int} t the top extent
+ * @param {int} r the right extent
+ * @param {int} b the bottom extent
+ * @param {int} l the left extent
+ * @constructor
+ */
+YAHOO.util.Region = function(t, r, b, l) {
+
+    /**
+     * The region's top extent
+     * @type int
+     */
+    this.top = t;
+
+    /**
+     * The region's top extent as index, for symmetry with set/getXY
+     * @type int
+     */
+    this[1] = t;
+
+    /**
+     * The region's right extent
+     * @type int
+     */
+    this.right = r;
+
+    /**
+     * The region's bottom extent
+     * @type int
+     */
+    this.bottom = b;
+
+    /**
+     * The region's left extent
+     * @type int
+     */
+    this.left = l;
+
+    /**
+     * The region's left extent as index, for symmetry with set/getXY
+     * @type int
+     */
+    this[0] = l;
+};
+
+/**
+ * Returns true if this region contains the region passed in
+ *
+ * @param  {Region}  region The region to evaluate
+ * @return {boolean}        True if the region is contained with this region,
+ *                          else false
+ */
+YAHOO.util.Region.prototype.contains = function(region) {
+    return ( region.left   >= this.left   &&
+             region.right  <= this.right  &&
+             region.top    >= this.top    &&
+             region.bottom <= this.bottom    );
+
+    // this.logger.debug("does " + this + " contain " + region + " ... " + ret);
+};
+
+/**
+ * Returns the area of the region
+ *
+ * @return {int} the region's area
+ */
+YAHOO.util.Region.prototype.getArea = function() {
+    return ( (this.bottom - this.top) * (this.right - this.left) );
+};
+
+/**
+ * Returns the region where the passed in region overlaps with this one
+ *
+ * @param  {Region} region The region that intersects
+ * @return {Region}        The overlap region, or null if there is no overlap
+ */
+YAHOO.util.Region.prototype.intersect = function(region) {
+    var t = Math.max( this.top,    region.top    );
+    var r = Math.min( this.right,  region.right  );
+    var b = Math.min( this.bottom, region.bottom );
+    var l = Math.max( this.left,   region.left   );
+
+    if (b >= t && r >= l) {
+        return new YAHOO.util.Region(t, r, b, l);
+    } else {
+        return null;
+    }
+};
+
+/**
+ * Returns the region representing the smallest region that can contain both
+ * the passed in region and this region.
+ *
+ * @param  {Region} region The region that to create the union with
+ * @return {Region}        The union region
+ */
+YAHOO.util.Region.prototype.union = function(region) {
+    var t = Math.min( this.top,    region.top    );
+    var r = Math.max( this.right,  region.right  );
+    var b = Math.max( this.bottom, region.bottom );
+    var l = Math.min( this.left,   region.left   );
+
+    return new YAHOO.util.Region(t, r, b, l);
+};
+
+/**
+ * toString
+ * @return string the region properties
+ */
+YAHOO.util.Region.prototype.toString = function() {
+    return ( "Region {"    +
+             "top: "       + this.top    +
+             ", right: "   + this.right  +
+             ", bottom: "  + this.bottom +
+             ", left: "    + this.left   +
+             "}" );
+};
+
+/**
+ * Returns a region that is occupied by the DOM element
+ *
+ * @param  {HTMLElement} el The element
+ * @return {Region}         The region that the element occupies
+ * @static
+ */
+YAHOO.util.Region.getRegion = function(el) {
+    var p = YAHOO.util.Dom.getXY(el);
+
+    var t = p[1];
+    var r = p[0] + el.offsetWidth;
+    var b = p[1] + el.offsetHeight;
+    var l = p[0];
+
+    return new YAHOO.util.Region(t, r, b, l);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ * @class
+ *
+ * A point is a region that is special in that it represents a single point on
+ * the grid.
+ *
+ * @param {int} x The X position of the point
+ * @param {int} y The Y position of the point
+ * @constructor
+ * @extends Region
+ */
+YAHOO.util.Point = function(x, y) {
+   if (x instanceof Array) { // accept output from Dom.getXY
+      y = x[1];
+      x = x[0];
+   }
+
+    /**
+     * The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
+     * @type int
+     */
+
+    this.x = this.right = this.left = this[0] = x;
+
+    /**
+     * The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
+     * @type int
+     */
+    this.y = this.top = this.bottom = this[1] = y;
+};
+
+YAHOO.util.Point.prototype = new YAHOO.util.Region();
+
Index: /branches/mobile/html/test/kakinaka/js/logger/logger.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/logger/logger.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/logger/logger.js	(revision 7213)
@@ -0,0 +1,1290 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.com/yui/license.txt
+version: 0.11.3
+*/
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+/**
+ * Singleton providing core logging functionality. Saves logs written through the
+ * global YAHOO.log function or written by LogWriter. Provides access to logs
+ * for reading by LogReader. Log messages can be automatically output to browser
+ * console such as the Firebug extension to Firefox or Safari's JavaScript
+ * console, if present.
+ *
+ * requires YAHOO.util.Event Event utility
+ */
+YAHOO.widget.Logger = {
+    // Initialize members
+    loggerEnabled: true,
+    _browserConsoleEnabled: false,
+    categories: ["info","warn","error","time","window"],
+    sources: ["global"],
+    _stack: [], // holds all log msgs
+    maxStackEntries: 5,
+    _startTime: new Date().getTime(), // static start timestamp
+    _lastTime: null // timestamp of last logged message
+};
+
+/***************************************************************************
+ * Events
+ ***************************************************************************/
+/**
+ * Fired when a new category has been created. Subscribers receive the following
+ * array:<br>
+ *     - args[0] The category name
+ */
+YAHOO.widget.Logger.categoryCreateEvent = new YAHOO.util.CustomEvent("categoryCreate", this, true);
+
+/**
+ * Fired when a new source has been named. Subscribers receive the following
+ * array:<br>
+ *     - args[0] The source name
+ */
+YAHOO.widget.Logger.sourceCreateEvent = new YAHOO.util.CustomEvent("sourceCreate", this, true);
+
+/**
+ * Fired when a new log message has been created. Subscribers receive the
+ * following array:<br>
+ *     - args[0] The log message
+ */
+YAHOO.widget.Logger.newLogEvent = new YAHOO.util.CustomEvent("newLog", this, true);
+
+/**
+ * Fired when the Logger has been reset has been created.
+ */
+YAHOO.widget.Logger.logResetEvent = new YAHOO.util.CustomEvent("logReset", this, true);
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+/**
+ * Saves a log message to the stack and fires newLogEvent. If the log message is
+ * assigned to an unknown category, creates a new category. If the log message is
+ * from an unknown source, creates a new source.  If browser console is enabled,
+ * outputs the log message to browser console.
+ *
+ * @param {string} sMsg The log message
+ * @param {string} sCategory Category of log message, or null
+ * @param {string} sSource Source of LogWriter, or null if global
+ */
+YAHOO.widget.Logger.log = function(sMsg, sCategory, sSource) {
+    if(this.loggerEnabled) {
+        if(!sCategory) {
+            sCategory = "info"; // default category
+        }
+        else {
+            sCategory = sCategory.toLocaleLowerCase();
+            if(this._isNewCategory(sCategory)) {
+                this._createNewCategory(sCategory);
+            }
+        }
+        var sClass = "global"; // default source
+        var sDetail = null;
+        if(sSource) {
+            var spaceIndex = sSource.indexOf(" ");
+            if(spaceIndex > 0) {
+                sClass = sSource.substring(0,spaceIndex);// substring until first space
+                sDetail = sSource.substring(spaceIndex,sSource.length);// the rest of the source
+            }
+            else {
+                sClass = sSource;
+            }
+            if(this._isNewSource(sClass)) {
+                this._createNewSource(sClass);
+            }
+        }
+
+        var timestamp = new Date();
+        var logEntry = {
+            time: timestamp,
+            category: sCategory,
+            source: sClass,
+            sourceDetail: sDetail,
+            msg: sMsg
+        };
+
+        var stack = this._stack;
+        var maxStackEntries = this.maxStackEntries;
+        if(maxStackEntries && !isNaN(maxStackEntries) && (stack.length >= maxStackEntries)) {
+            stack.shift();
+        }
+        stack.push(logEntry);
+        this.newLogEvent.fire(logEntry);
+
+        if(this._browserConsoleEnabled) {
+            this._printToBrowserConsole(logEntry);
+        }
+        return true;
+    }
+    else {
+        return false;
+    }
+};
+
+/**
+ * Resets internal stack and startTime, enables Logger, and fires logResetEvent.
+ *
+ */
+YAHOO.widget.Logger.reset = function() {
+    this._stack = [];
+    this._startTime = new Date().getTime();
+    this.loggerEnabled = true;
+    this.log("Logger reset");
+    this.logResetEvent.fire();
+};
+
+/**
+ * Public accessor to internal stack of log messages.
+ *
+ * @return {array} Array of log messages.
+ */
+YAHOO.widget.Logger.getStack = function() {
+    return this._stack;
+};
+
+/**
+ * Public accessor to internal start time.
+ *
+ * @return {date} Internal date of when Logger singleton was initialized.
+ */
+YAHOO.widget.Logger.getStartTime = function() {
+    return this._startTime;
+};
+
+/**
+ * Disables output to the browser's global console.log() function, which is used
+ * by the Firebug extension to Firefox as well as Safari.
+ */
+YAHOO.widget.Logger.disableBrowserConsole = function() {
+    YAHOO.log("Logger output to the function console.log() has been disabled.");
+    this._browserConsoleEnabled = false;
+};
+
+/**
+ * Enables output to the browser's global console.log() function, which is used
+ * by the Firebug extension to Firefox as well as Safari.
+ */
+YAHOO.widget.Logger.enableBrowserConsole = function() {
+    this._browserConsoleEnabled = true;
+    YAHOO.log("Logger output to the function console.log() has been enabled.");
+};
+
+/***************************************************************************
+ * Private methods
+ ***************************************************************************/
+/**
+ * Creates a new category of log messages and fires categoryCreateEvent.
+ *
+ * @param {string} category Category name
+ * @private
+ */
+YAHOO.widget.Logger._createNewCategory = function(category) {
+    this.categories.push(category);
+    this.categoryCreateEvent.fire(category);
+};
+
+/**
+ * Checks to see if a category has already been created.
+ *
+ * @param {string} category Category name
+ * @return {boolean} Returns true if category is unknown, else returns false
+ * @private
+ */
+YAHOO.widget.Logger._isNewCategory = function(category) {
+    for(var i=0; i < this.categories.length; i++) {
+        if(category == this.categories[i]) {
+            return false;
+        }
+    }
+    return true;
+};
+
+/**
+ * Creates a new source of log messages and fires sourceCreateEvent.
+ *
+ * @param {string} source Source name
+ * @private
+ */
+YAHOO.widget.Logger._createNewSource = function(source) {
+    this.sources.push(source);
+    this.sourceCreateEvent.fire(source);
+};
+
+/**
+ * Checks to see if a source has already been created.
+ *
+ * @param {string} source Source name
+ * @return {boolean} Returns true if source is unknown, else returns false
+ * @private
+ */
+YAHOO.widget.Logger._isNewSource = function(source) {
+    if(source) {
+        for(var i=0; i < this.sources.length; i++) {
+            if(source == this.sources[i]) {
+                return false;
+            }
+        }
+        return true;
+    }
+};
+
+/**
+ * Outputs a log message to global console.log() function.
+ *
+ * @param {object} entry Log entry object
+ * @private
+ */
+YAHOO.widget.Logger._printToBrowserConsole = function(entry) {
+    if(window.console && console.log) {
+        var category = entry.category;
+        var label = entry.category.substring(0,4).toUpperCase();
+
+        var time = entry.time;
+        if (time.toLocaleTimeString) {
+            var localTime  = time.toLocaleTimeString();
+        }
+        else {
+            localTime = time.toString();
+        }
+
+        var msecs = time.getTime();
+        var elapsedTime = (YAHOO.widget.Logger._lastTime) ?
+            (msecs - YAHOO.widget.Logger._lastTime) : 0;
+        YAHOO.widget.Logger._lastTime = msecs;
+
+        var output =
+            localTime + " (" +
+            elapsedTime + "ms): " +
+            entry.source + ": " +
+            entry.msg;
+
+        console.log(output);
+    }
+};
+
+/***************************************************************************
+ * Private event handlers
+ ***************************************************************************/
+/**
+ * Handles logging of messages due to window error events.
+ *
+ * @param {string} msg The error message
+ * @param {string} url URL of the error
+ * @param {string} line Line number of the error
+ * @private
+ */
+YAHOO.widget.Logger._onWindowError = function(msg,url,line) {
+    // Logger is not in scope of this event handler
+    try {
+        YAHOO.widget.Logger.log(msg+' ('+url+', line '+line+')', "window");
+        if(YAHOO.widget.Logger._origOnWindowError) {
+            YAHOO.widget.Logger._origOnWindowError();
+        }
+    }
+    catch(e) {
+        return false;
+    }
+};
+
+/**
+ * Handle native JavaScript errors
+ */
+//NB: Not all browsers support the window.onerror event
+if(window.onerror) {
+    // Save any previously defined handler to call
+    YAHOO.widget.Logger._origOnWindowError = window.onerror;
+}
+window.onerror = YAHOO.widget.Logger._onWindowError;
+
+/**
+ * First log
+ */
+YAHOO.widget.Logger.log("Logger initialized");
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+/**
+ * Class providing ability to log messages through YAHOO.widget.Logger from a
+ * named source.
+ *
+ * @constructor
+ * @param {string} sSource Source of LogWriter instance
+ */
+YAHOO.widget.LogWriter = function(sSource) {
+    if(!sSource) {
+        YAHOO.log("Could not instantiate LogWriter due to invalid source.", "error", "LogWriter");
+        return;
+    }
+    this._source = sSource;
+ };
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+ /**
+ * Public accessor to the unique name of the LogWriter instance.
+ *
+ * @return {string} Unique name of the LogWriter instance
+ */
+YAHOO.widget.LogWriter.prototype.toString = function() {
+    return "LogWriter " + this._sSource;
+};
+
+/**
+ * Logs a message attached to the source of the LogWriter.
+ *
+ * @param {string} sMsg The log message
+ * @param {string} sCategory Category name
+ */
+YAHOO.widget.LogWriter.prototype.log = function(sMsg, sCategory) {
+    YAHOO.widget.Logger.log(sMsg, sCategory, this._source);
+};
+
+/**
+ * Public accessor to get the source name.
+ *
+ * @return {string} The LogWriter source
+ */
+YAHOO.widget.LogWriter.prototype.getSource = function() {
+    return this._sSource;
+};
+
+/**
+ * Public accessor to set the source name.
+ *
+ * @param {string} sSource Source of LogWriter instance
+ */
+YAHOO.widget.LogWriter.prototype.setSource = function(sSource) {
+    if(!sSource) {
+        YAHOO.log("Could not set source due to invalid source.", "error", this.toString());
+        return;
+    }
+    else {
+        this._sSource = sSource;
+    }
+};
+/***************************************************************************
+ * Private members
+ ***************************************************************************/
+/**
+ * Source of the log writer instance.
+ *
+ * @type string
+ * @private
+ */
+YAHOO.widget.LogWriter.prototype._source = null;
+
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * Class providing UI to read messages logged to YAHOO.widget.Logger.
+ *
+ * requires YAHOO.util.Dom DOM utility
+ * requires YAHOO.util.Event Event utility
+ * optional YAHOO.util.DragDrop Drag and drop utility
+ *
+ * @constructor
+ * @param {el or ID} containerEl DOM element object or ID of container to wrap reader UI
+ * @param {object} oConfig Optional object literal of configuration params
+ */
+YAHOO.widget.LogReader = function(containerEl, oConfig) {
+    var oSelf = this;
+    this._sName = YAHOO.widget.LogReader._index;
+    YAHOO.widget.LogReader._index++;
+
+    // Parse config vars here
+    if (typeof oConfig == "object") {
+        for(var param in oConfig) {
+            this[param] = oConfig[param];
+        }
+    }
+
+    // Attach container...
+    if(containerEl) {
+        if(typeof containerEl == "string") {
+            this._containerEl = document.getElementById(containerEl);
+        }
+        else if(containerEl.tagName) {
+            this._containerEl = containerEl;
+        }
+        this._containerEl.className = "yui-log";
+    }
+    // ...or create container from scratch
+    if(!this._containerEl) {
+        if(YAHOO.widget.LogReader._defaultContainerEl) {
+            this._containerEl =  YAHOO.widget.LogReader._defaultContainerEl;
+        }
+        else {
+            this._containerEl = document.body.appendChild(document.createElement("div"));
+            this._containerEl.id = "yui-log";
+            this._containerEl.className = "yui-log";
+
+            YAHOO.widget.LogReader._defaultContainerEl = this._containerEl;
+        }
+
+        // If implementer has provided container values, trust and set those
+        var containerStyle = this._containerEl.style;
+        if(this.width) {
+            containerStyle.width = this.width;
+        }
+        if(this.left) {
+            containerStyle.left = this.left;
+        }
+        if(this.right) {
+            containerStyle.right = this.right;
+        }
+        if(this.bottom) {
+            containerStyle.bottom = this.bottom;
+        }
+        if(this.top) {
+            containerStyle.top = this.top;
+        }
+        if(this.fontSize) {
+            containerStyle.fontSize = this.fontSize;
+        }
+    }
+
+    if(this._containerEl) {
+        // Create header
+        if(!this._hdEl) {
+            this._hdEl = this._containerEl.appendChild(document.createElement("div"));
+            this._hdEl.id = "yui-log-hd" + this._sName;
+            this._hdEl.className = "yui-log-hd";
+
+            this._collapseEl = this._hdEl.appendChild(document.createElement("div"));
+            this._collapseEl.className = "yui-log-btns";
+
+            this._collapseBtn = document.createElement("input");
+            this._collapseBtn.type = "button";
+            this._collapseBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+            this._collapseBtn.className = "yui-log-button";
+            this._collapseBtn.value = "Collapse";
+            this._collapseBtn = this._collapseEl.appendChild(this._collapseBtn);
+            YAHOO.util.Event.addListener(oSelf._collapseBtn,'click',oSelf._onClickCollapseBtn,oSelf);
+
+            this._title = this._hdEl.appendChild(document.createElement("h4"));
+            this._title.innerHTML = "Logger Console";
+
+            // If Drag and Drop utility is available...
+            // ...and this container was created from scratch...
+            // ...then make the header draggable
+            if(YAHOO.util.DD &&
+            (YAHOO.widget.LogReader._defaultContainerEl == this._containerEl)) {
+                var ylog_dd = new YAHOO.util.DD(this._containerEl.id);
+                ylog_dd.setHandleElId(this._hdEl.id);
+                this._hdEl.style.cursor = "move";
+            }
+        }
+        // Ceate console
+        if(!this._consoleEl) {
+            this._consoleEl = this._containerEl.appendChild(document.createElement("div"));
+            this._consoleEl.className = "yui-log-bd";
+
+            // If implementer has provided console, trust and set those
+            if(this.height) {
+                this._consoleEl.style.height = this.height;
+            }
+        }
+        // Don't create footer if disabled
+        if(!this._ftEl && this.footerEnabled) {
+            this._ftEl = this._containerEl.appendChild(document.createElement("div"));
+            this._ftEl.className = "yui-log-ft";
+
+            this._btnsEl = this._ftEl.appendChild(document.createElement("div"));
+            this._btnsEl.className = "yui-log-btns";
+
+            this._pauseBtn = document.createElement("input");
+            this._pauseBtn.type = "button";
+            this._pauseBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+            this._pauseBtn.className = "yui-log-button";
+            this._pauseBtn.value = "Pause";
+            this._pauseBtn = this._btnsEl.appendChild(this._pauseBtn);
+            YAHOO.util.Event.addListener(oSelf._pauseBtn,'click',oSelf._onClickPauseBtn,oSelf);
+
+            this._clearBtn = document.createElement("input");
+            this._clearBtn.type = "button";
+            this._clearBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+            this._clearBtn.className = "yui-log-button";
+            this._clearBtn.value = "Clear";
+            this._clearBtn = this._btnsEl.appendChild(this._clearBtn);
+            YAHOO.util.Event.addListener(oSelf._clearBtn,'click',oSelf._onClickClearBtn,oSelf);
+
+            this._categoryFiltersEl = this._ftEl.appendChild(document.createElement("div"));
+            this._categoryFiltersEl.className = "yui-log-categoryfilters";
+            this._sourceFiltersEl = this._ftEl.appendChild(document.createElement("div"));
+            this._sourceFiltersEl.className = "yui-log-sourcefilters";
+        }
+    }
+
+    // Initialize internal vars
+    if(!this._buffer) {
+        this._buffer = []; // output buffer
+    }
+    this._lastTime = YAHOO.widget.Logger.getStartTime(); // timestamp of last log message to console
+    
+    // Subscribe to Logger custom events
+    YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog, this);
+    YAHOO.widget.Logger.logResetEvent.subscribe(this._onReset, this);
+
+    // Initialize category filters
+    this._categoryFilters = [];
+    var catsLen = YAHOO.widget.Logger.categories.length;
+    if(this._categoryFiltersEl) {
+        for(var i=0; i < catsLen; i++) {
+            this._createCategoryCheckbox(YAHOO.widget.Logger.categories[i]);
+        }
+    }
+    // Initialize source filters
+    this._sourceFilters = [];
+    var sourcesLen = YAHOO.widget.Logger.sources.length;
+    if(this._sourceFiltersEl) {
+        for(var j=0; j < sourcesLen; j++) {
+            this._createSourceCheckbox(YAHOO.widget.Logger.sources[j]);
+        }
+    }
+    YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate, this);
+    YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate, this);
+
+    this._filterLogs();
+    YAHOO.log("LogReader initialized", null, this.toString());
+};
+
+/***************************************************************************
+ * Public members
+ ***************************************************************************/
+/**
+ * Whether or not the log reader is enabled to output log messages. Default:
+ * true.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.logReaderEnabled = true;
+
+/**
+ * Public member to access CSS width of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.width = null;
+
+/**
+ * Public member to access CSS height of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.height = null;
+
+/**
+ * Public member to access CSS top position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.top = null;
+
+/**
+ * Public member to access CSS left position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.left = null;
+
+/**
+ * Public member to access CSS right position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.right = null;
+
+/**
+ * Public member to access CSS bottom position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.bottom = null;
+
+/**
+ * Public member to access CSS font size of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.fontSize = null;
+
+/**
+ * Whether or not the footer UI is enabled for the log reader. Default: true.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.footerEnabled = true;
+
+/**
+ * Whether or not output is verbose (more readable). Setting to true will make
+ * output more compact (less readable). Default: true.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.verboseOutput = true;
+
+/**
+ * Whether or not newest message is printed on top. Default: true.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.newestOnTop = true;
+
+/**
+ * Maximum number of messages a LogReader console will display. Default: 500;
+ *
+ * @type number
+ */
+YAHOO.widget.LogReader.prototype.thresholdMax = 500;
+
+/**
+ * When a LogReader console reaches its thresholdMax, it will clear out messages
+ * and print out the latest thresholdMin number of messages. Default: 100;
+ *
+ * @type number
+ */
+YAHOO.widget.LogReader.prototype.thresholdMin = 100;
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+ /**
+ * Public accessor to the unique name of the LogReader instance.
+ *
+ * @return {string} Unique name of the LogReader instance
+ */
+YAHOO.widget.LogReader.prototype.toString = function() {
+    return "LogReader instance" + this._sName;
+};
+/**
+ * Pauses output of log messages. While paused, log messages are not lost, but
+ * get saved to a buffer and then output upon resume of log reader.
+ */
+YAHOO.widget.LogReader.prototype.pause = function() {
+    this._timeout = null;
+    this.logReaderEnabled = false;
+};
+
+/**
+ * Resumes output of log messages, including outputting any log messages that
+ * have been saved to buffer while paused.
+ */
+YAHOO.widget.LogReader.prototype.resume = function() {
+    this.logReaderEnabled = true;
+    this._printBuffer();
+};
+
+/**
+ * Hides UI of log reader. Logging functionality is not disrupted.
+ */
+YAHOO.widget.LogReader.prototype.hide = function() {
+    this._containerEl.style.display = "none";
+};
+
+/**
+ * Shows UI of log reader. Logging functionality is not disrupted.
+ */
+YAHOO.widget.LogReader.prototype.show = function() {
+    this._containerEl.style.display = "block";
+};
+
+/**
+ * Updates title to given string.
+ *
+ * @param {string} sTitle String to display in log reader's title bar.
+ */
+YAHOO.widget.LogReader.prototype.setTitle = function(sTitle) {
+    this._title.innerHTML = this._HTML2Text(sTitle);
+};
+ /***************************************************************************
+ * Private members
+ ***************************************************************************/
+/**
+ * Internal class member to index multiple log reader instances.
+ *
+ * @type number
+ * @private
+ */
+YAHOO.widget.LogReader._index = 0;
+
+/**
+ * Name of LogReader instance.
+ *
+ * @type string
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sName = null;
+
+/**
+ * A class member shared by all log readers if a container needs to be
+ * created during instantiation. Will be null if a container element never needs to
+ * be created on the fly, such as when the implementer passes in their own element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader._defaultContainerEl = null;
+
+/**
+ * Buffer of log messages for batch output.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._buffer = null;
+
+/**
+ * Number of log messages output to console.
+ *
+ * @type number
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._consoleMsgCount = 0;
+
+/**
+ * Date of last output log message.
+ *
+ * @type date
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._lastTime = null;
+
+/**
+ * Batched output timeout ID.
+ *
+ * @type number
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._timeout = null;
+
+/**
+ * Array of filters for log message categories.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._categoryFilters = null;
+
+/**
+ * Array of filters for log message sources.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sourceFilters = null;
+
+/**
+ * Log reader container element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._containerEl = null;
+
+/**
+ * Log reader header element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._hdEl = null;
+
+/**
+ * Log reader collapse element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._collapseEl = null;
+
+/**
+ * Log reader collapse button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._collapseBtn = null;
+
+/**
+ * Log reader title header element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._title = null;
+
+/**
+ * Log reader console element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._consoleEl = null;
+
+/**
+ * Log reader footer element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._ftEl = null;
+
+/**
+ * Log reader buttons container element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._btnsEl = null;
+
+/**
+ * Container element for log reader category filter checkboxes.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._categoryFiltersEl = null;
+
+/**
+ * Container element for log reader source filter checkboxes.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sourceFiltersEl = null;
+
+/**
+ * Log reader pause button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._pauseBtn = null;
+
+/**
+ * Clear button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._clearBtn = null;
+/***************************************************************************
+ * Private methods
+ ***************************************************************************/
+/**
+ * Creates the UI for a category filter in the log reader footer element.
+ *
+ * @param {string} category Category name
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._createCategoryCheckbox = function(category) {
+    var oSelf = this;
+
+    if(this._ftEl) {
+        var parentEl = this._categoryFiltersEl;
+        var filters = this._categoryFilters;
+
+        var filterEl = parentEl.appendChild(document.createElement("span"));
+        filterEl.className = "yui-log-filtergrp";
+            // Append el at the end so IE 5.5 can set "type" attribute
+            // and THEN set checked property
+            var categoryChk = document.createElement("input");
+            categoryChk.id = "yui-log-filter-" + category + this._sName;
+            categoryChk.className = "yui-log-filter-" + category;
+            categoryChk.type = "checkbox";
+            categoryChk.category = category;
+            categoryChk = filterEl.appendChild(categoryChk);
+            categoryChk.checked = true;
+
+            // Add this checked filter to the internal array of filters
+            filters.push(category);
+            // Subscribe to the click event
+            YAHOO.util.Event.addListener(categoryChk,'click',oSelf._onCheckCategory,oSelf);
+
+            // Create and class the text label
+            var categoryChkLbl = filterEl.appendChild(document.createElement("label"));
+            categoryChkLbl.htmlFor = categoryChk.id;
+            categoryChkLbl.className = category;
+            categoryChkLbl.innerHTML = category;
+    }
+};
+
+YAHOO.widget.LogReader.prototype._createSourceCheckbox = function(source) {
+    var oSelf = this;
+
+    if(this._ftEl) {
+        var parentEl = this._sourceFiltersEl;
+        var filters = this._sourceFilters;
+
+        var filterEl = parentEl.appendChild(document.createElement("span"));
+        filterEl.className = "yui-log-filtergrp";
+
+        // Append el at the end so IE 5.5 can set "type" attribute
+        // and THEN set checked property
+        var sourceChk = document.createElement("input");
+        sourceChk.id = "yui-log-filter" + source + this._sName;
+        sourceChk.className = "yui-log-filter" + source;
+        sourceChk.type = "checkbox";
+        sourceChk.source = source;
+        sourceChk = filterEl.appendChild(sourceChk);
+        sourceChk.checked = true;
+
+        // Add this checked filter to the internal array of filters
+        filters.push(source);
+        // Subscribe to the click event
+        YAHOO.util.Event.addListener(sourceChk,'click',oSelf._onCheckSource,oSelf);
+
+        // Create and class the text label
+        var sourceChkLbl = filterEl.appendChild(document.createElement("label"));
+        sourceChkLbl.htmlFor = sourceChk.id;
+        sourceChkLbl.className = source;
+        sourceChkLbl.innerHTML = source;
+    }
+};
+
+/**
+ * Reprints all log messages in the stack through filters.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._filterLogs = function() {
+    // Reprint stack with new filters
+    if (this._consoleEl !== null) {
+        this._clearConsole();
+        this._printToConsole(YAHOO.widget.Logger.getStack());
+    }
+};
+
+/**
+ * Clears all outputted log messages from the console and resets the time of the
+ * last output log message.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._clearConsole = function() {
+    // Clear the buffer of any pending messages
+    this._timeout = null;
+    this._buffer = [];
+    this._consoleMsgCount = 0;
+
+    // Reset the rolling timer
+    this._lastTime = YAHOO.widget.Logger.getStartTime();
+
+    var consoleEl = this._consoleEl;
+    while(consoleEl.hasChildNodes()) {
+        consoleEl.removeChild(consoleEl.firstChild);
+    }
+};
+
+/**
+ * Sends buffer of log messages to output and clears buffer.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._printBuffer = function() {
+    this._timeout = null;
+
+    if(this._consoleEl !== null) {
+        var thresholdMax = this.thresholdMax;
+        thresholdMax = (thresholdMax && !isNaN(thresholdMax)) ? thresholdMax : 500;
+        if(this._consoleMsgCount < thresholdMax) {
+            var entries = [];
+            for (var i=0; i<this._buffer.length; i++) {
+                entries[i] = this._buffer[i];
+            }
+            this._buffer = [];
+            this._printToConsole(entries);
+        }
+        else {
+            this._filterLogs();
+        }
+        
+        if(!this.newestOnTop) {
+            this._consoleEl.scrollTop = this._consoleEl.scrollHeight;
+        }
+    }
+};
+
+/**
+ * Cycles through an array of log messages, and outputs each one to the console
+ * if its category has not been filtered out.
+ *
+ * @param {array} aEntries
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._printToConsole = function(aEntries) {
+    // Manage the number of messages displayed in the console
+    var entriesLen = aEntries.length;
+    var thresholdMin = this.thresholdMin;
+    if(isNaN(thresholdMin) || (thresholdMin > this.thresholdMax)) {
+        thresholdMin = 0;
+    }
+    var entriesStartIndex = (entriesLen > thresholdMin) ? (entriesLen - thresholdMin) : 0;
+    
+    // Iterate through all log entries to print the ones that filter through
+    var sourceFiltersLen = this._sourceFilters.length;
+    var categoryFiltersLen = this._categoryFilters.length;
+    for(var i=entriesStartIndex; i<entriesLen; i++) {
+        var entry = aEntries[i];
+        var category = entry.category;
+        var source = entry.source;
+        var sourceDetail = entry.sourceDetail;
+        var okToPrint = false;
+        var okToFilterCats = false;
+
+        for(var j=0; j<sourceFiltersLen; j++) {
+            if(source == this._sourceFilters[j]) {
+                okToFilterCats = true;
+                break;
+            }
+        }
+        if(okToFilterCats) {
+            for(var k=0; k<categoryFiltersLen; k++) {
+                if(category == this._categoryFilters[k]) {
+                    okToPrint = true;
+                    break;
+                }
+            }
+        }
+        if(okToPrint) {
+            // To format for console, calculate the elapsed time
+            // to be from the last item that passed through the filter,
+            // not the absolute previous item in the stack
+            var label = entry.category.substring(0,4).toUpperCase();
+
+            var time = entry.time;
+            if (time.toLocaleTimeString) {
+                var localTime  = time.toLocaleTimeString();
+            }
+            else {
+                localTime = time.toString();
+            }
+
+            var msecs = time.getTime();
+            var startTime = YAHOO.widget.Logger.getStartTime();
+            var totalTime = msecs - startTime;
+            var elapsedTime = msecs - this._lastTime;
+            this._lastTime = msecs;
+
+            var verboseOutput = (this.verboseOutput);
+            var container = (verboseOutput) ? "CODE" : "PRE";
+            var sourceAndDetail = (sourceDetail) ?
+                source + " " + sourceDetail : source;
+
+            // Verbose uses code tag instead of pre tag (for wrapping)
+            // and includes extra line breaks
+            var output =  (verboseOutput) ?
+                ["<p><span class='", category, "'>", label, "</span> ",
+                totalTime, "ms (+", elapsedTime, ") ",
+                localTime, ": ",
+                "</p><p>",
+                sourceAndDetail,
+                ": </p><p>",
+                this._HTML2Text(entry.msg),
+                "</p>"] :
+                
+                ["<p><span class='", category, "'>", label, "</span> ",
+                totalTime, "ms (+", elapsedTime, ") ",
+                localTime, ": ",
+                sourceAndDetail, ": ",
+                this._HTML2Text(entry.msg),"</p>"];
+
+            var oNewElement = (this.newestOnTop) ?
+                this._consoleEl.insertBefore(document.createElement(container),this._consoleEl.firstChild):
+                this._consoleEl.appendChild(document.createElement(container));
+
+            oNewElement.innerHTML = output.join("");
+            this._consoleMsgCount++;
+        }
+    }
+};
+
+/**
+ * Converts input chars "<", ">", and "&" to HTML entities.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._HTML2Text = function(html) {
+    if(html) {
+        return html.replace(/&/g, "&#38;").replace(/</g, "&#60;").replace(/>/g, "&#62;");
+    }
+    else return "";
+};
+
+/***************************************************************************
+ * Private event handlers
+ ***************************************************************************/
+/**
+ * Handles Logger's categoryCreateEvent.
+ *
+ * @param {string} type The event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCategoryCreate = function(type, args, oSelf) {
+    var category = args[0];
+    if(oSelf._ftEl) {
+        oSelf._createCategoryCheckbox(category);
+    }
+};
+
+/**
+ * Handles Logger's sourceCreateEvent.
+ *
+ * @param {string} type The event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onSourceCreate = function(type, args, oSelf) {
+    var source = args[0];
+    if(oSelf._ftEl) {
+        oSelf._createSourceCheckbox(source);
+    }
+};
+
+/**
+ * Handles check events on the category filter checkboxes.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCheckCategory = function(v, oSelf) {
+    var newFilter = this.category;
+    var filtersArray = oSelf._categoryFilters;
+
+    if(!this.checked) { // Remove category from filters
+        for(var i=0; i<filtersArray.length; i++) {
+            if(newFilter == filtersArray[i]) {
+                filtersArray.splice(i, 1);
+                break;
+            }
+        }
+    }
+    else { // Add category to filters
+        filtersArray.push(newFilter);
+    }
+    oSelf._filterLogs();
+};
+
+/**
+ * Handles check events on the category filter checkboxes.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCheckSource = function(v, oSelf) {
+    var newFilter = this.source;
+    var filtersArray = oSelf._sourceFilters;
+
+    if(!this.checked) { // Remove category from filters
+        for(var i=0; i<filtersArray.length; i++) {
+            if(newFilter == filtersArray[i]) {
+                filtersArray.splice(i, 1);
+                break;
+            }
+        }
+    }
+    else { // Add category to filters
+        filtersArray.push(newFilter);
+    }
+    oSelf._filterLogs();
+};
+
+/**
+ * Handles click events on the collapse button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickCollapseBtn = function(v, oSelf) {
+    var btn = oSelf._collapseBtn;
+    if(btn.value == "Expand") {
+        oSelf._consoleEl.style.display = "block";
+        if(oSelf._ftEl) {
+            oSelf._ftEl.style.display = "block";
+        }
+        btn.value = "Collapse";
+    }
+    else {
+        oSelf._consoleEl.style.display = "none";
+        if(oSelf._ftEl) {
+            oSelf._ftEl.style.display = "none";
+        }
+        btn.value = "Expand";
+    }
+};
+
+/**
+ * Handles click events on the pause button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickPauseBtn = function(v, oSelf) {
+    var btn = oSelf._pauseBtn;
+    if(btn.value == "Resume") {
+        oSelf.resume();
+        btn.value = "Pause";
+    }
+    else {
+        oSelf.pause();
+        btn.value = "Resume";
+    }
+};
+
+/**
+ * Handles click events on the clear button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickClearBtn = function(v, oSelf) {
+    oSelf._clearConsole();
+};
+
+/**
+ * Handles Logger's newLogEvent.
+ *
+ * @param {string} type The newLog event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onNewLog = function(type, args, oSelf) {
+    var logEntry = args[0];
+    oSelf._buffer.push(logEntry);
+
+    if (oSelf.logReaderEnabled === true && oSelf._timeout === null) {
+        oSelf._timeout = setTimeout(function(){oSelf._printBuffer();}, 100);
+    }
+};
+
+/**
+ * Handles Logger's resetEvent.
+ *
+ * @param {string} type The click event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onReset = function(type, args, oSelf) {
+    oSelf._filterLogs();
+};
+
Index: /branches/mobile/html/test/kakinaka/js/logger/logger-min.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/logger/logger-min.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/logger/logger-min.js	(revision 7213)
@@ -0,0 +1,56 @@
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.txt Version: 0.11.3 */
+YAHOO.widget.Logger={loggerEnabled:true,_browserConsoleEnabled:false,categories:["info","warn","error","time","window"],sources:["global"],_stack:[],maxStackEntries:5,_startTime:new Date().getTime(),_lastTime:null};YAHOO.widget.Logger.categoryCreateEvent=new YAHOO.util.CustomEvent("categoryCreate",this,true);YAHOO.widget.Logger.sourceCreateEvent=new YAHOO.util.CustomEvent("sourceCreate",this,true);YAHOO.widget.Logger.newLogEvent=new YAHOO.util.CustomEvent("newLog",this,true);YAHOO.widget.Logger.logResetEvent=new YAHOO.util.CustomEvent("logReset",this,true);YAHOO.widget.Logger.log=function(sMsg,sCategory,sSource){if(this.loggerEnabled){if(!sCategory){sCategory="info";}
+else{sCategory=sCategory.toLocaleLowerCase();if(this._isNewCategory(sCategory)){this._createNewCategory(sCategory);}}
+var sClass="global";var sDetail=null;if(sSource){var spaceIndex=sSource.indexOf(" ");if(spaceIndex>0){sClass=sSource.substring(0,spaceIndex);sDetail=sSource.substring(spaceIndex,sSource.length);}
+else{sClass=sSource;}
+if(this._isNewSource(sClass)){this._createNewSource(sClass);}}
+var timestamp=new Date();var logEntry={time:timestamp,category:sCategory,source:sClass,sourceDetail:sDetail,msg:sMsg};var stack=this._stack;var maxStackEntries=this.maxStackEntries;if(maxStackEntries&&!isNaN(maxStackEntries)&&(stack.length>=maxStackEntries)){stack.shift();}
+stack.push(logEntry);this.newLogEvent.fire(logEntry);if(this._browserConsoleEnabled){this._printToBrowserConsole(logEntry);}
+return true;}
+else{return false;}};YAHOO.widget.Logger.reset=function(){this._stack=[];this._startTime=new Date().getTime();this.loggerEnabled=true;this.log("Logger reset");this.logResetEvent.fire();};YAHOO.widget.Logger.getStack=function(){return this._stack;};YAHOO.widget.Logger.getStartTime=function(){return this._startTime;};YAHOO.widget.Logger.disableBrowserConsole=function(){YAHOO.log("Logger output to the function console.log() has been disabled.");this._browserConsoleEnabled=false;};YAHOO.widget.Logger.enableBrowserConsole=function(){this._browserConsoleEnabled=true;YAHOO.log("Logger output to the function console.log() has been enabled.");};YAHOO.widget.Logger._createNewCategory=function(category){this.categories.push(category);this.categoryCreateEvent.fire(category);};YAHOO.widget.Logger._isNewCategory=function(category){for(var i=0;i<this.categories.length;i++){if(category==this.categories[i]){return false;}}
+return true;};YAHOO.widget.Logger._createNewSource=function(source){this.sources.push(source);this.sourceCreateEvent.fire(source);};YAHOO.widget.Logger._isNewSource=function(source){if(source){for(var i=0;i<this.sources.length;i++){if(source==this.sources[i]){return false;}}
+return true;}};YAHOO.widget.Logger._printToBrowserConsole=function(entry){if(window.console&&console.log){var category=entry.category;var label=entry.category.substring(0,4).toUpperCase();var time=entry.time;if(time.toLocaleTimeString){var localTime=time.toLocaleTimeString();}
+else{localTime=time.toString();}
+var msecs=time.getTime();var elapsedTime=(YAHOO.widget.Logger._lastTime)?(msecs-YAHOO.widget.Logger._lastTime):0;YAHOO.widget.Logger._lastTime=msecs;var output=localTime+" ("+
+elapsedTime+"ms): "+
+entry.source+": "+
+entry.msg;console.log(output);}};YAHOO.widget.Logger._onWindowError=function(msg,url,line){try{YAHOO.widget.Logger.log(msg+' ('+url+', line '+line+')',"window");if(YAHOO.widget.Logger._origOnWindowError){YAHOO.widget.Logger._origOnWindowError();}}
+catch(e){return false;}};if(window.onerror){YAHOO.widget.Logger._origOnWindowError=window.onerror;}
+window.onerror=YAHOO.widget.Logger._onWindowError;YAHOO.widget.Logger.log("Logger initialized");YAHOO.widget.LogWriter=function(sSource){if(!sSource){YAHOO.log("Could not instantiate LogWriter due to invalid source.","error","LogWriter");return;}
+this._source=sSource;};YAHOO.widget.LogWriter.prototype.toString=function(){return"LogWriter "+this._sSource;};YAHOO.widget.LogWriter.prototype.log=function(sMsg,sCategory){YAHOO.widget.Logger.log(sMsg,sCategory,this._source);};YAHOO.widget.LogWriter.prototype.getSource=function(){return this._sSource;};YAHOO.widget.LogWriter.prototype.setSource=function(sSource){if(!sSource){YAHOO.log("Could not set source due to invalid source.","error",this.toString());return;}
+else{this._sSource=sSource;}};YAHOO.widget.LogWriter.prototype._source=null;YAHOO.widget.LogReader=function(containerEl,oConfig){var oSelf=this;this._sName=YAHOO.widget.LogReader._index;YAHOO.widget.LogReader._index++;if(typeof oConfig=="object"){for(var param in oConfig){this[param]=oConfig[param];}}
+if(containerEl){if(typeof containerEl=="string"){this._containerEl=document.getElementById(containerEl);}
+else if(containerEl.tagName){this._containerEl=containerEl;}
+this._containerEl.className="yui-log";}
+if(!this._containerEl){if(YAHOO.widget.LogReader._defaultContainerEl){this._containerEl=YAHOO.widget.LogReader._defaultContainerEl;}
+else{this._containerEl=document.body.appendChild(document.createElement("div"));this._containerEl.id="yui-log";this._containerEl.className="yui-log";YAHOO.widget.LogReader._defaultContainerEl=this._containerEl;}
+var containerStyle=this._containerEl.style;if(this.width){containerStyle.width=this.width;}
+if(this.left){containerStyle.left=this.left;}
+if(this.right){containerStyle.right=this.right;}
+if(this.bottom){containerStyle.bottom=this.bottom;}
+if(this.top){containerStyle.top=this.top;}
+if(this.fontSize){containerStyle.fontSize=this.fontSize;}}
+if(this._containerEl){if(!this._hdEl){this._hdEl=this._containerEl.appendChild(document.createElement("div"));this._hdEl.id="yui-log-hd"+this._sName;this._hdEl.className="yui-log-hd";this._collapseEl=this._hdEl.appendChild(document.createElement("div"));this._collapseEl.className="yui-log-btns";this._collapseBtn=document.createElement("input");this._collapseBtn.type="button";this._collapseBtn.style.fontSize=YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");this._collapseBtn.className="yui-log-button";this._collapseBtn.value="Collapse";this._collapseBtn=this._collapseEl.appendChild(this._collapseBtn);YAHOO.util.Event.addListener(oSelf._collapseBtn,'click',oSelf._onClickCollapseBtn,oSelf);this._title=this._hdEl.appendChild(document.createElement("h4"));this._title.innerHTML="Logger Console";if(YAHOO.util.DD&&(YAHOO.widget.LogReader._defaultContainerEl==this._containerEl)){var ylog_dd=new YAHOO.util.DD(this._containerEl.id);ylog_dd.setHandleElId(this._hdEl.id);this._hdEl.style.cursor="move";}}
+if(!this._consoleEl){this._consoleEl=this._containerEl.appendChild(document.createElement("div"));this._consoleEl.className="yui-log-bd";if(this.height){this._consoleEl.style.height=this.height;}}
+if(!this._ftEl&&this.footerEnabled){this._ftEl=this._containerEl.appendChild(document.createElement("div"));this._ftEl.className="yui-log-ft";this._btnsEl=this._ftEl.appendChild(document.createElement("div"));this._btnsEl.className="yui-log-btns";this._pauseBtn=document.createElement("input");this._pauseBtn.type="button";this._pauseBtn.style.fontSize=YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");this._pauseBtn.className="yui-log-button";this._pauseBtn.value="Pause";this._pauseBtn=this._btnsEl.appendChild(this._pauseBtn);YAHOO.util.Event.addListener(oSelf._pauseBtn,'click',oSelf._onClickPauseBtn,oSelf);this._clearBtn=document.createElement("input");this._clearBtn.type="button";this._clearBtn.style.fontSize=YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");this._clearBtn.className="yui-log-button";this._clearBtn.value="Clear";this._clearBtn=this._btnsEl.appendChild(this._clearBtn);YAHOO.util.Event.addListener(oSelf._clearBtn,'click',oSelf._onClickClearBtn,oSelf);this._categoryFiltersEl=this._ftEl.appendChild(document.createElement("div"));this._categoryFiltersEl.className="yui-log-categoryfilters";this._sourceFiltersEl=this._ftEl.appendChild(document.createElement("div"));this._sourceFiltersEl.className="yui-log-sourcefilters";}}
+if(!this._buffer){this._buffer=[];}
+this._lastTime=YAHOO.widget.Logger.getStartTime();YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog,this);YAHOO.widget.Logger.logResetEvent.subscribe(this._onReset,this);this._categoryFilters=[];var catsLen=YAHOO.widget.Logger.categories.length;if(this._categoryFiltersEl){for(var i=0;i<catsLen;i++){this._createCategoryCheckbox(YAHOO.widget.Logger.categories[i]);}}
+this._sourceFilters=[];var sourcesLen=YAHOO.widget.Logger.sources.length;if(this._sourceFiltersEl){for(var j=0;j<sourcesLen;j++){this._createSourceCheckbox(YAHOO.widget.Logger.sources[j]);}}
+YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate,this);YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate,this);this._filterLogs();YAHOO.log("LogReader initialized",null,this.toString());};YAHOO.widget.LogReader.prototype.logReaderEnabled=true;YAHOO.widget.LogReader.prototype.width=null;YAHOO.widget.LogReader.prototype.height=null;YAHOO.widget.LogReader.prototype.top=null;YAHOO.widget.LogReader.prototype.left=null;YAHOO.widget.LogReader.prototype.right=null;YAHOO.widget.LogReader.prototype.bottom=null;YAHOO.widget.LogReader.prototype.fontSize=null;YAHOO.widget.LogReader.prototype.footerEnabled=true;YAHOO.widget.LogReader.prototype.verboseOutput=true;YAHOO.widget.LogReader.prototype.newestOnTop=true;YAHOO.widget.LogReader.prototype.thresholdMax=500;YAHOO.widget.LogReader.prototype.thresholdMin=100;YAHOO.widget.LogReader.prototype.toString=function(){return"LogReader instance"+this._sName;};YAHOO.widget.LogReader.prototype.pause=function(){this._timeout=null;this.logReaderEnabled=false;};YAHOO.widget.LogReader.prototype.resume=function(){this.logReaderEnabled=true;this._printBuffer();};YAHOO.widget.LogReader.prototype.hide=function(){this._containerEl.style.display="none";};YAHOO.widget.LogReader.prototype.show=function(){this._containerEl.style.display="block";};YAHOO.widget.LogReader.prototype.setTitle=function(sTitle){this._title.innerHTML=this._HTML2Text(sTitle);};YAHOO.widget.LogReader._index=0;YAHOO.widget.LogReader.prototype._sName=null;YAHOO.widget.LogReader._defaultContainerEl=null;YAHOO.widget.LogReader.prototype._buffer=null;YAHOO.widget.LogReader.prototype._consoleMsgCount=0;YAHOO.widget.LogReader.prototype._lastTime=null;YAHOO.widget.LogReader.prototype._timeout=null;YAHOO.widget.LogReader.prototype._categoryFilters=null;YAHOO.widget.LogReader.prototype._sourceFilters=null;YAHOO.widget.LogReader.prototype._containerEl=null;YAHOO.widget.LogReader.prototype._hdEl=null;YAHOO.widget.LogReader.prototype._collapseEl=null;YAHOO.widget.LogReader.prototype._collapseBtn=null;YAHOO.widget.LogReader.prototype._title=null;YAHOO.widget.LogReader.prototype._consoleEl=null;YAHOO.widget.LogReader.prototype._ftEl=null;YAHOO.widget.LogReader.prototype._btnsEl=null;YAHOO.widget.LogReader.prototype._categoryFiltersEl=null;YAHOO.widget.LogReader.prototype._sourceFiltersEl=null;YAHOO.widget.LogReader.prototype._pauseBtn=null;YAHOO.widget.LogReader.prototype._clearBtn=null;YAHOO.widget.LogReader.prototype._createCategoryCheckbox=function(category){var oSelf=this;if(this._ftEl){var parentEl=this._categoryFiltersEl;var filters=this._categoryFilters;var filterEl=parentEl.appendChild(document.createElement("span"));filterEl.className="yui-log-filtergrp";var categoryChk=document.createElement("input");categoryChk.id="yui-log-filter-"+category+this._sName;categoryChk.className="yui-log-filter-"+category;categoryChk.type="checkbox";categoryChk.category=category;categoryChk=filterEl.appendChild(categoryChk);categoryChk.checked=true;filters.push(category);YAHOO.util.Event.addListener(categoryChk,'click',oSelf._onCheckCategory,oSelf);var categoryChkLbl=filterEl.appendChild(document.createElement("label"));categoryChkLbl.htmlFor=categoryChk.id;categoryChkLbl.className=category;categoryChkLbl.innerHTML=category;}};YAHOO.widget.LogReader.prototype._createSourceCheckbox=function(source){var oSelf=this;if(this._ftEl){var parentEl=this._sourceFiltersEl;var filters=this._sourceFilters;var filterEl=parentEl.appendChild(document.createElement("span"));filterEl.className="yui-log-filtergrp";var sourceChk=document.createElement("input");sourceChk.id="yui-log-filter"+source+this._sName;sourceChk.className="yui-log-filter"+source;sourceChk.type="checkbox";sourceChk.source=source;sourceChk=filterEl.appendChild(sourceChk);sourceChk.checked=true;filters.push(source);YAHOO.util.Event.addListener(sourceChk,'click',oSelf._onCheckSource,oSelf);var sourceChkLbl=filterEl.appendChild(document.createElement("label"));sourceChkLbl.htmlFor=sourceChk.id;sourceChkLbl.className=source;sourceChkLbl.innerHTML=source;}};YAHOO.widget.LogReader.prototype._filterLogs=function(){if(this._consoleEl!==null){this._clearConsole();this._printToConsole(YAHOO.widget.Logger.getStack());}};YAHOO.widget.LogReader.prototype._clearConsole=function(){this._timeout=null;this._buffer=[];this._consoleMsgCount=0;this._lastTime=YAHOO.widget.Logger.getStartTime();var consoleEl=this._consoleEl;while(consoleEl.hasChildNodes()){consoleEl.removeChild(consoleEl.firstChild);}};YAHOO.widget.LogReader.prototype._printBuffer=function(){this._timeout=null;if(this._consoleEl!==null){var thresholdMax=this.thresholdMax;thresholdMax=(thresholdMax&&!isNaN(thresholdMax))?thresholdMax:500;if(this._consoleMsgCount<thresholdMax){var entries=[];for(var i=0;i<this._buffer.length;i++){entries[i]=this._buffer[i];}
+this._buffer=[];this._printToConsole(entries);}
+else{this._filterLogs();}
+if(!this.newestOnTop){this._consoleEl.scrollTop=this._consoleEl.scrollHeight;}}};YAHOO.widget.LogReader.prototype._printToConsole=function(aEntries){var entriesLen=aEntries.length;var thresholdMin=this.thresholdMin;if(isNaN(thresholdMin)||(thresholdMin>this.thresholdMax)){thresholdMin=0;}
+var entriesStartIndex=(entriesLen>thresholdMin)?(entriesLen-thresholdMin):0;var sourceFiltersLen=this._sourceFilters.length;var categoryFiltersLen=this._categoryFilters.length;for(var i=entriesStartIndex;i<entriesLen;i++){var entry=aEntries[i];var category=entry.category;var source=entry.source;var sourceDetail=entry.sourceDetail;var okToPrint=false;var okToFilterCats=false;for(var j=0;j<sourceFiltersLen;j++){if(source==this._sourceFilters[j]){okToFilterCats=true;break;}}
+if(okToFilterCats){for(var k=0;k<categoryFiltersLen;k++){if(category==this._categoryFilters[k]){okToPrint=true;break;}}}
+if(okToPrint){var label=entry.category.substring(0,4).toUpperCase();var time=entry.time;if(time.toLocaleTimeString){var localTime=time.toLocaleTimeString();}
+else{localTime=time.toString();}
+var msecs=time.getTime();var startTime=YAHOO.widget.Logger.getStartTime();var totalTime=msecs-startTime;var elapsedTime=msecs-this._lastTime;this._lastTime=msecs;var verboseOutput=(this.verboseOutput);var container=(verboseOutput)?"CODE":"PRE";var sourceAndDetail=(sourceDetail)?source+" "+sourceDetail:source;var output=(verboseOutput)?["<p><span class='",category,"'>",label,"</span> ",totalTime,"ms (+",elapsedTime,") ",localTime,": ","</p><p>",sourceAndDetail,": </p><p>",this._HTML2Text(entry.msg),"</p>"]:["<p><span class='",category,"'>",label,"</span> ",totalTime,"ms (+",elapsedTime,") ",localTime,": ",sourceAndDetail,": ",this._HTML2Text(entry.msg),"</p>"];var oNewElement=(this.newestOnTop)?this._consoleEl.insertBefore(document.createElement(container),this._consoleEl.firstChild):this._consoleEl.appendChild(document.createElement(container));oNewElement.innerHTML=output.join("");this._consoleMsgCount++;}}};YAHOO.widget.LogReader.prototype._HTML2Text=function(html){if(html){return html.replace(/&/g,"&#38;").replace(/</g,"&#60;").replace(/>/g,"&#62;");}
+else return"";};YAHOO.widget.LogReader.prototype._onCategoryCreate=function(type,args,oSelf){var category=args[0];if(oSelf._ftEl){oSelf._createCategoryCheckbox(category);}};YAHOO.widget.LogReader.prototype._onSourceCreate=function(type,args,oSelf){var source=args[0];if(oSelf._ftEl){oSelf._createSourceCheckbox(source);}};YAHOO.widget.LogReader.prototype._onCheckCategory=function(v,oSelf){var newFilter=this.category;var filtersArray=oSelf._categoryFilters;if(!this.checked){for(var i=0;i<filtersArray.length;i++){if(newFilter==filtersArray[i]){filtersArray.splice(i,1);break;}}}
+else{filtersArray.push(newFilter);}
+oSelf._filterLogs();};YAHOO.widget.LogReader.prototype._onCheckSource=function(v,oSelf){var newFilter=this.source;var filtersArray=oSelf._sourceFilters;if(!this.checked){for(var i=0;i<filtersArray.length;i++){if(newFilter==filtersArray[i]){filtersArray.splice(i,1);break;}}}
+else{filtersArray.push(newFilter);}
+oSelf._filterLogs();};YAHOO.widget.LogReader.prototype._onClickCollapseBtn=function(v,oSelf){var btn=oSelf._collapseBtn;if(btn.value=="Expand"){oSelf._consoleEl.style.display="block";if(oSelf._ftEl){oSelf._ftEl.style.display="block";}
+btn.value="Collapse";}
+else{oSelf._consoleEl.style.display="none";if(oSelf._ftEl){oSelf._ftEl.style.display="none";}
+btn.value="Expand";}};YAHOO.widget.LogReader.prototype._onClickPauseBtn=function(v,oSelf){var btn=oSelf._pauseBtn;if(btn.value=="Resume"){oSelf.resume();btn.value="Pause";}
+else{oSelf.pause();btn.value="Resume";}};YAHOO.widget.LogReader.prototype._onClickClearBtn=function(v,oSelf){oSelf._clearConsole();};YAHOO.widget.LogReader.prototype._onNewLog=function(type,args,oSelf){var logEntry=args[0];oSelf._buffer.push(logEntry);if(oSelf.logReaderEnabled===true&&oSelf._timeout===null){oSelf._timeout=setTimeout(function(){oSelf._printBuffer();},100);}};YAHOO.widget.LogReader.prototype._onReset=function(type,args,oSelf){oSelf._filterLogs();};
Index: /branches/mobile/html/test/kakinaka/js/logger/logger-debug.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/logger/logger-debug.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/logger/logger-debug.js	(revision 7213)
@@ -0,0 +1,1290 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.com/yui/license.txt
+version: 0.11.3
+*/
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+/**
+ * Singleton providing core logging functionality. Saves logs written through the
+ * global YAHOO.log function or written by LogWriter. Provides access to logs
+ * for reading by LogReader. Log messages can be automatically output to browser
+ * console such as the Firebug extension to Firefox or Safari's JavaScript
+ * console, if present.
+ *
+ * requires YAHOO.util.Event Event utility
+ */
+YAHOO.widget.Logger = {
+    // Initialize members
+    loggerEnabled: true,
+    _browserConsoleEnabled: false,
+    categories: ["info","warn","error","time","window"],
+    sources: ["global"],
+    _stack: [], // holds all log msgs
+    maxStackEntries: 5,
+    _startTime: new Date().getTime(), // static start timestamp
+    _lastTime: null // timestamp of last logged message
+};
+
+/***************************************************************************
+ * Events
+ ***************************************************************************/
+/**
+ * Fired when a new category has been created. Subscribers receive the following
+ * array:<br>
+ *     - args[0] The category name
+ */
+YAHOO.widget.Logger.categoryCreateEvent = new YAHOO.util.CustomEvent("categoryCreate", this, true);
+
+/**
+ * Fired when a new source has been named. Subscribers receive the following
+ * array:<br>
+ *     - args[0] The source name
+ */
+YAHOO.widget.Logger.sourceCreateEvent = new YAHOO.util.CustomEvent("sourceCreate", this, true);
+
+/**
+ * Fired when a new log message has been created. Subscribers receive the
+ * following array:<br>
+ *     - args[0] The log message
+ */
+YAHOO.widget.Logger.newLogEvent = new YAHOO.util.CustomEvent("newLog", this, true);
+
+/**
+ * Fired when the Logger has been reset has been created.
+ */
+YAHOO.widget.Logger.logResetEvent = new YAHOO.util.CustomEvent("logReset", this, true);
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+/**
+ * Saves a log message to the stack and fires newLogEvent. If the log message is
+ * assigned to an unknown category, creates a new category. If the log message is
+ * from an unknown source, creates a new source.  If browser console is enabled,
+ * outputs the log message to browser console.
+ *
+ * @param {string} sMsg The log message
+ * @param {string} sCategory Category of log message, or null
+ * @param {string} sSource Source of LogWriter, or null if global
+ */
+YAHOO.widget.Logger.log = function(sMsg, sCategory, sSource) {
+    if(this.loggerEnabled) {
+        if(!sCategory) {
+            sCategory = "info"; // default category
+        }
+        else {
+            sCategory = sCategory.toLocaleLowerCase();
+            if(this._isNewCategory(sCategory)) {
+                this._createNewCategory(sCategory);
+            }
+        }
+        var sClass = "global"; // default source
+        var sDetail = null;
+        if(sSource) {
+            var spaceIndex = sSource.indexOf(" ");
+            if(spaceIndex > 0) {
+                sClass = sSource.substring(0,spaceIndex);// substring until first space
+                sDetail = sSource.substring(spaceIndex,sSource.length);// the rest of the source
+            }
+            else {
+                sClass = sSource;
+            }
+            if(this._isNewSource(sClass)) {
+                this._createNewSource(sClass);
+            }
+        }
+
+        var timestamp = new Date();
+        var logEntry = {
+            time: timestamp,
+            category: sCategory,
+            source: sClass,
+            sourceDetail: sDetail,
+            msg: sMsg
+        };
+
+        var stack = this._stack;
+        var maxStackEntries = this.maxStackEntries;
+        if(maxStackEntries && !isNaN(maxStackEntries) && (stack.length >= maxStackEntries)) {
+            stack.shift();
+        }
+        stack.push(logEntry);
+        this.newLogEvent.fire(logEntry);
+
+        if(this._browserConsoleEnabled) {
+            this._printToBrowserConsole(logEntry);
+        }
+        return true;
+    }
+    else {
+        return false;
+    }
+};
+
+/**
+ * Resets internal stack and startTime, enables Logger, and fires logResetEvent.
+ *
+ */
+YAHOO.widget.Logger.reset = function() {
+    this._stack = [];
+    this._startTime = new Date().getTime();
+    this.loggerEnabled = true;
+    this.log("Logger reset");
+    this.logResetEvent.fire();
+};
+
+/**
+ * Public accessor to internal stack of log messages.
+ *
+ * @return {array} Array of log messages.
+ */
+YAHOO.widget.Logger.getStack = function() {
+    return this._stack;
+};
+
+/**
+ * Public accessor to internal start time.
+ *
+ * @return {date} Internal date of when Logger singleton was initialized.
+ */
+YAHOO.widget.Logger.getStartTime = function() {
+    return this._startTime;
+};
+
+/**
+ * Disables output to the browser's global console.log() function, which is used
+ * by the Firebug extension to Firefox as well as Safari.
+ */
+YAHOO.widget.Logger.disableBrowserConsole = function() {
+    YAHOO.log("Logger output to the function console.log() has been disabled.");
+    this._browserConsoleEnabled = false;
+};
+
+/**
+ * Enables output to the browser's global console.log() function, which is used
+ * by the Firebug extension to Firefox as well as Safari.
+ */
+YAHOO.widget.Logger.enableBrowserConsole = function() {
+    this._browserConsoleEnabled = true;
+    YAHOO.log("Logger output to the function console.log() has been enabled.");
+};
+
+/***************************************************************************
+ * Private methods
+ ***************************************************************************/
+/**
+ * Creates a new category of log messages and fires categoryCreateEvent.
+ *
+ * @param {string} category Category name
+ * @private
+ */
+YAHOO.widget.Logger._createNewCategory = function(category) {
+    this.categories.push(category);
+    this.categoryCreateEvent.fire(category);
+};
+
+/**
+ * Checks to see if a category has already been created.
+ *
+ * @param {string} category Category name
+ * @return {boolean} Returns true if category is unknown, else returns false
+ * @private
+ */
+YAHOO.widget.Logger._isNewCategory = function(category) {
+    for(var i=0; i < this.categories.length; i++) {
+        if(category == this.categories[i]) {
+            return false;
+        }
+    }
+    return true;
+};
+
+/**
+ * Creates a new source of log messages and fires sourceCreateEvent.
+ *
+ * @param {string} source Source name
+ * @private
+ */
+YAHOO.widget.Logger._createNewSource = function(source) {
+    this.sources.push(source);
+    this.sourceCreateEvent.fire(source);
+};
+
+/**
+ * Checks to see if a source has already been created.
+ *
+ * @param {string} source Source name
+ * @return {boolean} Returns true if source is unknown, else returns false
+ * @private
+ */
+YAHOO.widget.Logger._isNewSource = function(source) {
+    if(source) {
+        for(var i=0; i < this.sources.length; i++) {
+            if(source == this.sources[i]) {
+                return false;
+            }
+        }
+        return true;
+    }
+};
+
+/**
+ * Outputs a log message to global console.log() function.
+ *
+ * @param {object} entry Log entry object
+ * @private
+ */
+YAHOO.widget.Logger._printToBrowserConsole = function(entry) {
+    if(window.console && console.log) {
+        var category = entry.category;
+        var label = entry.category.substring(0,4).toUpperCase();
+
+        var time = entry.time;
+        if (time.toLocaleTimeString) {
+            var localTime  = time.toLocaleTimeString();
+        }
+        else {
+            localTime = time.toString();
+        }
+
+        var msecs = time.getTime();
+        var elapsedTime = (YAHOO.widget.Logger._lastTime) ?
+            (msecs - YAHOO.widget.Logger._lastTime) : 0;
+        YAHOO.widget.Logger._lastTime = msecs;
+
+        var output =
+            localTime + " (" +
+            elapsedTime + "ms): " +
+            entry.source + ": " +
+            entry.msg;
+
+        console.log(output);
+    }
+};
+
+/***************************************************************************
+ * Private event handlers
+ ***************************************************************************/
+/**
+ * Handles logging of messages due to window error events.
+ *
+ * @param {string} msg The error message
+ * @param {string} url URL of the error
+ * @param {string} line Line number of the error
+ * @private
+ */
+YAHOO.widget.Logger._onWindowError = function(msg,url,line) {
+    // Logger is not in scope of this event handler
+    try {
+        YAHOO.widget.Logger.log(msg+' ('+url+', line '+line+')', "window");
+        if(YAHOO.widget.Logger._origOnWindowError) {
+            YAHOO.widget.Logger._origOnWindowError();
+        }
+    }
+    catch(e) {
+        return false;
+    }
+};
+
+/**
+ * Handle native JavaScript errors
+ */
+//NB: Not all browsers support the window.onerror event
+if(window.onerror) {
+    // Save any previously defined handler to call
+    YAHOO.widget.Logger._origOnWindowError = window.onerror;
+}
+window.onerror = YAHOO.widget.Logger._onWindowError;
+
+/**
+ * First log
+ */
+YAHOO.widget.Logger.log("Logger initialized");
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+/**
+ * Class providing ability to log messages through YAHOO.widget.Logger from a
+ * named source.
+ *
+ * @constructor
+ * @param {string} sSource Source of LogWriter instance
+ */
+YAHOO.widget.LogWriter = function(sSource) {
+    if(!sSource) {
+        YAHOO.log("Could not instantiate LogWriter due to invalid source.", "error", "LogWriter");
+        return;
+    }
+    this._source = sSource;
+ };
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+ /**
+ * Public accessor to the unique name of the LogWriter instance.
+ *
+ * @return {string} Unique name of the LogWriter instance
+ */
+YAHOO.widget.LogWriter.prototype.toString = function() {
+    return "LogWriter " + this._sSource;
+};
+
+/**
+ * Logs a message attached to the source of the LogWriter.
+ *
+ * @param {string} sMsg The log message
+ * @param {string} sCategory Category name
+ */
+YAHOO.widget.LogWriter.prototype.log = function(sMsg, sCategory) {
+    YAHOO.widget.Logger.log(sMsg, sCategory, this._source);
+};
+
+/**
+ * Public accessor to get the source name.
+ *
+ * @return {string} The LogWriter source
+ */
+YAHOO.widget.LogWriter.prototype.getSource = function() {
+    return this._sSource;
+};
+
+/**
+ * Public accessor to set the source name.
+ *
+ * @param {string} sSource Source of LogWriter instance
+ */
+YAHOO.widget.LogWriter.prototype.setSource = function(sSource) {
+    if(!sSource) {
+        YAHOO.log("Could not set source due to invalid source.", "error", this.toString());
+        return;
+    }
+    else {
+        this._sSource = sSource;
+    }
+};
+/***************************************************************************
+ * Private members
+ ***************************************************************************/
+/**
+ * Source of the log writer instance.
+ *
+ * @type string
+ * @private
+ */
+YAHOO.widget.LogWriter.prototype._source = null;
+
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * Class providing UI to read messages logged to YAHOO.widget.Logger.
+ *
+ * requires YAHOO.util.Dom DOM utility
+ * requires YAHOO.util.Event Event utility
+ * optional YAHOO.util.DragDrop Drag and drop utility
+ *
+ * @constructor
+ * @param {el or ID} containerEl DOM element object or ID of container to wrap reader UI
+ * @param {object} oConfig Optional object literal of configuration params
+ */
+YAHOO.widget.LogReader = function(containerEl, oConfig) {
+    var oSelf = this;
+    this._sName = YAHOO.widget.LogReader._index;
+    YAHOO.widget.LogReader._index++;
+
+    // Parse config vars here
+    if (typeof oConfig == "object") {
+        for(var param in oConfig) {
+            this[param] = oConfig[param];
+        }
+    }
+
+    // Attach container...
+    if(containerEl) {
+        if(typeof containerEl == "string") {
+            this._containerEl = document.getElementById(containerEl);
+        }
+        else if(containerEl.tagName) {
+            this._containerEl = containerEl;
+        }
+        this._containerEl.className = "yui-log";
+    }
+    // ...or create container from scratch
+    if(!this._containerEl) {
+        if(YAHOO.widget.LogReader._defaultContainerEl) {
+            this._containerEl =  YAHOO.widget.LogReader._defaultContainerEl;
+        }
+        else {
+            this._containerEl = document.body.appendChild(document.createElement("div"));
+            this._containerEl.id = "yui-log";
+            this._containerEl.className = "yui-log";
+
+            YAHOO.widget.LogReader._defaultContainerEl = this._containerEl;
+        }
+
+        // If implementer has provided container values, trust and set those
+        var containerStyle = this._containerEl.style;
+        if(this.width) {
+            containerStyle.width = this.width;
+        }
+        if(this.left) {
+            containerStyle.left = this.left;
+        }
+        if(this.right) {
+            containerStyle.right = this.right;
+        }
+        if(this.bottom) {
+            containerStyle.bottom = this.bottom;
+        }
+        if(this.top) {
+            containerStyle.top = this.top;
+        }
+        if(this.fontSize) {
+            containerStyle.fontSize = this.fontSize;
+        }
+    }
+
+    if(this._containerEl) {
+        // Create header
+        if(!this._hdEl) {
+            this._hdEl = this._containerEl.appendChild(document.createElement("div"));
+            this._hdEl.id = "yui-log-hd" + this._sName;
+            this._hdEl.className = "yui-log-hd";
+
+            this._collapseEl = this._hdEl.appendChild(document.createElement("div"));
+            this._collapseEl.className = "yui-log-btns";
+
+            this._collapseBtn = document.createElement("input");
+            this._collapseBtn.type = "button";
+            this._collapseBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+            this._collapseBtn.className = "yui-log-button";
+            this._collapseBtn.value = "Collapse";
+            this._collapseBtn = this._collapseEl.appendChild(this._collapseBtn);
+            YAHOO.util.Event.addListener(oSelf._collapseBtn,'click',oSelf._onClickCollapseBtn,oSelf);
+
+            this._title = this._hdEl.appendChild(document.createElement("h4"));
+            this._title.innerHTML = "Logger Console";
+
+            // If Drag and Drop utility is available...
+            // ...and this container was created from scratch...
+            // ...then make the header draggable
+            if(YAHOO.util.DD &&
+            (YAHOO.widget.LogReader._defaultContainerEl == this._containerEl)) {
+                var ylog_dd = new YAHOO.util.DD(this._containerEl.id);
+                ylog_dd.setHandleElId(this._hdEl.id);
+                this._hdEl.style.cursor = "move";
+            }
+        }
+        // Ceate console
+        if(!this._consoleEl) {
+            this._consoleEl = this._containerEl.appendChild(document.createElement("div"));
+            this._consoleEl.className = "yui-log-bd";
+
+            // If implementer has provided console, trust and set those
+            if(this.height) {
+                this._consoleEl.style.height = this.height;
+            }
+        }
+        // Don't create footer if disabled
+        if(!this._ftEl && this.footerEnabled) {
+            this._ftEl = this._containerEl.appendChild(document.createElement("div"));
+            this._ftEl.className = "yui-log-ft";
+
+            this._btnsEl = this._ftEl.appendChild(document.createElement("div"));
+            this._btnsEl.className = "yui-log-btns";
+
+            this._pauseBtn = document.createElement("input");
+            this._pauseBtn.type = "button";
+            this._pauseBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+            this._pauseBtn.className = "yui-log-button";
+            this._pauseBtn.value = "Pause";
+            this._pauseBtn = this._btnsEl.appendChild(this._pauseBtn);
+            YAHOO.util.Event.addListener(oSelf._pauseBtn,'click',oSelf._onClickPauseBtn,oSelf);
+
+            this._clearBtn = document.createElement("input");
+            this._clearBtn.type = "button";
+            this._clearBtn.style.fontSize = YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+            this._clearBtn.className = "yui-log-button";
+            this._clearBtn.value = "Clear";
+            this._clearBtn = this._btnsEl.appendChild(this._clearBtn);
+            YAHOO.util.Event.addListener(oSelf._clearBtn,'click',oSelf._onClickClearBtn,oSelf);
+
+            this._categoryFiltersEl = this._ftEl.appendChild(document.createElement("div"));
+            this._categoryFiltersEl.className = "yui-log-categoryfilters";
+            this._sourceFiltersEl = this._ftEl.appendChild(document.createElement("div"));
+            this._sourceFiltersEl.className = "yui-log-sourcefilters";
+        }
+    }
+
+    // Initialize internal vars
+    if(!this._buffer) {
+        this._buffer = []; // output buffer
+    }
+    this._lastTime = YAHOO.widget.Logger.getStartTime(); // timestamp of last log message to console
+    
+    // Subscribe to Logger custom events
+    YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog, this);
+    YAHOO.widget.Logger.logResetEvent.subscribe(this._onReset, this);
+
+    // Initialize category filters
+    this._categoryFilters = [];
+    var catsLen = YAHOO.widget.Logger.categories.length;
+    if(this._categoryFiltersEl) {
+        for(var i=0; i < catsLen; i++) {
+            this._createCategoryCheckbox(YAHOO.widget.Logger.categories[i]);
+        }
+    }
+    // Initialize source filters
+    this._sourceFilters = [];
+    var sourcesLen = YAHOO.widget.Logger.sources.length;
+    if(this._sourceFiltersEl) {
+        for(var j=0; j < sourcesLen; j++) {
+            this._createSourceCheckbox(YAHOO.widget.Logger.sources[j]);
+        }
+    }
+    YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate, this);
+    YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate, this);
+
+    this._filterLogs();
+    YAHOO.log("LogReader initialized", null, this.toString());
+};
+
+/***************************************************************************
+ * Public members
+ ***************************************************************************/
+/**
+ * Whether or not the log reader is enabled to output log messages. Default:
+ * true.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.logReaderEnabled = true;
+
+/**
+ * Public member to access CSS width of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.width = null;
+
+/**
+ * Public member to access CSS height of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.height = null;
+
+/**
+ * Public member to access CSS top position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.top = null;
+
+/**
+ * Public member to access CSS left position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.left = null;
+
+/**
+ * Public member to access CSS right position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.right = null;
+
+/**
+ * Public member to access CSS bottom position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.bottom = null;
+
+/**
+ * Public member to access CSS font size of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.fontSize = null;
+
+/**
+ * Whether or not the footer UI is enabled for the log reader. Default: true.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.footerEnabled = true;
+
+/**
+ * Whether or not output is verbose (more readable). Setting to true will make
+ * output more compact (less readable). Default: true.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.verboseOutput = true;
+
+/**
+ * Whether or not newest message is printed on top. Default: true.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.newestOnTop = true;
+
+/**
+ * Maximum number of messages a LogReader console will display. Default: 500;
+ *
+ * @type number
+ */
+YAHOO.widget.LogReader.prototype.thresholdMax = 500;
+
+/**
+ * When a LogReader console reaches its thresholdMax, it will clear out messages
+ * and print out the latest thresholdMin number of messages. Default: 100;
+ *
+ * @type number
+ */
+YAHOO.widget.LogReader.prototype.thresholdMin = 100;
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+ /**
+ * Public accessor to the unique name of the LogReader instance.
+ *
+ * @return {string} Unique name of the LogReader instance
+ */
+YAHOO.widget.LogReader.prototype.toString = function() {
+    return "LogReader instance" + this._sName;
+};
+/**
+ * Pauses output of log messages. While paused, log messages are not lost, but
+ * get saved to a buffer and then output upon resume of log reader.
+ */
+YAHOO.widget.LogReader.prototype.pause = function() {
+    this._timeout = null;
+    this.logReaderEnabled = false;
+};
+
+/**
+ * Resumes output of log messages, including outputting any log messages that
+ * have been saved to buffer while paused.
+ */
+YAHOO.widget.LogReader.prototype.resume = function() {
+    this.logReaderEnabled = true;
+    this._printBuffer();
+};
+
+/**
+ * Hides UI of log reader. Logging functionality is not disrupted.
+ */
+YAHOO.widget.LogReader.prototype.hide = function() {
+    this._containerEl.style.display = "none";
+};
+
+/**
+ * Shows UI of log reader. Logging functionality is not disrupted.
+ */
+YAHOO.widget.LogReader.prototype.show = function() {
+    this._containerEl.style.display = "block";
+};
+
+/**
+ * Updates title to given string.
+ *
+ * @param {string} sTitle String to display in log reader's title bar.
+ */
+YAHOO.widget.LogReader.prototype.setTitle = function(sTitle) {
+    this._title.innerHTML = this._HTML2Text(sTitle);
+};
+ /***************************************************************************
+ * Private members
+ ***************************************************************************/
+/**
+ * Internal class member to index multiple log reader instances.
+ *
+ * @type number
+ * @private
+ */
+YAHOO.widget.LogReader._index = 0;
+
+/**
+ * Name of LogReader instance.
+ *
+ * @type string
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sName = null;
+
+/**
+ * A class member shared by all log readers if a container needs to be
+ * created during instantiation. Will be null if a container element never needs to
+ * be created on the fly, such as when the implementer passes in their own element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader._defaultContainerEl = null;
+
+/**
+ * Buffer of log messages for batch output.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._buffer = null;
+
+/**
+ * Number of log messages output to console.
+ *
+ * @type number
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._consoleMsgCount = 0;
+
+/**
+ * Date of last output log message.
+ *
+ * @type date
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._lastTime = null;
+
+/**
+ * Batched output timeout ID.
+ *
+ * @type number
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._timeout = null;
+
+/**
+ * Array of filters for log message categories.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._categoryFilters = null;
+
+/**
+ * Array of filters for log message sources.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sourceFilters = null;
+
+/**
+ * Log reader container element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._containerEl = null;
+
+/**
+ * Log reader header element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._hdEl = null;
+
+/**
+ * Log reader collapse element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._collapseEl = null;
+
+/**
+ * Log reader collapse button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._collapseBtn = null;
+
+/**
+ * Log reader title header element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._title = null;
+
+/**
+ * Log reader console element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._consoleEl = null;
+
+/**
+ * Log reader footer element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._ftEl = null;
+
+/**
+ * Log reader buttons container element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._btnsEl = null;
+
+/**
+ * Container element for log reader category filter checkboxes.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._categoryFiltersEl = null;
+
+/**
+ * Container element for log reader source filter checkboxes.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sourceFiltersEl = null;
+
+/**
+ * Log reader pause button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._pauseBtn = null;
+
+/**
+ * Clear button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._clearBtn = null;
+/***************************************************************************
+ * Private methods
+ ***************************************************************************/
+/**
+ * Creates the UI for a category filter in the log reader footer element.
+ *
+ * @param {string} category Category name
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._createCategoryCheckbox = function(category) {
+    var oSelf = this;
+
+    if(this._ftEl) {
+        var parentEl = this._categoryFiltersEl;
+        var filters = this._categoryFilters;
+
+        var filterEl = parentEl.appendChild(document.createElement("span"));
+        filterEl.className = "yui-log-filtergrp";
+            // Append el at the end so IE 5.5 can set "type" attribute
+            // and THEN set checked property
+            var categoryChk = document.createElement("input");
+            categoryChk.id = "yui-log-filter-" + category + this._sName;
+            categoryChk.className = "yui-log-filter-" + category;
+            categoryChk.type = "checkbox";
+            categoryChk.category = category;
+            categoryChk = filterEl.appendChild(categoryChk);
+            categoryChk.checked = true;
+
+            // Add this checked filter to the internal array of filters
+            filters.push(category);
+            // Subscribe to the click event
+            YAHOO.util.Event.addListener(categoryChk,'click',oSelf._onCheckCategory,oSelf);
+
+            // Create and class the text label
+            var categoryChkLbl = filterEl.appendChild(document.createElement("label"));
+            categoryChkLbl.htmlFor = categoryChk.id;
+            categoryChkLbl.className = category;
+            categoryChkLbl.innerHTML = category;
+    }
+};
+
+YAHOO.widget.LogReader.prototype._createSourceCheckbox = function(source) {
+    var oSelf = this;
+
+    if(this._ftEl) {
+        var parentEl = this._sourceFiltersEl;
+        var filters = this._sourceFilters;
+
+        var filterEl = parentEl.appendChild(document.createElement("span"));
+        filterEl.className = "yui-log-filtergrp";
+
+        // Append el at the end so IE 5.5 can set "type" attribute
+        // and THEN set checked property
+        var sourceChk = document.createElement("input");
+        sourceChk.id = "yui-log-filter" + source + this._sName;
+        sourceChk.className = "yui-log-filter" + source;
+        sourceChk.type = "checkbox";
+        sourceChk.source = source;
+        sourceChk = filterEl.appendChild(sourceChk);
+        sourceChk.checked = true;
+
+        // Add this checked filter to the internal array of filters
+        filters.push(source);
+        // Subscribe to the click event
+        YAHOO.util.Event.addListener(sourceChk,'click',oSelf._onCheckSource,oSelf);
+
+        // Create and class the text label
+        var sourceChkLbl = filterEl.appendChild(document.createElement("label"));
+        sourceChkLbl.htmlFor = sourceChk.id;
+        sourceChkLbl.className = source;
+        sourceChkLbl.innerHTML = source;
+    }
+};
+
+/**
+ * Reprints all log messages in the stack through filters.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._filterLogs = function() {
+    // Reprint stack with new filters
+    if (this._consoleEl !== null) {
+        this._clearConsole();
+        this._printToConsole(YAHOO.widget.Logger.getStack());
+    }
+};
+
+/**
+ * Clears all outputted log messages from the console and resets the time of the
+ * last output log message.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._clearConsole = function() {
+    // Clear the buffer of any pending messages
+    this._timeout = null;
+    this._buffer = [];
+    this._consoleMsgCount = 0;
+
+    // Reset the rolling timer
+    this._lastTime = YAHOO.widget.Logger.getStartTime();
+
+    var consoleEl = this._consoleEl;
+    while(consoleEl.hasChildNodes()) {
+        consoleEl.removeChild(consoleEl.firstChild);
+    }
+};
+
+/**
+ * Sends buffer of log messages to output and clears buffer.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._printBuffer = function() {
+    this._timeout = null;
+
+    if(this._consoleEl !== null) {
+        var thresholdMax = this.thresholdMax;
+        thresholdMax = (thresholdMax && !isNaN(thresholdMax)) ? thresholdMax : 500;
+        if(this._consoleMsgCount < thresholdMax) {
+            var entries = [];
+            for (var i=0; i<this._buffer.length; i++) {
+                entries[i] = this._buffer[i];
+            }
+            this._buffer = [];
+            this._printToConsole(entries);
+        }
+        else {
+            this._filterLogs();
+        }
+        
+        if(!this.newestOnTop) {
+            this._consoleEl.scrollTop = this._consoleEl.scrollHeight;
+        }
+    }
+};
+
+/**
+ * Cycles through an array of log messages, and outputs each one to the console
+ * if its category has not been filtered out.
+ *
+ * @param {array} aEntries
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._printToConsole = function(aEntries) {
+    // Manage the number of messages displayed in the console
+    var entriesLen = aEntries.length;
+    var thresholdMin = this.thresholdMin;
+    if(isNaN(thresholdMin) || (thresholdMin > this.thresholdMax)) {
+        thresholdMin = 0;
+    }
+    var entriesStartIndex = (entriesLen > thresholdMin) ? (entriesLen - thresholdMin) : 0;
+    
+    // Iterate through all log entries to print the ones that filter through
+    var sourceFiltersLen = this._sourceFilters.length;
+    var categoryFiltersLen = this._categoryFilters.length;
+    for(var i=entriesStartIndex; i<entriesLen; i++) {
+        var entry = aEntries[i];
+        var category = entry.category;
+        var source = entry.source;
+        var sourceDetail = entry.sourceDetail;
+        var okToPrint = false;
+        var okToFilterCats = false;
+
+        for(var j=0; j<sourceFiltersLen; j++) {
+            if(source == this._sourceFilters[j]) {
+                okToFilterCats = true;
+                break;
+            }
+        }
+        if(okToFilterCats) {
+            for(var k=0; k<categoryFiltersLen; k++) {
+                if(category == this._categoryFilters[k]) {
+                    okToPrint = true;
+                    break;
+                }
+            }
+        }
+        if(okToPrint) {
+            // To format for console, calculate the elapsed time
+            // to be from the last item that passed through the filter,
+            // not the absolute previous item in the stack
+            var label = entry.category.substring(0,4).toUpperCase();
+
+            var time = entry.time;
+            if (time.toLocaleTimeString) {
+                var localTime  = time.toLocaleTimeString();
+            }
+            else {
+                localTime = time.toString();
+            }
+
+            var msecs = time.getTime();
+            var startTime = YAHOO.widget.Logger.getStartTime();
+            var totalTime = msecs - startTime;
+            var elapsedTime = msecs - this._lastTime;
+            this._lastTime = msecs;
+
+            var verboseOutput = (this.verboseOutput);
+            var container = (verboseOutput) ? "CODE" : "PRE";
+            var sourceAndDetail = (sourceDetail) ?
+                source + " " + sourceDetail : source;
+
+            // Verbose uses code tag instead of pre tag (for wrapping)
+            // and includes extra line breaks
+            var output =  (verboseOutput) ?
+                ["<p><span class='", category, "'>", label, "</span> ",
+                totalTime, "ms (+", elapsedTime, ") ",
+                localTime, ": ",
+                "</p><p>",
+                sourceAndDetail,
+                ": </p><p>",
+                this._HTML2Text(entry.msg),
+                "</p>"] :
+                
+                ["<p><span class='", category, "'>", label, "</span> ",
+                totalTime, "ms (+", elapsedTime, ") ",
+                localTime, ": ",
+                sourceAndDetail, ": ",
+                this._HTML2Text(entry.msg),"</p>"];
+
+            var oNewElement = (this.newestOnTop) ?
+                this._consoleEl.insertBefore(document.createElement(container),this._consoleEl.firstChild):
+                this._consoleEl.appendChild(document.createElement(container));
+
+            oNewElement.innerHTML = output.join("");
+            this._consoleMsgCount++;
+        }
+    }
+};
+
+/**
+ * Converts input chars "<", ">", and "&" to HTML entities.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._HTML2Text = function(html) {
+    if(html) {
+        return html.replace(/&/g, "&#38;").replace(/</g, "&#60;").replace(/>/g, "&#62;");
+    }
+    else return "";
+};
+
+/***************************************************************************
+ * Private event handlers
+ ***************************************************************************/
+/**
+ * Handles Logger's categoryCreateEvent.
+ *
+ * @param {string} type The event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCategoryCreate = function(type, args, oSelf) {
+    var category = args[0];
+    if(oSelf._ftEl) {
+        oSelf._createCategoryCheckbox(category);
+    }
+};
+
+/**
+ * Handles Logger's sourceCreateEvent.
+ *
+ * @param {string} type The event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onSourceCreate = function(type, args, oSelf) {
+    var source = args[0];
+    if(oSelf._ftEl) {
+        oSelf._createSourceCheckbox(source);
+    }
+};
+
+/**
+ * Handles check events on the category filter checkboxes.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCheckCategory = function(v, oSelf) {
+    var newFilter = this.category;
+    var filtersArray = oSelf._categoryFilters;
+
+    if(!this.checked) { // Remove category from filters
+        for(var i=0; i<filtersArray.length; i++) {
+            if(newFilter == filtersArray[i]) {
+                filtersArray.splice(i, 1);
+                break;
+            }
+        }
+    }
+    else { // Add category to filters
+        filtersArray.push(newFilter);
+    }
+    oSelf._filterLogs();
+};
+
+/**
+ * Handles check events on the category filter checkboxes.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCheckSource = function(v, oSelf) {
+    var newFilter = this.source;
+    var filtersArray = oSelf._sourceFilters;
+
+    if(!this.checked) { // Remove category from filters
+        for(var i=0; i<filtersArray.length; i++) {
+            if(newFilter == filtersArray[i]) {
+                filtersArray.splice(i, 1);
+                break;
+            }
+        }
+    }
+    else { // Add category to filters
+        filtersArray.push(newFilter);
+    }
+    oSelf._filterLogs();
+};
+
+/**
+ * Handles click events on the collapse button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickCollapseBtn = function(v, oSelf) {
+    var btn = oSelf._collapseBtn;
+    if(btn.value == "Expand") {
+        oSelf._consoleEl.style.display = "block";
+        if(oSelf._ftEl) {
+            oSelf._ftEl.style.display = "block";
+        }
+        btn.value = "Collapse";
+    }
+    else {
+        oSelf._consoleEl.style.display = "none";
+        if(oSelf._ftEl) {
+            oSelf._ftEl.style.display = "none";
+        }
+        btn.value = "Expand";
+    }
+};
+
+/**
+ * Handles click events on the pause button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickPauseBtn = function(v, oSelf) {
+    var btn = oSelf._pauseBtn;
+    if(btn.value == "Resume") {
+        oSelf.resume();
+        btn.value = "Pause";
+    }
+    else {
+        oSelf.pause();
+        btn.value = "Resume";
+    }
+};
+
+/**
+ * Handles click events on the clear button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickClearBtn = function(v, oSelf) {
+    oSelf._clearConsole();
+};
+
+/**
+ * Handles Logger's newLogEvent.
+ *
+ * @param {string} type The newLog event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onNewLog = function(type, args, oSelf) {
+    var logEntry = args[0];
+    oSelf._buffer.push(logEntry);
+
+    if (oSelf.logReaderEnabled === true && oSelf._timeout === null) {
+        oSelf._timeout = setTimeout(function(){oSelf._printBuffer();}, 100);
+    }
+};
+
+/**
+ * Handles Logger's resetEvent.
+ *
+ * @param {string} type The click event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onReset = function(type, args, oSelf) {
+    oSelf._filterLogs();
+};
+
Index: /branches/mobile/html/test/kakinaka/js/logger/assets/logger.css
===================================================================
--- /branches/mobile/html/test/kakinaka/js/logger/assets/logger.css	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/logger/assets/logger.css	(revision 7213)
@@ -0,0 +1,21 @@
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.  Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */
+/* logger default styles */
+/* font size is controlled here: default 77% */
+#yui-log {position:absolute;top:1em;right:1em;font-size:77%;text-align:left;}
+/* width is controlled here: default 31em */
+.yui-log {padding:1em;width:31em;background-color:#AAA;border:1px solid black;font-family:monospace;z-index:9000;}
+.yui-log p {margin:1px;padding:.1em;}
+.yui-log button {font-family:monospace;}
+.yui-log .yui-log-hd {margin-top:1em;padding:.5em;background-color:#575757;color:#FFF;}
+/* height is controlled here: default 20em*/
+.yui-log .yui-log-bd {width:100%;height:20em;background-color:#FFF;border:1px solid gray;overflow:auto;}
+.yui-log .yui-log-ft {margin-top:.5em;margin-bottom:1em;}
+.yui-log .yui-log-ft .yui-log-categoryfilters {}
+.yui-log .yui-log-ft .yui-log-sourcefilters {width:100%;border-top:1px solid #575757;margin-top:.75em;padding-top:.75em;}
+.yui-log .yui-log-btns {position:relative;float:right;bottom:.25em;}
+.yui-log .yui-log-filtergrp {margin-right:.5em;}
+.yui-log .info {background-color:#A7CC25;} /* A7CC25 green */
+.yui-log .warn {background-color:#F58516;} /* F58516 orange */
+.yui-log .error {background-color:#E32F0B;} /* E32F0B red */
+.yui-log .time {background-color:#A6C9D7;} /* A6C9D7 blue */
+.yui-log .window {background-color:#F2E886;} /* F2E886 tan */
Index: /branches/mobile/html/test/kakinaka/js/yahoo/yahoo.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/yahoo/yahoo.js	(revision 7220)
+++ /branches/mobile/html/test/kakinaka/js/yahoo/yahoo.js	(revision 7220)
@@ -0,0 +1,107 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+Version: 0.11.4
+*/
+
+/**
+ * The YAHOO object is the single global object used by YUI Library.  It
+ * contains utility function for setting up namespaces, inheritance, and
+ * logging.  YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
+ * created automatically for and used by the library.
+ * @module YAHOO
+ */
+
+/**
+ * The YAHOO global namespace object
+ * @class YAHOO
+ * @static
+ */
+if (typeof YAHOO == "undefined") {
+    YAHOO = {};
+}
+
+/**
+ * Returns the namespace specified and creates it if it doesn't exist
+ *
+ * YAHOO.namespace("property.package");
+ * YAHOO.namespace("YAHOO.property.package");
+ *
+ * Either of the above would create YAHOO.property, then
+ * YAHOO.property.package
+ *
+ * Be careful when naming packages. Reserved words may work in some browsers
+ * and not others. For instance, the following will fail in Safari:
+ *
+ * YAHOO.namespace("really.long.nested.namespace");
+ *
+ * This fails because "long" is a future reserved word in ECMAScript
+ * @method namespace
+ * @static
+ * @param  {String} ns The name of the namespace
+ * @return {Object}    A reference to the namespace object
+ */
+YAHOO.namespace = function(ns) {
+
+    if (!ns || !ns.length) {
+        return null;
+    }
+
+    var levels = ns.split(".");
+    var nsobj = YAHOO;
+
+    // YAHOO is implied, so it is ignored if it is included
+    for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
+        nsobj[levels[i]] = nsobj[levels[i]] || {};
+        nsobj = nsobj[levels[i]];
+    }
+
+    return nsobj;
+};
+
+/**
+ * Uses YAHOO.widget.Logger to output a log message, if the widget is available.
+ *
+ * @method log
+ * @static
+ * @param  {string}  sMsg       The message to log.
+ * @param  {string}  sCategory  The log category for the message.  Default
+ *                              categories are "info", "warn", "error", time".
+ *                              Custom categories can be used as well. (opt)
+ * @param  {string}  sSource    The source of the the message (opt)
+ * @return {boolean}            True if the log operation was successful.
+ */
+YAHOO.log = function(sMsg, sCategory, sSource) {
+    var l = YAHOO.widget.Logger;
+    if(l && l.log) {
+        return l.log(sMsg, sCategory, sSource);
+    } else {
+        return false;
+    }
+};
+
+/**
+ * Utility to set up the prototype, constructor and superclass properties to
+ * support an inheritance strategy that can chain constructors and methods.
+ *
+ * @method extend
+ * @static
+ * @param {function} subclass   the object to modify
+ * @param {function} superclass the object to inherit
+ */
+YAHOO.extend = function(subclass, superclass) {
+    var f = function() {};
+    f.prototype = superclass.prototype;
+    subclass.prototype = new f();
+    subclass.prototype.constructor = subclass;
+    subclass.superclass = superclass.prototype;
+    if (superclass.prototype.constructor == Object.prototype.constructor) {
+        superclass.prototype.constructor = superclass;
+    }
+};
+
+YAHOO.namespace("util");
+YAHOO.namespace("widget");
+YAHOO.namespace("example");
+
Index: /branches/mobile/html/test/kakinaka/js/yahoo/yahoo-min.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/yahoo/yahoo-min.js	(revision 7220)
+++ /branches/mobile/html/test/kakinaka/js/yahoo/yahoo-min.js	(revision 7220)
@@ -0,0 +1,1 @@
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.4*/ if(typeof YAHOO=="undefined"){YAHOO={};}YAHOO.namespace=function(ns){if(!ns||!ns.length){return null;}var _2=ns.split(".");var _3=YAHOO;for(var i=(_2[0]=="YAHOO")?1:0;i<_2.length;++i){_3[_2[i]]=_3[_2[i]]||{};_3=_3[_2[i]];}return _3;};YAHOO.log=function(_5,_6,_7){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_5,_6,_7);}else{return false;}};YAHOO.extend=function(_9,_10){var f=function(){};f.prototype=_10.prototype;_9.prototype=new f();_9.prototype.constructor=_9;_9.superclass=_10.prototype;if(_10.prototype.constructor==Object.prototype.constructor){_10.prototype.constructor=_10;}};YAHOO.namespace("util");YAHOO.namespace("widget");YAHOO.namespace("example");
Index: /branches/mobile/html/test/kakinaka/js/yahoo/yahoo-debug.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/yahoo/yahoo-debug.js	(revision 7220)
+++ /branches/mobile/html/test/kakinaka/js/yahoo/yahoo-debug.js	(revision 7220)
@@ -0,0 +1,107 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+Version: 0.11.4
+*/
+
+/**
+ * The YAHOO object is the single global object used by YUI Library.  It
+ * contains utility function for setting up namespaces, inheritance, and
+ * logging.  YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
+ * created automatically for and used by the library.
+ * @module YAHOO
+ */
+
+/**
+ * The YAHOO global namespace object
+ * @class YAHOO
+ * @static
+ */
+if (typeof YAHOO == "undefined") {
+    YAHOO = {};
+}
+
+/**
+ * Returns the namespace specified and creates it if it doesn't exist
+ *
+ * YAHOO.namespace("property.package");
+ * YAHOO.namespace("YAHOO.property.package");
+ *
+ * Either of the above would create YAHOO.property, then
+ * YAHOO.property.package
+ *
+ * Be careful when naming packages. Reserved words may work in some browsers
+ * and not others. For instance, the following will fail in Safari:
+ *
+ * YAHOO.namespace("really.long.nested.namespace");
+ *
+ * This fails because "long" is a future reserved word in ECMAScript
+ * @method namespace
+ * @static
+ * @param  {String} ns The name of the namespace
+ * @return {Object}    A reference to the namespace object
+ */
+YAHOO.namespace = function(ns) {
+
+    if (!ns || !ns.length) {
+        return null;
+    }
+
+    var levels = ns.split(".");
+    var nsobj = YAHOO;
+
+    // YAHOO is implied, so it is ignored if it is included
+    for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
+        nsobj[levels[i]] = nsobj[levels[i]] || {};
+        nsobj = nsobj[levels[i]];
+    }
+
+    return nsobj;
+};
+
+/**
+ * Uses YAHOO.widget.Logger to output a log message, if the widget is available.
+ *
+ * @method log
+ * @static
+ * @param  {string}  sMsg       The message to log.
+ * @param  {string}  sCategory  The log category for the message.  Default
+ *                              categories are "info", "warn", "error", time".
+ *                              Custom categories can be used as well. (opt)
+ * @param  {string}  sSource    The source of the the message (opt)
+ * @return {boolean}            True if the log operation was successful.
+ */
+YAHOO.log = function(sMsg, sCategory, sSource) {
+    var l = YAHOO.widget.Logger;
+    if(l && l.log) {
+        return l.log(sMsg, sCategory, sSource);
+    } else {
+        return false;
+    }
+};
+
+/**
+ * Utility to set up the prototype, constructor and superclass properties to
+ * support an inheritance strategy that can chain constructors and methods.
+ *
+ * @method extend
+ * @static
+ * @param {function} subclass   the object to modify
+ * @param {function} superclass the object to inherit
+ */
+YAHOO.extend = function(subclass, superclass) {
+    var f = function() {};
+    f.prototype = superclass.prototype;
+    subclass.prototype = new f();
+    subclass.prototype.constructor = subclass;
+    subclass.superclass = superclass.prototype;
+    if (superclass.prototype.constructor == Object.prototype.constructor) {
+        superclass.prototype.constructor = superclass;
+    }
+};
+
+YAHOO.namespace("util");
+YAHOO.namespace("widget");
+YAHOO.namespace("example");
+
Index: /branches/mobile/html/test/kakinaka/js/CheckOnClickNode.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/CheckOnClickNode.js	(revision 7219)
+++ /branches/mobile/html/test/kakinaka/js/CheckOnClickNode.js	(revision 7219)
@@ -0,0 +1,23 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+YAHOO.example.CheckOnClickNode = function(oData, oParent, expanded, checked) {
+	if (oParent) { 
+		this.init(oData, oParent, expanded);
+		this.setUpLabel(oData);
+		this.checked = checked;
+	}
+};
+
+YAHOO.example.CheckOnClickNode.prototype = new YAHOO.widget.TaskNode();
+
+YAHOO.example.CheckOnClickNode.prototype.getCheckLink = function() { 
+	return "var n=YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + 
+		this.index + "); " +
+        "var r = n.checkClick(); " +
+        "YAHOO.example.customCheckClickFunction(n);" +
+        "return r;";
+};
+
+YAHOO.example.customCheckClickFunction = function(node) {
+    alert(node.checked + "(" + node.checkState + ")");
+};
Index: /branches/mobile/html/test/kakinaka/js/event/event.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/event/event.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/event/event.js	(revision 7213)
@@ -0,0 +1,1326 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+Version: 0.11.4
+*/
+
+/**
+ * The CustomEvent class lets you define events for your application
+ * that can be subscribed to by one or more independent component.
+ *
+ * @param {String}  type The type of event, which is passed to the callback
+ *                  when the event fires
+ * @param {Object}  oScope The context the event will fire from.  "this" will
+ *                  refer to this object in the callback.  Default value:
+ *                  the window object.  The listener can override this.
+ * @param {boolean} silent pass true to prevent the event from writing to
+ *                  the log system
+ * @namespace YAHOO.util
+ * @class CustomEvent
+ * @constructor
+ */
+YAHOO.util.CustomEvent = function(type, oScope, silent) {
+
+    /**
+     * The type of event, returned to subscribers when the event fires
+     * @property type
+     * @type string
+     */
+    this.type = type;
+
+    /**
+     * The scope the the event will fire from by default.  Defaults to the window
+     * obj
+     * @property scope
+     * @type object
+     */
+    this.scope = oScope || window;
+
+    /**
+     * By default all custom events are logged in the debug build, set silent
+     * to true to disable logging for this event.
+     * @property silent
+     * @type boolean
+     */
+    this.silent = silent;
+
+    /**
+     * The subscribers to this event
+     * @property subscribers
+     * @type Subscriber[]
+     */
+    this.subscribers = [];
+
+    if (!this.silent) {
+    }
+
+    // Only add subscribe events for events that are not generated by CustomEvent
+    //if (oScope && (oScope.constructor != this.constructor)) {
+
+        /*
+         * Custom events provide a custom event that fires whenever there is
+         * a new subscriber to the event.  This provides an opportunity to
+         * handle the case where there is a non-repeating event that has
+         * already fired has a new subscriber.
+         *
+         * type CustomEvent
+         */
+        //this.subscribeEvent =
+                //new YAHOO.util.CustomEvent("subscribe", this, true);
+
+    //}
+};
+
+YAHOO.util.CustomEvent.prototype = {
+    /**
+     * Subscribes the caller to this event
+     * @method subscribe
+     * @param {Function} fn       The function to execute
+     * @param {Object}   obj      An object to be passed along when the event fires
+     * @param {boolean}  bOverride If true, the obj passed in becomes the execution
+     *                            scope of the listener
+     */
+    subscribe: function(fn, obj, bOverride) {
+        //if (this.subscribeEvent) {
+            //this.subscribeEvent.fire(fn, obj, bOverride);
+        //}
+
+        this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, bOverride) );
+    },
+
+    /**
+     * Unsubscribes the caller from this event
+     * @method unsubscribe
+     * @param {Function} fn  The function to execute
+     * @param {Object}   obj An object to be passed along when the event fires
+     * @return {boolean} True if the subscriber was found and detached.
+     */
+    unsubscribe: function(fn, obj) {
+        var found = false;
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {
+            var s = this.subscribers[i];
+            if (s && s.contains(fn, obj)) {
+                this._delete(i);
+                found = true;
+            }
+        }
+
+        return found;
+    },
+
+    /**
+     * Notifies the subscribers.  The callback functions will be executed
+     * from the scope specified when the event was created, and with the following
+     * parameters:
+     *   <pre>
+     *   - The type of event
+     *   - All of the arguments fire() was executed with as an array
+     *   - The custom object (if any) that was passed into the subscribe() method
+     *   </pre>
+     * @method fire
+     * @param {Array} an arbitrary set of parameters to pass to the handler
+     */
+    fire: function() {
+        var len=this.subscribers.length;
+        if (!len && this.silent) {
+            return;
+        }
+
+        var args = [];
+
+        for (var i=0; i<arguments.length; ++i) {
+            args.push(arguments[i]);
+        }
+
+        if (!this.silent) {
+        }
+
+        for (i=0; i<len; ++i) {
+            var s = this.subscribers[i];
+            if (s) {
+                if (!this.silent) {
+                }
+                var scope = (s.override) ? s.obj : this.scope;
+                s.fn.call(scope, this.type, args, s.obj);
+            }
+        }
+    },
+
+    /**
+     * Removes all listeners
+     * @method unsubscribeAll
+     */
+    unsubscribeAll: function() {
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {
+            this._delete(len - 1 - i);
+        }
+    },
+
+    /**
+     * @method _delete
+     * @private
+     */
+    _delete: function(index) {
+        var s = this.subscribers[index];
+        if (s) {
+            delete s.fn;
+            delete s.obj;
+        }
+
+        // delete this.subscribers[index];
+        this.subscribers.splice(index, 1);
+    },
+
+    /**
+     * @method toString
+     */
+    toString: function() {
+         return "CustomEvent: " + "'" + this.type  + "', " +
+             "scope: " + this.scope;
+
+    }
+};
+
+/////////////////////////////////////////////////////////////////////
+
+/**
+ * Stores the subscriber information to be used when the event fires.
+ * @param {Function} fn       The function to execute
+ * @param {Object}   obj      An object to be passed along when the event fires
+ * @param {boolean}  bOverride If true, the obj passed in becomes the execution
+ *                            scope of the listener
+ * @class Subscriber
+ * @constructor
+ */
+YAHOO.util.Subscriber = function(fn, obj, bOverride) {
+
+    /**
+     * The callback that will be execute when the event fires
+     * @property fn
+     * @type function
+     */
+    this.fn = fn;
+
+    /**
+     * An optional custom object that will passed to the callback when
+     * the event fires
+     * @property obj
+     * @type object
+     */
+    this.obj = obj || null;
+
+    /**
+     * The default execution scope for the event listener is defined when the
+     * event is created (usually the object which contains the event).
+     * By setting override to true, the execution scope becomes the custom
+     * object passed in by the subscriber
+     * @property override
+     * @type boolean
+     */
+    this.override = (bOverride);
+};
+
+/**
+ * Returns true if the fn and obj match this objects properties.
+ * Used by the unsubscribe method to match the right subscriber.
+ *
+ * @method contains
+ * @param {Function} fn the function to execute
+ * @param {Object} obj an object to be passed along when the event fires
+ * @return {boolean} true if the supplied arguments match this
+ *                   subscriber's signature.
+ */
+YAHOO.util.Subscriber.prototype.contains = function(fn, obj) {
+    return (this.fn == fn && this.obj == obj);
+};
+
+/**
+ * @method toString
+ */
+YAHOO.util.Subscriber.prototype.toString = function() {
+    return "Subscriber { obj: " + (this.obj || "")  +
+           ", override: " +  (this.override || "no") + " }";
+};
+
+// The first instance of Event will win if it is loaded more than once.
+if (!YAHOO.util.Event) {
+
+/**
+ * The event utility provides functions to add and remove event listeners,
+ * event cleansing.  It also tries to automatically remove listeners it
+ * registers during the unload event.
+ * @namespace YAHOO.util
+ * @class Event
+ */
+    YAHOO.util.Event = function() {
+
+        /**
+         * True after the onload event has fired
+         * @property loadComplete
+         * @type boolean
+         * @private
+         */
+        var loadComplete =  false;
+
+        /**
+         * Cache of wrapped listeners
+         * @property listeners
+         * @type array
+         * @private
+         */
+        var listeners = [];
+
+        /**
+         * Listeners that will be attached during the onload event
+         * @property delayedListeners
+         * @type array
+         * @private
+         */
+        var delayedListeners = [];
+
+        /**
+         * User-defined unload function that will be fired before all events
+         * are detached
+         * @property unloadListeners
+         * @type array
+         * @private
+         */
+        var unloadListeners = [];
+
+        /**
+         * Cache of DOM0 event handlers to work around issues with DOM2 events
+         * in Safari
+         * @property legacyEvents
+         * @private
+         */
+        var legacyEvents = [];
+
+        /**
+         * Listener stack for DOM0 events
+         * @property legacyHandlers
+         * @private
+         */
+        var legacyHandlers = [];
+
+        /**
+         * The number of times to poll after window.onload.  This number is
+         * increased if additional late-bound handlers are requested after
+         * the page load.
+         * @property retryCount
+         * @private
+         */
+        var retryCount = 0;
+
+        /**
+         * onAvailable listeners
+         * @property onAvailStack
+         * @private
+         */
+        var onAvailStack = [];
+
+        /**
+         * Lookup table for legacy events
+         * @property legacyMap
+         * @private
+         */
+        var legacyMap = [];
+
+        /**
+         * Counter for auto id generation
+         * @property counter
+         * @private
+         */
+        var counter = 0;
+
+        return { // PREPROCESS
+
+            /**
+             * The number of times we should look for elements that are not
+             * in the DOM at the time the event is requested after the document
+             * has been loaded.  The default is 200@amp;50 ms, so it will poll
+             * for 10 seconds or until all outstanding handlers are bound
+             * (whichever comes first).
+             * @property POLL_RETRYS
+             * @type int
+             */
+            POLL_RETRYS: 200,
+
+            /**
+             * The poll interval in milliseconds
+             * @property POLL_INTERVAL
+             * @type int
+             */
+            POLL_INTERVAL: 50,
+
+            /**
+             * Element to bind, int constant
+             * @property EL
+             * @type int
+             */
+            EL: 0,
+
+            /**
+             * Type of event, int constant
+             * @property TYPE
+             * @type int
+             */
+            TYPE: 1,
+
+            /**
+             * Function to execute, int constant
+             * @property FN
+             * @type int
+             */
+            FN: 2,
+
+            /**
+             * Function wrapped for scope correction and cleanup, int constant
+             * @property WFN
+             * @type int
+             */
+            WFN: 3,
+
+            /**
+             * Object passed in by the user that will be returned as a
+             * parameter to the callback, int constant
+             * @property SCOPE
+             * @type int
+             */
+            SCOPE: 3,
+
+            /**
+             * Adjusted scope, either the element we are registering the event
+             * on or the custom object passed in by the listener, int constant
+             * @property ADJ_SCOPE
+             * @type int
+             */
+            ADJ_SCOPE: 4,
+
+            /**
+             * Safari detection is necessary to work around the preventDefault
+             * bug that makes it so you can't cancel a href click from the
+             * handler.  There is not a capabilities check we can use here.
+             * @property isSafari
+             * @private
+             */
+            isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),
+
+            /**
+             * IE detection needed to properly calculate pageX and pageY.
+             * capabilities checking didn't seem to work because another
+             * browser that does not provide the properties have the values
+             * calculated in a different manner than IE.
+             * @property isIE
+             * @private
+             */
+            isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) &&
+                    navigator.userAgent.match(/msie/gi)),
+
+            /**
+             * @method addDelayedListener
+             * @private
+             */
+            addDelayedListener: function(el, sType, fn, oScope, bOverride) {
+                delayedListeners[delayedListeners.length] =
+                    [el, sType, fn, oScope, bOverride];
+
+                // If this happens after the inital page load, we need to
+                // reset the poll counter so that we continue to search for
+                // the element for a fixed period of time.
+                if (loadComplete) {
+                    retryCount = this.POLL_RETRYS;
+                    this.startTimeout(0);
+                    // this._tryPreloadAttach();
+                }
+            },
+
+            /**
+             * @method startTimeout
+             * @private
+             */
+            startTimeout: function(interval) {
+                var i = (interval || interval === 0) ? interval : this.POLL_INTERVAL;
+                var self = this;
+                var callback = function() { self._tryPreloadAttach(); };
+                this.timeout = setTimeout(callback, i);
+            },
+
+            /**
+             * Executes the supplied callback when the item with the supplied
+             * id is found.  This is meant to be used to execute behavior as
+             * soon as possible as the page loads.  If you use this after the
+             * initial page load it will poll for a fixed time for the element.
+             * The number of times it will poll and the frequency are
+             * configurable.  By default it will poll for 10 seconds.
+             *
+             * @method onAvailable
+             *
+             * @param {string}   p_id the id of the element to look for.
+             * @param {function} p_fn what to execute when the element is found.
+             * @param {object}   p_obj an optional object to be passed back as
+             *                   a parameter to p_fn.
+             * @param {boolean}  p_override If set to true, p_fn will execute
+             *                   in the scope of p_obj
+             *
+             */
+            onAvailable: function(p_id, p_fn, p_obj, p_override) {
+                onAvailStack.push( { id:       p_id,
+                                     fn:       p_fn,
+                                     obj:      p_obj,
+                                     override: p_override } );
+
+                retryCount = this.POLL_RETRYS;
+                this.startTimeout(0);
+                // this._tryPreloadAttach();
+            },
+
+            /**
+             * Appends an event handler
+             *
+             * @method addListener
+             *
+             * @param {Object}   el        The html element to assign the
+             *                             event to
+             * @param {String}   sType     The type of event to append
+             * @param {Function} fn        The method the event invokes
+             * @param {Object}   oScope    An arbitrary object that will be
+             *                             passed as a parameter to the handler
+             * @param {boolean}  bOverride If true, the obj passed in becomes
+             *                             the execution scope of the listener
+             * @return {boolean} True if the action was successful or defered,
+             *                        false if one or more of the elements
+             *                        could not have the event bound to it.
+             */
+            addListener: function(el, sType, fn, oScope, bOverride) {
+
+                if (!fn || !fn.call) {
+                    return false;
+                }
+
+                // The el argument can be an array of elements or element ids.
+                if ( this._isValidCollection(el)) {
+                    var ok = true;
+                    for (var i=0,len=el.length; i<len; ++i) {
+                        ok = ( this.on(el[i],
+                                       sType,
+                                       fn,
+                                       oScope,
+                                       bOverride) && ok );
+                    }
+                    return ok;
+
+                } else if (typeof el == "string") {
+                    var oEl = this.getEl(el);
+                    // If the el argument is a string, we assume it is
+                    // actually the id of the element.  If the page is loaded
+                    // we convert el to the actual element, otherwise we
+                    // defer attaching the event until onload event fires
+
+                    // check to see if we need to delay hooking up the event
+                    // until after the page loads.
+                    if (loadComplete && oEl) {
+                        el = oEl;
+                    } else {
+                        // defer adding the event until onload fires
+                        this.addDelayedListener(el,
+                                                sType,
+                                                fn,
+                                                oScope,
+                                                bOverride);
+
+                        return true;
+                    }
+                }
+
+                // Element should be an html element or an array if we get
+                // here.
+                if (!el) {
+                    return false;
+                }
+
+                // we need to make sure we fire registered unload events
+                // prior to automatically unhooking them.  So we hang on to
+                // these instead of attaching them to the window and fire the
+                // handles explicitly during our one unload event.
+                if ("unload" == sType && oScope !== this) {
+                    unloadListeners[unloadListeners.length] =
+                            [el, sType, fn, oScope, bOverride];
+                    return true;
+                }
+
+                // if the user chooses to override the scope, we use the custom
+                // object passed in, otherwise the executing scope will be the
+                // HTML element that the event is registered on
+                var scope = (bOverride) ? oScope : el;
+
+                // wrap the function so we can return the oScope object when
+                // the event fires;
+                var wrappedFn = function(e) {
+                        return fn.call(scope, YAHOO.util.Event.getEvent(e),
+                                oScope);
+                    };
+
+                var li = [el, sType, fn, wrappedFn, scope];
+                var index = listeners.length;
+                // cache the listener so we can try to automatically unload
+                listeners[index] = li;
+
+                if (this.useLegacyEvent(el, sType)) {
+                    var legacyIndex = this.getLegacyIndex(el, sType);
+
+                    // Add a new dom0 wrapper if one is not detected for this
+                    // element
+                    if ( legacyIndex == -1 ||
+                                el != legacyEvents[legacyIndex][0] ) {
+
+                        legacyIndex = legacyEvents.length;
+                        legacyMap[el.id + sType] = legacyIndex;
+
+                        // cache the signature for the DOM0 event, and
+                        // include the existing handler for the event, if any
+                        legacyEvents[legacyIndex] =
+                            [el, sType, el["on" + sType]];
+                        legacyHandlers[legacyIndex] = [];
+
+                        el["on" + sType] =
+                            function(e) {
+                                YAHOO.util.Event.fireLegacyEvent(
+                                    YAHOO.util.Event.getEvent(e), legacyIndex);
+                            };
+                    }
+
+                    // add a reference to the wrapped listener to our custom
+                    // stack of events
+                    //legacyHandlers[legacyIndex].push(index);
+                    legacyHandlers[legacyIndex].push(li);
+
+                // DOM2 Event model
+                } else if (el.addEventListener) {
+                    el.addEventListener(sType, wrappedFn, false);
+                // IE
+                } else if (el.attachEvent) {
+                    el.attachEvent("on" + sType, wrappedFn);
+                }
+
+                return true;
+
+            },
+
+            /**
+             * When using legacy events, the handler is routed to this object
+             * so we can fire our custom listener stack.
+             * @method fireLegacyEvent
+             * @private
+             */
+            fireLegacyEvent: function(e, legacyIndex) {
+                var ok = true;
+
+                var le = legacyHandlers[legacyIndex];
+                for (var i=0,len=le.length; i<len; ++i) {
+                    var li = le[i];
+                    if ( li && li[this.WFN] ) {
+                        var scope = li[this.ADJ_SCOPE];
+                        var ret = li[this.WFN].call(scope, e);
+                        ok = (ok && ret);
+                    }
+                }
+
+                return ok;
+            },
+
+            /**
+             * Returns the legacy event index that matches the supplied
+             * signature
+             * @method getLegacyIndex
+             * @private
+             */
+            getLegacyIndex: function(el, sType) {
+                var key = this.generateId(el) + sType;
+                if (typeof legacyMap[key] == "undefined") {
+                    return -1;
+                } else {
+                    return legacyMap[key];
+                }
+            },
+
+            /**
+             * Logic that determines when we should automatically use legacy
+             * events instead of DOM2 events.
+             * @method useLegacyEvent
+             * @private
+             */
+            useLegacyEvent: function(el, sType) {
+                if (!el.addEventListener && !el.attachEvent) {
+                    return true;
+                } else if (this.isSafari) {
+                    if ("click" == sType || "dblclick" == sType) {
+                        return true;
+                    }
+                }
+                return false;
+            },
+
+            /**
+             * Removes an event handler
+             *
+             * @method removeListener
+             *
+             * @param {Object} el the html element or the id of the element to
+             * assign the event to.
+             * @param {String} sType the type of event to remove
+             * @param {Function} fn the method the event invokes
+             * @return {boolean} true if the unbind was successful, false
+             * otherwise
+             */
+            removeListener: function(el, sType, fn, index) {
+
+                if (!fn || !fn.call) {
+                    return false;
+                }
+
+                var i, len;
+
+                // The el argument can be a string
+                if (typeof el == "string") {
+                    el = this.getEl(el);
+                // The el argument can be an array of elements or element ids.
+                } else if ( this._isValidCollection(el)) {
+                    var ok = true;
+                    for (i=0,len=el.length; i<len; ++i) {
+                        ok = ( this.removeListener(el[i], sType, fn) && ok );
+                    }
+                    return ok;
+                }
+
+                if ("unload" == sType) {
+
+                    for (i=0, len=unloadListeners.length; i<len; i++) {
+                        var li = unloadListeners[i];
+                        if (li &&
+                            li[0] == el &&
+                            li[1] == sType &&
+                            li[2] == fn) {
+                                unloadListeners.splice(i, 1);
+                                return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                var cacheItem = null;
+
+                //var index = arguments[3];
+
+                if ("undefined" == typeof index) {
+                    index = this._getCacheIndex(el, sType, fn);
+                }
+
+                if (index >= 0) {
+                    cacheItem = listeners[index];
+                }
+
+                if (!el || !cacheItem) {
+                    return false;
+                }
+
+                if (this.useLegacyEvent(el, sType)) {
+                    var legacyIndex = this.getLegacyIndex(el, sType);
+                    var llist = legacyHandlers[legacyIndex];
+                    if (llist) {
+                        for (i=0, len=llist.length; i<len; ++i) {
+                            li = llist[i];
+                            if (li &&
+                                li[this.EL] == el &&
+                                li[this.TYPE] == sType &&
+                                li[this.FN] == fn) {
+                                    llist.splice(i, 1);
+                            }
+                        }
+                    }
+
+                } else if (el.removeEventListener) {
+                    el.removeEventListener(sType, cacheItem[this.WFN], false);
+                } else if (el.detachEvent) {
+                    el.detachEvent("on" + sType, cacheItem[this.WFN]);
+                }
+
+                // removed the wrapped handler
+                delete listeners[index][this.WFN];
+                delete listeners[index][this.FN];
+                listeners.splice(index, 1);
+
+                return true;
+
+            },
+
+            /**
+             * Returns the event's target element
+             * @method getTarget
+             * @param {Event} ev the event
+             * @param {boolean} resolveTextNode when set to true the target's
+             *                  parent will be returned if the target is a
+             *                  text node.  @deprecated, the text node is
+             *                  now resolved automatically
+             * @return {HTMLElement} the event's target
+             */
+            getTarget: function(ev, resolveTextNode) {
+                var t = ev.target || ev.srcElement;
+                return this.resolveTextNode(t);
+            },
+
+            /**
+             * In some cases, some browsers will return a text node inside
+             * the actual element that was targeted.  This normalizes the
+             * return value for getTarget and getRelatedTarget.
+             * @method resolveTextNode
+             * @param {HTMLElement} node to resolve
+             * @return  the normized node
+             */
+            resolveTextNode: function(node) {
+                if (node && node.nodeName &&
+                        "#TEXT" == node.nodeName.toUpperCase()) {
+                    return node.parentNode;
+                } else {
+                    return node;
+                }
+            },
+
+            /**
+             * Returns the event's pageX
+             * @method getPageX
+             * @param {Event} ev the event
+             * @return {int} the event's pageX
+             */
+            getPageX: function(ev) {
+                var x = ev.pageX;
+                if (!x && 0 !== x) {
+                    x = ev.clientX || 0;
+
+                    if ( this.isIE ) {
+                        x += this._getScrollLeft();
+                    }
+                }
+
+                return x;
+            },
+
+            /**
+             * Returns the event's pageY
+             * @method getPageY
+             * @param {Event} ev the event
+             * @return {int} the event's pageY
+             */
+            getPageY: function(ev) {
+                var y = ev.pageY;
+                if (!y && 0 !== y) {
+                    y = ev.clientY || 0;
+
+                    if ( this.isIE ) {
+                        y += this._getScrollTop();
+                    }
+                }
+
+                return y;
+            },
+
+            /**
+             * Returns the pageX and pageY properties as an indexed array.
+             * @method getXY
+             * @type int[]
+             */
+            getXY: function(ev) {
+                return [this.getPageX(ev), this.getPageY(ev)];
+            },
+
+            /**
+             * Returns the event's related target
+             * @method getRelatedTarget
+             * @param {Event} ev the event
+             * @return {HTMLElement} the event's relatedTarget
+             */
+            getRelatedTarget: function(ev) {
+                var t = ev.relatedTarget;
+                if (!t) {
+                    if (ev.type == "mouseout") {
+                        t = ev.toElement;
+                    } else if (ev.type == "mouseover") {
+                        t = ev.fromElement;
+                    }
+                }
+
+                return this.resolveTextNode(t);
+            },
+
+            /**
+             * Returns the time of the event.  If the time is not included, the
+             * event is modified using the current time.
+             * @method getTime
+             * @param {Event} ev the event
+             * @return {Date} the time of the event
+             */
+            getTime: function(ev) {
+                if (!ev.time) {
+                    var t = new Date().getTime();
+                    try {
+                        ev.time = t;
+                    } catch(e) {
+                        // can't set the time property
+                        return t;
+                    }
+                }
+
+                return ev.time;
+            },
+
+            /**
+             * Convenience method for stopPropagation + preventDefault
+             * @method stopEvent
+             * @param {Event} ev the event
+             */
+            stopEvent: function(ev) {
+                this.stopPropagation(ev);
+                this.preventDefault(ev);
+            },
+
+            /**
+             * Stops event propagation
+             * @method stopPropagation
+             * @param {Event} ev the event
+             */
+            stopPropagation: function(ev) {
+                if (ev.stopPropagation) {
+                    ev.stopPropagation();
+                } else {
+                    ev.cancelBubble = true;
+                }
+            },
+
+            /**
+             * Prevents the default behavior of the event
+             * @method preventDefault
+             * @param {Event} ev the event
+             */
+            preventDefault: function(ev) {
+                if (ev.preventDefault) {
+                    ev.preventDefault();
+                } else {
+                    ev.returnValue = false;
+                }
+            },
+
+            /**
+             * Finds the event in the window object, the caller's arguments, or
+             * in the arguments of another method in the callstack.  This is
+             * executed automatically for events registered through the event
+             * manager, so the implementer should not normally need to execute
+             * this function at all.
+             * @method getEvent
+             * @param {Event} the event parameter from the handler
+             * @return {Event} the event
+             */
+            getEvent: function(e) {
+                var ev = e || window.event;
+
+                if (!ev) {
+                    var c = this.getEvent.caller;
+                    while (c) {
+                        ev = c.arguments[0];
+                        if (ev && Event == ev.constructor) {
+                            break;
+                        }
+                        c = c.caller;
+                    }
+                }
+
+                return ev;
+            },
+
+            /**
+             * Returns the charcode for an event
+             * @method getCharCode
+             * @param {Event} ev the event
+             * @return {int} the event's charCode
+             */
+            getCharCode: function(ev) {
+                return ev.charCode || ((ev.type == "keypress") ? ev.keyCode : 0);
+            },
+
+            /**
+             * Locating the saved event handler data by function ref
+             *
+             * @method _getCacheIndex
+             * @private
+             */
+            _getCacheIndex: function(el, sType, fn) {
+                for (var i=0,len=listeners.length; i<len; ++i) {
+                    var li = listeners[i];
+                    if ( li                 &&
+                         li[this.FN] == fn  &&
+                         li[this.EL] == el  &&
+                         li[this.TYPE] == sType ) {
+                        return i;
+                    }
+                }
+
+                return -1;
+            },
+
+            /**
+             * Generates an unique ID for the element if it does not already
+             * have one.
+             * @method generateId
+             * @param el the element
+             * @return {string} the id of the element
+             */
+            generateId: function(el) {
+                var id = el.id;
+
+                if (!id) {
+                    id = "yuievtautoid-" + counter;
+                    ++counter;
+                    el.id = id;
+                }
+
+                return id;
+            },
+
+            /**
+             * We want to be able to use getElementsByTagName as a collection
+             * to attach a group of events to.  Unfortunately, different
+             * browsers return different types of collections.  This function
+             * tests to determine if the object is array-like.  It will also
+             * fail if the object is an array, but is empty.
+             * @method _isValidCollection
+             * @param o the object to test
+             * @return {boolean} true if the object is array-like and populated
+             * @private
+             */
+            _isValidCollection: function(o) {
+
+                return ( o                    && // o is something
+                         o.length             && // o is indexed
+                         typeof o != "string" && // o is not a string
+                         !o.tagName           && // o is not an HTML element
+                         !o.alert             && // o is not a window
+                         typeof o[0] != "undefined" );
+
+            },
+
+            /**
+             * @private
+             * @property elCache
+             * DOM element cache
+             */
+            elCache: {},
+
+            /**
+             * We cache elements bound by id because when the unload event
+             * fires, we can no longer use document.getElementById
+             * @method getEl
+             * @private
+             */
+            getEl: function(id) {
+                return document.getElementById(id);
+            },
+
+            /**
+             * Clears the element cache
+             * @deprecated
+             * @private
+             */
+            clearCache: function() { },
+
+            /**
+             * hook up any deferred listeners
+             * @method _load
+             * @private
+             */
+            _load: function(e) {
+                loadComplete = true;
+                var EU = YAHOO.util.Event;
+                EU._simpleRemove(window, "load", EU._load);
+            },
+
+            /**
+             * Polling function that runs before the onload event fires,
+             * attempting to attach to DOM Nodes as soon as they are
+             * available
+             * @method _tryPreloadAttach
+             * @private
+             */
+            _tryPreloadAttach: function() {
+
+                if (this.locked) {
+                    return false;
+                }
+
+                this.locked = true;
+
+                // keep trying until after the page is loaded.  We need to
+                // check the page load state prior to trying to bind the
+                // elements so that we can be certain all elements have been
+                // tested appropriately
+                var tryAgain = !loadComplete;
+                if (!tryAgain) {
+                    tryAgain = (retryCount > 0);
+                }
+
+                // Delayed listeners
+                var stillDelayed = [];
+
+                for (var i=0,len=delayedListeners.length; i<len; ++i) {
+                    var d = delayedListeners[i];
+                    // There may be a race condition here, so we need to
+                    // verify the array element is usable.
+                    if (d) {
+
+                        // el will be null if document.getElementById did not
+                        // work
+                        var el = this.getEl(d[this.EL]);
+
+                        if (el) {
+                            this.on(el, d[this.TYPE], d[this.FN],
+                                    d[this.SCOPE], d[this.ADJ_SCOPE]);
+                            delete delayedListeners[i];
+                        } else {
+                            stillDelayed.push(d);
+                        }
+                    }
+                }
+
+                delayedListeners = stillDelayed;
+
+                // onAvailable
+                var notAvail = [];
+                for (i=0,len=onAvailStack.length; i<len ; ++i) {
+                    var item = onAvailStack[i];
+                    if (item) {
+                        el = this.getEl(item.id);
+
+                        if (el) {
+                            var scope = (item.override) ? item.obj : el;
+                            item.fn.call(scope, item.obj);
+                            delete onAvailStack[i];
+                        } else {
+                            notAvail.push(item);
+                        }
+                    }
+                }
+
+                retryCount = (stillDelayed.length === 0 &&
+                                    notAvail.length === 0) ? 0 : retryCount - 1;
+
+                if (tryAgain) {
+                    this.startTimeout();
+                }
+
+                this.locked = false;
+
+                return true;
+
+            },
+
+            /**
+             * Removes all listeners attached to the given element via addListener.
+             * Optionally, the node's children can also be purged.
+             * Optionally, you can specify a specific type of event to remove.
+             * @method purgeElement
+             * @param {HTMLElement} el the element to purge
+             * @param {boolean} recurse recursively purge this element's children
+             * as well.  Use with caution.
+             * @param {string} sType optional type of listener to purge. If
+             * left out, all listeners will be removed
+             */
+            purgeElement: function(el, recurse, sType) {
+                var elListeners = this.getListeners(el, sType);
+                if (elListeners) {
+                    for (var i=0,len=elListeners.length; i<len ; ++i) {
+                        var l = elListeners[i];
+                        // can't use the index on the changing collection
+                        //this.removeListener(el, l.type, l.fn, l.index);
+                        this.removeListener(el, l.type, l.fn);
+                    }
+                }
+
+                if (recurse && el && el.childNodes) {
+                    for (i=0,len=el.childNodes.length; i<len ; ++i) {
+                        this.purgeElement(el.childNodes[i], recurse, sType);
+                    }
+                }
+            },
+
+            /**
+             * Returns all listeners attached to the given element via addListener.
+             * Optionally, you can specify a specific type of event to return.
+             * @method getListeners
+             * @param el {HTMLElement} the element to inspect
+             * @param sType {string} optional type of listener to return. If
+             * left out, all listeners will be returned
+             * @return {Object} the listener. Contains the following fields:
+             *    type:   (string)   the type of event
+             *    fn:     (function) the callback supplied to addListener
+             *    obj:    (object)   the custom object supplied to addListener
+             *    adjust: (boolean)  whether or not to adjust the default scope
+             *    index:  (int)      its position in the Event util listener cache
+             */
+            getListeners: function(el, sType) {
+                var elListeners = [];
+                if (listeners && listeners.length > 0) {
+                    for (var i=0,len=listeners.length; i<len ; ++i) {
+                        var l = listeners[i];
+                        if ( l  && l[this.EL] === el &&
+                                (!sType || sType === l[this.TYPE]) ) {
+                            elListeners.push({
+                                type:   l[this.TYPE],
+                                fn:     l[this.FN],
+                                obj:    l[this.SCOPE],
+                                adjust: l[this.ADJ_SCOPE],
+                                index:  i
+                            });
+                        }
+                    }
+                }
+
+                return (elListeners.length) ? elListeners : null;
+            },
+
+            /**
+             * Removes all listeners registered by pe.event.  Called
+             * automatically during the unload event.
+             * @method _unload
+             * @private
+             */
+            _unload: function(e) {
+
+                var EU = YAHOO.util.Event;
+
+                for (var i=0,len=unloadListeners.length; i<len; ++i) {
+                    var l = unloadListeners[i];
+                    if (l) {
+                        var scope = (l[EU.ADJ_SCOPE]) ? l[EU.SCOPE]: window;
+                        l[EU.FN].call(scope, EU.getEvent(e), l[EU.SCOPE] );
+                        delete unloadListeners[i];
+                        l=null;
+                    }
+                }
+
+                if (listeners && listeners.length > 0) {
+                    //for (i=0,len=listeners.length; i<len ; ++i) {
+                    var j = listeners.length;
+                    while (j) {
+                        var index = j-1;
+                        l = listeners[index];
+                        if (l) {
+                            EU.removeListener(l[EU.EL], l[EU.TYPE],
+                                    l[EU.FN], index);
+                        }
+
+                        l=null;
+
+                        j = j - 1;
+                    }
+
+                    EU.clearCache();
+                }
+
+                for (i=0,len=legacyEvents.length; i<len; ++i) {
+                    // dereference the element
+                    delete legacyEvents[i][0];
+                    // delete the array item
+                    delete legacyEvents[i];
+                }
+
+                EU._simpleRemove(window, "unload", EU._unload);
+
+            },
+
+            /**
+             * Returns scrollLeft
+             * @method _getScrollLeft
+             * @private
+             */
+            _getScrollLeft: function() {
+                return this._getScroll()[1];
+            },
+
+            /**
+             * Returns scrollTop
+             * @method _getScrollTop
+             * @private
+             */
+            _getScrollTop: function() {
+                return this._getScroll()[0];
+            },
+
+            /**
+             * Returns the scrollTop and scrollLeft.  Used to calculate the
+             * pageX and pageY in Internet Explorer
+             * @method _getScroll
+             * @private
+             */
+            _getScroll: function() {
+                var dd = document.documentElement, db = document.body;
+                if (dd && (dd.scrollTop || dd.scrollLeft)) {
+                    return [dd.scrollTop, dd.scrollLeft];
+                } else if (db) {
+                    return [db.scrollTop, db.scrollLeft];
+                } else {
+                    return [0, 0];
+                }
+            },
+
+            /**
+             * Adds a DOM event directly without the caching, cleanup, scope adj, etc
+             *
+             * @param el the elment to bind the handler to
+             * @param {string} sType the type of event handler
+             * @param {function} fn the callback to invoke
+             * @param {boolen} capture or bubble phase
+             * @private
+             */
+            _simpleAdd: function (el, sType, fn, capture) {
+                if (el.addEventListener) {
+                    el.addEventListener(sType, fn, (capture));
+                } else if (el.attachEvent) {
+                    el.attachEvent("on" + sType, fn);
+                }
+            },
+
+            /**
+             * Basic remove listener
+             *
+             * @param el the elment to bind the handler to
+             * @param {string} sType the type of event handler
+             * @param {function} fn the callback to invoke
+             * @param {boolen} capture or bubble phase
+             * @private
+             */
+            _simpleRemove: function (el, sType, fn, capture) {
+                if (el.removeEventListener) {
+                    el.removeEventListener(sType, fn, (capture));
+                } else if (el.detachEvent) {
+                    el.detachEvent("on" + sType, fn);
+                }
+            }
+        };
+
+    } ();
+
+    /**
+     * YAHOO.util.Event.on is an alias for addListener
+     * @method on
+     * @see addListener
+     */
+    YAHOO.util.Event.on = YAHOO.util.Event.addListener;
+
+    if (document && document.body) {
+        YAHOO.util.Event._load();
+    } else {
+        YAHOO.util.Event._simpleAdd(window, "load", YAHOO.util.Event._load);
+    }
+    YAHOO.util.Event._simpleAdd(window, "unload", YAHOO.util.Event._unload);
+    YAHOO.util.Event._tryPreloadAttach();
+}
+
Index: /branches/mobile/html/test/kakinaka/js/event/event-min.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/event/event-min.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/event/event-min.js	(revision 7213)
@@ -0,0 +1,1 @@
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt Version: 0.11.4*/ YAHOO.util.CustomEvent=function(_1,_2,_3){this.type=_1;this.scope=_2||window;this.silent=_3;this.subscribers=[];if(!this.silent){}};YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_5,_6){this.subscribers.push(new YAHOO.util.Subscriber(fn,_5,_6));},unsubscribe:function(fn,_7){var _8=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_7)){this._delete(i);_8=true;}}return _8;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return;}var _12=[];for(var i=0;i<arguments.length;++i){_12.push(arguments[i]);}if(!this.silent){}for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _13=(s.override)?s.obj:this.scope;s.fn.call(_13,this.type,_12,s.obj);}}},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}},_delete:function(_14){var s=this.subscribers[_14];if(s){delete s.fn;delete s.obj;}this.subscribers.splice(_14,1);},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,_16){this.fn=fn;this.obj=obj||null;this.override=(_16);};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){return (this.fn==fn&&this.obj==obj);};YAHOO.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var _17=false;var _18=[];var _19=[];var _20=[];var _21=[];var _22=[];var _23=0;var _24=[];var _25=[];var _26=0;return {POLL_RETRYS:200,POLL_INTERVAL:50,EL:0,TYPE:1,FN:2,WFN:3,SCOPE:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),addDelayedListener:function(el,_28,fn,_29,_30){_19[_19.length]=[el,_28,fn,_29,_30];if(_17){_23=this.POLL_RETRYS;this.startTimeout(0);}},startTimeout:function(_31){var i=(_31||_31===0)?_31:this.POLL_INTERVAL;var _32=this;var _33=function(){_32._tryPreloadAttach();};this.timeout=setTimeout(_33,i);},onAvailable:function(_34,_35,_36,_37){_24.push({id:_34,fn:_35,obj:_36,override:_37});_23=this.POLL_RETRYS;this.startTimeout(0);},addListener:function(el,_38,fn,_39,_40){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=(this.on(el[i],_38,fn,_39,_40)&&ok);}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(_17&&oEl){el=oEl;}else{this.addDelayedListener(el,_38,fn,_39,_40);return true;}}}if(!el){return false;}if("unload"==_38&&_39!==this){_20[_20.length]=[el,_38,fn,_39,_40];return true;}var _43=(_40)?_39:el;var _44=function(e){return fn.call(_43,YAHOO.util.Event.getEvent(e),_39);};var li=[el,_38,fn,_44,_43];var _47=_18.length;_18[_47]=li;if(this.useLegacyEvent(el,_38)){var _48=this.getLegacyIndex(el,_38);if(_48==-1||el!=_21[_48][0]){_48=_21.length;_25[el.id+_38]=_48;_21[_48]=[el,_38,el["on"+_38]];_22[_48]=[];el["on"+_38]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),_48);};}_22[_48].push(li);}else{if(el.addEventListener){el.addEventListener(_38,_44,false);}else{if(el.attachEvent){el.attachEvent("on"+_38,_44);}}}return true;},fireLegacyEvent:function(e,_49){var ok=true;var le=_22[_49];for(var i=0,len=le.length;i<len;++i){var li=le[i];if(li&&li[this.WFN]){var _51=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_51,e);ok=(ok&&ret);}}return ok;},getLegacyIndex:function(el,_53){var key=this.generateId(el)+_53;if(typeof _25[key]=="undefined"){return -1;}else{return _25[key];}},useLegacyEvent:function(el,_55){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_55||"dblclick"==_55){return true;}}}return false;},removeListener:function(el,_56,fn,_57){if(!fn||!fn.call){return false;}var i,len;if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_56,fn)&&ok);}return ok;}}if("unload"==_56){for(i=0,len=_20.length;i<len;i++){var li=_20[i];if(li&&li[0]==el&&li[1]==_56&&li[2]==fn){_20.splice(i,1);return true;}}return false;}var _58=null;if("undefined"==typeof _57){_57=this._getCacheIndex(el,_56,fn);}if(_57>=0){_58=_18[_57];}if(!el||!_58){return false;}if(this.useLegacyEvent(el,_56)){var _59=this.getLegacyIndex(el,_56);var _60=_22[_59];if(_60){for(i=0,len=_60.length;i<len;++i){li=_60[i];if(li&&li[this.EL]==el&&li[this.TYPE]==_56&&li[this.FN]==fn){_60.splice(i,1);}}}}else{if(el.removeEventListener){el.removeEventListener(_56,_58[this.WFN],false);}else{if(el.detachEvent){el.detachEvent("on"+_56,_58[this.WFN]);}}}delete _18[_57][this.WFN];delete _18[_57][this.FN];_18.splice(_57,1);return true;},getTarget:function(ev,_62){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_64){if(_64&&_64.nodeName&&"#TEXT"==_64.nodeName.toUpperCase()){return _64.parentNode;}else{return _64;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||((ev.type=="keypress")?ev.keyCode:0);},_getCacheIndex:function(el,_68,fn){for(var i=0,len=_18.length;i<len;++i){var li=_18[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_68){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_26;++_26;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){_17=true;var EU=YAHOO.util.Event;EU._simpleRemove(window,"load",EU._load);},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _72=!_17;if(!_72){_72=(_23>0);}var _73=[];for(var i=0,len=_19.length;i<len;++i){var d=_19[i];if(d){var el=this.getEl(d[this.EL]);if(el){this.on(el,d[this.TYPE],d[this.FN],d[this.SCOPE],d[this.ADJ_SCOPE]);delete _19[i];}else{_73.push(d);}}}_19=_73;var _75=[];for(i=0,len=_24.length;i<len;++i){var _76=_24[i];if(_76){el=this.getEl(_76.id);if(el){var _77=(_76.override)?_76.obj:el;_76.fn.call(_77,_76.obj);delete _24[i];}else{_75.push(_76);}}}_23=(_73.length===0&&_75.length===0)?0:_23-1;if(_72){this.startTimeout();}this.locked=false;return true;},purgeElement:function(el,_78,_79){var _80=this.getListeners(el,_79);if(_80){for(var i=0,len=_80.length;i<len;++i){var l=_80[i];this.removeListener(el,l.type,l.fn);}}if(_78&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_78,_79);}}},getListeners:function(el,_82){var _83=[];if(_18&&_18.length>0){for(var i=0,len=_18.length;i<len;++i){var l=_18[i];if(l&&l[this.EL]===el&&(!_82||_82===l[this.TYPE])){_83.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.SCOPE],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_83.length)?_83:null;},_unload:function(e){var EU=YAHOO.util.Event;for(var i=0,len=_20.length;i<len;++i){var l=_20[i];if(l){var _84=(l[EU.ADJ_SCOPE])?l[EU.SCOPE]:window;l[EU.FN].call(_84,EU.getEvent(e),l[EU.SCOPE]);delete _20[i];l=null;}}if(_18&&_18.length>0){var j=_18.length;while(j){var _86=j-1;l=_18[_86];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],_86);}l=null;j=j-1;}EU.clearCache();}for(i=0,len=_21.length;i<len;++i){delete _21[i][0];delete _21[i];}EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}},_simpleAdd:function(el,_88,fn,_89){if(el.addEventListener){el.addEventListener(_88,fn,(_89));}else{if(el.attachEvent){el.attachEvent("on"+_88,fn);}}},_simpleRemove:function(el,_90,fn,_91){if(el.removeEventListener){el.removeEventListener(_90,fn,(_91));}else{if(el.detachEvent){el.detachEvent("on"+_90,fn);}}}};}();YAHOO.util.Event.on=YAHOO.util.Event.addListener;if(document&&document.body){YAHOO.util.Event._load();}else{YAHOO.util.Event._simpleAdd(window,"load",YAHOO.util.Event._load);}YAHOO.util.Event._simpleAdd(window,"unload",YAHOO.util.Event._unload);YAHOO.util.Event._tryPreloadAttach();}
Index: /branches/mobile/html/test/kakinaka/js/event/event-debug.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/event/event-debug.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/event/event-debug.js	(revision 7213)
@@ -0,0 +1,1353 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+Version: 0.11.4
+*/
+
+
+/**
+ * The CustomEvent class lets you define events for your application
+ * that can be subscribed to by one or more independent component.
+ *
+ * @param {String}  type The type of event, which is passed to the callback
+ *                  when the event fires
+ * @param {Object}  oScope The context the event will fire from.  "this" will
+ *                  refer to this object in the callback.  Default value:
+ *                  the window object.  The listener can override this.
+ * @param {boolean} silent pass true to prevent the event from writing to
+ *                  the log system
+ * @namespace YAHOO.util
+ * @class CustomEvent
+ * @constructor
+ */
+YAHOO.util.CustomEvent = function(type, oScope, silent) {
+
+    /**
+     * The type of event, returned to subscribers when the event fires
+     * @property type
+     * @type string
+     */
+    this.type = type;
+
+    /**
+     * The scope the the event will fire from by default.  Defaults to the window
+     * obj
+     * @property scope
+     * @type object
+     */
+    this.scope = oScope || window;
+
+    /**
+     * By default all custom events are logged in the debug build, set silent
+     * to true to disable logging for this event.
+     * @property silent
+     * @type boolean
+     */
+    this.silent = silent;
+
+    /**
+     * The subscribers to this event
+     * @property subscribers
+     * @type Subscriber[]
+     */
+    this.subscribers = [];
+
+    if (!this.silent) {
+        YAHOO.log( "Creating " + this, "info", "Event" );
+    }
+
+    // Only add subscribe events for events that are not generated by CustomEvent
+    //if (oScope && (oScope.constructor != this.constructor)) {
+
+        /*
+         * Custom events provide a custom event that fires whenever there is
+         * a new subscriber to the event.  This provides an opportunity to
+         * handle the case where there is a non-repeating event that has
+         * already fired has a new subscriber.
+         *
+         * type CustomEvent
+         */
+        //this.subscribeEvent =
+                //new YAHOO.util.CustomEvent("subscribe", this, true);
+
+    //}
+};
+
+YAHOO.util.CustomEvent.prototype = {
+    /**
+     * Subscribes the caller to this event
+     * @method subscribe
+     * @param {Function} fn       The function to execute
+     * @param {Object}   obj      An object to be passed along when the event fires
+     * @param {boolean}  bOverride If true, the obj passed in becomes the execution
+     *                            scope of the listener
+     */
+    subscribe: function(fn, obj, bOverride) {
+        //if (this.subscribeEvent) {
+            //this.subscribeEvent.fire(fn, obj, bOverride);
+        //}
+
+        this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, bOverride) );
+    },
+
+    /**
+     * Unsubscribes the caller from this event
+     * @method unsubscribe
+     * @param {Function} fn  The function to execute
+     * @param {Object}   obj An object to be passed along when the event fires
+     * @return {boolean} True if the subscriber was found and detached.
+     */
+    unsubscribe: function(fn, obj) {
+        var found = false;
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {
+            var s = this.subscribers[i];
+            if (s && s.contains(fn, obj)) {
+                this._delete(i);
+                found = true;
+            }
+        }
+
+        return found;
+    },
+
+    /**
+     * Notifies the subscribers.  The callback functions will be executed
+     * from the scope specified when the event was created, and with the following
+     * parameters:
+     *   <pre>
+     *   - The type of event
+     *   - All of the arguments fire() was executed with as an array
+     *   - The custom object (if any) that was passed into the subscribe() method
+     *   </pre>
+     * @method fire
+     * @param {Array} an arbitrary set of parameters to pass to the handler
+     */
+    fire: function() {
+        var len=this.subscribers.length;
+        if (!len && this.silent) {
+            return;
+        }
+
+        var args = [];
+
+        for (var i=0; i<arguments.length; ++i) {
+            args.push(arguments[i]);
+        }
+
+        if (!this.silent) {
+            YAHOO.log( "Firing "       + this  + ", " +
+                       "args: "        + args  + ", " +
+                       "subscribers: " + len,
+                       "info", "Event"                  );
+        }
+
+        for (i=0; i<len; ++i) {
+            var s = this.subscribers[i];
+            if (s) {
+                if (!this.silent) {
+                    YAHOO.log( this.type + "->" + (i+1) + ": " +  s, "info", "Event" );
+                }
+                var scope = (s.override) ? s.obj : this.scope;
+                s.fn.call(scope, this.type, args, s.obj);
+            }
+        }
+    },
+
+    /**
+     * Removes all listeners
+     * @method unsubscribeAll
+     */
+    unsubscribeAll: function() {
+        for (var i=0, len=this.subscribers.length; i<len; ++i) {
+            this._delete(len - 1 - i);
+        }
+    },
+
+    /**
+     * @method _delete
+     * @private
+     */
+    _delete: function(index) {
+        var s = this.subscribers[index];
+        if (s) {
+            delete s.fn;
+            delete s.obj;
+        }
+
+        // delete this.subscribers[index];
+        this.subscribers.splice(index, 1);
+    },
+
+    /**
+     * @method toString
+     */
+    toString: function() {
+         return "CustomEvent: " + "'" + this.type  + "', " +
+             "scope: " + this.scope;
+
+    }
+};
+
+/////////////////////////////////////////////////////////////////////
+
+/**
+ * Stores the subscriber information to be used when the event fires.
+ * @param {Function} fn       The function to execute
+ * @param {Object}   obj      An object to be passed along when the event fires
+ * @param {boolean}  bOverride If true, the obj passed in becomes the execution
+ *                            scope of the listener
+ * @class Subscriber
+ * @constructor
+ */
+YAHOO.util.Subscriber = function(fn, obj, bOverride) {
+
+    /**
+     * The callback that will be execute when the event fires
+     * @property fn
+     * @type function
+     */
+    this.fn = fn;
+
+    /**
+     * An optional custom object that will passed to the callback when
+     * the event fires
+     * @property obj
+     * @type object
+     */
+    this.obj = obj || null;
+
+    /**
+     * The default execution scope for the event listener is defined when the
+     * event is created (usually the object which contains the event).
+     * By setting override to true, the execution scope becomes the custom
+     * object passed in by the subscriber
+     * @property override
+     * @type boolean
+     */
+    this.override = (bOverride);
+};
+
+/**
+ * Returns true if the fn and obj match this objects properties.
+ * Used by the unsubscribe method to match the right subscriber.
+ *
+ * @method contains
+ * @param {Function} fn the function to execute
+ * @param {Object} obj an object to be passed along when the event fires
+ * @return {boolean} true if the supplied arguments match this
+ *                   subscriber's signature.
+ */
+YAHOO.util.Subscriber.prototype.contains = function(fn, obj) {
+    return (this.fn == fn && this.obj == obj);
+};
+
+/**
+ * @method toString
+ */
+YAHOO.util.Subscriber.prototype.toString = function() {
+    return "Subscriber { obj: " + (this.obj || "")  +
+           ", override: " +  (this.override || "no") + " }";
+};
+
+// The first instance of Event will win if it is loaded more than once.
+if (!YAHOO.util.Event) {
+
+/**
+ * The event utility provides functions to add and remove event listeners,
+ * event cleansing.  It also tries to automatically remove listeners it
+ * registers during the unload event.
+ * @namespace YAHOO.util
+ * @class Event
+ */
+    YAHOO.util.Event = function() {
+
+        /**
+         * True after the onload event has fired
+         * @property loadComplete
+         * @type boolean
+         * @private
+         */
+        var loadComplete =  false;
+
+        /**
+         * Cache of wrapped listeners
+         * @property listeners
+         * @type array
+         * @private
+         */
+        var listeners = [];
+
+        /**
+         * Listeners that will be attached during the onload event
+         * @property delayedListeners
+         * @type array
+         * @private
+         */
+        var delayedListeners = [];
+
+        /**
+         * User-defined unload function that will be fired before all events
+         * are detached
+         * @property unloadListeners
+         * @type array
+         * @private
+         */
+        var unloadListeners = [];
+
+        /**
+         * Cache of DOM0 event handlers to work around issues with DOM2 events
+         * in Safari
+         * @property legacyEvents
+         * @private
+         */
+        var legacyEvents = [];
+
+        /**
+         * Listener stack for DOM0 events
+         * @property legacyHandlers
+         * @private
+         */
+        var legacyHandlers = [];
+
+        /**
+         * The number of times to poll after window.onload.  This number is
+         * increased if additional late-bound handlers are requested after
+         * the page load.
+         * @property retryCount
+         * @private
+         */
+        var retryCount = 0;
+
+        /**
+         * onAvailable listeners
+         * @property onAvailStack
+         * @private
+         */
+        var onAvailStack = [];
+
+        /**
+         * Lookup table for legacy events
+         * @property legacyMap
+         * @private
+         */
+        var legacyMap = [];
+
+        /**
+         * Counter for auto id generation
+         * @property counter
+         * @private
+         */
+        var counter = 0;
+
+        return { // PREPROCESS
+
+            /**
+             * The number of times we should look for elements that are not
+             * in the DOM at the time the event is requested after the document
+             * has been loaded.  The default is 200@amp;50 ms, so it will poll
+             * for 10 seconds or until all outstanding handlers are bound
+             * (whichever comes first).
+             * @property POLL_RETRYS
+             * @type int
+             */
+            POLL_RETRYS: 200,
+
+            /**
+             * The poll interval in milliseconds
+             * @property POLL_INTERVAL
+             * @type int
+             */
+            POLL_INTERVAL: 50,
+
+            /**
+             * Element to bind, int constant
+             * @property EL
+             * @type int
+             */
+            EL: 0,
+
+            /**
+             * Type of event, int constant
+             * @property TYPE
+             * @type int
+             */
+            TYPE: 1,
+
+            /**
+             * Function to execute, int constant
+             * @property FN
+             * @type int
+             */
+            FN: 2,
+
+            /**
+             * Function wrapped for scope correction and cleanup, int constant
+             * @property WFN
+             * @type int
+             */
+            WFN: 3,
+
+            /**
+             * Object passed in by the user that will be returned as a
+             * parameter to the callback, int constant
+             * @property SCOPE
+             * @type int
+             */
+            SCOPE: 3,
+
+            /**
+             * Adjusted scope, either the element we are registering the event
+             * on or the custom object passed in by the listener, int constant
+             * @property ADJ_SCOPE
+             * @type int
+             */
+            ADJ_SCOPE: 4,
+
+            /**
+             * Safari detection is necessary to work around the preventDefault
+             * bug that makes it so you can't cancel a href click from the
+             * handler.  There is not a capabilities check we can use here.
+             * @property isSafari
+             * @private
+             */
+            isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),
+
+            /**
+             * IE detection needed to properly calculate pageX and pageY.
+             * capabilities checking didn't seem to work because another
+             * browser that does not provide the properties have the values
+             * calculated in a different manner than IE.
+             * @property isIE
+             * @private
+             */
+            isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) &&
+                    navigator.userAgent.match(/msie/gi)),
+
+            /**
+             * @method addDelayedListener
+             * @private
+             */
+            addDelayedListener: function(el, sType, fn, oScope, bOverride) {
+                delayedListeners[delayedListeners.length] =
+                    [el, sType, fn, oScope, bOverride];
+
+                // If this happens after the inital page load, we need to
+                // reset the poll counter so that we continue to search for
+                // the element for a fixed period of time.
+                if (loadComplete) {
+                    retryCount = this.POLL_RETRYS;
+                    this.startTimeout(0);
+                    // this._tryPreloadAttach();
+                }
+            },
+
+            /**
+             * @method startTimeout
+             * @private
+             */
+            startTimeout: function(interval) {
+                var i = (interval || interval === 0) ? interval : this.POLL_INTERVAL;
+                var self = this;
+                var callback = function() { self._tryPreloadAttach(); };
+                this.timeout = setTimeout(callback, i);
+            },
+
+            /**
+             * Executes the supplied callback when the item with the supplied
+             * id is found.  This is meant to be used to execute behavior as
+             * soon as possible as the page loads.  If you use this after the
+             * initial page load it will poll for a fixed time for the element.
+             * The number of times it will poll and the frequency are
+             * configurable.  By default it will poll for 10 seconds.
+             *
+             * @method onAvailable
+             *
+             * @param {string}   p_id the id of the element to look for.
+             * @param {function} p_fn what to execute when the element is found.
+             * @param {object}   p_obj an optional object to be passed back as
+             *                   a parameter to p_fn.
+             * @param {boolean}  p_override If set to true, p_fn will execute
+             *                   in the scope of p_obj
+             *
+             */
+            onAvailable: function(p_id, p_fn, p_obj, p_override) {
+                onAvailStack.push( { id:       p_id,
+                                     fn:       p_fn,
+                                     obj:      p_obj,
+                                     override: p_override } );
+
+                retryCount = this.POLL_RETRYS;
+                this.startTimeout(0);
+                // this._tryPreloadAttach();
+            },
+
+            /**
+             * Appends an event handler
+             *
+             * @method addListener
+             *
+             * @param {Object}   el        The html element to assign the
+             *                             event to
+             * @param {String}   sType     The type of event to append
+             * @param {Function} fn        The method the event invokes
+             * @param {Object}   oScope    An arbitrary object that will be
+             *                             passed as a parameter to the handler
+             * @param {boolean}  bOverride If true, the obj passed in becomes
+             *                             the execution scope of the listener
+             * @return {boolean} True if the action was successful or defered,
+             *                        false if one or more of the elements
+             *                        could not have the event bound to it.
+             */
+            addListener: function(el, sType, fn, oScope, bOverride) {
+
+                if (!fn || !fn.call) {
+                    // this.logger.debug("Error, function is not valid " + fn);
+                    return false;
+                }
+
+                // The el argument can be an array of elements or element ids.
+                if ( this._isValidCollection(el)) {
+                    var ok = true;
+                    for (var i=0,len=el.length; i<len; ++i) {
+                        ok = ( this.on(el[i],
+                                       sType,
+                                       fn,
+                                       oScope,
+                                       bOverride) && ok );
+                    }
+                    return ok;
+
+                } else if (typeof el == "string") {
+                    var oEl = this.getEl(el);
+                    // If the el argument is a string, we assume it is
+                    // actually the id of the element.  If the page is loaded
+                    // we convert el to the actual element, otherwise we
+                    // defer attaching the event until onload event fires
+
+                    // check to see if we need to delay hooking up the event
+                    // until after the page loads.
+                    if (loadComplete && oEl) {
+                        el = oEl;
+                    } else {
+                        // defer adding the event until onload fires
+                        this.addDelayedListener(el,
+                                                sType,
+                                                fn,
+                                                oScope,
+                                                bOverride);
+
+                        return true;
+                    }
+                }
+
+                // Element should be an html element or an array if we get
+                // here.
+                if (!el) {
+                    // this.logger.debug("unable to attach event " + sType);
+                    return false;
+                }
+
+                // we need to make sure we fire registered unload events
+                // prior to automatically unhooking them.  So we hang on to
+                // these instead of attaching them to the window and fire the
+                // handles explicitly during our one unload event.
+                if ("unload" == sType && oScope !== this) {
+                    unloadListeners[unloadListeners.length] =
+                            [el, sType, fn, oScope, bOverride];
+                    return true;
+                }
+
+                // this.logger.debug("Adding handler: " + el + ", " + sType);
+
+                // if the user chooses to override the scope, we use the custom
+                // object passed in, otherwise the executing scope will be the
+                // HTML element that the event is registered on
+                var scope = (bOverride) ? oScope : el;
+
+                // wrap the function so we can return the oScope object when
+                // the event fires;
+                var wrappedFn = function(e) {
+                        return fn.call(scope, YAHOO.util.Event.getEvent(e),
+                                oScope);
+                    };
+
+                var li = [el, sType, fn, wrappedFn, scope];
+                var index = listeners.length;
+                // cache the listener so we can try to automatically unload
+                listeners[index] = li;
+
+                if (this.useLegacyEvent(el, sType)) {
+                    var legacyIndex = this.getLegacyIndex(el, sType);
+
+                    // Add a new dom0 wrapper if one is not detected for this
+                    // element
+                    if ( legacyIndex == -1 ||
+                                el != legacyEvents[legacyIndex][0] ) {
+
+                        legacyIndex = legacyEvents.length;
+                        legacyMap[el.id + sType] = legacyIndex;
+
+                        // cache the signature for the DOM0 event, and
+                        // include the existing handler for the event, if any
+                        legacyEvents[legacyIndex] =
+                            [el, sType, el["on" + sType]];
+                        legacyHandlers[legacyIndex] = [];
+
+                        el["on" + sType] =
+                            function(e) {
+                                YAHOO.util.Event.fireLegacyEvent(
+                                    YAHOO.util.Event.getEvent(e), legacyIndex);
+                            };
+                    }
+
+                    // add a reference to the wrapped listener to our custom
+                    // stack of events
+                    //legacyHandlers[legacyIndex].push(index);
+                    legacyHandlers[legacyIndex].push(li);
+
+                // DOM2 Event model
+                } else if (el.addEventListener) {
+                    // this.logger.debug("adding DOM event: " + el.id +
+                    // ", " + sType);
+                    el.addEventListener(sType, wrappedFn, false);
+                // IE
+                } else if (el.attachEvent) {
+                    el.attachEvent("on" + sType, wrappedFn);
+                }
+
+                return true;
+
+            },
+
+            /**
+             * When using legacy events, the handler is routed to this object
+             * so we can fire our custom listener stack.
+             * @method fireLegacyEvent
+             * @private
+             */
+            fireLegacyEvent: function(e, legacyIndex) {
+                // this.logger.debug("fireLegacyEvent " + legacyIndex);
+                var ok = true;
+
+                var le = legacyHandlers[legacyIndex];
+                for (var i=0,len=le.length; i<len; ++i) {
+                    var li = le[i];
+                    if ( li && li[this.WFN] ) {
+                        var scope = li[this.ADJ_SCOPE];
+                        var ret = li[this.WFN].call(scope, e);
+                        ok = (ok && ret);
+                    }
+                }
+
+                return ok;
+            },
+
+            /**
+             * Returns the legacy event index that matches the supplied
+             * signature
+             * @method getLegacyIndex
+             * @private
+             */
+            getLegacyIndex: function(el, sType) {
+                var key = this.generateId(el) + sType;
+                if (typeof legacyMap[key] == "undefined") {
+                    return -1;
+                } else {
+                    return legacyMap[key];
+                }
+            },
+
+            /**
+             * Logic that determines when we should automatically use legacy
+             * events instead of DOM2 events.
+             * @method useLegacyEvent
+             * @private
+             */
+            useLegacyEvent: function(el, sType) {
+                if (!el.addEventListener && !el.attachEvent) {
+                    return true;
+                } else if (this.isSafari) {
+                    if ("click" == sType || "dblclick" == sType) {
+                        return true;
+                    }
+                }
+                return false;
+            },
+
+            /**
+             * Removes an event handler
+             *
+             * @method removeListener
+             *
+             * @param {Object} el the html element or the id of the element to
+             * assign the event to.
+             * @param {String} sType the type of event to remove
+             * @param {Function} fn the method the event invokes
+             * @return {boolean} true if the unbind was successful, false
+             * otherwise
+             */
+            removeListener: function(el, sType, fn, index) {
+
+                if (!fn || !fn.call) {
+                    // this.logger.debug("Error, function is not valid " + fn);
+                    return false;
+                }
+
+                var i, len;
+
+                // The el argument can be a string
+                if (typeof el == "string") {
+                    el = this.getEl(el);
+                // The el argument can be an array of elements or element ids.
+                } else if ( this._isValidCollection(el)) {
+                    var ok = true;
+                    for (i=0,len=el.length; i<len; ++i) {
+                        ok = ( this.removeListener(el[i], sType, fn) && ok );
+                    }
+                    return ok;
+                }
+
+
+                if ("unload" == sType) {
+
+                    for (i=0, len=unloadListeners.length; i<len; i++) {
+                        var li = unloadListeners[i];
+                        if (li &&
+                            li[0] == el &&
+                            li[1] == sType &&
+                            li[2] == fn) {
+                                unloadListeners.splice(i, 1);
+                                return true;
+                        }
+                    }
+
+                    return false;
+                }
+
+                var cacheItem = null;
+
+                //var index = arguments[3];
+
+                if ("undefined" == typeof index) {
+                    index = this._getCacheIndex(el, sType, fn);
+                }
+
+                if (index >= 0) {
+                    cacheItem = listeners[index];
+                }
+
+                if (!el || !cacheItem) {
+                    // this.logger.debug("cached listener not found");
+                    return false;
+                }
+
+                // this.logger.debug("Removing handler: " + el + ", " + sType);
+
+                if (this.useLegacyEvent(el, sType)) {
+                    var legacyIndex = this.getLegacyIndex(el, sType);
+                    var llist = legacyHandlers[legacyIndex];
+                    if (llist) {
+                        for (i=0, len=llist.length; i<len; ++i) {
+                            li = llist[i];
+                            if (li &&
+                                li[this.EL] == el &&
+                                li[this.TYPE] == sType &&
+                                li[this.FN] == fn) {
+                                    llist.splice(i, 1);
+                            }
+                        }
+                    }
+
+                } else if (el.removeEventListener) {
+                    el.removeEventListener(sType, cacheItem[this.WFN], false);
+                    // this.logger.debug("adsf");
+                } else if (el.detachEvent) {
+                    el.detachEvent("on" + sType, cacheItem[this.WFN]);
+                }
+
+                // removed the wrapped handler
+                delete listeners[index][this.WFN];
+                delete listeners[index][this.FN];
+                listeners.splice(index, 1);
+
+                return true;
+
+            },
+
+            /**
+             * Returns the event's target element
+             * @method getTarget
+             * @param {Event} ev the event
+             * @param {boolean} resolveTextNode when set to true the target's
+             *                  parent will be returned if the target is a
+             *                  text node.  @deprecated, the text node is
+             *                  now resolved automatically
+             * @return {HTMLElement} the event's target
+             */
+            getTarget: function(ev, resolveTextNode) {
+                var t = ev.target || ev.srcElement;
+                return this.resolveTextNode(t);
+            },
+
+            /**
+             * In some cases, some browsers will return a text node inside
+             * the actual element that was targeted.  This normalizes the
+             * return value for getTarget and getRelatedTarget.
+             * @method resolveTextNode
+             * @param {HTMLElement} node to resolve
+             * @return  the normized node
+             */
+            resolveTextNode: function(node) {
+                if (node && node.nodeName &&
+                        "#TEXT" == node.nodeName.toUpperCase()) {
+                    return node.parentNode;
+                } else {
+                    return node;
+                }
+            },
+
+            /**
+             * Returns the event's pageX
+             * @method getPageX
+             * @param {Event} ev the event
+             * @return {int} the event's pageX
+             */
+            getPageX: function(ev) {
+                var x = ev.pageX;
+                if (!x && 0 !== x) {
+                    x = ev.clientX || 0;
+
+                    if ( this.isIE ) {
+                        x += this._getScrollLeft();
+                    }
+                }
+
+                return x;
+            },
+
+            /**
+             * Returns the event's pageY
+             * @method getPageY
+             * @param {Event} ev the event
+             * @return {int} the event's pageY
+             */
+            getPageY: function(ev) {
+                var y = ev.pageY;
+                if (!y && 0 !== y) {
+                    y = ev.clientY || 0;
+
+                    if ( this.isIE ) {
+                        y += this._getScrollTop();
+                    }
+                }
+
+
+                return y;
+            },
+
+            /**
+             * Returns the pageX and pageY properties as an indexed array.
+             * @method getXY
+             * @type int[]
+             */
+            getXY: function(ev) {
+                return [this.getPageX(ev), this.getPageY(ev)];
+            },
+
+            /**
+             * Returns the event's related target
+             * @method getRelatedTarget
+             * @param {Event} ev the event
+             * @return {HTMLElement} the event's relatedTarget
+             */
+            getRelatedTarget: function(ev) {
+                var t = ev.relatedTarget;
+                if (!t) {
+                    if (ev.type == "mouseout") {
+                        t = ev.toElement;
+                    } else if (ev.type == "mouseover") {
+                        t = ev.fromElement;
+                    }
+                }
+
+                return this.resolveTextNode(t);
+            },
+
+            /**
+             * Returns the time of the event.  If the time is not included, the
+             * event is modified using the current time.
+             * @method getTime
+             * @param {Event} ev the event
+             * @return {Date} the time of the event
+             */
+            getTime: function(ev) {
+                if (!ev.time) {
+                    var t = new Date().getTime();
+                    try {
+                        ev.time = t;
+                    } catch(e) {
+                        // can't set the time property
+                        return t;
+                    }
+                }
+
+                return ev.time;
+            },
+
+            /**
+             * Convenience method for stopPropagation + preventDefault
+             * @method stopEvent
+             * @param {Event} ev the event
+             */
+            stopEvent: function(ev) {
+                this.stopPropagation(ev);
+                this.preventDefault(ev);
+            },
+
+            /**
+             * Stops event propagation
+             * @method stopPropagation
+             * @param {Event} ev the event
+             */
+            stopPropagation: function(ev) {
+                if (ev.stopPropagation) {
+                    ev.stopPropagation();
+                } else {
+                    ev.cancelBubble = true;
+                }
+            },
+
+            /**
+             * Prevents the default behavior of the event
+             * @method preventDefault
+             * @param {Event} ev the event
+             */
+            preventDefault: function(ev) {
+                if (ev.preventDefault) {
+                    ev.preventDefault();
+                } else {
+                    ev.returnValue = false;
+                }
+            },
+
+            /**
+             * Finds the event in the window object, the caller's arguments, or
+             * in the arguments of another method in the callstack.  This is
+             * executed automatically for events registered through the event
+             * manager, so the implementer should not normally need to execute
+             * this function at all.
+             * @method getEvent
+             * @param {Event} the event parameter from the handler
+             * @return {Event} the event
+             */
+            getEvent: function(e) {
+                var ev = e || window.event;
+
+                if (!ev) {
+                    var c = this.getEvent.caller;
+                    while (c) {
+                        ev = c.arguments[0];
+                        if (ev && Event == ev.constructor) {
+                            break;
+                        }
+                        c = c.caller;
+                    }
+                }
+
+                return ev;
+            },
+
+            /**
+             * Returns the charcode for an event
+             * @method getCharCode
+             * @param {Event} ev the event
+             * @return {int} the event's charCode
+             */
+            getCharCode: function(ev) {
+                return ev.charCode || ((ev.type == "keypress") ? ev.keyCode : 0);
+            },
+
+            /**
+             * Locating the saved event handler data by function ref
+             *
+             * @method _getCacheIndex
+             * @private
+             */
+            _getCacheIndex: function(el, sType, fn) {
+                for (var i=0,len=listeners.length; i<len; ++i) {
+                    var li = listeners[i];
+                    if ( li                 &&
+                         li[this.FN] == fn  &&
+                         li[this.EL] == el  &&
+                         li[this.TYPE] == sType ) {
+                        return i;
+                    }
+                }
+
+                return -1;
+            },
+
+            /**
+             * Generates an unique ID for the element if it does not already
+             * have one.
+             * @method generateId
+             * @param el the element
+             * @return {string} the id of the element
+             */
+            generateId: function(el) {
+                var id = el.id;
+
+                if (!id) {
+                    id = "yuievtautoid-" + counter;
+                    ++counter;
+                    el.id = id;
+                }
+
+                return id;
+            },
+
+
+            /**
+             * We want to be able to use getElementsByTagName as a collection
+             * to attach a group of events to.  Unfortunately, different
+             * browsers return different types of collections.  This function
+             * tests to determine if the object is array-like.  It will also
+             * fail if the object is an array, but is empty.
+             * @method _isValidCollection
+             * @param o the object to test
+             * @return {boolean} true if the object is array-like and populated
+             * @private
+             */
+            _isValidCollection: function(o) {
+                // this.logger.debug(o.constructor.toString())
+                // this.logger.debug(typeof o)
+
+                return ( o                    && // o is something
+                         o.length             && // o is indexed
+                         typeof o != "string" && // o is not a string
+                         !o.tagName           && // o is not an HTML element
+                         !o.alert             && // o is not a window
+                         typeof o[0] != "undefined" );
+
+            },
+
+            /**
+             * @private
+             * @property elCache
+             * DOM element cache
+             */
+            elCache: {},
+
+            /**
+             * We cache elements bound by id because when the unload event
+             * fires, we can no longer use document.getElementById
+             * @method getEl
+             * @private
+             */
+            getEl: function(id) {
+                return document.getElementById(id);
+            },
+
+            /**
+             * Clears the element cache
+             * @deprecated
+             * @private
+             */
+            clearCache: function() { },
+
+            /**
+             * hook up any deferred listeners
+             * @method _load
+             * @private
+             */
+            _load: function(e) {
+                loadComplete = true;
+                var EU = YAHOO.util.Event;
+                EU._simpleRemove(window, "load", EU._load);
+            },
+
+            /**
+             * Polling function that runs before the onload event fires,
+             * attempting to attach to DOM Nodes as soon as they are
+             * available
+             * @method _tryPreloadAttach
+             * @private
+             */
+            _tryPreloadAttach: function() {
+
+                if (this.locked) {
+                    return false;
+                }
+
+                this.locked = true;
+
+                // this.logger.debug("tryPreloadAttach");
+
+                // keep trying until after the page is loaded.  We need to
+                // check the page load state prior to trying to bind the
+                // elements so that we can be certain all elements have been
+                // tested appropriately
+                var tryAgain = !loadComplete;
+                if (!tryAgain) {
+                    tryAgain = (retryCount > 0);
+                }
+
+                // Delayed listeners
+                var stillDelayed = [];
+
+                for (var i=0,len=delayedListeners.length; i<len; ++i) {
+                    var d = delayedListeners[i];
+                    // There may be a race condition here, so we need to
+                    // verify the array element is usable.
+                    if (d) {
+
+                        // el will be null if document.getElementById did not
+                        // work
+                        var el = this.getEl(d[this.EL]);
+
+                        if (el) {
+                            // this.logger.debug("attaching: " + d[this.EL]);
+                            this.on(el, d[this.TYPE], d[this.FN],
+                                    d[this.SCOPE], d[this.ADJ_SCOPE]);
+                            delete delayedListeners[i];
+                        } else {
+                            stillDelayed.push(d);
+                        }
+                    }
+                }
+
+                delayedListeners = stillDelayed;
+
+                // onAvailable
+                var notAvail = [];
+                for (i=0,len=onAvailStack.length; i<len ; ++i) {
+                    var item = onAvailStack[i];
+                    if (item) {
+                        el = this.getEl(item.id);
+
+                        if (el) {
+                            var scope = (item.override) ? item.obj : el;
+                            item.fn.call(scope, item.obj);
+                            delete onAvailStack[i];
+                        } else {
+                            notAvail.push(item);
+                        }
+                    }
+                }
+
+                retryCount = (stillDelayed.length === 0 &&
+                                    notAvail.length === 0) ? 0 : retryCount - 1;
+
+                if (tryAgain) {
+                    this.startTimeout();
+                }
+
+                this.locked = false;
+
+                return true;
+
+            },
+
+            /**
+             * Removes all listeners attached to the given element via addListener.
+             * Optionally, the node's children can also be purged.
+             * Optionally, you can specify a specific type of event to remove.
+             * @method purgeElement
+             * @param {HTMLElement} el the element to purge
+             * @param {boolean} recurse recursively purge this element's children
+             * as well.  Use with caution.
+             * @param {string} sType optional type of listener to purge. If
+             * left out, all listeners will be removed
+             */
+            purgeElement: function(el, recurse, sType) {
+                var elListeners = this.getListeners(el, sType);
+                if (elListeners) {
+                    for (var i=0,len=elListeners.length; i<len ; ++i) {
+                        var l = elListeners[i];
+                        // can't use the index on the changing collection
+                        //this.removeListener(el, l.type, l.fn, l.index);
+                        this.removeListener(el, l.type, l.fn);
+                    }
+                }
+
+                if (recurse && el && el.childNodes) {
+                    for (i=0,len=el.childNodes.length; i<len ; ++i) {
+                        this.purgeElement(el.childNodes[i], recurse, sType);
+                    }
+                }
+            },
+
+            /**
+             * Returns all listeners attached to the given element via addListener.
+             * Optionally, you can specify a specific type of event to return.
+             * @method getListeners
+             * @param el {HTMLElement} the element to inspect
+             * @param sType {string} optional type of listener to return. If
+             * left out, all listeners will be returned
+             * @return {Object} the listener. Contains the following fields:
+             *    type:   (string)   the type of event
+             *    fn:     (function) the callback supplied to addListener
+             *    obj:    (object)   the custom object supplied to addListener
+             *    adjust: (boolean)  whether or not to adjust the default scope
+             *    index:  (int)      its position in the Event util listener cache
+             */
+            getListeners: function(el, sType) {
+                var elListeners = [];
+                if (listeners && listeners.length > 0) {
+                    for (var i=0,len=listeners.length; i<len ; ++i) {
+                        var l = listeners[i];
+                        if ( l  && l[this.EL] === el &&
+                                (!sType || sType === l[this.TYPE]) ) {
+                            elListeners.push({
+                                type:   l[this.TYPE],
+                                fn:     l[this.FN],
+                                obj:    l[this.SCOPE],
+                                adjust: l[this.ADJ_SCOPE],
+                                index:  i
+                            });
+                        }
+                    }
+                }
+
+                return (elListeners.length) ? elListeners : null;
+            },
+
+            /**
+             * Removes all listeners registered by pe.event.  Called
+             * automatically during the unload event.
+             * @method _unload
+             * @private
+             */
+            _unload: function(e) {
+
+                var EU = YAHOO.util.Event;
+
+                for (var i=0,len=unloadListeners.length; i<len; ++i) {
+                    var l = unloadListeners[i];
+                    if (l) {
+                        var scope = (l[EU.ADJ_SCOPE]) ? l[EU.SCOPE]: window;
+                        l[EU.FN].call(scope, EU.getEvent(e), l[EU.SCOPE] );
+                        delete unloadListeners[i];
+                        l=null;
+                    }
+                }
+
+                if (listeners && listeners.length > 0) {
+                    //for (i=0,len=listeners.length; i<len ; ++i) {
+                    var j = listeners.length;
+                    while (j) {
+                        var index = j-1;
+                        l = listeners[index];
+                        if (l) {
+                            EU.removeListener(l[EU.EL], l[EU.TYPE],
+                                    l[EU.FN], index);
+                        }
+
+                        l=null;
+
+                        j = j - 1;
+                    }
+
+                    EU.clearCache();
+                }
+
+                for (i=0,len=legacyEvents.length; i<len; ++i) {
+                    // dereference the element
+                    delete legacyEvents[i][0];
+                    // delete the array item
+                    delete legacyEvents[i];
+                }
+
+                EU._simpleRemove(window, "unload", EU._unload);
+
+            },
+
+            /**
+             * Returns scrollLeft
+             * @method _getScrollLeft
+             * @private
+             */
+            _getScrollLeft: function() {
+                return this._getScroll()[1];
+            },
+
+            /**
+             * Returns scrollTop
+             * @method _getScrollTop
+             * @private
+             */
+            _getScrollTop: function() {
+                return this._getScroll()[0];
+            },
+
+            /**
+             * Returns the scrollTop and scrollLeft.  Used to calculate the
+             * pageX and pageY in Internet Explorer
+             * @method _getScroll
+             * @private
+             */
+            _getScroll: function() {
+                var dd = document.documentElement, db = document.body;
+                if (dd && (dd.scrollTop || dd.scrollLeft)) {
+                    return [dd.scrollTop, dd.scrollLeft];
+                } else if (db) {
+                    return [db.scrollTop, db.scrollLeft];
+                } else {
+                    return [0, 0];
+                }
+            },
+
+            /**
+             * Adds a DOM event directly without the caching, cleanup, scope adj, etc
+             *
+             * @param el the elment to bind the handler to
+             * @param {string} sType the type of event handler
+             * @param {function} fn the callback to invoke
+             * @param {boolen} capture or bubble phase
+             * @private
+             */
+            _simpleAdd: function (el, sType, fn, capture) {
+                if (el.addEventListener) {
+                    el.addEventListener(sType, fn, (capture));
+                } else if (el.attachEvent) {
+                    el.attachEvent("on" + sType, fn);
+                }
+            },
+
+            /**
+             * Basic remove listener
+             *
+             * @param el the elment to bind the handler to
+             * @param {string} sType the type of event handler
+             * @param {function} fn the callback to invoke
+             * @param {boolen} capture or bubble phase
+             * @private
+             */
+            _simpleRemove: function (el, sType, fn, capture) {
+                if (el.removeEventListener) {
+                    el.removeEventListener(sType, fn, (capture));
+                } else if (el.detachEvent) {
+                    el.detachEvent("on" + sType, fn);
+                }
+            }
+        };
+
+    } ();
+
+    /**
+     * YAHOO.util.Event.on is an alias for addListener
+     * @method on
+     * @see addListener
+     */
+    YAHOO.util.Event.on = YAHOO.util.Event.addListener;
+
+    if (document && document.body) {
+        YAHOO.util.Event._load();
+    } else {
+        YAHOO.util.Event._simpleAdd(window, "load", YAHOO.util.Event._load);
+    }
+    YAHOO.util.Event._simpleAdd(window, "unload", YAHOO.util.Event._unload);
+    YAHOO.util.Event._tryPreloadAttach();
+}
+
Index: /branches/mobile/html/test/kakinaka/js/TaskNode.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/TaskNode.js	(revision 7219)
+++ /branches/mobile/html/test/kakinaka/js/TaskNode.js	(revision 7219)
@@ -0,0 +1,253 @@
+/**
+ * The check box marks a task complete.  It is a simulated form field 
+ * with three states ...
+ * 0=unchecked, 1=some children checked, 2=all children checked
+ * When a task is clicked, the state of the nodes and parent and children
+ * are updated, and this behavior cascades.
+ *
+ * @extends YAHOO.widget.TextNode
+ * @constructor
+ * @param oData    {object}  A string or object containing the data that will
+ *                           be used to render this node.
+ * @param oParent  {Node}    This node's parent node
+ * @param expanded {boolean} The initial expanded/collapsed state
+ * @param checked  {boolean} The initial checked/unchecked state
+ */
+YAHOO.widget.TaskNode = function(oData, oParent, expanded, checked) {
+
+    if (oData) { 
+        this.init(oData, oParent, expanded);
+        this.setUpLabel(oData);
+        if (checked && checked === true) {
+            this.check();
+        }
+
+        /*
+        if (!this.tree.checkClickEvent) {
+            this.tree.checkClickEvent = 
+                    new YAHOO.util.CustomEvent("checkclick", this.tree);
+        }
+        */
+    }
+
+    this.logger = new YAHOO.widget.LogWriter(this.toString());
+};
+
+YAHOO.widget.TaskNode.prototype = new YAHOO.widget.TextNode();
+
+/**
+ * True if checkstate is 1 (some children checked) or 2 (all children checked),
+ * false if 0.
+ * @type boolean
+ */
+YAHOO.widget.TaskNode.prototype.checked = false;
+
+/**
+ * checkState
+ * 0=unchecked, 1=some children checked, 2=all children checked
+ * @type int
+ */
+YAHOO.widget.TaskNode.prototype.checkState = 0;
+
+/**
+ * The id of the check element
+ * @type string
+ */
+YAHOO.widget.TaskNode.prototype.getCheckElId = function() { 
+    return "ygtvcheck" + this.index; 
+};
+
+/**
+ * Returns the check box element
+ * @return the check html element (img)
+ */
+YAHOO.widget.TaskNode.prototype.getCheckEl = function() { 
+    return document.getElementById(this.getCheckElId()); 
+};
+
+/**
+ * The style of the check element, derived from its current state
+ * @return {string} the css style for the current check state
+ */
+YAHOO.widget.TaskNode.prototype.getCheckStyle = function() { 
+    return "ygtvcheck" + this.checkState;
+};
+
+/**
+ * Returns the link that will invoke this node's check toggle
+ * @return {string} returns the link required to adjust the checkbox state
+ */
+YAHOO.widget.TaskNode.prototype.getCheckLink = function() { 
+    return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + 
+        this.index + ").checkClick()";
+};
+
+/**
+ * Invoked when the user clicks the check box
+ */
+YAHOO.widget.TaskNode.prototype.checkClick = function() { 
+    this.logger.log("previous checkstate: " + this.checkState);
+    if (this.checkState === 0) {
+        this.check();
+    } else {
+        this.uncheck();
+    }
+
+    // this.tree.checkClickEvent.fire(this);
+
+    this.onCheckClick();
+};
+
+/**
+ * Override to get the check click event
+ */
+YAHOO.widget.TaskNode.prototype.onCheckClick = function() { 
+    this.logger.log("check was clicked");
+}
+
+/**
+ * Refresh the state of this node's parent, and cascade up.
+ */
+YAHOO.widget.TaskNode.prototype.updateParent = function() { 
+    var p = this.parent;
+
+    if (!p || !p.updateParent) {
+        this.logger.log("Abort udpate parent: " + this.index);
+        return;
+    }
+
+    var somethingChecked = false;
+    var somethingNotChecked = false;
+
+    for (var i=0;i< p.children.length;++i) {
+        if (p.children[i].checked) {
+            somethingChecked = true;
+            // checkState will be 1 if the child node has unchecked children
+            if (p.children[i].checkState == 1) {
+                somethingNotChecked = true;
+            }
+        } else {
+            somethingNotChecked = true;
+        }
+    }
+
+    if (somethingChecked) {
+        p.setCheckState( (somethingNotChecked) ? 1 : 2 );
+    } else {
+        p.setCheckState(0);
+    }
+
+    p.updateCheckHtml();
+    p.updateParent();
+};
+
+/**
+ * If the node has been rendered, update the html to reflect the current
+ * state of the node.
+ */
+YAHOO.widget.TaskNode.prototype.updateCheckHtml = function() { 
+    if (this.parent && this.parent.childrenRendered) {
+        this.getCheckEl().className = this.getCheckStyle();
+    }
+};
+
+/**
+ * Updates the state.  The checked property is true if the state is 1 or 2
+ * 
+ * @param the new check state
+ */
+YAHOO.widget.TaskNode.prototype.setCheckState = function(state) { 
+    this.checkState = state;
+    this.checked = (state > 0);
+};
+
+/**
+ * Check this node
+ */
+YAHOO.widget.TaskNode.prototype.check = function() { 
+    this.logger.log("check");
+    this.setCheckState(2);
+    for (var i=0; i<this.children.length; ++i) {
+        this.children[i].check();
+    }
+    this.updateCheckHtml();
+    this.updateParent();
+};
+
+/**
+ * Uncheck this node
+ */
+YAHOO.widget.TaskNode.prototype.uncheck = function() { 
+    this.setCheckState(0);
+    for (var i=0; i<this.children.length; ++i) {
+        this.children[i].uncheck();
+    }
+    this.updateCheckHtml();
+    this.updateParent();
+};
+
+// Overrides YAHOO.widget.TextNode
+YAHOO.widget.TaskNode.prototype.getNodeHtml = function() { 
+    this.logger.log("Generating html");
+    var sb = new Array();
+
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';
+    sb[sb.length] = '<tr>';
+    
+    for (i=0;i<this.depth;++i) {
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';
+    }
+
+    sb[sb.length] = '<td';
+    sb[sb.length] = ' id="' + this.getToggleElId() + '"';
+    sb[sb.length] = ' class="' + this.getStyle() + '"';
+    if (this.hasChildren(true)) {
+        sb[sb.length] = ' onmouseover="this.className=';
+        sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+        sb[sb.length] = this.tree.id + '\',' + this.index +  ').getHoverStyle()"';
+        sb[sb.length] = ' onmouseout="this.className=';
+        sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+        sb[sb.length] = this.tree.id + '\',' + this.index +  ').getStyle()"';
+    }
+    sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">&#160;';
+    sb[sb.length] = '</td>';
+
+    // check box
+    sb[sb.length] = '<td';
+    sb[sb.length] = ' id="' + this.getCheckElId() + '"';
+    sb[sb.length] = ' class="' + this.getCheckStyle() + '"';
+    sb[sb.length] = ' onclick="javascript:' + this.getCheckLink() + '">';
+    sb[sb.length] = '&#160;</td>';
+    
+
+    sb[sb.length] = '<td>';
+    sb[sb.length] = '<a';
+    sb[sb.length] = ' id="' + this.labelElId + '"';
+    sb[sb.length] = ' class="' + this.labelStyle + '"';
+    sb[sb.length] = ' href="' + this.href + '"';
+    sb[sb.length] = ' target="' + this.target + '"';
+    if (this.hasChildren(true)) {
+        sb[sb.length] = ' onmouseover="document.getElementById(\'';
+        sb[sb.length] = this.getToggleElId() + '\').className=';
+        sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+        sb[sb.length] = this.tree.id + '\',' + this.index +  ').getHoverStyle()"';
+        sb[sb.length] = ' onmouseout="document.getElementById(\'';
+        sb[sb.length] = this.getToggleElId() + '\').className=';
+        sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+        sb[sb.length] = this.tree.id + '\',' + this.index +  ').getStyle()"';
+    }
+    sb[sb.length] = ' >';
+    sb[sb.length] = this.label;
+    sb[sb.length] = '</a>';
+    sb[sb.length] = '</td>';
+    sb[sb.length] = '</tr>';
+    sb[sb.length] = '</table>';
+
+    return sb.join("");
+
+};
+
+YAHOO.widget.TaskNode.prototype.toString = function() {
+    return "TaskNode (" + this.index + ") " + this.label;
+};
+
Index: /branches/mobile/html/test/kakinaka/js/key.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/key.js	(revision 7219)
+++ /branches/mobile/html/test/kakinaka/js/key.js	(revision 7219)
@@ -0,0 +1,34 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+YAHOO.util.Key = new function() {
+	// this.logger	= new ygLogger("ygEventUtil");
+	// DOM key constants 
+	this.DOM_VK_UNDEFINED               = 0x0;
+	this.DOM_VK_RIGHT_ALT               = 0x12;
+	this.DOM_VK_LEFT_ALT                = 0x12;
+	this.DOM_VK_LEFT_CONTROL            = 0x11;
+	this.DOM_VK_RIGHT_CONTROL           = 0x11;
+	this.DOM_VK_LEFT_SHIFT              = 0x10;
+	this.DOM_VK_RIGHT_SHIFT             = 0x10;
+	this.DOM_VK_META                    = 0x9D;
+	this.DOM_VK_BACK_SPACE              = 0x08;
+	this.DOM_VK_CAPS_LOCK               = 0x14;
+	this.DOM_VK_DELETE                  = 0x7F;
+	this.DOM_VK_END                     = 0x23;
+	this.DOM_VK_ENTER                   = 0x0D;
+	this.DOM_VK_ESCAPE                  = 0x1B;
+	this.DOM_VK_HOME                    = 0x24;
+	this.DOM_VK_NUM_LOCK                = 0x90;
+	this.DOM_VK_PAUSE                   = 0x13;
+	this.DOM_VK_PRINTSCREEN             = 0x9A;
+	this.DOM_VK_SCROLL_LOCK             = 0x91;
+	this.DOM_VK_SPACE                   = 0x20;
+	this.DOM_VK_TAB                     = 0x09;
+	this.DOM_VK_LEFT                    = 0x25;
+	this.DOM_VK_RIGHT                   = 0x27;
+	this.DOM_VK_UP                      = 0x26;
+	this.DOM_VK_DOWN                    = 0x28;
+	this.DOM_VK_PAGE_DOWN               = 0x22;
+	this.DOM_VK_PAGE_UP                 = 0x21;
+};
+
Index: /branches/mobile/html/test/kakinaka/js/dpSyntaxHighlighter.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/dpSyntaxHighlighter.js	(revision 7219)
+++ /branches/mobile/html/test/kakinaka/js/dpSyntaxHighlighter.js	(revision 7219)
@@ -0,0 +1,736 @@
+/**
+ * Code Syntax Highlighter.
+ * Version 1.2.0
+ * Copyright (C) 2004 Alex Gorbatchev.
+ * http://www.dreamprojections.com/syntaxhighlighter/
+ * 
+ * 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 
+ */
+
+//
+// create namespaces
+//
+var dp = {
+	sh :						// dp.sh
+	{
+			Utils	: {},		// dp.sh.Utils
+			Brushes	: {},		// dp.sh.Brushes
+			Strings : {}
+	},
+	Version : '1.2.0'
+};
+
+dp.sh.Strings = {
+	AboutDialog : '<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><div class="para title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</div><div class="para"><a href="http://www.dreamprojections.com/sh/?ref=about" target="_blank">http://www.dreamprojections.com/SyntaxHighlighter</a></div>&copy;2004-2005 Alex Gorbatchev. All right reserved.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>',
+	
+	// tools
+	ExpandCode : '+ expand code',
+	ViewPlain : 'view plain',
+	Print : '',
+	CopyToClipboard : '',
+	About : '',
+	
+	CopiedToClipboard : 'The code is in your clipboard now.'
+};
+
+dp.SyntaxHighlighter = dp.sh;
+
+//
+// Dialog and toolbar functions
+//
+
+dp.sh.Utils.Expand = function(sender)
+{
+	var table = sender;
+	var span = sender;
+
+	// find the span in which the text label and pipe contained so we can hide it
+	while(span != null && span.tagName != 'SPAN')
+		span = span.parentNode;
+
+	// find the table
+	while(table != null && table.tagName != 'TABLE')
+		table = table.parentNode;
+	
+	// remove the 'expand code' button
+	span.parentNode.removeChild(span);
+	
+	table.tBodies[0].className = 'show';
+	table.parentNode.style.height = '100%'; // containing div isn't getting updated properly when the TBODY is shown
+}
+
+// opens a new windows and puts the original unformatted source code inside.
+dp.sh.Utils.ViewSource = function(sender)
+{
+	var code = sender.parentNode.originalCode;
+	var wnd = window.open('', '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1');
+	
+	code = code.replace(/</g, '&lt;');
+	
+	wnd.document.write('<pre>' + code + '</pre>');
+	wnd.document.close();
+}
+
+// copies the original source code in to the clipboard (IE only)
+dp.sh.Utils.ToClipboard = function(sender)
+{
+	var code = sender.parentNode.originalCode;
+	
+	// This works only for IE. There's a way to make it work with Mozilla as well,
+	// but it requires security settings changed on the client, which isn't by
+	// default, so 99% of users won't have it working anyways.
+	if(window.clipboardData)
+	{
+		window.clipboardData.setData('text', code);
+		
+		alert(dp.sh.Strings.CopiedToClipboard);
+	}
+}
+
+// creates an invisible iframe, puts the original source code inside and prints it
+dp.sh.Utils.PrintSource = function(sender)
+{
+	var td		= sender.parentNode;
+	var code	= td.processedCode;
+	var iframe	= document.createElement('IFRAME');
+	var doc		= null;
+	var wnd		= 
+
+	// this hides the iframe
+	iframe.style.cssText = 'position:absolute; width:0px; height:0px; left:-5px; top:-5px;';
+	
+	td.appendChild(iframe);
+	
+	doc = iframe.contentWindow.document;
+	code = code.replace(/</g, '&lt;');
+	
+	doc.open();
+	doc.write('<pre>' + code + '</pre>');
+	doc.close();
+	
+	iframe.contentWindow.focus();
+	iframe.contentWindow.print();
+	
+	td.removeChild(iframe);
+}
+
+dp.sh.Utils.About = function()
+{
+	var wnd	= window.open('', '_blank', 'dialog,width=320,height=150,scrollbars=0');
+	var doc	= wnd.document;
+	
+	var styles = document.getElementsByTagName('style');
+	var links = document.getElementsByTagName('link');
+	
+	doc.write(dp.sh.Strings.AboutDialog.replace('{V}', dp.sh.Version));
+	
+	// copy over ALL the styles from the parent page
+	for(var i = 0; i < styles.length; i++)
+		doc.write('<style>' + styles[i].innerHTML + '</style>');
+
+	for(var i = 0; i < links.length; i++)
+		if(links[i].rel.toLowerCase() == 'stylesheet')
+			doc.write('<link type="text/css" rel="stylesheet" href="' + links[i].href + '"></link>');
+	
+	doc.close();
+	wnd.focus();
+}
+
+//
+// Match object
+//
+dp.sh.Match = function(value, index, css)
+{
+	this.value		= value;
+	this.index		= index;
+	this.length		= value.length;
+	this.css		= css;
+}
+
+//
+// Highlighter object
+//
+dp.sh.Highlighter = function()
+{
+	this.addGutter = true;
+	this.addControls = true;
+	this.collapse = false;
+	this.tabsToSpaces = true;
+}
+
+// static callback for the match sorting
+dp.sh.Highlighter.SortCallback = function(m1, m2)
+{
+	// sort matches by index first
+	if(m1.index < m2.index)
+		return -1;
+	else if(m1.index > m2.index)
+		return 1;
+	else
+	{
+		// if index is the same, sort by length
+		if(m1.length < m2.length)
+			return -1;
+		else if(m1.length > m2.length)
+			return 1;
+	}
+	return 0;
+}
+
+// gets a list of all matches for a given regular expression
+dp.sh.Highlighter.prototype.GetMatches = function(regex, css)
+{
+	var index = 0;
+	var match = null;
+
+	while((match = regex.exec(this.code)) != null)
+	{
+		this.matches[this.matches.length] = new dp.sh.Match(match[0], match.index, css);
+	}
+}
+
+dp.sh.Highlighter.prototype.AddBit = function(str, css)
+{
+	var span = document.createElement('span');
+	
+	str = str.replace(/&/g, '&amp;');
+	str = str.replace(/ /g, '&nbsp;');
+	str = str.replace(/</g, '&lt;');
+	str = str.replace(/\n/gm, '&nbsp;<br>');
+
+	// when adding a piece of code, check to see if it has line breaks in it 
+	// and if it does, wrap individual line breaks with span tags
+	if(css != null)
+	{
+		var regex = new RegExp('<br>', 'gi');
+		
+		if(regex.test(str))
+		{
+			var lines = str.split('&nbsp;<br>');
+			
+			str = '';
+			
+			for(var i = 0; i < lines.length; i++)
+			{
+				span			= document.createElement('SPAN');
+				span.className	= css;
+				span.innerHTML	= lines[i];
+				
+				this.div.appendChild(span);
+				
+				// don't add a <BR> for the last line
+				if(i + 1 < lines.length)
+					this.div.appendChild(document.createElement('BR'));
+			}
+		}
+		else
+		{
+			span.className = css;
+			span.innerHTML = str;
+			this.div.appendChild(span);
+		}
+	}
+	else
+	{
+		span.innerHTML = str;
+		this.div.appendChild(span);
+	}
+}
+
+// checks if one match is inside any other match
+dp.sh.Highlighter.prototype.IsInside = function(match)
+{
+	if(match == null || match.length == 0)
+		return;
+	
+	for(var i = 0; i < this.matches.length; i++)
+	{
+		var c = this.matches[i];
+		
+		if(c == null)
+			continue;
+		
+		if((match.index > c.index) && (match.index <= c.index + c.length))
+			return true;
+	}
+	
+	return false;
+}
+
+dp.sh.Highlighter.prototype.ProcessRegexList = function()
+{
+	for(var i = 0; i < this.regexList.length; i++)
+		this.GetMatches(this.regexList[i].regex, this.regexList[i].css);
+}
+
+dp.sh.Highlighter.prototype.ProcessSmartTabs = function(code)
+{
+	var lines	= code.split('\n');
+	var result	= '';
+	var tabSize	= 4;
+	var tab		= '\t';
+
+	// This function inserts specified amount of spaces in the string
+	// where a tab is while removing that given tab. 
+	function InsertSpaces(line, pos, count)
+	{
+		var left	= line.substr(0, pos);
+		var right	= line.substr(pos + 1, line.length);	// pos + 1 will get rid of the tab
+		var spaces	= '';
+		
+		for(var i = 0; i < count; i++)
+			spaces += ' ';
+		
+		return left + spaces + right;
+	}
+
+	// This function process one line for 'smart tabs'
+	function ProcessLine(line, tabSize)
+	{
+		if(line.indexOf(tab) == -1)
+			return line;
+
+		var pos = 0;
+
+		while((pos = line.indexOf(tab)) != -1)
+		{
+			// This is pretty much all there is to the 'smart tabs' logic.
+			// Based on the position within the line and size of a tab, 
+			// calculate the amount of spaces we need to insert.
+			var spaces = tabSize - pos % tabSize;
+			
+			line = InsertSpaces(line, pos, spaces);
+		}
+		
+		return line;
+	}
+
+	// Go through all the lines and do the 'smart tabs' magic.
+	for(var i = 0; i < lines.length; i++)
+		result += ProcessLine(lines[i], tabSize) + '\n';
+	
+	return result;
+}
+
+dp.sh.Highlighter.prototype.SwitchToTable = function()
+{
+	// Safari fix: for some reason lowercase <br> isn't getting picked up, even though 'i' is set
+	var lines	= this.div.innerHTML.split(/<BR>/gi);
+	var row		= null;
+	var cell	= null;
+	var tBody	= null;
+	var html	= '';
+	var pipe	= ' | ';
+
+	// creates an anchor to a utility
+	function UtilHref(util, text)
+	{
+		return '<a href="#" onclick="dp.sh.Utils.' + util + '(this); return false;">' + text + '</a>';
+	}
+	
+	tBody = document.createElement('TBODY');	// can be created and all others go to tBodies collection.
+
+	this.table.appendChild(tBody);
+		
+	if(this.addGutter == true)
+	{
+		row = tBody.insertRow(-1);
+		cell = row.insertCell(-1);
+		cell.className = 'tools-corner';
+	}
+
+	if(this.addControls == true)
+	{
+		var tHead = document.createElement('THEAD');	// controls will be placed in here
+		this.table.appendChild(tHead);
+
+		row = tHead.insertRow(-1);
+
+		// add corner if there's a gutter
+		if(this.addGutter == true)
+		{
+			cell = row.insertCell(-1);
+			cell.className = 'tools-corner';
+		}
+		
+		cell = row.insertCell(-1);
+		
+		// preserve some variables for the controls
+		cell.originalCode = this.originalCode;
+		cell.processedCode = this.code;
+		cell.className = 'tools';
+		
+		if(this.collapse == true)
+		{
+			tBody.className = 'hide';
+			cell.innerHTML += '<span><b>' + UtilHref('Expand', dp.sh.Strings.ExpandCode) + '</b>' + pipe + '</span>';
+		}
+
+		cell.innerHTML += UtilHref('ViewSource', dp.sh.Strings.ViewPlain) ;
+		
+		// IE has this clipboard object which is easy enough to use
+		if(window.clipboardData)
+			cell.innerHTML += pipe + UtilHref('ToClipboard', dp.sh.Strings.CopyToClipboard);
+	}
+
+	for(var i = 0; i < lines.length - 1; i++)
+	{
+		row = tBody.insertRow(-1);
+		
+		if(this.addGutter == true)
+		{
+			cell = row.insertCell(-1);
+			cell.className = 'gutter';
+			cell.innerHTML = i + 1;
+		}
+
+		cell = row.insertCell(-1);
+		cell.className = 'line' + (i % 2 + 1);		// uses .line1 and .line2 css styles for alternating lines
+		cell.innerHTML = lines[i];
+	}
+	
+	this.div.innerHTML	= '';
+}
+
+dp.sh.Highlighter.prototype.Highlight = function(code)
+{
+	function Trim(str)
+	{
+		return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
+	}
+	
+	function Chop(str)
+	{
+		return str.replace(/\n*$/, '').replace(/^\n*/, '');
+	}
+
+	function Unindent(str)
+	{
+		var lines = str.split('\n');
+		var indents = new Array();
+		var regex = new RegExp('^\\s*', 'g');
+		var min = 1000;
+
+		// go through every line and check for common number of indents
+		for(var i = 0; i < lines.length && min > 0; i++)
+		{
+			if(Trim(lines[i]).length == 0)
+				continue;
+				
+			var matches = regex.exec(lines[i]);
+
+			if(matches != null && matches.length > 0)
+				min = Math.min(matches[0].length, min);
+		}
+
+		// trim minimum common number of white space from the begining of every line
+		if(min > 0)
+			for(var i = 0; i < lines.length; i++)
+				lines[i] = lines[i].substr(min);
+
+		return lines.join('\n');
+	}
+	
+	// This function returns a portions of the string from pos1 to pos2 inclusive
+	function Copy(string, pos1, pos2)
+	{
+		return string.substr(pos1, pos2 - pos1);
+	}
+
+	var pos	= 0;
+	
+	this.originalCode = code;
+	this.code = Chop(Unindent(code));
+	this.div = document.createElement('DIV');
+	this.table = document.createElement('TABLE');
+	this.matches = new Array();
+
+	if(this.CssClass != null)
+		this.table.className = this.CssClass;
+
+	// replace tabs with spaces
+	if(this.tabsToSpaces == true)
+		this.code = this.ProcessSmartTabs(this.code);
+
+	this.table.border = 0;
+	this.table.cellSpacing = 0;
+	this.table.cellPadding = 0;
+
+	this.ProcessRegexList();	
+
+	// if no matches found, add entire code as plain text
+	if(this.matches.length == 0)
+	{
+		this.AddBit(this.code, null);
+		this.SwitchToTable();
+		return;
+	}
+
+	// sort the matches
+	this.matches = this.matches.sort(dp.sh.Highlighter.SortCallback);
+
+	// The following loop checks to see if any of the matches are inside
+	// of other matches. This process would get rid of highligting strings
+	// inside comments, keywords inside strings and so on.
+	for(var i = 0; i < this.matches.length; i++)
+		if(this.IsInside(this.matches[i]))
+			this.matches[i] = null;
+
+	// Finally, go through the final list of matches and pull the all
+	// together adding everything in between that isn't a match.
+	for(var i = 0; i < this.matches.length; i++)
+	{
+		var match = this.matches[i];
+
+		if(match == null || match.length == 0)
+			continue;
+		
+		this.AddBit(Copy(this.code, pos, match.index), null);
+		this.AddBit(match.value, match.css);
+		
+		pos = match.index + match.length;
+	}
+	
+	this.AddBit(this.code.substr(pos), null);
+
+	this.SwitchToTable();
+}
+
+dp.sh.Highlighter.prototype.GetKeywords = function(str) 
+{
+	return '\\b' + str.replace(/ /g, '\\b|\\b') + '\\b';
+}
+
+// highlightes all elements identified by name and gets source code from specified property
+dp.sh.HighlightAll = function(name, showGutter /* optional */, showControls /* optional */, collapseAll /* optional */)
+{
+	function FindValue()
+	{
+		var a = arguments;
+		
+		for(var i = 0; i < a.length; i++)
+		{
+			if(a[i] == null)
+				continue;
+				
+			if(typeof(a[i]) == 'string' && a[i] != '')
+				return a[i] + '';
+		
+			if(typeof(a[i]) == 'object' && a[i].value != '')
+				return a[i].value + '';
+		}
+		
+		return null;
+	}
+	
+	function IsOptionSet(value, list)
+	{
+		for(var i = 0; i < list.length; i++)
+			if(list[i] == value)
+				return true;
+		
+		return false;
+	}
+
+	var elements = document.getElementsByName(name);
+	var highlighter = null;
+	var registered = new Object();
+	var propertyName = 'value';
+	
+	// if no code blocks found, leave
+	if(elements == null)
+		return;
+
+	// register all brushes
+	for(var brush in dp.sh.Brushes)
+	{
+		var aliases = dp.sh.Brushes[brush].Aliases;
+		
+		if(aliases == null)
+			continue;
+		
+		for(var i = 0; i < aliases.length; i++)
+			registered[aliases[i]] = brush;
+	}
+
+	for(var i = 0; i < elements.length; i++)
+	{
+		var element = elements[i];
+		var options = FindValue(
+				element.attributes['class'], element.className, 
+				element.attributes['language'], element.language
+				);
+		var language = '';
+		
+		if(options == null)
+			continue;
+		
+		options = options.split(':');
+		
+		language = options[0].toLowerCase();
+		
+		if(registered[language] == null)
+			continue;
+		
+		// instantiate a brush
+		highlighter = new dp.sh.Brushes[registered[language]]();
+		
+		// hide the original element
+		element.style.display = 'none';
+
+		highlighter.addGutter = (showGutter == null) ? !IsOptionSet('nogutter', options) : showGutter;
+		highlighter.addControls = (showControls == null) ? !IsOptionSet('nocontrols', options) : showControls;
+		highlighter.collapse = (collapseAll == null) ? IsOptionSet('collapse', options) : collapseAll;
+		
+		highlighter.Highlight(element[propertyName]);
+
+		// place the result table inside a div
+		var div = document.createElement('DIV');
+		
+		div.className = 'dp-highlighter';
+		div.appendChild(highlighter.table);
+
+		element.parentNode.insertBefore(div, element);		
+	}	
+}
+
+
+dp.sh.Brushes.JScript = function()
+{
+	var keywords =	'abstract boolean break byte case catch char class const continue debugger ' +
+					'default delete do double else enum export extends false final finally float ' +
+					'for function goto if implements import in instanceof int interface long native ' +
+					'new null package private protected public return short static super switch ' +
+					'synchronized this throw throws transient true try typeof var void volatile while with';
+
+	this.regexList = [
+		{ regex: new RegExp('//.*$', 'gm'),							css: 'comment' },			// one line comments
+		{ regex: new RegExp('/\\*[\\s\\S]*?\\*/', 'g'),				css: 'comment' },			// multiline comments
+		{ regex: new RegExp('"(?:[^"\n]|[\"])*"', 'g'),				css: 'string' },			// double quoted strings
+		{ regex: new RegExp("'(?:[^'\n]|[\'])*'", 'g'),				css: 'string' },			// single quoted strings
+		{ regex: new RegExp('^\\s*#.*', 'gm'),						css: 'preprocessor' },		// preprocessor tags like #region and #endregion
+		{ regex: new RegExp(this.GetKeywords(keywords), 'gm'),		css: 'keyword' }			// keywords
+		];
+
+	this.CssClass = 'dp-c';
+}
+
+dp.sh.Brushes.JScript.prototype	= new dp.sh.Highlighter();
+dp.sh.Brushes.JScript.Aliases	= ['js', 'jscript', 'javascript'];
+
+
+dp.sh.Brushes.Php = function()
+{
+	var keywords =	'and or xor __FILE__ __LINE__ array as break case ' +
+					'cfunction class const continue declare default die do echo else ' +
+					'elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exit ' +
+					'extends for foreach function global if include include_once isset list ' +
+					'new old_function print require require_once return static switch unset use ' +
+					'var while __FUNCTION__ __CLASS__';
+
+	this.regexList = [
+		{ regex: new RegExp('//.*$', 'gm'),							css: 'comment' },			// one line comments
+		{ regex: new RegExp('/\\*[\\s\\S]*?\\*/', 'g'),				css: 'comment' },			// multiline comments
+		{ regex: new RegExp('"(?:[^"\n]|[\"])*"', 'g'),				css: 'string' },			// double quoted strings
+		{ regex: new RegExp("'(?:[^'\n]|[\'])*'", 'g'),				css: 'string' },			// single quoted strings
+		{ regex: new RegExp('\\$\\w+', 'g'),						css: 'vars' },				// variables
+		{ regex: new RegExp(this.GetKeywords(keywords), 'gm'),		css: 'keyword' }			// keyword
+		];
+
+	this.CssClass = 'dp-c';
+}
+
+dp.sh.Brushes.Php.prototype	= new dp.sh.Highlighter();
+dp.sh.Brushes.Php.Aliases	= ['php'];
+
+
+
+dp.sh.Brushes.Xml = function()
+{
+	this.CssClass = 'dp-xml';
+}
+
+dp.sh.Brushes.Xml.prototype	= new dp.sh.Highlighter();
+dp.sh.Brushes.Xml.Aliases	= ['xml', 'xhtml', 'xslt', 'html', 'xhtml'];
+
+dp.sh.Brushes.Xml.prototype.ProcessRegexList = function()
+{
+	function push(array, value)
+	{
+		array[array.length] = value;
+	}
+	
+	/* If only there was a way to get index of a group within a match, the whole XML
+	   could be matched with the expression looking something like that:
+	
+	   (<!\[CDATA\[\s*.*\s*\]\]>)
+	   | (<!--\s*.*\s*?-->)
+	   | (<)*(\w+)*\s*(\w+)\s*=\s*(".*?"|'.*?'|\w+)(/*>)*
+	   | (</?)(.*?)(/?>)
+	*/
+	var index	= 0;
+	var match	= null;
+	var regex	= null;
+
+	// Match CDATA in the following format <![ ... [ ... ]]>
+	// <\!\[[\w\s]*?\[(.|\s)*?\]\]>
+	this.GetMatches(new RegExp('<\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\]>', 'gm'), 'cdata');
+	
+	// Match comments
+	// <!--\s*.*\s*?-->
+	this.GetMatches(new RegExp('<!--\\s*.*\\s*?-->', 'gm'), 'comments');
+
+	// Match attributes and their values
+	// (\w+)\s*=\s*(".*?"|\'.*?\'|\w+)*
+	regex = new RegExp('([\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*', 'gm');
+	while((match = regex.exec(this.code)) != null)
+	{
+		push(this.matches, new dp.sh.Match(match[1], match.index, 'attribute'));
+	
+		// if xml is invalid and attribute has no property value, ignore it	
+		if(match[2] != undefined)
+		{
+			push(this.matches, new dp.sh.Match(match[2], match.index + match[0].indexOf(match[2]), 'attribute-value'));
+		}
+	}
+
+	// Match opening and closing tag brackets
+	// </*\?*(?!\!)|/*\?*>
+	this.GetMatches(new RegExp('</*\\?*(?!\\!)|/*\\?*>', 'gm'), 'tag');
+
+	// Match tag names
+	// </*\?*\s*(\w+)
+	regex = new RegExp('</*\\?*\\s*([\\w-\.]+)', 'gm');
+	while((match = regex.exec(this.code)) != null)
+	{
+		push(this.matches, new dp.sh.Match(match[1], match.index + match[0].indexOf(match[1]), 'tag-name'));
+	}
+}
+
+
+dp.sh.Brushes.CSS = function()
+{
+	var keywords =	'link over active visited';
+
+	this.regexList = [
+		{ regex: new RegExp('/\\*[\\s\\S]*?\\*/', 'g'),				css: 'comment' },			// multiline comments
+		{ regex: new RegExp('"(?:[^"\n]|[\"])*"', 'g'),				css: 'string' },			// double quoted strings
+		{ regex: new RegExp("'(?:[^'\n]|[\'])*'", 'g'),				css: 'string' },			// single quoted strings
+		{ regex: new RegExp('^\\s*#.*', 'gm'),						css: 'preprocessor' },		// preprocessor tags like #region and #endregion
+		{ regex: new RegExp(this.GetKeywords(keywords), 'gm'),		css: 'keyword' }			// keywords
+		];
+
+	this.CssClass = 'dp-c';
+}
+
+dp.sh.Brushes.CSS.prototype	= new dp.sh.Highlighter();
+dp.sh.Brushes.CSS.Aliases	= ['css'];
Index: /branches/mobile/html/test/kakinaka/js/json.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/json.js	(revision 7219)
+++ /branches/mobile/html/test/kakinaka/js/json.js	(revision 7219)
@@ -0,0 +1,150 @@
+/*
+Copyright (c) 2005 JSON.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The Software shall be used for Good, not Evil.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/*
+    The global object JSON contains two methods.
+
+    JSON.stringify(value) takes a JavaScript value and produces a JSON text.
+    The value must not be cyclical.
+
+    JSON.parse(text) takes a JSON text and produces a JavaScript value. It will
+    throw a 'JSONError' exception if there is an error.
+*/
+var JSON = {
+    copyright: '(c)2005 JSON.org',
+    license: 'http://www.crockford.com/JSON/license.html',
+/*
+    Stringify a JavaScript value, producing a JSON text.
+*/
+    stringify: function (v) {
+        var a = [];
+
+/*
+    Emit a string.
+*/
+        function e(s) {
+            a[a.length] = s;
+        }
+
+/*
+    Convert a value.
+*/
+        function g(x) {
+            var c, i, l, v;
+
+            switch (typeof x) {
+            case 'object':
+                if (x) {
+                    if (x instanceof Array) {
+                        e('[');
+                        l = a.length;
+                        for (i = 0; i < x.length; i += 1) {
+                            v = x[i];
+                            if (typeof v != 'undefined' &&
+                                    typeof v != 'function') {
+                                if (l < a.length) {
+                                    e(',');
+                                }
+                                g(v);
+                            }
+                        }
+                        e(']');
+                        return;
+                    } else if (typeof x.valueOf == 'function') {
+                        e('{');
+                        l = a.length;
+                        for (i in x) {
+                            v = x[i];
+                            if (typeof v != 'undefined' &&
+                                    typeof v != 'function' &&
+                                    (!v || typeof v != 'object' ||
+                                        typeof v.valueOf == 'function')) {
+                                if (l < a.length) {
+                                    e(',');
+                                }
+                                g(i);
+                                e(':');
+                                g(v);
+                            }
+                        }
+                        return e('}');
+                    }
+                }
+                e('null');
+                return;
+            case 'number':
+                e(isFinite(x) ? +x : 'null');
+                return;
+            case 'string':
+                l = x.length;
+                e('"');
+                for (i = 0; i < l; i += 1) {
+                    c = x.charAt(i);
+                    if (c >= ' ') {
+                        if (c == '\\' || c == '"') {
+                            e('\\');
+                        }
+                        e(c);
+                    } else {
+                        switch (c) {
+                        case '\b':
+                            e('\\b');
+                            break;
+                        case '\f':
+                            e('\\f');
+                            break;
+                        case '\n':
+                            e('\\n');
+                            break;
+                        case '\r':
+                            e('\\r');
+                            break;
+                        case '\t':
+                            e('\\t');
+                            break;
+                        default:
+                            c = c.charCodeAt();
+                            e('\\u00' + Math.floor(c / 16).toString(16) +
+                                (c % 16).toString(16));
+                        }
+                    }
+                }
+                e('"');
+                return;
+            case 'boolean':
+                e(String(x));
+                return;
+            default:
+                e('null');
+                return;
+            }
+        }
+        g(v);
+        return a.join('');
+    },
+/*
+    Parse a JSON text, producing a JavaScript value.
+*/
+    parse: function (text) {
+        return (/^(\s+|[,:{}\[\]]|"(\\["\\\/bfnrtu]|[^\x00-\x1f"\\]+)*"|-?\d+(\.\d*)?([eE][+-]?\d+)?|true|false|null)+$/.test(text)) &&
+            eval('(' + text + ')');
+    }
+};
Index: /branches/mobile/html/test/kakinaka/js/treeview/treeview-debug.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/treeview/treeview-debug.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/treeview/treeview-debug.js	(revision 7213)
@@ -0,0 +1,2010 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.11.3
+*/
+
+/**
+ * Contains the tree view state data and the root node.  This is an
+ * ordered tree; child nodes will be displayed in the order created, and
+ * there currently is no way to change this.
+ *
+ * @constructor
+ * @param {string|HTMLElement} id The id of the element, or the element
+ * itself that the tree will be inserted into.
+ */
+YAHOO.widget.TreeView = function(id) {
+    if (id) { this.init(id); }
+};
+
+/**
+ * Count of all nodes in all trees
+ * @type int
+ */
+YAHOO.widget.TreeView.nodeCount = 0;
+
+YAHOO.widget.TreeView.prototype = {
+
+    /**
+     * The id of tree container element
+     *
+     * @type String
+     */
+    id: null,
+
+    /**
+     * The host element for this tree
+     * @private
+     */
+    _el: null,
+
+     /**
+     * Flat collection of all nodes in this tree
+     *
+     * @type Node[]
+     * @private
+     */
+    _nodes: null,
+
+    /**
+     * We lock the tree control while waiting for the dynamic loader to return
+     *
+     * @type boolean
+     */
+    locked: false,
+
+    /**
+     * The animation to use for expanding children, if any
+     *
+     * @type string
+     * @private
+     */
+    _expandAnim: null,
+
+    /**
+     * The animation to use for collapsing children, if any
+     *
+     * @type string
+     * @private
+     */
+    _collapseAnim: null,
+
+    /**
+     * The current number of animations that are executing
+     *
+     * @type int
+     * @private
+     */
+    _animCount: 0,
+
+    /**
+     * The maximum number of animations to run at one time.
+     *
+     * @type int
+     */
+    maxAnim: 2,
+
+    /**
+     * Sets up the animation for expanding children
+     *
+     * @param {string} the type of animation (acceptable values defined in
+     * YAHOO.widget.TVAnim)
+     */
+    setExpandAnim: function(type) {
+        if (YAHOO.widget.TVAnim.isValid(type)) {
+            this._expandAnim = type;
+        }
+    },
+
+    /**
+     * Sets up the animation for collapsing children
+     *
+     * @param {string} the type of animation (acceptable values defined in
+     * YAHOO.widget.TVAnim)
+     */
+    setCollapseAnim: function(type) {
+        if (YAHOO.widget.TVAnim.isValid(type)) {
+            this._collapseAnim = type;
+        }
+    },
+
+    /**
+     * Perform the expand animation if configured, or just show the
+     * element if not configured or too many animations are in progress
+     *
+     * @param el {HTMLElement} the element to animate
+     * @return {boolean} true if animation could be invoked, false otherwise
+     */
+    animateExpand: function(el) {
+        this.logger.log("animating expand");
+
+        if (this._expandAnim && this._animCount < this.maxAnim) {
+            // this.locked = true;
+            var tree = this;
+            var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el,
+                            function() { tree.expandComplete(); });
+            if (a) {
+                ++this._animCount;
+                a.animate();
+            }
+
+            return true;
+        }
+
+        return false;
+    },
+
+    /**
+     * Perform the collapse animation if configured, or just show the
+     * element if not configured or too many animations are in progress
+     *
+     * @param el {HTMLElement} the element to animate
+     * @return {boolean} true if animation could be invoked, false otherwise
+     */
+    animateCollapse: function(el) {
+        this.logger.log("animating collapse");
+
+        if (this._collapseAnim && this._animCount < this.maxAnim) {
+            // this.locked = true;
+            var tree = this;
+            var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el,
+                            function() { tree.collapseComplete(); });
+            if (a) {
+                ++this._animCount;
+                a.animate();
+            }
+
+            return true;
+        }
+
+        return false;
+    },
+
+    /**
+     * Function executed when the expand animation completes
+     */
+    expandComplete: function() {
+        this.logger.log("expand complete: " + this.id);
+        --this._animCount;
+        // this.locked = false;
+    },
+
+    /**
+     * Function executed when the collapse animation completes
+     */
+    collapseComplete: function() {
+        this.logger.log("collapse complete: " + this.id);
+        --this._animCount;
+        // this.locked = false;
+    },
+
+    /**
+     * Initializes the tree
+     *
+     * @parm {string|HTMLElement} id the id of the element that will hold the tree
+     * @private
+     */
+    init: function(id) {
+
+        this.id = id;
+
+        if ("string" !== typeof id) {
+            this._el = id;
+            this.id = this.generateId(id);
+        }
+
+        this._nodes = [];
+
+        // store a global reference
+        YAHOO.widget.TreeView.trees[this.id] = this;
+
+        // Set up the root node
+        this.root = new YAHOO.widget.RootNode(this);
+
+        this.logger = new YAHOO.widget.LogWriter(this.toString());
+
+        this.logger.log("tree init: " + this.id);
+    },
+
+    /**
+     * Renders the tree boilerplate and visible nodes
+     */
+    draw: function() {
+        var html = this.root.getHtml();
+        this.getEl().innerHTML = html;
+        this.firstDraw = false;
+    },
+
+    /**
+     * Returns the tree's host element
+     * @return {HTMLElement} the host element
+     */
+    getEl: function() {
+        if (! this._el) {
+            this._el = document.getElementById(this.id);
+        }
+        return this._el;
+    },
+
+    /**
+     * Nodes register themselves with the tree instance when they are created.
+     *
+     * @param node {Node} the node to register
+     * @private
+     */
+    regNode: function(node) {
+        this._nodes[node.index] = node;
+    },
+
+    /**
+     * Returns the root node of this tree
+     *
+     * @return {Node} the root node
+     */
+    getRoot: function() {
+        return this.root;
+    },
+
+    /**
+     * Configures this tree to dynamically load all child data
+     *
+     * @param {function} fnDataLoader the function that will be called to get the data
+     * @param iconMode {int} configures the icon that is displayed when a dynamic
+     * load node is expanded the first time without children.  By default, the
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be
+     * displayed.
+     */
+    setDynamicLoad: function(fnDataLoader, iconMode) {
+        this.root.setDynamicLoad(fnDataLoader, iconMode);
+    },
+
+    /**
+     * Expands all child nodes.  Note: this conflicts with the "multiExpand"
+     * node property.  If expand all is called in a tree with nodes that
+     * do not allow multiple siblings to be displayed, only the last sibling
+     * will be expanded.
+     */
+    expandAll: function() {
+        if (!this.locked) {
+            this.root.expandAll();
+        }
+    },
+
+    /**
+     * Collapses all expanded child nodes in the entire tree.
+     */
+    collapseAll: function() {
+        if (!this.locked) {
+            this.root.collapseAll();
+        }
+    },
+
+    /**
+     * Returns a node in the tree that has the specified index (this index
+     * is created internally, so this function probably will only be used
+     * in html generated for a given node.)
+     *
+     * @param {int} nodeIndex the index of the node wanted
+     * @return {Node} the node with index=nodeIndex, null if no match
+     */
+    getNodeByIndex: function(nodeIndex) {
+        var n = this._nodes[nodeIndex];
+        return (n) ? n : null;
+    },
+
+    /**
+     * Returns a node that has a matching property and value in the data
+     * object that was passed into its constructor.
+     *
+     * @param {object} property the property to search (usually a string)
+     * @param {object} value the value we want to find (usuall an int or string)
+     * @return {Node} the matching node, null if no match
+     */
+    getNodeByProperty: function(property, value) {
+        for (var i in this._nodes) {
+            var n = this._nodes[i];
+            if (n.data && value == n.data[property]) {
+                return n;
+            }
+        }
+
+        return null;
+    },
+
+    /**
+     * Returns a collection of nodes that have a matching property
+     * and value in the data object that was passed into its constructor.
+     *
+     * @param {object} property the property to search (usually a string)
+     * @param {object} value the value we want to find (usuall an int or string)
+     * @return {Array} the matching collection of nodes, null if no match
+     */
+    getNodesByProperty: function(property, value) {
+        var values = [];
+        for (var i in this._nodes) {
+            var n = this._nodes[i];
+            if (n.data && value == n.data[property]) {
+                values.push(n);
+            }
+        }
+
+        return (values.length) ? values : null;
+    },
+
+    /**
+     * Removes the node and its children, and optionally refreshes the
+     * branch of the tree that was affected.
+     * @param {Node} The node to remove
+     * @param {boolean} autoRefresh automatically refreshes branch if true
+     * @return {boolean} False is there was a problem, true otherwise.
+     */
+    removeNode: function(node, autoRefresh) {
+
+        // Don't delete the root node
+        if (node.isRoot()) {
+            return false;
+        }
+
+        // Get the branch that we may need to refresh
+        var p = node.parent;
+        if (p.parent) {
+            p = p.parent;
+        }
+
+        // Delete the node and its children
+        this._deleteNode(node);
+
+        // Refresh the parent of the parent
+        if (autoRefresh && p && p.childrenRendered) {
+            p.refresh();
+        }
+
+        return true;
+    },
+
+    /**
+     * Deletes this nodes child collection, recursively.  Also collapses
+     * the node, and resets the dynamic load flag.  The primary use for
+     * this method is to purge a node and allow it to fetch its data
+     * dynamically again.
+     * @param {Node} node the node to purge
+     */
+    removeChildren: function(node) {
+        this.logger.log("Removing children for " + node);
+        while (node.children.length) {
+             this._deleteNode(node.children[0]);
+        }
+
+        node.childrenRendered = false;
+        node.dynamicLoadComplete = false;
+        // node.collapse();
+        node.expand();
+        node.collapse();
+    },
+
+    /**
+     * Deletes the node and recurses children
+     * @private
+     */
+    _deleteNode: function(node) {
+        // Remove all the child nodes first
+        this.removeChildren(node);
+
+        // Remove the node from the tree
+        this.popNode(node);
+    },
+
+    /**
+     * Removes the node from the tree, preserving the child collection
+     * to make it possible to insert the branch into another part of the
+     * tree, or another tree.
+     * @param {Node} the node to remove
+     */
+    popNode: function(node) {
+        var p = node.parent;
+
+        // Update the parent's collection of children
+        var a = [];
+
+        for (var i=0, len=p.children.length;i<len;++i) {
+            if (p.children[i] != node) {
+                a[a.length] = p.children[i];
+            }
+        }
+
+        p.children = a;
+
+        // reset the childrenRendered flag for the parent
+        p.childrenRendered = false;
+
+         // Update the sibling relationship
+        if (node.previousSibling) {
+            node.previousSibling.nextSibling = node.nextSibling;
+        }
+
+        if (node.nextSibling) {
+            node.nextSibling.previousSibling = node.previousSibling;
+        }
+
+        node.parent = null;
+        node.previousSibling = null;
+        node.nextSibling = null;
+        node.tree = null;
+
+        // Update the tree's node collection
+        delete this._nodes[node.index];
+    },
+
+
+    /**
+     * toString
+     * @return {string} string representation of the tree
+     */
+    toString: function() {
+        return "TreeView " + this.id;
+    },
+
+    /**
+     * private
+     */
+    generateId: function(el) {
+        var id = el.id;
+
+        if (!id) {
+            id = "yui-tv-auto-id-" + YAHOO.widget.TreeView.counter;
+            YAHOO.widget.TreeView.counter++;
+        }
+
+        return id;
+    },
+
+    /**
+     * Abstract method that is executed when a node is expanded
+     * @param node {Node} the node that was expanded
+     */
+    onExpand: function(node) { },
+
+    /**
+     * Abstract method that is executed when a node is collapsed
+     * @param node {Node} the node that was collapsed.
+     */
+    onCollapse: function(node) { }
+
+};
+
+/**
+ * Global cache of tree instances
+ *
+ * @type Array
+ * @private
+ */
+YAHOO.widget.TreeView.trees = [];
+
+/**
+ * @private
+ */
+YAHOO.widget.TreeView.counter = 0;
+
+/**
+ * Global method for getting a tree by its id.  Used in the generated
+ * tree html.
+ *
+ * @param treeId {String} the id of the tree instance
+ * @return {TreeView} the tree instance requested, null if not found.
+ */
+YAHOO.widget.TreeView.getTree = function(treeId) {
+    var t = YAHOO.widget.TreeView.trees[treeId];
+    return (t) ? t : null;
+};
+
+
+/**
+ * Global method for getting a node by its id.  Used in the generated
+ * tree html.
+ *
+ * @param treeId {String} the id of the tree instance
+ * @param nodeIndex {String} the index of the node to return
+ * @return {Node} the node instance requested, null if not found
+ */
+YAHOO.widget.TreeView.getNode = function(treeId, nodeIndex) {
+    var t = YAHOO.widget.TreeView.getTree(treeId);
+    return (t) ? t.getNodeByIndex(nodeIndex) : null;
+};
+
+/**
+ * Adds an event.  Replace with event manager when available
+ *
+ * @param el the elment to bind the handler to
+ * @param {string} sType the type of event handler
+ * @param {function} fn the callback to invoke
+ * @param {boolean} capture if true event is capture phase, bubble otherwise
+ */
+YAHOO.widget.TreeView.addHandler = function (el, sType, fn, capture) {
+    capture = (capture) ? true : false;
+    if (el.addEventListener) {
+        el.addEventListener(sType, fn, capture);
+    } else if (el.attachEvent) {
+        el.attachEvent("on" + sType, fn);
+    } else {
+        el["on" + sType] = fn;
+    }
+};
+
+/**
+ * Attempts to preload the images defined in the styles used to draw the tree by
+ * rendering off-screen elements that use the styles.
+ */
+YAHOO.widget.TreeView.preload = function(prefix) {
+    prefix = prefix || "ygtv";
+    var styles = ["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];
+
+    var sb = [];
+
+    for (var i = 0; i < styles.length; ++i) {
+        sb[sb.length] = '<span class="' + prefix + styles[i] + '">&#160;</span>';
+    }
+
+    var f = document.createElement("DIV");
+    var s = f.style;
+    s.position = "absolute";
+    s.top = "-1000px";
+    s.left = "-1000px";
+    f.innerHTML = sb.join("");
+
+    document.body.appendChild(f);
+};
+
+YAHOO.widget.TreeView.addHandler(window,
+                "load", YAHOO.widget.TreeView.preload);
+
+/**
+ * The base class for all tree nodes.  The node's presentation and behavior in
+ * response to mouse events is handled in Node subclasses.
+ *
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @constructor
+ */
+YAHOO.widget.Node = function(oData, oParent, expanded) {
+    if (oData) { this.init(oData, oParent, expanded); }
+};
+
+YAHOO.widget.Node.prototype = {
+
+    /**
+     * The index for this instance obtained from global counter in YAHOO.widget.TreeView.
+     *
+     * @type int
+     */
+    index: 0,
+
+    /**
+     * This node's child node collection.
+     *
+     * @type Node[]
+     */
+    children: null,
+
+    /**
+     * Tree instance this node is part of
+     *
+     * @type TreeView
+     */
+    tree: null,
+
+    /**
+     * The data linked to this node.  This can be any object or primitive
+     * value, and the data can be used in getNodeHtml().
+     *
+     * @type object
+     */
+    data: null,
+
+    /**
+     * Parent node
+     *
+     * @type Node
+     */
+    parent: null,
+
+    /**
+     * The depth of this node.  We start at -1 for the root node.
+     *
+     * @type int
+     */
+    depth: -1,
+
+    /**
+     * The href for the node's label.  If one is not specified, the href will
+     * be set so that it toggles the node.
+     *
+     * @type string
+     */
+    href: null,
+
+    /**
+     * The label href target, defaults to current window
+     *
+     * @type string
+     */
+    target: "_self",
+
+    /**
+     * The node's expanded/collapsed state
+     *
+     * @type boolean
+     */
+    expanded: false,
+
+    /**
+     * Can multiple children be expanded at once?
+     *
+     * @type boolean
+     */
+    multiExpand: true,
+
+    /**
+     * Should we render children for a collapsed node?  It is possible that the
+     * implementer will want to render the hidden data...  @todo verify that we
+     * need this, and implement it if we do.
+     *
+     * @type boolean
+     */
+    renderHidden: false,
+
+    /**
+     * This flag is set to true when the html is generated for this node's
+     * children, and set to false when new children are added.
+     * @type boolean
+     */
+    childrenRendered: false,
+
+    /**
+     * Dynamically loaded nodes only fetch the data the first time they are
+     * expanded.  This flag is set to true once the data has been fetched.
+     * @type boolean
+     */
+    dynamicLoadComplete: false,
+
+    /**
+     * This node's previous sibling
+     *
+     * @type Node
+     */
+    previousSibling: null,
+
+    /**
+     * This node's next sibling
+     *
+     * @type Node
+     */
+    nextSibling: null,
+
+    /**
+     * We can set the node up to call an external method to get the child
+     * data dynamically.
+     *
+     * @type boolean
+     * @private
+     */
+    _dynLoad: false,
+
+    /**
+     * Function to execute when we need to get this node's child data.
+     *
+     * @type function
+     */
+    dataLoader: null,
+
+    /**
+     * This is true for dynamically loading nodes while waiting for the
+     * callback to return.
+     *
+     * @type boolean
+     */
+    isLoading: false,
+
+    /**
+     * The toggle/branch icon will not show if this is set to false.  This
+     * could be useful if the implementer wants to have the child contain
+     * extra info about the parent, rather than an actual node.
+     *
+     * @type boolean
+     */
+    hasIcon: true,
+
+    /**
+     * Used to configure what happens when a dynamic load node is expanded
+     * and we discover that it does not have children.  By default, it is
+     * treated as if it still could have children (plus/minus icon).  Set
+     * iconMode to have it display like a leaf node instead.
+     * @type int
+     */
+    iconMode: 0,
+
+    /**
+     * The node type
+     * @private
+     */
+    _type: "Node",
+
+    /*
+    spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",
+    expandedText: "Expanded",
+    collapsedText: "Collapsed",
+    loadingText: "Loading",
+    */
+
+    /**
+     * Initializes this node, gets some of the properties from the parent
+     *
+     * @param oData {object} a string or object containing the data that will
+     * be used to render this node
+     * @param oParent {Node} this node's parent node
+     * @param expanded {boolean} the initial expanded/collapsed state
+     */
+    init: function(oData, oParent, expanded) {
+        this.data       = oData;
+        this.children   = [];
+        this.index      = YAHOO.widget.TreeView.nodeCount;
+        ++YAHOO.widget.TreeView.nodeCount;
+        this.expanded   = expanded;
+        this.logger     = new YAHOO.widget.LogWriter(this.toString());
+
+        // oParent should never be null except when we create the root node.
+        if (oParent) {
+            oParent.appendChild(this);
+        }
+    },
+
+    /**
+     * Certain properties for the node cannot be set until the parent
+     * is known. This is called after the node is inserted into a tree.
+     * the parent is also applied to this node's children in order to
+     * make it possible to move a branch from one tree to another.
+     * @param {Node} parentNode this node's parent node
+     * @return {boolean} true if the application was successful
+     */
+    applyParent: function(parentNode) {
+        if (!parentNode) {
+            return false;
+        }
+
+        this.tree   = parentNode.tree;
+        this.parent = parentNode;
+        this.depth  = parentNode.depth + 1;
+
+        if (! this.href) {
+            this.href = "javascript:" + this.getToggleLink();
+        }
+
+        if (! this.multiExpand) {
+            this.multiExpand = parentNode.multiExpand;
+        }
+
+        this.tree.regNode(this);
+        parentNode.childrenRendered = false;
+
+        // cascade update existing children
+        for (var i=0, len=this.children.length;i<len;++i) {
+            this.children[i].applyParent(this);
+        }
+
+        return true;
+    },
+
+    /**
+     * Appends a node to the child collection.
+     *
+     * @param childNode {Node} the new node
+     * @return {Node} the child node
+     * @private
+     */
+    appendChild: function(childNode) {
+        if (this.hasChildren()) {
+            var sib = this.children[this.children.length - 1];
+            sib.nextSibling = childNode;
+            childNode.previousSibling = sib;
+        }
+        this.children[this.children.length] = childNode;
+        childNode.applyParent(this);
+
+        return childNode;
+    },
+
+    /**
+     * Appends this node to the supplied node's child collection
+     * @param parentNode {Node} the node to append to.
+     * @return {Node} The appended node
+     */
+    appendTo: function(parentNode) {
+        return parentNode.appendChild(this);
+    },
+
+    /**
+    * Inserts this node before this supplied node
+    *
+    * @param node {Node} the node to insert this node before
+    * @return {Node} the inserted node
+    */
+    insertBefore: function(node) {
+        this.logger.log("insertBefore: " + node);
+        var p = node.parent;
+        if (p) {
+
+            if (this.tree) {
+                this.tree.popNode(this);
+            }
+
+            var refIndex = node.isChildOf(p);
+            this.logger.log(refIndex);
+            p.children.splice(refIndex, 0, this);
+            if (node.previousSibling) {
+                node.previousSibling.nextSibling = this;
+            }
+            this.previousSibling = node.previousSibling;
+            this.nextSibling = node;
+            node.previousSibling = this;
+
+            this.applyParent(p);
+        }
+
+        return this;
+    },
+
+    /**
+    * Inserts this node after the supplied node
+    *
+    * @param node {Node} the node to insert after
+    * @return {Node} the inserted node
+    */
+    insertAfter: function(node) {
+        this.logger.log("insertAfter: " + node);
+        var p = node.parent;
+        if (p) {
+
+            if (this.tree) {
+                this.tree.popNode(this);
+            }
+
+            var refIndex = node.isChildOf(p);
+            this.logger.log(refIndex);
+
+            if (!node.nextSibling) {
+                return this.appendTo(p);
+            }
+
+            p.children.splice(refIndex + 1, 0, this);
+
+            node.nextSibling.previousSibling = this;
+            this.previousSibling = node;
+            this.nextSibling = node.nextSibling;
+            node.nextSibling = this;
+
+            this.applyParent(p);
+        }
+
+        return this;
+    },
+
+    /**
+    * Returns true if the Node is a child of supplied Node
+    *
+    * @param parentNode {Node} the Node to check
+    * @return {boolean} The node index if this Node is a child of
+    *                   supplied Node, else -1.
+    * @private
+    */
+    isChildOf: function(parentNode) {
+        if (parentNode && parentNode.children) {
+            for (var i=0, len=parentNode.children.length; i<len ; ++i) {
+                if (parentNode.children[i] === this) {
+                    return i;
+                }
+            }
+        }
+
+        return -1;
+    },
+
+    /**
+     * Returns a node array of this node's siblings, null if none.
+     *
+     * @return Node[]
+     */
+    getSiblings: function() {
+        return this.parent.children;
+    },
+
+    /**
+     * Shows this node's children
+     */
+    showChildren: function() {
+        if (!this.tree.animateExpand(this.getChildrenEl())) {
+            if (this.hasChildren()) {
+                this.getChildrenEl().style.display = "";
+            }
+        }
+    },
+
+    /**
+     * Hides this node's children
+     */
+    hideChildren: function() {
+        this.logger.log("hiding " + this.index);
+
+        if (!this.tree.animateCollapse(this.getChildrenEl())) {
+            this.getChildrenEl().style.display = "none";
+        }
+    },
+
+    /**
+     * Returns the id for this node's container div
+     *
+     * @return {string} the element id
+     */
+    getElId: function() {
+        return "ygtv" + this.index;
+    },
+
+    /**
+     * Returns the id for this node's children div
+     *
+     * @return {string} the element id for this node's children div
+     */
+    getChildrenElId: function() {
+        return "ygtvc" + this.index;
+    },
+
+    /**
+     * Returns the id for this node's toggle element
+     *
+     * @return {string} the toggel element id
+     */
+    getToggleElId: function() {
+        return "ygtvt" + this.index;
+    },
+
+
+    /**
+     * Returns the id for this node's spacer image.  The spacer is positioned
+     * over the toggle and provides feedback for screen readers.
+     * @return {string} the id for the spacer image
+     */
+    /*
+    getSpacerId: function() {
+        return "ygtvspacer" + this.index;
+    },
+    */
+
+    /**
+     * Returns this node's container html element
+     * @return {HTMLElement} the container html element
+     */
+    getEl: function() {
+        return document.getElementById(this.getElId());
+    },
+
+    /**
+     * Returns the div that was generated for this node's children
+     * @return {HTMLElement} this node's children div
+     */
+    getChildrenEl: function() {
+        return document.getElementById(this.getChildrenElId());
+    },
+
+    /**
+     * Returns the element that is being used for this node's toggle.
+     * @return {HTMLElement} this node's toggle html element
+     */
+    getToggleEl: function() {
+        return document.getElementById(this.getToggleElId());
+    },
+
+    /**
+     * Returns the element that is being used for this node's spacer.
+     * @return {HTMLElement} this node's spacer html element
+     */
+    /*
+    getSpacer: function() {
+        return document.getElementById( this.getSpacerId() ) || {};
+    },
+    */
+
+    /*
+    getStateText: function() {
+        if (this.isLoading) {
+            return this.loadingText;
+        } else if (this.hasChildren(true)) {
+            if (this.expanded) {
+                return this.expandedText;
+            } else {
+                return this.collapsedText;
+            }
+        } else {
+            return "";
+        }
+    },
+    */
+
+    /**
+     * Generates the link that will invoke this node's toggle method
+     * @return {string} the javascript url for toggling this node
+     */
+    getToggleLink: function() {
+        return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," +
+            this.index + ").toggle()";
+    },
+
+    /**
+     * Hides this nodes children (creating them if necessary), changes the
+     * toggle style.
+     */
+    collapse: function() {
+        // Only collapse if currently expanded
+        if (!this.expanded) { return; }
+
+        // fire the collapse event handler
+        var ret = this.tree.onCollapse(this);
+
+        if ("undefined" != typeof ret && !ret) {
+            this.logger.log("Collapse was stopped by the event handler");
+            return;
+        }
+
+        if (!this.getEl()) {
+            this.expanded = false;
+            return;
+        }
+
+        // hide the child div
+        this.hideChildren();
+        this.expanded = false;
+
+        if (this.hasIcon) {
+            this.getToggleEl().className = this.getStyle();
+        }
+
+        // this.getSpacer().title = this.getStateText();
+
+    },
+
+    /**
+     * Shows this nodes children (creating them if necessary), changes the
+     * toggle style, and collapses its siblings if multiExpand is not set.
+     */
+    expand: function() {
+        // Only expand if currently collapsed.
+        if (this.expanded) { return; }
+
+        // fire the expand event handler
+        var ret = this.tree.onExpand(this);
+
+        if ("undefined" != typeof ret && !ret) {
+            this.logger.log("Expand was stopped by the event handler");
+            return;
+        }
+
+        if (!this.getEl()) {
+            this.expanded = true;
+            return;
+        }
+
+        if (! this.childrenRendered) {
+            this.logger.log("children not rendered yet");
+            this.getChildrenEl().innerHTML = this.renderChildren();
+        } else {
+            this.logger.log("CHILDREN RENDERED");
+        }
+
+        this.expanded = true;
+        if (this.hasIcon) {
+            this.getToggleEl().className = this.getStyle();
+        }
+
+        // this.getSpacer().title = this.getStateText();
+
+        // We do an extra check for children here because the lazy
+        // load feature can expose nodes that have no children.
+
+        // if (!this.hasChildren()) {
+        if (this.isLoading) {
+            this.expanded = false;
+            return;
+        }
+
+        if (! this.multiExpand) {
+            var sibs = this.getSiblings();
+            for (var i=0; i<sibs.length; ++i) {
+                if (sibs[i] != this && sibs[i].expanded) {
+                    sibs[i].collapse();
+                }
+            }
+        }
+
+        this.showChildren();
+    },
+
+    /**
+     * Returns the css style name for the toggle
+     *
+     * @return {string} the css class for this node's toggle
+     */
+    getStyle: function() {
+        // this.logger.log("No children, " + " isDyanmic: " + this.isDynamic() + " expanded: " + this.expanded);
+        if (this.isLoading) {
+            this.logger.log("returning the loading icon");
+            return "ygtvloading";
+        } else {
+            // location top or bottom, middle nodes also get the top style
+            var loc = (this.nextSibling) ? "t" : "l";
+
+            // type p=plus(expand), m=minus(collapase), n=none(no children)
+            var type = "n";
+            if (this.hasChildren(true) || (this.isDynamic() && !this.getIconMode())) {
+            // if (this.hasChildren(true)) {
+                type = (this.expanded) ? "m" : "p";
+            }
+
+            // this.logger.log("ygtv" + loc + type);
+            return "ygtv" + loc + type;
+        }
+    },
+
+    /**
+     * Returns the hover style for the icon
+     * @return {string} the css class hover state
+     */
+    getHoverStyle: function() {
+        var s = this.getStyle();
+        if (this.hasChildren(true) && !this.isLoading) {
+            s += "h";
+        }
+        return s;
+    },
+
+    /**
+     * Recursively expands all of this node's children.
+     */
+    expandAll: function() {
+        for (var i=0;i<this.children.length;++i) {
+            var c = this.children[i];
+            if (c.isDynamic()) {
+                alert("Not supported (lazy load + expand all)");
+                break;
+            } else if (! c.multiExpand) {
+                alert("Not supported (no multi-expand + expand all)");
+                break;
+            } else {
+                c.expand();
+                c.expandAll();
+            }
+        }
+    },
+
+    /**
+     * Recursively collapses all of this node's children.
+     */
+    collapseAll: function() {
+        for (var i=0;i<this.children.length;++i) {
+            this.children[i].collapse();
+            this.children[i].collapseAll();
+        }
+    },
+
+    /**
+     * Configures this node for dynamically obtaining the child data
+     * when the node is first expanded.  Calling it without the callback
+     * will turn off dynamic load for the node.
+     *
+     * @param fmDataLoader {function} the function that will be used to get the data.
+     * @param iconMode {int} configures the icon that is displayed when a dynamic
+     * load node is expanded the first time without children.  By default, the
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be
+     * displayed.
+     */
+    setDynamicLoad: function(fnDataLoader, iconMode) {
+        if (fnDataLoader) {
+            this.dataLoader = fnDataLoader;
+            this._dynLoad = true;
+        } else {
+            this.dataLoader = null;
+            this._dynLoad = false;
+        }
+
+        if (iconMode) {
+            this.iconMode = iconMode;
+        }
+    },
+
+    /**
+     * Evaluates if this node is the root node of the tree
+     *
+     * @return {boolean} true if this is the root node
+     */
+    isRoot: function() {
+        return (this == this.tree.root);
+    },
+
+    /**
+     * Evaluates if this node's children should be loaded dynamically.  Looks for
+     * the property both in this instance and the root node.  If the tree is
+     * defined to load all children dynamically, the data callback function is
+     * defined in the root node
+     *
+     * @return {boolean} true if this node's children are to be loaded dynamically
+     */
+    isDynamic: function() {
+        var lazy = (!this.isRoot() && (this._dynLoad || this.tree.root._dynLoad));
+        // this.logger.log("isDynamic: " + lazy);
+        return lazy;
+    },
+
+    getIconMode: function() {
+        return (this.iconMode || this.tree.root.iconMode);
+    },
+
+    /**
+     * Checks if this node has children.  If this node is lazy-loading and the
+     * children have not been rendered, we do not know whether or not there
+     * are actual children.  In most cases, we need to assume that there are
+     * children (for instance, the toggle needs to show the expandable
+     * presentation state).  In other times we want to know if there are rendered
+     * children.  For the latter, "checkForLazyLoad" should be false.
+     *
+     * @param checkForLazyLoad {boolean} should we check for unloaded children?
+     * @return {boolean} true if this has children or if it might and we are
+     * checking for this condition.
+     */
+    hasChildren: function(checkForLazyLoad) {
+        return ( this.children.length > 0 ||
+                (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );
+    },
+
+    /**
+     * Expands if node is collapsed, collapses otherwise.
+     */
+    toggle: function() {
+        if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {
+            if (this.expanded) { this.collapse(); } else { this.expand(); }
+        }
+    },
+
+    /**
+     * Returns the markup for this node and its children.
+     *
+     * @return {string} the markup for this node and its expanded children.
+     */
+    getHtml: function() {
+        var sb = [];
+        sb[sb.length] = '<div class="ygtvitem" id="' + this.getElId() + '">';
+        sb[sb.length] = this.getNodeHtml();
+        sb[sb.length] = this.getChildrenHtml();
+        sb[sb.length] = '</div>';
+        return sb.join("");
+    },
+
+    /**
+     * Called when first rendering the tree.  We always build the div that will
+     * contain this nodes children, but we don't render the children themselves
+     * unless this node is expanded.
+     *
+     * @return {string} the children container div html and any expanded children
+     * @private
+     */
+    getChildrenHtml: function() {
+
+        var sb = [];
+        sb[sb.length] = '<div class="ygtvchildren"';
+        sb[sb.length] = ' id="' + this.getChildrenElId() + '"';
+        if (!this.expanded) {
+            sb[sb.length] = ' style="display:none;"';
+        }
+        sb[sb.length] = '>';
+
+        // Don't render the actual child node HTML unless this node is expanded.
+        if ( (this.hasChildren(true) && this.expanded) ||
+                (this.renderHidden && !this.isDynamic()) ) {
+            sb[sb.length] = this.renderChildren();
+        }
+
+        sb[sb.length] = '</div>';
+
+        return sb.join("");
+    },
+
+    /**
+     * Generates the markup for the child nodes.  This is not done until the node
+     * is expanded.
+     *
+     * @return {string} the html for this node's children
+     * @private
+     */
+    renderChildren: function() {
+
+        this.logger.log("rendering children for " + this.index);
+
+        var node = this;
+
+        if (this.isDynamic() && !this.dynamicLoadComplete) {
+            this.isLoading = true;
+            this.tree.locked = true;
+
+            if (this.dataLoader) {
+                this.logger.log("Using dynamic loader defined for this node");
+
+                setTimeout(
+                    function() {
+                        node.dataLoader(node,
+                            function() {
+                                node.loadComplete();
+                            });
+                    }, 10);
+
+            } else if (this.tree.root.dataLoader) {
+                this.logger.log("Using the tree-level dynamic loader");
+
+                setTimeout(
+                    function() {
+                        node.tree.root.dataLoader(node,
+                            function() {
+                                node.loadComplete();
+                            });
+                    }, 10);
+
+            } else {
+                this.logger.log("no loader found");
+                return "Error: data loader not found or not specified.";
+            }
+
+            return "";
+
+        } else {
+            return this.completeRender();
+        }
+    },
+
+    /**
+     * Called when we know we have all the child data.
+     * @return {string} children html
+     */
+    completeRender: function() {
+        this.logger.log("completeRender: " + this.index + ", # of children: " + this.children.length);
+        var sb = [];
+
+        for (var i=0; i < this.children.length; ++i) {
+            this.children[i].childrenRendered = false;
+            sb[sb.length] = this.children[i].getHtml();
+        }
+
+        this.childrenRendered = true;
+
+        return sb.join("");
+    },
+
+    /**
+     * Load complete is the callback function we pass to the data provider
+     * in dynamic load situations.
+     */
+    loadComplete: function() {
+        this.logger.log("loadComplete: " + this.index);
+        this.getChildrenEl().innerHTML = this.completeRender();
+        this.dynamicLoadComplete = true;
+        this.isLoading = false;
+        this.expand();
+        this.tree.locked = false;
+    },
+
+    /**
+     * Returns this node's ancestor at the specified depth.
+     *
+     * @param {int} depth the depth of the ancestor.
+     * @return {Node} the ancestor
+     */
+    getAncestor: function(depth) {
+        if (depth >= this.depth || depth < 0)  {
+            this.logger.log("illegal getAncestor depth: " + depth);
+            return null;
+        }
+
+        var p = this.parent;
+
+        while (p.depth > depth) {
+            p = p.parent;
+        }
+
+        return p;
+    },
+
+    /**
+     * Returns the css class for the spacer at the specified depth for
+     * this node.  If this node's ancestor at the specified depth
+     * has a next sibling the presentation is different than if it
+     * does not have a next sibling
+     *
+     * @param {int} depth the depth of the ancestor.
+     * @return {string} the css class for the spacer
+     */
+    getDepthStyle: function(depth) {
+        return (this.getAncestor(depth).nextSibling) ?
+            "ygtvdepthcell" : "ygtvblankdepthcell";
+    },
+
+    /**
+     * Get the markup for the node.  This is designed to be overrided so that we can
+     * support different types of nodes.
+     *
+     * @return {string} The HTML that will render this node.
+     */
+    getNodeHtml: function() {
+        this.logger.log("Generating html");
+        return "";
+    },
+
+    /**
+     * Regenerates the html for this node and its children.  To be used when the
+     * node is expanded and new children have been added.
+     */
+    refresh: function() {
+        // this.loadComplete();
+        this.getChildrenEl().innerHTML = this.completeRender();
+
+        if (this.hasIcon) {
+            var el = this.getToggleEl();
+            if (el) {
+                el.className = this.getStyle();
+            }
+        }
+    },
+
+    /**
+     * toString
+     * @return {string} string representation of the node
+     */
+    toString: function() {
+        return "Node (" + this.index + ")";
+    }
+
+};
+
+/**
+ * A custom YAHOO.widget.Node that handles the unique nature of
+ * the virtual, presentationless root node.
+ *
+ * @extends YAHOO.widget.Node
+ * @constructor
+ */
+YAHOO.widget.RootNode = function(oTree) {
+	// Initialize the node with null params.  The root node is a
+	// special case where the node has no presentation.  So we have
+	// to alter the standard properties a bit.
+	this.init(null, null, true);
+
+	/**
+	 * For the root node, we get the tree reference from as a param
+	 * to the constructor instead of from the parent element.
+	 *
+	 * @type TreeView
+	 */
+	this.tree = oTree;
+};
+
+YAHOO.widget.RootNode.prototype = new YAHOO.widget.Node();
+
+// overrides YAHOO.widget.Node
+YAHOO.widget.RootNode.prototype.getNodeHtml = function() {
+	return "";
+};
+
+YAHOO.widget.RootNode.prototype.toString = function() {
+    return "RootNode";
+};
+
+YAHOO.widget.RootNode.prototype.loadComplete = function() {
+    this.tree.draw();
+};
+/**
+ * The default node presentation.  The first parameter should be
+ * either a string that will be used as the node's label, or an object
+ * that has a string propery called label.  By default, the clicking the
+ * label will toggle the expanded/collapsed state of the node.  By
+ * changing the href property of the instance, this behavior can be
+ * changed so that the label will go to the specified href.
+ *
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ */
+YAHOO.widget.TextNode = function(oData, oParent, expanded) {
+    // this.type = "TextNode";
+
+    if (oData) {
+        this.init(oData, oParent, expanded);
+        this.setUpLabel(oData);
+    }
+
+    /**
+     * @private
+     */
+    this.logger     = new YAHOO.widget.LogWriter(this.toString());
+};
+
+YAHOO.widget.TextNode.prototype = new YAHOO.widget.Node();
+
+/**
+ * The CSS class for the label href.  Defaults to ygtvlabel, but can be
+ * overridden to provide a custom presentation for a specific node.
+ *
+ * @type string
+ */
+YAHOO.widget.TextNode.prototype.labelStyle = "ygtvlabel";
+
+/**
+ * The derived element id of the label for this node
+ *
+ * @type string
+ */
+YAHOO.widget.TextNode.prototype.labelElId = null;
+
+/**
+ * The text for the label.  It is assumed that the oData parameter will
+ * either be a string that will be used as the label, or an object that
+ * has a property called "label" that we will use.
+ *
+ * @type string
+ */
+YAHOO.widget.TextNode.prototype.label = null;
+
+/**
+ * Sets up the node label
+ *
+ * @param oData string containing the label, or an object with a label property
+ */
+YAHOO.widget.TextNode.prototype.setUpLabel = function(oData) {
+    if (typeof oData == "string") {
+        oData = { label: oData };
+    }
+    this.label = oData.label;
+
+    // update the link
+    if (oData.href) {
+        this.href = oData.href;
+    }
+
+    // set the target
+    if (oData.target) {
+        this.target = oData.target;
+    }
+
+    if (oData.style) {
+        this.labelStyle = oData.style;
+    }
+
+    this.labelElId = "ygtvlabelel" + this.index;
+};
+
+/**
+ * Returns the label element
+ *
+ * @return {object} the element
+ */
+YAHOO.widget.TextNode.prototype.getLabelEl = function() {
+    return document.getElementById(this.labelElId);
+};
+
+// overrides YAHOO.widget.Node
+YAHOO.widget.TextNode.prototype.getNodeHtml = function() {
+    this.logger.log("Generating html");
+    var sb = [];
+
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';
+    sb[sb.length] = '<tr>';
+
+    for (i=0;i<this.depth;++i) {
+        // sb[sb.length] = '<td class="ygtvdepthcell">&#160;</td>';
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';
+    }
+
+    var getNode = 'YAHOO.widget.TreeView.getNode(\'' +
+                    this.tree.id + '\',' + this.index + ')';
+
+    sb[sb.length] = '<td';
+    // sb[sb.length] = ' onselectstart="return false"';
+    sb[sb.length] = ' id="' + this.getToggleElId() + '"';
+    sb[sb.length] = ' class="' + this.getStyle() + '"';
+    if (this.hasChildren(true)) {
+        sb[sb.length] = ' onmouseover="this.className=';
+        sb[sb.length] = getNode + '.getHoverStyle()"';
+        sb[sb.length] = ' onmouseout="this.className=';
+        sb[sb.length] = getNode + '.getStyle()"';
+    }
+    sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">';
+
+    /*
+    sb[sb.length] = '<img id="' + this.getSpacerId() + '"';
+    sb[sb.length] = ' alt=""';
+    sb[sb.length] = ' tabindex=0';
+    sb[sb.length] = ' src="' + this.spacerPath + '"';
+    sb[sb.length] = ' title="' + this.getStateText() + '"';
+    sb[sb.length] = ' class="ygtvspacer"';
+    // sb[sb.length] = ' onkeypress="return ' + getNode + '".onKeyPress()"';
+    sb[sb.length] = ' />';
+    */
+
+    sb[sb.length] = '&#160;';
+
+    sb[sb.length] = '</td>';
+    sb[sb.length] = '<td>';
+    sb[sb.length] = '<a';
+    sb[sb.length] = ' id="' + this.labelElId + '"';
+    sb[sb.length] = ' class="' + this.labelStyle + '"';
+    sb[sb.length] = ' href="' + this.href + '"';
+    sb[sb.length] = ' target="' + this.target + '"';
+    sb[sb.length] = ' onclick="return ' + getNode + '.onLabelClick(' + getNode +')"';
+    if (this.hasChildren(true)) {
+        sb[sb.length] = ' onmouseover="document.getElementById(\'';
+        sb[sb.length] = this.getToggleElId() + '\').className=';
+        sb[sb.length] = getNode + '.getHoverStyle()"';
+        sb[sb.length] = ' onmouseout="document.getElementById(\'';
+        sb[sb.length] = this.getToggleElId() + '\').className=';
+        sb[sb.length] = getNode + '.getStyle()"';
+    }
+    sb[sb.length] = ' >';
+    sb[sb.length] = this.label;
+    sb[sb.length] = '</a>';
+    sb[sb.length] = '</td>';
+    sb[sb.length] = '</tr>';
+    sb[sb.length] = '</table>';
+
+    return sb.join("");
+};
+
+
+/**
+ * Executed when the label is clicked
+ * @param me {Node} this node
+ * @scope the anchor tag clicked
+ * @return false to cancel the anchor click
+ */
+YAHOO.widget.TextNode.prototype.onLabelClick = function(me) {
+    me.logger.log("onLabelClick " + this.label);
+    //return true;
+};
+
+YAHOO.widget.TextNode.prototype.toString = function() {
+    return "TextNode (" + this.index + ") " + this.label;
+};
+
+/**
+ * A menu-specific implementation that differs from TextNode in that only
+ * one sibling can be expanded at a time.
+ * @extends YAHOO.widget.TextNode
+ * @constructor
+ */
+YAHOO.widget.MenuNode = function(oData, oParent, expanded) {
+	if (oData) {
+		this.init(oData, oParent, expanded);
+		this.setUpLabel(oData);
+	}
+
+    /**
+     * Menus usually allow only one branch to be open at a time.
+     * @type boolean
+     */
+	this.multiExpand = false;
+
+    /**
+     * @private
+     */
+    this.logger     = new YAHOO.widget.LogWriter(this.toString());
+
+};
+
+YAHOO.widget.MenuNode.prototype = new YAHOO.widget.TextNode();
+
+YAHOO.widget.MenuNode.prototype.toString = function() {
+    return "MenuNode (" + this.index + ") " + this.label;
+};
+
+/**
+ * This implementation takes either a string or object for the
+ * oData argument.  If is it a string, we will use it for the display
+ * of this node (and it can contain any html code).  If the parameter
+ * is an object, we look for a parameter called "html" that will be
+ * used for this node's display.
+ *
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @param hasIcon {boolean} specifies whether or not leaf nodes should
+ * have an icon
+ */
+YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {
+    if (oData) {
+        this.init(oData, oParent, expanded);
+        this.initContent(oData, hasIcon);
+    }
+};
+
+YAHOO.widget.HTMLNode.prototype = new YAHOO.widget.Node();
+
+/**
+ * The CSS class for the html content container.  Defaults to ygtvhtml, but
+ * can be overridden to provide a custom presentation for a specific node.
+ *
+ * @type string
+ */
+YAHOO.widget.HTMLNode.prototype.contentStyle = "ygtvhtml";
+
+/**
+ * The generated id that will contain the data passed in by the implementer.
+ *
+ * @type string
+ */
+YAHOO.widget.HTMLNode.prototype.contentElId = null;
+
+/**
+ * The HTML content to use for this node's display
+ *
+ * @type string
+ */
+YAHOO.widget.HTMLNode.prototype.content = null;
+
+/**
+ * Sets up the node label
+ *
+ * @param {object} An html string or object containing an html property
+ * @param {boolean} hasIcon determines if the node will be rendered with an
+ * icon or not
+ */
+YAHOO.widget.HTMLNode.prototype.initContent = function(oData, hasIcon) {
+    if (typeof oData == "string") {
+        oData = { html: oData };
+    }
+
+    this.html = oData.html;
+    this.contentElId = "ygtvcontentel" + this.index;
+    this.hasIcon = hasIcon;
+
+    /**
+     * @private
+     */
+    this.logger = new YAHOO.widget.LogWriter(this.toString());
+};
+
+/**
+ * Returns the outer html element for this node's content
+ *
+ * @return {HTMLElement} the element
+ */
+YAHOO.widget.HTMLNode.prototype.getContentEl = function() {
+    return document.getElementById(this.contentElId);
+};
+
+// overrides YAHOO.widget.Node
+YAHOO.widget.HTMLNode.prototype.getNodeHtml = function() {
+    this.logger.log("Generating html");
+    var sb = [];
+
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';
+    sb[sb.length] = '<tr>';
+
+    for (i=0;i<this.depth;++i) {
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';
+    }
+
+    if (this.hasIcon) {
+        sb[sb.length] = '<td';
+        sb[sb.length] = ' id="' + this.getToggleElId() + '"';
+        sb[sb.length] = ' class="' + this.getStyle() + '"';
+        sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '"';
+        if (this.hasChildren(true)) {
+            sb[sb.length] = ' onmouseover="this.className=';
+            sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+            sb[sb.length] = this.tree.id + '\',' + this.index +  ').getHoverStyle()"';
+            sb[sb.length] = ' onmouseout="this.className=';
+            sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+            sb[sb.length] = this.tree.id + '\',' + this.index +  ').getStyle()"';
+        }
+        sb[sb.length] = '>&#160;</td>';
+    }
+
+    sb[sb.length] = '<td';
+    sb[sb.length] = ' id="' + this.contentElId + '"';
+    sb[sb.length] = ' class="' + this.contentStyle + '"';
+    sb[sb.length] = ' >';
+    sb[sb.length] = this.html;
+    sb[sb.length] = '</td>';
+    sb[sb.length] = '</tr>';
+    sb[sb.length] = '</table>';
+
+    return sb.join("");
+};
+
+YAHOO.widget.HTMLNode.prototype.toString = function() {
+    return "HTMLNode (" + this.index + ")";
+};
+
+/**
+ * A static factory class for tree view expand/collapse animations
+ *
+ * @constructor
+ */
+YAHOO.widget.TVAnim = function() {
+    return {
+        /**
+         * Constant for the fade in animation
+         *
+         * @type string
+         */
+        FADE_IN: "TVFadeIn",
+
+        /**
+         * Constant for the fade out animation
+         *
+         * @type string
+         */
+        FADE_OUT: "TVFadeOut",
+
+        /**
+         * Returns a ygAnim instance of the given type
+         *
+         * @param type {string} the type of animation
+         * @param el {HTMLElement} the element to element (probably the children div)
+         * @param callback {function} function to invoke when the animation is done.
+         * @return {YAHOO.util.Animation} the animation instance
+         */
+        getAnim: function(type, el, callback) {
+            if (YAHOO.widget[type]) {
+                return new YAHOO.widget[type](el, callback);
+            } else {
+                return null;
+            }
+        },
+
+        /**
+         * Returns true if the specified animation class is available
+         *
+         * @param type {string} the type of animation
+         * @return {boolean} true if valid, false if not
+         */
+        isValid: function(type) {
+            return (YAHOO.widget[type]);
+        }
+    };
+} ();
+
+/**
+ * A 1/2 second fade-in animation.
+ *
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeIn = function(el, callback) {
+    /**
+     * The element to animate
+     * @type HTMLElement
+     */
+    this.el = el;
+
+    /**
+     * the callback to invoke when the animation is complete
+     *
+     * @type function
+     */
+    this.callback = callback;
+
+    /**
+     * @private
+     */
+    this.logger = new YAHOO.widget.LogWriter(this.toString());
+};
+
+/**
+ * Performs the animation
+ */
+YAHOO.widget.TVFadeIn.prototype = {
+    animate: function() {
+        var tvanim = this;
+
+        var s = this.el.style;
+        s.opacity = 0.1;
+        s.filter = "alpha(opacity=10)";
+        s.display = "";
+
+        // var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;
+        var dur = 0.4;
+        // this.logger.log("duration: " + dur);
+        // var a = new ygAnim_Fade(this.el, dur, 1);
+        // a.setStart(0.1);
+        // a.onComplete = function() { tvanim.onComplete(); };
+
+        // var a = new YAHOO.util.Anim(this.el, 'opacity', 0.1, 1);
+        var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);
+        a.onComplete.subscribe( function() { tvanim.onComplete(); } );
+        a.animate();
+    },
+
+    /**
+     * Clean up and invoke callback
+     */
+    onComplete: function() {
+        this.callback();
+    },
+
+    toString: function() {
+        return "TVFadeIn";
+    }
+};
+
+/**
+ * A 1/2 second fade out animation.
+ *
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {Function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeOut = function(el, callback) {
+    /**
+     * The element to animate
+     * @type HTMLElement
+     */
+    this.el = el;
+
+    /**
+     * the callback to invoke when the animation is complete
+     *
+     * @type function
+     */
+    this.callback = callback;
+
+    /**
+     * @private
+     */
+    this.logger = new YAHOO.widget.LogWriter(this.toString());
+};
+
+/**
+ * Performs the animation
+ */
+YAHOO.widget.TVFadeOut.prototype = {
+    animate: function() {
+        var tvanim = this;
+        // var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;
+        var dur = 0.4;
+        // this.logger.log("duration: " + dur);
+        // var a = new ygAnim_Fade(this.el, dur, 0.1);
+        // a.onComplete = function() { tvanim.onComplete(); };
+
+        // var a = new YAHOO.util.Anim(this.el, 'opacity', 1, 0.1);
+        var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);
+        a.onComplete.subscribe( function() { tvanim.onComplete(); } );
+        a.animate();
+    },
+
+    /**
+     * Clean up and invoke callback
+     */
+    onComplete: function() {
+        var s = this.el.style;
+        s.display = "none";
+        // s.opacity = 1;
+        s.filter = "alpha(opacity=100)";
+        this.callback();
+    },
+
+    toString: function() {
+        return "TVFadeOut";
+    }
+};
+
Index: /branches/mobile/html/test/kakinaka/js/treeview/assets/tree.css
===================================================================
--- /branches/mobile/html/test/kakinaka/js/treeview/assets/tree.css	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/treeview/assets/tree.css	(revision 7213)
@@ -0,0 +1,103 @@
+/*
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.com/yui/license.txt
+Version: 0.11.3
+*/
+
+/* first or middle sibling, no children */
+.ygtvtn {
+	width:16px; height:22px; 
+	background: url(tn.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, collapsable */
+.ygtvtm {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(tm.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, collapsable, hover */
+.ygtvtmh {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(tmh.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, expandable */
+.ygtvtp {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(tp.gif) 0 0 no-repeat; 
+}
+
+/* first or middle sibling, expandable, hover */
+.ygtvtph {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(tph.gif) 0 0 no-repeat; 
+}
+
+/* last sibling, no children */
+.ygtvln {
+	width:16px; height:22px; 
+	background: url(ln.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, collapsable */
+.ygtvlm {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(lm.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, collapsable, hover */
+.ygtvlmh {
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(lmh.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, expandable */
+.ygtvlp { 
+	width:16px; height:22px; 
+	cursor:pointer ;
+	background: url(lp.gif) 0 0 no-repeat; 
+}
+
+/* Last sibling, expandable, hover */
+.ygtvlph { 
+	width:16px; height:22px; cursor:pointer ;
+	background: url(lph.gif) 0 0 no-repeat; 
+}
+
+/* Loading icon */
+.ygtvloading { 
+	width:16px; height:22px; 
+	background: url(loading.gif) 0 0 no-repeat; 
+}
+
+/* the style for the empty cells that are used for rendering the depth 
+ * of the node */
+.ygtvdepthcell { 
+	width:16px; height:22px; 
+	background: url(vline.gif) 0 0 no-repeat; 
+}
+
+.ygtvblankdepthcell { width:16px; height:22px; }
+
+/* the style of the div around each node */
+.ygtvitem { }  
+
+/* the style of the div around each node's collection of children */
+.ygtvchildren { }  
+* html .ygtvchildren { height:2%; }  
+
+/* the style of the text label in ygTextNode */
+.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { 
+	margin-left:2px;
+	text-decoration: none;
+}
+
+.ygtvspacer { height: 10px; width: 10px; margin: 2px; }
Index: /branches/mobile/html/test/kakinaka/js/treeview/treeview.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/treeview/treeview.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/treeview/treeview.js	(revision 7213)
@@ -0,0 +1,1967 @@
+/*                                                                                                                                                      
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+version: 0.11.3
+*/ 
+
+/**
+ * Contains the tree view state data and the root node.  This is an
+ * ordered tree; child nodes will be displayed in the order created, and
+ * there currently is no way to change this.
+ *
+ * @constructor
+ * @param {string|HTMLElement} id The id of the element, or the element
+ * itself that the tree will be inserted into.
+ */
+YAHOO.widget.TreeView = function(id) {
+    if (id) { this.init(id); }
+};
+
+/**
+ * Count of all nodes in all trees
+ * @type int
+ */
+YAHOO.widget.TreeView.nodeCount = 0;
+
+YAHOO.widget.TreeView.prototype = {
+
+    /**
+     * The id of tree container element
+     *
+     * @type String
+     */
+    id: null,
+
+    /**
+     * The host element for this tree
+     * @private
+     */
+    _el: null,
+
+     /**
+     * Flat collection of all nodes in this tree
+     *
+     * @type Node[]
+     * @private
+     */
+    _nodes: null,
+
+    /**
+     * We lock the tree control while waiting for the dynamic loader to return
+     *
+     * @type boolean
+     */
+    locked: false,
+
+    /**
+     * The animation to use for expanding children, if any
+     *
+     * @type string
+     * @private
+     */
+    _expandAnim: null,
+
+    /**
+     * The animation to use for collapsing children, if any
+     *
+     * @type string
+     * @private
+     */
+    _collapseAnim: null,
+
+    /**
+     * The current number of animations that are executing
+     *
+     * @type int
+     * @private
+     */
+    _animCount: 0,
+
+    /**
+     * The maximum number of animations to run at one time.
+     *
+     * @type int
+     */
+    maxAnim: 2,
+
+    /**
+     * Sets up the animation for expanding children
+     *
+     * @param {string} the type of animation (acceptable values defined in 
+     * YAHOO.widget.TVAnim)
+     */
+    setExpandAnim: function(type) {
+        if (YAHOO.widget.TVAnim.isValid(type)) {
+            this._expandAnim = type;
+        }
+    },
+
+    /**
+     * Sets up the animation for collapsing children
+     *
+     * @param {string} the type of animation (acceptable values defined in 
+     * YAHOO.widget.TVAnim)
+     */
+    setCollapseAnim: function(type) {
+        if (YAHOO.widget.TVAnim.isValid(type)) {
+            this._collapseAnim = type;
+        }
+    },
+
+    /**
+     * Perform the expand animation if configured, or just show the
+     * element if not configured or too many animations are in progress
+     *
+     * @param el {HTMLElement} the element to animate
+     * @return {boolean} true if animation could be invoked, false otherwise
+     */
+    animateExpand: function(el) {
+
+        if (this._expandAnim && this._animCount < this.maxAnim) {
+            // this.locked = true;
+            var tree = this;
+            var a = YAHOO.widget.TVAnim.getAnim(this._expandAnim, el, 
+                            function() { tree.expandComplete(); });
+            if (a) { 
+                ++this._animCount;
+                a.animate();
+            }
+
+            return true;
+        }
+
+        return false;
+    },
+
+    /**
+     * Perform the collapse animation if configured, or just show the
+     * element if not configured or too many animations are in progress
+     *
+     * @param el {HTMLElement} the element to animate
+     * @return {boolean} true if animation could be invoked, false otherwise
+     */
+    animateCollapse: function(el) {
+
+        if (this._collapseAnim && this._animCount < this.maxAnim) {
+            // this.locked = true;
+            var tree = this;
+            var a = YAHOO.widget.TVAnim.getAnim(this._collapseAnim, el, 
+                            function() { tree.collapseComplete(); });
+            if (a) { 
+                ++this._animCount;
+                a.animate();
+            }
+
+            return true;
+        }
+
+        return false;
+    },
+
+    /**
+     * Function executed when the expand animation completes
+     */
+    expandComplete: function() {
+        --this._animCount;
+        // this.locked = false;
+    },
+
+    /**
+     * Function executed when the collapse animation completes
+     */
+    collapseComplete: function() {
+        --this._animCount;
+        // this.locked = false;
+    },
+
+    /**
+     * Initializes the tree
+     *
+     * @parm {string|HTMLElement} id the id of the element that will hold the tree
+     * @private
+     */
+    init: function(id) {
+
+        this.id = id;
+
+        if ("string" !== typeof id) {
+            this._el = id;
+            this.id = this.generateId(id);
+        }
+
+        this._nodes = [];
+
+        // store a global reference
+        YAHOO.widget.TreeView.trees[this.id] = this;
+
+        // Set up the root node
+        this.root = new YAHOO.widget.RootNode(this);
+
+
+    },
+
+    /**
+     * Renders the tree boilerplate and visible nodes
+     */
+    draw: function() {
+        var html = this.root.getHtml();
+        this.getEl().innerHTML = html;
+        this.firstDraw = false;
+    },
+
+    /**
+     * Returns the tree's host element
+     * @return {HTMLElement} the host element
+     */
+    getEl: function() {
+        if (! this._el) {
+            this._el = document.getElementById(this.id);
+        }
+        return this._el;
+    },
+
+    /**
+     * Nodes register themselves with the tree instance when they are created.
+     *
+     * @param node {Node} the node to register
+     * @private
+     */
+    regNode: function(node) {
+        this._nodes[node.index] = node;
+    },
+
+    /**
+     * Returns the root node of this tree
+     *
+     * @return {Node} the root node
+     */
+    getRoot: function() {
+        return this.root;
+    },
+
+    /**
+     * Configures this tree to dynamically load all child data
+     *
+     * @param {function} fnDataLoader the function that will be called to get the data
+     * @param iconMode {int} configures the icon that is displayed when a dynamic
+     * load node is expanded the first time without children.  By default, the 
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be
+     * displayed.
+     */
+    setDynamicLoad: function(fnDataLoader, iconMode) { 
+        this.root.setDynamicLoad(fnDataLoader, iconMode);
+    },
+
+    /**
+     * Expands all child nodes.  Note: this conflicts with the "multiExpand"
+     * node property.  If expand all is called in a tree with nodes that
+     * do not allow multiple siblings to be displayed, only the last sibling
+     * will be expanded.
+     */
+    expandAll: function() { 
+        if (!this.locked) {
+            this.root.expandAll(); 
+        }
+    },
+
+    /**
+     * Collapses all expanded child nodes in the entire tree.
+     */
+    collapseAll: function() { 
+        if (!this.locked) {
+            this.root.collapseAll(); 
+        }
+    },
+
+    /**
+     * Returns a node in the tree that has the specified index (this index
+     * is created internally, so this function probably will only be used
+     * in html generated for a given node.)
+     *
+     * @param {int} nodeIndex the index of the node wanted
+     * @return {Node} the node with index=nodeIndex, null if no match
+     */
+    getNodeByIndex: function(nodeIndex) {
+        var n = this._nodes[nodeIndex];
+        return (n) ? n : null;
+    },
+
+    /**
+     * Returns a node that has a matching property and value in the data
+     * object that was passed into its constructor.
+     *
+     * @param {object} property the property to search (usually a string)
+     * @param {object} value the value we want to find (usuall an int or string)
+     * @return {Node} the matching node, null if no match
+     */
+    getNodeByProperty: function(property, value) {
+        for (var i in this._nodes) {
+            var n = this._nodes[i];
+            if (n.data && value == n.data[property]) {
+                return n;
+            }
+        }
+
+        return null;
+    },
+
+    /**
+     * Returns a collection of nodes that have a matching property 
+     * and value in the data object that was passed into its constructor.  
+     *
+     * @param {object} property the property to search (usually a string)
+     * @param {object} value the value we want to find (usuall an int or string)
+     * @return {Array} the matching collection of nodes, null if no match
+     */
+    getNodesByProperty: function(property, value) {
+        var values = [];
+        for (var i in this._nodes) {
+            var n = this._nodes[i];
+            if (n.data && value == n.data[property]) {
+                values.push(n);
+            }
+        }
+
+        return (values.length) ? values : null;
+    },
+
+    /**
+     * Removes the node and its children, and optionally refreshes the 
+     * branch of the tree that was affected.
+     * @param {Node} The node to remove
+     * @param {boolean} autoRefresh automatically refreshes branch if true
+     * @return {boolean} False is there was a problem, true otherwise.
+     */
+    removeNode: function(node, autoRefresh) { 
+
+        // Don't delete the root node
+        if (node.isRoot()) {
+            return false;
+        }
+
+        // Get the branch that we may need to refresh
+        var p = node.parent;
+        if (p.parent) {
+            p = p.parent;
+        }
+
+        // Delete the node and its children
+        this._deleteNode(node);
+
+        // Refresh the parent of the parent
+        if (autoRefresh && p && p.childrenRendered) {
+            p.refresh();
+        }
+
+        return true;
+    },
+
+    /**
+     * Deletes this nodes child collection, recursively.  Also collapses
+     * the node, and resets the dynamic load flag.  The primary use for
+     * this method is to purge a node and allow it to fetch its data
+     * dynamically again.
+     * @param {Node} node the node to purge
+     */
+    removeChildren: function(node) { 
+        while (node.children.length) {
+             this._deleteNode(node.children[0]);
+        }
+
+        node.childrenRendered = false;
+        node.dynamicLoadComplete = false;
+        // node.collapse();
+        node.expand();
+        node.collapse();
+    },
+
+    /**
+     * Deletes the node and recurses children
+     * @private
+     */
+    _deleteNode: function(node) { 
+        // Remove all the child nodes first
+        this.removeChildren(node);
+
+        // Remove the node from the tree
+        this.popNode(node);
+    },
+
+    /**
+     * Removes the node from the tree, preserving the child collection 
+     * to make it possible to insert the branch into another part of the 
+     * tree, or another tree.
+     * @param {Node} the node to remove
+     */
+    popNode: function(node) { 
+        var p = node.parent;
+
+        // Update the parent's collection of children
+        var a = [];
+
+        for (var i=0, len=p.children.length;i<len;++i) {
+            if (p.children[i] != node) {
+                a[a.length] = p.children[i];
+            }
+        }
+
+        p.children = a;
+
+        // reset the childrenRendered flag for the parent
+        p.childrenRendered = false;
+
+         // Update the sibling relationship
+        if (node.previousSibling) {
+            node.previousSibling.nextSibling = node.nextSibling;
+        }
+
+        if (node.nextSibling) {
+            node.nextSibling.previousSibling = node.previousSibling;
+        }
+
+        node.parent = null;
+        node.previousSibling = null;
+        node.nextSibling = null;
+        node.tree = null;
+
+        // Update the tree's node collection 
+        delete this._nodes[node.index];
+    },
+
+    /**
+     * toString
+     * @return {string} string representation of the tree
+     */
+    toString: function() {
+        return "TreeView " + this.id;
+    },
+
+    /**
+     * private
+     */
+    generateId: function(el) {
+        var id = el.id;
+
+        if (!id) {
+            id = "yui-tv-auto-id-" + YAHOO.widget.TreeView.counter;
+            YAHOO.widget.TreeView.counter++;
+        }
+
+        return id;
+    },
+
+    /**
+     * Abstract method that is executed when a node is expanded
+     * @param node {Node} the node that was expanded
+     */
+    onExpand: function(node) { },
+
+    /**
+     * Abstract method that is executed when a node is collapsed
+     * @param node {Node} the node that was collapsed.
+     */
+    onCollapse: function(node) { }
+
+};
+
+/**
+ * Global cache of tree instances
+ *
+ * @type Array
+ * @private
+ */
+YAHOO.widget.TreeView.trees = [];
+
+/**
+ * @private
+ */
+YAHOO.widget.TreeView.counter = 0;
+
+/**
+ * Global method for getting a tree by its id.  Used in the generated
+ * tree html.
+ *
+ * @param treeId {String} the id of the tree instance
+ * @return {TreeView} the tree instance requested, null if not found.
+ */
+YAHOO.widget.TreeView.getTree = function(treeId) {
+    var t = YAHOO.widget.TreeView.trees[treeId];
+    return (t) ? t : null;
+};
+
+/**
+ * Global method for getting a node by its id.  Used in the generated
+ * tree html.
+ *
+ * @param treeId {String} the id of the tree instance
+ * @param nodeIndex {String} the index of the node to return
+ * @return {Node} the node instance requested, null if not found
+ */
+YAHOO.widget.TreeView.getNode = function(treeId, nodeIndex) {
+    var t = YAHOO.widget.TreeView.getTree(treeId);
+    return (t) ? t.getNodeByIndex(nodeIndex) : null;
+};
+
+/**
+ * Adds an event.  Replace with event manager when available
+ *
+ * @param el the elment to bind the handler to
+ * @param {string} sType the type of event handler
+ * @param {function} fn the callback to invoke
+ * @param {boolean} capture if true event is capture phase, bubble otherwise
+ */
+YAHOO.widget.TreeView.addHandler = function (el, sType, fn, capture) {
+    capture = (capture) ? true : false;
+    if (el.addEventListener) {
+        el.addEventListener(sType, fn, capture);
+    } else if (el.attachEvent) {
+        el.attachEvent("on" + sType, fn);
+    } else {
+        el["on" + sType] = fn;
+    }
+};
+
+/**
+ * Attempts to preload the images defined in the styles used to draw the tree by
+ * rendering off-screen elements that use the styles.
+ */
+YAHOO.widget.TreeView.preload = function(prefix) {
+    prefix = prefix || "ygtv";
+    var styles = ["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];
+
+    var sb = [];
+    
+    for (var i = 0; i < styles.length; ++i) { 
+        sb[sb.length] = '<span class="' + prefix + styles[i] + '">&#160;</span>';
+    }
+
+    var f = document.createElement("DIV");
+    var s = f.style;
+    s.position = "absolute";
+    s.top = "-1000px";
+    s.left = "-1000px";
+    f.innerHTML = sb.join("");
+
+    document.body.appendChild(f);
+};
+
+YAHOO.widget.TreeView.addHandler(window, 
+                "load", YAHOO.widget.TreeView.preload);
+
+/**
+ * The base class for all tree nodes.  The node's presentation and behavior in
+ * response to mouse events is handled in Node subclasses.
+ *
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @constructor
+ */
+YAHOO.widget.Node = function(oData, oParent, expanded) {
+    if (oData) { this.init(oData, oParent, expanded); }
+};
+
+YAHOO.widget.Node.prototype = {
+
+    /**
+     * The index for this instance obtained from global counter in YAHOO.widget.TreeView.
+     *
+     * @type int
+     */
+    index: 0,
+
+    /**
+     * This node's child node collection.
+     *
+     * @type Node[] 
+     */
+    children: null,
+
+    /**
+     * Tree instance this node is part of
+     *
+     * @type TreeView
+     */
+    tree: null,
+
+    /**
+     * The data linked to this node.  This can be any object or primitive
+     * value, and the data can be used in getNodeHtml().
+     *
+     * @type object
+     */
+    data: null,
+
+    /**
+     * Parent node
+     *
+     * @type Node
+     */
+    parent: null,
+
+    /**
+     * The depth of this node.  We start at -1 for the root node.
+     *
+     * @type int
+     */
+    depth: -1,
+
+    /**
+     * The href for the node's label.  If one is not specified, the href will
+     * be set so that it toggles the node.
+     *
+     * @type string
+     */
+    href: null,
+
+    /**
+     * The label href target, defaults to current window
+     *
+     * @type string
+     */
+    target: "_self",
+
+    /**
+     * The node's expanded/collapsed state
+     *
+     * @type boolean
+     */
+    expanded: false,
+
+    /**
+     * Can multiple children be expanded at once?
+     *
+     * @type boolean
+     */
+    multiExpand: true,
+
+    /**
+     * Should we render children for a collapsed node?  It is possible that the
+     * implementer will want to render the hidden data...  @todo verify that we 
+     * need this, and implement it if we do.
+     *
+     * @type boolean
+     */
+    renderHidden: false,
+
+    /**
+     * This flag is set to true when the html is generated for this node's
+     * children, and set to false when new children are added.
+     * @type boolean
+     */
+    childrenRendered: false,
+
+    /**
+     * Dynamically loaded nodes only fetch the data the first time they are
+     * expanded.  This flag is set to true once the data has been fetched.
+     * @type boolean
+     */
+    dynamicLoadComplete: false,
+
+    /**
+     * This node's previous sibling
+     *
+     * @type Node
+     */
+    previousSibling: null,
+
+    /**
+     * This node's next sibling
+     *
+     * @type Node
+     */
+    nextSibling: null,
+
+    /**
+     * We can set the node up to call an external method to get the child
+     * data dynamically.
+     *
+     * @type boolean
+     * @private
+     */
+    _dynLoad: false,
+
+    /**
+     * Function to execute when we need to get this node's child data.
+     *
+     * @type function
+     */
+    dataLoader: null,
+
+    /**
+     * This is true for dynamically loading nodes while waiting for the
+     * callback to return.
+     *
+     * @type boolean
+     */
+    isLoading: false,
+
+    /**
+     * The toggle/branch icon will not show if this is set to false.  This
+     * could be useful if the implementer wants to have the child contain
+     * extra info about the parent, rather than an actual node.
+     *
+     * @type boolean
+     */
+    hasIcon: true,
+
+    /**
+     * Used to configure what happens when a dynamic load node is expanded
+     * and we discover that it does not have children.  By default, it is
+     * treated as if it still could have children (plus/minus icon).  Set
+     * iconMode to have it display like a leaf node instead.
+     * @type int
+     */
+    iconMode: 0,
+
+    /**
+     * The node type
+     * @private
+     */
+    _type: "Node",
+
+    /*
+    spacerPath: "http://us.i1.yimg.com/us.yimg.com/i/space.gif",
+    expandedText: "Expanded",
+    collapsedText: "Collapsed",
+    loadingText: "Loading",
+    */
+
+    /**
+     * Initializes this node, gets some of the properties from the parent
+     *
+     * @param oData {object} a string or object containing the data that will
+     * be used to render this node
+     * @param oParent {Node} this node's parent node
+     * @param expanded {boolean} the initial expanded/collapsed state
+     */
+    init: function(oData, oParent, expanded) {
+        this.data       = oData;
+        this.children   = [];
+        this.index      = YAHOO.widget.TreeView.nodeCount;
+        ++YAHOO.widget.TreeView.nodeCount;
+        this.expanded   = expanded;
+
+        // oParent should never be null except when we create the root node.
+        if (oParent) {
+            oParent.appendChild(this);
+        }
+    },
+
+    /**
+     * Certain properties for the node cannot be set until the parent
+     * is known. This is called after the node is inserted into a tree.
+     * the parent is also applied to this node's children in order to
+     * make it possible to move a branch from one tree to another.
+     * @param {Node} parentNode this node's parent node
+     * @return {boolean} true if the application was successful
+     */
+    applyParent: function(parentNode) {
+        if (!parentNode) {
+            return false;
+        }
+
+        this.tree   = parentNode.tree;
+        this.parent = parentNode;
+        this.depth  = parentNode.depth + 1;
+
+        if (! this.href) {
+            this.href = "javascript:" + this.getToggleLink();
+        }
+
+        if (! this.multiExpand) {
+            this.multiExpand = parentNode.multiExpand;
+        }
+
+        this.tree.regNode(this);
+        parentNode.childrenRendered = false;
+
+        // cascade update existing children
+        for (var i=0, len=this.children.length;i<len;++i) {
+            this.children[i].applyParent(this);
+        }
+
+        return true;
+    },
+
+    /**
+     * Appends a node to the child collection.
+     *
+     * @param childNode {Node} the new node
+     * @return {Node} the child node
+     * @private
+     */
+    appendChild: function(childNode) {
+        if (this.hasChildren()) {
+            var sib = this.children[this.children.length - 1];
+            sib.nextSibling = childNode;
+            childNode.previousSibling = sib;
+        }
+        this.children[this.children.length] = childNode;
+        childNode.applyParent(this);
+
+        return childNode;
+    },
+
+    /**
+     * Appends this node to the supplied node's child collection
+     * @param parentNode {Node} the node to append to.
+     * @return {Node} The appended node
+     */
+    appendTo: function(parentNode) {
+        return parentNode.appendChild(this);
+    },
+
+    /**
+    * Inserts this node before this supplied node
+    *
+    * @param node {Node} the node to insert this node before
+    * @return {Node} the inserted node
+    */
+    insertBefore: function(node) {
+        var p = node.parent;
+        if (p) {
+
+            if (this.tree) {
+                this.tree.popNode(this);
+            }
+
+            var refIndex = node.isChildOf(p);
+            p.children.splice(refIndex, 0, this);
+            if (node.previousSibling) {
+                node.previousSibling.nextSibling = this;
+            }
+            this.previousSibling = node.previousSibling;
+            this.nextSibling = node;
+            node.previousSibling = this;
+
+            this.applyParent(p);
+        }
+
+        return this;
+    },
+ 
+    /**
+    * Inserts this node after the supplied node
+    *
+    * @param node {Node} the node to insert after
+    * @return {Node} the inserted node
+    */
+    insertAfter: function(node) {
+        var p = node.parent;
+        if (p) {
+
+            if (this.tree) {
+                this.tree.popNode(this);
+            }
+
+            var refIndex = node.isChildOf(p);
+
+            if (!node.nextSibling) {
+                return this.appendTo(p);
+            }
+
+            p.children.splice(refIndex + 1, 0, this);
+
+            node.nextSibling.previousSibling = this;
+            this.previousSibling = node;
+            this.nextSibling = node.nextSibling;
+            node.nextSibling = this;
+
+            this.applyParent(p);
+        }
+
+        return this;
+    },
+
+    /**
+    * Returns true if the Node is a child of supplied Node
+    *
+    * @param parentNode {Node} the Node to check
+    * @return {boolean} The node index if this Node is a child of 
+    *                   supplied Node, else -1.
+    * @private
+    */
+    isChildOf: function(parentNode) {
+        if (parentNode && parentNode.children) {
+            for (var i=0, len=parentNode.children.length; i<len ; ++i) {
+                if (parentNode.children[i] === this) {
+                    return i;
+                }
+            }
+        }
+
+        return -1;
+    },
+
+    /**
+     * Returns a node array of this node's siblings, null if none.
+     *
+     * @return Node[]
+     */
+    getSiblings: function() {
+        return this.parent.children;
+    },
+
+    /**
+     * Shows this node's children
+     */
+    showChildren: function() {
+        if (!this.tree.animateExpand(this.getChildrenEl())) {
+            if (this.hasChildren()) {
+                this.getChildrenEl().style.display = "";
+            }
+        }
+    },
+
+    /**
+     * Hides this node's children
+     */
+    hideChildren: function() {
+
+        if (!this.tree.animateCollapse(this.getChildrenEl())) {
+            this.getChildrenEl().style.display = "none";
+        }
+    },
+
+    /**
+     * Returns the id for this node's container div
+     *
+     * @return {string} the element id
+     */
+    getElId: function() {
+        return "ygtv" + this.index;
+    },
+
+    /**
+     * Returns the id for this node's children div
+     *
+     * @return {string} the element id for this node's children div
+     */
+    getChildrenElId: function() {
+        return "ygtvc" + this.index;
+    },
+
+    /**
+     * Returns the id for this node's toggle element
+     *
+     * @return {string} the toggel element id
+     */
+    getToggleElId: function() {
+        return "ygtvt" + this.index;
+    },
+
+    /**
+     * Returns the id for this node's spacer image.  The spacer is positioned
+     * over the toggle and provides feedback for screen readers.
+     * @return {string} the id for the spacer image
+     */
+    /*
+    getSpacerId: function() {
+        return "ygtvspacer" + this.index;
+    }, 
+    */
+
+    /**
+     * Returns this node's container html element
+     * @return {HTMLElement} the container html element
+     */
+    getEl: function() {
+        return document.getElementById(this.getElId());
+    },
+
+    /**
+     * Returns the div that was generated for this node's children
+     * @return {HTMLElement} this node's children div
+     */
+    getChildrenEl: function() {
+        return document.getElementById(this.getChildrenElId());
+    },
+
+    /**
+     * Returns the element that is being used for this node's toggle.
+     * @return {HTMLElement} this node's toggle html element
+     */
+    getToggleEl: function() {
+        return document.getElementById(this.getToggleElId());
+    },
+
+    /**
+     * Returns the element that is being used for this node's spacer.
+     * @return {HTMLElement} this node's spacer html element
+     */
+    /*
+    getSpacer: function() {
+        return document.getElementById( this.getSpacerId() ) || {};
+    },
+    */
+
+    /*
+    getStateText: function() {
+        if (this.isLoading) {
+            return this.loadingText;
+        } else if (this.hasChildren(true)) {
+            if (this.expanded) {
+                return this.expandedText;
+            } else {
+                return this.collapsedText;
+            }
+        } else {
+            return "";
+        }
+    },
+    */
+
+    /**
+     * Generates the link that will invoke this node's toggle method
+     * @return {string} the javascript url for toggling this node
+     */
+    getToggleLink: function() {
+        return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + 
+            this.index + ").toggle()";
+    },
+
+    /**
+     * Hides this nodes children (creating them if necessary), changes the
+     * toggle style.
+     */
+    collapse: function() {
+        // Only collapse if currently expanded
+        if (!this.expanded) { return; }
+
+        // fire the collapse event handler
+        var ret = this.tree.onCollapse(this);
+
+        if ("undefined" != typeof ret && !ret) {
+            return;
+        }
+
+        if (!this.getEl()) {
+            this.expanded = false;
+            return;
+        }
+
+        // hide the child div
+        this.hideChildren();
+        this.expanded = false;
+
+        if (this.hasIcon) {
+            this.getToggleEl().className = this.getStyle();
+        }
+
+        // this.getSpacer().title = this.getStateText();
+
+    },
+
+    /**
+     * Shows this nodes children (creating them if necessary), changes the
+     * toggle style, and collapses its siblings if multiExpand is not set.
+     */
+    expand: function() {
+        // Only expand if currently collapsed.
+        if (this.expanded) { return; }
+
+        // fire the expand event handler
+        var ret = this.tree.onExpand(this);
+
+        if ("undefined" != typeof ret && !ret) {
+            return;
+        }
+
+        if (!this.getEl()) {
+            this.expanded = true;
+            return;
+        }
+
+        if (! this.childrenRendered) {
+            this.getChildrenEl().innerHTML = this.renderChildren();
+        } else {
+        }
+
+        this.expanded = true;
+        if (this.hasIcon) {
+            this.getToggleEl().className = this.getStyle();
+        }
+
+        // this.getSpacer().title = this.getStateText();
+
+        // We do an extra check for children here because the lazy
+        // load feature can expose nodes that have no children.
+
+        // if (!this.hasChildren()) {
+        if (this.isLoading) {
+            this.expanded = false;
+            return;
+        }
+
+        if (! this.multiExpand) {
+            var sibs = this.getSiblings();
+            for (var i=0; i<sibs.length; ++i) {
+                if (sibs[i] != this && sibs[i].expanded) { 
+                    sibs[i].collapse(); 
+                }
+            }
+        }
+
+        this.showChildren();
+    },
+
+    /**
+     * Returns the css style name for the toggle
+     *
+     * @return {string} the css class for this node's toggle
+     */
+    getStyle: function() {
+        if (this.isLoading) {
+            return "ygtvloading";
+        } else {
+            // location top or bottom, middle nodes also get the top style
+            var loc = (this.nextSibling) ? "t" : "l";
+
+            // type p=plus(expand), m=minus(collapase), n=none(no children)
+            var type = "n";
+            if (this.hasChildren(true) || (this.isDynamic() && !this.getIconMode())) {
+            // if (this.hasChildren(true)) {
+                type = (this.expanded) ? "m" : "p";
+            }
+
+            return "ygtv" + loc + type;
+        }
+    },
+
+    /**
+     * Returns the hover style for the icon
+     * @return {string} the css class hover state
+     */
+    getHoverStyle: function() { 
+        var s = this.getStyle();
+        if (this.hasChildren(true) && !this.isLoading) { 
+            s += "h"; 
+        }
+        return s;
+    },
+
+    /**
+     * Recursively expands all of this node's children.
+     */
+    expandAll: function() { 
+        for (var i=0;i<this.children.length;++i) {
+            var c = this.children[i];
+            if (c.isDynamic()) {
+                alert("Not supported (lazy load + expand all)");
+                break;
+            } else if (! c.multiExpand) {
+                alert("Not supported (no multi-expand + expand all)");
+                break;
+            } else {
+                c.expand();
+                c.expandAll();
+            }
+        }
+    },
+
+    /**
+     * Recursively collapses all of this node's children.
+     */
+    collapseAll: function() { 
+        for (var i=0;i<this.children.length;++i) {
+            this.children[i].collapse();
+            this.children[i].collapseAll();
+        }
+    },
+
+    /**
+     * Configures this node for dynamically obtaining the child data
+     * when the node is first expanded.  Calling it without the callback
+     * will turn off dynamic load for the node.
+     *
+     * @param fmDataLoader {function} the function that will be used to get the data.
+     * @param iconMode {int} configures the icon that is displayed when a dynamic
+     * load node is expanded the first time without children.  By default, the 
+     * "collapse" icon will be used.  If set to 1, the leaf node icon will be
+     * displayed.
+     */
+    setDynamicLoad: function(fnDataLoader, iconMode) { 
+        if (fnDataLoader) {
+            this.dataLoader = fnDataLoader;
+            this._dynLoad = true;
+        } else {
+            this.dataLoader = null;
+            this._dynLoad = false;
+        }
+
+        if (iconMode) {
+            this.iconMode = iconMode;
+        }
+    },
+
+    /**
+     * Evaluates if this node is the root node of the tree
+     *
+     * @return {boolean} true if this is the root node
+     */
+    isRoot: function() { 
+        return (this == this.tree.root);
+    },
+
+    /**
+     * Evaluates if this node's children should be loaded dynamically.  Looks for
+     * the property both in this instance and the root node.  If the tree is
+     * defined to load all children dynamically, the data callback function is
+     * defined in the root node
+     *
+     * @return {boolean} true if this node's children are to be loaded dynamically
+     */
+    isDynamic: function() { 
+        var lazy = (!this.isRoot() && (this._dynLoad || this.tree.root._dynLoad));
+        return lazy;
+    },
+
+    getIconMode: function() {
+        return (this.iconMode || this.tree.root.iconMode);
+    },
+
+    /**
+     * Checks if this node has children.  If this node is lazy-loading and the
+     * children have not been rendered, we do not know whether or not there
+     * are actual children.  In most cases, we need to assume that there are
+     * children (for instance, the toggle needs to show the expandable 
+     * presentation state).  In other times we want to know if there are rendered
+     * children.  For the latter, "checkForLazyLoad" should be false.
+     *
+     * @param checkForLazyLoad {boolean} should we check for unloaded children?
+     * @return {boolean} true if this has children or if it might and we are
+     * checking for this condition.
+     */
+    hasChildren: function(checkForLazyLoad) { 
+        return ( this.children.length > 0 || 
+                (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete) );
+    },
+
+    /**
+     * Expands if node is collapsed, collapses otherwise.
+     */
+    toggle: function() {
+        if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {
+            if (this.expanded) { this.collapse(); } else { this.expand(); }
+        }
+    },
+
+    /**
+     * Returns the markup for this node and its children.
+     *
+     * @return {string} the markup for this node and its expanded children.
+     */
+    getHtml: function() {
+        var sb = [];
+        sb[sb.length] = '<div class="ygtvitem" id="' + this.getElId() + '">';
+        sb[sb.length] = this.getNodeHtml();
+        sb[sb.length] = this.getChildrenHtml();
+        sb[sb.length] = '</div>';
+        return sb.join("");
+    },
+
+    /**
+     * Called when first rendering the tree.  We always build the div that will
+     * contain this nodes children, but we don't render the children themselves
+     * unless this node is expanded.
+     *
+     * @return {string} the children container div html and any expanded children
+     * @private
+     */
+    getChildrenHtml: function() {
+
+        var sb = [];
+        sb[sb.length] = '<div class="ygtvchildren"';
+        sb[sb.length] = ' id="' + this.getChildrenElId() + '"';
+        if (!this.expanded) {
+            sb[sb.length] = ' style="display:none;"';
+        }
+        sb[sb.length] = '>';
+
+        // Don't render the actual child node HTML unless this node is expanded.
+        if ( (this.hasChildren(true) && this.expanded) ||
+                (this.renderHidden && !this.isDynamic()) ) {
+            sb[sb.length] = this.renderChildren();
+        }
+
+        sb[sb.length] = '</div>';
+
+        return sb.join("");
+    },
+
+    /**
+     * Generates the markup for the child nodes.  This is not done until the node
+     * is expanded.
+     *
+     * @return {string} the html for this node's children
+     * @private
+     */
+    renderChildren: function() {
+
+
+        var node = this;
+
+        if (this.isDynamic() && !this.dynamicLoadComplete) {
+            this.isLoading = true;
+            this.tree.locked = true;
+
+            if (this.dataLoader) {
+
+                setTimeout( 
+                    function() {
+                        node.dataLoader(node, 
+                            function() { 
+                                node.loadComplete(); 
+                            });
+                    }, 10);
+                
+            } else if (this.tree.root.dataLoader) {
+
+                setTimeout( 
+                    function() {
+                        node.tree.root.dataLoader(node, 
+                            function() { 
+                                node.loadComplete(); 
+                            });
+                    }, 10);
+
+            } else {
+                return "Error: data loader not found or not specified.";
+            }
+
+            return "";
+
+        } else {
+            return this.completeRender();
+        }
+    },
+
+    /**
+     * Called when we know we have all the child data.
+     * @return {string} children html
+     */
+    completeRender: function() {
+        var sb = [];
+
+        for (var i=0; i < this.children.length; ++i) {
+            this.children[i].childrenRendered = false;
+            sb[sb.length] = this.children[i].getHtml();
+        }
+        
+        this.childrenRendered = true;
+
+        return sb.join("");
+    },
+
+    /**
+     * Load complete is the callback function we pass to the data provider
+     * in dynamic load situations.
+     */
+    loadComplete: function() {
+        this.getChildrenEl().innerHTML = this.completeRender();
+        this.dynamicLoadComplete = true;
+        this.isLoading = false;
+        this.expand();
+        this.tree.locked = false;
+    },
+
+    /**
+     * Returns this node's ancestor at the specified depth.
+     *
+     * @param {int} depth the depth of the ancestor.
+     * @return {Node} the ancestor
+     */
+    getAncestor: function(depth) {
+        if (depth >= this.depth || depth < 0)  {
+            return null;
+        }
+
+        var p = this.parent;
+        
+        while (p.depth > depth) {
+            p = p.parent;
+        }
+
+        return p;
+    },
+
+    /**
+     * Returns the css class for the spacer at the specified depth for
+     * this node.  If this node's ancestor at the specified depth
+     * has a next sibling the presentation is different than if it
+     * does not have a next sibling
+     *
+     * @param {int} depth the depth of the ancestor.
+     * @return {string} the css class for the spacer
+     */
+    getDepthStyle: function(depth) {
+        return (this.getAncestor(depth).nextSibling) ? 
+            "ygtvdepthcell" : "ygtvblankdepthcell";
+    },
+
+    /**
+     * Get the markup for the node.  This is designed to be overrided so that we can
+     * support different types of nodes.
+     *
+     * @return {string} The HTML that will render this node.
+     */
+    getNodeHtml: function() { 
+        return ""; 
+    },
+
+    /**
+     * Regenerates the html for this node and its children.  To be used when the
+     * node is expanded and new children have been added.
+     */
+    refresh: function() {
+        // this.loadComplete();
+        this.getChildrenEl().innerHTML = this.completeRender();
+
+        if (this.hasIcon) {
+            var el = this.getToggleEl();
+            if (el) {
+                el.className = this.getStyle();
+            }
+        }
+    },
+
+    /**
+     * toString
+     * @return {string} string representation of the node
+     */
+    toString: function() {
+        return "Node (" + this.index + ")";
+    }
+
+};
+
+/**
+ * A custom YAHOO.widget.Node that handles the unique nature of 
+ * the virtual, presentationless root node.
+ *
+ * @extends YAHOO.widget.Node
+ * @constructor
+ */
+YAHOO.widget.RootNode = function(oTree) {
+	// Initialize the node with null params.  The root node is a
+	// special case where the node has no presentation.  So we have
+	// to alter the standard properties a bit.
+	this.init(null, null, true);
+	
+	/**
+	 * For the root node, we get the tree reference from as a param
+	 * to the constructor instead of from the parent element.
+	 *
+	 * @type TreeView
+	 */
+	this.tree = oTree;
+};
+
+YAHOO.widget.RootNode.prototype = new YAHOO.widget.Node();
+
+// overrides YAHOO.widget.Node
+YAHOO.widget.RootNode.prototype.getNodeHtml = function() { 
+	return ""; 
+};
+
+YAHOO.widget.RootNode.prototype.toString = function() { 
+    return "RootNode";
+};
+
+YAHOO.widget.RootNode.prototype.loadComplete = function() { 
+    this.tree.draw();
+};
+/**
+ * The default node presentation.  The first parameter should be
+ * either a string that will be used as the node's label, or an object
+ * that has a string propery called label.  By default, the clicking the
+ * label will toggle the expanded/collapsed state of the node.  By
+ * changing the href property of the instance, this behavior can be
+ * changed so that the label will go to the specified href.
+ *
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ */
+YAHOO.widget.TextNode = function(oData, oParent, expanded) {
+    // this.type = "TextNode";
+
+    if (oData) { 
+        this.init(oData, oParent, expanded);
+        this.setUpLabel(oData);
+    }
+
+    /**
+     * @private
+     */
+};
+
+YAHOO.widget.TextNode.prototype = new YAHOO.widget.Node();
+
+/**
+ * The CSS class for the label href.  Defaults to ygtvlabel, but can be
+ * overridden to provide a custom presentation for a specific node.
+ *
+ * @type string
+ */
+YAHOO.widget.TextNode.prototype.labelStyle = "ygtvlabel";
+
+/**
+ * The derived element id of the label for this node
+ *
+ * @type string
+ */
+YAHOO.widget.TextNode.prototype.labelElId = null;
+
+/**
+ * The text for the label.  It is assumed that the oData parameter will
+ * either be a string that will be used as the label, or an object that
+ * has a property called "label" that we will use.
+ *
+ * @type string
+ */
+YAHOO.widget.TextNode.prototype.label = null;
+
+/**
+ * Sets up the node label
+ * 
+ * @param oData string containing the label, or an object with a label property
+ */
+YAHOO.widget.TextNode.prototype.setUpLabel = function(oData) { 
+    if (typeof oData == "string") {
+        oData = { label: oData };
+    }
+    this.label = oData.label;
+    
+    // update the link
+    if (oData.href) {
+        this.href = oData.href;
+    }
+
+    // set the target
+    if (oData.target) {
+        this.target = oData.target;
+    }
+
+    if (oData.style) {
+        this.labelStyle = oData.style;
+    }
+
+    this.labelElId = "ygtvlabelel" + this.index;
+};
+
+/**
+ * Returns the label element
+ *
+ * @return {object} the element
+ */
+YAHOO.widget.TextNode.prototype.getLabelEl = function() { 
+    return document.getElementById(this.labelElId);
+};
+
+// overrides YAHOO.widget.Node
+YAHOO.widget.TextNode.prototype.getNodeHtml = function() { 
+    var sb = [];
+
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';
+    sb[sb.length] = '<tr>';
+    
+    for (i=0;i<this.depth;++i) {
+        // sb[sb.length] = '<td class="ygtvdepthcell">&#160;</td>';
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';
+    }
+
+    var getNode = 'YAHOO.widget.TreeView.getNode(\'' +
+                    this.tree.id + '\',' + this.index + ')';
+
+    sb[sb.length] = '<td';
+    // sb[sb.length] = ' onselectstart="return false"';
+    sb[sb.length] = ' id="' + this.getToggleElId() + '"';
+    sb[sb.length] = ' class="' + this.getStyle() + '"';
+    if (this.hasChildren(true)) {
+        sb[sb.length] = ' onmouseover="this.className=';
+        sb[sb.length] = getNode + '.getHoverStyle()"';
+        sb[sb.length] = ' onmouseout="this.className=';
+        sb[sb.length] = getNode + '.getStyle()"';
+    }
+    sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '">';
+
+    /*
+    sb[sb.length] = '<img id="' + this.getSpacerId() + '"';
+    sb[sb.length] = ' alt=""';
+    sb[sb.length] = ' tabindex=0';
+    sb[sb.length] = ' src="' + this.spacerPath + '"';
+    sb[sb.length] = ' title="' + this.getStateText() + '"';
+    sb[sb.length] = ' class="ygtvspacer"';
+    // sb[sb.length] = ' onkeypress="return ' + getNode + '".onKeyPress()"';
+    sb[sb.length] = ' />';
+    */
+
+    sb[sb.length] = '&#160;';
+
+    sb[sb.length] = '</td>';
+    sb[sb.length] = '<td>';
+    sb[sb.length] = '<a';
+    sb[sb.length] = ' id="' + this.labelElId + '"';
+    sb[sb.length] = ' class="' + this.labelStyle + '"';
+    sb[sb.length] = ' href="' + this.href + '"';
+    sb[sb.length] = ' target="' + this.target + '"';
+    sb[sb.length] = ' onclick="return ' + getNode + '.onLabelClick(' + getNode +')"';
+    if (this.hasChildren(true)) {
+        sb[sb.length] = ' onmouseover="document.getElementById(\'';
+        sb[sb.length] = this.getToggleElId() + '\').className=';
+        sb[sb.length] = getNode + '.getHoverStyle()"';
+        sb[sb.length] = ' onmouseout="document.getElementById(\'';
+        sb[sb.length] = this.getToggleElId() + '\').className=';
+        sb[sb.length] = getNode + '.getStyle()"';
+    }
+    sb[sb.length] = ' >';
+    sb[sb.length] = this.label;
+    sb[sb.length] = '</a>';
+    sb[sb.length] = '</td>';
+    sb[sb.length] = '</tr>';
+    sb[sb.length] = '</table>';
+
+    return sb.join("");
+};
+
+/**
+ * Executed when the label is clicked
+ * @param me {Node} this node
+ * @scope the anchor tag clicked
+ * @return false to cancel the anchor click
+ */
+YAHOO.widget.TextNode.prototype.onLabelClick = function(me) { 
+    //return true;
+};
+
+YAHOO.widget.TextNode.prototype.toString = function() { 
+    return "TextNode (" + this.index + ") " + this.label;
+};
+
+/**
+ * A menu-specific implementation that differs from TextNode in that only 
+ * one sibling can be expanded at a time.
+ * @extends YAHOO.widget.TextNode
+ * @constructor
+ */
+YAHOO.widget.MenuNode = function(oData, oParent, expanded) {
+	if (oData) { 
+		this.init(oData, oParent, expanded);
+		this.setUpLabel(oData);
+	}
+
+    /**
+     * Menus usually allow only one branch to be open at a time.
+     * @type boolean
+     */
+	this.multiExpand = false;
+
+    /**
+     * @private
+     */
+
+};
+
+YAHOO.widget.MenuNode.prototype = new YAHOO.widget.TextNode();
+
+YAHOO.widget.MenuNode.prototype.toString = function() { 
+    return "MenuNode (" + this.index + ") " + this.label;
+};
+
+/**
+ * This implementation takes either a string or object for the
+ * oData argument.  If is it a string, we will use it for the display
+ * of this node (and it can contain any html code).  If the parameter
+ * is an object, we look for a parameter called "html" that will be
+ * used for this node's display.
+ *
+ * @extends YAHOO.widget.Node
+ * @constructor
+ * @param oData {object} a string or object containing the data that will
+ * be used to render this node
+ * @param oParent {YAHOO.widget.Node} this node's parent node
+ * @param expanded {boolean} the initial expanded/collapsed state
+ * @param hasIcon {boolean} specifies whether or not leaf nodes should
+ * have an icon
+ */
+YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {
+    if (oData) { 
+        this.init(oData, oParent, expanded);
+        this.initContent(oData, hasIcon);
+    }
+};
+
+YAHOO.widget.HTMLNode.prototype = new YAHOO.widget.Node();
+
+/**
+ * The CSS class for the html content container.  Defaults to ygtvhtml, but 
+ * can be overridden to provide a custom presentation for a specific node.
+ *
+ * @type string
+ */
+YAHOO.widget.HTMLNode.prototype.contentStyle = "ygtvhtml";
+
+/**
+ * The generated id that will contain the data passed in by the implementer.
+ *
+ * @type string
+ */
+YAHOO.widget.HTMLNode.prototype.contentElId = null;
+
+/**
+ * The HTML content to use for this node's display
+ *
+ * @type string
+ */
+YAHOO.widget.HTMLNode.prototype.content = null;
+
+/**
+ * Sets up the node label
+ *
+ * @param {object} An html string or object containing an html property
+ * @param {boolean} hasIcon determines if the node will be rendered with an
+ * icon or not
+ */
+YAHOO.widget.HTMLNode.prototype.initContent = function(oData, hasIcon) { 
+    if (typeof oData == "string") {
+        oData = { html: oData };
+    }
+
+    this.html = oData.html;
+    this.contentElId = "ygtvcontentel" + this.index;
+    this.hasIcon = hasIcon;
+
+    /**
+     * @private
+     */
+};
+
+/**
+ * Returns the outer html element for this node's content
+ *
+ * @return {HTMLElement} the element
+ */
+YAHOO.widget.HTMLNode.prototype.getContentEl = function() { 
+    return document.getElementById(this.contentElId);
+};
+
+// overrides YAHOO.widget.Node
+YAHOO.widget.HTMLNode.prototype.getNodeHtml = function() { 
+    var sb = [];
+
+    sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';
+    sb[sb.length] = '<tr>';
+    
+    for (i=0;i<this.depth;++i) {
+        sb[sb.length] = '<td class="' + this.getDepthStyle(i) + '">&#160;</td>';
+    }
+
+    if (this.hasIcon) {
+        sb[sb.length] = '<td';
+        sb[sb.length] = ' id="' + this.getToggleElId() + '"';
+        sb[sb.length] = ' class="' + this.getStyle() + '"';
+        sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() + '"';
+        if (this.hasChildren(true)) {
+            sb[sb.length] = ' onmouseover="this.className=';
+            sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+            sb[sb.length] = this.tree.id + '\',' + this.index +  ').getHoverStyle()"';
+            sb[sb.length] = ' onmouseout="this.className=';
+            sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+            sb[sb.length] = this.tree.id + '\',' + this.index +  ').getStyle()"';
+        }
+        sb[sb.length] = '>&#160;</td>';
+    }
+
+    sb[sb.length] = '<td';
+    sb[sb.length] = ' id="' + this.contentElId + '"';
+    sb[sb.length] = ' class="' + this.contentStyle + '"';
+    sb[sb.length] = ' >';
+    sb[sb.length] = this.html;
+    sb[sb.length] = '</td>';
+    sb[sb.length] = '</tr>';
+    sb[sb.length] = '</table>';
+
+    return sb.join("");
+};
+
+YAHOO.widget.HTMLNode.prototype.toString = function() { 
+    return "HTMLNode (" + this.index + ")";
+};
+
+/**
+ * A static factory class for tree view expand/collapse animations
+ *
+ * @constructor
+ */
+YAHOO.widget.TVAnim = function() {
+    return {
+        /**
+         * Constant for the fade in animation
+         * 
+         * @type string
+         */
+        FADE_IN: "TVFadeIn",
+
+        /**
+         * Constant for the fade out animation
+         * 
+         * @type string
+         */
+        FADE_OUT: "TVFadeOut",
+
+        /**
+         * Returns a ygAnim instance of the given type
+         *
+         * @param type {string} the type of animation
+         * @param el {HTMLElement} the element to element (probably the children div)
+         * @param callback {function} function to invoke when the animation is done.
+         * @return {YAHOO.util.Animation} the animation instance
+         */
+        getAnim: function(type, el, callback) {
+            if (YAHOO.widget[type]) {
+                return new YAHOO.widget[type](el, callback);
+            } else {
+                return null;
+            }
+        },
+
+        /**
+         * Returns true if the specified animation class is available
+         *
+         * @param type {string} the type of animation
+         * @return {boolean} true if valid, false if not
+         */
+        isValid: function(type) {
+            return (YAHOO.widget[type]);
+        }
+    };
+} ();
+
+/**
+ * A 1/2 second fade-in animation.
+ *
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeIn = function(el, callback) {
+    /**
+     * The element to animate
+     * @type HTMLElement
+     */
+    this.el = el;
+
+    /**
+     * the callback to invoke when the animation is complete
+     *
+     * @type function
+     */
+    this.callback = callback;
+
+    /**
+     * @private
+     */
+};
+
+/**
+ * Performs the animation
+ */
+YAHOO.widget.TVFadeIn.prototype = {
+    animate: function() {
+        var tvanim = this;
+
+        var s = this.el.style;
+        s.opacity = 0.1;
+        s.filter = "alpha(opacity=10)";
+        s.display = "";
+
+        // var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;
+        var dur = 0.4; 
+        // var a = new ygAnim_Fade(this.el, dur, 1);
+        // a.setStart(0.1);
+        // a.onComplete = function() { tvanim.onComplete(); };
+
+        // var a = new YAHOO.util.Anim(this.el, 'opacity', 0.1, 1);
+        var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);
+        a.onComplete.subscribe( function() { tvanim.onComplete(); } );
+        a.animate();
+    },
+
+    /**
+     * Clean up and invoke callback
+     */
+    onComplete: function() {
+        this.callback();
+    },
+
+    toString: function() {
+        return "TVFadeIn";
+    }
+};
+
+/**
+ * A 1/2 second fade out animation.
+ *
+ * @constructor
+ * @param el {HTMLElement} the element to animate
+ * @param callback {Function} function to invoke when the animation is finished
+ */
+YAHOO.widget.TVFadeOut = function(el, callback) {
+    /**
+     * The element to animate
+     * @type HTMLElement
+     */
+    this.el = el;
+
+    /**
+     * the callback to invoke when the animation is complete
+     *
+     * @type function
+     */
+    this.callback = callback;
+
+    /**
+     * @private
+     */
+};
+
+/**
+ * Performs the animation
+ */
+YAHOO.widget.TVFadeOut.prototype = {
+    animate: function() {
+        var tvanim = this;
+        // var dur = ( navigator.userAgent.match(/msie/gi) ) ? 0.05 : 0.4;
+        var dur = 0.4;
+        // var a = new ygAnim_Fade(this.el, dur, 0.1);
+        // a.onComplete = function() { tvanim.onComplete(); };
+
+        // var a = new YAHOO.util.Anim(this.el, 'opacity', 1, 0.1);
+        var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);
+        a.onComplete.subscribe( function() { tvanim.onComplete(); } );
+        a.animate();
+    },
+
+    /**
+     * Clean up and invoke callback
+     */
+    onComplete: function() {
+        var s = this.el.style;
+        s.display = "none";
+        // s.opacity = 1;
+        s.filter = "alpha(opacity=100)";
+        this.callback();
+    },
+
+    toString: function() {
+        return "TVFadeOut";
+    }
+};
+
Index: /branches/mobile/html/test/kakinaka/js/treeview/treeview-min.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/treeview/treeview-min.js	(revision 7213)
+++ /branches/mobile/html/test/kakinaka/js/treeview/treeview-min.js	(revision 7213)
@@ -0,0 +1,1 @@
+/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ YAHOO.widget.TreeView=function(id){if(id){this.init(id);}};YAHOO.widget.TreeView.nodeCount=0;YAHOO.widget.TreeView.prototype={id:null,_el:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,setExpandAnim:function(_2){if(YAHOO.widget.TVAnim.isValid(_2)){this._expandAnim=_2;}},setCollapseAnim:function(_3){if(YAHOO.widget.TVAnim.isValid(_3)){this._collapseAnim=_3;}},animateExpand:function(el){if(this._expandAnim&&this._animCount<this.maxAnim){var _5=this;var a=YAHOO.widget.TVAnim.getAnim(this._expandAnim,el,function(){_5.expandComplete();});if(a){++this._animCount;a.animate();}return true;}return false;},animateCollapse:function(el){if(this._collapseAnim&&this._animCount<this.maxAnim){var _7=this;var a=YAHOO.widget.TVAnim.getAnim(this._collapseAnim,el,function(){_7.collapseComplete();});if(a){++this._animCount;a.animate();}return true;}return false;},expandComplete:function(){--this._animCount;},collapseComplete:function(){--this._animCount;},init:function(id){this.id=id;if("string"!==typeof id){this._el=id;this.id=this.generateId(id);}this._nodes=[];YAHOO.widget.TreeView.trees[this.id]=this;this.root=new YAHOO.widget.RootNode(this);},draw:function(){var _8=this.root.getHtml();this.getEl().innerHTML=_8;this.firstDraw=false;},getEl:function(){if(!this._el){this._el=document.getElementById(this.id);}return this._el;},regNode:function(_9){this._nodes[_9.index]=_9;},getRoot:function(){return this.root;},setDynamicLoad:function(_10,_11){this.root.setDynamicLoad(_10,_11);},expandAll:function(){if(!this.locked){this.root.expandAll();}},collapseAll:function(){if(!this.locked){this.root.collapseAll();}},getNodeByIndex:function(_12){var n=this._nodes[_12];return (n)?n:null;},getNodeByProperty:function(_14,_15){for(var i in this._nodes){var n=this._nodes[i];if(n.data&&_15==n.data[_14]){return n;}}return null;},getNodesByProperty:function(_17,_18){var _19=[];for(var i in this._nodes){var n=this._nodes[i];if(n.data&&_18==n.data[_17]){_19.push(n);}}return (_19.length)?_19:null;},removeNode:function(_20,_21){if(_20.isRoot()){return false;}var p=_20.parent;if(p.parent){p=p.parent;}this._deleteNode(_20);if(_21&&p&&p.childrenRendered){p.refresh();}return true;},removeChildren:function(_23){while(_23.children.length){this._deleteNode(_23.children[0]);}_23.childrenRendered=false;_23.dynamicLoadComplete=false;_23.expand();_23.collapse();},_deleteNode:function(_24){this.removeChildren(_24);this.popNode(_24);},popNode:function(_25){var p=_25.parent;var a=[];for(var i=0,len=p.children.length;i<len;++i){if(p.children[i]!=_25){a[a.length]=p.children[i];}}p.children=a;p.childrenRendered=false;if(_25.previousSibling){_25.previousSibling.nextSibling=_25.nextSibling;}if(_25.nextSibling){_25.nextSibling.previousSibling=_25.previousSibling;}_25.parent=null;_25.previousSibling=null;_25.nextSibling=null;_25.tree=null;delete this._nodes[_25.index];},toString:function(){return "TreeView "+this.id;},generateId:function(el){var id=el.id;if(!id){id="yui-tv-auto-id-"+YAHOO.widget.TreeView.counter;YAHOO.widget.TreeView.counter++;}return id;},onExpand:function(_26){},onCollapse:function(_27){}};YAHOO.widget.TreeView.trees=[];YAHOO.widget.TreeView.counter=0;YAHOO.widget.TreeView.getTree=function(_28){var t=YAHOO.widget.TreeView.trees[_28];return (t)?t:null;};YAHOO.widget.TreeView.getNode=function(_30,_31){var t=YAHOO.widget.TreeView.getTree(_30);return (t)?t.getNodeByIndex(_31):null;};YAHOO.widget.TreeView.addHandler=function(el,_32,fn,_34){_34=(_34)?true:false;if(el.addEventListener){el.addEventListener(_32,fn,_34);}else{if(el.attachEvent){el.attachEvent("on"+_32,fn);}else{el["on"+_32]=fn;}}};YAHOO.widget.TreeView.preload=function(_35){_35=_35||"ygtv";var _36=["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];var sb=[];for(var i=0;i<_36.length;++i){sb[sb.length]="<span class=\""+_35+_36[i]+"\">&#160;</span>";}var f=document.createElement("DIV");var s=f.style;s.position="absolute";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);};YAHOO.widget.TreeView.addHandler(window,"load",YAHOO.widget.TreeView.preload);YAHOO.widget.Node=function(_40,_41,_42){if(_40){this.init(_40,_41,_42);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,_type:"Node",init:function(_43,_44,_45){this.data=_43;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.expanded=_45;if(_44){_44.appendChild(this);}},applyParent:function(_46){if(!_46){return false;}this.tree=_46.tree;this.parent=_46;this.depth=_46.depth+1;if(!this.href){this.href="javascript:"+this.getToggleLink();}if(!this.multiExpand){this.multiExpand=_46.multiExpand;}this.tree.regNode(this);_46.childrenRendered=false;for(var i=0,len=this.children.length;i<len;++i){this.children[i].applyParent(this);}return true;},appendChild:function(_47){if(this.hasChildren()){var sib=this.children[this.children.length-1];sib.nextSibling=_47;_47.previousSibling=sib;}this.children[this.children.length]=_47;_47.applyParent(this);return _47;},appendTo:function(_49){return _49.appendChild(this);},insertBefore:function(_50){var p=_50.parent;if(p){if(this.tree){this.tree.popNode(this);}var _51=_50.isChildOf(p);p.children.splice(_51,0,this);if(_50.previousSibling){_50.previousSibling.nextSibling=this;}this.previousSibling=_50.previousSibling;this.nextSibling=_50;_50.previousSibling=this;this.applyParent(p);}return this;},insertAfter:function(_52){var p=_52.parent;if(p){if(this.tree){this.tree.popNode(this);}var _53=_52.isChildOf(p);if(!_52.nextSibling){return this.appendTo(p);}p.children.splice(_53+1,0,this);_52.nextSibling.previousSibling=this;this.previousSibling=_52;this.nextSibling=_52.nextSibling;_52.nextSibling=this;this.applyParent(p);}return this;},isChildOf:function(_54){if(_54&&_54.children){for(var i=0,len=_54.children.length;i<len;++i){if(_54.children[i]===this){return i;}}}return -1;},getSiblings:function(){return this.parent.children;},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl())){if(this.hasChildren()){this.getChildrenEl().style.display="";}}},hideChildren:function(){if(!this.tree.animateCollapse(this.getChildrenEl())){this.getChildrenEl().style.display="none";}},getElId:function(){return "ygtv"+this.index;},getChildrenElId:function(){return "ygtvc"+this.index;},getToggleElId:function(){return "ygtvt"+this.index;},getEl:function(){return document.getElementById(this.getElId());},getChildrenEl:function(){return document.getElementById(this.getChildrenElId());},getToggleEl:function(){return document.getElementById(this.getToggleElId());},getToggleLink:function(){return "YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+").toggle()";},collapse:function(){if(!this.expanded){return;}var ret=this.tree.onCollapse(this);if("undefined"!=typeof ret&&!ret){return;}if(!this.getEl()){this.expanded=false;return;}this.hideChildren();this.expanded=false;if(this.hasIcon){this.getToggleEl().className=this.getStyle();}},expand:function(){if(this.expanded){return;}var ret=this.tree.onExpand(this);if("undefined"!=typeof ret&&!ret){return;}if(!this.getEl()){this.expanded=true;return;}if(!this.childrenRendered){this.getChildrenEl().innerHTML=this.renderChildren();}else{}this.expanded=true;if(this.hasIcon){this.getToggleEl().className=this.getStyle();}if(this.isLoading){this.expanded=false;return;}if(!this.multiExpand){var _56=this.getSiblings();for(var i=0;i<_56.length;++i){if(_56[i]!=this&&_56[i].expanded){_56[i].collapse();}}}this.showChildren();},getStyle:function(){if(this.isLoading){return "ygtvloading";}else{var loc=(this.nextSibling)?"t":"l";var _58="n";if(this.hasChildren(true)||(this.isDynamic()&&!this.getIconMode())){_58=(this.expanded)?"m":"p";}return "ygtv"+loc+_58;}},getHoverStyle:function(){var s=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){s+="h";}return s;},expandAll:function(){for(var i=0;i<this.children.length;++i){var c=this.children[i];if(c.isDynamic()){alert("Not supported (lazy load + expand all)");break;}else{if(!c.multiExpand){alert("Not supported (no multi-expand + expand all)");break;}else{c.expand();c.expandAll();}}}},collapseAll:function(){for(var i=0;i<this.children.length;++i){this.children[i].collapse();this.children[i].collapseAll();}},setDynamicLoad:function(_60,_61){if(_60){this.dataLoader=_60;this._dynLoad=true;}else{this.dataLoader=null;this._dynLoad=false;}if(_61){this.iconMode=_61;}},isRoot:function(){return (this==this.tree.root);},isDynamic:function(){var _62=(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));return _62;},getIconMode:function(){return (this.iconMode||this.tree.root.iconMode);},hasChildren:function(_63){return (this.children.length>0||(_63&&this.isDynamic()&&!this.dynamicLoadComplete));},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){var sb=[];sb[sb.length]="<div class=\"ygtvitem\" id=\""+this.getElId()+"\">";sb[sb.length]=this.getNodeHtml();sb[sb.length]=this.getChildrenHtml();sb[sb.length]="</div>";return sb.join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]="<div class=\"ygtvchildren\"";sb[sb.length]=" id=\""+this.getChildrenElId()+"\"";if(!this.expanded){sb[sb.length]=" style=\"display:none;\"";}sb[sb.length]=">";if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){sb[sb.length]=this.renderChildren();}sb[sb.length]="</div>";return sb.join("");},renderChildren:function(){var _64=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){_64.dataLoader(_64,function(){_64.loadComplete();});},10);}else{if(this.tree.root.dataLoader){setTimeout(function(){_64.tree.root.dataLoader(_64,function(){_64.loadComplete();});},10);}else{return "Error: data loader not found or not specified.";}}return "";}else{return this.completeRender();}},completeRender:function(){var sb=[];for(var i=0;i<this.children.length;++i){this.children[i].childrenRendered=false;sb[sb.length]=this.children[i].getHtml();}this.childrenRendered=true;return sb.join("");},loadComplete:function(){this.getChildrenEl().innerHTML=this.completeRender();this.dynamicLoadComplete=true;this.isLoading=false;this.expand();this.tree.locked=false;},getAncestor:function(_65){if(_65>=this.depth||_65<0){return null;}var p=this.parent;while(p.depth>_65){p=p.parent;}return p;},getDepthStyle:function(_66){return (this.getAncestor(_66).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){return "";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=this.getStyle();}}},toString:function(){return "Node ("+this.index+")";}};YAHOO.widget.RootNode=function(_67){this.init(null,null,true);this.tree=_67;};YAHOO.widget.RootNode.prototype=new YAHOO.widget.Node();YAHOO.widget.RootNode.prototype.getNodeHtml=function(){return "";};YAHOO.widget.RootNode.prototype.toString=function(){return "RootNode";};YAHOO.widget.RootNode.prototype.loadComplete=function(){this.tree.draw();};YAHOO.widget.TextNode=function(_68,_69,_70){if(_68){this.init(_68,_69,_70);this.setUpLabel(_68);}};YAHOO.widget.TextNode.prototype=new YAHOO.widget.Node();YAHOO.widget.TextNode.prototype.labelStyle="ygtvlabel";YAHOO.widget.TextNode.prototype.labelElId=null;YAHOO.widget.TextNode.prototype.label=null;YAHOO.widget.TextNode.prototype.setUpLabel=function(_71){if(typeof _71=="string"){_71={label:_71};}this.label=_71.label;if(_71.href){this.href=_71.href;}if(_71.target){this.target=_71.target;}if(_71.style){this.labelStyle=_71.style;}this.labelElId="ygtvlabelel"+this.index;};YAHOO.widget.TextNode.prototype.getLabelEl=function(){return document.getElementById(this.labelElId);};YAHOO.widget.TextNode.prototype.getNodeHtml=function(){var sb=[];sb[sb.length]="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";sb[sb.length]="<tr>";for(i=0;i<this.depth;++i){sb[sb.length]="<td class=\""+this.getDepthStyle(i)+"\">&#160;</td>";}var _72="YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+")";sb[sb.length]="<td";sb[sb.length]=" id=\""+this.getToggleElId()+"\"";sb[sb.length]=" class=\""+this.getStyle()+"\"";if(this.hasChildren(true)){sb[sb.length]=" onmouseover=\"this.className=";sb[sb.length]=_72+".getHoverStyle()\"";sb[sb.length]=" onmouseout=\"this.className=";sb[sb.length]=_72+".getStyle()\"";}sb[sb.length]=" onclick=\"javascript:"+this.getToggleLink()+"\">";sb[sb.length]="&#160;";sb[sb.length]="</td>";sb[sb.length]="<td>";sb[sb.length]="<a";sb[sb.length]=" id=\""+this.labelElId+"\"";sb[sb.length]=" class=\""+this.labelStyle+"\"";sb[sb.length]=" href=\""+this.href+"\"";sb[sb.length]=" target=\""+this.target+"\"";sb[sb.length]=" onclick=\"return "+_72+".onLabelClick("+_72+")\"";if(this.hasChildren(true)){sb[sb.length]=" onmouseover=\"document.getElementById('";sb[sb.length]=this.getToggleElId()+"').className=";sb[sb.length]=_72+".getHoverStyle()\"";sb[sb.length]=" onmouseout=\"document.getElementById('";sb[sb.length]=this.getToggleElId()+"').className=";sb[sb.length]=_72+".getStyle()\"";}sb[sb.length]=" >";sb[sb.length]=this.label;sb[sb.length]="</a>";sb[sb.length]="</td>";sb[sb.length]="</tr>";sb[sb.length]="</table>";return sb.join("");};YAHOO.widget.TextNode.prototype.onLabelClick=function(me){};YAHOO.widget.TextNode.prototype.toString=function(){return "TextNode ("+this.index+") "+this.label;};YAHOO.widget.MenuNode=function(_74,_75,_76){if(_74){this.init(_74,_75,_76);this.setUpLabel(_74);}this.multiExpand=false;};YAHOO.widget.MenuNode.prototype=new YAHOO.widget.TextNode();YAHOO.widget.MenuNode.prototype.toString=function(){return "MenuNode ("+this.index+") "+this.label;};YAHOO.widget.HTMLNode=function(_77,_78,_79,_80){if(_77){this.init(_77,_78,_79);this.initContent(_77,_80);}};YAHOO.widget.HTMLNode.prototype=new YAHOO.widget.Node();YAHOO.widget.HTMLNode.prototype.contentStyle="ygtvhtml";YAHOO.widget.HTMLNode.prototype.contentElId=null;YAHOO.widget.HTMLNode.prototype.content=null;YAHOO.widget.HTMLNode.prototype.initContent=function(_81,_82){if(typeof _81=="string"){_81={html:_81};}this.html=_81.html;this.contentElId="ygtvcontentel"+this.index;this.hasIcon=_82;};YAHOO.widget.HTMLNode.prototype.getContentEl=function(){return document.getElementById(this.contentElId);};YAHOO.widget.HTMLNode.prototype.getNodeHtml=function(){var sb=[];sb[sb.length]="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";sb[sb.length]="<tr>";for(i=0;i<this.depth;++i){sb[sb.length]="<td class=\""+this.getDepthStyle(i)+"\">&#160;</td>";}if(this.hasIcon){sb[sb.length]="<td";sb[sb.length]=" id=\""+this.getToggleElId()+"\"";sb[sb.length]=" class=\""+this.getStyle()+"\"";sb[sb.length]=" onclick=\"javascript:"+this.getToggleLink()+"\"";if(this.hasChildren(true)){sb[sb.length]=" onmouseover=\"this.className=";sb[sb.length]="YAHOO.widget.TreeView.getNode('";sb[sb.length]=this.tree.id+"',"+this.index+").getHoverStyle()\"";sb[sb.length]=" onmouseout=\"this.className=";sb[sb.length]="YAHOO.widget.TreeView.getNode('";sb[sb.length]=this.tree.id+"',"+this.index+").getStyle()\"";}sb[sb.length]=">&#160;</td>";}sb[sb.length]="<td";sb[sb.length]=" id=\""+this.contentElId+"\"";sb[sb.length]=" class=\""+this.contentStyle+"\"";sb[sb.length]=" >";sb[sb.length]=this.html;sb[sb.length]="</td>";sb[sb.length]="</tr>";sb[sb.length]="</table>";return sb.join("");};YAHOO.widget.HTMLNode.prototype.toString=function(){return "HTMLNode ("+this.index+")";};YAHOO.widget.TVAnim=function(){return {FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(_83,el,_84){if(YAHOO.widget[_83]){return new YAHOO.widget[_83](el,_84);}else{return null;}},isValid:function(_85){return (YAHOO.widget[_85]);}};}();YAHOO.widget.TVFadeIn=function(el,_86){this.el=el;this.callback=_86;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var _87=this;var s=this.el.style;s.opacity=0.1;s.filter="alpha(opacity=10)";s.display="";var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);a.onComplete.subscribe(function(){_87.onComplete();});a.animate();},onComplete:function(){this.callback();},toString:function(){return "TVFadeIn";}};YAHOO.widget.TVFadeOut=function(el,_89){this.el=el;this.callback=_89;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var _90=this;var dur=0.4;var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);a.onComplete.subscribe(function(){_90.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();},toString:function(){return "TVFadeOut";}};
Index: /branches/mobile/html/test/kakinaka/js/log.js
===================================================================
--- /branches/mobile/html/test/kakinaka/js/log.js	(revision 7219)
+++ /branches/mobile/html/test/kakinaka/js/log.js	(revision 7219)
@@ -0,0 +1,15 @@
+// Adapter for YAHOO.widget.Logger
+
+var ygLogger = function(module) {
+    return new YAHOO.widget.LogWriter(module);
+};
+
+YAHOO.widget.LogWriter.prototype.debug = function() {
+    this.log.apply(this, arguments);
+};
+
+ygLogger.init = function(div) {
+   new YAHOO.widget.LogReader(div, { 
+            height: "400px" 
+        });
+};
Index: /branches/mobile/html/test/kakinaka/list.html
===================================================================
--- /branches/mobile/html/test/kakinaka/list.html	(revision 7020)
+++ /branches/mobile/html/test/kakinaka/list.html	(revision 7020)
@@ -0,0 +1,47 @@
+<html>
+<head>
+<link rel="stylesheet" href="./top_default.css" type="text/css" media="all" />
+</head>
+<body>
+
+<div id="wraper">
+<div align="center">
+<a name="top" id="top"></a>
+	<div id="container">
+	<div id="main-column">
+		<div class="box01">
+			<div class="box03">
+				<h2><img src="http://www.tokado.jp/img/renewal/main_column_box03_ttl.gif" alt="¥È¥Ô¥Ã¥¯¥¹" width="600" height="19" ></h2>
+				<div>
+					<ul>
+			            <li><span class="day"> ¡Ú10/20¡Û</span><span class="topic-txt"> <strong>¥È¡¼¥«Æ²¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥·¥ç¥Ã¥Ô¥ó¥°¥ê¥Ë¥å¡¼¥¢¥ë¥ª¡¼¥×¥ó¡ª</strong></span></li>
+			            <li class="bg-gray"><span class="day"> ¡Ú10/12¡Û</span><span class="topic-txt"> 
+			              <a href="/products/list-c559.html">¿Íµ¤¥Ö¥é¥ó¥É¥³¡¼¥Á¤Î»þ·×¤¬ºÇÂç57¡óOFF¡ª¡ª¡ª</a></span></li>
+			            <li><span class="day"> ¡Ú10/11¡Û</span><span class="topic-txt"> <a href="/products/list-c558.html">¹âµé¥Ö¥é¥ó¥É 
+			              ¥·¥ã¥Í¥ë¤Î»þ·×¤¬ÂçÆÃ²Á¤ÇÈÎÇä³«»Ï¡ª</a></span></li>
+			            <li class="bg-gray"><span class="day"> ¡Ú10/10¡Û</span><span class="topic-txt"> 
+			              <a href="/products/list-c557.html">½÷À­¤ËÂç¿Íµ¤¤Î¥Õ¥©¥ê¥Õ¥©¥ê»þ·×¤¬·ã°Â¤ÇÆþ²Ù¡ª</a></span></li>
+			            <li><span class="day"> ¡Ú10/6¡Û</span><span class="topic-txt"> <a href="/products/list-c556.html">ºÇÂç64¡óOFF¡ª¥°¥Ã¥Á¤Î»þ·×ÆÃÊÌ²Á³Ê¤ÇÈÎÇä³«»Ï¡ª¡ª</a></span></li>
+			            <li class="bg-gray"><span class="day"> ¡Ú10/3¡Û</span><span class="topic-txt"> 
+			              ¥¯¥ê¥Ë¡¼¥¯¤Ê¤É³¤³°¥Ö¥é¥ó¥É²½¾ÑÉÊ°ìµó£´£°£°ÅÀÆþ²Ù¡ª¡ª<a href="/products/list-c486.html">¥¹¥­¥ó¥±¥¢</a>¡¡<a href="/products/list-c485.html">¥á¥¤¥¯¥¢¥Ã¥×</a></span></li>
+			            <li><span class="day"> ¡Ú9/27¡Û</span><span class="topic-txt"> <a href="/products/list-c509.html">¥«¥ë¥Æ¥£¥¨¤Î»þ·×¤¬ÂçÆÃ²Á¡ªËÜÆüÂçÎÌÆþ²Ù¤¤¤¿¤·¤Þ¤·¤¿</a></span></li>
+			            <li class="bg-gray"><span class="day"> ¡Ú9/26¡Û</span><span class="topic-txt"> 
+			              <a href="/products/list-c482.html">ºÇÂç£´£¸¡óOFF¡ª¥Ö¥é¥ó¥É»þ·×¡Ú¥Ö¥ë¥¬¥ê¡ÛÂçÎÌÆþ²Ù¡ª¡ª</a></span></li>
+			            <li><span class="day"> ¡Ú9/1¡Û</span><span class="topic-txt"> <a href="/products/list-c473.html">¥Ö¥é¥ó¥É»þ·×¡Ú¥ª¥á¥¬¡ÛÂçÆÃ²Á¥»¡¼¥ë³«ºÅÃæ¡ª¡ª</a></span></li>
+			            <li class="bg-gray"><span class="day"> ¡Ú£²ÇÜ¡Û</span><span class="topic-txt"> 
+			              <a href="/products/list-c64.html">º£¤À¤±¡ª±Õ¾½¥Æ¥ì¥Ó¡Ø¥¢¥¯¥ª¥¹¡Ù¡ú¥Ý¥¤¥ó¥È£²ÇÜÃæ¡ú</a></span></li>
+			            <li><span class="day"> ¡ÚÆÃ½¸¡Û</span><span class="topic-txt"> <a href="/campaign/07ruby/index.html">À¤³¦¤Ë2¤Ä¤ÈÌµ¤¤¹âÉÊ¼Á¥ë¥Ó¡¼¥¸¥å¥¨¥ê¡¼ÆÃ½¸¡ª¡ª</a></span></li>
+			            <li class="bg-gray"><span class="day"> ¡ÚÆÃ½¸¡Û</span><span class="topic-txt"> 
+			              <a href="/campaign/04mio/index.htm">¥è¡¼¥í¥Ã¥Ñ¤ÇÂç¿Íµ¤¤Î¥Ê¥Ó¥²¡¼¥·¥ç¥ó¡ÖMio¡×Å°Äì²òË¶¡ª</a></span></li>
+					</ul>
+				</div>
+			</div>
+		</div>
+	</div>
+	<br class="float-clear">
+</div>
+
+</div>
+<!-- wrap_end -->
+</body>
+</html>
Index: /branches/mobile/html/test/kakinaka/send.php
===================================================================
--- /branches/mobile/html/test/kakinaka/send.php	(revision 8651)
+++ /branches/mobile/html/test/kakinaka/send.php	(revision 8651)
@@ -0,0 +1,34 @@
+<?php
+
+require_once("../../require.php");
+require_once(DATA_PATH . "module/Request.php");
+
+//$order_url = "http://test.ec-cube.net/ec-cube/load_module.php?module_id=4";
+$order_url = "http://test.ec-cube.net/ec-cube/test/kakinaka/epsilon_check.php";
+
+$arrData = array(
+	'order_number' => '1',
+	'trans_code' => '1',
+	'paid' => 1	
+);
+
+$req = new HTTP_Request($order_url);
+$req->setMethod(HTTP_REQUEST_METHOD_POST);
+		
+$arrSendData = array();
+$req->addPostDataArray($arrData);
+if (!PEAR::isError($req->sendRequest())) {
+	echo("Á÷¿®´°Î»");
+} else {
+	echo("Á÷¿®¼ºÇÔ");
+}
+
+sfprintr($req->getResponseBody());
+sfprintr($req->getResponseHeader());
+
+
+$body = "Content-Type: text/plain
+
+1";
+
+?>
Index: /branches/mobile/html/test/naka/mail_test.php
===================================================================
--- /branches/mobile/html/test/naka/mail_test.php	(revision 10430)
+++ /branches/mobile/html/test/naka/mail_test.php	(revision 10430)
@@ -0,0 +1,10 @@
+<?php
+
+$to = "naka@tokado.jp";
+$body = "¥Æ¥¹¥È¤Ç¤¹¤Í¤ó¡£";
+$body = mb_convert_encoding($body, 'JIS', "EUC-JP");
+
+if(mb_send_mail($to, "test", $body)){
+	print("ok");
+}
+?>
Index: /branches/mobile/html/test/naka/mail.php
===================================================================
--- /branches/mobile/html/test/naka/mail.php	(revision 7046)
+++ /branches/mobile/html/test/naka/mail.php	(revision 7046)
@@ -0,0 +1,26 @@
+<?php
+
+ini_set("mbstring.http_output", "UTF-8");
+ini_set("mbstring.internal_encoding", "UTF-8");
+
+$to = "naka@lockon.co.jp";
+$body = "¥Æ¥¹¥È¤Ç¤¹¡£¥¢¥¤¥¦¥í¥¨??????¼ô??";
+
+$body = mb_convert_encoding($body, 'UTF-8', "EUC-JP");
+
+print("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body>\n");
+print("<b>" . $body . "</b>");
+
+echo("</body></html>");
+
+/*
+mb_language("uni");
+
+if(mb_send_mail($to, "test", $body)){
+	print("ok");
+}
+*/
+
+
+
+?>
Index: /branches/mobile/html/test/naka/index.html
===================================================================
--- /branches/mobile/html/test/naka/index.html	(revision 6643)
+++ /branches/mobile/html/test/naka/index.html	(revision 6643)
@@ -0,0 +1,1 @@
+¥Ë¥ç¥í¡§¢·
Index: /branches/mobile/html/test/naka/test.txt
===================================================================
--- /branches/mobile/html/test/naka/test.txt	(revision 10547)
+++ /branches/mobile/html/test/naka/test.txt	(revision 10547)
@@ -0,0 +1,1 @@
+aaaabcdef
Index: /branches/mobile/html/test/naka/send.php
===================================================================
--- /branches/mobile/html/test/naka/send.php	(revision 8283)
+++ /branches/mobile/html/test/naka/send.php	(revision 8283)
@@ -0,0 +1,78 @@
+<?php
+
+require_once("../../require.php");
+require_once(DATA_PATH . "module/Request.php");
+
+$order_url = "https://beta.epsilon.jp/cgi-bin/order/receive_order3.cgi";
+
+$arrData = array(
+	'order_number' => '93963928111111111113',
+	'st_code' => '00100-0000-00000',
+	'memo1' => '»î¸³ÍÑ¥ª¡¼¥À¡¼¾ðÊó',
+	'user_mail_add' => 'naka@lockon.co.jp',
+	'item_name' => '¥×¥ê¥ó¥¿',
+	'contract_code' => '13094800',
+	'user_name' => 'naka',
+	'process_code' => '1',
+	'mission_code' => '1',
+	'item_price' => '34800',
+	'xml' => '1',		
+	'item_code' => 'abc12345',
+	'memo2' => '',
+	'user_id' => 'ktest'
+	,'conveni_code' => '11'
+	
+);
+
+$req = new HTTP_Request($order_url);
+$req->setMethod(HTTP_REQUEST_METHOD_POST);
+		
+$arrSendData = array();
+$req->addPostDataArray($arrData);
+
+if (!PEAR::isError($req->sendRequest())) {
+	$response = $req->getResponseBody();
+} else {
+	$response = "";
+}
+$req->clearPostData();
+
+$parser = xml_parser_create();
+xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
+xml_parse_into_struct($parser,$response,$arrVal,$idx);
+xml_parser_free($parser);
+
+$err_code = lfGetXMLValue($arrVal,'RESULT','ERR_CODE');
+
+if($err_code != "") {
+	$err_detail = lfGetXMLValue($arrVal,'RESULT','ERR_DETAIL');
+	print($err_detail);
+} else {
+	$url = lfGetXMLValue($arrVal,'RESULT','REDIRECT');
+	
+	sfprintr($arrVal);
+	//header("Location: " . $url);	
+}
+
+
+function lfGetXMLValue($arrVal, $tag, $att) {
+	$ret = "";
+	foreach($arrVal as $array) {
+		if($tag == $array['tag']) {
+			if(!is_array($array['attributes'])) {
+				continue;
+			}
+			foreach($array['attributes'] as $key => $val) {
+				if($key == $att) {
+					$ret = $val;
+					break;
+				}
+			}			
+		}
+	}
+	$dec = urldecode($ret);
+	$enc = mb_convert_encoding($dec, 'EUC-JP', 'auto');
+	return $enc;
+}
+
+?>
Index: /branches/mobile/html/test/naka/info.php
===================================================================
--- /branches/mobile/html/test/naka/info.php	(revision 10169)
+++ /branches/mobile/html/test/naka/info.php	(revision 10169)
@@ -0,0 +1,4 @@
+<?php
+require_once("../../require.php");
+	phpinfo();
+?>
Index: /branches/mobile/html/test/naka/shopcgi.php
===================================================================
--- /branches/mobile/html/test/naka/shopcgi.php	(revision 7841)
+++ /branches/mobile/html/test/naka/shopcgi.php	(revision 7841)
@@ -0,0 +1,102 @@
+<?php
+
+require_once("../../require.php");
+require_once(DATA_PATH . "module/Request.php");
+
+$entry_url = "http://mod-i.ccsware.net/ohayou/EntryTran.php";
+$exec_url = "https://mod-i.ccsware.net/ohayou/ExecTran.php";
+// ¼õÃíÈÖ¹æ¤Î¼èÆÀ
+$order_id = sfGetUniqRandomId();
+
+// Å¹ÊÞ¾ðÊó¤ÎÁ÷¿®
+$arrData = array(
+	'OrderId' => $order_id,		// Å¹ÊÞ¤´¤È¤Ë°ì°Õ¤ÊÃíÊ¸ID¤òÁ÷¿®¤¹¤ë¡£
+	'TdTenantName' => '',		// 3DÇ§¾Ú»þÉ½¼¨ÍÑÅ¹ÊÞÌ¾
+	'TdFlag' => '',				// 3D¥Õ¥é¥°
+	'ShopId' => 'test000003087',// ¥·¥ç¥Ã¥×ID
+	'ShopPass' => 'lockon',		// ¥·¥ç¥Ã¥×¥Ñ¥¹¥ï¡¼¥É
+	'Currency' => 'JPN',		// ÄÌ²ß¥³¡¼¥É
+	'Amount' => '1000',			// ¶â³Û
+	'Tax' => '50',				// ¾ÃÈñÀÇ
+	'JobCd' => 'CHECK',			// ½èÍý¶èÊ¬
+	'TenantNo' => '111111111',	// cgi-4¤ÇºîÀ®¤·¤¿Å¹ÊÞID¤òÁ÷¿®¤¹¤ë¡£
+);
+
+$req = new HTTP_Request($entry_url);
+$req->setMethod(HTTP_REQUEST_METHOD_POST);
+		
+$req->addPostDataArray($arrData);
+
+if (!PEAR::isError($req->sendRequest())) {
+	$response = $req->getResponseBody();
+} else {
+	$response = "";
+}
+$req->clearPostData();
+$arrRet = lfGetPostArray($response);
+
+sfPrintR($arrRet);
+
+// ·èºÑ¾ðÊó¤ÎÁ÷¿®
+$arrData = array(
+	'AccessId' => $arrRet['ACCESS_ID'],
+	'AccessPass' => $arrRet['ACCESS_PASS'],
+	'OrderId' => $order_id,
+	'RetURL' => 'http://test.ec-cube.net/ec-cube/test/naka/recv.php',
+	// ¥×¥í¥Ñ¡¼¥«¡¼¥É¤ò°·¤ï¤Ê¤¤¾ì¹ç¤ÏVISA¸ÇÄê¤ÇOK
+	'CardType' => 'VISA, 11111, 111111111111111111111111111111111111, 1111111111',
+	// »ÙÊ§¤¤ÊýË¡
+	/*
+		1:°ì³ç
+		2:Ê¬³ä
+		3:¥Ü¡¼¥Ê¥¹°ì³ç
+		4:¥Ü¡¼¥Ê¥¹Ê¬³ä
+		5:¥ê¥ÜÊ§¤¤
+	 */
+	'Method' => '2',
+	// »ÙÊ§²ó¿ô
+	'PayTimes' => '4',
+	'CardNo1' => '4444',
+	'CardNo2' => '4444',
+	'CardNo3' => '4444',
+	'CardNo4' => '5780',
+    'ExpireMM' => '06',
+    'ExpireYY' => '07',
+	// ²ÃÌÁÅ¹¼«Í³¹àÌÜÊÖµÑ¥Õ¥é¥°
+    'ClientFieldFlag' => '1',
+    'ClientField1' => 'f1',
+    'ClientField2' => 'f2',
+    'ClientField3' => 'f3',
+	// ¥ê¥À¥¤¥ì¥¯¥È¥Ú¡¼¥¸¤Ç¤Î±þÅú¤ò¼õ¤±¼è¤é¤Ê¤¤
+	'ModiFlag' => '1',	
+);
+
+$req = new HTTP_Request($exec_url);
+$req->setMethod(HTTP_REQUEST_METHOD_POST);
+
+$req->addPostDataArray($arrData);
+
+if (!PEAR::isError($req->sendRequest())) {
+	$response = $req->getResponseBody();
+} else {
+	$response = "";
+}
+$req->clearPostData();
+
+$arrRet = lfGetPostArray($response);
+
+sfPrintR($arrRet);
+
+//---------------------------------------------------------------------------------------------------------------------------------
+function lfGetPostArray($text) {
+	if($text != "") {
+		$text = ereg_replace("[\n\r]", "", $text);
+		$arrTemp = split("&", $text);
+		foreach($arrTemp as $ret) {
+			list($key, $val) = split("=", $ret);
+			$arrRet[$key] = $val;
+		}
+	}
+	return $arrRet;
+}
+?>
Index: /branches/mobile/html/test/naka/recv.php
===================================================================
--- /branches/mobile/html/test/naka/recv.php	(revision 7812)
+++ /branches/mobile/html/test/naka/recv.php	(revision 7812)
@@ -0,0 +1,31 @@
+<?php
+require_once("../../require.php");
+require_once(DATA_PATH . "module/Request.php");
+
+$strmask = "/home/web/test.ec-cube.net/cgi-bin/ShopCGI/common/strmask/FreeBSD_4.4/strmask.exe";
+$cmd = $strmask . " -d " . $_GET['SendData'];
+
+$tmpResult = popen($cmd, "r");
+
+// ·ë²Ì¼èÆÀ
+while( ! FEOF ( $tmpResult ) ) {
+	$result .= FGETS($tmpResult);
+}
+pclose($tmpResult);				// 	¥Ñ¥¤¥×¤òÊÄ¤¸¤ë
+
+$arrRet = lfGetPostArray($result);
+gfDebugLog($arrRet);
+
+//---------------------------------------------------------------------------------------------------------------------------------
+function lfGetPostArray($text) {
+	if($text != "") {
+		$text = ereg_replace("[\n\r]", "", $text);
+		$arrTemp = split("&", $text);
+		foreach($arrTemp as $ret) {
+			list($key, $val) = split("=", $ret);
+			$arrRet[$key] = $val;
+		}
+	}
+	return $arrRet;
+}
+?>
Index: /branches/mobile/html/test/naka/test.php
===================================================================
--- /branches/mobile/html/test/naka/test.php	(revision 8542)
+++ /branches/mobile/html/test/naka/test.php	(revision 8542)
@@ -0,0 +1,27 @@
+<html lang="ja">
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=EUC-JP">
+</head>
+
+<body>
+
+<table>
+<form name="form1" action="test.php" method="POST">
+<tr>
+	<td>Ê¸»ú¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤</td>
+	<td><input type="text" name="string"></td>
+	<td><input type="submit" value="Á÷¿®"></td>
+</tr>
+</form>
+</table>
+
+<?php
+require_once("../../require.php");
+
+    if(isset($_POST['string'])) {
+        print("string is " . $_POST['string']);
+    }
+?>
+
+</body>
+</html>
Index: /branches/mobile/html/shopping/deliv.php
===================================================================
--- /branches/mobile/html/shopping/deliv.php	(revision 10399)
+++ /branches/mobile/html/shopping/deliv.php	(revision 10399)
@@ -0,0 +1,302 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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 = URL_DIR.'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 del_flg = 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: /branches/mobile/html/shopping/index.php
===================================================================
--- /branches/mobile/html/shopping/index.php	(revision 10399)
+++ /branches/mobile/html/shopping/index.php	(revision 10399)
@@ -0,0 +1,245 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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[] = URL_DIR.'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) {
+		$sqlval['create_date'] = 'Now()';
+		$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: /branches/mobile/html/shopping/complete.php
===================================================================
--- /branches/mobile/html/shopping/complete.php	(revision 10399)
+++ /branches/mobile/html/shopping/complete.php	(revision 10399)
@@ -0,0 +1,524 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/complete.tpl';
+		$this->tpl_css = URL_DIR.'css/layout/shopping/complete.css';
+		$this->tpl_title = "¤´ÃíÊ¸´°Î»";
+		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();
+
+// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿¤«È½Äê
+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');
+	}
+
+	//¤½¤ÎÂ¾¾ðÊó¤Î¼èÆÀ
+	$other_data = $objQuery->get("dtb_order", "memo02", "order_id = ? ", array($order_id));
+	if($other_data != "") {
+		$arrOther = unserialize($other_data);
+		
+		// ¥Ç¡¼¥¿¤òÊÔ½¸
+		foreach($arrOther as $key => $val){
+			// URL¤Î¾ì¹ç¤Ë¤Ï¥ê¥ó¥¯¤Ä¤­¤ÇÉ½¼¨¤µ¤»¤ë
+			if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $val["value"])) {
+				$arrOther[$key]["value"] = "<a href='#' onClick=\"window.open('". $val["value"] . "'); \" >" . $val["value"] ."</a>";
+			}
+		}
+				
+		$objPage->arrOther = $arrOther;
+		
+	}
+	
+	// ¥¢¥Õ¥£¥ê¥¨¥¤¥ÈÍÑ¥³¥ó¥Ð¡¼¥¸¥ç¥ó¥¿¥°¤ÎÀßÄê
+	$objPage->tpl_conv_page = AFF_SHOPPING_COMPLETE;
+	$objPage->tpl_aff_option = "order_id=$order_id";
+	//¹ç·×²Á³Ê¤Î¼èÆÀ
+	$total = $objQuery->get("dtb_order", "total", "order_id = ? ", array($order_id));
+	if($total != "") {
+		$objPage->tpl_aff_option.= "|total=$total";
+	}
+}
+
+$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, $objQuery);
+	} else {
+		//¹ØÆþ»þ¶¯À©²ñ°÷ÅÐÏ¿
+		switch(PURCHASE_CUSTOMER_REGIST) {
+		//Ìµ¸ú
+		case '0':
+			// ¹ØÆþ»þ²ñ°÷ÅÐÏ¿
+			if($arrData['member_check'] == '1') {
+				// ²¾²ñ°÷ÅÐÏ¿
+				$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
+				// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+				lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
+			}
+			break;
+		//Í­¸ú
+		case '1':
+			// ²¾²ñ°÷ÅÐÏ¿
+			$customer_id = lfRegistPreCustomer($arrData, $arrInfo);
+			// ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+			lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
+			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();
+	$sqlval['create_date'] = "now()";
+	$sqlval['update_date'] = "now()";
+	$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;
+	}
+
+	$objQuery = new SC_Query();
+	$objQuery->begin();	
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®ÍÑ¥Æ¡¼¥Ö¥ëÅÐÏ¿
+	lfRegistNonCustomer($arrData['order_email'], $mail_flag, $objQuery);
+	$objQuery->commit();
+
+	//¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
+	$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']);	// ¥ê¥Þ¥¤¥ó¥À¡¼Åú¤¨
+
+	// ÃíÊ¸¥¹¥Æ¡¼¥¿¥¹:»ØÄê¤¬Ìµ¤±¤ì¤Ð¿·µ¬¼õÉÕ¤ËÀßÄê
+	if($sqlval["status"] == ""){
+		$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'];
+	}
+	
+	$order_id = $arrData['order_id'];		// ¥ª¡¼¥À¡¼ID
+	$sqlval['create_date'] = 'now()';		// ¼õÃíÆü
+	
+	// ¥²¥Ã¥È¤ÎÃÍ¤ò¥¤¥ó¥µ¡¼¥È
+	//$sqlval = lfGetInsParam($sqlval);
+	
+	// INSERT¤Î¼Â¹Ô
+	$objQuery->insert("dtb_order", $sqlval);
+	
+	// ¥á¥ë¥Þ¥¬ÇÛ¿®´õË¾¾ðÊó¤ÎÅÐÏ¿
+	lfRegistNonCustomer($arrData['order_email'], $arrData['mail_flag'], $objQuery);
+	
+	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['del_flg'] = 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) {
+	$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) {
+	// ²ñ°÷¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
+	if(!sfCheckCustomerMailMaga($email)) {
+		$where = "email = ?";
+		$objQuery->delete("dtb_customer_mail", $where, array($email));
+		$sqlval['email'] = $email;
+		$sqlval['mail_flag'] = $mail_flag;
+		$sqlval['create_date'] = "now()";
+		$sqlval['update_date'] = "now()";
+		$objQuery->insert("dtb_customer_mail", $sqlval);
+	}
+}
+
+// ºß¸Ë¤ò¸º¤é¤¹½èÍý
+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, "", true);
+	// ÌµÀ©¸Â¤Î¾ì¹ç¡¢ºß¸Ë¤Ï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);
+	}
+}
+
+// GET¤ÎÃÍ¤ò¥¤¥ó¥µ¡¼¥ÈÍÑ¤ËÀ°¤¨¤ë
+function lfGetInsParam($sqlVal){
+	
+	foreach($_GET as $key => $val){
+		// ¥«¥é¥à¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+		if(sfColumnExists("dtb_order", $key)) $sqlVal[$key] = $val;
+	}
+	
+	return $sqlVal;
+}
+
+?>
Index: /branches/mobile/html/shopping/card.php
===================================================================
--- /branches/mobile/html/shopping/card.php	(revision 10399)
+++ /branches/mobile/html/shopping/card.php	(revision 10399)
@@ -0,0 +1,151 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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 = URL_DIR.'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: /branches/mobile/html/shopping/loan.php
===================================================================
--- /branches/mobile/html/shopping/loan.php	(revision 10399)
+++ /branches/mobile/html/shopping/loan.php	(revision 10399)
@@ -0,0 +1,91 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/loan.tpl';
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/shopping/convenience.php
===================================================================
--- /branches/mobile/html/shopping/convenience.php	(revision 10399)
+++ /branches/mobile/html/shopping/convenience.php	(revision 10399)
@@ -0,0 +1,218 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = "shopping/convenience.tpl";
+		$this->tpl_css = URL_DIR.'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(DATA_PATH . "vtcvsmdk/mdk/lib/BSCVS/Transaction.php");
+		require_once(DATA_PATH . "vtcvsmdk/mdk/lib/BSCVS/Config.php");
+		require_once(DATA_PATH . "vtcvsmdk/mdk/lib/BSCVS/Log.php");
+	
+		// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®
+		$objTran = new Transaction;
+		
+		// ÀßÄê¥Õ¥¡¥¤¥ë cvsgwlib.conf ¤Ë¤è¤ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½
+		$objTran->setServer(DATA_PATH . "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: /branches/mobile/html/shopping/confirm.php
===================================================================
--- /branches/mobile/html/shopping/confirm.php	(revision 10399)
+++ /branches/mobile/html/shopping/confirm.php	(revision 10399)
@@ -0,0 +1,120 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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 = URL_DIR.'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;
+$objQuery = new SC_Query();
+
+// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿µ­Ï¿¤¬¤¢¤ë¤«È½Äê
+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);
+
+// ¥«¡¼ÅÔÆâ¤Î¾¦ÉÊ¤ÎÇä¤êÀÚ¤ì¥Á¥§¥Ã¥¯
+$objCartSess->chkSoldOut($objCartSess->getCartList());
+
+// ²ñ°÷¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯
+if($objCustomer->isLoginSuccess()) {
+	$objPage->tpl_login = '1';
+	$objPage->tpl_user_point = $objCustomer->getValue('point');
+}
+
+// ·èºÑ¶èÊ¬¤ò¼èÆÀ¤¹¤ë
+$payment_type = "";
+if(sfColumnExists("dtb_payment", "memo01")){
+	// MEMO03¤ËÃÍ¤¬Æþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢¥â¥¸¥å¡¼¥ëÄÉ²Ã¤µ¤ì¤¿¤â¤Î¤È¤ß¤Ê¤¹
+	$sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
+	$arrPayment = $objQuery->getall($sql, array($arrData['payment_id']));
+	$payment_type = $arrPayment[0]["memo03"];
+}
+$objPage->payment_type = $payment_type;
+
+
+switch($_POST['mode']) {
+// Á°¤Î¥Ú¡¼¥¸¤ËÌá¤ë
+case 'return':
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	header("Location: " . URL_SHOP_PAYMENT);
+	exit;
+	break;
+case 'confirm':
+	// ¤³¤Î»þÅÀ¤Ç¥ª¡¼¥À¡¼ID¤ò³ÎÊÝ¤·¤Æ¤ª¤¯¡Ê¥¯¥ì¥¸¥Ã¥È¡¢¥³¥ó¥Ó¥Ë·èºÑ¤ÇÉ¬Í×¤Ê¤¿¤á¡Ë
+	// postgresql¤Èmysql¤È¤Ç½èÍý¤òÊ¬¤±¤ë
+	if (DB_TYPE == "pgsql") {
+		$order_id = $objQuery->nextval("dtb_order","order_id");
+	}elseif (DB_TYPE == "mysql") {
+		$order_id = $objQuery->get_auto_increment("dtb_order");
+	}
+	$arrData["order_id"] = $order_id;
+	
+	// ½¸·×·ë²Ì¤ò¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
+	sfRegistTempOrder($uniqid, $arrData);
+	// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	
+	// ·èºÑÊýË¡¤Ë¤è¤ê²èÌÌÀÚÂØ
+	if($payment_type != "") {
+		$_SESSION["payment_id"] = $arrData['payment_id'];
+		header("Location: " . URL_SHOP_MODULE);
+	}else{
+		header("Location: " . URL_SHOP_COMPLETE);
+	}
+	break;
+default:
+	break;
+}
+
+
+$objPage->arrData = $arrData;
+$objPage->arrInfo = $arrInfo;
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+//--------------------------------------------------------------------------------------------------------------------------
+?>
Index: /branches/mobile/html/shopping/payment.php
===================================================================
--- /branches/mobile/html/shopping/payment.php	(revision 10399)
+++ /branches/mobile/html/shopping/payment.php	(revision 10399)
@@ -0,0 +1,333 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	var $arrSession;
+	var $tpl_mode;
+	function LC_Page() {
+		$this->tpl_css = URL_DIR.'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);
+
+// ¥«¡¼ÅÔÆâ¤Î¾¦ÉÊ¤ÎÇä¤êÀÚ¤ì¥Á¥§¥Ã¥¯
+$objCartSess->chkSoldOut($objCartSess->getCartList());
+
+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', 'deliv_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("rank DESC");
+	//ºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤»ÙÊ§ÊýË¡¤ò¼èÆÀ
+	$arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", "del_flg = 0 AND deliv_id IN (SELECT deliv_id FROM dtb_deliv WHERE del_flg = 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, deliv_time", "dtb_delivtime", $where, array($time_id));
+	return (array($arrRet[0]['deliv_id'], $arrRet[0]['deliv_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: /branches/mobile/html/shopping/loan_cancel.php
===================================================================
--- /branches/mobile/html/shopping/loan_cancel.php	(revision 10399)
+++ /branches/mobile/html/shopping/loan_cancel.php	(revision 10399)
@@ -0,0 +1,90 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		$this->tpl_mainpage = 'shopping/loan.tpl';
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/shopping/load_payment_module.php
===================================================================
--- /branches/mobile/html/shopping/load_payment_module.php	(revision 7711)
+++ /branches/mobile/html/shopping/load_payment_module.php	(revision 7711)
@@ -0,0 +1,42 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+$objSiteSess = new SC_SiteSession();
+$objCartSess = new SC_CartSession();
+$objQuery = new SC_Query();
+
+// Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼êÂ³¤­¤¬¹Ô¤ï¤ì¤¿µ­Ï¿¤¬¤¢¤ë¤«È½Äê
+sfIsPrePage($objSiteSess);
+
+// ¥¢¥¯¥»¥¹¤ÎÀµÅöÀ­¤ÎÈ½Äê
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+$payment_id = $_SESSION["payment_id"];
+
+// »ÙÊ§¤¤ID¤¬Ìµ¤¤¾ì¹ç¤Ë¤Ï¥¨¥é¡¼
+if($payment_id == ""){
+	sfDispSiteError(PAGE_ERROR, "", true);
+}
+
+// ·èºÑ¾ðÊó¤ò¼èÆÀ¤¹¤ë
+if(sfColumnExists("dtb_payment", "memo01")){
+	$sql = "SELECT module_path, memo01, memo02, memo03, memo04, memo05, memo06, memo07, memo08, memo09, memo10 FROM dtb_payment WHERE payment_id = ?";
+	$arrPayment = $objQuery->getall($sql, array($payment_id));
+}
+
+if(count($arrPayment) > 0) {
+	$path = $arrPayment[0]['module_path'];
+	if(file_exists($path)) {
+		require_once($path);
+		exit;
+	} else {
+		sfDispSiteError(FREE_ERROR_MSG, "", true, "¥â¥¸¥å¡¼¥ë¥Õ¥¡¥¤¥ë¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£<br />¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£");
+	}
+}
+
+?>
Index: /branches/mobile/html/resize_image.php
===================================================================
--- /branches/mobile/html/resize_image.php	(revision 9284)
+++ /branches/mobile/html/resize_image.php	(revision 9284)
@@ -0,0 +1,16 @@
+<?php
+
+$include_dir = realpath(dirname( __FILE__));
+require_once($include_dir . "/../data/lib/gdthumb.php");
+require_once($include_dir . "/../data/conf/conf.php");	
+
+$objThumb = new gdthumb();
+
+$file = $_GET["image"];
+if(file_exists($file)){
+	$objThumb->Main($file, $_GET["width"], $_GET["height"], "", true);
+}else{
+	$objThumb->Main(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], "", true);
+}
+
+?>
Index: /branches/mobile/html/forgot/index.php
===================================================================
--- /branches/mobile/html/forgot/index.php	(revision 5934)
+++ /branches/mobile/html/forgot/index.php	(revision 5934)
@@ -0,0 +1,146 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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 del_flg = 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 del_flg = 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 del_flg = 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( sha1($objPage->temp_password . ":" . AUTH_MAGIC) ,$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: /branches/mobile/html/products/review_complete.php
===================================================================
--- /branches/mobile/html/products/review_complete.php	(revision 5934)
+++ /branches/mobile/html/products/review_complete.php	(revision 5934)
@@ -0,0 +1,22 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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: /branches/mobile/html/products/list.php
===================================================================
--- /branches/mobile/html/products/list.php	(revision 10561)
+++ /branches/mobile/html/products/list.php	(revision 10561)
@@ -0,0 +1,419 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+require_once(DATA_PATH . "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 = HTML_PATH . "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'], "del_flg = 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->setPrevURL($_SERVER['REQUEST_URI']);
+			$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
+			header("Location: " . URL_CART_TOP);
+			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 = HTML_PATH . "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 = "del_flg = 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 AS allcls", $where, $arrval);
+	$objPage->tpl_linemax = $linemax;	// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
+	
+	// ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
+	$objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX);
+	
+	$strnavi = $objNavi->strnavi;
+	$strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi);
+	$objPage->tpl_strnavi = $strnavi;		// É½¼¨Ê¸»úÎó
+	$startno = $objNavi->start_row;					// ³«»Ï¹Ô
+	
+	// ¼èÆÀÈÏ°Ï¤Î»ØÄê(³«»Ï¹ÔÈÖ¹æ¡¢¹Ô¿ô¤Î¥»¥Ã¥È)
+	$objQuery->setlimitoffset($disp_num, $startno);
+	// É½¼¨½ç½ø
+	$objQuery->setorder($order);
+	
+	
+	
+	
+	
+	
+	
+	
+	// ¸¡º÷·ë²Ì¤Î¼èÆÀ
+	$objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $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 AS prdcls";
+		$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 = "del_flg = 0";
+	$order = "payment_id";
+	$objQuery->setorder($order);
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+?>
Index: /branches/mobile/html/products/batch_relate.php
===================================================================
--- /branches/mobile/html/products/batch_relate.php	(revision 6089)
+++ /branches/mobile/html/products/batch_relate.php	(revision 6089)
@@ -0,0 +1,42 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/*¡¡¤³¤Î¾¦ÉÊ¤òÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉÊ¤âÇã¤Ã¤Æ¤¤¤Þ¤¹¡£½¸·×¥Õ¥¡¥¤¥ë  */
+require_once(DATA_PATH . "lib/slib.php");
+require_once(DATA_PATH . "lib/glib.php");
+require_once(DATA_PATH . "class/SC_Query.php");
+require_once(DATA_PATH . "class/SC_DbConn.php");
+		
+$objQuery = new SC_Query();
+
+$objQuery->begin();
+$objQuery->delete("dtb_bat_relate_products");
+$arrCID = $objQuery->select("customer_id", "dtb_order", "del_flg = 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'];
+					$sqlval['create_date'] = "now()";
+					//¥Ç¡¼¥¿ÁÞÆþ
+					$objQuery->insert("dtb_bat_relate_products", $sqlval);
+				}
+			}
+		}
+	}
+}
+$objQuery->commit();
+
+?>
Index: /branches/mobile/html/products/favorite.php
===================================================================
--- /branches/mobile/html/products/favorite.php	(revision 5934)
+++ /branches/mobile/html/products/favorite.php	(revision 5934)
@@ -0,0 +1,35 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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: /branches/mobile/html/products/review.php
===================================================================
--- /branches/mobile/html/products/review.php	(revision 5934)
+++ /branches/mobile/html/products/review.php	(revision 5934)
@@ -0,0 +1,173 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+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", "del_flg = 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['update_date'] = 'now()';
+	$arrRegist['creator_id'] = '0';
+	//-- ÅÐÏ¿¼Â¹Ô
+	$objQuery->begin();
+	$objQuery->insert("dtb_review", $arrRegist);
+	$objQuery->commit();
+}
+
+?>
Index: /branches/mobile/html/products/detail.php
===================================================================
--- /branches/mobile/html/products/detail.php	(revision 10112)
+++ /branches/mobile/html/products/detail.php	(revision 10112)
@@ -0,0 +1,442 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+require_once(DATA_PATH . "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 = "del_flg = 0";
+} else {
+	$where = "del_flg = 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 {
+		//±ÜÍ÷ÍúÎò¤ÎÃæ¤Ç°ìÈÖ¸Å¤¤¤â¤Î¤òºï½ü¤·¤Æ¿·µ¬ÄÉ²Ã
+		$oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?";
+		$old = $objQuery->getone($oldsql, array($objCustomer->getValue("customer_id")));
+		$where = "customer_id = ? AND update_date = ? ";
+		$arrval = array($objCustomer->getValue("customer_id"), $old);
+		//ºï½ü
+		$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->setPrevURL($_SERVER['REQUEST_URI']);
+		$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $objFormParam->getValue('quantity'));
+		header("Location: " . URL_CART_TOP);
+
+		exit;
+	}
+	break;
+		
+default:
+	break;
+}
+
+$objQuery = new SC_Query();
+// DB¤«¤é¾¦ÉÊ¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
+$arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id));
+$objPage->arrProduct = $arrRet[0];
+
+// ¾¦ÉÊ¥³¡¼¥É¤Î¼èÆÀ
+$code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code";
+$arrProductCode = $objQuery->getall($code_sql, array($tmp_id));
+$arrProductCode = sfswaparray($arrProductCode);
+$objPage->arrProductCode = $arrProductCode["product_code"];
+
+// ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ
+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, true);
+// »ÙÊ§ÊýË¡¤Î¼èÆÀ
+$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);
+
+// ³ÈÂç²èÁü¤Î¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ò¥»¥Ã¥È
+list($large_width, $large_height) = getimagesize(IMAGE_SAVE_DIR . basename($objPage->arrFile["main_large_image"]["filepath"]));
+$objPage->tpl_large_width = $large_width + 60;
+$objPage->tpl_large_height = $large_height + 80;
+
+$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 AS prdcls";
+		$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 = "del_flg = 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  AS allcls", $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()';
+	$sqlval['update_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 allcls ";
+	$where = "del_flg = 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 = "del_flg = 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 = "del_flg = 0";
+	$order = "payment_id";
+	$objQuery->setorder($order);
+	$arrRet = $objQuery->select($col, $from, $where);
+	return $arrRet;
+}
+
+?>
Index: /branches/mobile/html/products/detail_image.php
===================================================================
--- /branches/mobile/html/products/detail_image.php	(revision 9222)
+++ /branches/mobile/html/products/detail_image.php	(revision 9222)
@@ -0,0 +1,53 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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();
+$objCartSess = new SC_CartSession("", false);
+
+// ´ÉÍý¥Ú¡¼¥¸¤«¤é¤Î³ÎÇ§¤Î¾ì¹ç¤Ï¡¢Èó¸ø³«¤Î¾¦ÉÊ¤âÉ½¼¨¤¹¤ë¡£
+if($_GET['admin'] == 'on') {
+	$where = "del_flg = 0";
+} else {
+	$where = "del_flg = 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']));
+
+list($width, $height) = getimagesize(IMAGE_SAVE_DIR . $arrRet[0][$image_key]);
+$objPage->tpl_width = $width;
+$objPage->tpl_height = $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: /branches/mobile/html/faq/index.php
===================================================================
--- /branches/mobile/html/faq/index.php	(revision 10399)
+++ /branches/mobile/html/faq/index.php	(revision 10399)
@@ -0,0 +1,26 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/html/fax/index.php
===================================================================
--- /branches/mobile/html/fax/index.php	(revision 10399)
+++ /branches/mobile/html/fax/index.php	(revision 10399)
@@ -0,0 +1,26 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+require_once("../require.php");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_css = URL_DIR.'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: /branches/mobile/data/script/send_kara_mail.php
===================================================================
--- /branches/mobile/data/script/send_kara_mail.php	(revision 11406)
+++ /branches/mobile/data/script/send_kara_mail.php	(revision 11406)
@@ -0,0 +1,26 @@
+#!/usr/bin/env php
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¶õ¥á¡¼¥ë¥Æ¥¹¥ÈÁ÷¿®¥¹¥¯¥ê¥×¥È
+ */
+
+require_once dirname(__FILE__) . '/../conf/mobile.conf';
+
+if ($argc != 4) {
+	echo "Usage: $argv[0] sender command token\n";
+	exit(1);
+}
+
+$receive_kara_mail = dirname(__FILE__) . '/receive_kara_mail.php';
+$from = $argv[1];
+$command = $argv[2];
+$token = $argv[3];
+$to = MOBILE_KARA_MAIL_ADDRESS_USER . MOBILE_KARA_MAIL_ADDRESS_DELIMITER . $command . '_' . $token . '@' . MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
+
+$pipe = popen($receive_kara_mail, 'w');
+fwrite($pipe, "From $from " . date('D M j H:i:s Y') . "\n");
+fwrite($pipe, "From: $from\n");
+fwrite($pipe, "To: $to\n");
+fwrite($pipe, "\n");
+pclose($pipe);
+?>
Index: /branches/mobile/data/script/receive_kara_mail.php
===================================================================
--- /branches/mobile/data/script/receive_kara_mail.php	(revision 11406)
+++ /branches/mobile/data/script/receive_kara_mail.php	(revision 11406)
@@ -0,0 +1,38 @@
+#!/usr/bin/env php
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¶õ¥á¡¼¥ë¼õ¤±ÉÕ¤±¥¹¥¯¥ê¥×¥È
+ */
+
+require_once dirname(__FILE__) . '/../conf/mobile.conf';
+require_once DATA_PATH . '/include/php_ini.inc';
+require_once DATA_PATH . '/include/mobile.inc';
+require_once DATA_PATH . '/lib/slib.php';
+require_once DATA_PATH . '/class/GC_MobileKaraMail.php';
+require_once DATA_PATH . '/class/GC_SendMail.php';
+
+$CONF = sf_getBasisData();
+
+$objMail =& GC_MobileKaraMail::factory();
+$objMail->parse();
+$token = $objMail->getToken();
+$sender = $objMail->getSender();
+
+if (gfRegisterKaraMail($token, $sender)) {
+	$subject = '¶õ¥á¡¼¥ë¤ò¼õ¤±ÉÕ¤±¤Þ¤·¤¿';
+	$reply_body = "²¼µ­¤Î¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¡¢¼¡¤Î¼êÂ³¤­¤Ë¿Ê¤ó¤Ç¤¯¤À¤µ¤¤¡£\n" .
+	              SITE_URL . "redirect.php?token=$token";
+} else {
+	$subject = '¶õ¥á¡¼¥ë¼êÂ³¤­¤¬¼ºÇÔ¤·¤Þ¤·¤¿';
+	$reply_body = "»þ´ÖÀÚ¤ì¤Ê¤É¤Ë¤è¤ê¡¢¶õ¥á¡¼¥ë¼êÂ³¤­¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£\n" .
+	              "¥µ¥¤¥È¤Î¥È¥Ã¥×¤ØÌá¤Ã¤Æ¤ä¤êÄ¾¤·¤Æ¤¯¤À¤µ¤¤¡£\n" .
+	              SITE_URL . "\n";
+}
+
+$objReply = new GC_SendMail;
+$objReply->setItem($sender, "¡Ú{$CONF["shop_name"]}¡Û$subject", $reply_body,
+                   $CONF['email03'], $CONF['shop_name'], $CONF['email03'], $CONF['email04']);
+$objReply->sendMail();
+
+$objMail->success();
+?>
Index: /branches/mobile/data/class/SC_CheckError.php
===================================================================
--- /branches/mobile/data/class/SC_CheckError.php	(revision 11454)
+++ /branches/mobile/data/class/SC_CheckError.php	(revision 11454)
@@ -0,0 +1,725 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] 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[$i]] .= "¢¨ " . $value[0] . $i . "¤Ï" . $value[4] . "»ú°ÊÆâ¤ÇÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br />";
+			} else if (strlen($this->arrParam[$value[$i]]) > 0 && !EregI("^[[:digit:]]+$", $this->arrParam[$value[$i]])) {
+				$this->arrErr[$value[$i]] .= "¢¨ " . $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 && ! mb_ereg("^[¥¡-¥ö¦-ß¡¼]+$", $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]]) || count($value[2]) == 0) {
+			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] = È½ÄêÂÐ¾ÝÊ¸»úÎó
+	function FILE_NAME_CHECK_BY_NOUPLOAD( $value ) {			// ÆþÎÏÊ¸»ú¤¬±Ñ¿ô»ú,"_","-"°Ê³°¤Ê¤é¥¨¥é¡¼¤òÊÖ¤¹
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+	
+		if( strlen($this->arrParam[$value[1]]) > 0 && ! EregI("^[[:alnum:]_\.-]+$", $this->arrParam[$value[1]]) || EregI("[\\]" ,$this->arrParam[$value[1]])) { 
+			$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 />";
+		}
+	}	
+	
+	/*¡¡·ÈÂÓ¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÎÈ½Äê¡¡*/
+	// value[0] = ¹àÌÜÌ¾ value[1] = È½ÄêÂÐ¾Ý¥á¡¼¥ë¥¢¥É¥ì¥¹
+	function MOBILE_EMAIL_CHECK( $value ){				//¡¡¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÀµµ¬É½¸½¤ÇÈ½Äê¤¹¤ë
+		if(isset($this->arrErr[$value[1]])) {
+			return;
+		}
+		if(strlen($this->arrParam[$value[1]]) > 0 && !gfIsMobileMailAddress($this->arrParam[$value[1]])) {
+			$this->arrErr[$value[1]] = "¢¨ " . $value[0] . "¤Ï·ÈÂÓÅÅÏÃ¤Î¤â¤Î¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£<br />";
+		}
+	}		
+}
+?>
Index: /branches/mobile/data/class/SC_PageNavi.php
===================================================================
--- /branches/mobile/data/class/SC_PageNavi.php	(revision 6377)
+++ /branches/mobile/data/class/SC_PageNavi.php	(revision 6377)
@@ -0,0 +1,123 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/* ¢¨»ÈÍÑ¾ò·ï¢¨
+	¡¦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: /branches/mobile/data/class/SC_CustomerList.php
===================================================================
--- /branches/mobile/data/class/SC_CustomerList.php	(revision 9973)
+++ /branches/mobile/data/class/SC_CustomerList.php	(revision 9973)
@@ -0,0 +1,319 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/*  [Ì¾¾Î] 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 del_flg = 0 ");		
+			// ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à
+			$regdate_col = 'dtb_customer.update_date';
+		}
+		
+		if($mode == "customer") {
+			// ´ÉÍý¼Ô¥Ú¡¼¥¸¸ÜµÒ¸¡º÷¤Î¾ì¹ç²¾ÅÐÏ¿²ñ°÷¤â¸¡º÷
+			$this->setWhere( "(status = 1 OR status = 2) AND del_flg = 0 ");		
+			// ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à
+			$regdate_col = 'dtb_customer.update_date';
+		}
+				
+		// ¥á¡¼¥ë¥Þ¥¬¥¸¥ó¤Î¾ì¹ç		
+		if($mode == "magazine") {
+			$this->setWhere("(del_flg = 0 OR del_flg 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 .= "dtb_customer.email NOT ILIKE ? ";
+					} else {
+						$sql_where .= "AND dtb_customer.email NOT ILIKE ? ";
+					}
+				} else {				
+					if($sql_where == "") {
+						$sql_where .= "dtb_customer.email ILIKE ? ";
+					} else {
+						$sql_where .= "OR dtb_customer.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((array)$this->arrVal, (array)$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 
+				dtb_customer.customer_id,
+				dtb_customer.name01,
+				dtb_customer.name02,
+				dtb_customer.kana01,
+				dtb_customer.kana02,
+				dtb_customer.sex,
+				dtb_customer.email,
+				dtb_customer.tel01,
+				dtb_customer.tel02,
+				dtb_customer.tel03,
+				dtb_customer.pref, 
+				dtb_customer_mail.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: /branches/mobile/data/class/SC_CartSession.php
===================================================================
--- /branches/mobile/data/class/SC_CartSession.php	(revision 8421)
+++ /branches/mobile/data/class/SC_CartSession.php	(revision 8421)
@@ -0,0 +1,310 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/* ¥«¡¼¥È¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+class SC_CartSession {
+	var $key;
+	var $key_tmp;	// ¥æ¥Ë¡¼¥¯ID¤ò»ØÄê¤¹¤ë¡£
+	
+	/* ¥³¥ó¥¹¥È¥é¥¯¥¿ */
+	function SC_CartSession($key = 'cart') {
+		sfDomainSessionStart();
+		
+		if($key == "") $key = "cart";
+		$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();
+		}
+	}
+	
+	// Á°ÊÇ¤ÎURL¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	function setPrevURL($url) {
+		$_SESSION[$this->key]['prev_url'] = $url;
+	}
+	
+	// Á°ÊÇ¤ÎURL¤ò¼èÆÀ¤¹¤ë
+	function getPrevURL() {
+		return $_SESSION[$this->key]['prev_url'];
+	}
+
+	// ¥­¡¼¤¬°ìÃ×¤·¤¿¾¦ÉÊ¤Îºï½ü
+	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;
+	}
+	
+	// ¥«¡¼¥È¤ÎÃæ¤ÎÇä¤êÀÚ¤ì¥Á¥§¥Ã¥¯
+	function chkSoldOut($arrCartList){
+		foreach($arrCartList as $key => $val){
+			if($val['quantity'] == 0){
+				// Çä¤êÀÚ¤ì¾¦ÉÊ¤ò¥«¡¼¥È¤«¤éºï½ü¤¹¤ë
+				$this->delProduct($val['cart_no']);
+				sfDispSiteError(SOLD_OUT, "", true);
+			}
+		}
+	}
+	
+}
+?>
Index: /branches/mobile/data/class/GC_MobileKaraMail.php
===================================================================
--- /branches/mobile/data/class/GC_MobileKaraMail.php	(revision 11406)
+++ /branches/mobile/data/class/GC_MobileKaraMail.php	(revision 11406)
@@ -0,0 +1,200 @@
+<?php
+
+/**
+ * ¶õ¥á¡¼¥ë¼õ¤±ÉÕ¤±¥¢¥É¥ì¥¹¤Î¥³¥Þ¥ó¥ÉÌ¾¤È¥È¡¼¥¯¥ó¤Î´Ö¤Î¶èÀÚ¤êÊ¸»ú
+ */
+define('MOBILE_KARA_MAIL_EXTENSION_DELIMITER', '_');
+
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È¤Î¶õ¥á¡¼¥ë¤ò°·¤¦¥¯¥é¥¹
+ */
+class GC_MobileKaraMail {
+	/**
+	 * ´Ä¶­ÊÑ¿ô¤«¤é MTA ¤òÈ½ÊÌ¤·¡¢ÂÐ±þ¤¹¤ë GC_MobileKaraMail ¤Þ¤¿¤Ï¤½¤Î¥µ¥Ö¥¯¥é¥¹
+	 * ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë¡£
+	 *
+	 * @return object GC_MobileKaraMail ¤Þ¤¿¤Ï¤½¤Î¥µ¥Ö¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òÊÖ¤¹¡£
+	 */
+	function &factory() {
+		if (isset($_ENV['EXTENSION'])) {
+			$objInstance = new GC_MobileKaraMail_Postfix;
+		} elseif (isset($_ENV['DEFAULT'])) {
+			$objInstance = new GC_MobileKaraMail_Qmail;
+		} else {
+			$objInstance = new GC_MobileKaraMail;
+		}
+
+		return $objInstance;
+	}
+
+	/**
+	 * É¸½àÆþÎÏ¤«¤é¥á¡¼¥ë¤òÆÉ¤ß¹þ¤ß¡¢É¬Í×¤Ê¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
+	 *
+	 * @return void
+	 */
+	function parse() {
+		if (@$this->parsed) {
+			return;
+		}
+
+		require_once DATA_PATH . '/module/Mail/mimeDecode.php';
+
+		$fp = fopen('php://stdin', 'r');
+
+		// From ¹Ô¤ò²òÀÏ¤¹¤ë¡£
+		$from_line = rtrim(fgets($fp));
+		if (preg_match('/^From\\s+"?([^\\s"@]+)"?@([^\\s@]+)/', $from_line, $matches)) {
+			$this->sender = $matches[1] . '@' . $matches[2];
+		} else {
+			trigger_error("Invalid from line: $from_line");
+			$this->sender = null;
+		}
+
+		// »Ä¤ê¤Î¥Ø¥Ã¥À¡¼¤ò²òÀÏ¤¹¤ë¡£
+		$data = '';
+		while (!feof($fp)) {
+			$data .= fgets($fp);
+			if (rtrim($data, "\r\n") == '') {
+				break;
+			}
+		}
+		$structure = Mail_mimeDecode::decode(array('input' => $data));
+		$this->recipient = @$structure->headers['to'];
+
+		// °¸Àè¥¢¥É¥ì¥¹¤«¤é³ÈÄ¥ÉôÊ¬¤ò¼èÆÀ¤¹¤ë¡£
+		$pos = strpos($this->recipient, MOBILE_KARA_MAIL_ADDRESS_DELIMITER);
+		if ($pos !== false) {
+			$extension_and_domain = substr($this->recipient, $pos + 1);
+			$pos = strpos($extension_and_domain, '@');
+			if ($pos !== false) {
+				$this->extension = substr($extension_and_domain, 0, $pos);
+			} else {
+				$this->extension = $extension_and_domain;
+			}
+		} else {
+			trigger_error("Invalid recipient: {$this->recipient}");
+			$this->extension = null;
+		}
+
+		$this->parsed = true;
+	}
+
+	/**
+	 * ÇÛ¿®¤¬´°Î»¤·¤¿¤³¤È¤ò¼¨¤¹½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤Ç¥×¥í¥°¥é¥à¤ò½ªÎ»¤¹¤ë¡£
+	 *
+	 * @return void
+	 */
+	function success() {
+		exit(0);
+	}
+
+	/**
+	 * °ì»þÅª¤Ê¥¨¥é¡¼¤ò¼¨¤¹½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤Ç¥×¥í¥°¥é¥à¤ò½ªÎ»¤¹¤ë¡£
+	 *
+	 * @return void
+	 */
+	function temporaryFailure() {
+		exit(75);
+	}
+
+	/**
+	 * Á÷¿®¼Ô¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¼èÆÀ¤¹¤ë¡£
+	 *
+	 * parse() ¼Â¹Ô¸å¤Ë»ÈÍÑ¤¹¤ë¤³¤È¡£
+	 *
+	 * @return string|false Á÷¿®¼Ô¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÊÖ¤¹¡£¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function getSender() {
+		return isset($this->sender) ? $this->sender : false;
+	}
+
+	/**
+	 * °¸Àè¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î³ÈÄ¥ÉôÊ¬¤«¤é¥³¥Þ¥ó¥ÉÌ¾¤ò¼èÆÀ¤¹¤ë¡£
+	 *
+	 * parse() ¼Â¹Ô¸å¤Ë»ÈÍÑ¤¹¤ë¤³¤È¡£
+	 *
+	 * @return string|false ¥³¥Þ¥ó¥ÉÌ¾¤òÊÖ¤¹¡£¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function getCommand() {
+		if (!isset($this->extension)) {
+			return false;
+		}
+
+		$pos = strpos($this->extension, MOBILE_KARA_MAIL_EXTENSION_DELIMITER);
+		if ($pos === false) {
+			return false;
+		}
+
+		return substr($this->extension, 0, $pos);
+	}
+
+	/**
+	 * °¸Àè¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î³ÈÄ¥ÉôÊ¬¤«¤é¥È¡¼¥¯¥ó¤ò¼èÆÀ¤¹¤ë¡£
+	 *
+	 * parse() ¼Â¹Ô¸å¤Ë»ÈÍÑ¤¹¤ë¤³¤È¡£
+	 *
+	 * @return string|false ¥È¡¼¥¯¥ó¤òÊÖ¤¹¡£¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function getToken() {
+		if (!isset($this->extension)) {
+			return false;
+		}
+
+		$pos = strpos($this->extension, MOBILE_KARA_MAIL_EXTENSION_DELIMITER);
+		if ($pos === false) {
+			return false;
+		}
+
+		return substr($this->extension, $pos + 1);
+	}
+}
+
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È¤Î¶õ¥á¡¼¥ë¤ò°·¤¦¥¯¥é¥¹ (PostfixÍÑ)
+ */
+class GC_MobileKaraMail_Postfix extends GC_MobileKaraMail {
+	/**
+	 * @see GC_MobileKaraMail::parse()
+	 */
+	function parse() {
+		if (@$this->parsed) {
+			return;
+		}
+
+		$this->sender = $_ENV['SENDER'];
+		$this->recipient = $_ENV['RECIPIENT'];
+		$this->extension = $_ENV['EXTENSION'];
+
+		$this->parsed = true;
+	}
+}
+
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È¤Î¶õ¥á¡¼¥ë¤ò°·¤¦¥¯¥é¥¹ (qmailÍÑ)
+ */
+class GC_MobileKaraMail_Qmail extends GC_MobileKaraMail {
+	/**
+	 * @see GC_MobileKaraMail::parse()
+	 */
+	function parse() {
+		if (@$this->parsed) {
+			return;
+		}
+
+		$this->sender = $_ENV['SENDER'];
+		$this->recipient = $_ENV['RECIPIENT'];
+		$this->extension = $_ENV['DEFAULT'];
+
+		$this->parsed = true;
+	}
+
+	/**
+	 * °ì»þÅª¤Ê¥¨¥é¡¼¤ò¼¨¤¹½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤Ç¥×¥í¥°¥é¥à¤ò½ªÎ»¤¹¤ë¡£
+	 *
+	 * @return void
+	 */
+	function temporaryFailure() {
+		exit(111);
+	}
+}
+?>
Index: /branches/mobile/data/class/GC_MobileImage.php
===================================================================
--- /branches/mobile/data/class/GC_MobileImage.php	(revision 11459)
+++ /branches/mobile/data/class/GC_MobileImage.php	(revision 11459)
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Ã¼Ëö¤Î²èÌÌ²òÁüÅÙ¤Ë¤¢¤ï¤»¤Æ²èÁü¤òÊÑ´¹¤¹¤ë
+ */
+
+define("MOBILE_IMAGE_INC_PATH", realpath(dirname( __FILE__)) . "/../include");
+require_once(MOBILE_IMAGE_INC_PATH . "/image_converter.inc");
+
+/**
+ * ²èÁüÊÑ´¹¥¯¥é¥¹
+ */
+class GC_MobileImage {
+	/**
+	 * ²èÁü¤òÃ¼Ëö¤Î²òÁüÅÙ¤Ë¹ç¤ï¤»¤ÆÊÑ´¹¤¹¤ë
+	 * output buffering ÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+	 *
+	 * @param string ÆþÎÏ
+	 * @return string ½ÐÎÏ
+	 */
+	function handler($buffer) {
+
+		// Ã¼Ëö¾ðÊó¤ò¼èÆÀ¤¹¤ë
+		$carrier = GC_MobileUserAgent::getCarrier();
+		$model   = GC_MobileUserAgent::getModel();
+
+		// ·ÈÂÓÅÅÏÃ¤Î¾ì¹ç¤Î¤ß½èÍý¤ò¹Ô¤¦
+		if ($carrier !== FALSE) {
+
+			// HTMLÃæ¤ÎIMG¥¿¥°¤ò¼èÆÀ¤¹¤ë
+			$pattern = '/<img\s+src=[\'"]([^>"]+)[\'"]\s*\/*>/i';
+			$result = preg_match_all($pattern, $buffer, $images);
+
+			// Ã¼Ëö¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë
+			$fp = fopen(MOBILE_IMAGE_INC_PATH . "/mobile_image_map_$carrier.csv", "r");
+			while (($data = fgetcsv($fp, 1000, ",")) !== FALSE) {
+				if ($data[1] == $model || $data[1] == '*') {
+					$cacheSize     = $data[2];
+					$imageFileSize = $data[7];
+					$imageType     = $data[6];
+					$imageWidth    = $data[5];
+					break;
+				}
+			}
+			fclose($fp);
+
+			// docomo¤Èsoftbank¤Î¾ì¹ç¤Ï²èÁü¥Õ¥¡¥¤¥ë°ì¤Ä¤ËÍøÍÑ²ÄÇ½¤Ê¥µ¥¤¥º¤Î¾å¸Â¤ò·×»»¤¹¤ë
+			// au¤ÏHTML¤Îbyte¿ô¾å¸Â¤Ë²èÁü¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬´Þ¤Þ¤ì¤Ê¤¤¤Î¤ÇimageFileSize¤Î¤Þ¤Þ¡£
+			if ($carrier == "docomo" or $carrier == "softbank") {
+				// ·×»»¼°¡§(ÍøÍÑÃ¼Ëö¤ÇÉ½¼¨²ÄÇ½¤Êcache¥µ¥¤¥º - HTML¤Î¥Ð¥¤¥È¿ô - ÊÑ´¹¸å¤Î²èÁüÌ¾¤Î¥Ð¥¤¥È¿ô(ÌÜ°ÂÃÍ) ) / HTMLÃæ¤Î²èÁü¿ô
+				$temp_imagefilesize = ($cacheSize - strlen($buffer) - (140 * $result) ) / $result;
+				// ·×»»·ë²Ì¤¬Ã¼Ëö¤ÎÉ½¼¨²ÄÇ½¥Õ¥¡¥¤¥ë¥µ¥¤¥º¾å¸Â¤è¤ê¾®¤µ¤¤¾ì¹ç¤Ï·×»»·ë²Ì¤ÎÃÍ¤òÍ­¸ú¤Ë¤¹¤ë
+				if ($temp_imagefilesize < $imageFileSize) {
+					$imageFileSize = $temp_imagefilesize;
+				}
+			}
+
+			// ²èÁüÊÑ´¹¤Î¾ðÊó¤ò¥»¥Ã¥È¤¹¤ë
+			$imageConverter = New ImageConverter();
+			$imageConverter->setOutputDir(MOBILE_IMAGE_DIR);
+			$imageConverter->setImageType($imageType);
+			$imageConverter->setImageWidth($imageWidth);
+			$imageConverter->setFileSize($imageFileSize);
+
+			// HTMLÃæ¤ÎIMG¥¿¥°¤òÊÑ´¹¸å¤Î¥Õ¥¡¥¤¥ë¥Ñ¥¹¤ËÃÖ´¹¤¹¤ë
+			foreach ($images[1] as $key => $value) {
+				$converted = $imageConverter->execute(preg_replace('|^' . PC_URL_DIR . '|', PC_HTML_PATH, $value));
+				if (isset($converted['outputImageName'])) {
+					$buffer = str_replace($value, MOBILE_IMAGE_URL . '/' . $converted['outputImageName'], $buffer);
+				} else {
+					$buffer = str_replace($images[0][$key], '<!--No image-->', $buffer);
+				}
+			}
+		}
+		return $buffer;
+	}
+}
+?>
Index: /branches/mobile/data/class/SC_SelectSql.php
===================================================================
--- /branches/mobile/data/class/SC_SelectSql.php	(revision 5934)
+++ /branches/mobile/data/class/SC_SelectSql.php	(revision 5934)
@@ -0,0 +1,231 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/* ---- 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: /branches/mobile/data/class/SC_Customer.php
===================================================================
--- /branches/mobile/data/class/SC_Customer.php	(revision 11457)
+++ /branches/mobile/data/class/SC_Customer.php	(revision 11457)
@@ -0,0 +1,243 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/*  [Ì¾¾Î] 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, $mobile = false ) {
+		$sql_mobile = $mobile ? ' OR email_mobile ILIKE ?' : '';
+		$arrValues = array($email);
+		if ($mobile) {
+			$arrValues[] = $email;
+		}
+		// ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß
+		$sql = "SELECT * FROM dtb_customer WHERE (email ILIKE ?" . $sql_mobile . ") AND del_flg = 0 AND status = 2";
+		$result = $this->conn->getAll($sql, $arrValues);
+		$data = $result[0];
+		
+		// ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ì¤Ð¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë¥»¥Ã¥È¤·¤Ætrue¤òÊÖ¤¹
+		if ( sha1($pass . ":" . AUTH_MAGIC) == $data['password'] ){
+			$this->customer_data = $data;
+			$this->startSession();
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * ·ÈÂÓÃ¼ËöID¤¬°ìÃ×¤¹¤ë²ñ°÷¤¬Â¸ºß¤¹¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	 *
+	 * @return boolean ³ºÅö¤¹¤ë²ñ°÷¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï true¡¢¤½¤ì°Ê³°¤Î¾ì¹ç
+	 *                 ¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function checkMobilePhoneId() {
+		if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) {
+			return false;
+		}
+
+		// ·ÈÂÓÃ¼ËöID¤¬°ìÃ×¤·¡¢ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤ò¸¡º÷¤¹¤ë¡£
+		$sql = 'SELECT count(*) FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2';
+		$result = $this->conn->getOne($sql, array($_SESSION['mobile']['phone_id']));
+		return $result > 0;
+	}
+
+	/**
+	 * ·ÈÂÓÃ¼ËöID¤ò»ÈÍÑ¤·¤Æ²ñ°÷¤ò¸¡º÷¤·¡¢¥Ñ¥¹¥ï¡¼¥É¤Î¾È¹ç¤ò¹Ô¤¦¡£
+	 * ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¸ÜµÒ¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
+	 *
+	 * @param string $pass ¥Ñ¥¹¥ï¡¼¥É
+	 * @return boolean ³ºÅö¤¹¤ë²ñ°÷¤¬Â¸ºß¤·¡¢¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï true¡¢
+	 *                 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function getCustomerDataFromMobilePhoneIdPass($pass) {
+		if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) {
+			return false;
+		}
+
+		// ·ÈÂÓÃ¼ËöID¤¬°ìÃ×¤·¡¢ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤ò¸¡º÷¤¹¤ë¡£
+		$sql = 'SELECT * FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2';
+		@list($data) = $this->conn->getAll($sql, array($_SESSION['mobile']['phone_id']));
+
+		// ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë³ÊÇ¼¤·¤Ætrue¤òÊÖ¤¹¡£
+		if (sha1($pass . ':' . AUTH_MAGIC) == @$data['password']) {
+			$this->customer_data = $data;
+			$this->startSession();
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * ·ÈÂÓÃ¼ËöID¤òÅÐÏ¿¤¹¤ë¡£
+	 *
+	 * @return void
+	 */
+	function updateMobilePhoneId() {
+		if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) {
+			return;
+		}
+
+		if ($this->customer_data['mobile_phone_id'] == $_SESSION['mobile']['phone_id']) {
+			return;
+		}
+
+		$objQuery = new SC_Query;
+		$sqlval = array('mobile_phone_id' => $_SESSION['mobile']['phone_id']);
+		$where = 'customer_id = ? AND del_flg = 0 AND status = 2';
+		$objQuery->update('dtb_customer', $sqlval, $where, array($this->customer_data['customer_id']));
+
+		$this->customer_data['mobile_phone_id'] = $_SESSION['mobile']['phone_id'];
+	}
+
+	/**
+	 * email ¤«¤é email_mobile ¤Ø·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¥³¥Ô¡¼¤¹¤ë¡£
+	 *
+	 * @return void
+	 */
+	function updateEmailMobile() {
+		// ¤¹¤Ç¤Ë email_mobile ¤ËÃÍ¤¬Æþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï²¿¤â¤·¤Ê¤¤¡£
+		if ($this->customer_data['email_mobile'] != '') {
+			return;
+		}
+
+		// email ¤¬·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï²¿¤â¤·¤Ê¤¤¡£
+		if (!gfIsMobileMailAddress($this->customer_data['email'])) {
+			return;
+		}
+
+		// email ¤«¤é email_mobile ¤Ø¥³¥Ô¡¼¤¹¤ë¡£
+		$objQuery = new SC_Query;
+		$sqlval = array('email_mobile' => $this->customer_data['email']);
+		$where = 'customer_id = ? AND del_flg = 0 AND status = 2';
+		$objQuery->update('dtb_customer', $sqlval, $where, array($this->customer_data['customer_id']));
+
+		$this->customer_data['email_mobile'] = $this->customer_data['email'];
+	}
+	
+	// ¥Ñ¥¹¥ï¡¼¥É¤ò³ÎÇ§¤»¤º¤Ë¥í¥°¥¤¥ó
+	function setLogin($email) {
+		// ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß
+		$sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND del_flg = 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 del_flg = 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($dont_check_email_mobile = false) {
+		// ¥í¥°¥¤¥ó»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤È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']) {
+				// ¥â¥Ð¥¤¥ë¥µ¥¤¥È¤Î¾ì¹ç¤Ï·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¤³¤È¤â¥Á¥§¥Ã¥¯¤¹¤ë¡£
+				// ¤¿¤À¤· $dont_check_email_mobile ¤¬ true ¤Î¾ì¹ç¤Ï¥Á¥§¥Ã¥¯¤·¤Ê¤¤¡£
+				if (defined('MOBILE_SITE') && !$dont_check_email_mobile) {
+					$email_mobile = $objQuery->get("dtb_customer", "email_mobile", "customer_id = ?", array($_SESSION['customer']['customer_id']));
+					return isset($email_mobile);
+				}
+				return true;
+			}
+		}
+		return false;
+	}
+		
+	// ¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ
+	function getValue($keyname) {
+		return $_SESSION['customer'][$keyname];
+	}
+	
+	// ¥Ñ¥é¥á¡¼¥¿¤Î¥»¥Ã¥È
+	function setValue($keyname, $val) {
+		$_SESSION['customer'][$keyname] = $val;
+	}
+
+	// ¥Ñ¥é¥á¡¼¥¿¤¬NULL¤«¤É¤¦¤«¤ÎÈ½Äê
+	function hasValue($keyname) {
+		return isset($_SESSION['customer'][$keyname]);
+	}
+	
+	// ÃÂÀ¸Æü·î¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎÈ½Äê
+	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: /branches/mobile/data/class/GC_Thumb.php
===================================================================
--- /branches/mobile/data/class/GC_Thumb.php	(revision 5934)
+++ /branches/mobile/data/class/GC_Thumb.php	(revision 5934)
@@ -0,0 +1,64 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+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: /branches/mobile/data/class/SC_DbConn.php
===================================================================
--- /branches/mobile/data/class/SC_DbConn.php	(revision 10538)
+++ /branches/mobile/data/class/SC_DbConn.php	(revision 10538)
@@ -0,0 +1,187 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+$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;
+	var $err_disp = true;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function SC_DbConn($dsn = "", $err_disp = true, $new = false){
+		global $objDbConn;
+		
+		// Debug¥â¡¼¥É»ØÄê
+		$options['debug'] = PEAR_DB_DEBUG;
+		// ´û¤ËÀÜÂ³¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¡¢¿·µ¬ÀÜÂ³Í×Ë¾¤Î¾ì¹ç¤ÏÀÜÂ³¤¹¤ë¡£
+		if(!isset($objDbConn->connection) || $new) {
+			if($dsn != "") {
+				$objDbConn = DB::connect($dsn, $options);
+				$this->dsn = $dsn;
+			} else {
+				if(defined('DEFAULT_DSN')) {
+					$objDbConn = DB::connect(DEFAULT_DSN, $options);
+					$this->dsn = DEFAULT_DSN;
+				} else {
+					return;
+				}
+			}
+		}
+		$this->conn = $objDbConn;
+		$this->error_mail_to = DB_ERROR_MAIL_TO;
+		$this->error_mail_title = DB_ERROR_MAIL_SUBJECT;
+		$this->err_disp = $err_disp;
+	}
+	
+	// ¥¯¥¨¥ê¤Î¼Â¹Ô
+	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 = ""){
+		
+		// mysql¤Î¾ì¹ç¤Ë¤Ï¥Ó¥å¡¼É½¤òÊÑ´¹¤¹¤ë
+		if (DB_TYPE == "mysql") $n = sfChangeMySQL($n);
+		
+		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 = ""){
+
+		// mysql¤Î¾ì¹ç¤Ë¤Ï¥Ó¥å¡¼É½¤òÊÑ´¹¤¹¤ë
+		if (DB_TYPE == "mysql") $n = sfChangeMySQL($n);
+
+		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 = ""){
+
+		// mysql¤Î¾ì¹ç¤Ë¤Ï¥Ó¥å¡¼É½¤òÊÑ´¹¤¹¤ë
+		if (DB_TYPE == "mysql") $n = sfChangeMySQL($n);
+		
+		if(PEAR::isError($this->conn)) {
+			if(ADMIN_MODE){
+				sfErrorHeader("DB¤Ø¤ÎÀÜÂ³¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£:" . $this->dsn);
+			}else{
+				sfErrorHeader("DB¤Ø¤ÎÀÜÂ³¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£:");
+			}
+			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 ($this->err_disp) {
+			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);
+
+			exit();
+		}
+	}
+}
+
+?>
Index: /branches/mobile/data/class/SC_Query.php
===================================================================
--- /branches/mobile/data/class/SC_Query.php	(revision 10259)
+++ /branches/mobile/data/class/SC_Query.php	(revision 10259)
@@ -0,0 +1,438 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+class SC_Query {
+	var $option;
+	var $where;
+	var $conn;
+	
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	/*
+		$err_disp:¥¨¥é¡¼É½¼¨¤ò¹Ô¤¦¤«
+		$new¡§¿·µ¬¤ËÀÜÂ³¤ò¹Ô¤¦¤«
+	 */
+	function SC_Query($dsn = "", $err_disp = true, $new = false) {
+		$this->conn = new SC_DBconn($dsn, $err_disp, $new);
+		$this->where = "";
+		return $this->conn;
+	}
+	
+	// ¥¨¥é¡¼È½Äê
+	function isError() {
+		if(PEAR::isError($this->conn->conn)) {
+			return true;
+		}
+		return false;
+	}
+	
+	// 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, $return = false) {
+		if (is_numeric($limit) && is_numeric($offset)){
+			
+			$option.= " LIMIT " . $limit;
+			$option.= " OFFSET " . $offset;
+			
+			if($return){
+				return $option;
+			}else{
+				$this->option.= $option;
+			}
+		}
+	}
+	
+	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;
+		
+		if(count($sqlval) <= 0 ) return 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) {
+		$sql = "";
+		// postgresql¤Èmysql¤È¤Ç½èÍý¤òÊ¬¤±¤ë
+		if (DB_TYPE == "pgsql") {
+			$seqtable = $table . "_" . $colname . "_seq";
+			$sql = "SELECT NEXTVAL('$seqtable')";
+		}else if (DB_TYPE == "mysql") {
+			$sql = "SELECT last_insert_id();";
+		}
+		$ret = $this->conn->getOne($sql);
+		
+		return $ret;
+	}
+	
+	function currval($table, $colname) {
+		$sql = "";
+		if (DB_TYPE == "pgsql") {
+			$seqtable = $table . "_" . $colname . "_seq";
+			$sql = "SELECT CURRVAL('$seqtable')";
+		}else if (DB_TYPE == "mysql") {
+			$sql = "SELECT last_insert_id();";
+		}
+		$ret = $this->conn->getOne($sql);
+		
+		return $ret;
+	}	
+	
+	function setval($table, $colname, $data) {
+		$sql = "";
+		if (DB_TYPE == "pgsql") {
+			$seqtable = $table . "_" . $colname . "_seq";
+			$sql = "SELECT SETVAL('$seqtable', $data)";
+			$ret = $this->conn->getOne($sql);
+		}else if (DB_TYPE == "mysql") {
+			$sql = "ALTER TABLE $table AUTO_INCREMENT=$data";
+			$ret = $this->conn->query($sql);
+		}
+		
+		return $ret;
+	}		
+	
+	function query($n ,$arr = "", $ignore_err = false){
+		$result = $this->conn->query($n, $arr, $ignore_err);
+		return $result;
+	}
+	
+	// auto_increment¤ò¼èÆÀ¤¹¤ë
+	function get_auto_increment($table_name){
+		// ¥í¥Ã¥¯¤¹¤ë
+		$this->BEGIN();
+		
+		// ¼¡¤ÎIncrement¤ò¼èÆÀ
+		$arrRet = $this->getAll("SHOW TABLE STATUS LIKE ?", array($table_name));
+		$auto_inc_no = $arrRet[0]["Auto_increment"];
+		
+		// ÃÍ¤ò¥«¥¦¥ó¥È¥¢¥Ã¥×¤·¤Æ¤ª¤¯
+		$this->conn->query("ALTER TABLE $table_name AUTO_INCREMENT=?" , $auto_inc_no + 1);
+		
+		// ²ò½ü¤¹¤ë
+		$this->COMMIT();
+		
+		return $auto_inc_no;
+	}
+}
+
+?>
Index: /branches/mobile/data/class/SC_SiteSession.php
===================================================================
--- /branches/mobile/data/class/SC_SiteSession.php	(revision 8055)
+++ /branches/mobile/data/class/SC_SiteSession.php	(revision 8055)
@@ -0,0 +1,74 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/* ¥«¡¼¥È¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+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() {
+		// ¥æ¥Ë¡¼¥¯ID¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥»¥Ã¥È¤¹¤ë¡£
+		if(!isset($_SESSION['site']['uniqid']) || $_SESSION['site']['uniqid'] == "") {
+			$this->setUniqId();
+		}
+		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: /branches/mobile/data/class/SC_Pdf.php
===================================================================
--- /branches/mobile/data/class/SC_Pdf.php	(revision 7180)
+++ /branches/mobile/data/class/SC_Pdf.php	(revision 7180)
@@ -0,0 +1,535 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] 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 = CHAR_CODE;
+		// 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", CHAR_CODE);
+				
+		$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: /branches/mobile/data/class/GC_MobileUserAgent.php
===================================================================
--- /branches/mobile/data/class/GC_MobileUserAgent.php	(revision 11404)
+++ /branches/mobile/data/class/GC_MobileUserAgent.php	(revision 11404)
@@ -0,0 +1,127 @@
+<?php
+require_once(dirname(__FILE__) . '/../module/Net/UserAgent/Mobile.php');
+
+/**
+ * ·ÈÂÓÃ¼Ëö¤Î¾ðÊó¤ò°·¤¦¥¯¥é¥¹
+ *
+ * ÂÐ¾Ý¤È¤¹¤ë·ÈÂÓÃ¼Ëö¤Ï $_SERVER ¤«¤é·èÄê¤¹¤ë¡£
+ * ¤¹¤Ù¤Æ¤Î¥á¥½¥Ã¥É¤Ï¥¯¥é¥¹¥á¥½¥Ã¥É¡£
+ */
+class GC_MobileUserAgent {
+	/**
+	 * ·ÈÂÓÃ¼Ëö¤Î¥­¥ã¥ê¥¢¤òÉ½¤¹Ê¸»úÎó¤ò¼èÆÀ¤¹¤ë¡£
+	 *
+	 * Ê¸»úÎó¤Ï docomo, ezweb, softbank ¤Î¤¤¤º¤ì¤«¡£
+	 *
+	 * @return string|false ·ÈÂÓÃ¼Ëö¤Î¥­¥ã¥ê¥¢¤òÉ½¤¹Ê¸»úÎó¤òÊÖ¤¹¡£
+	 *                      ·ÈÂÓÃ¼Ëö¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function getCarrier() {
+		$objAgent =& Net_UserAgent_Mobile::singleton();
+		if (Net_UserAgent_Mobile::isError($objAgent)) {
+			return false;
+		}
+
+		switch ($objAgent->getCarrierShortName()) {
+		case 'I':
+			return 'docomo';
+		case 'E':
+			return 'ezweb';
+		case 'V':
+			return 'softbank';
+		default:
+			return false;
+		}
+	}
+
+	/**
+	 * ¾¡¼ê¥µ¥¤¥È¤ÇÍøÍÑ²ÄÇ½¤Ê·ÈÂÓÃ¼Ëö/ÍøÍÑ¼Ô¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
+	 *
+	 * ³Æ¥­¥ã¥ê¥¢¤Ç»ÈÍÑ¤¹¤ëID¤Î¼ïÎà:
+	 * + docomo   ... UTN
+	 * + ezweb    ... EZÈÖ¹æ
+	 * + softbank ... Ã¼Ëö¥·¥ê¥¢¥ëÈÖ¹æ
+	 *
+	 * @return string|false ¼èÆÀ¤·¤¿ID¤òÊÖ¤¹¡£¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function getId() {
+		$objAgent =& Net_UserAgent_Mobile::singleton();
+		if (Net_UserAgent_Mobile::isError($objAgent)) {
+			return false;
+		} elseif ($objAgent->isDoCoMo() || $objAgent->isVodafone()) {
+			$id = $objAgent->getSerialNumber();
+		} elseif ($objAgent->isEZweb()) {
+			$id = @$_SERVER['HTTP_X_UP_SUBNO'];
+		}
+		return isset($id) ? $id : false;
+	}
+
+	/**
+	 * ·ÈÂÓÃ¼Ëö¤Îµ¡¼ï¤òÉ½¤¹Ê¸»úÎó¤ò¼èÆÀ¤¹¤ë¡£
+	 * ·ÈÂÓÃ¼Ëö¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï¥æ¡¼¥¶¡¼¥¨¡¼¥¸¥§¥ó¥È¤ÎÌ¾Á°¤ò¼èÆÀ¤¹¤ë¡£(Îã: "Mozilla")
+	 *
+	 * @return string ·ÈÂÓÃ¼Ëö¤Î¥â¥Ç¥ë¤òÉ½¤¹Ê¸»úÎó¤òÊÖ¤¹¡£
+	 */
+	function getModel() {
+		$objAgent =& Net_UserAgent_Mobile::singleton();
+		if (Net_UserAgent_Mobile::isError($objAgent)) {
+			return 'Unknown';
+		} elseif ($objAgent->isNonMobile()) {
+			return $objAgent->getName();
+		} else {
+			return $objAgent->getModel();
+		}
+	}
+
+	/**
+	 * EC-CUBE ¤¬¥µ¥Ý¡¼¥È¤¹¤ë·ÈÂÓ¥­¥ã¥ê¥¢¤«¤É¤¦¤«¤òÈ½ÊÌ¤¹¤ë¡£
+	 *
+	 * @return boolean ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¾ì¹ç¤Ï true¡¢¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function isMobile() {
+		$objAgent =& Net_UserAgent_Mobile::singleton();
+		if (Net_UserAgent_Mobile::isError($objAgent)) {
+			return false;
+		} else {
+			return $objAgent->isDoCoMo() || $objAgent->isEZweb() || $objAgent->isVodafone();
+		}
+	}
+
+	/**
+	 * EC-CUBE ¤¬¥µ¥Ý¡¼¥È¤¹¤ë·ÈÂÓ¥­¥ã¥ê¥¢¤«¤É¤¦¤«¤òÈ½ÊÌ¤¹¤ë¡£
+	 *
+	 * @return boolean ·ÈÂÓÃ¼Ëö¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï true¡¢¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function isNonMobile() {
+		return !GC_MobileUserAgent::isMobile();
+	}
+
+	/**
+	 * EC-CUBE ¤¬¥µ¥Ý¡¼¥È¤¹¤ë·ÈÂÓÃ¼Ëö¤«¤É¤¦¤«¤òÈ½ÊÌ¤¹¤ë¡£
+	 *
+	 * @return boolean ¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¾ì¹ç¤Ï true¡¢¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+	 */
+	function isSupported() {
+		$objAgent =& Net_UserAgent_Mobile::singleton();
+
+		// ·ÈÂÓÃ¼Ëö¤À¤ÈÇ§¼±¤µ¤ì¤¿¤¬¡¢User-Agent ¤Î·Á¼°¤¬Ì¤ÃÎ¤Î¾ì¹ç
+		if (Net_UserAgent_Mobile::isError($objAgent)) {
+			gfPrintLog($objAgent->toString());
+			return false;
+		}
+
+		if ($objAgent->isDoCoMo()) {
+			$arrUnsupportedSeries = array('501i', '502i', '209i', '210i');
+			$arrUnsupportedModels = array('SH821i', 'N821i', 'P821i ', 'P651ps', 'R691i', 'F671i', 'SH251i', 'SH251iS');
+			return !in_array($objAgent->getSeries(), $arrUnsupportedSeries) && !in_array($objAgent->getModel(), $arrUnsupportedModels);
+		} elseif ($objAgent->isEZweb()) {
+			return $objAgent->isWAP2();
+		} elseif ($objAgent->isVodafone()) {
+			return $objAgent->isPacketCompliant();
+		} else {
+			// ·ÈÂÓÃ¼Ëö¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤³¤È¤Ë¤¹¤ë¡£
+			return true;
+		}
+	}
+}
+?>
Index: /branches/mobile/data/class/SC_Cookie.php
===================================================================
--- /branches/mobile/data/class/SC_Cookie.php	(revision 6781)
+++ /branches/mobile/data/class/SC_Cookie.php	(revision 6781)
@@ -0,0 +1,29 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/*¡¡Æü»þÉ½¼¨ÍÑ¥¯¥é¥¹ */
+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: /branches/mobile/data/class/SC_View.php
===================================================================
--- /branches/mobile/data/class/SC_View.php	(revision 8439)
+++ /branches/mobile/data/class/SC_View.php	(revision 8439)
@@ -0,0 +1,173 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+$SC_VIEW_PHP_DIR = realpath(dirname(__FILE__));
+require_once($SC_VIEW_PHP_DIR . "/../module/Smarty/libs/Smarty.class.php");
+require_once($SC_VIEW_PHP_DIR . "/../include/php_ini.inc");
+
+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("sfTrim", "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");
+		$this->_smarty->register_function("str_replace","str_replace");
+		$this->_smarty->register_function("sfPrintEbisTag","sfPrintEbisTag");
+		$this->_smarty->register_function("sfPrintAffTag","sfPrintAffTag");
+		
+		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($cart = true) {
+    	parent::SC_View();
+		$this->_smarty->template_dir = TEMPLATE_DIR;
+		$this->_smarty->compile_dir = COMPILE_DIR;
+		$this->initpath();
+		
+		// PHP5¤Ç¤Ïsession¤ò¥¹¥¿¡¼¥È¤¹¤ëÁ°¤Ë¥Ø¥Ã¥À¡¼¾ðÊó¤òÁ÷¿®¤·¤Æ¤¤¤ë¤È·Ù¹ð¤¬½Ð¤ë¤¿¤á¡¢Àè¤Ë¥»¥Ã¥·¥ç¥ó¤ò¥¹¥¿¡¼¥È¤¹¤ë¤è¤¦¤ËÊÑ¹¹
+		sfDomainSessionStart();
+		
+		if($cart){
+			$include_dir = realpath(dirname( __FILE__));
+			require_once($include_dir . "/SC_CartSession.php");
+			$objCartSess = new SC_CartSession();
+			$objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
+		}
+	}
+}
+
+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: /branches/mobile/data/class/SC_Page.php
===================================================================
--- /branches/mobile/data/class/SC_Page.php	(revision 5934)
+++ /branches/mobile/data/class/SC_Page.php	(revision 5934)
@@ -0,0 +1,14 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+class SC_Page {
+	var $tpl_main_page;
+	function SC_Page() {
+		$this->tpl_main_page = '';
+	}
+}
+?>
Index: /branches/mobile/data/class/SC_Date.php
===================================================================
--- /branches/mobile/data/class/SC_Date.php	(revision 5934)
+++ /branches/mobile/data/class/SC_Date.php	(revision 5934)
@@ -0,0 +1,132 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/*¡¡Æü»þÉ½¼¨ÍÑ¥¯¥é¥¹ */
+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: /branches/mobile/data/class/GC_MobileEmoji.php
===================================================================
--- /branches/mobile/data/class/GC_MobileEmoji.php	(revision 11398)
+++ /branches/mobile/data/class/GC_MobileEmoji.php	(revision 11398)
@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * 表示できない絵文字を置き換える文字列 (Shift JIS)
+ * デフォルトは空文字列。
+ */
+define('MOBILE_EMOJI_SUBSTITUTE', '');
+
+/**
+ * 携帯端末の絵文字を扱うクラス
+ */
+class GC_MobileEmoji {
+	/**
+	 * 絵文字タグを各キャリア用の文字コードに変換する
+	 * output buffering 用コールバック関数
+	 *
+	 * @param string 入力
+	 * @return string 出力
+	 */
+	function handler($buffer) {
+		$replace_callback = create_function('$matches', 'return GC_MobileEmoji::indexToCode($matches[1]);');
+		return preg_replace_callback('/\[emoji:(e?\d+)\]/', $replace_callback, $buffer);
+	}
+
+	/**
+	 * 絵文字番号を絵文字を表す Shift JIS の文字列に変換する。
+	 *
+	 * @param string $index 絵文字番号
+	 * @return string 絵文字を表す Shift JIS の文字列を返す。
+	 */
+	function indexToCode($index) {
+		$carrier = GC_MobileUserAgent::getCarrier();
+		if ($carrier === false) {
+			return MOBILE_EMOJI_SUBSTITUTE;
+		}
+
+		static $arrMap;
+		if (!isset($arrMap)) {
+			$arrMap = @include_once(dirname(__FILE__) . "/../include/mobile_emoji_map_$carrier.inc");
+		}
+
+		return isset($arrMap[$index]) ? $arrMap[$index] : MOBILE_EMOJI_SUBSTITUTE;
+	}
+}
+?>
Index: /branches/mobile/data/class/SC_SiteInfo.php
===================================================================
--- /branches/mobile/data/class/SC_SiteInfo.php	(revision 5934)
+++ /branches/mobile/data/class/SC_SiteInfo.php	(revision 5934)
@@ -0,0 +1,37 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/* ¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+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: /branches/mobile/data/class/GC_SendMail.php
===================================================================
--- /branches/mobile/data/class/GC_SendMail.php	(revision 7180)
+++ /branches/mobile/data/class/GC_SendMail.php	(revision 7180)
@@ -0,0 +1,102 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+//--- ¥Æ¥­¥¹¥È/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", CHAR_CODE);
+		$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, "" . $this->return_path ) ) {
+			return true;
+		}
+		return false;
+	}
+
+	function sendHtmlMail() {
+
+		Mb_language( "Japanese" );	
+		
+		//¡¡¥á¡¼¥ëÁ÷¿®
+		if( mail( $this->to, $this->subject, $this->body, $this->header, "" . $this->return_path ) ) {
+			return true;
+		}
+		return false;
+	}
+}
+
+?>
Index: /branches/mobile/data/class/SC_Image.php
===================================================================
--- /branches/mobile/data/class/SC_Image.php	(revision 9284)
+++ /branches/mobile/data/class/SC_Image.php	(revision 9284)
@@ -0,0 +1,55 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+//---- ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë²Ã¹©¥¯¥é¥¹(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: /branches/mobile/data/class/SC_Session.php
===================================================================
--- /branches/mobile/data/class/SC_Session.php	(revision 5934)
+++ /branches/mobile/data/class/SC_Session.php	(revision 5934)
@@ -0,0 +1,93 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/* ¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */
+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: /branches/mobile/data/class/SC_FormParam.php
===================================================================
--- /branches/mobile/data/class/SC_FormParam.php	(revision 11411)
+++ /branches/mobile/data/class/SC_FormParam.php	(revision 11411)
@@ -0,0 +1,357 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/* ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹ */
+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;
+		$this->disp_name = array();
+		$this->keyname = array();
+		$this->length = array();
+		$this->convert = array();
+		$this->arrCheck = array();
+		$this->default = array();
+		$this->input_db = array();
+	}
+	
+	// ¥Ñ¥é¥á¡¼¥¿¤ÎÄÉ²Ã
+	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':
+				case 'FILE_NAME_CHECK':
+				case 'MOBILE_EMAIL_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: /branches/mobile/data/class/SC_UploadFile.php
===================================================================
--- /branches/mobile/data/class/SC_UploadFile.php	(revision 10445)
+++ /branches/mobile/data/class/SC_UploadFile.php	(revision 10445)
@@ -0,0 +1,312 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+$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, $rename = true) {
+		$objErr = new SC_CheckError();
+		$cnt = 0;
+		$arrKeyname = array_flip($this->keyname);
+		
+		if(!($_FILES[$keyname]['size'] > 0)) {
+			$objErr->arrErr[$keyname] = "¢¨ " . $this->disp_name[$arrKeyname[$keyname]] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<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 {
+							// °ì°Õ¤Ê¥Õ¥¡¥¤¥ëÌ¾¤òºîÀ®¤¹¤ë¡£
+							if($rename) {
+								$uniqname = date("mdHi") . "_" . uniqid("").".";
+								$this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']);
+							} else {
+								$this->temp_file[$cnt] = $_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, $real_size = false) {
+
+		$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];
+				}
+				$arrRet[$val]['filepath_dir'] = $this->temp_dir . $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];
+				}
+				$arrRet[$val]['filepath_dir'] = $this->save_dir . $this->save_file[$cnt];
+			}
+			if($arrRet[$val]['filepath'] != "") {
+				
+				if($real_size){
+					list($width, $height) = getimagesize($arrRet[$val]['filepath_dir']);
+					// ¥Õ¥¡¥¤¥ë²£Éý
+					$arrRet[$val]['width'] = $width;
+					// ¥Õ¥¡¥¤¥ë½ÄÉý
+					$arrRet[$val]['height'] = $height;
+				}else{
+					// ¥Õ¥¡¥¤¥ë²£Éý
+					$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;
+	}
+		
+	// ³ÈÂçÎ¨¤ò»ØÄê¤·¤Æ²èÁüÊÝÂ¸
+	function saveResizeImage($keyname, $to_w, $to_h) {
+		$path = "";
+		
+		// keyname¤ÎÅºÉÕ¥Õ¥¡¥¤¥ë¤ò¼èÆÀ
+		$arrImageKey = array_flip($this->keyname);
+		$file = $this->temp_file[$arrImageKey[$keyname]];
+		$filepath = $this->temp_dir . $file;
+		
+		$path = $this->makeThumb($filepath, $to_w, $to_h);
+		
+		// ¥Õ¥¡¥¤¥ëÌ¾¤À¤±ÊÖ¤¹
+		return basename($path);
+	}
+}
+?>
Index: /branches/mobile/data/conf/conf.php
===================================================================
--- /branches/mobile/data/conf/conf.php	(revision 10560)
+++ /branches/mobile/data/conf/conf.php	(revision 10560)
@@ -0,0 +1,964 @@
+<?php
+/**
+ * 
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ * 
+ */
+
+$CONF_PHP_PATH = realpath( dirname( __FILE__) );
+require_once($CONF_PHP_PATH ."/../install.inc");
+require_once($CONF_PHP_PATH ."/core.php" );
+
+//--------------------------------------------------------------------------------------------------------
+/** ¥Ñ¥¹´ØÏ¢ **/
+// ¥æ¡¼¥¶¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("USER_DIR", "user_data/");
+define("USER_PATH", HTML_PATH . USER_DIR);
+
+// ¥æ¡¼¥¶¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("USER_INC_PATH", USER_PATH . "include/");
+
+// ¥Ö¥í¥Ã¥¯¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("BLOC_DIR", "include/bloc/");
+define("BLOC_PATH", USER_PATH . BLOC_DIR);
+
+// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÊÝÂ¸Àè
+define("USER_TEMPLATE_DIR", "templates/");
+define("USER_TEMPLATE_PATH", USER_PATH . USER_TEMPLATE_DIR);
+// ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë°ì»þÊÝÂ¸Àè
+define("TEMPLATE_TEMP_DIR", HTML_PATH . "upload/temp_template/");
+
+// ¥æ¡¼¥¶¡¼ºîÀ®²èÌÌ¤Î¥Ç¥Õ¥©¥ë¥ÈPHP¥Õ¥¡¥¤¥ë
+define("USER_DEF_PHP", HTML_PATH . "__default.php");
+
+// ¤½¤ÎÂ¾²èÌÌ¤Î¥Ç¥Õ¥©¥ë¥È¥Ú¡¼¥¸¥ì¥¤¥¢¥¦¥È
+define("DEF_LAYOUT", "products/list.php");
+
+// ¥À¥¦¥ó¥í¡¼¥É¥â¥¸¥å¡¼¥ëÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê
+define("MODULE_DIR", "downloads/module/");
+define("MODULE_PATH", DATA_PATH . MODULE_DIR);
+
+// HotFixÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê
+define("UPDATE_DIR", "downloads/update/");
+define("UPDATE_PATH", DATA_PATH . UPDATE_DIR);
+//--------------------------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------------------------
+/** ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑ **/
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑ¥Õ¥¡¥¤¥ë³ÊÇ¼¾ì½ê¡¡
+define("UPDATE_HTTP", "http://www.lockon.co.jp/share/test/");
+
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑCSV1¹ÔÊÕ¤ê¤ÎºÇÂçÊ¸»ú¿ô
+define("UPDATE_CSV_LINE_MAX", 4096);
+// ¥¢¥Ã¥×¥Ç¡¼¥È´ÉÍýÍÑCSV¥«¥é¥à¿ô
+define("UPDATE_CSV_COL_MAX", 13);
+// ¥â¥¸¥å¡¼¥ë´ÉÍýÍÑCSV¥«¥é¥à¿ô
+define("MODULE_CSV_COL_MAX", 16);
+//--------------------------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------------------------
+/** ¥â¥¸¥å¡¼¥ë´ÉÍýÍÑ **/
+// ¥¨¥Ó¥¹¥¿¥°µ¡Ç½¤Î¥â¥¸¥å¡¼¥ëID
+define("EBIS_TAG_MID", 1);
+// ¥¢¥Õ¥£¥ê¥¨¥¤¥È¥¿¥°µ¡Ç½¤Î¥â¥¸¥å¡¼¥ëID
+define("AFF_TAG_MID", 3);
+// ¾¦ÉÊ¹ØÆþ´°Î»
+define("AFF_SHOPPING_COMPLETE", 1);
+// ¥æ¡¼¥¶ÅÐÏ¿´°Î»
+define("AFF_ENTRY_COMPLETE", 2);
+//--------------------------------------------------------------------------------------------------------
+
+// Ê¸»ú¥³¡¼¥É
+define("CHAR_CODE", "EUC-JP");
+
+// EC-CUBE¥Ð¡¼¥¸¥ç¥ó¾ðÊó
+define("ECCUBE_VERSION", "1.0.2a-beta");
+
+// ·èºÑ¥â¥¸¥å¡¼¥ëÉÕÍ¿Ê¸¸À
+define("ECCUBE_PAYMENT", "EC-CUBE");
+
+// PEAR::DB¤Î¥Ç¥Ð¥Ã¥°¥â¡¼¥É
+define('PEAR_DB_DEBUG', 9);
+
+//¥Ð¥Ã¥Á¤ò¼Â¹Ô¤¹¤ëºÇÃ»¤Î´Ö³Ö(ÉÃ)
+define("LOAD_BATCH_PASS", 3600);
+
+define("CLOSE_DAY", 31);	// Äù¤áÆü¤Î»ØÄê(ËöÆü¤Î¾ì¹ç¤Ï¡¢31¤ò»ØÄê¤·¤Æ¤¯¤À¤µ¤¤¡£)
+
+//°ìÈÌ¥µ¥¤¥È¥¨¥é¡¼
+define("FAVORITE_ERROR", 13);
+
+//¤ª¤¹¤¹¤á¾¦ÉÊ¿ô
+define ("RECOMMEND_PRODUCT_MAX", 4);
+
+/** ¥°¥é¥Õ´ØÏ¢ **/
+	
+define("LIB_DIR", DATA_PATH . "lib/");						// ¥é¥¤¥Ö¥é¥ê¤Î¥Ñ¥¹
+define("TTF_DIR", DATA_PATH . "fonts/");					// ¥Õ¥©¥ó¥È¤Î¥Ñ¥¹
+define("GRAPH_DIR", HTML_PATH . "upload/graph_image/");		// ¥°¥é¥Õ³ÊÇ¼¥Ç¥£¥ì¥¯¥È¥ê
+define("GRAPH_URL", URL_DIR . "upload/graph_image/");		// ¥°¥é¥ÕURL
+define("GRAPH_PIE_MAX", 10);								// ±ß¥°¥é¥ÕºÇÂçÉ½¼¨¿ô
+define("GRAPH_LABEL_MAX", 40);								// ¥°¥é¥Õ¤Î¥é¥Ù¥ë¤ÎÊ¸»ú¿ô
+
+/** ¥Ñ¥¹´ØÏ¢ **/
+
+define("PDF_DIR", DATA_PATH . "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);
+//±ÜÍ÷ÍúÎòÊÝÂ¸¿ô
+define("CUSTOMER_READING_MAX",30);
+//SSLURLÈ½Äê
+define("SSLURL_CHECK", 0);
+//´ÉÍý²èÌÌ¥¹¥Æ¡¼¥¿¥¹°ìÍ÷É½¼¨·ï¿ô
+define("ORDER_STATUS_MAX", 50);
+//¥Õ¥í¥ó¥È¥ì¥Ó¥å¡¼½ñ¤­¹þ¤ßºÇÂç¿ô
+define("REVIEW_REGIST_MAX", 5);
+
+/*
+ * ¥µ¥¤¥ÈÄêµÁÄê¿ô
+ */
+/* ¥·¥¹¥Æ¥à´ØÏ¢ */
+define ("ADMIN_ID", "1");								// ´ÉÍý¥æ¡¼¥¶ID(¥á¥ó¥Æ¥Ê¥ó¥¹ÍÑÉ½¼¨¤µ¤ì¤Ê¤¤¡£)
+define ("MELMAGA_SEND", true);							// ¥á¥ë¥Þ¥¬ÇÛ¿®ÍÞÀ©(false:OFF¡¢true:ON)
+define ("LOGIN_FRAME", "login_frame.tpl");				// ¥í¥°¥¤¥ó²èÌÌ¥Õ¥ì¡¼¥à
+define ("MAIN_FRAME", "main_frame.tpl");				// ´ÉÍý²èÌÌ¥Õ¥ì¡¼¥à
+define ("SITE_FRAME", "site_frame.tpl");				// °ìÈÌ¥µ¥¤¥È²èÌÌ¥Õ¥ì¡¼¥à
+define ("CERT_STRING", "7WDhcBTF");						// Ç§¾ÚÊ¸»úÎó
+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", "");												// ²ÃÌÁÅ¹¥³¡¼¥É(¥Ï¥¤¥Õ¥ó¤Ê¤·¤Ç¡Ë
+// 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", HTML_PATH . "../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_LOAN_ID", 5);			// ¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó
+define ("PAYMENT_CREDIT_ID",1);			// ¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É
+define ("PAYMENT_CONVENIENCE_ID", 2);	// ¥³¥ó¥Ó¥Ë·èºÑ
+
+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", 200);					// ÄÌ¾ï¥µ¥Ö²èÁü²£
+define("NORMAL_SUBIMAGE_HEIGHT", 200);					// ÄÌ¾ï¥µ¥Ö²èÁü½Ä
+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", 1000);								// ²èÁü¥µ¥¤¥ºÀ©¸Â(KB)
+define("CSV_SIZE", 2000);								// CSV¥µ¥¤¥ºÀ©¸Â(KB)
+define("PDF_SIZE", 5000);								// PDF¥µ¥¤¥ºÀ©¸Â(KB):¾¦ÉÊ¾ÜºÙ¥Õ¥¡¥¤¥ëÅù
+define("FILE_SIZE", 10000);								// ¥Õ¥¡¥¤¥ë´ÉÍý²èÌÌ¥¢¥Ã¥×À©¸Â(KB)
+define("TEMPLATE_SIZE", 10000);							// ¥¢¥Ã¥×¤Ç¤­¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ëÀ©¸Â(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", DATA_PATH . "logs/site.log");							// ¥í¥°¥Õ¥¡¥¤¥ë
+define ("CUSTOMER_LOG_PATH", DATA_PATH . "logs/customer.log");				// ²ñ°÷¥í¥°¥¤¥ó ¥í¥°¥Õ¥¡¥¤¥ë
+define ("TEMPLATE_ADMIN_DIR", DATA_PATH . "Smarty/templates/admin");		// SMARTY¥Æ¥ó¥×¥ì¡¼¥È
+define ("TEMPLATE_DIR", DATA_PATH . "Smarty/templates");					// SMARTY¥Æ¥ó¥×¥ì¡¼¥È
+define ("COMPILE_ADMIN_DIR", DATA_PATH . "Smarty/templates_c/admin");		// SMARTY¥³¥ó¥Ñ¥¤¥ë
+define ("COMPILE_DIR", DATA_PATH . "Smarty/templates_c");					// SMARTY¥³¥ó¥Ñ¥¤¥ë
+
+define ("TEMPLATE_FTP_DIR", USER_PATH . "templates/");			// SMARTY¥Æ¥ó¥×¥ì¡¼¥È(FTPµö²Ä)
+define ("COMPILE_FTP_DIR", DATA_PATH . "Smarty/templates_c/user_data/");	// SMARTY¥³¥ó¥Ñ¥¤¥ë
+
+define ("IMAGE_TEMP_DIR", HTML_PATH . "upload/temp_image/");				// ²èÁü°ì»þÊÝÂ¸
+define ("IMAGE_SAVE_DIR", HTML_PATH . "upload/save_image/");				// ²èÁüÊÝÂ¸Àè
+define ("IMAGE_TEMP_URL", URL_DIR . "upload/temp_image/");					// ²èÁü°ì»þÊÝÂ¸URL
+define ("IMAGE_SAVE_URL", URL_DIR . "upload/save_image/");					// ²èÁüÊÝÂ¸ÀèURL
+define ("IMAGE_TEMP_URL_RSS", SITE_URL . "upload/temp_image/");				// RSSÍÑ²èÁü°ì»þÊÝÂ¸URL
+define ("IMAGE_SAVE_URL_RSS", SITE_URL . "upload/save_image/");				// RSSÍÑ²èÁüÊÝÂ¸ÀèURL
+define ("CSV_TEMP_DIR", HTML_PATH . "upload/csv/");							// ¥¨¥ó¥³¡¼¥ÉCSV¤Î°ì»þÊÝÂ¸Àè
+define ("NO_IMAGE_URL", URL_DIR . "misc/blank.gif");						// ²èÁü¤¬¤Ê¤¤¾ì¹ç¤ËÉ½¼¨
+define ("NO_IMAGE_DIR", HTML_PATH . "misc/blank.gif");						// ²èÁü¤¬¤Ê¤¤¾ì¹ç¤ËÉ½¼¨
+
+/* URL¥Ñ¥¹ */
+define ("URL_SYSTEM_TOP", URL_DIR . "admin/system/index.php");			// ¥·¥¹¥Æ¥à´ÉÍý¥È¥Ã¥×
+define ("URL_CLASS_REGIST", URL_DIR . "admin/products/class.php");		// µ¬³ÊÅÐÏ¿
+define ("URL_INPUT_ZIP", URL_DIR . "input_zip.php");					// Í¹ÊØÈÖ¹æÆþÎÏ
+define ("URL_DELIVERY_TOP", URL_DIR . "admin/basis/delivery.php");		// ÇÛÁ÷¶È¼ÔÅÐÏ¿
+define ("URL_PAYMENT_TOP", URL_DIR . "admin/basis/payment.php");		// »ÙÊ§¤¤ÊýË¡ÅÐÏ¿
+define ("URL_HOME", URL_DIR . "admin/home.php");						// ¥Û¡¼¥à
+define ("URL_LOGIN", URL_DIR . "admin/index.php");						// ¥í¥°¥¤¥ó¥Ú¡¼¥¸
+define ("URL_SEARCH_TOP", URL_DIR . "admin/products/index.php");		// ¾¦ÉÊ¸¡º÷¥Ú¡¼¥¸
+define ("URL_ORDER_EDIT", URL_DIR . "admin/order/edit.php");			// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_SEARCH_ORDER", URL_DIR . "admin/order/index.php");			// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_ORDER_MAIL", URL_DIR . "admin/order/mail.php");			// ÃíÊ¸ÊÔ½¸¥Ú¡¼¥¸
+define ("URL_LOGOUT", URL_DIR . "admin/logout.php");					// ¥í¥°¥¢¥¦¥È¥Ú¡¼¥¸
+define ("URL_SYSTEM_CSV", URL_DIR . "admin/system/member_csv.php");		// ¥·¥¹¥Æ¥à´ÉÍýCSV½ÐÎÏ¥Ú¡¼¥¸
+define ("URL_SYSTEM_TOP", URL_DIR . "admin/system/index.php");			// ¥·¥¹¥Æ¥à´ÉÍýTOP¥Ú¡¼¥¸
+define ("URL_ADMIN_CSS", URL_DIR . "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 ("FILE_NAME_LEN", 10);		// ¥Õ¥¡¥¤¥ëÌ¾É½¼¨Ê¸»ú¿ô
+
+/** ¥Õ¥í¥ó¥È¥Ú¡¼¥¸ **/
+
+/* ¥·¥¹¥Æ¥à´ØÏ¢ */
+define ("SALE_LIMIT_MAX", 10);		// ¹ØÆþÀ©¸Â¤Ê¤·¤Î¾ì¹ç¤ÎºÇÂç¹ØÆþ¸Ä¿ô
+define ("SITE_TITLE", "£Å£Ã-£Ã£Õ£Â£Å  ¥Æ¥¹¥È¥µ¥¤¥È");	// HTML¥¿¥¤¥È¥ë
+define ("COOKIE_EXPIRE", 365);		// ¥¯¥Ã¥­¡¼ÊÝ»ý´ü¸Â(Æü)
+define ("FREE_DIAL", "");
+
+/* °ìÈÌ¥µ¥¤¥È¥¨¥é¡¼ */
+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 ("FREE_ERROR_MSG", 999);		// ¥Õ¥ê¡¼¥á¥Ã¥»¡¼¥¸
+
+/* É½¼¨´ØÏ¢ */
+define ("SEPA_CATNAVI", " > ");	// ¥«¥Æ¥´¥ê¶èÀÚ¤êÊ¸»ú
+define ("SEPA_CATLIST", " | ");	// ¥«¥Æ¥´¥ê¶èÀÚ¤êÊ¸»ú
+
+/* URL */
+define ("URL_SHOP_TOP", SSL_URL . "shopping/index.php");						// ²ñ°÷¾ðÊóÆþÎÏ
+define ("URL_ENTRY_TOP", SSL_URL . "entry/index.php");	 						// ²ñ°÷ÅÐÏ¿¥Ú¡¼¥¸TOP
+define ("URL_SITE_TOP", URL_DIR . "index.php");									// ¥µ¥¤¥È¥È¥Ã¥×
+define ("URL_CART_TOP", URL_DIR . "cart/index.php");							// ¥«¡¼¥È¥È¥Ã¥×
+define ("URL_MYPAGE_TOP", SSL_URL . "mypage/login.php");						// My¥Ú¡¼¥¸¥È¥Ã¥×
+define ("URL_SHOP_CONFIRM", URL_DIR . "shopping/confirm.php");					// ¹ØÆþ³ÎÇ§¥Ú¡¼¥¸
+define ("URL_SHOP_PAYMENT", URL_DIR . "shopping/payment.php");					// ¤ª»ÙÊ§¤¤ÊýË¡ÁªÂò¥Ú¡¼¥¸
+define ("URL_SHOP_COMPLETE", URL_DIR . "shopping/complete.php");				// ¹ØÆþ´°Î»²èÌÌ
+define ("URL_SHOP_CREDIT", URL_DIR . "shopping/card.php");						// ¥«¡¼¥É·èºÑ²èÌÌ
+define ("URL_SHOP_LOAN", URL_DIR . "shopping/loan.php");						// ¥í¡¼¥ó·èºÑ²èÌÌ
+define ("URL_SHOP_CONVENIENCE", URL_DIR . "shopping/convenience.php");			// ¥³¥ó¥Ó¥Ë·èºÑ²èÌÌ
+define ("URL_SHOP_MODULE", URL_DIR . "shopping/load_payment_module.php");		// ¥â¥¸¥å¡¼¥ëÄÉ²ÃÍÑ²èÌÌ
+define ("URL_PRODUCTS_TOP", URL_DIR . "products/top.php");						// ¾¦ÉÊ¥È¥Ã¥×
+define ("LIST_P_HTML", URL_DIR . "products/list-p");							// ¾¦ÉÊ°ìÍ÷(HTML½ÐÎÏ)
+define ("LIST_C_HTML", URL_DIR . "products/list.php?mode=search&category_id=");	// ¾¦ÉÊ°ìÍ÷(HTML½ÐÎÏ)
+define ("DETAIL_P_HTML", URL_DIR . "products/detail.php?product_id=");			// ¾¦ÉÊ¾ÜºÙ(HTML½ÐÎÏ)
+define ("MYPAGE_DELIVADDR_URL", URL_DIR . "mypage/delivery.php");				// ¥Þ¥¤¥Ú¡¼¥¸¤ªÆÏ¤±ÀèURL
+
+/*
+ * ¥µ¥¤¥ÈÄêµÁÊÑ¿ô
+ */
+ 
+// ¥¢¥¯¥»¥¹¸¢¸Â
+// 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] = URL_DIR . "img/right_product/icon01.gif";
+$arrSTATUS_IMAGE[2] = URL_DIR . "img/right_product/icon02.gif";
+$arrSTATUS_IMAGE[3] = URL_DIR . "img/right_product/icon03.gif";
+$arrSTATUS_IMAGE[4] = URL_DIR . "img/right_product/icon04.gif";
+$arrSTATUS_IMAGE[5] = URL_DIR . "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 => "±Ä¶È¡¦ÈÎÇä",
+					10 => "¸¦µæ¡¦³«È¯",
+					11 => "¹­Êó¡¦ÀëÅÁ",
+					12 => "´ë²è¡¦¥Þ¡¼¥±¥Æ¥£¥ó¥°",
+					13 => "¥Ç¥¶¥¤¥ó´Ø·¸",
+					14 => "²ñ¼Ò·Ð±Ä¡¦Ìò°÷",
+					15 => "½ÐÈÇ¡¦¥Þ¥¹¥³¥ß´Ø·¸",
+					16 => "³ØÀ¸¡¦¥Õ¥ê¡¼¥¿¡¼",
+					17 => "¼çÉØ",
+					18 => "¤½¤ÎÂ¾"
+				);
+
+/* ¥Ñ¥¹¥ï¡¼¥É¤ÎÅú¤¨ÇÛÎó */
+$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 => "Æþ¶âÂÔ¤Á",
+	6 => "Æþ¶âºÑ¤ß",
+	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",
+	6 => "#FFFFAB"
+);
+
+// ÍËÆü
+$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'
+);
+
+// ¥Ö¥í¥Ã¥¯ÇÛÃÖ
+$arrTarget = array(
+	1 => "LeftNavi",
+	2 => "MainHead",
+	3 => "RightNavi",
+	4 => "MainFoot",
+	5 => "Unused"
+);
+
+
+// View¤ÎWhere¶çÃÖ´¹ÍÑ
+$arrViewWhere = array(
+	"&&crscls_where&&" => "",
+	"&&crsprdcls_where&&" =>"",
+	"&&noncls_where&&" => "",
+	"&&allcls_where&&" => "",
+	"&&allclsdtl_where&&" => "",
+	"&&prdcls_where&&" => "",
+	"&&catcnt_where&&" => ""
+);
+
+// ViewÊÑ´¹ÍÑ(MySQLÂÐ±þ)
+$arrView = array(
+	"vw_cross_class" => '
+		(SELECT T1.class_id AS class_id1, T2.class_id AS class_id2, T1.classcategory_id AS classcategory_id1, T2.classcategory_id AS classcategory_id2, T1.name AS name1, T2.name AS name2, T1.rank AS rank1, T2.rank AS rank2
+		FROM dtb_classcategory AS T1, dtb_classcategory AS T2 ) ',
+
+	"vw_cross_products_class" =>'
+		(SELECT T1.class_id1, T1.class_id2, T1.classcategory_id1, T1.classcategory_id2, T2.product_id,
+		T1.name1, T1.name2, T2.product_code, T2.stock, T2.price01, T2.price02, T1.rank1, T1.rank2
+		FROM (SELECT T1.class_id AS class_id1, T2.class_id AS class_id2, T1.classcategory_id AS classcategory_id1, T2.classcategory_id AS classcategory_id2, T1.name AS name1, T2.name AS name2, T1.rank AS rank1, T2.rank AS rank2
+		FROM dtb_classcategory AS T1, dtb_classcategory AS T2 ) AS T1 LEFT JOIN dtb_products_class AS T2 
+		ON T1.classcategory_id1 = T2.classcategory_id1 AND T1.classcategory_id2 = T2.classcategory_id2) ',
+
+	"vw_products_nonclass" => '
+		(SELECT 
+		    T1.product_id,
+		    T1.name,
+		    T1.deliv_fee,
+		    T1.sale_limit,
+		    T1.sale_unlimited,
+		    T1.category_id,
+		    T1.rank,
+		    T1.status,
+		    T1.product_flag,
+		    T1.point_rate,
+		    T1.comment1,
+		    T1.comment2,
+		    T1.comment3,
+		    T1.comment4,
+		    T1.comment5,
+		    T1.comment6,
+		    T1.file1,
+		    T1.file2,
+		    T1.file3,
+		    T1.file4,
+		    T1.file5,
+		    T1.file6,
+		    T1.main_list_comment,
+		    T1.main_list_image,
+		    T1.main_comment,
+		    T1.main_image,
+		    T1.main_large_image,
+		    T1.sub_title1,
+		    T1.sub_comment1,
+		    T1.sub_image1,
+		    T1.sub_large_image1,
+		    T1.sub_title2,
+		    T1.sub_comment2,
+		    T1.sub_image2,
+		    T1.sub_large_image2,
+		    T1.sub_title3,
+		    T1.sub_comment3,
+		    T1.sub_image3,
+		    T1.sub_large_image3,
+		    T1.sub_title4,
+		    T1.sub_comment4,
+		    T1.sub_image4,
+		    T1.sub_large_image4,
+		    T1.sub_title5,
+		    T1.sub_comment5,
+		    T1.sub_image5,
+		    T1.sub_large_image5,
+		    T1.sub_title6,
+		    T1.sub_comment6,
+		    T1.sub_image6,
+		    T1.sub_large_image6,
+		    T1.del_flg,
+		    T1.creator_id,
+		    T1.create_date,
+		    T1.update_date,
+		    T1.deliv_date_id,
+		    T2.product_id_sub,
+		    T2.product_code,
+		    T2.price01,
+		    T2.price02,
+		    T2.stock,
+		    T2.stock_unlimited,
+		    T2.classcategory_id1,
+		    T2.classcategory_id2
+		FROM (SELECT * FROM dtb_products &&noncls_where&&) AS T1 LEFT JOIN 
+		(SELECT
+		product_id AS product_id_sub,
+		product_code,
+		price01,
+		price02,
+		stock,
+		stock_unlimited,
+		classcategory_id1,
+		classcategory_id2
+		FROM dtb_products_class WHERE classcategory_id1 = 0 AND classcategory_id2 = 0) 
+		AS T2
+		ON T1.product_id = T2.product_id_sub) ',
+
+	"vw_products_allclass" => '
+		(SELECT
+        product_id,
+        product_code_min,
+        product_code_max,
+        price01_min,
+        price01_max,
+        price02_min,
+        price02_max,
+        stock_min,
+        stock_max,
+        stock_unlimited_min,
+        stock_unlimited_max,
+        del_flg,
+        status,
+        name,
+        comment1,
+        comment2,
+        comment3,
+        rank,
+        main_list_comment,
+        main_image,
+        main_list_image,
+        product_flag,
+        deliv_date_id,
+        sale_limit,
+        point_rate,
+        sale_unlimited,
+        create_date,
+        deliv_fee
+        ,(SELECT rank AS category_rank FROM dtb_category AS T4 WHERE T1.category_id = T4.category_id) as category_rank
+        ,(SELECT category_id AS sub_category_id FROM dtb_category T4 WHERE T1.category_id = T4.category_id) as category_id
+    FROM
+        dtb_products AS T1 RIGHT JOIN (SELECT product_id AS product_id_sub, MIN(product_code) AS product_code_min, MAX(product_code) AS product_code_max, MIN(price01) AS price01_min, MAX(price01) AS price01_max, MIN(price02) AS price02_min, MAX(price02) AS price02_max, MIN(stock) AS stock_min, MAX(stock) AS stock_max, MIN(stock_unlimited) AS stock_unlimited_min, MAX(stock_unlimited) AS stock_unlimited_max FROM dtb_products_class GROUP BY product_id) AS T2 ON T1.product_id = T2.product_id_sub
+    ) ',
+
+	"vw_products_allclass_detail" => '
+		(SELECT product_id,price01_min,price01_max,price02_min,price02_max,stock_min,stock_max,stock_unlimited_min,stock_unlimited_max,
+		del_flg,status,name,comment1,comment2,comment3,deliv_fee,main_comment,main_image,main_large_image,
+		sub_title1,sub_comment1,sub_image1,sub_large_image1,
+		sub_title2,sub_comment2,sub_image2,sub_large_image2,
+		sub_title3,sub_comment3,sub_image3,sub_large_image3,
+		sub_title4,sub_comment4,sub_image4,sub_large_image4,
+		sub_title5,sub_comment5,sub_image5,sub_large_image5,
+		product_flag,deliv_date_id,sale_limit,point_rate,sale_unlimited,file1,file2,category_id
+		FROM ( SELECT * FROM (dtb_products AS T1 RIGHT JOIN 
+		(SELECT 
+		product_id AS product_id_sub,
+		MIN(price01) AS price01_min,
+		MAX(price01) AS price01_max,
+		MIN(price02) AS price02_min,
+		MAX(price02) AS price02_max,
+		MIN(stock) AS stock_min,
+		MAX(stock) AS stock_max,
+		MIN(stock_unlimited) AS stock_unlimited_min,
+		MAX(stock_unlimited) AS stock_unlimited_max
+		FROM dtb_products_class GROUP BY product_id) AS T2
+		ON T1.product_id = T2.product_id_sub ) ) AS T3 LEFT JOIN (SELECT rank AS category_rank, category_id AS sub_category_id FROM dtb_category) AS T4
+		ON T3.category_id = T4.sub_category_id) ',
+
+	"vw_product_class" => '
+		(SELECT * FROM 
+		(SELECT T3.product_class_id, T3.product_id AS product_id_sub, classcategory_id1, classcategory_id2, 
+		T3.rank AS rank1, T4.rank AS rank2, T3.class_id AS class_id1, T4.class_id AS class_id2,
+		stock, price01, price02, stock_unlimited, product_code
+		FROM ( SELECT 
+		        T1.product_class_id,
+		        T1.product_id,
+		        classcategory_id1,
+		        classcategory_id2,
+		        T2.rank,
+		        T2.class_id,
+		        stock,
+		        price01,
+		        price02,
+		        stock_unlimited,
+		        product_code		
+		 FROM (dtb_products_class AS T1 LEFT JOIN dtb_classcategory AS T2
+		ON T1.classcategory_id1 = T2.classcategory_id))
+		AS T3 LEFT JOIN dtb_classcategory AS T4
+		ON T3.classcategory_id2 = T4.classcategory_id) AS T5 LEFT JOIN dtb_products AS T6
+		ON product_id_sub = T6.product_id) ',
+
+	"vw_category_count" => '
+		(SELECT T1.category_id, T1.category_name, T1.parent_category_id, T1.level, T1.rank, T2.product_count
+		FROM dtb_category AS T1 LEFT JOIN dtb_category_total_count AS T2
+		ON T1.category_id = T2.category_id) '
+);
+
+?>
Index: /branches/mobile/data/conf/mobile.conf
===================================================================
--- /branches/mobile/data/conf/mobile.conf	(revision 11457)
+++ /branches/mobile/data/conf/mobile.conf	(revision 11457)
@@ -0,0 +1,77 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È¶¦Í­ÀßÄê¥Õ¥¡¥¤¥ë
+ */
+
+// ¥â¥Ð¥¤¥ë¥µ¥¤¥ÈÀßÄê¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¹þ¤à¡£
+require_once(dirname(__FILE__) . '/../install_mobile.inc');
+
+
+//--------------------------------------------------------------------------------------------------------
+// conf.php ¤ÇÄêµÁ¤µ¤ì¤ëÄê¿ô¤Î¤¦¤Á¡¢¥â¥Ð¥¤¥ë¥µ¥¤¥ÈÍÑ¤ËÊÑ¹¹¤¬É¬Í×¤Ê¤â¤Î
+
+define('TEMPLATE_DIR', DATA_PATH . 'Smarty/templates/mobile');	// SMARTY¥Æ¥ó¥×¥ì¡¼¥È
+define('COMPILE_DIR', DATA_PATH . 'Smarty/templates_c/mobile');	// SMARTY¥³¥ó¥Ñ¥¤¥ë
+define('IMAGE_TEMP_DIR', PC_HTML_PATH . 'upload/temp_image/');	// ²èÁü°ì»þÊÝÂ¸
+define('IMAGE_SAVE_DIR', PC_HTML_PATH . 'upload/save_image/');	// ²èÁüÊÝÂ¸Àè
+define('IMAGE_TEMP_URL', PC_URL_DIR . 'upload/temp_image/');	// ²èÁü°ì»þÊÝÂ¸URL
+define('IMAGE_SAVE_URL', PC_URL_DIR . 'upload/save_image/');	// ²èÁüÊÝÂ¸ÀèURL
+
+
+//--------------------------------------------------------------------------------------------------------
+// ¥â¥Ð¥¤¥ë¥µ¥¤¥ÈÀìÍÑ¤ÎÀßÄê
+
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È¤Ç¤¢¤ë¤³¤È¤òÉ½¤¹Äê¿ô
+ */
+define('MOBILE_SITE', true);
+
+/**
+ * ¥»¥Ã¥·¥ç¥ó¤ÎÂ¸Â³»þ´Ö (ÉÃ)
+ */
+define('MOBILE_SESSION_LIFETIME', 1800);
+
+/**
+ * ¶õ¥á¡¼¥ëµ¡Ç½¤ò»ÈÍÑ¤¹¤ë¤«¤É¤¦¤«
+ */
+define('MOBILE_USE_KARA_MAIL', false);
+
+/**
+ * ¶õ¥á¡¼¥ë¼õ¤±ÉÕ¤±¥¢¥É¥ì¥¹¤Î¥æ¡¼¥¶¡¼Ì¾ÉôÊ¬
+ */
+define('MOBILE_KARA_MAIL_ADDRESS_USER', 'eccube');
+
+/**
+ * ¶õ¥á¡¼¥ë¼õ¤±ÉÕ¤±¥¢¥É¥ì¥¹¤Î¥æ¡¼¥¶¡¼Ì¾¤È¥³¥Þ¥ó¥É¤Î´Ö¤Î¶èÀÚ¤êÊ¸»ú
+ * qmail ¤Î¾ì¹ç¤Ï '-'
+ */
+define('MOBILE_KARA_MAIL_ADDRESS_DELIMITER', '+');
+
+/**
+ * ¶õ¥á¡¼¥ë¼õ¤±ÉÕ¤±¥¢¥É¥ì¥¹¤Î¥É¥á¥¤¥óÉôÊ¬
+ */
+define('MOBILE_KARA_MAIL_ADDRESS_DOMAIN', 'mobile.ec-cube.net');
+
+/**
+ * ·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤Ï¤Ê¤¤¤¬¡¢·ÈÂÓ¤À¤È¤ß¤Ê¤¹¥É¥á¥¤¥ó¤Î¥ê¥¹¥È
+ * Ç¤°Õ¤Î¿ô¤Î¡Ö,¡×¡Ö ¡×¤Ç¶èÀÚ¤ë¡£
+ */
+define('MOBILE_ADDITIONAL_MAIL_DOMAINS', 'lockon.co.jp, rebelt.co.jp');
+
+/**
+ * ·ÈÂÓÅÅÏÃ¸þ¤±ÊÑ´¹²èÁüÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê
+ */
+define('MOBILE_IMAGE_DIR', HTML_PATH . 'converted_images');
+define('MOBILE_IMAGE_URL', URL_DIR . 'converted_images');
+
+
+//--------------------------------------------------------------------------------------------------------
+// conf.php ¤«¤é»Ä¤ê¤ÎÀßÄê¤òÆÉ¤ß¹þ¤à¡£
+// Äê¿ô¤ÎÄêµÁ¤¬½ÅÊ£¤¹¤ë¤¿¤á¡¢error_reporting ¤Î¥ì¥Ù¥ë¤òÄ´À°¤¹¤ë¡£
+
+$error_reporting = error_reporting();
+error_reporting($error_reporting & ~E_NOTICE);
+require_once(DATA_PATH . 'conf/conf.php');
+error_reporting($error_reporting);
+unset($error_reporting);
+?>
Index: /branches/mobile/data/conf/core.php
===================================================================
--- /branches/mobile/data/conf/core.php	(revision 6557)
+++ /branches/mobile/data/conf/core.php	(revision 6557)
@@ -0,0 +1,33 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+///////////////////////////////////////////////////////////
+/*
+	¥µ¥¤¥È¤´¤È¤ËÉ¬¤ºÊÑ¹¹¤¹¤ëÀßÄê
+*/
+///////////////////////////////////////////////////////////
+
+// DB¥¨¥é¡¼¥á¡¼¥ëÁ÷¿®Àè
+define ("DB_ERROR_MAIL_TO", "error-ml@lockon.co.jp");
+
+// DB¥¨¥é¡¼¥á¡¼¥ë·ïÌ¾
+define ("DB_ERROR_MAIL_SUBJECT", "OS_TEST_ERROR");
+
+if(defined('DB_TYPE') && defined('DB_USER') && defined('DB_PASSWORD') && defined('DB_SERVER') && defined('DB_PORT') && defined('DB_NAME')) {
+	// ¥µ¥¤¥ÈÍÑDB
+	define ("DEFAULT_DSN", DB_TYPE . "://" . DB_USER . ":" . DB_PASSWORD . "@" . DB_SERVER . ":" .DB_PORT . "/" . DB_NAME);
+}
+
+// Í¹ÊØÈÖ¹æÀìÍÑDB
+define ("ZIP_DSN", DEFAULT_DSN);
+
+define ("USER_URL", SITE_URL."user_data/"); // ¥æ¡¼¥¶¡¼ºîÀ®¥Ú¡¼¥¸Åù 
+
+// Ç§¾ÚÍÑ magic
+define ("AUTH_MAGIC", "31eafcbd7a81d7b401a7fdc12bba047c02d1fae6");
+
+?>
Index: /branches/mobile/data/install_mobile.inc
===================================================================
--- /branches/mobile/data/install_mobile.inc	(revision 11400)
+++ /branches/mobile/data/install_mobile.inc	(revision 11400)
@@ -0,0 +1,19 @@
+<?php
+    define ('ECCUBE_INSTALL', 'ON');
+    define ('HTML_PATH', '/home/web/mobile.ec-cube.net/html/mobile/');
+    define ('PC_HTML_PATH', '/home/web/mobile.ec-cube.net/html/');
+    define ('SITE_URL', 'http://mobile.ec-cube.net/mobile/');
+    define ('PC_SITE_URL', 'http://mobile.ec-cube.net/');
+    define ('SSL_URL', 'http://mobile.ec-cube.net/mobile/');
+    define ('PC_SSL_URL', 'http://mobile.ec-cube.net/');
+    define ('URL_DIR', '/mobile/');
+    define ('PC_URL_DIR', '/');
+    define ('DOMAIN_NAME', '');
+    define ('DB_TYPE', 'mysql');
+    define ('DB_USER', 'mobile_db_user');
+    define ('DB_PASSWORD', 'password');
+    define ('DB_SERVER', '127.0.0.1');
+    define ('DB_NAME', 'mobile_db');
+    define ('DB_PORT', '3307');
+    define ('DATA_PATH', '/home/web/mobile.ec-cube.net/html/../data/');
+?>
Index: /branches/mobile/data/module/DB/ibase.php
===================================================================
--- /branches/mobile/data/module/DB/ibase.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/storage.php
===================================================================
--- /branches/mobile/data/module/DB/storage.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/mysql.php
===================================================================
--- /branches/mobile/data/module/DB/mysql.php	(revision 5277)
+++ /branches/mobile/data/module/DB/mysql.php	(revision 5277)
@@ -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_PHP_DIR . '/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: /branches/mobile/data/module/DB/ifx.php
===================================================================
--- /branches/mobile/data/module/DB/ifx.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/pgsql.php
===================================================================
--- /branches/mobile/data/module/DB/pgsql.php	(revision 6114)
+++ /branches/mobile/data/module/DB/pgsql.php	(revision 6114)
@@ -0,0 +1,1098 @@
+<?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: /branches/mobile/data/module/DB/sybase.php
===================================================================
--- /branches/mobile/data/module/DB/sybase.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/fbsql.php
===================================================================
--- /branches/mobile/data/module/DB/fbsql.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/odbc.php
===================================================================
--- /branches/mobile/data/module/DB/odbc.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/common.php
===================================================================
--- /branches/mobile/data/module/DB/common.php	(revision 10236)
+++ /branches/mobile/data/module/DB/common.php	(revision 10236)
@@ -0,0 +1,2161 @@
+<?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 DB_PHP_DIR . '/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) {
+				if ($value != "") {
+					$realquery .= $this->quoteSmart($value);
+				}else{
+					$realquery .= 'NULL';
+				}
+            } 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: /branches/mobile/data/module/DB/msql.php
===================================================================
--- /branches/mobile/data/module/DB/msql.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/dbase.php
===================================================================
--- /branches/mobile/data/module/DB/dbase.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/mysqli.php
===================================================================
--- /branches/mobile/data/module/DB/mysqli.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/mssql.php
===================================================================
--- /branches/mobile/data/module/DB/mssql.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/sqlite.php
===================================================================
--- /branches/mobile/data/module/DB/sqlite.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/DB/oci8.php
===================================================================
--- /branches/mobile/data/module/DB/oci8.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Net/UserAgent/Mobile/EZweb.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/EZweb.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/EZweb.php	(revision 11456)
@@ -0,0 +1,347 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: EZweb.php,v 1.17 2007/02/20 15:19:07 kuboa Exp $
+ * @link       http://www.au.kddi.com/ezfactory/tec/spec/4_4.html
+ * @link       http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      File available since Release 0.1.0
+ */
+
+require_once(dirname(__FILE__) . '/Common.php');
+require_once(dirname(__FILE__) . '/Display.php');
+
+// {{{ Net_UserAgent_Mobile_EZweb
+
+/**
+ * EZweb implementation
+ *
+ * Net_UserAgent_Mobile_EZweb is a subclass of
+ * {@link Net_UserAgent_Mobile_Common}, which implements EZweb (WAP1.0/2.0)
+ * user agents.
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $_SERVER['HTTP_USER_AGENT'] = 'UP.Browser/3.01-HI02 UP.Link/3.2.1.2';
+ * $agent = &Net_UserAgent_Mobile::factory();
+ *
+ * printf("Name: %s\n", $agent->getName()); // 'UP.Browser'
+ * printf("Version: %s\n", $agent->getVersion()); // 3.01
+ * printf("DeviceID: %s\n", $agent->getDeviceID()); // 'HI02'
+ * printf("Server: %s\n", $agent->getServer()); // 'UP.Link/3.2.1.2'
+ *
+ * e.g.) 'UP.Browser/3.01-HI02 UP.Link/3.2.1.2 (Google WAP Proxy/1.0)'
+ * printf("Comment: %s\n", $agent->getComment()); // 'Google WAP Proxy/1.0'
+ *
+ * e.g.) 'KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1'
+ * if ($agent->isXHTMLCompliant()) {
+ *     print "XHTML compliant!\n"; // true
+ * }
+ * </code>
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @link       http://www.au.kddi.com/ezfactory/tec/spec/4_4.html
+ * @link       http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      Class available since Release 0.1.0
+ */
+class Net_UserAgent_Mobile_EZweb extends Net_UserAgent_Mobile_Common
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * name of the model like 'P502i'
+     * @var string
+     */
+    var $_model = '';
+
+    /**
+     * device ID like 'TS21'
+     * @var string
+     */
+    var $_deviceID = '';
+
+    /**
+     * server string like 'UP.Link/3.2.1.2'
+     * @var string
+     */
+    var $_serverName = '';
+
+    /**
+     * comment like 'Google WAP Proxy/1.0'
+     * @var string
+     */
+    var $_comment = null;
+
+    /**
+     * whether it's XHTML compliant or not
+     * @var boolean
+     */
+    var $_xhtmlCompliant = false;
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ isEZweb()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isEZweb()
+    {
+        return true;
+    }
+
+    // }}}
+    // {{{ isTUKa()
+
+    /**
+     * returns true if the agent is TU-Ka
+     *
+     * @return boolean
+     */
+    function isTUKa()
+    {
+        $tuka = substr($this->_deviceID, 2, 1);
+        if ($this->isWAP2()) {
+            if ($tuka == 'U') {
+                return true;
+            }
+        } else {
+            if ($tuka == 'T') {
+                return true;
+            }
+        }
+        
+        return false;
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * parse HTTP_USER_AGENT string
+     */
+    function parse()
+    {
+        $agent = $this->getUserAgent();
+
+        if (preg_match('/^KDDI-(.*)/', $agent, $matches)) {
+
+            // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1
+            $this->_xhtmlCompliant = true;
+            list($this->_deviceID, $browser, $opt, $this->_serverName) =
+                explode(' ', $matches[1], 4);
+            list($this->name, $version) = explode('/', $browser);
+            $this->version = "$version $opt";
+        } else {
+
+            // UP.Browser/3.01-HI01 UP.Link/3.4.5.2
+            @list($browser, $this->_serverName, $comment) =
+                explode(' ', $agent, 3);
+            list($this->name, $software) = explode('/', $browser);
+            list($this->version, $this->_deviceID) =
+                explode('-', $software);
+            if ($comment) {
+                $this->_comment =
+                    preg_replace('/^\((.*)\)$/', '$1', $comment);
+            }
+        }
+
+        $this->_model = $this->_deviceID;
+    }
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new {@link Net_UserAgent_Mobile_Display} class instance
+     *
+     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
+     *     object
+     * @see Net_UserAgent_Mobile_Display
+     */
+    function makeDisplay()
+    {
+        @list($width, $height) =
+            explode(',', $this->getHeader('x-up-devcap-screenpixels'));
+        $screenDepth =
+            explode(',', $this->getHeader('x-up-devcap-screendepth'));
+        $depth = $screenDepth[0] ? pow(2, (integer)$screenDepth[0]) : 0;
+        $color =
+            $this->getHeader('x-up-devcap-iscolor') === '1' ? true : false;
+        return new Net_UserAgent_Mobile_Display(array(
+                                                      'width'  => $width,
+                                                      'height' => $height,
+                                                      'color'  => $color,
+                                                      'depth'  => $depth
+                                                      )
+                                                );
+    }
+
+    // }}}
+    // {{{ getModel()
+
+    /**
+     * returns name of the model (device ID) like 'TS21'
+     *
+     * @return string
+     */
+    function getModel()
+    {
+        return $this->_model;
+    }
+
+    // }}}
+    // {{{ getDeviceID()
+
+    /**
+     * returns device ID like 'TS21'
+     *
+     * @return string
+     */
+    function getDeviceID()
+    {
+        return $this->_deviceID;
+    }
+
+    // }}}
+    // {{{ getServer()
+
+    /**
+     * returns server string like 'UP.Link/3.2.1.2'
+     *
+     * @return string
+     */
+    function getServer()
+    {
+        return $this->_serverName;
+    }
+
+    // }}}
+    // {{{ getComment()
+
+    /**
+     * returns comment like 'Google WAP Proxy/1.0'. returns null if nothinng.
+     *
+     * @return boolean
+     */
+    function getComment()
+    {
+        return $this->_comment;
+    }
+
+    // }}}
+    // {{{ isXHTMLCompliant()
+
+    /**
+     * returns whether it's XHTML compliant or not
+     *
+     * @return boolean
+     */
+    function isXHTMLCompliant()
+    {
+        return $this->_xhtmlCompliant;
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierShortName()
+    {
+        return 'E';
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierLongName()
+    {
+        return 'EZweb';
+    }
+
+    // }}}
+    // {{{ isWIN()
+
+    /**
+     * Returns whether the agent is CDMA 1X WIN or not.
+     *
+     * @return boolean
+     */
+    function isWIN()
+    {
+        return substr($this->_deviceID, 2, 1) == 3 ? true : false;
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile/AirHPhone.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/AirHPhone.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/AirHPhone.php	(revision 11456)
@@ -0,0 +1,285 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: AirHPhone.php,v 1.12 2007/02/20 14:39:45 kuboa Exp $
+ * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      File available since Release 0.5
+ */
+
+require_once(dirname(__FILE__) . '/Common.php');
+require_once(dirname(__FILE__) . '/Display.php');
+
+// {{{ Net_UserAgent_Mobile_AirHPhone
+
+/**
+ * AirH"PHONE implementation
+ *
+ * Net_UserAgent_Mobile_AirHPhone is a subclass of
+ * {@link Net_UserAgent_Mobile_Common}, which implements DDI POCKET's
+ * AirH"PHONE user agents.
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $_SERVER['HTTP_USER_AGENT'] =
+ *     'Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0';
+ * $agent = &Net_UserAgent_Mobile::factory();
+ *
+ * printf("Name: %s\n", $agent->getName()); // 'DDIPOCKET'
+ * printf("Verdor: %s\n", $agent->getVendor()); // 'JRC'
+ * printf("Model: %s\n", $agent->getModel()); // 'AH-J3001V,AH-J3002V'
+ * printf("Model Version: %s\n", $agent->getModelVersion()); // '1.0'
+ * printf("Browser Version: %s\n", $agent->getBrowserVersion()); // '0100'
+ * printf("Cache Size: %s\n", $agent->getCacheSize()); // 50
+ * </code>
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      Class available since Release 0.5
+ */
+class Net_UserAgent_Mobile_AirHPhone extends Net_UserAgent_Mobile_Common
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**
+     * User-Agent name
+     * @var string
+     */
+    var $name = 'WILLCOM';
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * vendor name
+     * @var string
+     */
+    var $_vendor;
+
+    /**
+     * model name
+     * @var string
+     */
+    var $_model;
+
+    /**
+     * version number of the model
+     * @var string
+     */
+    var $_modelVersion;
+
+    /**
+     * version number of the browser
+     * @var string
+     */
+    var $_browserVersion;
+
+    /**
+     * cache size as killobytes unit
+     * @var integer
+     */
+    var $_cacheSize;
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ isAirHPhone()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isAirHPhone()
+    {
+        return true;
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * parse HTTP_USER_AGENT string
+     */
+    function parse()
+    {
+        $agent = $this->getUserAgent();
+        if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!',
+                       $agent, $matches)
+            ) {
+            list($this->_vendor, $this->_model, $this->_modelVersion,
+                 $this->_browserVersion, $cache) =
+                explode('/', $matches[1]);
+            if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) {
+                return $this->noMatch();
+            }
+            $this->_cacheSize = (integer)$matches[1];
+        } else {
+            $this->noMatch();
+        }
+    }
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new {@link Net_UserAgent_Mobile_Display} class instance
+     *
+     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
+     *     object
+     * @see Net_UserAgent_Mobile_Display
+     */
+    function makeDisplay()
+    {
+        return new Net_UserAgent_Mobile_Display(null);
+    }
+
+    // }}}
+    // {{{ getVendor()
+
+    /**
+     * returns vendor name
+     *
+     * @return string
+     */
+    function getVendor()
+    {
+        return $this->_vendor;
+    }
+
+    // }}}
+    // {{{ getModel()
+
+    /**
+     * returns model name. Note that model names are separated with ','.
+     *
+     * @return string
+     */
+    function getModel()
+    {
+        return $this->_model;
+    }
+
+    // }}}
+    // {{{ getModelVersion()
+
+    /**
+     * returns version number of the model
+     *
+     * @return string
+     */
+    function getModelVersion()
+    {
+        return $this->_modelVersion;
+    }
+
+    // }}}
+    // {{{ getBrowserVersion()
+
+    /**
+     * returns version number of the browser
+     *
+     * @return string
+     */
+    function getBrowserVersion()
+    {
+        return $this->_browserVersion;
+    }
+
+    // }}}
+    // {{{ getCacheSize()
+
+    /**
+     * returns cache size as killobytes unit
+     *
+     * @return integer
+     */
+    function getCacheSize()
+    {
+        return $this->_cacheSize;
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierShortName()
+    {
+        return 'H';
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierLongName()
+    {
+        return 'AirH';
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile/DoCoMo.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/DoCoMo.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/DoCoMo.php	(revision 11456)
@@ -0,0 +1,587 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: DoCoMo.php,v 1.35 2007/02/20 18:41:04 kuboa Exp $
+ * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      File available since Release 0.1
+ */
+
+require_once dirname(__FILE__) . '/Common.php';
+require_once dirname(__FILE__) . '/Display.php';
+require_once dirname(__FILE__) . '/DoCoMoDisplayMap.php';
+
+// {{{ Net_UserAgent_Mobile_DoCoMo
+
+/**
+ * NTT DoCoMo implementation
+ *
+ * Net_UserAgent_Mobile_DoCoMo is a subclass of
+ * {@link Net_UserAgent_Mobile_Common}, which implements NTT docomo i-mode
+ * user agents.
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $_SERVER['HTTP_USER_AGENT'] = 'DoCoMo/1.0/P502i/c10';
+ * $agent = &Net_UserAgent_Mobile::factory();
+ *
+ * printf("Name: %s\n", $agent->getName()); // 'DoCoMo'
+ * printf("Version: %s\n", $agent->getVersion()); // 1.0
+ * printf("HTML version: %s\n", $agent->getHTMLVersion()); // 2.0
+ * printf("Model: %s\n", $agent->getModel()); // 'P502i'
+ * printf("Cache: %dk\n", $agent->getCacheSize()); // 10
+ * if ($agent->isFOMA()) {
+ *     print "FOMA\n";             // false
+ * }
+ * printf("Vendor: %s\n", $agent->getVendor()); // 'P'
+ * printf("Series: %s\n", $agent->getSeries()); // '502i'
+ *
+ * // only available with <form utn>
+ * // e.g.) 'DoCoMo/1.0/P503i/c10/serNMABH200331';
+ * printf("Serial: %s\n", $agent->getSerialNumber()); // 'NMABH200331'
+ *
+ * // e.g.) 'DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789)';
+ * printf("Serial: %s\n", $agent->getSerialNumber()); // '0123456789abcde'
+ * printf("Card ID: %s\n", $agent->getCardID()); // '01234567890123456789'
+ *
+ * // e.g.) 'DoCoMo/1.0/P502i (Google CHTML Proxy/1.0)'
+ * printf("Comment: %s\n", $agent->getComment()); // 'Google CHTML Proxy/1.0'
+ *
+ * // e.g.) 'DoCoMo/1.0/D505i/c20/TB/W20H10'
+ * printf("Status: %s\n", $agent->getStatus()); // 'TB'
+ *
+ * // only available in eggy/M-stage
+ * // e.g.) 'DoCoMo/1.0/eggy/c300/s32/kPHS-K'
+ * printf("Bandwidth: %dkbps\n", $agent->getBandwidth()); // 32
+ * </code>
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_DoCoMo extends Net_UserAgent_Mobile_Common
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * name of the model like 'P502i'
+     * @var string
+     */
+    var $_model = '';
+
+    /**
+     * status of the cache (TC, TB, TD, TJ)
+     * @var string
+     */
+    var $_status = '';
+
+    /**
+     * bandwidth like 32 as kilobytes unit
+     * @var integer
+     */
+    var $_bandwidth = null;
+
+    /**
+     * hardware unique serial number
+     * @var string
+     */
+    var $_serialNumber = null;
+
+    /**
+     * whether it's FOMA or not
+     * @var boolean
+     */
+    var $_isFOMA = false;
+
+    /**
+     * FOMA Card ID (20 digit alphanumeric)
+     * @var string
+     */
+    var $_cardID = null;
+
+    /**
+     * comment on user agent string like 'Google Proxy'
+     * @var string
+     */
+    var $_comment = null;
+
+    /**
+     * cache size as killobytes unit
+     * @var integer
+     */
+    var $_cacheSize;
+
+    /**
+     * width and height of the display
+     * @var string
+     */
+    var $_displayBytes = '';
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ isDoCoMo()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isDoCoMo()
+    {
+        return true;
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * parse HTTP_USER_AGENT string
+     *
+     * @return mixed void, or a PEAR error object on error
+     */
+    function parse()
+    {
+        @list($main, $foma_or_comment) =
+            explode(' ', $this->getUserAgent(), 2);
+
+        if ($foma_or_comment
+            && preg_match('/^\((.*)\)$/', $foma_or_comment, $matches)
+            ) {
+
+            // DoCoMo/1.0/P209is (Google CHTML Proxy/1.0)
+            $this->_comment = $matches[1];
+            $result = $this->_parseMain($main);
+        } elseif ($foma_or_comment) {
+
+            // DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789)
+            $this->_isFOMA = true;
+            list($this->name, $this->version) = explode('/', $main);
+            $result = $this->_parseFOMA($foma_or_comment);
+        } else {
+
+            // DoCoMo/1.0/R692i/c10
+            $result = $this->_parseMain($main);
+        }
+
+        if (Net_UserAgent_Mobile::isError($result)) {
+            return $result;
+        }
+    }
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new {@link Net_UserAgent_Mobile_Display} class instance
+     *
+     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
+     *     object
+     * @see Net_UserAgent_Mobile_Display
+     * @see Net_UserAgent_Mobile_DoCoMoDisplayMap::get()
+     */
+    function makeDisplay()
+    {
+        $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->_model);
+        if ($this->_displayBytes !== '') {
+            list($widthBytes, $heightBytes) =
+                explode('*', $this->_displayBytes);
+            $display['width_bytes']  = $widthBytes;
+            $display['height_bytes'] = $heightBytes;
+        }
+        return new Net_UserAgent_Mobile_Display($display);
+    }
+
+    // }}}
+    // {{{ getHTMLVersion()
+
+    /**
+     * returns supported HTML version like '3.0'. retuns null if unknown.
+     *
+     * @return string
+     */
+    function getHTMLVersion()
+    {
+        static $htmlVersionMap;
+        if (!isset($htmlVersionMap)) {
+            $htmlVersionMap = array(
+                                    '[DFNP]501i' => '1.0',
+                                    '502i|821i|209i|651|691i|(F|N|P|KO)210i|^F671i$' => '2.0',
+                                    '(D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V' => '3.0',
+                                    '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0',
+                                    'eggy|P751v' => '3.2',
+                                    '505i|252i|900i|506i|880i|253i|P213i|901i|700i|851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$' => '5.0',
+                                    '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$' => '6.0',
+                                    '903i|703i' => '7.0'
+                                    );
+        }
+
+        foreach ($htmlVersionMap as $key => $value) {
+            if (preg_match("/$key/", $this->_model)) {
+                return $value;
+            }
+        }
+        return null;
+    }
+
+    // }}}
+    // {{{ getCacheSize()
+
+    /**
+     * returns cache size as kilobytes unit. returns 5 if unknown.
+     *
+     * @return integer
+     */
+    function getCacheSize()
+    {
+        if ($this->_cacheSize) {
+            return $this->_cacheSize;
+        }
+
+        static $defaultCacheSize;
+        if (!isset($defaultCacheSize)) {
+            $defaultCacheSize = 5;
+        }
+        return $defaultCacheSize;
+    }
+
+    // }}}
+    // {{{ getSeries()
+
+    /**
+     * returns series name like '502i'. returns null if unknown.
+     *
+     * @return string
+     */
+    function getSeries()
+    {
+        if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_model)) {
+            return 'FOMA';
+        }
+
+        if (preg_match('/(\d{3}i)/', $this->_model, $matches)) {
+            return $matches[1];
+        }
+
+        if ($this->_model == 'P651ps') {
+            return '651';
+        }
+
+        return null;
+    }
+
+    // }}}
+    // {{{ getVendor()
+
+    /**
+     * returns vender code like 'SO' for Sony. returns null if unknown.
+     *
+     * @return string
+     */
+    function getVendor()
+    {
+        if (preg_match('/([A-Z]+)\d/', $this->_model, $matches)) {
+            return $matches[1];
+        }
+        return null;
+    }
+
+    // }}}
+    // {{{ getModel()
+
+    /**
+     * returns name of the model like 'P502i'
+     *
+     * @return string
+     */
+    function getModel()
+    {
+        return $this->_model;
+    }
+
+    // }}}
+    // {{{ getStatus()
+
+    /**
+     * returns status like "TB", "TC", "TD" or "TJ", which means:
+     * 
+     * TB | Browsers
+     * TC | Browsers with image off (only Available in HTML 5.0)
+     * TD | Fetching JAR
+     * TJ | i-Appli
+     *
+     * @return string
+     */
+    function getStatus()
+    {
+        return $this->_status;
+    }
+
+    // }}}
+    // {{{ getBandwidth()
+
+    /**
+     * returns bandwidth like 32 as killobytes unit. Only vailable in eggy,
+     * returns null otherwise.
+     *
+     * @return integer
+     */
+    function getBandwidth()
+    {
+        return $this->_bandwidth;
+    }
+
+    // }}}
+    // {{{ getSerialNumber()
+
+    /**
+     * returns hardware unique serial number (15 digit in FOMA, 11 digit
+     * otherwise alphanumeric). Only available with form utn attribute.
+     * returns null otherwise.
+     *
+     * @return string
+     */
+    function getSerialNumber()
+    {
+        return $this->_serialNumber;
+    }
+
+    // }}}
+    // {{{ isFOMA()
+
+    /**
+     * retuns whether it's FOMA or not
+     *
+     * @return boolean
+     */
+    function isFOMA()
+    {
+        return $this->_isFOMA;
+    }
+
+    // }}}
+    // {{{ getComment()
+
+    /**
+     * returns comment on user agent string like 'Google Proxy'. returns null
+     * otherwise.
+     *
+     * @return string
+     */
+    function getComment()
+    {
+        return $this->_comment;
+    }
+
+    // }}}
+    // {{{ getCardID()
+
+    /**
+     * returns FOMA Card ID (20 digit alphanumeric). Only available in FOMA
+     * with <form utn> attribute. returns null otherwise.
+     *
+     * @return string
+     */ 
+    function getCardID()
+    {
+        return $this->_cardID;
+    }
+
+    // }}}
+    // {{{ isGPS()
+
+    /**
+     * @return boolean
+     */ 
+    function isGPS()
+    {
+        static $gpsModels;
+        if (!isset($gpsModels)) {
+            $gpsModels = array('F661i', 'F505iGPS');
+        }
+        return in_array($this->_model, $gpsModels);
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierShortName()
+    {
+        return 'I';
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierLongName()
+    {
+        return 'DoCoMo';
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    // }}}
+    // {{{ _parseMain()
+
+    /**
+     * parse main part of HTTP_USER_AGENT string (not FOMA)
+     *
+     * @param string $main main part of HTTP_USER_AGENT string
+     * @return mixed void, or a PEAR error object on error
+     */ 
+    function _parseMain($main)
+    {
+        @list($this->name, $this->version, $this->_model, $cache, $rest) =
+            explode('/', $main, 5);
+        if ($this->_model === 'SH505i2') {
+            $this->_model = 'SH505i';
+        }
+
+        if ($cache) {
+            if (!preg_match('/^c(\d+)/', $cache, $matches)) {
+                return $this->noMatch();
+            }
+            $this->_cacheSize = (integer)$matches[1];
+        }
+
+        if ($rest) {
+            $rest = explode('/', $rest);
+            foreach ($rest as $value) {
+                if (preg_match('/^ser(\w{11})$/', $value, $matches)) {
+                    $this->_serialNumber = $matches[1];
+                    continue;
+                }
+                if (preg_match('/^(T[CDBJ])$/', $value, $matches)) {
+                    $this->_status = $matches[1];
+                    continue;
+                }
+                if (preg_match('/^s(\d+)$/', $value, $matches)) {
+                    $this->_bandwidth = (integer)$matches[1];
+                    continue;
+                }
+                if (preg_match('/^W(\d+)H(\d+)$/', $value, $matches)) {
+                    $this->_displayBytes = "{$matches[1]}*{$matches[2]}";
+                    continue;
+                }
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _parseFOMA()
+
+    /**
+     * parse main part of HTTP_USER_AGENT string (FOMA)
+     *
+     * @param string $foma main part of HTTP_USER_AGENT string
+     * @return mixed void, or a PEAR error object on error
+     */ 
+    function _parseFOMA($foma)
+    {
+        if (!preg_match('/^([^(]+)/', $foma, $matches)) {
+            return $this->noMatch();
+        }
+        $this->_model = $matches[1];
+        if ($matches[1] === 'MST_v_SH2101V') {
+            $this->_model = 'SH2101V';
+        }
+
+        if (preg_match('/^[^(]+\((.*?)\)$/', $foma, $matches)) {
+            $rest = explode(';', $matches[1]);
+            foreach ($rest as $value) {
+                if (preg_match('/^c(\d+)/', $value, $matches)) {
+                    $this->_cacheSize = (integer)$matches[1];
+                    continue;
+                }
+                if (preg_match('/^ser(\w{15})$/', $value, $matches)) {
+                    $this->_serialNumber = $matches[1];
+                    continue;
+                }
+                if (preg_match('/^(T[CDBJ])$/', $value, $matches)) {
+                    $this->_status = $matches[1];
+                    continue;
+                }
+                if (preg_match('/^icc(\w{20})?$/', $value, $matches)) {
+                    if (count($matches) == 2) {
+                        $this->_cardID = $matches[1];
+                    }
+                    continue;
+                }
+                if (preg_match('/^W(\d+)H(\d+)$/', $value, $matches)) {
+                    $this->_displayBytes = "{$matches[1]}*{$matches[2]}";
+                    continue;
+                }
+                return $this->noMatch();
+            }
+        }
+    }
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile/Vodafone.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/Vodafone.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/Vodafone.php	(revision 11456)
@@ -0,0 +1,557 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: Vodafone.php,v 1.12 2007/02/20 15:21:05 kuboa Exp $
+ * @since      File available since Release 0.20.0
+ */
+
+require_once dirname(__FILE__) . '/Common.php';
+require_once dirname(__FILE__) . '/Display.php';
+
+// {{{ Net_UserAgent_Mobile_Vodafone
+
+/**
+ * Vodafone implementation
+ *
+ * Net_UserAgent_Mobile_Vodafone is a subclass of
+ * {@link Net_UserAgent_Mobile_Common}, which implements Vodafone user agents.
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $_SERVER['HTTP_USER_AGENT'] = 'J-PHONE/2.0/J-DN02';
+ * $agent = &Net_UserAgent_Mobile::factory();
+ *
+ * printf("Name: %s\n", $agent->getName()); // 'J-PHONE'
+ * printf("Version: %s\n", $agent->getVersion()); // 2.0
+ * printf("Model: %s\n", $agent->getModel()); // 'J-DN02'
+ * if ($agent->isPacketCompliant()) {
+ *     print "Packet is compliant.\n"; // false
+ * }
+ *
+ * // only availabe in Java compliant
+ * // e.g.) 'J-PHONE/4.0/J-SH51/SNXXXXXXXXX SH/0001a Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0'
+ * printf("Serial: %s\n", $agent->getSerialNumber()); // XXXXXXXXX
+ * printf("Vendor: %s\n", $agent->getVendor()); // 'SH'
+ * printf("Vendor Version: %s\n", $agent->getVendorVersion()); // '0001a'
+ *
+ * $info = $agent->getJavaInfo();  // array
+ * foreach ($info as $key => $value) {
+ *     print "$key: $value\n";
+ * }
+ * </code>
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @link       http://developers.vodafone.jp/dp/tool_dl/web/useragent.php
+ * @link       http://developers.vodafone.jp/dp/tool_dl/web/position.php
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      Class available since Release 0.20.0
+ */
+class Net_UserAgent_Mobile_Vodafone extends Net_UserAgent_Mobile_Common
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * name of the model like 'J-DN02'
+     * @var string
+     */
+    var $_model = '';
+
+    /**
+     * whether the agent is packet connection complicant or not
+     * @var boolean
+     */
+    var $_packetCompliant = false;
+
+    /**
+     * terminal unique serial number
+     * @var string
+     */
+    var $_serialNumber = null;
+
+    /**
+     * vendor code like 'SH'
+     * @var string
+     */
+    var $_vendor = '';
+
+    /**
+     * vendor version like '0001a'
+     * @var string
+     */
+    var $_vendorVersion = null;
+
+    /**
+     * Java profiles
+     * @var array
+     */
+    var $_javaInfo = array();
+
+    /**
+     * whether the agent is 3G
+     * @var boolean
+     */
+    var $_is3G = true;
+
+    /**
+     * the name of the mobile phone
+     * @var string
+     */
+    var $_msname = '';
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ isJPhone()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isJPhone()
+    {
+        return true;
+    }
+
+    // }}}
+    // {{{ isVodafone()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isVodafone()
+    {
+        return true;
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * parse HTTP_USER_AGENT string
+     *
+     * @return mixed void, or a PEAR error object on error
+     */
+    function parse()
+    {
+        $agent = explode(' ', $this->getUserAgent());
+        preg_match('!^(?:(SoftBank|Vodafone|J-PHONE)/\d\.\d|MOT-)!',
+                   $agent[0], $matches
+                   );
+        if (count($matches) > 1) {
+            $carrier = $matches[1];
+        } else {
+            $carrier = 'Motorola';
+        }
+
+        switch ($carrier) {
+        case 'Vodafone':
+        case 'SoftBank':
+            $result = $this->_parseVodafone($agent);
+            break;
+        case 'J-PHONE':
+            $result = $this->_parseJphone($agent);
+            break;
+        case 'Motorola':
+            $result = $this->_parseMotorola($agent);
+            break;
+        }
+
+        if (Net_UserAgent_Mobile::isError($result)) {
+            return $result;
+        }
+
+        $this->_msname = $this->getHeader('x-jphone-msname');
+    }
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new {@link Net_UserAgent_Mobile_Display} class instance
+     *
+     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
+     *     object
+     * @see Net_UserAgent_Mobile_Display
+     */
+    function makeDisplay() 
+    {
+        @list($width, $height) =
+            explode('*', $this->getHeader('x-jphone-display'));
+        $color = false;
+        $depth = 0;
+        if ($color_string = $this->getHeader('x-jphone-color')) {
+            preg_match('!^([CG])(\d+)$!', $color_string, $matches);
+            $color = $matches[1] === 'C' ? true : false;
+            $depth = $matches[2];
+        }
+        return new Net_UserAgent_Mobile_Display(array(
+                                                      'width'  => $width,
+                                                      'height' => $height,
+                                                      'depth'  => $depth,
+                                                      'color'  => $color)
+                                                );
+    }
+
+    // }}}
+    // {{{ getModel()
+
+    /**
+     * returns name of the model like 'J-DN02'
+     *
+     * @return string
+     */
+    function getModel()
+    {
+        return $this->_model;
+    }
+
+    // }}}
+    // {{{ isPacketCompliant()
+
+    /**
+     * returns whether the agent is packet connection complicant or not
+     *
+     * @return boolean
+     */
+    function isPacketCompliant()
+    {
+        return $this->_packetCompliant;
+    }
+
+    // }}}
+    // {{{ getSerialNumber()
+
+    /**
+     * return terminal unique serial number. returns null if user forbids to
+     * send his/her serial number.
+     *
+     * @return string
+     */
+    function getSerialNumber()
+    {
+        return $this->_serialNumber;
+    }
+
+    // }}}
+    // {{{ getVendor()
+
+    /**
+     * returns vendor code like 'SH'
+     *
+     * @return string
+     */
+    function getVendor()
+    {
+        return $this->_vendor;
+    }
+
+    // }}}
+    // {{{ getVendorVersion()
+
+    /**
+     * returns vendor version like '0001a'. returns null if unknown.
+     *
+     * @return string
+     */
+    function getVendorVersion()
+    {
+        return $this->_vendorVersion;
+    }
+
+    // }}}
+    // {{{ getJavaInfo()
+
+    /**
+     * returns array of Java profiles
+     *
+     * Array structure is something like:
+     *
+     * - 'Profile'       => 'MIDP-1.0',
+     * - 'Configuration' => 'CLDC-1.0',
+     * - 'Ext-Profile'   => 'JSCL-1.1.0'
+     *
+     * @return array
+     */
+    function getJavaInfo()
+    {
+        return $this->_javaInfo;
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierShortName()
+    {
+        return 'V';
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierLongName()
+    {
+        return 'Vodafone';
+    }
+
+    // }}}
+    // {{{ isTypeC()
+
+    /**
+     * returns true if the type is C
+     *
+     * @return boolean
+     */
+    function isTypeC()
+    {
+        if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    // }}}
+    // {{{ isTypeP()
+
+    /**
+     * returns true if the type is P
+     *
+     * @return boolean
+     */
+    function isTypeP()
+    {
+        if ($this->_is3G || !preg_match('!^4\.!', $this->version)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    // }}}
+    // {{{ isTypeW()
+
+    /**
+     * returns true if the type is W
+     *
+     * @return boolean
+     */
+    function isTypeW()
+    {
+        if ($this->_is3G || !preg_match('!^5\.!', $this->version)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    // }}}
+    // {{{ isType3GC()
+
+    /**
+     * returns true if the type is 3GC
+     *
+     * @return boolean
+     */
+    function isType3GC()
+    {
+        return $this->_is3G;
+    }
+
+    // }}}
+    // {{{ getMsname()
+
+    /**
+     * returns the name of the mobile phone
+     *
+     * @return string the name of the mobile phone
+     */
+    function getMsname()
+    {
+        return $this->_msname;
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    // }}}
+    // {{{ _parseVodafone()
+
+    /**
+     * parse HTTP_USER_AGENT string for the Vodafone 3G aegnt
+     *
+     * @param array $agent parts of the User-Agent string
+     * @return mixed void, or a PEAR error object on error
+     */
+    function _parseVodafone(&$agent)
+    {
+        $count = count($agent);
+        $this->_packetCompliant = true;
+
+        // Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1
+        // Vodafone/1.0/V702NK/NKJ001/SN123456789012345 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1
+        // Vodafone/1.0/V802SE/SEJ001/SN123456789012345 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
+        @list($this->name, $this->version, $this->_model, $modelVersion,
+              $serialNumber) = explode('/', $agent[0]);
+        if ($serialNumber) {
+            if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) {
+                return $this->noMatch();
+            }
+            $this->_serialNumber = $matches[1];
+        }
+
+        if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) {
+            return $this->noMatch();
+        }
+
+        $this->_vendor = $matches[1];
+        $this->_vendorVersion = $matches[2];
+
+        for ($i = 2; $i < $count; ++$i) {
+            list($key, $value) = explode('/', $agent[$i]);
+            $this->_javaInfo[$key] = $value;
+        }
+    }
+
+    // }}}
+    // {{{ _parseJphone()
+
+    /**
+     * parse HTTP_USER_AGENT string for the ancient agent
+     *
+     * @param array $agent parts of the User-Agent string
+     * @return mixed void, or a PEAR error object on error
+     */
+    function _parseJphone(&$agent)
+    {
+        $count = count($agent);
+        $this->_is3G = false;
+
+        if ($count > 1) {
+
+            // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0
+            $this->_packetCompliant = true;
+            @list($this->name, $this->version, $this->_model,
+                  $serialNumber) = explode('/', $agent[0]);
+            if ($serialNumber) {
+                if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) {
+                    return $this->noMatch();
+                }
+                $this->_serialNumber = $matches[1];
+            }
+            list($this->_vendor, $this->_vendorVersion) =
+                explode('/', $agent[1]);
+            for ($i = 2; $i < $count; ++$i) {
+                list($key, $value) = explode('/', $agent[$i]);
+                $this->_javaInfo[$key] = $value;
+            }
+        } else {
+
+            // J-PHONE/2.0/J-DN02
+            @list($this->name, $this->version, $model) =
+                explode('/', $agent[0]);
+            $this->_model  = (string)$model;
+            if ($this->_model) {
+                if (preg_match('!V\d+([A-Z]+)!', $this->_model, $matches)) {
+                    $this->_vendor = $matches[1];
+                } elseif (preg_match('!J-([A-Z]+)!', $this->_model, $matches)) {
+                    $this->_vendor = $matches[1];
+                }
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _parseMotorola()
+
+    /**
+     * parse HTTP_USER_AGENT string for the Motorola 3G aegnt
+     *
+     * @param array $agent parts of the User-Agent string
+     * @return mixed void, or a PEAR error object on error
+     */
+    function _parseMotorola(&$agent)
+    {
+        $count = count($agent);
+        $this->_packetCompliant = true;
+        $this->_vendor = 'MOT';
+
+        // MOT-V980/80.2F.2E. MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
+        list($name, $this->_vendorVersion) = explode('/', $agent[0]);
+        $this->_model = substr(strrchr($name, '-'), 1);
+
+        for ($i = 2; $i < $count; ++$i) {
+            list($key, $value) = explode('/', $agent[$i]);
+            $this->_javaInfo[$key] = $value;
+        }
+    }
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile/NonMobile.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/NonMobile.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/NonMobile.php	(revision 11456)
@@ -0,0 +1,188 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: NonMobile.php,v 1.12 2007/02/20 15:20:02 kuboa Exp $
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      File available since Release 0.1.0
+ */
+
+require_once(dirname(__FILE__) . '/Common.php');
+require_once(dirname(__FILE__) . '/Display.php');
+
+// {{{ Net_UserAgent_Mobile_NonMobile
+
+/**
+ * Non-Mobile Agent implementation
+ *
+ * Net_UserAgent_Mobile_NonMobile is a subclass of
+ * {@link Net_UserAgent_Mobile_Common}, which implements non-mobile or
+ * unimplemented user agents.
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0';
+ * $agent = &Net_UserAgent_Mobile::factory();
+ * </code>
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      Class available since Release 0.1.0
+ */
+class Net_UserAgent_Mobile_NonMobile extends Net_UserAgent_Mobile_Common
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ isNonMobile()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isNonMobile()
+    {
+        return true;
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * parse HTTP_USER_AGENT string
+     */
+    function parse()
+    {
+        @list($this->name, $this->version) =
+            explode('/', $this->getUserAgent());
+    }
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new {@link Net_UserAgent_Mobile_Display} class instance
+     *
+     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
+     *     object
+     * @see Net_UserAgent_Mobile_Display
+     */
+    function makeDisplay()
+    {
+        return new Net_UserAgent_Mobile_Display(null);
+    }
+
+    // }}}
+    // {{{ getModel()
+
+    /**
+     * returns name of the model
+     *
+     * @return string
+     */
+    function getModel()
+    {
+        return '';
+    }
+
+    // }}}
+    // {{{ getDeviceID()
+
+    /**
+     * returns device ID
+     *
+     * @return string
+     */
+    function getDeviceID()
+    {
+        return '';
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierShortName()
+    {
+        return 'N';
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierLongName()
+    {
+        return 'NonMobile';
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php	(revision 11456)
@@ -0,0 +1,1471 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: DoCoMoDisplayMap.php,v 1.32 2007/02/20 18:30:17 kuboa Exp $
+ * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html
+ * @see        Net_UserAgent_Mobile_Display
+ * @since      File available since Release 0.1
+ */
+
+// {{{ Net_UserAgent_Mobile_DoCoMoDisplayMap
+
+/**
+ * Display information mapping for DoCoMo.
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html
+ * @see        Net_UserAgent_Mobile_Display
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_DoCoMoDisplayMap
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ get()
+
+    /**
+     * Returns the display information of the model.
+     *
+     * @param string $model the name of the model
+     * @return array
+     * @static
+     */
+    function get($model)
+    {
+        static $displayMap;
+        if (!isset($displayMap)) {
+            if (isset($_SERVER['DOCOMO_MAP'])) {
+
+                // using the specified XML data
+                while (true) {
+                    if (!function_exists('xml_parser_create')
+                        || !is_readable($_SERVER['DOCOMO_MAP'])
+                        ) {
+                        break;
+                    }
+                    $xml = file_get_contents($_SERVER['DOCOMO_MAP']);
+                    $parser = xml_parser_create();
+                    if ($parser === false) {
+                        break;
+                    }
+                    xml_parse_into_struct($parser, $xml, $values, $indexes);
+                    if (!xml_parser_free($parser)) {
+                        break;
+                    }
+                    if (isset($indexes['OPT'])) {
+                        unset($indexes['OPT']);
+                    }
+                    foreach ($indexes as $modelName => $modelIndexes) {
+                        $displayMap[$modelName] = array();
+                        foreach ($values[ $modelIndexes[0] ]['attributes'] as $attributeName => $attributeValue) {
+                            $displayMap[$modelName][ strtolower($attributeName) ] = $attributeValue;
+                        }
+                    }
+                    break;
+                }
+            }
+
+            if (!isset($displayMap)) {
+                $displayMap = array(
+
+                                    // i-mode compliant HTML 1.0
+                                    'D501I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 72,
+                                                     'depth'  => 2,
+                                                     'color'  => 0
+                                                     ),
+                                    'F501I' => array(
+                                                     'width'  => 112,
+                                                     'height' => 84,
+                                                     'depth'  => 2,
+                                                     'color'  => 0
+                                                     ),
+                                    'N501I' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 2,
+                                                     'color'  => 0
+                                                     ),
+                                    'P501I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 120,
+                                                     'depth'  => 2,
+                                                     'color'  => 0
+                                                     ),
+
+                                    // i-mode compliant HTML 2.0
+                                    'D502I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 90,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'F502I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 91,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'N502I' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 4,
+                                                     'color'  => 0
+                                                     ),
+                                    'P502I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 117,
+                                                     'depth'  => 4,
+                                                     'color'  => 0
+                                                     ),
+                                    'NM502I' => array(
+                                                      'width'  => 111,
+                                                      'height' => 106,
+                                                      'depth'  => 2,
+                                                      'color'  => 0
+                                                      ),
+                                    'SO502I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 120,
+                                                      'depth'  => 4,
+                                                      'color'  => 0
+                                                      ),
+                                    'F502IT' => array(
+                                                      'width'  => 96,
+                                                      'height' => 91,
+                                                      'depth'  => 256,
+                                                      'color'  => 1
+                                                      ),
+                                    'N502IT' => array(
+                                                      'width'  => 118,
+                                                      'height' => 128,
+                                                      'depth'  => 256,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO502IWM' => array(
+                                                        'width'  => 120,
+                                                        'height' => 113,
+                                                        'depth'  => 256,
+                                                        'color'  => 1
+                                                        ),
+                                    'SH821I' => array(
+                                                      'width'  => 96,
+                                                      'height' => 78,
+                                                      'depth'  => 256,
+                                                      'color'  => 1
+                                                      ),
+                                    'N821I' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 4,
+                                                     'color'  => 0
+                                                     ),
+                                    'P821I' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 4,
+                                                     'color'  => 0
+                                                     ),
+                                    'D209I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 90,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'ER209I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 72,
+                                                      'depth'  => 2,
+                                                      'color'  => 0
+                                                      ),
+                                    'F209I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 91,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'KO209I' => array(
+                                                      'width'  => 96,
+                                                      'height' => 96,
+                                                      'depth'  => 256,
+                                                      'color'  => 1
+                                                      ),
+                                    'N209I' => array(
+                                                     'width'  => 108,
+                                                     'height' => 82,
+                                                     'depth'  => 4,
+                                                     'color'  => 0
+                                                     ),
+                                    'P209I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 87,
+                                                     'depth'  => 4,
+                                                     'color'  => 0
+                                                     ),
+                                    'P209IS' => array(
+                                                      'width'  => 96,
+                                                      'height' => 87,
+                                                      'depth'  => 256,
+                                                      'color'  => 1
+                                                      ),
+                                    'R209I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 72,
+                                                     'depth'  => 4,
+                                                     'color'  => 0
+                                                     ),
+                                    'P651PS' => array(
+                                                      'width'  => 96,
+                                                      'height' => 87,
+                                                      'depth'  => 4,
+                                                      'color'  => 0
+                                                      ),
+                                    'R691I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 72,
+                                                     'depth'  => 4,
+                                                     'color'  => 0
+                                                     ),
+                                    'F671I' => array(
+                                                     'width'  => 120,
+                                                     'height' => 126,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'F210I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 113,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'N210I' => array(
+                                                     'width'  => 118,
+                                                     'height' => 113,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'P210I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 91,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'KO210I' => array(
+                                                      'width'  => 96,
+                                                      'height' => 96,
+                                                      'depth'  => 256,
+                                                      'color'  => 1
+                                                      ),
+
+                                    // i-mode compliant HTML 3.0
+                                    'F503I' => array(
+                                                     'width'  => 120,
+                                                     'height' => 130,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'F503IS' => array(
+                                                      'width'  => 120,
+                                                      'height' => 130,
+                                                      'depth'  => 4096,
+                                                      'color'  => 1
+                                                      ),
+                                    'P503I' => array(
+                                                     'width'  => 120,
+                                                     'height' => 130,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'P503IS' => array(
+                                                      'width'  => 120,
+                                                      'height' => 130,
+                                                      'depth'  => 256,
+                                                      'color'  => 1
+                                                      ),
+                                    'N503I' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 4096,
+                                                     'color'  => 1
+                                                     ),
+                                    'N503IS' => array(
+                                                      'width'  => 118,
+                                                      'height' => 128,
+                                                      'depth'  => 4096,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO503I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 113,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO503IS' => array(
+                                                       'width'  => 120,
+                                                       'height' => 113,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'D503I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 126,
+                                                     'depth'  => 4096,
+                                                     'color'  => 1
+                                                     ),
+                                    'D503IS' => array(
+                                                      'width'  => 132,
+                                                      'height' => 126,
+                                                      'depth'  => 4096,
+                                                      'color'  => 1
+                                                      ),
+                                    'D210I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 91,
+                                                     'depth'  => 256,
+                                                     'color'  => 1
+                                                     ),
+                                    'SO210I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 113,
+                                                      'depth'  => 256,
+                                                      'color'  => 1
+                                                      ),
+                                    'F211I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 113,
+                                                     'depth'  => 4096,
+                                                     'color'  => 1
+                                                     ),
+                                    'D211I' => array(
+                                                     'width'  => 100,
+                                                     'height' => 91,
+                                                     'depth'  => 4096,
+                                                     'color'  => 1
+                                                     ),
+                                    'N211I' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 4096,
+                                                     'color'  => 1
+                                                     ),
+                                    'N211IS' => array(
+                                                      'width'  => 118,
+                                                      'height' => 128,
+                                                      'depth'  => 4096,
+                                                      'color'  => 1
+                                                      ),
+                                    'P211I' => array(
+                                                     'width'  => 120,
+                                                     'height' => 130,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P211IS' => array(
+                                                      'width'  => 120,
+                                                      'height' => 130,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO211I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 112,
+                                                      'depth'  => 4096,
+                                                      'color'  => 1
+                                                      ),
+                                    'R211I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 98,
+                                                     'depth'  => 4096,
+                                                     'color'  => 1
+                                                     ),
+                                    'SH251I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 130,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH251IS' => array(
+                                                       'width'  => 176,
+                                                       'height' => 187,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'R692I' => array(
+                                                     'width'  => 96,
+                                                     'height' => 98,
+                                                     'depth'  => 4096,
+                                                     'color'  => 1
+                                                     ),
+
+                                    // i-mode compliant HTML 3.0
+                                    // (FOMA 2001/2002/2101V)
+                                    'N2001' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 4096,
+                                                     'color'  => 1
+                                                     ),
+                                    'N2002' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P2002' => array(
+                                                     'width'  => 118,
+                                                     'height' => 128,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'D2101V' => array(
+                                                      'width'  => 120,
+                                                      'height' => 130,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P2101V' => array(
+                                                      'width'  => 163,
+                                                      'height' => 182,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH2101V' => array(
+                                                       'width'  => 800,
+                                                       'height' => 600,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'T2101V' => array(
+                                                      'width'  => 176,
+                                                      'height' => 144,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+
+                                    // i-mode compliant HTML 4.0
+                                    'D504I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 144,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'F504I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 136,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'F504IS' => array(
+                                                      'width'  => 132,
+                                                      'height' => 136,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'N504I' => array(
+                                                     'width'  => 160,
+                                                     'height' => 180,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'N504IS' => array(
+                                                      'width'  => 160,
+                                                      'height' => 180,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO504I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 112,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'P504I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 144,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P504IS' => array(
+                                                      'width'  => 132,
+                                                      'height' => 144,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'D251I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 144,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'D251IS' => array(
+                                                      'width'  => 132,
+                                                      'height' => 144,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'F251I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 140,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'N251I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 140,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'N251IS' => array(
+                                                      'width'  => 132,
+                                                      'height' => 140,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'P251IS' => array(
+                                                      'width'  => 132,
+                                                      'height' => 144,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'F671IS' => array(
+                                                      'width'  => 160,
+                                                      'height' => 120,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'F212I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 136,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'SO212I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 112,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'F661I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 136,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'F672I' => array(
+                                                     'width'  => 160,
+                                                     'height' => 120,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'SO213I' => array(
+                                                      'width'  => 120,
+                                                      'height' => 112,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO213IS' => array(
+                                                       'width'  => 120,
+                                                       'height' => 112,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'SO213IWR' => array(
+                                                        'width'  => 120,
+                                                        'height' => 112,
+                                                        'depth'  => 65536,
+                                                        'color'  => 1
+                                                        ),
+
+                                    // i-mode compliant HTML 4.0
+                                    // (FOMA 2051/2102V/2701 etc.)
+                                    'F2051' => array(
+                                                     'width'  => 176,
+                                                     'height' => 182,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'N2051' => array(
+                                                     'width'  => 176,
+                                                     'height' => 198,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P2102V' => array(
+                                                      'width'  => 176,
+                                                      'height' => 198,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P2102V' => array(
+                                                      'width'  => 176,
+                                                      'height' => 198,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'F2102V' => array(
+                                                      'width'  => 176,
+                                                      'height' => 182,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'N2102V' => array(
+                                                      'width'  => 176,
+                                                      'height' => 198,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'N2701' => array(
+                                                     'width'  => 176,
+                                                     'height' => 198,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'NM850IG' => array(
+                                                       'width'  => 176,
+                                                       'height' => 144,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+
+                                    // i-mode compliant HTML 5.0 (505i etc.)
+                                    'D505I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SO505I' => array(
+                                                      'width'  => 256,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH505I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 252,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'N505I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'F505I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 268,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'P505I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 266,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'D505IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P505IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 266,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'N505IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO505IS' => array(
+                                                       'width'  => 240,
+                                                       'height' => 256,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'SH505IS' => array(
+                                                       'width'  => 240,
+                                                       'height' => 252,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'F505IGPS' => array(
+                                                        'width'  => 240,
+                                                        'height' => 268,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'D252I' => array(
+                                                     'width'  => 176,
+                                                     'height' => 198,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SH252I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 252,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P252I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 144,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'N252I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 140,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P252IS' => array(
+                                                      'width'  => 132,
+                                                      'height' => 144,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'D506I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'F506I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 268,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N506I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 295,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'P506IC' => array(
+                                                      'width'  => 240,
+                                                      'height' => 266,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH506IC' => array(
+                                                       'width'  => 240,
+                                                       'height' => 252,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'SO506IC' => array(
+                                                       'width'  => 240,
+                                                       'height' => 256,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'N506IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 295,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO506I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 256,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO506IS' => array(
+                                                       'width'  => 240,
+                                                       'height' => 256,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'N506ISII' => array(
+                                                        'width'  => 240,
+                                                        'height' => 295,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'P506ICII' => array(
+                                                        'width'  => 240,
+                                                        'height' => 266,
+                                                        'depth'  => 65536,
+                                                        'color'  => 1
+                                                        ),
+                                    'D253I' => array(
+                                                     'width'  => 176,
+                                                     'height' => 198,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N253I' => array(
+                                                     'width'  => 160,
+                                                     'height' => 180,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P253I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 144,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'D253IWM' => array(
+                                                       'width'  => 220,
+                                                       'height' => 144,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'P253IS' => array(
+                                                      'width'  => 132,
+                                                      'height' => 144,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'P213I' => array(
+                                                     'width'  => 132,
+                                                     'height' => 144,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+
+                                    // i-mode compliant HTML 5.0
+                                    // (FOMA 900i etc.)
+                                    'F900I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N900I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 269,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P900I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 266,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'SH900I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 252,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'F900IT' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P900IV' => array(
+                                                      'width'  => 240,
+                                                      'height' => 266,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'N900IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 269,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'D900I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'F900IC' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'F880IES' => array(
+                                                       'width'  => 240,
+                                                       'height' => 256,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'N900IL' => array(
+                                                      'width'  => 240,
+                                                      'height' => 269,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'N900IG' => array(
+                                                      'width'  => 240,
+                                                      'height' => 269,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH901IC' => array(
+                                                       'width'  => 240,
+                                                       'height' => 252,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'F901IC' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'N901IC' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'D901I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'P901I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'F700I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SH700I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 252,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'N700I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P700I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'F700IS' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH700IS' => array(
+                                                       'width'  => 240,
+                                                       'height' => 252,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'SA700IS' => array(
+                                                       'width'  => 240,
+                                                       'height' => 252,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+
+                                    'SH901IS' => array(
+                                                       'width'  => 240,
+                                                       'height' => 252,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'F901IS' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'D901IS' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P901IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'N901IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'P901ITV' => array(
+                                                       'width'  => 240,
+                                                       'height' => 270,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'SH851I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 252,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P851I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'F881IES' => array(
+                                                       'width'  => 240,
+                                                       'height' => 256,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'D701I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'N701I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P701ID' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'D701IWM' => array(
+                                                       'width'  => 230,
+                                                       'height' => 240,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'N701IECO' => array(
+                                                        'width'  => 240,
+                                                        'height' => 270,
+                                                        'depth'  => 65536,
+                                                        'color'  => 1
+                                                        ),
+                                    'SA800I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 252,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'L600I' => array(
+                                                     'width'  => 176,
+                                                     'height' => 189,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'N600I' => array(
+                                                     'width'  => 176,
+                                                     'height' => 180,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'L601I' => array(
+                                                     'width'  => 176,
+                                                     'height' => 189,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'M702IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 267,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'M702IG' => array(
+                                                      'width'  => 240,
+                                                      'height' => 267,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+
+                                    // i-mode compliant HTML 6.0
+                                    // (FOMA 902i etc.)
+                                    'F902I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'D902I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N902I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'P902I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SH902I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO902I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 256,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH902IS' => array(
+                                                       'width'  => 240,
+                                                       'height' => 240,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'P902IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'N902IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'D902IS' => array(
+                                                      'width'  => 230,
+                                                      'height' => 320,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'F902IS' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO902IWP+' => array(
+                                                         'width'  => 240,
+                                                         'height' => 256,
+                                                         'depth'  => 262144,
+                                                         'color'  => 1
+                                                         ),
+                                    'SH902ISL' => array(
+                                                        'width'  => 240,
+                                                        'height' => 240,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'N902IX' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'N902IL' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P702I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N702ID' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'F702ID' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH702ID' => array(
+                                                       'width'  => 240,
+                                                       'height' => 240,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'D702I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SO702I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 256,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'D702IBCL' => array(
+                                                        'width'  => 230,
+                                                        'height' => 240,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'SA702I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 252,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH702IS' => array(
+                                                       'width'  => 240,
+                                                       'height' => 240,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'N702IS' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 65536,
+                                                      'color'  => 1
+                                                      ),
+                                    'P702ID' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'D702IF' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'D851IWM' => array(
+                                                       'width'  => 230,
+                                                       'height' => 320,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'F882IES' => array(
+                                                       'width'  => 240,
+                                                       'height' => 256,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'N601I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'D800IDS' => array(
+                                                       'width'  => 230,
+                                                       'height' => 240,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'P703IMYU' => array(
+                                                        'width'  => 240,
+                                                        'height' => 270,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+
+                                    // i-mode compliant HTML 7.0
+                                    // (FOMA 903i etc.)
+                                    'SH903I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 320,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P903I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N903I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'D903I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 320,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'F903I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SO903I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 368,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'D903ITV' => array(
+                                                      'width'  => 230,
+                                                      'height' => 320,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'F903IX' => array(
+                                                      'width'  => 230,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P903ITV' => array(
+                                                       'width'  => 240,
+                                                       'height' => 350,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
+                                    'N703ID' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'F703I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'P703I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'D703I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SH703I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SH703I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 240,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'N703IMYU' => array(
+                                                        'width'  => 240,
+                                                        'height' => 270,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'SO703I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 368,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      )
+                                    );
+            }
+        }
+
+        return @$displayMap[ strtoupper($model) ];
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile/Display.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/Display.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/Display.php	(revision 11456)
@@ -0,0 +1,268 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: Display.php,v 1.10 2007/02/20 15:00:06 kuboa Exp $
+ * @since      File available since Release 0.1
+ */
+
+// {{{ Net_UserAgent_Mobile_Display
+
+/**
+ * Display information for Net_UserAgent_Mobile
+ *
+ * Net_UserAgent_Mobile_Display is a class for display information on
+ * {@link Net_UserAgent_Mobile}. Handy for image resizing or dispatching.
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $agent = &Net_UserAgent_Mobile::factory();
+ * $display = $agent->getDisplay();
+ *
+ * $width  = $display->getWidth();
+ * $height = $display->getHeight();
+ * list($width, $height) = $display->getSize();
+ *
+ * if ($display->isColor()) {
+ *     $depth = $display->getDepth();
+ * }
+ *
+ * // only available in DoCoMo 505i
+ * $width_bytes  = $display->getWidthBytes();
+ * $height_bytes = $display->getHeightBytes();
+ * </code>
+ *
+ * USING EXTERNAL MAP FILE:
+ * If the environment variable DOCOMO_MAP exists, the specified XML data will
+ * be used for DoCoMo display information.
+ *
+ * ex) Please add the following code.
+ * $_SERVER['DOCOMO_MAP'] = '/path/to/DoCoMoMap.xml';
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_Display
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * width of the display
+     * @var integer
+     */
+    var $_width;
+
+    /**
+     * height of the display
+     * @var integer
+     */
+    var $_height;
+
+    /**
+     * depth of the display
+     * @var integer
+     */
+    var $_depth;
+
+    /**
+     * color capability of the display
+     * @var boolean
+     */
+    var $_color;
+
+    /**
+     * width (bytes) of the display
+     * @var integer
+     */
+    var $_widthBytes;
+
+    /**
+     * height (bytes) of the display
+     * @var integer
+     */
+    var $_heightBytes;
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * constructor
+     *
+     * @param array $data display infomation
+     */
+    function Net_UserAgent_Mobile_Display($data)
+    {
+        $this->_width  = (integer)@$data['width'];
+        $this->_height = (integer)@$data['height'];
+        $this->_depth  = (integer)@$data['depth'];
+        $this->_color  = (boolean)@$data['color'];
+
+        $this->_widthBytes  = (integer)@$data['width_bytes'];
+        $this->_heightBytes = (integer)@$data['height_bytes'];
+    }
+
+    // }}}
+    // {{{ calcSize()
+
+    /**
+     * returns width * height of the display
+     *
+     * @return integer
+     */
+    function calcSize()
+    {
+        return $this->_width * $this->_height;
+    }
+
+    // }}}
+    // {{{ getSize()
+
+    /**
+     * returns width with height of the display
+     *
+     * @return array
+     */
+    function getSize()
+    {
+        return array($this->_width, $this->_height);
+    }
+
+    // }}}
+    // {{{ getWidth()
+
+    /**
+     * returns width of the display
+     *
+     * @return integer
+     */
+    function getWidth()
+    {
+        return $this->_width;
+    }
+
+    // }}}
+    // {{{ getHeight()
+
+    /**
+     * returns height of the display
+     *
+     * @return integer
+     */
+    function getHeight()
+    {
+        return $this->_height;
+    }
+
+    // }}}
+    // {{{ getDepth()
+
+    /**
+     * returns depth of the display
+     *
+     * @return integer
+     */
+    function getDepth()
+    {
+        return $this->_depth;
+    }
+
+    // }}}
+    // {{{ isColor()
+
+    /**
+     * returns true if the display has color capability
+     *
+     * @return boolean
+     */
+    function isColor()
+    {
+        return $this->_color;
+    }
+
+    // }}}
+    // {{{ getWidthBytes()
+
+    /**
+     * returns width (bytes) of the display
+     *
+     * @return integer
+     */
+    function getWidthBytes()
+    {
+        return $this->_widthBytes;
+    }
+
+    // }}}
+    // {{{ getHeightBytes()
+
+    /**
+     * returns height (bytes) of the display
+     *
+     * @return integer
+     */
+    function getHeightBytes()
+    {
+        return $this->_heightBytes;
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile/Common.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/Common.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/Common.php	(revision 11456)
@@ -0,0 +1,447 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: Common.php,v 1.15 2007/02/20 14:59:19 kuboa Exp $
+ * @since      File available since Release 0.1
+ */
+
+// {{{ Net_UserAgent_Mobile_Common
+
+/**
+ * Base class that is extended by each user agents implementor
+ *
+ * Net_UserAgent_Mobile_Common is a class for mobile user agent
+ * abstraction layer on Net_UserAgent_Mobile.
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_Common extends PEAR
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**
+     * User-Agent name like 'DoCoMo'
+     * @var string
+     */
+    var $name = '';
+
+    /**
+     * User-Agent version number like '1.0'
+     * @var string
+     */
+    var $version = '';
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * {@link Net_UserAgent_Mobile_Display} object
+     * @var object {@link Net_UserAgent_Mobile_Display}
+     */
+    var $_display;
+
+    /**
+     * Net_UserAgent_Mobile_Request_XXX object
+     * @var object {@link Net_UserAgent_Mobile_Request_Env}
+     */
+    var $_request;
+
+    /**
+     * {@link Net_UserAgent_Mobile_Error} object for error handling in the
+     *     constructor
+     * @var object
+     **/
+    var $_error = null;
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * constructor
+     *
+     * @param object $request a {@link Net_UserAgent_Mobile_Request_Env}
+     *     object
+     */
+    function Net_UserAgent_Mobile_Common($request)
+    {
+        parent::PEAR('Net_UserAgent_Mobile_Error');
+        $this->_request = $request;
+        if (Net_UserAgent_Mobile::isError($result = $this->parse())) {
+            $this->isError($result);
+        }
+    }
+
+    // }}}
+    // {{{ isError
+
+    /**
+     * Returns/set an error when the instance couldn't initialize properly
+     *
+     * @param object {@link Net_UserAgent_Mobile_Error} object when setting
+     *     an error
+     * @return object {@link Net_UserAgent_Mobile_Error} object
+     */
+    function &isError($error = null)
+    {
+        if ($error !== null) {
+            $this->_error = &$error;
+        }
+
+        return $this->_error;
+    }
+
+    // }}}
+    // {{{ raiseError()
+
+    /**
+     * This method is used to communicate an error and invoke error
+     * callbacks etc. Basically a wrapper for PEAR::raiseError without
+     * the message string.
+     *
+     * @param mixed $code integer error code, or a PEAR error object (all
+     *     other parameters are ignored if this parameter is an object
+     * @param int $mode error mode, see PEAR_Error docs
+     * @param mixed $options 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 $userinfo Extra debug information. Defaults to the last
+     *     query and native error code.
+     * @return object a PEAR error object
+     * @see PEAR_Error
+     */
+    function &raiseError($code = NET_USERAGENT_MOBILE_ERROR, $mode = null,
+                         $options = null, $userinfo = null
+                         )
+    {
+
+        // The error is yet a Net_UserAgent_Mobile error object
+        if (is_object($code)) {
+            $error = &PEAR::raiseError($code, null, null, null, null, null,
+                                       true
+                                       );
+            return $error;
+        }
+
+        $error = &PEAR::raiseError(null, $code, $mode, $options, $userinfo,
+                                   'Net_UserAgent_Mobile_Error', true
+                                   );
+        return $error;
+    }
+
+    // }}}
+    // {{{ getUserAgent()
+
+    /**
+     * returns User-Agent string
+     *
+     * @return string
+     */
+    function getUserAgent()
+    {
+        return $this->getHeader('User-Agent');
+    }
+
+    // }}}
+    // {{{ getHeader()
+
+    /**
+     * returns a specified HTTP header
+     *
+     * @param string $header
+     * @return string
+     */
+    function getHeader($header)
+    {
+        return $this->_request->get($header);
+    }
+
+    // }}}
+    // {{{ getName()
+
+    /**
+     * returns User-Agent name like 'DoCoMo'
+     *
+     * @return string
+     */
+    function getName()
+    {
+        return $this->name;
+    }
+
+    // }}}
+    // {{{ getDisplay()
+
+    /**
+     * returns {@link Net_UserAgent_Mobile_Disply} object
+     *
+     * @return object a {@link Net_UserAgent_Mobile_Display} object, or a
+     *     PEAR error object on error
+     * @see Net_UserAgent_Mobile_Display
+     */
+    function getDisplay()
+    {
+        if (!is_object($this->_display)) {
+            $this->_display = $this->makeDisplay();
+        }
+        return $this->_display;
+    }
+
+    // }}}
+    // {{{ getVersion()
+
+    /**
+     * returns User-Agent version number like '1.0'
+     *
+     * @return string
+     */
+    function getVersion()
+    {
+        return $this->version;
+    }
+
+    // }}}
+    // {{{ noMatch()
+
+    /**
+     * generates a warning message for new variants
+     *
+     * @return object a PEAR error object
+     */
+    function noMatch()
+    {
+        return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null,
+                                 null, $this->getUserAgent() .
+                                 ': might be new variants. Please contact the author of Net_UserAgent_Mobile!'
+                                 );
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * parse HTTP_USER_AGENT string (should be implemented in subclasses)
+     *
+     * @abstract
+     */
+    function parse()
+    {
+        die();
+    }
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new Net_UserAgent_Mobile_Display class instance (should be
+     * implemented in subclasses)
+     *
+     * @abstract
+     */
+    function makeDisplay()
+    {
+        die();
+    }
+
+    // }}}
+    // {{{ isDoCoMo()
+
+    /**
+     * returns true if the agent is DoCoMo
+     *
+     * @return boolean
+     */
+    function isDoCoMo()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isJPhone()
+
+    /**
+     * returns true if the agent is J-PHONE
+     *
+     * @return boolean
+     */
+    function isJPhone()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isVodafone()
+
+    /**
+     * returns true if the agent is Vodafone
+     *
+     * @return boolean
+     */
+    function isVodafone()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isEZweb()
+
+    /**
+     * returns true if the agent is EZweb
+     *
+     * @return boolean
+     */
+    function isEZweb()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isAirHPhone()
+
+    /**
+     * returns true if the agent is AirH"PHONE
+     *
+     * @return boolean
+     */
+    function isAirHPhone()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isNonMobile()
+
+    /**
+     * returns true if the agent is NonMobile
+     *
+     * @return boolean
+     */
+    function isNonMobile()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isTUKa()
+
+    /**
+     * returns true if the agent is TU-Ka
+     *
+     * @return boolean
+     */
+    function isTUKa()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isWAP1()
+
+    /**
+     * returns true if the agent can speak WAP1 protocol
+     *
+     * @return boolean
+     */
+    function isWAP1()
+    {
+        return $this->isEZweb() && !$this->isWAP2();
+    }
+
+    // }}}
+    // {{{ isWAP2()
+
+    /**
+     * returns true if the agent can speak WAP2 protocol
+     *
+     * @return boolean
+     */
+    function isWAP2()
+    {
+        return $this->isEZweb() && $this->isXHTMLCompliant();
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @abstract
+     */
+    function getCarrierShortName()
+    {
+        die();
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @abstract
+     */
+    function getCarrierLongName()
+    {
+        die();
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile/Request.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile/Request.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile/Request.php	(revision 11456)
@@ -0,0 +1,185 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: Request.php,v 1.6 2007/02/20 15:18:26 kuboa Exp $
+ * @since      File available since Release 0.1
+ */
+
+// {{{ Net_UserAgent_Mobile_Request
+
+/**
+ * Utility class that constructs appropriate class instance for miscellaneous
+ * HTTP header containers
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_Request
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     * @static
+     */
+
+    // }}}
+    // {{{ factory()
+
+    /**
+     * create a new Net_UserAgent_Mobile_Request_XXX instance
+     *
+     * parses HTTP headers and constructs appropriate class instance.
+     * If no argument is supplied, $_SERVER is used.
+     *
+     * @param mixed $stuff User-Agent string or object that works with
+     *     HTTP_Request (not implemented)
+     * @return mixed a newly created Net_UserAgent_Request object
+     * @global array $_SERVER
+     */
+    function &factory($stuff = null)
+    {
+        if ($stuff === null) {
+            $request = &new Net_UserAgent_Mobile_Request_Env($_SERVER);
+        } else {
+            $request =
+                &new Net_UserAgent_Mobile_Request_Env(array(
+                                                            'HTTP_USER_AGENT' => $stuff)
+                                                      );
+        }
+        return $request;
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+// {{{ Net_UserAgent_Mobile_Request_Env
+
+/**
+ * provides easy way to access environment variables
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_Request_Env
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * array of environment variables defined by Web Server
+     * @var array
+     */
+    var $_env;
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * constructor
+     *
+     * @param array $env
+     */
+    function Net_UserAgent_Mobile_Request_Env($env)
+    {
+        $this->_env = $env;
+    }
+
+    /**
+     * returns a specified HTTP Header
+     *
+     * @param string $header
+     * @return string
+     */
+    function get($header)
+    {
+        $header = strtr($header, '-', '_');
+        return @$this->_env[ 'HTTP_' . strtoupper($header) ];
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/UserAgent/Mobile.php
===================================================================
--- /branches/mobile/data/module/Net/UserAgent/Mobile.php	(revision 11456)
+++ /branches/mobile/data/module/Net/UserAgent/Mobile.php	(revision 11456)
@@ -0,0 +1,358 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * 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   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id: Mobile.php,v 1.27 2007/02/20 15:17:16 kuboa Exp $
+ * @since      File available since Release 0.1
+ */
+
+require_once dirname(__FILE__) . '/../../PEAR.php';
+require_once dirname(__FILE__) . '/Mobile/Request.php';
+
+// {{{ constants
+
+/**
+ * Constants for error handling.
+ */
+define('NET_USERAGENT_MOBILE_OK',               1);
+define('NET_USERAGENT_MOBILE_ERROR',           -1);
+define('NET_USERAGENT_MOBILE_ERROR_NOMATCH',   -2);
+define('NET_USERAGENT_MOBILE_ERROR_NOT_FOUND', -3);
+
+// }}}
+// {{{ GLOBALS
+
+/**
+ * globals for fallback on no match
+ *
+ * @global boolean $GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH']
+ */
+$GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] = false;
+
+// }}}
+// {{{ Net_UserAgent_Mobile
+
+/**
+ * HTTP mobile user agent string parser
+ *
+ * Net_UserAgent_Mobile parses HTTP_USER_AGENT strings of (mainly Japanese)
+ * mobile HTTP user agents. It'll be useful in page dispatching by user
+ * agents.
+ * This package was ported from Perl's HTTP::MobileAgent.
+ * See {@link http://search.cpan.org/search?mode=module&query=HTTP-MobileAgent}
+ * The author of the HTTP::MobileAgent module is Tatsuhiko Miyagawa
+ * <miyagawa@bulknews.net>
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $agent = &Net_UserAgent_Mobile::factory($agent_string);
+ * // or $agent = &Net_UserAgent_Mobile::factory(); // to get from $_SERVER
+ *
+ * if ($agent->isDoCoMo()) {
+ *     // or if ($agent->getName() == 'DoCoMo')
+ *     // or if (strtolower(get_class($agent)) == 'http_mobileagent_docomo')
+ *     // it's NTT DoCoMo i-mode
+ *     // see what's available in Net_UserAgent_Mobile_DoCoMo
+ * } elseif ($agent->isVodafone()) {
+ *     // it's Vodafone(J-PHONE)
+ *     // see what's available in Net_UserAgent_Mobile_Vodafone
+ * } elseif ($agent->isEZweb()) {
+ *     // it's KDDI/EZWeb
+ *     // see what's available in Net_UserAgent_Mobile_EZweb
+ * } else {
+ *     // may be PC
+ *     // $agent is Net_UserAgent_Mobile_NonMobile
+ * }
+ *
+ * $display = $agent->getDisplay();    // Net_UserAgent_Mobile_Display
+ * if ($display->isColor()) {
+ *    ...
+ * }
+ * </code>
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     * @static
+     */
+
+    // }}}
+    // {{{ factory()
+
+    /**
+     * create a new {@link Net_UserAgent_Mobile_Common} subclass instance
+     *
+     * parses HTTP headers and constructs {@link Net_UserAgent_Mobile_Common}
+     * subclass instance.
+     * If no argument is supplied, $_SERVER{'HTTP_*'} is used.
+     *
+     * @param mixed $stuff User-Agent string or object that works with
+     *     HTTP_Request (not implemented)
+     * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR
+     *     error object on error
+     * @see Net_UserAgent_Mobile_Request::factory()
+     */
+    function &factory($stuff = null)
+    {
+        static $mobileRegex;
+        if (!isset($mobileRegex)) {
+            $docomoRegex    = '^DoCoMo/\d\.\d[ /]';
+            $vodafoneRegex  = '^(?:(?:SoftBank|Vodafone|J-PHONE|Vemulator|J-EMULATOR)/\d\.\d|(?:MOT|MOTEMULATOR)-)';
+            $ezwebRegex     = '^(?:KDDI-[A-Z]+\d+[A-Z]? )?UP\.Browser\/';
+            $airhphoneRegex = '^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);';
+            $mobileRegex =
+                "(?:($docomoRegex)|($vodafoneRegex)|($ezwebRegex)|($airhphoneRegex))";
+        }
+
+        $request = &Net_UserAgent_Mobile_Request::factory($stuff);
+
+        // parse User-Agent string
+        $ua = $request->get('User-Agent');
+        $sub = 'NonMobile';
+        if (preg_match("!$mobileRegex!", $ua, $matches)) {
+            $sub = @$matches[1] ? 'DoCoMo' :
+                (@$matches[2] ? 'Vodafone' :
+                 (@$matches[3] ? 'EZweb' : 'AirHPhone'));
+        }
+        $className = "Net_UserAgent_Mobile_{$sub}";
+
+        if (!class_exists($className)) {
+            $file = dirname(__FILE__) . "/Mobile/{$sub}.php";
+            if (!include_once $file) {
+                return PEAR::raiseError(null,
+                                        NET_USERAGENT_MOBILE_ERROR_NOT_FOUND,
+                                        null, null,
+                                        "Unable to include the $file file",
+                                        'Net_UserAgent_Mobile_Error', true
+                                        );
+            }
+        }
+
+        $instance = &new $className($request);
+        $error = &$instance->isError();
+        if (Net_UserAgent_Mobile::isError($error)) {
+            if ($GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH']
+                && $error->getCode() == NET_USERAGENT_MOBILE_ERROR_NOMATCH
+                ) {
+                $instance = &Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_Fallback_On_NoMatch');
+                return $instance;
+            }
+
+            $instance = &$error;
+        }
+
+        return $instance;
+    }
+
+    // }}}
+    // {{{ singleton()
+
+    /**
+     * creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or
+     * returns a instance from existent ones
+     *
+     * @param mixed $stuff User-Agent string or object that works with
+     *     HTTP_Request (not implemented)
+     * @return mixed a newly created or a existent Net_UserAgent_Mobile
+     *     object, or a PEAR error object on error
+     * @see Net_UserAgent_Mobile::factory()
+     */
+     function &singleton($stuff = null)
+     {
+         static $instance;
+         if (!isset($instance)) {
+             $instance = Net_UserAgent_Mobile::factory($stuff);
+         }
+
+         return $instance;
+     }
+
+    // }}}
+    // {{{ isError()
+
+    /**
+     * tell whether a result code from a Net_UserAgent_Mobile method
+     * is an error
+     *
+     * @param integer $value result code
+     * @return boolean whether $value is an {@link Net_UserAgent_Mobile_Error}
+     */
+    function isError($value)
+    {
+        return is_a($value, 'Net_UserAgent_Mobile_Error');
+    }
+
+    // }}}
+    // {{{ errorMessage()
+
+    /**
+     * return a textual error message for a Net_UserAgent_Mobile error code
+     *
+     * @param integer $value error code
+     * @return string error message, or false if the error code was not
+     *     recognized
+     */
+    function errorMessage($value)
+    {
+        static $errorMessages;
+        if (!isset($errorMessages)) {
+            $errorMessages = array(
+                                   NET_USERAGENT_MOBILE_ERROR           => 'unknown error',
+                                   NET_USERAGENT_MOBILE_ERROR_NOMATCH   => 'no match',
+                                   NET_USERAGENT_MOBILE_ERROR_NOT_FOUND => 'not found',
+                                   NET_USERAGENT_MOBILE_OK              => 'no error'
+                                   );
+        }
+
+        if (Net_UserAgent_Mobile::isError($value)) {
+            $value = $value->getCode();
+        }
+
+        return isset($errorMessages[$value]) ?
+            $errorMessages[$value] :
+            $errorMessages[NET_USERAGENT_MOBILE_ERROR];
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+// {{{ Net_UserAgent_Mobile_Error
+
+/**
+ * Net_UserAgent_Mobile_Error implements a class for reporting user
+ * agent error messages
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.30.0
+ * @since      Class available since Release 0.1
+ */
+class Net_UserAgent_Mobile_Error extends PEAR_Error
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * constructor
+     *
+     * @param mixed   $code     Net_UserAgent_Mobile error code, or string
+     *     with error message.
+     * @param integer $mode     what 'error mode' to operate in
+     * @param integer $level    what error level to use for $mode and
+     *     PEAR_ERROR_TRIGGER
+     * @param mixed   $userinfo additional user/debug info
+     * @access public
+     */
+    function Net_UserAgent_Mobile_Error($code = NET_USERAGENT_MOBILE_ERROR,
+                                        $mode = PEAR_ERROR_RETURN,
+                                        $level = E_USER_NOTICE,
+                                        $userinfo = null
+                                        )
+    {
+        if (is_int($code)) {
+            $this->PEAR_Error('Net_UserAgent_Mobile Error: ' .
+                              Net_UserAgent_Mobile::errorMessage($code),
+                              $code, $mode, $level, $userinfo
+                              );
+        } else {
+            $this->PEAR_Error("Net_UserAgent_Mobile Error: $code",
+                              NET_USERAGENT_MOBILE_ERROR, $mode, $level,
+                              $userinfo
+                              );
+        }
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Net/Socket.php
===================================================================
--- /branches/mobile/data/module/Net/Socket.php	(revision 8284)
+++ /branches/mobile/data/module/Net/Socket.php	(revision 8284)
@@ -0,0 +1,534 @@
+<?php
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.0 of the PHP license,       |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Authors: Stig Bakken <ssb@php.net>                                   |
+// |          Chuck Hagenbuch <chuck@horde.org>                           |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+
+if(!defined('SOCKET_PHP_DIR')) {
+	$SOCKET_PHP_DIR = realpath(dirname( __FILE__));
+	define("SOCKET_PHP_DIR", $SOCKET_PHP_DIR);	
+}
+require_once SOCKET_PHP_DIR. '/../PEAR.php';
+
+define('NET_SOCKET_READ',  1);
+define('NET_SOCKET_WRITE', 2);
+define('NET_SOCKET_ERROR', 3);
+
+/**
+ * Generalized Socket class.
+ *
+ * @version 1.1
+ * @author Stig Bakken <ssb@php.net>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ */
+class Net_Socket extends PEAR {
+
+    /**
+     * Socket file pointer.
+     * @var resource $fp
+     */
+    var $fp = null;
+
+    /**
+     * Whether the socket is blocking. Defaults to true.
+     * @var boolean $blocking
+     */
+    var $blocking = true;
+
+    /**
+     * Whether the socket is persistent. Defaults to false.
+     * @var boolean $persistent
+     */
+    var $persistent = false;
+
+    /**
+     * The IP address to connect to.
+     * @var string $addr
+     */
+    var $addr = '';
+
+    /**
+     * The port number to connect to.
+     * @var integer $port
+     */
+    var $port = 0;
+
+    /**
+     * Number of seconds to wait on socket connections before assuming
+     * there's no more data. Defaults to no timeout.
+     * @var integer $timeout
+     */
+    var $timeout = false;
+
+    /**
+     * Number of bytes to read at a time in readLine() and
+     * readAll(). Defaults to 2048.
+     * @var integer $lineLength
+     */
+    var $lineLength = 2048;
+
+    /**
+     * Connect to the specified port. If called when the socket is
+     * already connected, it disconnects and connects again.
+     *
+     * @param string  $addr        IP address or host name.
+     * @param integer $port        TCP port number.
+     * @param boolean $persistent  (optional) Whether the connection is
+     *                             persistent (kept open between requests
+     *                             by the web server).
+     * @param integer $timeout     (optional) How long to wait for data.
+     * @param array   $options     See options for stream_context_create.
+     *
+     * @access public
+     *
+     * @return boolean | PEAR_Error  True on success or a PEAR_Error on failure.
+     */
+    function connect($addr, $port = 0, $persistent = null, $timeout = null, $options = null)
+    {
+        if (is_resource($this->fp)) {
+            @fclose($this->fp);
+            $this->fp = null;
+        }
+
+        if (!$addr) {
+            return $this->raiseError('$addr cannot be empty');
+        } elseif (strspn($addr, '.0123456789') == strlen($addr) ||
+                  strstr($addr, '/') !== false) {
+            $this->addr = $addr;
+        } else {
+            $this->addr = @gethostbyname($addr);
+        }
+
+        $this->port = $port % 65536;
+
+        if ($persistent !== null) {
+            $this->persistent = $persistent;
+        }
+
+        if ($timeout !== null) {
+            $this->timeout = $timeout;
+        }
+
+        $openfunc = $this->persistent ? 'pfsockopen' : 'fsockopen';
+        $errno = 0;
+        $errstr = '';
+        if ($options && function_exists('stream_context_create')) {
+            if ($this->timeout) {
+                $timeout = $this->timeout;
+            } else {
+                $timeout = 0;
+            }
+            $context = stream_context_create($options);
+            $fp = @$openfunc($this->addr, $this->port, $errno, $errstr, $timeout, $context);
+        } else {
+            if ($this->timeout) {
+                $fp = @$openfunc($this->addr, $this->port, $errno, $errstr, $this->timeout);
+            } else {
+                $fp = @$openfunc($this->addr, $this->port, $errno, $errstr);
+            }
+        }
+
+        if (!$fp) {
+            return $this->raiseError($errstr, $errno);
+        }
+
+        $this->fp = $fp;
+
+        return $this->setBlocking($this->blocking);
+    }
+
+    /**
+     * Disconnects from the peer, closes the socket.
+     *
+     * @access public
+     * @return mixed true on success or an error object otherwise
+     */
+    function disconnect()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        @fclose($this->fp);
+        $this->fp = null;
+        return true;
+    }
+
+    /**
+     * Find out if the socket is in blocking mode.
+     *
+     * @access public
+     * @return boolean  The current blocking mode.
+     */
+    function isBlocking()
+    {
+        return $this->blocking;
+    }
+
+    /**
+     * Sets whether the socket connection should be blocking or
+     * not. A read call to a non-blocking socket will return immediately
+     * if there is no data available, whereas it will block until there
+     * is data for blocking sockets.
+     *
+     * @param boolean $mode  True for blocking sockets, false for nonblocking.
+     * @access public
+     * @return mixed true on success or an error object otherwise
+     */
+    function setBlocking($mode)
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        $this->blocking = $mode;
+        socket_set_blocking($this->fp, $this->blocking);
+        return true;
+    }
+
+    /**
+     * Sets the timeout value on socket descriptor,
+     * expressed in the sum of seconds and microseconds
+     *
+     * @param integer $seconds  Seconds.
+     * @param integer $microseconds  Microseconds.
+     * @access public
+     * @return mixed true on success or an error object otherwise
+     */
+    function setTimeout($seconds, $microseconds)
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        return socket_set_timeout($this->fp, $seconds, $microseconds);
+    }
+
+    /**
+     * Returns information about an existing socket resource.
+     * Currently returns four entries in the result array:
+     *
+     * <p>
+     * timed_out (bool) - The socket timed out waiting for data<br>
+     * blocked (bool) - The socket was blocked<br>
+     * eof (bool) - Indicates EOF event<br>
+     * unread_bytes (int) - Number of bytes left in the socket buffer<br>
+     * </p>
+     *
+     * @access public
+     * @return mixed Array containing information about existing socket resource or an error object otherwise
+     */
+    function getStatus()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        return socket_get_status($this->fp);
+    }
+
+    /**
+     * Get a specified line of data
+     *
+     * @access public
+     * @return $size bytes of data from the socket, or a PEAR_Error if
+     *         not connected.
+     */
+    function gets($size)
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        return @fgets($this->fp, $size);
+    }
+
+    /**
+     * Read a specified amount of data. This is guaranteed to return,
+     * and has the added benefit of getting everything in one fread()
+     * chunk; if you know the size of the data you're getting
+     * beforehand, this is definitely the way to go.
+     *
+     * @param integer $size  The number of bytes to read from the socket.
+     * @access public
+     * @return $size bytes of data from the socket, or a PEAR_Error if
+     *         not connected.
+     */
+    function read($size)
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        return @fread($this->fp, $size);
+    }
+
+    /**
+     * Write a specified amount of data.
+     *
+     * @param string  $data       Data to write.
+     * @param integer $blocksize  Amount of data to write at once.
+     *                            NULL means all at once.
+     *
+     * @access public
+     * @return mixed true on success or an error object otherwise
+     */
+    function write($data, $blocksize = null)
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        if (is_null($blocksize) && !OS_WINDOWS) {
+            return fwrite($this->fp, $data);
+        } else {
+            if (is_null($blocksize)) {
+                $blocksize = 1024;
+            }
+
+            $pos = 0;
+            $size = strlen($data);
+            while ($pos < $size) {
+                $written = @fwrite($this->fp, substr($data, $pos, $blocksize));
+                if ($written === false) {
+                    return false;
+                }
+                $pos += $written;
+            }
+
+            return $pos;
+        }
+    }
+
+    /**
+     * Write a line of data to the socket, followed by a trailing "\r\n".
+     *
+     * @access public
+     * @return mixed fputs result, or an error
+     */
+    function writeLine($data)
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        return fwrite($this->fp, $data . "\r\n");
+    }
+
+    /**
+     * Tests for end-of-file on a socket descriptor.
+     *
+     * @access public
+     * @return bool
+     */
+    function eof()
+    {
+        return (is_resource($this->fp) && feof($this->fp));
+    }
+
+    /**
+     * Reads a byte of data
+     *
+     * @access public
+     * @return 1 byte of data from the socket, or a PEAR_Error if
+     *         not connected.
+     */
+    function readByte()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        return ord(@fread($this->fp, 1));
+    }
+
+    /**
+     * Reads a word of data
+     *
+     * @access public
+     * @return 1 word of data from the socket, or a PEAR_Error if
+     *         not connected.
+     */
+    function readWord()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        $buf = @fread($this->fp, 2);
+        return (ord($buf[0]) + (ord($buf[1]) << 8));
+    }
+
+    /**
+     * Reads an int of data
+     *
+     * @access public
+     * @return integer  1 int of data from the socket, or a PEAR_Error if
+     *                  not connected.
+     */
+    function readInt()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        $buf = @fread($this->fp, 4);
+        return (ord($buf[0]) + (ord($buf[1]) << 8) +
+                (ord($buf[2]) << 16) + (ord($buf[3]) << 24));
+    }
+
+    /**
+     * Reads a zero-terminated string of data
+     *
+     * @access public
+     * @return string, or a PEAR_Error if
+     *         not connected.
+     */
+    function readString()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        $string = '';
+        while (($char = @fread($this->fp, 1)) != "\x00")  {
+            $string .= $char;
+        }
+        return $string;
+    }
+
+    /**
+     * Reads an IP Address and returns it in a dot formated string
+     *
+     * @access public
+     * @return Dot formated string, or a PEAR_Error if
+     *         not connected.
+     */
+    function readIPAddress()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        $buf = @fread($this->fp, 4);
+        return sprintf("%s.%s.%s.%s", ord($buf[0]), ord($buf[1]),
+                       ord($buf[2]), ord($buf[3]));
+    }
+
+    /**
+     * Read until either the end of the socket or a newline, whichever
+     * comes first. Strips the trailing newline from the returned data.
+     *
+     * @access public
+     * @return All available data up to a newline, without that
+     *         newline, or until the end of the socket, or a PEAR_Error if
+     *         not connected.
+     */
+    function readLine()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        $line = '';
+        $timeout = time() + $this->timeout;
+		
+        while (!feof($this->fp) && (!$this->timeout || time() < $timeout)) {
+            $line .= @fgets($this->fp, $this->lineLength);
+            if (substr($line, -1) == "\n") {
+                return rtrim($line, "\r\n");
+            }
+        }
+
+        return $line;
+    }
+	
+    /**
+     * Read until the socket closes, or until there is no more data in
+     * the inner PHP buffer. If the inner buffer is empty, in blocking
+     * mode we wait for at least 1 byte of data. Therefore, in
+     * blocking mode, if there is no data at all to be read, this
+     * function will never exit (unless the socket is closed on the
+     * remote end).
+     *
+     * @access public
+     *
+     * @return string  All data until the socket closes, or a PEAR_Error if
+     *                 not connected.
+     */
+    function readAll()
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        $data = '';
+        while (!feof($this->fp)) {
+            $data .= @fread($this->fp, $this->lineLength);
+        }
+        return $data;
+    }
+
+    /**
+     * Runs the equivalent of the select() system call on the socket
+     * with a timeout specified by tv_sec and tv_usec.
+     *
+     * @param integer $state    Which of read/write/error to check for.
+     * @param integer $tv_sec   Number of seconds for timeout.
+     * @param integer $tv_usec  Number of microseconds for timeout.
+     *
+     * @access public
+     * @return False if select fails, integer describing which of read/write/error
+     *         are ready, or PEAR_Error if not connected.
+     */
+    function select($state, $tv_sec, $tv_usec = 0)
+    {
+        if (!is_resource($this->fp)) {
+            return $this->raiseError('not connected');
+        }
+
+        $read = null;
+        $write = null;
+        $except = null;
+        if ($state & NET_SOCKET_READ) {
+            $read[] = $this->fp;
+        }
+        if ($state & NET_SOCKET_WRITE) {
+            $write[] = $this->fp;
+        }
+        if ($state & NET_SOCKET_ERROR) {
+            $except[] = $this->fp;
+        }
+        if (false === ($sr = stream_select($read, $write, $except, $tv_sec, $tv_usec))) {
+            return false;
+        }
+
+        $result = 0;
+        if (count($read)) {
+            $result |= NET_SOCKET_READ;
+        }
+        if (count($write)) {
+            $result |= NET_SOCKET_WRITE;
+        }
+        if (count($except)) {
+            $result |= NET_SOCKET_ERROR;
+        }
+        return $result;
+    }
+
+}
Index: /branches/mobile/data/module/Net/URL.php
===================================================================
--- /branches/mobile/data/module/Net/URL.php	(revision 6888)
+++ /branches/mobile/data/module/Net/URL.php	(revision 6888)
@@ -0,0 +1,410 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002-2004, Richard Heyes                                |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.|
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Richard Heyes <richard at php net>                            |
+// +-----------------------------------------------------------------------+
+//
+// $Id$
+//
+// Net_URL Class
+
+class Net_URL
+{
+    /**
+    * Full url
+    * @var string
+    */
+    var $url;
+
+    /**
+    * Protocol
+    * @var string
+    */
+    var $protocol;
+
+    /**
+    * Username
+    * @var string
+    */
+    var $username;
+
+    /**
+    * Password
+    * @var string
+    */
+    var $password;
+
+    /**
+    * Host
+    * @var string
+    */
+    var $host;
+
+    /**
+    * Port
+    * @var integer
+    */
+    var $port;
+
+    /**
+    * Path
+    * @var string
+    */
+    var $path;
+
+    /**
+    * Query string
+    * @var array
+    */
+    var $querystring;
+
+    /**
+    * Anchor
+    * @var string
+    */
+    var $anchor;
+
+    /**
+    * Whether to use []
+    * @var bool
+    */
+    var $useBrackets;
+
+    /**
+    * PHP4 Constructor
+    *
+    * @see __construct()
+    */
+    function Net_URL($url = null, $useBrackets = true)
+    {
+        $this->__construct($url, $useBrackets);
+    }
+
+    /**
+    * PHP5 Constructor
+    *
+    * Parses the given url and stores the various parts
+    * Defaults are used in certain cases
+    *
+    * @param string $url         Optional URL
+    * @param bool   $useBrackets Whether to use square brackets when
+    *                            multiple querystrings with the same name
+    *                            exist
+    */
+    function __construct($url = null, $useBrackets = true)
+    {
+        $HTTP_SERVER_VARS  = !empty($_SERVER) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
+
+        $this->useBrackets = $useBrackets;
+        $this->url         = $url;
+        $this->user        = '';
+        $this->pass        = '';
+        $this->host        = '';
+        $this->port        = 80;
+        $this->path        = '';
+        $this->querystring = array();
+        $this->anchor      = '';
+
+        // Only use defaults if not an absolute URL given
+        if (!preg_match('/^[a-z0-9]+:\/\//i', $url)) {
+
+            $this->protocol    = (@$HTTP_SERVER_VARS['HTTPS'] == 'on' ? 'https' : 'http');
+
+            /**
+            * Figure out host/port
+            */
+            if (!empty($HTTP_SERVER_VARS['HTTP_HOST']) AND preg_match('/^(.*)(:([0-9]+))?$/U', $HTTP_SERVER_VARS['HTTP_HOST'], $matches)) {
+                $host = $matches[1];
+                if (!empty($matches[3])) {
+                    $port = $matches[3];
+                } else {
+                    $port = $this->getStandardPort($this->protocol);
+                }
+            }
+
+            $this->user        = '';
+            $this->pass        = '';
+            $this->host        = !empty($host) ? $host : (isset($HTTP_SERVER_VARS['SERVER_NAME']) ? $HTTP_SERVER_VARS['SERVER_NAME'] : 'localhost');
+            $this->port        = !empty($port) ? $port : (isset($HTTP_SERVER_VARS['SERVER_PORT']) ? $HTTP_SERVER_VARS['SERVER_PORT'] : $this->getStandardPort($this->protocol));
+            $this->path        = !empty($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : '/';
+            $this->querystring = isset($HTTP_SERVER_VARS['QUERY_STRING']) ? $this->_parseRawQuerystring($HTTP_SERVER_VARS['QUERY_STRING']) : null;
+            $this->anchor      = '';
+        }
+
+        // Parse the url and store the various parts
+        if (!empty($url)) {
+            $urlinfo = parse_url($url);
+
+            // Default querystring
+            $this->querystring = array();
+
+            foreach ($urlinfo as $key => $value) {
+                switch ($key) {
+                    case 'scheme':
+                        $this->protocol = $value;
+                        $this->port     = $this->getStandardPort($value);
+                        break;
+
+                    case 'user':
+                    case 'pass':
+                    case 'host':
+                    case 'port':
+                        $this->$key = $value;
+                        break;
+
+                    case 'path':
+                        if ($value{0} == '/') {
+                            $this->path = $value;
+                        } else {
+                            $path = dirname($this->path) == DIRECTORY_SEPARATOR ? '' : dirname($this->path);
+                            $this->path = sprintf('%s/%s', $path, $value);
+                        }
+                        break;
+
+                    case 'query':
+                        $this->querystring = $this->_parseRawQueryString($value);
+                        break;
+
+                    case 'fragment':
+                        $this->anchor = $value;
+                        break;
+                }
+            }
+        }
+    }
+
+    /**
+    * Returns full url
+    *
+    * @return string Full url
+    * @access public
+    */
+    function getURL()
+    {
+        $querystring = $this->getQueryString();
+
+        $this->url = $this->protocol . '://'
+                   . $this->user . (!empty($this->pass) ? ':' : '')
+                   . $this->pass . (!empty($this->user) ? '@' : '')
+                   . $this->host . ($this->port == $this->getStandardPort($this->protocol) ? '' : ':' . $this->port)
+                   . $this->path
+                   . (!empty($querystring) ? '?' . $querystring : '')
+                   . (!empty($this->anchor) ? '#' . $this->anchor : '');
+
+        return $this->url;
+    }
+
+    /**
+    * Adds a querystring item
+    *
+    * @param  string $name       Name of item
+    * @param  string $value      Value of item
+    * @param  bool   $preencoded Whether value is urlencoded or not, default = not
+    * @access public
+    */
+    function addQueryString($name, $value, $preencoded = false)
+    {
+        if ($preencoded) {
+            $this->querystring[$name] = $value;
+        } else {
+            $this->querystring[$name] = is_array($value) ? array_map('rawurlencode', $value): rawurlencode($value);
+        }
+    }
+
+    /**
+    * Removes a querystring item
+    *
+    * @param  string $name Name of item
+    * @access public
+    */
+    function removeQueryString($name)
+    {
+        if (isset($this->querystring[$name])) {
+            unset($this->querystring[$name]);
+        }
+    }
+
+    /**
+    * Sets the querystring to literally what you supply
+    *
+    * @param  string $querystring The querystring data. Should be of the format foo=bar&x=y etc
+    * @access public
+    */
+    function addRawQueryString($querystring)
+    {
+        $this->querystring = $this->_parseRawQueryString($querystring);
+    }
+
+    /**
+    * Returns flat querystring
+    *
+    * @return string Querystring
+    * @access public
+    */
+    function getQueryString()
+    {
+        if (!empty($this->querystring)) {
+            foreach ($this->querystring as $name => $value) {
+                if (is_array($value)) {
+                    foreach ($value as $k => $v) {
+                        $querystring[] = $this->useBrackets ? sprintf('%s[%s]=%s', $name, $k, $v) : ($name . '=' . $v);
+                    }
+                } elseif (!is_null($value)) {
+                    $querystring[] = $name . '=' . $value;
+                } else {
+                    $querystring[] = $name;
+                }
+            }
+            $querystring = implode(ini_get('arg_separator.output'), $querystring);
+        } else {
+            $querystring = '';
+        }
+
+        return $querystring;
+    }
+
+    /**
+    * Parses raw querystring and returns an array of it
+    *
+    * @param  string  $querystring The querystring to parse
+    * @return array                An array of the querystring data
+    * @access private
+    */
+    function _parseRawQuerystring($querystring)
+    {
+        $parts  = preg_split('/[' . preg_quote(ini_get('arg_separator.input'), '/') . ']/', $querystring, -1, PREG_SPLIT_NO_EMPTY);
+        $return = array();
+
+        foreach ($parts as $part) {
+            if (strpos($part, '=') !== false) {
+                $value = substr($part, strpos($part, '=') + 1);
+                $key   = substr($part, 0, strpos($part, '='));
+            } else {
+                $value = null;
+                $key   = $part;
+            }
+            if (substr($key, -2) == '[]') {
+                $key = substr($key, 0, -2);
+                if (@!is_array($return[$key])) {
+                    $return[$key]   = array();
+                    $return[$key][] = $value;
+                } else {
+                    $return[$key][] = $value;
+                }
+            } elseif (!$this->useBrackets AND !empty($return[$key])) {
+                $return[$key]   = (array)$return[$key];
+                $return[$key][] = $value;
+            } else {
+                $return[$key] = $value;
+            }
+        }
+
+        return $return;
+    }
+
+    /**
+    * Resolves //, ../ and ./ from a path and returns
+    * the result. Eg:
+    *
+    * /foo/bar/../boo.php    => /foo/boo.php
+    * /foo/bar/../../boo.php => /boo.php
+    * /foo/bar/.././/boo.php => /foo/boo.php
+    *
+    * This method can also be called statically.
+    *
+    * @param  string $url URL path to resolve
+    * @return string      The result
+    */
+    function resolvePath($path)
+    {
+        $path = explode('/', str_replace('//', '/', $path));
+
+        for ($i=0; $i<count($path); $i++) {
+            if ($path[$i] == '.') {
+                unset($path[$i]);
+                $path = array_values($path);
+                $i--;
+
+            } elseif ($path[$i] == '..' AND ($i > 1 OR ($i == 1 AND $path[0] != '') ) ) {
+                unset($path[$i]);
+                unset($path[$i-1]);
+                $path = array_values($path);
+                $i -= 2;
+
+            } elseif ($path[$i] == '..' AND $i == 1 AND $path[0] == '') {
+                unset($path[$i]);
+                $path = array_values($path);
+                $i--;
+
+            } else {
+                continue;
+            }
+        }
+
+        return implode('/', $path);
+    }
+
+    /**
+    * Returns the standard port number for a protocol
+    *
+    * @param  string  $scheme The protocol to lookup
+    * @return integer         Port number or NULL if no scheme matches
+    *
+    * @author Philippe Jausions <Philippe.Jausions@11abacus.com>
+    */
+    function getStandardPort($scheme)
+    {
+        switch (strtolower($scheme)) {
+            case 'http':    return 80;
+            case 'https':   return 443;
+            case 'ftp':     return 21;
+            case 'imap':    return 143;
+            case 'imaps':   return 993;
+            case 'pop3':    return 110;
+            case 'pop3s':   return 995;
+            default:        return null;
+       }
+    }
+
+    /**
+    * Forces the URL to a particular protocol
+    *
+    * @param string  $protocol Protocol to force the URL to
+    * @param integer $port     Optional port (standard port is used by default)
+    */
+    function setProtocol($protocol, $port = null)
+    {
+        $this->protocol = $protocol;
+        $this->port = is_null($port) ? $this->getStandardPort() : $port;
+    }
+
+}
+?>
Index: /branches/mobile/data/module/SearchReplace.php
===================================================================
--- /branches/mobile/data/module/SearchReplace.php	(revision 10511)
+++ /branches/mobile/data/module/SearchReplace.php	(revision 10511)
@@ -0,0 +1,547 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002-2005, Richard Heyes                                |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.|
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Richard Heyes <richard@phpguru.org>                           |
+// +-----------------------------------------------------------------------+
+//
+// $Id: SearchReplace.php,v 1.14 2006/07/12 09:35:09 techtonik Exp $
+//
+// Search and Replace Utility
+//
+
+/**
+ * Search and Replace Utility
+ *
+ *
+ * @author  Richard Heyes <richard@phpguru.org>
+ * @version 1.0
+ * @package File
+ */
+class File_SearchReplace
+{
+    
+    // {{{ Properties (All private)
+
+    var $find;
+    var $replace;
+    var $files;
+    var $directories;
+    var $include_subdir;
+    var $ignore_lines;
+    var $ignore_sep;
+    var $occurences;
+    var $search_function;
+    var $php5;
+    var $last_error;
+
+    // }}}
+    // {{{ Constructor
+
+    /**
+     * Sets up the object
+     *
+     * @access public
+     * @param string $find                      The string/regex to find.
+     * @param string $replace                   The string/regex to replace $find with.
+     * @param array  $files                     The file(s) to perform this operation on.
+     * @param array  $directories    (optional) The directories to perform this operation on.
+     * @param bool   $include_subdir            If performing on directories, whether to traverse subdirectories.
+     * @param array  $ignore_lines              Ignore lines beginning with any of the strings in this array. This
+     *                                          feature only works with the "normal" search.
+     */
+    function File_SearchReplace($find, $replace, $files, $directories = '', $include_subdir = TRUE, $ignore_lines = array())
+    {
+
+        $this->find            = $find;
+        $this->replace         = $replace;
+        $this->files           = $files;
+        $this->directories     = $directories;
+        $this->include_subdir  = $include_subdir;
+        $this->ignore_lines    = (array) $ignore_lines;
+
+        $this->occurences      = 0;
+        $this->search_function = 'search';
+        $this->php5            = (substr(PHP_VERSION, 0, 1) == 5) ? TRUE : FALSE;
+        $this->last_error      = '';
+
+    }
+
+    // }}}
+    // {{{ getNumOccurences()
+
+    /**
+     * Accessor to return the number of occurences found.
+     *
+     * @access public
+     * @return int Number of occurences found.
+     */
+    function getNumOccurences()
+    {
+        return $this->occurences;
+    }
+
+    // }}}
+    // {{{ getLastError()
+
+    /**
+     * Accessor for retrieving last error.
+     *
+     * @access public
+     * @return string The last error that occurred, if any.
+     */
+    function getLastError()
+    {
+        return $this->last_error;
+    }
+
+    // }}}
+    // {{{ setFind()
+
+    /**
+     * Accessor for setting find variable.
+     *
+     * @access public
+     * @param string $find The string/regex to find.
+     */
+    function setFind($find)
+    {
+        $this->find = $find;
+    }
+
+    // }}}
+    // {{{ setReplace()
+
+    /**
+     * Accessor for setting replace variable.
+     *
+     * @access public
+     * @param string $replace The string/regex to replace the find string/regex with.
+     */
+    function setReplace($replace)
+    {
+        $this->replace = $replace;
+    }
+
+    // }}}
+    // {{{ setFiles()
+
+    /**
+     * Accessor for setting files variable.
+     *
+     * @access public
+     * @param array $files The file(s) to perform this operation on.
+     */
+    function setFiles($files)
+    {
+        $this->files = $files;
+    }
+
+    // }}}
+    // {{{ setDirectories()
+
+    /**
+     * Accessor for setting directories variable.
+     *
+     * @access public
+     * @param array $directories The directories to perform this operation on.
+     */
+    function setDirectories($directories)
+    {
+        $this->directories = $directories;
+    }
+
+    // }}}
+    // {{{ setIncludeSubdir
+
+    /**
+     * Accessor for setting include_subdir variable.
+     *
+     * @access public
+     * @param bool $include_subdir Whether to traverse subdirectories or not.
+     */
+    function setIncludeSubdir($include_subdir)
+    {
+        $this->include_subdir = $include_subdir;
+    }
+
+    // }}}
+    // {{{ setIgnoreLines()
+
+    /**
+     * Accessor for setting ignore_lines variable.
+     *
+     * @access public
+     * @param array $ignore_lines Ignore lines beginning with any of the strings in this array. This
+     *                            feature only works with the "normal" search.
+     */
+    function setIgnoreLines($ignore_lines)
+    {
+        $this->ignore_lines = $ignore_lines;
+    }
+
+    // }}}
+    // {{{ setSearchFunction()
+
+    /**
+     * Function to determine which search function is used.
+     *
+     * @access public
+     * @param string The search function that should be used. Can be any one of:
+     *               normal - Default search. Goes line by line. Ignore lines feature only works with this type.
+     *               quick  - Uses str_replace for straight replacement throughout file. Quickest of the lot.
+     *               preg   - Uses preg_replace(), so any regex valid with this function is valid here.
+     *               ereg   - Uses ereg_replace(), so any regex valid with this function is valid here.
+     */
+    function setSearchFunction($search_function)
+    {
+        switch($search_function) {
+        case 'normal': $this->search_function = 'search';
+            return TRUE;
+            break;
+
+        case 'quick' : $this->search_function = 'quickSearch';
+            return TRUE;
+            break;
+
+        case 'preg'  : $this->search_function = 'pregSearch';
+            return TRUE;
+            break;
+
+        case 'ereg'  : $this->search_function = 'eregSearch';
+            return TRUE;
+            break;
+
+        default      : $this->last_error      = 'Invalid search function specified';
+            return FALSE;
+            break;
+        }
+    }
+
+    // }}}
+    // {{{ search()
+
+    /**
+     * Default ("normal") search routine.
+     *
+     * @access private
+     * @param string $filename The filename to search and replace upon.
+     * @return array Will return an array containing the new file contents and the number of occurences.
+     *               Will return FALSE if there are no occurences.
+     */
+    function search($filename)
+    {
+        $occurences = 0;
+        $file_array = file($filename);
+
+        if (empty($this->ignore_lines) && $this->php5) { // PHP5 acceleration
+            $file_array = str_replace($this->find, $this->replace, $file_array, $occurences);
+
+        } else { // str_replace() doesn't return number of occurences in PHP4
+                 // so we need to count them manually and/or filter strings
+            $ignore_lines_num = count($this->ignore_lines);
+
+            // just for the sake of catching occurences
+            $local_find    = array_values((array) $this->find);
+            $local_replace = (is_array($this->replace)) ? array_values($this->replace) : $this->replace;
+
+            for ($i=0; $i < count($file_array); $i++) {
+
+                if ($ignore_lines_num > 0) {
+                    for ($j=0; $j < $ignore_lines_num; $j++) {
+                        if (substr($file_array[$i],0,strlen($this->ignore_lines[$j])) == $this->ignore_lines[$j]) continue 2;
+                    }
+                }
+
+                if ($this->php5) {
+                    $file_array[$i] = str_replace($this->find, $this->replace, $file_array[$i], $counted);
+                    $occurences += $counted;
+                } else {
+                    foreach ($local_find as $fk => $ff) {
+                        $occurences += substr_count($file_array[$i], $ff);
+                        if (!is_array($local_replace)) {
+                            $fr = $local_replace;
+                        } else {
+                            $fr = (isset($local_replace[$fk])) ? $local_replace[$fk] : "";
+                        }
+                        $file_array[$i] = str_replace($ff, $fr, $file_array[$i]);
+                    }
+                }
+            }
+
+        }
+        if ($occurences > 0) $return = array($occurences, implode('', $file_array)); else $return = FALSE;
+        return $return;
+
+    }
+
+    // }}}
+    // {{{ quickSearch()
+
+    /**
+     * Quick search routine.
+     *
+     * @access private
+     * @param string $filename The filename to search and replace upon.
+     * @return array Will return an array containing the new file contents and the number of occurences.
+     *               Will return FALSE if there are no occurences.
+     */
+    function quickSearch($filename)
+    {
+
+        clearstatcache();
+
+        $file          = fread($fp = fopen($filename, 'r'), max(1, filesize($filename))); fclose($fp);
+        $local_find    = array_values((array) $this->find);
+        $local_replace = (is_array($this->replace)) ? array_values($this->replace) : $this->replace;
+
+        $occurences    = 0;
+
+        // logic is the same as in str_replace function with one exception:
+        //   if <search> is a string and <replacement> is an array - substitution
+        //   is done from the first element of array. str_replace in this case
+        //   usualy fails with notice and returns "ArrayArrayArray..." string
+        // (this exclusive logic of SearchReplace will not work for php5, though,
+        // because I haven't decided yet whether it is bug or feature)
+
+        if ($this->php5) {
+            $file_array[$i] = str_replace($this->find, $this->replace, $file_array[$i], $counted);
+            $occurences += $counted;
+        } else {
+            foreach ($local_find as $fk => $ff) {
+                $occurences += substr_count($file, $ff);
+                if (!is_array($local_replace)) {
+                    $fr = $local_replace;
+                } else {
+                    $fr = (isset($local_replace[$fk])) ? $local_replace[$fk] : "";
+                }
+                $file = str_replace($ff, $fr, $file);
+            }
+        }
+
+        if ($occurences > 0) $return = array($occurences, $file); else $return = FALSE;
+        return $return;
+
+    }
+
+    // }}}
+    // {{{ pregSearch()
+
+    /**
+     * Preg search routine.
+     *
+     * @access private
+     * @param string $filename The filename to search and replace upon.
+     * @return array Will return an array containing the new file contents and the number of occurences.
+     *               Will return FALSE if there are no occurences.
+     */
+    function pregSearch($filename)
+    {
+
+        clearstatcache();
+
+        $file       = fread($fp = fopen($filename, 'r'), max(1, filesize($filename))); fclose($fp);
+        $local_find    = array_values((array) $this->find);
+        $local_replace = (is_array($this->replace)) ? array_values($this->replace) : $this->replace;
+
+        $occurences = 0;
+
+        foreach($local_find as $fk => $ff) {
+            $occurences += preg_match_all($ff, $file, $matches);
+            if (!is_array($local_replace)) {
+                $fr = $local_replace;
+            } else {
+                $fr = (isset($local_replace[$fk])) ? $local_replace[$fk] : "";
+            }
+            $file = preg_replace($ff, $fr, $file);
+        }
+
+        if ($occurences > 0) $return = array($occurences, $file); else $return = FALSE;
+        return $return;
+
+    }
+
+    // }}}
+    // {{{ eregSearch()
+
+    /**
+     * Ereg search routine.
+     *
+     * @access private
+     * @param string $filename The filename to search and replace upon.
+     * @return array Will return an array containing the new file contents and the number of occurences.
+     *               Will return FALSE if there are no occurences.
+     */
+    function eregSearch($filename)
+    {
+
+        clearstatcache();
+
+        $file = fread($fp = fopen($filename, 'r'), max(1, filesize($filename))); fclose($fp);
+        $local_find    = array_values((array) $this->find);
+        $local_replace = (is_array($this->replace)) ? array_values($this->replace) : $this->replace;
+
+        $occurences = 0;
+
+        foreach($local_find as $fk => $ff) {
+            $occurences += count(split($ff, $file)) - 1;
+            if (!is_array($local_replace)) {
+                $fr = $local_replace;
+            } else {
+                $fr = (isset($local_replace[$fk])) ? $local_replace[$fk] : "";
+            }
+            $file = ereg_replace($ff, $fr, $file);
+        }
+
+        if ($occurences > 0) $return = array($occurences, $file); else $return = FALSE;
+        return $return;
+
+    }
+
+    // }}}
+    // {{{ writeout()
+    
+    /**
+     * Function to writeout the file contents.
+     *
+     * @access private
+     * @param string $filename The filename of the file to write.
+     * @param string $contents The contents to write to the file.
+     */
+    function writeout($filename, $contents)
+    {
+
+        if ($fp = @fopen($filename, 'w')) {
+            flock($fp,2);
+            fwrite($fp, $contents);
+            flock($fp,3);
+            fclose($fp);
+        } else {
+            $this->last_error = 'Could not open file: '.$filename;
+        }
+
+    }
+
+    // }}}
+    // {{{ doFiles()
+
+    /**
+     * Function called by doSearch() to go through any files that need searching.
+     *
+     * @access private
+     * @param string $ser_func The search function to use.
+     */
+    function doFiles($ser_func)
+    {
+        if (!is_array($this->files)) $this->files = explode(',', $this->files);
+        for ($i=0; $i<count($this->files); $i++) {
+            if ($this->files[$i] == '.' OR $this->files[$i] == '..') continue;
+            if (is_dir($this->files[$i]) == TRUE) continue;
+            $newfile = $this->$ser_func($this->files[$i]);
+            if (is_array($newfile) == TRUE){
+                $this->writeout($this->files[$i], $newfile[1]);
+                $this->occurences += $newfile[0];
+            }
+        }
+    }
+
+    // }}}
+    // {{{ doDirectories()
+
+    /**
+     * Function called by doSearch() to go through any directories that need searching.
+     *
+     * @access private
+     * @param string $ser_func The search function to use.
+     */
+    function doDirectories($ser_func)
+    {
+        if (!is_array($this->directories)) $this->directories = explode(',', $this->directories);
+        for ($i=0; $i<count($this->directories); $i++) {
+            $dh = opendir($this->directories[$i]);
+            while ($file = readdir($dh)) {
+                if ($file == '.' OR $file == '..') continue;
+
+                if (is_dir($this->directories[$i].$file) == TRUE) {
+                    if ($this->include_subdir == TRUE) {
+                        $this->directories[] = $this->directories[$i].$file.'/';
+                        continue;
+                    } else {
+                        continue;
+                    }
+                }
+
+                $newfile = $this->$ser_func($this->directories[$i].$file);
+                if (is_array($newfile) == TRUE) {
+                    $this->writeout($this->directories[$i].$file, $newfile[1]);
+                    $this->occurences += $newfile[0];
+                }
+            }
+        }
+    }
+
+    // }}}
+    // {{{ doSearch()
+    
+    /**
+     * This starts the search/replace off. The behavior of this function will likely
+     * to be changed in future versions to work in read only mode. If you want to do
+     * actual replace with writing files - use doReplace method instead. 
+     *
+     * @access public
+     */
+    function doSearch()
+    {
+        $this->doReplace();
+    }
+    
+    // }}}
+    // {{{ doReplace()
+    
+    /**
+     * This starts the search/replace off. Call this to do the replace.
+     * First do whatever files are specified, and/or if directories are specified,
+     * do those too.
+     *
+     * @access public
+     */
+    function doReplace()
+    {
+        $this->occurences = 0;
+        if ($this->find != '') {
+            if ((is_array($this->files) AND count($this->files) > 0) OR $this->files != '') $this->doFiles($this->search_function);
+            if ($this->directories != '')                                                   $this->doDirectories($this->search_function);
+        }
+    }
+    
+    // }}}
+
+}
+?>
Index: /branches/mobile/data/module/DB.php
===================================================================
--- /branches/mobile/data/module/DB.php	(revision 6099)
+++ /branches/mobile/data/module/DB.php	(revision 6099)
@@ -0,0 +1,1393 @@
+<?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
+ */
+
+if(!defined('DB_PHP_DIR')) {
+	$DB_PHP_DIR = realpath(dirname( __FILE__));
+	define("DB_PHP_DIR", $DB_PHP_DIR);	
+}
+
+require_once DB_PHP_DIR . '/PEAR.php';
+
+// {{{ 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: /branches/mobile/data/module/Tar.php
===================================================================
--- /branches/mobile/data/module/Tar.php	(revision 6097)
+++ /branches/mobile/data/module/Tar.php	(revision 6097)
@@ -0,0 +1,1767 @@
+<?php
+/* vim: set ts=4 sw=4: */
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 3.0 of the PHP license,       |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available through the world-wide-web at the following url:           |
+// | 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 world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Author: Vincent Blavet <vincent@phpconcept.net>                      |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+
+if(!defined('TAR_PHP_DIR')) {
+	$TAR_PHP_DIR = realpath(dirname( __FILE__));
+	define("TAR_PHP_DIR", $TAR_PHP_DIR);	
+}
+
+require_once TAR_PHP_DIR . '/PEAR.php';
+
+
+define ('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
+
+/**
+* Creates a (compressed) Tar archive
+*
+* @author   Vincent Blavet <vincent@phpconcept.net>
+* @version  $Revision$
+* @package  Archive
+*/
+class Archive_Tar extends PEAR
+{
+    /**
+    * @var string Name of the Tar
+    */
+    var $_tarname='';
+
+    /**
+    * @var boolean if true, the Tar file will be gzipped
+    */
+    var $_compress=false;
+
+    /**
+    * @var string Type of compression : 'none', 'gz' or 'bz2'
+    */
+    var $_compress_type='none';
+
+    /**
+    * @var string Explode separator
+    */
+    var $_separator=' ';
+
+    /**
+    * @var file descriptor
+    */
+    var $_file=0;
+
+    /**
+    * @var string Local Tar name of a remote Tar (http:// or ftp://)
+    */
+    var $_temp_tarname='';
+
+    // {{{ constructor
+    /**
+    * Archive_Tar Class constructor. This flavour of the constructor only
+    * declare a new Archive_Tar object, identifying it by the name of the
+    * tar file.
+    * If the compress argument is set the tar will be read or created as a
+    * gzip or bz2 compressed TAR file.
+    *
+    * @param    string  $p_tarname  The name of the tar archive to create
+    * @param    string  $p_compress can be null, 'gz' or 'bz2'. This
+    *                   parameter indicates if gzip or bz2 compression
+    *                   is required.  For compatibility reason the
+    *                   boolean value 'true' means 'gz'.
+    * @access public
+    */
+    function Archive_Tar($p_tarname, $p_compress = null)
+    {
+        $this->PEAR();
+        $this->_compress = false;
+        $this->_compress_type = 'none';
+        if (($p_compress === null) || ($p_compress == '')) {
+            if (@file_exists($p_tarname)) {
+                if ($fp = @fopen($p_tarname, "rb")) {
+                    // look for gzip magic cookie
+                    $data = fread($fp, 2);
+                    fclose($fp);
+                    if ($data == "\37\213") {
+                        $this->_compress = true;
+                        $this->_compress_type = 'gz';
+                    // No sure it's enought for a magic code ....
+                    } elseif ($data == "BZ") {
+                        $this->_compress = true;
+                        $this->_compress_type = 'bz2';
+                    }
+                }
+            } else {
+                // probably a remote file or some file accessible
+                // through a stream interface
+                if (substr($p_tarname, -2) == 'gz') {
+                    $this->_compress = true;
+                    $this->_compress_type = 'gz';
+                } elseif ((substr($p_tarname, -3) == 'bz2') ||
+                          (substr($p_tarname, -2) == 'bz')) {
+                    $this->_compress = true;
+                    $this->_compress_type = 'bz2';
+                }
+            }
+        } else {
+            if (($p_compress === true) || ($p_compress == 'gz')) {
+                $this->_compress = true;
+                $this->_compress_type = 'gz';
+            } else if ($p_compress == 'bz2') {
+                $this->_compress = true;
+                $this->_compress_type = 'bz2';
+            } else {
+                die("Unsupported compression type '$p_compress'\n".
+                    "Supported types are 'gz' and 'bz2'.\n");
+                return false;
+            }
+        }
+        $this->_tarname = $p_tarname;
+        if ($this->_compress) { // assert zlib or bz2 extension support
+            if ($this->_compress_type == 'gz')
+                $extname = 'zlib';
+            else if ($this->_compress_type == 'bz2')
+                $extname = 'bz2';
+
+            if (!extension_loaded($extname)) {
+                PEAR::loadExtension($extname);
+            }
+            if (!extension_loaded($extname)) {
+                die("The extension '$extname' couldn't be found.\n".
+                    "Please make sure your version of PHP was built ".
+                    "with '$extname' support.\n");
+                return false;
+            }
+        }
+    }
+    // }}}
+
+    // {{{ destructor
+    function _Archive_Tar()
+    {
+        $this->_close();
+        // ----- Look for a local copy to delete
+        if ($this->_temp_tarname != '')
+            @unlink($this->_temp_tarname);
+        $this->_PEAR();
+    }
+    // }}}
+
+    // {{{ create()
+    /**
+    * This method creates the archive file and add the files / directories
+    * that are listed in $p_filelist.
+    * If a file with the same name exist and is writable, it is replaced
+    * by the new tar.
+    * The method return false and a PEAR error text.
+    * The $p_filelist parameter can be an array of string, each string
+    * representing a filename or a directory name with their path if
+    * needed. It can also be a single string with names separated by a
+    * single blank.
+    * For each directory added in the archive, the files and
+    * sub-directories are also added.
+    * See also createModify() method for more details.
+    *
+    * @param array  $p_filelist An array of filenames and directory names, or a
+	*                           single string with names separated by a single
+	*                           blank space.
+    * @return                   true on success, false on error.
+    * @see createModify()
+    * @access public
+    */
+    function create($p_filelist)
+    {
+		return $this->createModify($p_filelist, '', '');
+    }
+    // }}}
+
+    // {{{ add()
+    /**
+    * This method add the files / directories that are listed in $p_filelist in
+    * the archive. If the archive does not exist it is created.
+    * The method return false and a PEAR error text.
+    * The files and directories listed are only added at the end of the archive,
+    * even if a file with the same name is already archived.
+    * See also createModify() method for more details.
+    *
+    * @param array  $p_filelist An array of filenames and directory names, or a
+	*                           single string with names separated by a single
+	*                           blank space.
+    * @return                   true on success, false on error.
+    * @see createModify()
+    * @access public
+    */
+    function add($p_filelist)
+    {
+        return $this->addModify($p_filelist, '', '');
+    }
+    // }}}
+
+    // {{{ extract()
+    function extract($p_path='')
+    {
+        return $this->extractModify($p_path, '');
+    }
+    // }}}
+
+    // {{{ listContent()
+    function listContent()
+    {
+        $v_list_detail = array();
+
+        if ($this->_openRead()) {
+            if (!$this->_extractList('', $v_list_detail, "list", '', '')) {
+                unset($v_list_detail);
+                $v_list_detail = 0;
+            }
+            $this->_close();
+        }
+
+        return $v_list_detail;
+    }
+    // }}}
+
+    // {{{ createModify()
+    /**
+    * This method creates the archive file and add the files / directories
+    * that are listed in $p_filelist.
+    * If the file already exists and is writable, it is replaced by the
+    * new tar. It is a create and not an add. If the file exists and is
+    * read-only or is a directory it is not replaced. The method return
+    * false and a PEAR error text.
+    * The $p_filelist parameter can be an array of string, each string
+    * representing a filename or a directory name with their path if
+    * needed. It can also be a single string with names separated by a
+    * single blank.
+    * The path indicated in $p_remove_dir will be removed from the
+    * memorized path of each file / directory listed when this path
+    * exists. By default nothing is removed (empty path '')
+    * The path indicated in $p_add_dir will be added at the beginning of
+    * the memorized path of each file / directory listed. However it can
+    * be set to empty ''. The adding of a path is done after the removing
+    * of path.
+    * The path add/remove ability enables the user to prepare an archive
+    * for extraction in a different path than the origin files are.
+    * See also addModify() method for file adding properties.
+    *
+    * @param array  $p_filelist     An array of filenames and directory names,
+	*                               or a single string with names separated by
+	*                               a single blank space.
+    * @param string $p_add_dir      A string which contains a path to be added
+	*                               to the memorized path of each element in
+	*                               the list.
+    * @param string $p_remove_dir   A string which contains a path to be
+	*                               removed from the memorized path of each
+	*                               element in the list, when relevant.
+    * @return boolean               true on success, false on error.
+    * @access public
+    * @see addModify()
+    */
+    function createModify($p_filelist, $p_add_dir, $p_remove_dir='')
+    {
+        $v_result = true;
+
+        if (!$this->_openWrite())
+            return false;
+
+        if ($p_filelist != '') {
+            if (is_array($p_filelist))
+                $v_list = $p_filelist;
+            elseif (is_string($p_filelist))
+                $v_list = explode($this->_separator, $p_filelist);
+            else {
+                $this->_cleanFile();
+                $this->_error('Invalid file list');
+                return false;
+            }
+
+            $v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir);
+        }
+
+        if ($v_result) {
+            $this->_writeFooter();
+            $this->_close();
+        } else
+            $this->_cleanFile();
+
+        return $v_result;
+    }
+    // }}}
+
+    // {{{ addModify()
+    /**
+    * This method add the files / directories listed in $p_filelist at the
+    * end of the existing archive. If the archive does not yet exists it
+    * is created.
+    * The $p_filelist parameter can be an array of string, each string
+    * representing a filename or a directory name with their path if
+    * needed. It can also be a single string with names separated by a
+    * single blank.
+    * The path indicated in $p_remove_dir will be removed from the
+    * memorized path of each file / directory listed when this path
+    * exists. By default nothing is removed (empty path '')
+    * The path indicated in $p_add_dir will be added at the beginning of
+    * the memorized path of each file / directory listed. However it can
+    * be set to empty ''. The adding of a path is done after the removing
+    * of path.
+    * The path add/remove ability enables the user to prepare an archive
+    * for extraction in a different path than the origin files are.
+    * If a file/dir is already in the archive it will only be added at the
+    * end of the archive. There is no update of the existing archived
+    * file/dir. However while extracting the archive, the last file will
+    * replace the first one. This results in a none optimization of the
+    * archive size.
+    * If a file/dir does not exist the file/dir is ignored. However an
+    * error text is send to PEAR error.
+    * If a file/dir is not readable the file/dir is ignored. However an
+    * error text is send to PEAR error.
+    *
+    * @param array      $p_filelist     An array of filenames and directory
+	*                                   names, or a single string with names
+	*                                   separated by a single blank space.
+    * @param string     $p_add_dir      A string which contains a path to be
+	*                                   added to the memorized path of each
+	*                                   element in the list.
+    * @param string     $p_remove_dir   A string which contains a path to be
+	*                                   removed from the memorized path of
+	*                                   each element in the list, when
+    *                                   relevant.
+    * @return                           true on success, false on error.
+    * @access public
+    */
+    function addModify($p_filelist, $p_add_dir, $p_remove_dir='')
+    {
+        $v_result = true;
+
+        if (!$this->_isArchive())
+            $v_result = $this->createModify($p_filelist, $p_add_dir,
+			                                $p_remove_dir);
+        else {
+            if (is_array($p_filelist))
+                $v_list = $p_filelist;
+            elseif (is_string($p_filelist))
+                $v_list = explode($this->_separator, $p_filelist);
+            else {
+                $this->_error('Invalid file list');
+                return false;
+            }
+
+            $v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir);
+        }
+
+        return $v_result;
+    }
+    // }}}
+
+    // {{{ addString()
+    /**
+    * This method add a single string as a file at the
+    * end of the existing archive. If the archive does not yet exists it
+    * is created.
+    *
+    * @param string     $p_filename     A string which contains the full
+	*                                   filename path that will be associated
+	*                                   with the string.
+    * @param string     $p_string       The content of the file added in
+	*                                   the archive.
+    * @return                           true on success, false on error.
+    * @access public
+    */
+    function addString($p_filename, $p_string)
+    {
+        $v_result = true;
+        
+        if (!$this->_isArchive()) {
+            if (!$this->_openWrite()) {
+                return false;
+            }
+            $this->_close();
+        }
+        
+        if (!$this->_openAppend())
+            return false;
+
+        // Need to check the get back to the temporary file ? ....
+        $v_result = $this->_addString($p_filename, $p_string);
+
+        $this->_writeFooter();
+
+        $this->_close();
+
+        return $v_result;
+    }
+    // }}}
+
+    // {{{ extractModify()
+    /**
+    * This method extract all the content of the archive in the directory
+    * indicated by $p_path. When relevant the memorized path of the
+    * files/dir can be modified by removing the $p_remove_path path at the
+    * beginning of the file/dir path.
+    * While extracting a file, if the directory path does not exists it is
+    * created.
+    * While extracting a file, if the file already exists it is replaced
+    * without looking for last modification date.
+    * While extracting a file, if the file already exists and is write
+    * protected, the extraction is aborted.
+    * While extracting a file, if a directory with the same name already
+    * exists, the extraction is aborted.
+    * While extracting a directory, if a file with the same name already
+    * exists, the extraction is aborted.
+    * While extracting a file/directory if the destination directory exist
+    * and is write protected, or does not exist but can not be created,
+    * the extraction is aborted.
+    * If after extraction an extracted file does not show the correct
+    * stored file size, the extraction is aborted.
+    * When the extraction is aborted, a PEAR error text is set and false
+    * is returned. However the result can be a partial extraction that may
+    * need to be manually cleaned.
+    *
+    * @param string $p_path         The path of the directory where the
+	*                               files/dir need to by extracted.
+    * @param string $p_remove_path  Part of the memorized path that can be
+	*                               removed if present at the beginning of
+	*                               the file/dir path.
+    * @return boolean               true on success, false on error.
+    * @access public
+    * @see extractList()
+    */
+    function extractModify($p_path, $p_remove_path)
+    {
+        $v_result = true;
+        $v_list_detail = array();
+
+        if ($v_result = $this->_openRead()) {
+            $v_result = $this->_extractList($p_path, $v_list_detail,
+			                                "complete", 0, $p_remove_path);
+            $this->_close();
+        }
+
+        return $v_result;
+    }
+    // }}}
+
+    // {{{ extractInString()
+    /**
+    * This method extract from the archive one file identified by $p_filename.
+    * The return value is a string with the file content, or NULL on error.
+    * @param string $p_filename     The path of the file to extract in a string.
+    * @return                       a string with the file content or NULL.
+    * @access public
+    */
+    function extractInString($p_filename)
+    {
+        if ($this->_openRead()) {
+            $v_result = $this->_extractInString($p_filename);
+            $this->_close();
+        } else {
+            $v_result = NULL;
+        }
+
+        return $v_result;
+    }
+    // }}}
+
+    // {{{ extractList()
+    /**
+    * This method extract from the archive only the files indicated in the
+    * $p_filelist. These files are extracted in the current directory or
+    * in the directory indicated by the optional $p_path parameter.
+    * If indicated the $p_remove_path can be used in the same way as it is
+    * used in extractModify() method.
+    * @param array  $p_filelist     An array of filenames and directory names,
+	*                               or a single string with names separated
+	*                               by a single blank space.
+    * @param string $p_path         The path of the directory where the
+	*                               files/dir need to by extracted.
+    * @param string $p_remove_path  Part of the memorized path that can be
+	*                               removed if present at the beginning of
+	*                               the file/dir path.
+    * @return                       true on success, false on error.
+    * @access public
+    * @see extractModify()
+    */
+    function extractList($p_filelist, $p_path='', $p_remove_path='')
+    {
+        $v_result = true;
+        $v_list_detail = array();
+
+        if (is_array($p_filelist))
+            $v_list = $p_filelist;
+        elseif (is_string($p_filelist))
+            $v_list = explode($this->_separator, $p_filelist);
+        else {
+            $this->_error('Invalid string list');
+            return false;
+        }
+
+        if ($v_result = $this->_openRead()) {
+            $v_result = $this->_extractList($p_path, $v_list_detail, "partial",
+			                                $v_list, $p_remove_path);
+            $this->_close();
+        }
+
+        return $v_result;
+    }
+    // }}}
+
+    // {{{ setAttribute()
+    /**
+    * This method set specific attributes of the archive. It uses a variable
+    * list of parameters, in the format attribute code + attribute values :
+    * $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
+    * @param mixed $argv            variable list of attributes and values
+    * @return                       true on success, false on error.
+    * @access public
+    */
+    function setAttribute()
+    {
+        $v_result = true;
+        
+        // ----- Get the number of variable list of arguments
+        if (($v_size = func_num_args()) == 0) {
+            return true;
+        }
+        
+        // ----- Get the arguments
+        $v_att_list = &func_get_args();
+
+        // ----- Read the attributes
+        $i=0;
+        while ($i<$v_size) {
+
+            // ----- Look for next option
+            switch ($v_att_list[$i]) {
+                // ----- Look for options that request a string value
+                case ARCHIVE_TAR_ATT_SEPARATOR :
+                    // ----- Check the number of parameters
+                    if (($i+1) >= $v_size) {
+                        $this->_error('Invalid number of parameters for '
+						              .'attribute ARCHIVE_TAR_ATT_SEPARATOR');
+                        return false;
+                    }
+
+                    // ----- Get the value
+                    $this->_separator = $v_att_list[$i+1];
+                    $i++;
+                break;
+
+                default :
+                    $this->_error('Unknow attribute code '.$v_att_list[$i].'');
+                    return false;
+            }
+
+            // ----- Next attribute
+            $i++;
+        }
+
+        return $v_result;
+    }
+    // }}}
+
+    // {{{ _error()
+    function _error($p_message)
+    {
+        // ----- To be completed
+        $this->raiseError($p_message);
+    }
+    // }}}
+
+    // {{{ _warning()
+    function _warning($p_message)
+    {
+        // ----- To be completed
+        $this->raiseError($p_message);
+    }
+    // }}}
+
+    // {{{ _isArchive()
+    function _isArchive($p_filename=NULL)
+    {
+        if ($p_filename == NULL) {
+            $p_filename = $this->_tarname;
+        }
+        clearstatcache();
+        return @is_file($p_filename);
+    }
+    // }}}
+
+    // {{{ _openWrite()
+    function _openWrite()
+    {
+        if ($this->_compress_type == 'gz')
+            $this->_file = @gzopen($this->_tarname, "wb9");
+        else if ($this->_compress_type == 'bz2')
+            $this->_file = @bzopen($this->_tarname, "wb");
+        else if ($this->_compress_type == 'none')
+            $this->_file = @fopen($this->_tarname, "wb");
+        else
+            $this->_error('Unknown or missing compression type ('
+			              .$this->_compress_type.')');
+
+        if ($this->_file == 0) {
+            $this->_error('Unable to open in write mode \''
+			              .$this->_tarname.'\'');
+            return false;
+        }
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _openRead()
+    function _openRead()
+    {
+        if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
+
+          // ----- Look if a local copy need to be done
+          if ($this->_temp_tarname == '') {
+              $this->_temp_tarname = uniqid('tar').'.tmp';
+              if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
+                $this->_error('Unable to open in read mode \''
+				              .$this->_tarname.'\'');
+                $this->_temp_tarname = '';
+                return false;
+              }
+              if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
+                $this->_error('Unable to open in write mode \''
+				              .$this->_temp_tarname.'\'');
+                $this->_temp_tarname = '';
+                return false;
+              }
+              while ($v_data = @fread($v_file_from, 1024))
+                  @fwrite($v_file_to, $v_data);
+              @fclose($v_file_from);
+              @fclose($v_file_to);
+          }
+
+          // ----- File to open if the local copy
+          $v_filename = $this->_temp_tarname;
+
+        } else
+          // ----- File to open if the normal Tar file
+          $v_filename = $this->_tarname;
+
+        if ($this->_compress_type == 'gz')
+            $this->_file = @gzopen($v_filename, "rb");
+        else if ($this->_compress_type == 'bz2')
+            $this->_file = @bzopen($v_filename, "rb");
+        else if ($this->_compress_type == 'none')
+            $this->_file = @fopen($v_filename, "rb");
+        else
+            $this->_error('Unknown or missing compression type ('
+			              .$this->_compress_type.')');
+
+        if ($this->_file == 0) {
+            $this->_error('Unable to open in read mode \''.$v_filename.'\'');
+            return false;
+        }
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _openReadWrite()
+    function _openReadWrite()
+    {
+        if ($this->_compress_type == 'gz')
+            $this->_file = @gzopen($this->_tarname, "r+b");
+        else if ($this->_compress_type == 'bz2')
+            $this->_file = @bzopen($this->_tarname, "r+b");
+        else if ($this->_compress_type == 'none')
+            $this->_file = @fopen($this->_tarname, "r+b");
+        else
+            $this->_error('Unknown or missing compression type ('
+			              .$this->_compress_type.')');
+
+        if ($this->_file == 0) {
+            $this->_error('Unable to open in read/write mode \''
+			              .$this->_tarname.'\'');
+            return false;
+        }
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _close()
+    function _close()
+    {
+        //if (isset($this->_file)) {
+        if (is_resource($this->_file)) {
+            if ($this->_compress_type == 'gz')
+                @gzclose($this->_file);
+            else if ($this->_compress_type == 'bz2')
+                @bzclose($this->_file);
+            else if ($this->_compress_type == 'none')
+                @fclose($this->_file);
+            else
+                $this->_error('Unknown or missing compression type ('
+				              .$this->_compress_type.')');
+
+            $this->_file = 0;
+        }
+
+        // ----- Look if a local copy need to be erase
+        // Note that it might be interesting to keep the url for a time : ToDo
+        if ($this->_temp_tarname != '') {
+            @unlink($this->_temp_tarname);
+            $this->_temp_tarname = '';
+        }
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _cleanFile()
+    function _cleanFile()
+    {
+        $this->_close();
+
+        // ----- Look for a local copy
+        if ($this->_temp_tarname != '') {
+            // ----- Remove the local copy but not the remote tarname
+            @unlink($this->_temp_tarname);
+            $this->_temp_tarname = '';
+        } else {
+            // ----- Remove the local tarname file
+            @unlink($this->_tarname);
+        }
+        $this->_tarname = '';
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _writeBlock()
+    function _writeBlock($p_binary_data, $p_len=null)
+    {
+      if (is_resource($this->_file)) {
+          if ($p_len === null) {
+              if ($this->_compress_type == 'gz')
+                  @gzputs($this->_file, $p_binary_data);
+              else if ($this->_compress_type == 'bz2')
+                  @bzwrite($this->_file, $p_binary_data);
+              else if ($this->_compress_type == 'none')
+                  @fputs($this->_file, $p_binary_data);
+              else
+                  $this->_error('Unknown or missing compression type ('
+				                .$this->_compress_type.')');
+          } else {
+              if ($this->_compress_type == 'gz')
+                  @gzputs($this->_file, $p_binary_data, $p_len);
+              else if ($this->_compress_type == 'bz2')
+                  @bzwrite($this->_file, $p_binary_data, $p_len);
+              else if ($this->_compress_type == 'none')
+                  @fputs($this->_file, $p_binary_data, $p_len);
+              else
+                  $this->_error('Unknown or missing compression type ('
+				                .$this->_compress_type.')');
+
+          }
+      }
+      return true;
+    }
+    // }}}
+
+    // {{{ _readBlock()
+    function _readBlock()
+    {
+      $v_block = null;
+      if (is_resource($this->_file)) {
+          if ($this->_compress_type == 'gz')
+              $v_block = @gzread($this->_file, 512);
+          else if ($this->_compress_type == 'bz2')
+              $v_block = @bzread($this->_file, 512);
+          else if ($this->_compress_type == 'none')
+              $v_block = @fread($this->_file, 512);
+          else
+              $this->_error('Unknown or missing compression type ('
+			                .$this->_compress_type.')');
+      }
+      return $v_block;
+    }
+    // }}}
+
+    // {{{ _jumpBlock()
+    function _jumpBlock($p_len=null)
+    {
+      if (is_resource($this->_file)) {
+          if ($p_len === null)
+              $p_len = 1;
+
+          if ($this->_compress_type == 'gz') {
+              @gzseek($this->_file, @gztell($this->_file)+($p_len*512));
+          }
+          else if ($this->_compress_type == 'bz2') {
+              // ----- Replace missing bztell() and bzseek()
+              for ($i=0; $i<$p_len; $i++)
+                  $this->_readBlock();
+          } else if ($this->_compress_type == 'none')
+              @fseek($this->_file, @ftell($this->_file)+($p_len*512));
+          else
+              $this->_error('Unknown or missing compression type ('
+			                .$this->_compress_type.')');
+
+      }
+      return true;
+    }
+    // }}}
+
+    // {{{ _writeFooter()
+    function _writeFooter()
+    {
+      if (is_resource($this->_file)) {
+          // ----- Write the last 0 filled block for end of archive
+          $v_binary_data = pack("a512", '');
+          $this->_writeBlock($v_binary_data);
+      }
+      return true;
+    }
+    // }}}
+
+    // {{{ _addList()
+    function _addList($p_list, $p_add_dir, $p_remove_dir)
+    {
+      $v_result=true;
+      $v_header = array();
+
+      // ----- Remove potential windows directory separator
+      $p_add_dir = $this->_translateWinPath($p_add_dir);
+      $p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
+
+      if (!$this->_file) {
+          $this->_error('Invalid file descriptor');
+          return false;
+      }
+
+      if (sizeof($p_list) == 0)
+          return true;
+
+      foreach ($p_list as $v_filename) {
+          if (!$v_result) {
+              break;
+          }
+
+        // ----- Skip the current tar name
+        if ($v_filename == $this->_tarname)
+            continue;
+
+        if ($v_filename == '')
+            continue;
+
+        if (!file_exists($v_filename)) {
+            $this->_warning("File '$v_filename' does not exist");
+            continue;
+        }
+
+        // ----- Add the file or directory header
+        if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
+            return false;
+
+        if (@is_dir($v_filename)) {
+            if (!($p_hdir = opendir($v_filename))) {
+                $this->_warning("Directory '$v_filename' can not be read");
+                continue;
+            }
+            while (false !== ($p_hitem = readdir($p_hdir))) {
+                if (($p_hitem != '.') && ($p_hitem != '..')) {
+                    if ($v_filename != ".")
+                        $p_temp_list[0] = $v_filename.'/'.$p_hitem;
+                    else
+                        $p_temp_list[0] = $p_hitem;
+
+                    $v_result = $this->_addList($p_temp_list,
+					                            $p_add_dir,
+												$p_remove_dir);
+                }
+            }
+
+            unset($p_temp_list);
+            unset($p_hdir);
+            unset($p_hitem);
+        }
+      }
+
+      return $v_result;
+    }
+    // }}}
+
+    // {{{ _addFile()
+    function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir)
+    {
+      if (!$this->_file) {
+          $this->_error('Invalid file descriptor');
+          return false;
+      }
+
+      if ($p_filename == '') {
+          $this->_error('Invalid file name');
+          return false;
+      }
+
+      // ----- Calculate the stored filename
+      $p_filename = $this->_translateWinPath($p_filename, false);;
+      $v_stored_filename = $p_filename;
+      if (strcmp($p_filename, $p_remove_dir) == 0) {
+          return true;
+      }
+      if ($p_remove_dir != '') {
+          if (substr($p_remove_dir, -1) != '/')
+              $p_remove_dir .= '/';
+
+          if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
+              $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
+      }
+      $v_stored_filename = $this->_translateWinPath($v_stored_filename);
+      if ($p_add_dir != '') {
+          if (substr($p_add_dir, -1) == '/')
+              $v_stored_filename = $p_add_dir.$v_stored_filename;
+          else
+              $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
+      }
+
+      $v_stored_filename = $this->_pathReduction($v_stored_filename);
+
+      if ($this->_isArchive($p_filename)) {
+          if (($v_file = @fopen($p_filename, "rb")) == 0) {
+              $this->_warning("Unable to open file '".$p_filename
+			                  ."' in binary read mode");
+              return true;
+          }
+
+          if (!$this->_writeHeader($p_filename, $v_stored_filename))
+              return false;
+
+          while (($v_buffer = fread($v_file, 512)) != '') {
+              $v_binary_data = pack("a512", "$v_buffer");
+              $this->_writeBlock($v_binary_data);
+          }
+
+          fclose($v_file);
+
+      } else {
+          // ----- Only header for dir
+          if (!$this->_writeHeader($p_filename, $v_stored_filename))
+              return false;
+      }
+
+      return true;
+    }
+    // }}}
+
+    // {{{ _addString()
+    function _addString($p_filename, $p_string)
+    {
+      if (!$this->_file) {
+          $this->_error('Invalid file descriptor');
+          return false;
+      }
+
+      if ($p_filename == '') {
+          $this->_error('Invalid file name');
+          return false;
+      }
+
+      // ----- Calculate the stored filename
+      $p_filename = $this->_translateWinPath($p_filename, false);;
+
+      if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
+	                                0, 0, "", 0, 0))
+          return false;
+
+      $i=0;
+      while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') {
+          $v_binary_data = pack("a512", $v_buffer);
+          $this->_writeBlock($v_binary_data);
+      }
+
+      return true;
+    }
+    // }}}
+
+    // {{{ _writeHeader()
+    function _writeHeader($p_filename, $p_stored_filename)
+    {
+        if ($p_stored_filename == '')
+            $p_stored_filename = $p_filename;
+        $v_reduce_filename = $this->_pathReduction($p_stored_filename);
+
+        if (strlen($v_reduce_filename) > 99) {
+          if (!$this->_writeLongHeader($v_reduce_filename))
+            return false;
+        }
+
+        $v_info = stat($p_filename);
+        $v_uid = sprintf("%6s ", DecOct($v_info[4]));
+        $v_gid = sprintf("%6s ", DecOct($v_info[5]));
+        $v_perms = sprintf("%6s ", DecOct(fileperms($p_filename)));
+
+        $v_mtime = sprintf("%11s", DecOct(filemtime($p_filename)));
+
+        if (@is_dir($p_filename)) {
+          $v_typeflag = "5";
+          $v_size = sprintf("%11s ", DecOct(0));
+        } else {
+          $v_typeflag = '';
+          clearstatcache();
+          $v_size = sprintf("%11s ", DecOct(filesize($p_filename)));
+        }
+
+        $v_linkname = '';
+
+        $v_magic = '';
+
+        $v_version = '';
+
+        $v_uname = '';
+
+        $v_gname = '';
+
+        $v_devmajor = '';
+
+        $v_devminor = '';
+
+        $v_prefix = '';
+
+        $v_binary_data_first = pack("a100a8a8a8a12A12",
+		                            $v_reduce_filename, $v_perms, $v_uid,
+									$v_gid, $v_size, $v_mtime);
+        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
+		                           $v_typeflag, $v_linkname, $v_magic,
+								   $v_version, $v_uname, $v_gname,
+								   $v_devmajor, $v_devminor, $v_prefix, '');
+
+        // ----- Calculate the checksum
+        $v_checksum = 0;
+        // ..... First part of the header
+        for ($i=0; $i<148; $i++)
+            $v_checksum += ord(substr($v_binary_data_first,$i,1));
+        // ..... Ignore the checksum value and replace it by ' ' (space)
+        for ($i=148; $i<156; $i++)
+            $v_checksum += ord(' ');
+        // ..... Last part of the header
+        for ($i=156, $j=0; $i<512; $i++, $j++)
+            $v_checksum += ord(substr($v_binary_data_last,$j,1));
+
+        // ----- Write the first 148 bytes of the header in the archive
+        $this->_writeBlock($v_binary_data_first, 148);
+
+        // ----- Write the calculated checksum
+        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
+        $v_binary_data = pack("a8", $v_checksum);
+        $this->_writeBlock($v_binary_data, 8);
+
+        // ----- Write the last 356 bytes of the header in the archive
+        $this->_writeBlock($v_binary_data_last, 356);
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _writeHeaderBlock()
+    function _writeHeaderBlock($p_filename, $p_size, $p_mtime=0, $p_perms=0,
+	                           $p_type='', $p_uid=0, $p_gid=0)
+    {
+        $p_filename = $this->_pathReduction($p_filename);
+
+        if (strlen($p_filename) > 99) {
+          if (!$this->_writeLongHeader($p_filename))
+            return false;
+        }
+
+        if ($p_type == "5") {
+          $v_size = sprintf("%11s ", DecOct(0));
+        } else {
+          $v_size = sprintf("%11s ", DecOct($p_size));
+        }
+
+        $v_uid = sprintf("%6s ", DecOct($p_uid));
+        $v_gid = sprintf("%6s ", DecOct($p_gid));
+        $v_perms = sprintf("%6s ", DecOct($p_perms));
+
+        $v_mtime = sprintf("%11s", DecOct($p_mtime));
+
+        $v_linkname = '';
+
+        $v_magic = '';
+
+        $v_version = '';
+
+        $v_uname = '';
+
+        $v_gname = '';
+
+        $v_devmajor = '';
+
+        $v_devminor = '';
+
+        $v_prefix = '';
+
+        $v_binary_data_first = pack("a100a8a8a8a12A12",
+		                            $p_filename, $v_perms, $v_uid, $v_gid,
+									$v_size, $v_mtime);
+        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
+		                           $p_type, $v_linkname, $v_magic,
+								   $v_version, $v_uname, $v_gname,
+								   $v_devmajor, $v_devminor, $v_prefix, '');
+
+        // ----- Calculate the checksum
+        $v_checksum = 0;
+        // ..... First part of the header
+        for ($i=0; $i<148; $i++)
+            $v_checksum += ord(substr($v_binary_data_first,$i,1));
+        // ..... Ignore the checksum value and replace it by ' ' (space)
+        for ($i=148; $i<156; $i++)
+            $v_checksum += ord(' ');
+        // ..... Last part of the header
+        for ($i=156, $j=0; $i<512; $i++, $j++)
+            $v_checksum += ord(substr($v_binary_data_last,$j,1));
+
+        // ----- Write the first 148 bytes of the header in the archive
+        $this->_writeBlock($v_binary_data_first, 148);
+
+        // ----- Write the calculated checksum
+        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
+        $v_binary_data = pack("a8", $v_checksum);
+        $this->_writeBlock($v_binary_data, 8);
+
+        // ----- Write the last 356 bytes of the header in the archive
+        $this->_writeBlock($v_binary_data_last, 356);
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _writeLongHeader()
+    function _writeLongHeader($p_filename)
+    {
+        $v_size = sprintf("%11s ", DecOct(strlen($p_filename)));
+
+        $v_typeflag = 'L';
+
+        $v_linkname = '';
+
+        $v_magic = '';
+
+        $v_version = '';
+
+        $v_uname = '';
+
+        $v_gname = '';
+
+        $v_devmajor = '';
+
+        $v_devminor = '';
+
+        $v_prefix = '';
+
+        $v_binary_data_first = pack("a100a8a8a8a12A12",
+		                            '././@LongLink', 0, 0, 0, $v_size, 0);
+        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
+		                           $v_typeflag, $v_linkname, $v_magic,
+								   $v_version, $v_uname, $v_gname,
+								   $v_devmajor, $v_devminor, $v_prefix, '');
+
+        // ----- Calculate the checksum
+        $v_checksum = 0;
+        // ..... First part of the header
+        for ($i=0; $i<148; $i++)
+            $v_checksum += ord(substr($v_binary_data_first,$i,1));
+        // ..... Ignore the checksum value and replace it by ' ' (space)
+        for ($i=148; $i<156; $i++)
+            $v_checksum += ord(' ');
+        // ..... Last part of the header
+        for ($i=156, $j=0; $i<512; $i++, $j++)
+            $v_checksum += ord(substr($v_binary_data_last,$j,1));
+
+        // ----- Write the first 148 bytes of the header in the archive
+        $this->_writeBlock($v_binary_data_first, 148);
+
+        // ----- Write the calculated checksum
+        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
+        $v_binary_data = pack("a8", $v_checksum);
+        $this->_writeBlock($v_binary_data, 8);
+
+        // ----- Write the last 356 bytes of the header in the archive
+        $this->_writeBlock($v_binary_data_last, 356);
+
+        // ----- Write the filename as content of the block
+        $i=0;
+        while (($v_buffer = substr($p_filename, (($i++)*512), 512)) != '') {
+            $v_binary_data = pack("a512", "$v_buffer");
+            $this->_writeBlock($v_binary_data);
+        }
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _readHeader()
+    function _readHeader($v_binary_data, &$v_header)
+    {
+        if (strlen($v_binary_data)==0) {
+            $v_header['filename'] = '';
+            return true;
+        }
+
+        if (strlen($v_binary_data) != 512) {
+            $v_header['filename'] = '';
+            $this->_error('Invalid block size : '.strlen($v_binary_data));
+            return false;
+        }
+
+        // ----- Calculate the checksum
+        $v_checksum = 0;
+        // ..... First part of the header
+        for ($i=0; $i<148; $i++)
+            $v_checksum+=ord(substr($v_binary_data,$i,1));
+        // ..... Ignore the checksum value and replace it by ' ' (space)
+        for ($i=148; $i<156; $i++)
+            $v_checksum += ord(' ');
+        // ..... Last part of the header
+        for ($i=156; $i<512; $i++)
+           $v_checksum+=ord(substr($v_binary_data,$i,1));
+
+        $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
+		                 ."a8checksum/a1typeflag/a100link/a6magic/a2version/"
+						 ."a32uname/a32gname/a8devmajor/a8devminor",
+						 $v_binary_data);
+
+        // ----- Extract the checksum
+        $v_header['checksum'] = OctDec(trim($v_data['checksum']));
+        if ($v_header['checksum'] != $v_checksum) {
+            $v_header['filename'] = '';
+
+            // ----- Look for last block (empty block)
+            if (($v_checksum == 256) && ($v_header['checksum'] == 0))
+                return true;
+
+            $this->_error('Invalid checksum for file "'.$v_data['filename']
+			              .'" : '.$v_checksum.' calculated, '
+						  .$v_header['checksum'].' expected');
+            return false;
+        }
+
+        // ----- Extract the properties
+        $v_header['filename'] = trim($v_data['filename']);
+        $v_header['mode'] = OctDec(trim($v_data['mode']));
+        $v_header['uid'] = OctDec(trim($v_data['uid']));
+        $v_header['gid'] = OctDec(trim($v_data['gid']));
+        $v_header['size'] = OctDec(trim($v_data['size']));
+        $v_header['mtime'] = OctDec(trim($v_data['mtime']));
+        if (($v_header['typeflag'] = $v_data['typeflag']) == "5") {
+          $v_header['size'] = 0;
+        }
+        /* ----- All these fields are removed form the header because
+		they do not carry interesting info
+        $v_header[link] = trim($v_data[link]);
+        $v_header[magic] = trim($v_data[magic]);
+        $v_header[version] = trim($v_data[version]);
+        $v_header[uname] = trim($v_data[uname]);
+        $v_header[gname] = trim($v_data[gname]);
+        $v_header[devmajor] = trim($v_data[devmajor]);
+        $v_header[devminor] = trim($v_data[devminor]);
+        */
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _readLongHeader()
+    function _readLongHeader(&$v_header)
+    {
+      $v_filename = '';
+      $n = floor($v_header['size']/512);
+      for ($i=0; $i<$n; $i++) {
+        $v_content = $this->_readBlock();
+        $v_filename .= $v_content;
+      }
+      if (($v_header['size'] % 512) != 0) {
+        $v_content = $this->_readBlock();
+        $v_filename .= $v_content;
+      }
+
+      // ----- Read the next header
+      $v_binary_data = $this->_readBlock();
+
+      if (!$this->_readHeader($v_binary_data, $v_header))
+        return false;
+
+      $v_header['filename'] = $v_filename;
+
+      return true;
+    }
+    // }}}
+
+    // {{{ _extractInString()
+    /**
+    * This method extract from the archive one file identified by $p_filename.
+    * The return value is a string with the file content, or NULL on error.
+    * @param string $p_filename     The path of the file to extract in a string.
+    * @return                       a string with the file content or NULL.
+    * @access private
+    */
+    function _extractInString($p_filename)
+    {
+        $v_result_str = "";
+
+        While (strlen($v_binary_data = $this->_readBlock()) != 0)
+        {
+          if (!$this->_readHeader($v_binary_data, $v_header))
+            return NULL;
+
+          if ($v_header['filename'] == '')
+            continue;
+
+          // ----- Look for long filename
+          if ($v_header['typeflag'] == 'L') {
+            if (!$this->_readLongHeader($v_header))
+              return NULL;
+          }
+
+          if ($v_header['filename'] == $p_filename) {
+              if ($v_header['typeflag'] == "5") {
+                  $this->_error('Unable to extract in string a directory '
+				                .'entry {'.$v_header['filename'].'}');
+                  return NULL;
+              } else {
+                  $n = floor($v_header['size']/512);
+                  for ($i=0; $i<$n; $i++) {
+                      $v_result_str .= $this->_readBlock();
+                  }
+                  if (($v_header['size'] % 512) != 0) {
+                      $v_content = $this->_readBlock();
+                      $v_result_str .= substr($v_content, 0,
+					                          ($v_header['size'] % 512));
+                  }
+                  return $v_result_str;
+              }
+          } else {
+              $this->_jumpBlock(ceil(($v_header['size']/512)));
+          }
+        }
+
+        return NULL;
+    }
+    // }}}
+
+    // {{{ _extractList()
+    function _extractList($p_path, &$p_list_detail, $p_mode,
+	                      $p_file_list, $p_remove_path)
+    {
+    $v_result=true;
+    $v_nb = 0;
+    $v_extract_all = true;
+    $v_listing = false;
+
+    $p_path = $this->_translateWinPath($p_path, false);
+    if ($p_path == '' || (substr($p_path, 0, 1) != '/'
+	    && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
+      $p_path = "./".$p_path;
+    }
+    $p_remove_path = $this->_translateWinPath($p_remove_path);
+
+    // ----- Look for path to remove format (should end by /)
+    if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
+      $p_remove_path .= '/';
+    $p_remove_path_size = strlen($p_remove_path);
+
+    switch ($p_mode) {
+      case "complete" :
+        $v_extract_all = TRUE;
+        $v_listing = FALSE;
+      break;
+      case "partial" :
+          $v_extract_all = FALSE;
+          $v_listing = FALSE;
+      break;
+      case "list" :
+          $v_extract_all = FALSE;
+          $v_listing = TRUE;
+      break;
+      default :
+        $this->_error('Invalid extract mode ('.$p_mode.')');
+        return false;
+    }
+
+    clearstatcache();
+
+    while (strlen($v_binary_data = $this->_readBlock()) != 0)
+    {
+      $v_extract_file = FALSE;
+      $v_extraction_stopped = 0;
+
+      if (!$this->_readHeader($v_binary_data, $v_header))
+        return false;
+
+      if ($v_header['filename'] == '') {
+        continue;
+      }
+
+      // ----- Look for long filename
+      if ($v_header['typeflag'] == 'L') {
+        if (!$this->_readLongHeader($v_header))
+          return false;
+      }
+
+      if ((!$v_extract_all) && (is_array($p_file_list))) {
+        // ----- By default no unzip if the file is not found
+        $v_extract_file = false;
+
+        for ($i=0; $i<sizeof($p_file_list); $i++) {
+          // ----- Look if it is a directory
+          if (substr($p_file_list[$i], -1) == '/') {
+            // ----- Look if the directory is in the filename path
+            if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
+			    && (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
+				    == $p_file_list[$i])) {
+              $v_extract_file = TRUE;
+              break;
+            }
+          }
+
+          // ----- It is a file, so compare the file names
+          elseif ($p_file_list[$i] == $v_header['filename']) {
+            $v_extract_file = TRUE;
+            break;
+          }
+        }
+      } else {
+        $v_extract_file = TRUE;
+      }
+
+      // ----- Look if this file need to be extracted
+      if (($v_extract_file) && (!$v_listing))
+      {
+        if (($p_remove_path != '')
+            && (substr($v_header['filename'], 0, $p_remove_path_size)
+			    == $p_remove_path))
+          $v_header['filename'] = substr($v_header['filename'],
+		                                 $p_remove_path_size);
+        if (($p_path != './') && ($p_path != '/')) {
+          while (substr($p_path, -1) == '/')
+            $p_path = substr($p_path, 0, strlen($p_path)-1);
+
+          if (substr($v_header['filename'], 0, 1) == '/')
+              $v_header['filename'] = $p_path.$v_header['filename'];
+          else
+            $v_header['filename'] = $p_path.'/'.$v_header['filename'];
+        }
+        if (file_exists($v_header['filename'])) {
+          if (   (@is_dir($v_header['filename']))
+		      && ($v_header['typeflag'] == '')) {
+            $this->_error('File '.$v_header['filename']
+			              .' already exists as a directory');
+            return false;
+          }
+          if (   ($this->_isArchive($v_header['filename']))
+		      && ($v_header['typeflag'] == "5")) {
+            $this->_error('Directory '.$v_header['filename']
+			              .' already exists as a file');
+            return false;
+          }
+          if (!is_writeable($v_header['filename'])) {
+            $this->_error('File '.$v_header['filename']
+			              .' already exists and is write protected');
+            return false;
+          }
+          if (filemtime($v_header['filename']) > $v_header['mtime']) {
+            // To be completed : An error or silent no replace ?
+          }
+        }
+
+        // ----- Check the directory availability and create it if necessary
+        elseif (($v_result
+		         = $this->_dirCheck(($v_header['typeflag'] == "5"
+				                    ?$v_header['filename']
+									:dirname($v_header['filename'])))) != 1) {
+            $this->_error('Unable to create path for '.$v_header['filename']);
+            return false;
+        }
+
+        if ($v_extract_file) {
+          if ($v_header['typeflag'] == "5") {
+            if (!@file_exists($v_header['filename'])) {
+                if (!@mkdir($v_header['filename'], 0777)) {
+                    $this->_error('Unable to create directory {'
+					              .$v_header['filename'].'}');
+                    return false;
+                }
+            }
+          } else {
+              if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
+                  $this->_error('Error while opening {'.$v_header['filename']
+				                .'} in write binary mode');
+                  return false;
+              } else {
+                  $n = floor($v_header['size']/512);
+                  for ($i=0; $i<$n; $i++) {
+                      $v_content = $this->_readBlock();
+                      fwrite($v_dest_file, $v_content, 512);
+                  }
+            if (($v_header['size'] % 512) != 0) {
+              $v_content = $this->_readBlock();
+              fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
+            }
+
+            @fclose($v_dest_file);
+
+            // ----- Change the file mode, mtime
+            @touch($v_header['filename'], $v_header['mtime']);
+            // To be completed
+            //chmod($v_header[filename], DecOct($v_header[mode]));
+          }
+
+          // ----- Check the file size
+          clearstatcache();
+          if (filesize($v_header['filename']) != $v_header['size']) {
+              $this->_error('Extracted file '.$v_header['filename']
+			                .' does not have the correct file size \''
+							.filesize($v_header['filename'])
+							.'\' ('.$v_header['size']
+							.' expected). Archive may be corrupted.');
+              return false;
+          }
+          }
+        } else {
+          $this->_jumpBlock(ceil(($v_header['size']/512)));
+        }
+      } else {
+          $this->_jumpBlock(ceil(($v_header['size']/512)));
+      }
+
+      /* TBC : Seems to be unused ...
+      if ($this->_compress)
+        $v_end_of_file = @gzeof($this->_file);
+      else
+        $v_end_of_file = @feof($this->_file);
+        */
+
+      if ($v_listing || $v_extract_file || $v_extraction_stopped) {
+        // ----- Log extracted files
+        if (($v_file_dir = dirname($v_header['filename']))
+		    == $v_header['filename'])
+          $v_file_dir = '';
+        if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
+          $v_file_dir = '/';
+
+        $p_list_detail[$v_nb++] = $v_header;
+      }
+    }
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _openAppend()
+    function _openAppend()
+    {
+        if (filesize($this->_tarname) == 0)
+          return $this->_openWrite();
+          
+        if ($this->_compress) {
+            $this->_close();
+
+            if (!@rename($this->_tarname, $this->_tarname.".tmp")) {
+                $this->_error('Error while renaming \''.$this->_tarname
+				              .'\' to temporary file \''.$this->_tarname
+							  .'.tmp\'');
+                return false;
+            }
+
+            if ($this->_compress_type == 'gz')
+                $v_temp_tar = @gzopen($this->_tarname.".tmp", "rb");
+            elseif ($this->_compress_type == 'bz2')
+                $v_temp_tar = @bzopen($this->_tarname.".tmp", "rb");
+                
+            if ($v_temp_tar == 0) {
+                $this->_error('Unable to open file \''.$this->_tarname
+				              .'.tmp\' in binary read mode');
+                @rename($this->_tarname.".tmp", $this->_tarname);
+                return false;
+            }
+
+            if (!$this->_openWrite()) {
+                @rename($this->_tarname.".tmp", $this->_tarname);
+                return false;
+            }
+
+            if ($this->_compress_type == 'gz') {
+                $v_buffer = @gzread($v_temp_tar, 512);
+
+                // ----- Read the following blocks but not the last one
+                if (!@gzeof($v_temp_tar)) {
+                    do{
+                        $v_binary_data = pack("a512", $v_buffer);
+                        $this->_writeBlock($v_binary_data);
+                        $v_buffer = @gzread($v_temp_tar, 512);
+
+                    } while (!@gzeof($v_temp_tar));
+                }
+
+                @gzclose($v_temp_tar);
+            }
+            elseif ($this->_compress_type == 'bz2') {
+                $v_buffered_lines   = array();
+                $v_buffered_lines[] = @bzread($v_temp_tar, 512);
+
+                // ----- Read the following blocks but not the last one
+                while (strlen($v_buffered_lines[]
+				              = @bzread($v_temp_tar, 512)) > 0) {
+                    $v_binary_data = pack("a512",
+					                      array_shift($v_buffered_lines));
+                    $this->_writeBlock($v_binary_data);
+                }
+
+                @bzclose($v_temp_tar);
+            }
+
+            if (!@unlink($this->_tarname.".tmp")) {
+                $this->_error('Error while deleting temporary file \''
+				              .$this->_tarname.'.tmp\'');
+            }
+
+        } else {
+            // ----- For not compressed tar, just add files before the last
+			//       512 bytes block
+            if (!$this->_openReadWrite())
+               return false;
+
+            clearstatcache();
+            $v_size = filesize($this->_tarname);
+            fseek($this->_file, $v_size-512);
+        }
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _append()
+    function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
+    {
+        if (!$this->_openAppend())
+            return false;
+            
+        if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
+           $this->_writeFooter();
+
+        $this->_close();
+
+        return true;
+    }
+    // }}}
+
+    // {{{ _dirCheck()
+
+    /**
+     * Check if a directory exists and create it (including parent
+     * dirs) if not.
+     *
+     * @param string $p_dir directory to check
+     *
+     * @return bool TRUE if the directory exists or was created
+     */
+    function _dirCheck($p_dir)
+    {
+        if ((@is_dir($p_dir)) || ($p_dir == ''))
+            return true;
+
+        $p_parent_dir = dirname($p_dir);
+
+        if (($p_parent_dir != $p_dir) &&
+            ($p_parent_dir != '') &&
+            (!$this->_dirCheck($p_parent_dir)))
+             return false;
+
+        if (!@mkdir($p_dir, 0777)) {
+            $this->_error("Unable to create directory '$p_dir'");
+            return false;
+        }
+
+        return true;
+    }
+
+    // }}}
+
+    // {{{ _pathReduction()
+
+    /**
+     * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar", 
+     * rand emove double slashes.
+     *
+     * @param string $p_dir path to reduce
+     *
+     * @return string reduced path
+     *
+     * @access private
+     *
+     */
+    function _pathReduction($p_dir)
+    {
+        $v_result = '';
+
+        // ----- Look for not empty path
+        if ($p_dir != '') {
+            // ----- Explode path by directory names
+            $v_list = explode('/', $p_dir);
+
+            // ----- Study directories from last to first
+            for ($i=sizeof($v_list)-1; $i>=0; $i--) {
+                // ----- Look for current path
+                if ($v_list[$i] == ".") {
+                    // ----- Ignore this directory
+                    // Should be the first $i=0, but no check is done
+                }
+                else if ($v_list[$i] == "..") {
+                    // ----- Ignore it and ignore the $i-1
+                    $i--;
+                }
+                else if (   ($v_list[$i] == '')
+				         && ($i!=(sizeof($v_list)-1))
+						 && ($i!=0)) {
+                    // ----- Ignore only the double '//' in path,
+                    // but not the first and last /
+                } else {
+                    $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'
+					            .$v_result:'');
+                }
+            }
+        }
+        $v_result = strtr($v_result, '\\', '/');
+        return $v_result;
+    }
+
+    // }}}
+
+    // {{{ _translateWinPath()
+    function _translateWinPath($p_path, $p_remove_disk_letter=true)
+    {
+      if (OS_WINDOWS) {
+          // ----- Look for potential disk letter
+          if (   ($p_remove_disk_letter)
+		      && (($v_position = strpos($p_path, ':')) != false)) {
+              $p_path = substr($p_path, $v_position+1);
+          }
+          // ----- Change potential windows directory separator
+          if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
+              $p_path = strtr($p_path, '\\', '/');
+          }
+      }
+      return $p_path;
+    }
+    // }}}
+
+}
+?>
Index: /branches/mobile/data/module/PEAR.php
===================================================================
--- /branches/mobile/data/module/PEAR.php	(revision 6098)
+++ /branches/mobile/data/module/PEAR.php	(revision 6098)
@@ -0,0 +1,1095 @@
+<?php
+/**
+ * PEAR, the PHP Extension and Application Repository
+ *
+ * PEAR class and PEAR_Error 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   pear
+ * @package    PEAR
+ * @author     Sterling Hughes <sterling@php.net>
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V.Cox <cox@idecnet.com>
+ * @author     Greg Beaver <cellog@php.net>
+ * @copyright  1997-2006 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/PEAR
+ * @since      File available since Release 0.1
+ */
+
+/**#@+
+ * ERROR constants
+ */
+define('PEAR_ERROR_RETURN',     1);
+define('PEAR_ERROR_PRINT',      2);
+define('PEAR_ERROR_TRIGGER',    4);
+define('PEAR_ERROR_DIE',        8);
+define('PEAR_ERROR_CALLBACK',  16);
+/**
+ * WARNING: obsolete
+ * @deprecated
+ */
+define('PEAR_ERROR_EXCEPTION', 32);
+/**#@-*/
+define('PEAR_ZE2', (function_exists('version_compare') &&
+                    version_compare(zend_version(), "2-dev", "ge")));
+
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+    define('OS_WINDOWS', true);
+    define('OS_UNIX',    false);
+    define('PEAR_OS',    'Windows');
+} else {
+    define('OS_WINDOWS', false);
+    define('OS_UNIX',    true);
+    define('PEAR_OS',    'Unix'); // blatant assumption
+}
+
+// instant backwards compatibility
+if (!defined('PATH_SEPARATOR')) {
+    if (OS_WINDOWS) {
+        define('PATH_SEPARATOR', ';');
+    } else {
+        define('PATH_SEPARATOR', ':');
+    }
+}
+
+$GLOBALS['_PEAR_default_error_mode']     = PEAR_ERROR_RETURN;
+$GLOBALS['_PEAR_default_error_options']  = E_USER_NOTICE;
+$GLOBALS['_PEAR_destructor_object_list'] = array();
+$GLOBALS['_PEAR_shutdown_funcs']         = array();
+$GLOBALS['_PEAR_error_handler_stack']    = array();
+
+@ini_set('track_errors', true);
+
+/**
+ * Base class for other PEAR classes.  Provides rudimentary
+ * emulation of destructors.
+ *
+ * If you want a destructor in your class, inherit PEAR and make a
+ * destructor method called _yourclassname (same name as the
+ * constructor, but with a "_" prefix).  Also, in your constructor you
+ * have to call the PEAR constructor: $this->PEAR();.
+ * The destructor method will be called without parameters.  Note that
+ * at in some SAPI implementations (such as Apache), any output during
+ * the request shutdown (in which destructors are called) seems to be
+ * discarded.  If you need to get any debug information from your
+ * destructor, use error_log(), syslog() or something similar.
+ *
+ * IMPORTANT! To use the emulated destructors you need to create the
+ * objects by reference: $obj =& new PEAR_child;
+ *
+ * @category   pear
+ * @package    PEAR
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Greg Beaver <cellog@php.net>
+ * @copyright  1997-2006 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 1.4.6
+ * @link       http://pear.php.net/package/PEAR
+ * @see        PEAR_Error
+ * @since      Class available since PHP 4.0.2
+ * @link        http://pear.php.net/manual/en/core.pear.php#core.pear.pear
+ */
+class PEAR
+{
+    // {{{ properties
+
+    /**
+     * Whether to enable internal debug messages.
+     *
+     * @var     bool
+     * @access  private
+     */
+    var $_debug = false;
+
+    /**
+     * Default error mode for this object.
+     *
+     * @var     int
+     * @access  private
+     */
+    var $_default_error_mode = null;
+
+    /**
+     * Default error options used for this object when error mode
+     * is PEAR_ERROR_TRIGGER.
+     *
+     * @var     int
+     * @access  private
+     */
+    var $_default_error_options = null;
+
+    /**
+     * Default error handler (callback) for this object, if error mode is
+     * PEAR_ERROR_CALLBACK.
+     *
+     * @var     string
+     * @access  private
+     */
+    var $_default_error_handler = '';
+
+    /**
+     * Which class to use for error objects.
+     *
+     * @var     string
+     * @access  private
+     */
+    var $_error_class = 'PEAR_Error';
+
+    /**
+     * An array of expected errors.
+     *
+     * @var     array
+     * @access  private
+     */
+    var $_expected_errors = array();
+
+    // }}}
+
+    // {{{ constructor
+
+    /**
+     * Constructor.  Registers this object in
+     * $_PEAR_destructor_object_list for destructor emulation if a
+     * destructor object exists.
+     *
+     * @param string $error_class  (optional) which class to use for
+     *        error objects, defaults to PEAR_Error.
+     * @access public
+     * @return void
+     */
+    function PEAR($error_class = null)
+    {
+        $classname = strtolower(get_class($this));
+        if ($this->_debug) {
+            print "PEAR constructor called, class=$classname\n";
+        }
+        if ($error_class !== null) {
+            $this->_error_class = $error_class;
+        }
+        while ($classname && strcasecmp($classname, "pear")) {
+            $destructor = "_$classname";
+            if (method_exists($this, $destructor)) {
+                global $_PEAR_destructor_object_list;
+                $_PEAR_destructor_object_list[] = &$this;
+                if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
+                    register_shutdown_function("_PEAR_call_destructors");
+                    $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
+                }
+                break;
+            } else {
+                $classname = get_parent_class($classname);
+            }
+        }
+    }
+
+    // }}}
+    // {{{ destructor
+
+    /**
+     * Destructor (the emulated type of...).  Does nothing right now,
+     * but is included for forward compatibility, so subclass
+     * destructors should always call it.
+     *
+     * See the note in the class desciption about output from
+     * destructors.
+     *
+     * @access public
+     * @return void
+     */
+    function _PEAR() {
+        if ($this->_debug) {
+            printf("PEAR destructor called, class=%s\n", strtolower(get_class($this)));
+        }
+    }
+
+    // }}}
+    // {{{ getStaticProperty()
+
+    /**
+    * If you have a class that's mostly/entirely static, and you need static
+    * properties, you can use this method to simulate them. Eg. in your method(s)
+    * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
+    * You MUST use a reference, or they will not persist!
+    *
+    * @access public
+    * @param  string $class  The calling classname, to prevent clashes
+    * @param  string $var    The variable to retrieve.
+    * @return mixed   A reference to the variable. If not set it will be
+    *                 auto initialised to NULL.
+    */
+    function &getStaticProperty($class, $var)
+    {
+        static $properties;
+        return $properties[$class][$var];
+    }
+
+    // }}}
+    // {{{ registerShutdownFunc()
+
+    /**
+    * Use this function to register a shutdown method for static
+    * classes.
+    *
+    * @access public
+    * @param  mixed $func  The function name (or array of class/method) to call
+    * @param  mixed $args  The arguments to pass to the function
+    * @return void
+    */
+    function registerShutdownFunc($func, $args = array())
+    {
+        $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
+    }
+
+    // }}}
+    // {{{ isError()
+
+    /**
+     * Tell whether a value is a PEAR error.
+     *
+     * @param   mixed $data   the value to test
+     * @param   int   $code   if $data is an error object, return true
+     *                        only if $code is a string and
+     *                        $obj->getMessage() == $code or
+     *                        $code is an integer and $obj->getCode() == $code
+     * @access  public
+     * @return  bool    true if parameter is an error
+     */
+    function isError($data, $code = null)
+    {
+        if (is_a($data, 'PEAR_Error')) {
+            if (is_null($code)) {
+                return true;
+            } elseif (is_string($code)) {
+                return $data->getMessage() == $code;
+            } else {
+                return $data->getCode() == $code;
+            }
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ setErrorHandling()
+
+    /**
+     * Sets how errors generated by this object should be handled.
+     * Can be invoked both in objects and statically.  If called
+     * statically, setErrorHandling sets the default behaviour for all
+     * PEAR objects.  If called in an object, setErrorHandling sets
+     * the default behaviour for that object.
+     *
+     * @param int $mode
+     *        One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
+     *        PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
+     *        PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
+     *
+     * @param mixed $options
+     *        When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
+     *        of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
+     *
+     *        When $mode is PEAR_ERROR_CALLBACK, this parameter is expected
+     *        to be the callback function or method.  A callback
+     *        function is a string with the name of the function, a
+     *        callback method is an array of two elements: the element
+     *        at index 0 is the object, and the element at index 1 is
+     *        the name of the method to call in the object.
+     *
+     *        When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is
+     *        a printf format string used when printing the error
+     *        message.
+     *
+     * @access public
+     * @return void
+     * @see PEAR_ERROR_RETURN
+     * @see PEAR_ERROR_PRINT
+     * @see PEAR_ERROR_TRIGGER
+     * @see PEAR_ERROR_DIE
+     * @see PEAR_ERROR_CALLBACK
+     * @see PEAR_ERROR_EXCEPTION
+     *
+     * @since PHP 4.0.5
+     */
+
+    function setErrorHandling($mode = null, $options = null)
+    {
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $setmode     = &$this->_default_error_mode;
+            $setoptions  = &$this->_default_error_options;
+        } else {
+            $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
+            $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
+        }
+
+        switch ($mode) {
+            case PEAR_ERROR_EXCEPTION:
+            case PEAR_ERROR_RETURN:
+            case PEAR_ERROR_PRINT:
+            case PEAR_ERROR_TRIGGER:
+            case PEAR_ERROR_DIE:
+            case null:
+                $setmode = $mode;
+                $setoptions = $options;
+                break;
+
+            case PEAR_ERROR_CALLBACK:
+                $setmode = $mode;
+                // class/object method callback
+                if (is_callable($options)) {
+                    $setoptions = $options;
+                } else {
+                    trigger_error("invalid error callback", E_USER_WARNING);
+                }
+                break;
+
+            default:
+                trigger_error("invalid error mode", E_USER_WARNING);
+                break;
+        }
+    }
+
+    // }}}
+    // {{{ expectError()
+
+    /**
+     * This method is used to tell which errors you expect to get.
+     * Expected errors are always returned with error mode
+     * PEAR_ERROR_RETURN.  Expected error codes are stored in a stack,
+     * and this method pushes a new element onto it.  The list of
+     * expected errors are in effect until they are popped off the
+     * stack with the popExpect() method.
+     *
+     * Note that this method can not be called statically
+     *
+     * @param mixed $code a single error code or an array of error codes to expect
+     *
+     * @return int     the new depth of the "expected errors" stack
+     * @access public
+     */
+    function expectError($code = '*')
+    {
+        if (is_array($code)) {
+            array_push($this->_expected_errors, $code);
+        } else {
+            array_push($this->_expected_errors, array($code));
+        }
+        return sizeof($this->_expected_errors);
+    }
+
+    // }}}
+    // {{{ popExpect()
+
+    /**
+     * This method pops one element off the expected error codes
+     * stack.
+     *
+     * @return array   the list of error codes that were popped
+     */
+    function popExpect()
+    {
+        return array_pop($this->_expected_errors);
+    }
+
+    // }}}
+    // {{{ _checkDelExpect()
+
+    /**
+     * This method checks unsets an error code if available
+     *
+     * @param mixed error code
+     * @return bool true if the error code was unset, false otherwise
+     * @access private
+     * @since PHP 4.3.0
+     */
+    function _checkDelExpect($error_code)
+    {
+        $deleted = false;
+
+        foreach ($this->_expected_errors AS $key => $error_array) {
+            if (in_array($error_code, $error_array)) {
+                unset($this->_expected_errors[$key][array_search($error_code, $error_array)]);
+                $deleted = true;
+            }
+
+            // clean up empty arrays
+            if (0 == count($this->_expected_errors[$key])) {
+                unset($this->_expected_errors[$key]);
+            }
+        }
+        return $deleted;
+    }
+
+    // }}}
+    // {{{ delExpect()
+
+    /**
+     * This method deletes all occurences of the specified element from
+     * the expected error codes stack.
+     *
+     * @param  mixed $error_code error code that should be deleted
+     * @return mixed list of error codes that were deleted or error
+     * @access public
+     * @since PHP 4.3.0
+     */
+    function delExpect($error_code)
+    {
+        $deleted = false;
+
+        if ((is_array($error_code) && (0 != count($error_code)))) {
+            // $error_code is a non-empty array here;
+            // we walk through it trying to unset all
+            // values
+            foreach($error_code as $key => $error) {
+                if ($this->_checkDelExpect($error)) {
+                    $deleted =  true;
+                } else {
+                    $deleted = false;
+                }
+            }
+            return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
+        } elseif (!empty($error_code)) {
+            // $error_code comes alone, trying to unset it
+            if ($this->_checkDelExpect($error_code)) {
+                return true;
+            } else {
+                return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
+            }
+        } else {
+            // $error_code is empty
+            return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
+        }
+    }
+
+    // }}}
+    // {{{ raiseError()
+
+    /**
+     * This method is a wrapper that returns an instance of the
+     * configured error class with this object's default error
+     * handling applied.  If the $mode and $options parameters are not
+     * specified, the object's defaults are used.
+     *
+     * @param mixed $message a text error message or a PEAR error object
+     *
+     * @param int $code      a numeric error code (it is up to your class
+     *                  to define these if you want to use codes)
+     *
+     * @param int $mode      One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
+     *                  PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
+     *                  PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
+     *
+     * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
+     *                  specifies the PHP-internal error level (one of
+     *                  E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
+     *                  If $mode is PEAR_ERROR_CALLBACK, this
+     *                  parameter specifies the callback function or
+     *                  method.  In other error modes this parameter
+     *                  is ignored.
+     *
+     * @param string $userinfo If you need to pass along for example debug
+     *                  information, this parameter is meant for that.
+     *
+     * @param string $error_class The returned error object will be
+     *                  instantiated from this class, if specified.
+     *
+     * @param bool $skipmsg If true, raiseError will only pass error codes,
+     *                  the error message parameter will be dropped.
+     *
+     * @access public
+     * @return object   a PEAR error object
+     * @see PEAR::setErrorHandling
+     * @since PHP 4.0.5
+     */
+    function &raiseError($message = null,
+                         $code = null,
+                         $mode = null,
+                         $options = null,
+                         $userinfo = null,
+                         $error_class = null,
+                         $skipmsg = false)
+    {
+        // The error is yet a PEAR error object
+        if (is_object($message)) {
+            $code        = $message->getCode();
+            $userinfo    = $message->getUserInfo();
+            $error_class = $message->getType();
+            $message->error_message_prefix = '';
+            $message     = $message->getMessage();
+        }
+
+        if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
+            if ($exp[0] == "*" ||
+                (is_int(reset($exp)) && in_array($code, $exp)) ||
+                (is_string(reset($exp)) && in_array($message, $exp))) {
+                $mode = PEAR_ERROR_RETURN;
+            }
+        }
+        // No mode given, try global ones
+        if ($mode === null) {
+            // Class error handler
+            if (isset($this) && isset($this->_default_error_mode)) {
+                $mode    = $this->_default_error_mode;
+                $options = $this->_default_error_options;
+            // Global error handler
+            } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
+                $mode    = $GLOBALS['_PEAR_default_error_mode'];
+                $options = $GLOBALS['_PEAR_default_error_options'];
+            }
+        }
+
+        if ($error_class !== null) {
+            $ec = $error_class;
+        } elseif (isset($this) && isset($this->_error_class)) {
+            $ec = $this->_error_class;
+        } else {
+            $ec = 'PEAR_Error';
+        }
+        if ($skipmsg) {
+            $a = &new $ec($code, $mode, $options, $userinfo);
+            return $a;
+        } else {
+            $a = &new $ec($message, $code, $mode, $options, $userinfo);
+            return $a;
+        }
+    }
+
+    // }}}
+    // {{{ throwError()
+
+    /**
+     * Simpler form of raiseError with fewer options.  In most cases
+     * message, code and userinfo are enough.
+     *
+     * @param string $message
+     *
+     */
+    function &throwError($message = null,
+                         $code = null,
+                         $userinfo = null)
+    {
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $a = &$this->raiseError($message, $code, null, null, $userinfo);
+            return $a;
+        } else {
+            $a = &PEAR::raiseError($message, $code, null, null, $userinfo);
+            return $a;
+        }
+    }
+
+    // }}}
+    function staticPushErrorHandling($mode, $options = null)
+    {
+        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
+        $def_options = &$GLOBALS['_PEAR_default_error_options'];
+        $stack[] = array($def_mode, $def_options);
+        switch ($mode) {
+            case PEAR_ERROR_EXCEPTION:
+            case PEAR_ERROR_RETURN:
+            case PEAR_ERROR_PRINT:
+            case PEAR_ERROR_TRIGGER:
+            case PEAR_ERROR_DIE:
+            case null:
+                $def_mode = $mode;
+                $def_options = $options;
+                break;
+
+            case PEAR_ERROR_CALLBACK:
+                $def_mode = $mode;
+                // class/object method callback
+                if (is_callable($options)) {
+                    $def_options = $options;
+                } else {
+                    trigger_error("invalid error callback", E_USER_WARNING);
+                }
+                break;
+
+            default:
+                trigger_error("invalid error mode", E_USER_WARNING);
+                break;
+        }
+        $stack[] = array($mode, $options);
+        return true;
+    }
+
+    function staticPopErrorHandling()
+    {
+        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
+        $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
+        array_pop($stack);
+        list($mode, $options) = $stack[sizeof($stack) - 1];
+        array_pop($stack);
+        switch ($mode) {
+            case PEAR_ERROR_EXCEPTION:
+            case PEAR_ERROR_RETURN:
+            case PEAR_ERROR_PRINT:
+            case PEAR_ERROR_TRIGGER:
+            case PEAR_ERROR_DIE:
+            case null:
+                $setmode = $mode;
+                $setoptions = $options;
+                break;
+
+            case PEAR_ERROR_CALLBACK:
+                $setmode = $mode;
+                // class/object method callback
+                if (is_callable($options)) {
+                    $setoptions = $options;
+                } else {
+                    trigger_error("invalid error callback", E_USER_WARNING);
+                }
+                break;
+
+            default:
+                trigger_error("invalid error mode", E_USER_WARNING);
+                break;
+        }
+        return true;
+    }
+
+    // {{{ pushErrorHandling()
+
+    /**
+     * Push a new error handler on top of the error handler options stack. With this
+     * you can easily override the actual error handler for some code and restore
+     * it later with popErrorHandling.
+     *
+     * @param mixed $mode (same as setErrorHandling)
+     * @param mixed $options (same as setErrorHandling)
+     *
+     * @return bool Always true
+     *
+     * @see PEAR::setErrorHandling
+     */
+    function pushErrorHandling($mode, $options = null)
+    {
+        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $def_mode    = &$this->_default_error_mode;
+            $def_options = &$this->_default_error_options;
+        } else {
+            $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
+            $def_options = &$GLOBALS['_PEAR_default_error_options'];
+        }
+        $stack[] = array($def_mode, $def_options);
+
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $this->setErrorHandling($mode, $options);
+        } else {
+            PEAR::setErrorHandling($mode, $options);
+        }
+        $stack[] = array($mode, $options);
+        return true;
+    }
+
+    // }}}
+    // {{{ popErrorHandling()
+
+    /**
+    * Pop the last error handler used
+    *
+    * @return bool Always true
+    *
+    * @see PEAR::pushErrorHandling
+    */
+    function popErrorHandling()
+    {
+        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+        array_pop($stack);
+        list($mode, $options) = $stack[sizeof($stack) - 1];
+        array_pop($stack);
+        if (isset($this) && is_a($this, 'PEAR')) {
+            $this->setErrorHandling($mode, $options);
+        } else {
+            PEAR::setErrorHandling($mode, $options);
+        }
+        return true;
+    }
+
+    // }}}
+    // {{{ loadExtension()
+
+    /**
+    * OS independant PHP extension load. Remember to take care
+    * on the correct extension name for case sensitive OSes.
+    *
+    * @param string $ext The extension name
+    * @return bool Success or not on the dl() call
+    */
+    function loadExtension($ext)
+    {
+        if (!extension_loaded($ext)) {
+            // if either returns true dl() will produce a FATAL error, stop that
+            if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
+                return false;
+            }
+            if (OS_WINDOWS) {
+                $suffix = '.dll';
+            } elseif (PHP_OS == 'HP-UX') {
+                $suffix = '.sl';
+            } elseif (PHP_OS == 'AIX') {
+                $suffix = '.a';
+            } elseif (PHP_OS == 'OSX') {
+                $suffix = '.bundle';
+            } else {
+                $suffix = '.so';
+            }
+            return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
+        }
+        return true;
+    }
+
+    // }}}
+}
+
+// {{{ _PEAR_call_destructors()
+
+function _PEAR_call_destructors()
+{
+    global $_PEAR_destructor_object_list;
+    if (is_array($_PEAR_destructor_object_list) &&
+        sizeof($_PEAR_destructor_object_list))
+    {
+        reset($_PEAR_destructor_object_list);
+        if (@PEAR::getStaticProperty('PEAR', 'destructlifo')) {
+            $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
+        }
+        while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
+            $classname = get_class($objref);
+            while ($classname) {
+                $destructor = "_$classname";
+                if (method_exists($objref, $destructor)) {
+                    $objref->$destructor();
+                    break;
+                } else {
+                    $classname = get_parent_class($classname);
+                }
+            }
+        }
+        // Empty the object list to ensure that destructors are
+        // not called more than once.
+        $_PEAR_destructor_object_list = array();
+    }
+
+    // Now call the shutdown functions
+    if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) {
+        foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) {
+            call_user_func_array($value[0], $value[1]);
+        }
+    }
+}
+
+// }}}
+/**
+ * Standard PEAR error class for PHP 4
+ *
+ * This class is supserseded by {@link PEAR_Exception} in PHP 5
+ *
+ * @category   pear
+ * @package    PEAR
+ * @author     Stig Bakken <ssb@php.net>
+ * @author     Tomas V.V. Cox <cox@idecnet.com>
+ * @author     Gregory Beaver <cellog@php.net>
+ * @copyright  1997-2006 The PHP Group
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 1.4.6
+ * @link       http://pear.php.net/manual/en/core.pear.pear-error.php
+ * @see        PEAR::raiseError(), PEAR::throwError()
+ * @since      Class available since PHP 4.0.2
+ */
+class PEAR_Error
+{
+    // {{{ properties
+
+    var $error_message_prefix = '';
+    var $mode                 = PEAR_ERROR_RETURN;
+    var $level                = E_USER_NOTICE;
+    var $code                 = -1;
+    var $message              = '';
+    var $userinfo             = '';
+    var $backtrace            = null;
+
+    // }}}
+    // {{{ constructor
+
+    /**
+     * PEAR_Error constructor
+     *
+     * @param string $message  message
+     *
+     * @param int $code     (optional) error code
+     *
+     * @param int $mode     (optional) error mode, one of: PEAR_ERROR_RETURN,
+     * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
+     * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
+     *
+     * @param mixed $options   (optional) error level, _OR_ in the case of
+     * PEAR_ERROR_CALLBACK, the callback function or object/method
+     * tuple.
+     *
+     * @param string $userinfo (optional) additional user/debug info
+     *
+     * @access public
+     *
+     */
+    function PEAR_Error($message = 'unknown error', $code = null,
+                        $mode = null, $options = null, $userinfo = null)
+    {
+        if ($mode === null) {
+            $mode = PEAR_ERROR_RETURN;
+        }
+        $this->message   = $message;
+        $this->code      = $code;
+        $this->mode      = $mode;
+        $this->userinfo  = $userinfo;
+        if (function_exists("debug_backtrace")) {
+            if (@!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) {
+                $this->backtrace = debug_backtrace();
+            }
+        }
+        if ($mode & PEAR_ERROR_CALLBACK) {
+            $this->level = E_USER_NOTICE;
+            $this->callback = $options;
+        } else {
+            if ($options === null) {
+                $options = E_USER_NOTICE;
+            }
+            $this->level = $options;
+            $this->callback = null;
+        }
+        if ($this->mode & PEAR_ERROR_PRINT) {
+            if (is_null($options) || is_int($options)) {
+                $format = "%s";
+            } else {
+                $format = $options;
+            }
+            printf($format, $this->getMessage());
+        }
+        if ($this->mode & PEAR_ERROR_TRIGGER) {
+            trigger_error($this->getMessage(), $this->level);
+        }
+        if ($this->mode & PEAR_ERROR_DIE) {
+            $msg = $this->getMessage();
+            if (is_null($options) || is_int($options)) {
+                $format = "%s";
+                if (substr($msg, -1) != "\n") {
+                    $msg .= "\n";
+                }
+            } else {
+                $format = $options;
+            }
+            die(sprintf($format, $msg));
+        }
+        if ($this->mode & PEAR_ERROR_CALLBACK) {
+            if (is_callable($this->callback)) {
+                call_user_func($this->callback, $this);
+            }
+        }
+        if ($this->mode & PEAR_ERROR_EXCEPTION) {
+            trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
+            eval('$e = new Exception($this->message, $this->code);throw($e);');
+        }
+    }
+
+    // }}}
+    // {{{ getMode()
+
+    /**
+     * Get the error mode from an error object.
+     *
+     * @return int error mode
+     * @access public
+     */
+    function getMode() {
+        return $this->mode;
+    }
+
+    // }}}
+    // {{{ getCallback()
+
+    /**
+     * Get the callback function/method from an error object.
+     *
+     * @return mixed callback function or object/method array
+     * @access public
+     */
+    function getCallback() {
+        return $this->callback;
+    }
+
+    // }}}
+    // {{{ getMessage()
+
+
+    /**
+     * Get the error message from an error object.
+     *
+     * @return  string  full error message
+     * @access public
+     */
+    function getMessage()
+    {
+        return ($this->error_message_prefix . $this->message);
+    }
+
+
+    // }}}
+    // {{{ getCode()
+
+    /**
+     * Get error code from an error object
+     *
+     * @return int error code
+     * @access public
+     */
+     function getCode()
+     {
+        return $this->code;
+     }
+
+    // }}}
+    // {{{ getType()
+
+    /**
+     * Get the name of this error/exception.
+     *
+     * @return string error/exception name (type)
+     * @access public
+     */
+    function getType()
+    {
+        return get_class($this);
+    }
+
+    // }}}
+    // {{{ getUserInfo()
+
+    /**
+     * Get additional user-supplied information.
+     *
+     * @return string user-supplied information
+     * @access public
+     */
+    function getUserInfo()
+    {
+        return $this->userinfo;
+    }
+
+    // }}}
+    // {{{ getDebugInfo()
+
+    /**
+     * Get additional debug information supplied by the application.
+     *
+     * @return string debug information
+     * @access public
+     */
+    function getDebugInfo()
+    {
+        return $this->getUserInfo();
+    }
+
+    // }}}
+    // {{{ getBacktrace()
+
+    /**
+     * Get the call backtrace from where the error was generated.
+     * Supported with PHP 4.3.0 or newer.
+     *
+     * @param int $frame (optional) what frame to fetch
+     * @return array Backtrace, or NULL if not available.
+     * @access public
+     */
+    function getBacktrace($frame = null)
+    {
+        if (defined('PEAR_IGNORE_BACKTRACE')) {
+            return null;
+        }
+        if ($frame === null) {
+            return $this->backtrace;
+        }
+        return $this->backtrace[$frame];
+    }
+
+    // }}}
+    // {{{ addUserInfo()
+
+    function addUserInfo($info)
+    {
+        if (empty($this->userinfo)) {
+            $this->userinfo = $info;
+        } else {
+            $this->userinfo .= " ** $info";
+        }
+    }
+
+    // }}}
+    // {{{ toString()
+
+    /**
+     * Make a string representation of this object.
+     *
+     * @return string a string with an object summary
+     * @access public
+     */
+    function toString() {
+        $modes = array();
+        $levels = array(E_USER_NOTICE  => 'notice',
+                        E_USER_WARNING => 'warning',
+                        E_USER_ERROR   => 'error');
+        if ($this->mode & PEAR_ERROR_CALLBACK) {
+            if (is_array($this->callback)) {
+                $callback = (is_object($this->callback[0]) ?
+                    strtolower(get_class($this->callback[0])) :
+                    $this->callback[0]) . '::' .
+                    $this->callback[1];
+            } else {
+                $callback = $this->callback;
+            }
+            return sprintf('[%s: message="%s" code=%d mode=callback '.
+                           'callback=%s prefix="%s" info="%s"]',
+                           strtolower(get_class($this)), $this->message, $this->code,
+                           $callback, $this->error_message_prefix,
+                           $this->userinfo);
+        }
+        if ($this->mode & PEAR_ERROR_PRINT) {
+            $modes[] = 'print';
+        }
+        if ($this->mode & PEAR_ERROR_TRIGGER) {
+            $modes[] = 'trigger';
+        }
+        if ($this->mode & PEAR_ERROR_DIE) {
+            $modes[] = 'die';
+        }
+        if ($this->mode & PEAR_ERROR_RETURN) {
+            $modes[] = 'return';
+        }
+        return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
+                       'prefix="%s" info="%s"]',
+                       strtolower(get_class($this)), $this->message, $this->code,
+                       implode("|", $modes), $levels[$this->level],
+                       $this->error_message_prefix,
+                       $this->userinfo);
+    }
+
+    // }}}
+}
+
+/*
+ * Local Variables:
+ * mode: php
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
+?>
Index: /branches/mobile/data/module/Request.php
===================================================================
--- /branches/mobile/data/module/Request.php	(revision 8277)
+++ /branches/mobile/data/module/Request.php	(revision 8277)
@@ -0,0 +1,1408 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002-2003, Richard Heyes                                |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.|
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Richard Heyes <richard@phpguru.org>                           |
+// +-----------------------------------------------------------------------+
+//
+// $Id$
+//
+// HTTP_Request Class
+//
+// Simple example, (Fetches yahoo.com and displays it):
+//
+// $a = &new HTTP_Request('http://www.yahoo.com/');
+// $a->sendRequest();
+// echo $a->getResponseBody();
+//
+
+if(!defined('REQUEST_PHP_DIR')) {
+	$REQUEST_PHP_DIR = realpath(dirname( __FILE__));
+	define("REQUEST_PHP_DIR", $REQUEST_PHP_DIR);	
+}
+
+require_once REQUEST_PHP_DIR . '/PEAR.php';
+require_once REQUEST_PHP_DIR . '/Net/Socket.php';
+require_once REQUEST_PHP_DIR . '/Net/URL.php';
+
+define('HTTP_REQUEST_METHOD_GET',     'GET',     true);
+define('HTTP_REQUEST_METHOD_HEAD',    'HEAD',    true);
+define('HTTP_REQUEST_METHOD_POST',    'POST',    true);
+define('HTTP_REQUEST_METHOD_PUT',     'PUT',     true);
+define('HTTP_REQUEST_METHOD_DELETE',  'DELETE',  true);
+define('HTTP_REQUEST_METHOD_OPTIONS', 'OPTIONS', true);
+define('HTTP_REQUEST_METHOD_TRACE',   'TRACE',   true);
+
+define('HTTP_REQUEST_HTTP_VER_1_0', '1.0', true);
+define('HTTP_REQUEST_HTTP_VER_1_1', '1.1', true);
+
+class HTTP_Request {
+
+    /**
+    * Instance of Net_URL
+    * @var object Net_URL
+    */
+    var $_url;
+
+    /**
+    * Type of request
+    * @var string
+    */
+    var $_method;
+
+    /**
+    * HTTP Version
+    * @var string
+    */
+    var $_http;
+
+    /**
+    * Request headers
+    * @var array
+    */
+    var $_requestHeaders;
+
+    /**
+    * Basic Auth Username
+    * @var string
+    */
+    var $_user;
+    
+    /**
+    * Basic Auth Password
+    * @var string
+    */
+    var $_pass;
+
+    /**
+    * Socket object
+    * @var object Net_Socket
+    */
+    var $_sock;
+    
+    /**
+    * Proxy server
+    * @var string
+    */
+    var $_proxy_host;
+    
+    /**
+    * Proxy port
+    * @var integer
+    */
+    var $_proxy_port;
+    
+    /**
+    * Proxy username
+    * @var string
+    */
+    var $_proxy_user;
+    
+    /**
+    * Proxy password
+    * @var string
+    */
+    var $_proxy_pass;
+
+    /**
+    * Post data
+    * @var array
+    */
+    var $_postData;
+
+   /**
+    * Request body  
+    * @var string
+    */
+    var $_body;
+
+   /**
+    * A list of methods that MUST NOT have a request body, per RFC 2616
+    * @var array
+    */
+    var $_bodyDisallowed = array('TRACE');
+
+   /**
+    * Files to post 
+    * @var array
+    */
+    var $_postFiles = array();
+
+    /**
+    * Connection timeout.
+    * @var float
+    */
+    var $_timeout;
+    
+    /**
+    * HTTP_Response object
+    * @var object HTTP_Response
+    */
+    var $_response;
+    
+    /**
+    * Whether to allow redirects
+    * @var boolean
+    */
+    var $_allowRedirects;
+    
+    /**
+    * Maximum redirects allowed
+    * @var integer
+    */
+    var $_maxRedirects;
+    
+    /**
+    * Current number of redirects
+    * @var integer
+    */
+    var $_redirects;
+
+   /**
+    * Whether to append brackets [] to array variables
+    * @var bool
+    */
+    var $_useBrackets = true;
+
+   /**
+    * Attached listeners
+    * @var array
+    */
+    var $_listeners = array();
+
+   /**
+    * Whether to save response body in response object property  
+    * @var bool
+    */
+    var $_saveBody = true;
+
+   /**
+    * Timeout for reading from socket (array(seconds, microseconds))
+    * @var array
+    */
+    var $_readTimeout = null;
+
+   /**
+    * Options to pass to Net_Socket::connect. See stream_context_create
+    * @var array
+    */
+    var $_socketOptions = null;
+
+    /**
+    * Constructor
+    *
+    * Sets up the object
+    * @param    string  The url to fetch/access
+    * @param    array   Associative array of parameters which can have the following keys:
+    * <ul>
+    *   <li>method         - Method to use, GET, POST etc (string)</li>
+    *   <li>http           - HTTP Version to use, 1.0 or 1.1 (string)</li>
+    *   <li>user           - Basic Auth username (string)</li>
+    *   <li>pass           - Basic Auth password (string)</li>
+    *   <li>proxy_host     - Proxy server host (string)</li>
+    *   <li>proxy_port     - Proxy server port (integer)</li>
+    *   <li>proxy_user     - Proxy auth username (string)</li>
+    *   <li>proxy_pass     - Proxy auth password (string)</li>
+    *   <li>timeout        - Connection timeout in seconds (float)</li>
+    *   <li>allowRedirects - Whether to follow redirects or not (bool)</li>
+    *   <li>maxRedirects   - Max number of redirects to follow (integer)</li>
+    *   <li>useBrackets    - Whether to append [] to array variable names (bool)</li>
+    *   <li>saveBody       - Whether to save response body in response object property (bool)</li>
+    *   <li>readTimeout    - Timeout for reading / writing data over the socket (array (seconds, microseconds))</li>
+    *   <li>socketOptions  - Options to pass to Net_Socket object (array)</li>
+    * </ul>
+    * @access public
+    */
+    function HTTP_Request($url = '', $params = array())
+    {
+        $this->_method         =  HTTP_REQUEST_METHOD_GET;
+        $this->_http           =  HTTP_REQUEST_HTTP_VER_1_1;
+        $this->_requestHeaders = array();
+        $this->_postData       = array();
+        $this->_body           = null;
+
+        $this->_user = null;
+        $this->_pass = null;
+
+        $this->_proxy_host = null;
+        $this->_proxy_port = null;
+        $this->_proxy_user = null;
+        $this->_proxy_pass = null;
+
+        $this->_allowRedirects = false;
+        $this->_maxRedirects   = 3;
+        $this->_redirects      = 0;
+
+        $this->_timeout  = null;
+        $this->_response = null;
+
+        foreach ($params as $key => $value) {
+            $this->{'_' . $key} = $value;
+        }
+
+        if (!empty($url)) {
+            $this->setURL($url);
+        }
+
+        // Default useragent
+        $this->addHeader('User-Agent', 'PEAR HTTP_Request class ( http://pear.php.net/ )');
+
+        // We don't do keep-alives by default
+        $this->addHeader('Connection', 'close');
+
+        // Basic authentication
+        if (!empty($this->_user)) {
+            $this->addHeader('Authorization', 'Basic ' . base64_encode($this->_user . ':' . $this->_pass));
+        }
+
+        // Proxy authentication (see bug #5913)
+        if (!empty($this->_proxy_user)) {
+            $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($this->_proxy_user . ':' . $this->_proxy_pass));
+        }
+
+        // Use gzip encoding if possible
+        // Avoid gzip encoding if using multibyte functions (see #1781)
+        if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && extension_loaded('zlib') &&
+            0 == (2 & ini_get('mbstring.func_overload'))) {
+
+            $this->addHeader('Accept-Encoding', 'gzip');
+        }
+    }
+    
+    /**
+    * Generates a Host header for HTTP/1.1 requests
+    *
+    * @access private
+    * @return string
+    */
+    function _generateHostHeader()
+    {
+        if ($this->_url->port != 80 AND strcasecmp($this->_url->protocol, 'http') == 0) {
+            $host = $this->_url->host . ':' . $this->_url->port;
+
+        } elseif ($this->_url->port != 443 AND strcasecmp($this->_url->protocol, 'https') == 0) {
+            $host = $this->_url->host . ':' . $this->_url->port;
+
+        } elseif ($this->_url->port == 443 AND strcasecmp($this->_url->protocol, 'https') == 0 AND strpos($this->_url->url, ':443') !== false) {
+            $host = $this->_url->host . ':' . $this->_url->port;
+        
+        } else {
+            $host = $this->_url->host;
+        }
+
+        return $host;
+    }
+    
+    /**
+    * Resets the object to its initial state (DEPRECATED).
+    * Takes the same parameters as the constructor.
+    *
+    * @param  string $url    The url to be requested
+    * @param  array  $params Associative array of parameters
+    *                        (see constructor for details)
+    * @access public
+    * @deprecated deprecated since 1.2, call the constructor if this is necessary
+    */
+    function reset($url, $params = array())
+    {
+        $this->HTTP_Request($url, $params);
+    }
+
+    /**
+    * Sets the URL to be requested
+    *
+    * @param  string The url to be requested
+    * @access public
+    */
+    function setURL($url)
+    {
+        $this->_url = &new Net_URL($url, $this->_useBrackets);
+
+        if (!empty($this->_url->user) || !empty($this->_url->pass)) {
+            $this->setBasicAuth($this->_url->user, $this->_url->pass);
+        }
+
+        if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http) {
+            $this->addHeader('Host', $this->_generateHostHeader());
+        }
+
+        // set '/' instead of empty path rather than check later (see bug #8662)
+        if (empty($this->_url->path)) {
+            $this->_url->path = '/';
+        } 
+    }
+    
+   /**
+    * Returns the current request URL  
+    *
+    * @return   string  Current request URL
+    * @access   public
+    */
+    function getUrl($url)
+    {
+        return empty($this->_url)? '': $this->_url->getUrl();
+    }
+
+    /**
+    * Sets a proxy to be used
+    *
+    * @param string     Proxy host
+    * @param int        Proxy port
+    * @param string     Proxy username
+    * @param string     Proxy password
+    * @access public
+    */
+    function setProxy($host, $port = 8080, $user = null, $pass = null)
+    {
+        $this->_proxy_host = $host;
+        $this->_proxy_port = $port;
+        $this->_proxy_user = $user;
+        $this->_proxy_pass = $pass;
+
+        if (!empty($user)) {
+            $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($user . ':' . $pass));
+        }
+    }
+
+    /**
+    * Sets basic authentication parameters
+    *
+    * @param string     Username
+    * @param string     Password
+    */
+    function setBasicAuth($user, $pass)
+    {
+        $this->_user = $user;
+        $this->_pass = $pass;
+
+        $this->addHeader('Authorization', 'Basic ' . base64_encode($user . ':' . $pass));
+    }
+
+    /**
+    * Sets the method to be used, GET, POST etc.
+    *
+    * @param string     Method to use. Use the defined constants for this
+    * @access public
+    */
+    function setMethod($method)
+    {
+        $this->_method = $method;
+    }
+
+    /**
+    * Sets the HTTP version to use, 1.0 or 1.1
+    *
+    * @param string     Version to use. Use the defined constants for this
+    * @access public
+    */
+    function setHttpVer($http)
+    {
+        $this->_http = $http;
+    }
+
+    /**
+    * Adds a request header
+    *
+    * @param string     Header name
+    * @param string     Header value
+    * @access public
+    */
+    function addHeader($name, $value)
+    {
+        $this->_requestHeaders[strtolower($name)] = $value;
+    }
+
+    /**
+    * Removes a request header
+    *
+    * @param string     Header name to remove
+    * @access public
+    */
+    function removeHeader($name)
+    {
+        if (isset($this->_requestHeaders[strtolower($name)])) {
+            unset($this->_requestHeaders[strtolower($name)]);
+        }
+    }
+
+    /**
+    * Adds a querystring parameter
+    *
+    * @param string     Querystring parameter name
+    * @param string     Querystring parameter value
+    * @param bool       Whether the value is already urlencoded or not, default = not
+    * @access public
+    */
+    function addQueryString($name, $value, $preencoded = false)
+    {
+        $this->_url->addQueryString($name, $value, $preencoded);
+    }    
+    
+    /**
+    * Sets the querystring to literally what you supply
+    *
+    * @param string     The querystring data. Should be of the format foo=bar&x=y etc
+    * @param bool       Whether data is already urlencoded or not, default = already encoded
+    * @access public
+    */
+    function addRawQueryString($querystring, $preencoded = true)
+    {
+        $this->_url->addRawQueryString($querystring, $preencoded);
+    }
+
+    /**
+    * Adds postdata items
+    *
+    * @param string     Post data name
+    * @param string     Post data value
+    * @param bool       Whether data is already urlencoded or not, default = not
+    * @access public
+    */
+    function addPostData($name, $value, $preencoded = false)
+    {
+        if ($preencoded) {
+            $this->_postData[$name] = $value;
+        } else {
+            $this->_postData[$name] = $this->_arrayMapRecursive('urlencode', $value);
+        }
+    }
+	
+    function addPostDataArray($array, $preencoded = false)
+    {
+		foreach($array as $key => $val){
+			$this->addPostData($key, $val, $preencoded);
+		}
+    }	
+
+   /**
+    * Recursively applies the callback function to the value
+    * 
+    * @param    mixed   Callback function
+    * @param    mixed   Value to process
+    * @access   private
+    * @return   mixed   Processed value
+    */
+    function _arrayMapRecursive($callback, $value)
+    {
+        if (!is_array($value)) {
+            return call_user_func($callback, $value);
+        } else {
+            $map = array();
+            foreach ($value as $k => $v) {
+                $map[$k] = $this->_arrayMapRecursive($callback, $v);
+            }
+            return $map;
+        }
+    }
+
+   /**
+    * Adds a file to upload
+    * 
+    * This also changes content-type to 'multipart/form-data' for proper upload
+    * 
+    * @access public
+    * @param  string    name of file-upload field
+    * @param  mixed     file name(s)
+    * @param  mixed     content-type(s) of file(s) being uploaded
+    * @return bool      true on success
+    * @throws PEAR_Error
+    */
+    function addFile($inputName, $fileName, $contentType = 'application/octet-stream')
+    {
+        if (!is_array($fileName) && !is_readable($fileName)) {
+            return PEAR::raiseError("File '{$fileName}' is not readable");
+        } elseif (is_array($fileName)) {
+            foreach ($fileName as $name) {
+                if (!is_readable($name)) {
+                    return PEAR::raiseError("File '{$name}' is not readable");
+                }
+            }
+        }
+        $this->addHeader('Content-Type', 'multipart/form-data');
+        $this->_postFiles[$inputName] = array(
+            'name' => $fileName,
+            'type' => $contentType
+        );
+        return true;
+    }
+
+    /**
+    * Adds raw postdata (DEPRECATED)
+    *
+    * @param string     The data
+    * @param bool       Whether data is preencoded or not, default = already encoded
+    * @access public
+    * @deprecated       deprecated since 1.3.0, method setBody() should be used instead
+    */
+    function addRawPostData($postdata, $preencoded = true)
+    {
+        $this->_body = $preencoded ? $postdata : urlencode($postdata);
+    }
+
+   /**
+    * Sets the request body (for POST, PUT and similar requests)
+    *
+    * @param    string  Request body
+    * @access   public
+    */
+    function setBody($body)
+    {
+        $this->_body = $body;
+    }
+
+    /**
+    * Clears any postdata that has been added (DEPRECATED). 
+    * 
+    * Useful for multiple request scenarios.
+    *
+    * @access public
+    * @deprecated deprecated since 1.2
+    */
+    function clearPostData()
+    {
+        $this->_postData = null;
+    }
+
+    /**
+    * Appends a cookie to "Cookie:" header
+    * 
+    * @param string $name cookie name
+    * @param string $value cookie value
+    * @access public
+    */
+    function addCookie($name, $value)
+    {
+        $cookies = isset($this->_requestHeaders['cookie']) ? $this->_requestHeaders['cookie']. '; ' : '';
+        $this->addHeader('Cookie', $cookies . $name . '=' . $value);
+    }
+    
+    /**
+    * Clears any cookies that have been added (DEPRECATED). 
+    * 
+    * Useful for multiple request scenarios
+    *
+    * @access public
+    * @deprecated deprecated since 1.2
+    */
+    function clearCookies()
+    {
+        $this->removeHeader('Cookie');
+    }
+
+    /**
+    * Sends the request
+    *
+    * @access public
+    * @param  bool   Whether to store response body in Response object property,
+    *                set this to false if downloading a LARGE file and using a Listener
+    * @return mixed  PEAR error on error, true otherwise
+    */
+    function sendRequest($saveBody = true)
+    {
+        if (!is_a($this->_url, 'Net_URL')) {
+            return PEAR::raiseError('No URL given.');
+        }
+
+        $host = isset($this->_proxy_host) ? $this->_proxy_host : $this->_url->host;
+        $port = isset($this->_proxy_port) ? $this->_proxy_port : $this->_url->port;
+
+        // 4.3.0 supports SSL connections using OpenSSL. The function test determines
+        // we running on at least 4.3.0
+        if (strcasecmp($this->_url->protocol, 'https') == 0 AND function_exists('file_get_contents') AND extension_loaded('openssl')) {
+            if (isset($this->_proxy_host)) {
+                return PEAR::raiseError('HTTPS proxies are not supported.');
+            }
+            $host = 'ssl://' . $host;
+        }
+
+        // magic quotes may fuck up file uploads and chunked response processing
+        $magicQuotes = ini_get('magic_quotes_runtime');
+        ini_set('magic_quotes_runtime', false);
+
+        // RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive 
+        // connection token to a proxy server...
+        if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection']) &&
+            'Keep-Alive' == $this->_requestHeaders['connection'])
+        {
+            $this->removeHeader('connection');
+        }
+
+        $keepAlive = (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection'])) ||
+                     (!empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']);
+        $sockets   = &PEAR::getStaticProperty('HTTP_Request', 'sockets');
+        $sockKey   = $host . ':' . $port;
+        unset($this->_sock);
+
+        // There is a connected socket in the "static" property?
+        if ($keepAlive && !empty($sockets[$sockKey]) &&
+            !empty($sockets[$sockKey]->fp)) 
+        {
+            $this->_sock =& $sockets[$sockKey];
+            $err = null;
+        } else {
+            $this->_notify('connect');
+            $this->_sock =& new Net_Socket();
+            $err = $this->_sock->connect($host, $port, null, $this->_timeout, $this->_socketOptions);
+        }
+        PEAR::isError($err) or $err = $this->_sock->write($this->_buildRequest());
+
+        if (!PEAR::isError($err)) {
+            if (!empty($this->_readTimeout)) {
+                $this->_sock->setTimeout($this->_readTimeout[0], $this->_readTimeout[1]);
+            }
+
+            $this->_notify('sentRequest');
+
+            // Read the response
+            $this->_response = &new HTTP_Response($this->_sock, $this->_listeners);
+            $err = $this->_response->process(
+                $this->_saveBody && $saveBody,
+                HTTP_REQUEST_METHOD_HEAD != $this->_method
+            );
+
+            if ($keepAlive) {
+                $keepAlive = (isset($this->_response->_headers['content-length'])
+                              || (isset($this->_response->_headers['transfer-encoding'])
+                                  && strtolower($this->_response->_headers['transfer-encoding']) == 'chunked'));
+                if ($keepAlive) {
+                    if (isset($this->_response->_headers['connection'])) {
+                        $keepAlive = strtolower($this->_response->_headers['connection']) == 'keep-alive';
+                    } else {
+                        $keepAlive = 'HTTP/'.HTTP_REQUEST_HTTP_VER_1_1 == $this->_response->_protocol;
+                    }
+                }
+            }
+        }
+
+        ini_set('magic_quotes_runtime', $magicQuotes);
+
+        if (PEAR::isError($err)) {
+            return $err;
+        }
+
+        if (!$keepAlive) {
+            $this->disconnect();
+        // Store the connected socket in "static" property
+        } elseif (empty($sockets[$sockKey]) || empty($sockets[$sockKey]->fp)) {
+            $sockets[$sockKey] =& $this->_sock;
+        }
+
+        // Check for redirection
+        if (    $this->_allowRedirects
+            AND $this->_redirects <= $this->_maxRedirects
+            AND $this->getResponseCode() > 300
+            AND $this->getResponseCode() < 399
+            AND !empty($this->_response->_headers['location'])) {
+
+            
+            $redirect = $this->_response->_headers['location'];
+
+            // Absolute URL
+            if (preg_match('/^https?:\/\//i', $redirect)) {
+                $this->_url = &new Net_URL($redirect);
+                $this->addHeader('Host', $this->_generateHostHeader());
+            // Absolute path
+            } elseif ($redirect{0} == '/') {
+                $this->_url->path = $redirect;
+            
+            // Relative path
+            } elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {
+                if (substr($this->_url->path, -1) == '/') {
+                    $redirect = $this->_url->path . $redirect;
+                } else {
+                    $redirect = dirname($this->_url->path) . '/' . $redirect;
+                }
+                $redirect = Net_URL::resolvePath($redirect);
+                $this->_url->path = $redirect;
+                
+            // Filename, no path
+            } else {
+                if (substr($this->_url->path, -1) == '/') {
+                    $redirect = $this->_url->path . $redirect;
+                } else {
+                    $redirect = dirname($this->_url->path) . '/' . $redirect;
+                }
+                $this->_url->path = $redirect;
+            }
+
+            $this->_redirects++;
+            return $this->sendRequest($saveBody);
+
+        // Too many redirects
+        } elseif ($this->_allowRedirects AND $this->_redirects > $this->_maxRedirects) {
+            return PEAR::raiseError('Too many redirects');
+        }
+
+        return true;
+    }
+
+    /**
+     * Disconnect the socket, if connected. Only useful if using Keep-Alive.
+     *
+     * @access public
+     */
+    function disconnect()
+    {
+        if (!empty($this->_sock) && !empty($this->_sock->fp)) {
+            $this->_notify('disconnect');
+            $this->_sock->disconnect();
+        }
+    }
+
+    /**
+    * Returns the response code
+    *
+    * @access public
+    * @return mixed     Response code, false if not set
+    */
+    function getResponseCode()
+    {
+        return isset($this->_response->_code) ? $this->_response->_code : false;
+    }
+
+    /**
+    * Returns either the named header or all if no name given
+    *
+    * @access public
+    * @param string     The header name to return, do not set to get all headers
+    * @return mixed     either the value of $headername (false if header is not present)
+    *                   or an array of all headers
+    */
+    function getResponseHeader($headername = null)
+    {
+        if (!isset($headername)) {
+            return isset($this->_response->_headers)? $this->_response->_headers: array();
+        } else {
+            $headername = strtolower($headername);
+            return isset($this->_response->_headers[$headername]) ? $this->_response->_headers[$headername] : false;
+        }
+    }
+
+    /**
+    * Returns the body of the response
+    *
+    * @access public
+    * @return mixed     response body, false if not set
+    */
+    function getResponseBody()
+    {
+        return isset($this->_response->_body) ? $this->_response->_body : false;
+    }
+
+    /**
+    * Returns cookies set in response
+    * 
+    * @access public
+    * @return mixed     array of response cookies, false if none are present
+    */
+    function getResponseCookies()
+    {
+        return isset($this->_response->_cookies) ? $this->_response->_cookies : false;
+    }
+
+    /**
+    * Builds the request string
+    *
+    * @access private
+    * @return string The request string
+    */
+    function _buildRequest()
+    {
+        $separator = ini_get('arg_separator.output');
+        ini_set('arg_separator.output', '&');
+        $querystring = ($querystring = $this->_url->getQueryString()) ? '?' . $querystring : '';
+        ini_set('arg_separator.output', $separator);
+
+        $host = isset($this->_proxy_host) ? $this->_url->protocol . '://' . $this->_url->host : '';
+        $port = (isset($this->_proxy_host) AND $this->_url->port != 80) ? ':' . $this->_url->port : '';
+        $path = $this->_url->path . $querystring;
+        $url  = $host . $port . $path;
+
+        $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n";
+
+        if (in_array($this->_method, $this->_bodyDisallowed) ||
+            (empty($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method ||
+             (empty($this->_postData) && empty($this->_postFiles)))))
+        {
+            $this->removeHeader('Content-Type');
+        } else {
+            if (empty($this->_requestHeaders['content-type'])) {
+                // Add default content-type
+                $this->addHeader('Content-Type', 'application/x-www-form-urlencoded');
+            } elseif ('multipart/form-data' == $this->_requestHeaders['content-type']) {
+                $boundary = 'HTTP_Request_' . md5(uniqid('request') . microtime());
+                $this->addHeader('Content-Type', 'multipart/form-data; boundary=' . $boundary);
+            }
+        }
+
+        // Request Headers
+        if (!empty($this->_requestHeaders)) {
+            foreach ($this->_requestHeaders as $name => $value) {
+                $canonicalName = implode('-', array_map('ucfirst', explode('-', $name)));
+                $request      .= $canonicalName . ': ' . $value . "\r\n";
+            }
+        }
+
+        // No post data or wrong method, so simply add a final CRLF
+        if (in_array($this->_method, $this->_bodyDisallowed) || 
+            (HTTP_REQUEST_METHOD_POST != $this->_method && empty($this->_body))) {
+
+            $request .= "\r\n";
+
+        // Post data if it's an array
+        } elseif (HTTP_REQUEST_METHOD_POST == $this->_method && 
+                  (!empty($this->_postData) || !empty($this->_postFiles))) {
+
+            // "normal" POST request
+            if (!isset($boundary)) {
+                $postdata = implode('&', array_map(
+                    create_function('$a', 'return $a[0] . \'=\' . $a[1];'), 
+                    $this->_flattenArray('', $this->_postData)
+                ));
+
+            // multipart request, probably with file uploads
+            } else {
+                $postdata = '';
+                if (!empty($this->_postData)) {
+                    $flatData = $this->_flattenArray('', $this->_postData);
+                    foreach ($flatData as $item) {
+                        $postdata .= '--' . $boundary . "\r\n";
+                        $postdata .= 'Content-Disposition: form-data; name="' . $item[0] . '"';
+                        $postdata .= "\r\n\r\n" . urldecode($item[1]) . "\r\n";
+                    }
+                }
+                foreach ($this->_postFiles as $name => $value) {
+                    if (is_array($value['name'])) {
+                        $varname       = $name . ($this->_useBrackets? '[]': '');
+                    } else {
+                        $varname       = $name;
+                        $value['name'] = array($value['name']);
+                    }
+                    foreach ($value['name'] as $key => $filename) {
+                        $fp   = fopen($filename, 'r');
+                        $data = fread($fp, filesize($filename));
+                        fclose($fp);
+                        $basename = basename($filename);
+                        $type     = is_array($value['type'])? @$value['type'][$key]: $value['type'];
+
+                        $postdata .= '--' . $boundary . "\r\n";
+                        $postdata .= 'Content-Disposition: form-data; name="' . $varname . '"; filename="' . $basename . '"';
+                        $postdata .= "\r\nContent-Type: " . $type;
+                        $postdata .= "\r\n\r\n" . $data . "\r\n";
+                    }
+                }
+                $postdata .= '--' . $boundary . "--\r\n";
+            }
+            $request .= 'Content-Length: ' . strlen($postdata) . "\r\n\r\n";
+            $request .= $postdata;
+
+        // Explicitly set request body
+        } elseif (!empty($this->_body)) {
+
+            $request .= 'Content-Length: ' . strlen($this->_body) . "\r\n\r\n";
+            $request .= $this->_body;
+        }
+        
+        return $request;
+    }
+
+   /**
+    * Helper function to change the (probably multidimensional) associative array
+    * into the simple one.
+    *
+    * @param    string  name for item
+    * @param    mixed   item's values
+    * @return   array   array with the following items: array('item name', 'item value');
+    */
+    function _flattenArray($name, $values)
+    {
+        if (!is_array($values)) {
+            return array(array($name, $values));
+        } else {
+            $ret = array();
+            foreach ($values as $k => $v) {
+                if (empty($name)) {
+                    $newName = $k;
+                } elseif ($this->_useBrackets) {
+                    $newName = $name . '[' . $k . ']';
+                } else {
+                    $newName = $name;
+                }
+                $ret = array_merge($ret, $this->_flattenArray($newName, $v));
+            }
+            return $ret;
+        }
+    }
+
+
+   /**
+    * Adds a Listener to the list of listeners that are notified of
+    * the object's events
+    * 
+    * @param    object   HTTP_Request_Listener instance to attach
+    * @return   boolean  whether the listener was successfully attached
+    * @access   public
+    */
+    function attach(&$listener)
+    {
+        if (!is_a($listener, 'HTTP_Request_Listener')) {
+            return false;
+        }
+        $this->_listeners[$listener->getId()] =& $listener;
+        return true;
+    }
+
+
+   /**
+    * Removes a Listener from the list of listeners 
+    * 
+    * @param    object   HTTP_Request_Listener instance to detach
+    * @return   boolean  whether the listener was successfully detached
+    * @access   public
+    */
+    function detach(&$listener)
+    {
+        if (!is_a($listener, 'HTTP_Request_Listener') || 
+            !isset($this->_listeners[$listener->getId()])) {
+            return false;
+        }
+        unset($this->_listeners[$listener->getId()]);
+        return true;
+    }
+
+
+   /**
+    * Notifies all registered listeners of an event.
+    * 
+    * Events sent by HTTP_Request object
+    * - 'connect': on connection to server
+    * - 'sentRequest': after the request was sent
+    * - 'disconnect': on disconnection from server
+    * 
+    * Events sent by HTTP_Response object
+    * - 'gotHeaders': after receiving response headers (headers are passed in $data)
+    * - 'tick': on receiving a part of response body (the part is passed in $data)
+    * - 'gzTick': on receiving a gzip-encoded part of response body (ditto)
+    * - 'gotBody': after receiving the response body (passes the decoded body in $data if it was gzipped)
+    * 
+    * @param    string  Event name
+    * @param    mixed   Additional data
+    * @access   private
+    */
+    function _notify($event, $data = null)
+    {
+        foreach (array_keys($this->_listeners) as $id) {
+            $this->_listeners[$id]->update($this, $event, $data);
+        }
+    }
+}
+
+
+/**
+* Response class to complement the Request class
+*/
+class HTTP_Response
+{
+    /**
+    * Socket object
+    * @var object
+    */
+    var $_sock;
+
+    /**
+    * Protocol
+    * @var string
+    */
+    var $_protocol;
+    
+    /**
+    * Return code
+    * @var string
+    */
+    var $_code;
+    
+    /**
+    * Response headers
+    * @var array
+    */
+    var $_headers;
+
+    /**
+    * Cookies set in response  
+    * @var array
+    */
+    var $_cookies;
+
+    /**
+    * Response body
+    * @var string
+    */
+    var $_body = '';
+
+   /**
+    * Used by _readChunked(): remaining length of the current chunk
+    * @var string
+    */
+    var $_chunkLength = 0;
+
+   /**
+    * Attached listeners
+    * @var array
+    */
+    var $_listeners = array();
+
+   /**
+    * Bytes left to read from message-body
+    * @var null|int
+    */
+    var $_toRead;
+
+    /**
+    * Constructor
+    *
+    * @param  object Net_Socket     socket to read the response from
+    * @param  array                 listeners attached to request
+    * @return mixed PEAR Error on error, true otherwise
+    */
+    function HTTP_Response(&$sock, &$listeners)
+    {
+        $this->_sock      =& $sock;
+        $this->_listeners =& $listeners;
+    }
+
+
+   /**
+    * Processes a HTTP response
+    * 
+    * This extracts response code, headers, cookies and decodes body if it 
+    * was encoded in some way
+    *
+    * @access public
+    * @param  bool      Whether to store response body in object property, set
+    *                   this to false if downloading a LARGE file and using a Listener.
+    *                   This is assumed to be true if body is gzip-encoded.
+    * @param  bool      Whether the response can actually have a message-body.
+    *                   Will be set to false for HEAD requests.
+    * @throws PEAR_Error
+    * @return mixed     true on success, PEAR_Error in case of malformed response
+    */
+    function process($saveBody = true, $canHaveBody = true)
+    {
+        do {
+            $line = $this->_sock->readLine();
+            if (sscanf($line, 'HTTP/%s %s', $http_version, $returncode) != 2) {
+                return PEAR::raiseError('Malformed response.');
+            } else {
+                $this->_protocol = 'HTTP/' . $http_version;
+                $this->_code     = intval($returncode);
+            }
+            while ('' !== ($header = $this->_sock->readLine())) {
+                $this->_processHeader($header);
+            }
+        } while (100 == $this->_code);
+
+        $this->_notify('gotHeaders', $this->_headers);
+
+        // RFC 2616, section 4.4:
+        // 1. Any response message which "MUST NOT" include a message-body ... 
+        // is always terminated by the first empty line after the header fields 
+        // 3. ... If a message is received with both a
+        // Transfer-Encoding header field and a Content-Length header field,
+        // the latter MUST be ignored.
+        $canHaveBody = $canHaveBody && $this->_code >= 200 && 
+                       $this->_code != 204 && $this->_code != 304;
+
+        // If response body is present, read it and decode
+        $chunked = isset($this->_headers['transfer-encoding']) && ('chunked' == $this->_headers['transfer-encoding']);
+        $gzipped = isset($this->_headers['content-encoding']) && ('gzip' == $this->_headers['content-encoding']);
+        $hasBody = false;
+        if ($canHaveBody && ($chunked || !isset($this->_headers['content-length']) || 
+                0 != $this->_headers['content-length']))
+        {
+            if ($chunked || !isset($this->_headers['content-length'])) {
+                $this->_toRead = null;
+            } else {
+                $this->_toRead = $this->_headers['content-length'];
+            }
+            while (!$this->_sock->eof() && (is_null($this->_toRead) || 0 < $this->_toRead)) {
+                if ($chunked) {
+                    $data = $this->_readChunked();
+                } elseif (is_null($this->_toRead)) {
+                    $data = $this->_sock->read(4096);
+                } else {
+                    $data = $this->_sock->read(min(4096, $this->_toRead));
+                    $this->_toRead -= strlen($data);
+                }
+                if ('' == $data) {
+                    break;
+                } else {
+                    $hasBody = true;
+                    if ($saveBody || $gzipped) {
+                        $this->_body .= $data;
+                    }
+                    $this->_notify($gzipped? 'gzTick': 'tick', $data);
+                }
+            }
+        }
+
+        if ($hasBody) {
+            // Uncompress the body if needed
+            if ($gzipped) {
+                $body = $this->_decodeGzip($this->_body);
+                if (PEAR::isError($body)) {
+                    return $body;
+                }
+                $this->_body = $body;
+                $this->_notify('gotBody', $this->_body);
+            } else {
+                $this->_notify('gotBody');
+            }
+        }
+        return true;
+    }
+
+
+   /**
+    * Processes the response header
+    *
+    * @access private
+    * @param  string    HTTP header
+    */
+    function _processHeader($header)
+    {
+        if (false === strpos($header, ':')) {
+            return;
+        }
+        list($headername, $headervalue) = explode(':', $header, 2);
+        $headername  = strtolower($headername);
+        $headervalue = ltrim($headervalue);
+        
+        if ('set-cookie' != $headername) {
+            if (isset($this->_headers[$headername])) {
+                $this->_headers[$headername] .= ',' . $headervalue;
+            } else {
+                $this->_headers[$headername]  = $headervalue;
+            }
+        } else {
+            $this->_parseCookie($headervalue);
+        }
+    }
+
+
+   /**
+    * Parse a Set-Cookie header to fill $_cookies array
+    *
+    * @access private
+    * @param  string    value of Set-Cookie header
+    */
+    function _parseCookie($headervalue)
+    {
+        $cookie = array(
+            'expires' => null,
+            'domain'  => null,
+            'path'    => null,
+            'secure'  => false
+        );
+
+        // Only a name=value pair
+        if (!strpos($headervalue, ';')) {
+            $pos = strpos($headervalue, '=');
+            $cookie['name']  = trim(substr($headervalue, 0, $pos));
+            $cookie['value'] = trim(substr($headervalue, $pos + 1));
+
+        // Some optional parameters are supplied
+        } else {
+            $elements = explode(';', $headervalue);
+            $pos = strpos($elements[0], '=');
+            $cookie['name']  = trim(substr($elements[0], 0, $pos));
+            $cookie['value'] = trim(substr($elements[0], $pos + 1));
+
+            for ($i = 1; $i < count($elements); $i++) {
+                if (false === strpos($elements[$i], '=')) {
+                    $elName  = trim($elements[$i]);
+                    $elValue = null;
+                } else {
+                    list ($elName, $elValue) = array_map('trim', explode('=', $elements[$i]));
+                }
+                $elName = strtolower($elName);
+                if ('secure' == $elName) {
+                    $cookie['secure'] = true;
+                } elseif ('expires' == $elName) {
+                    $cookie['expires'] = str_replace('"', '', $elValue);
+                } elseif ('path' == $elName || 'domain' == $elName) {
+                    $cookie[$elName] = urldecode($elValue);
+                } else {
+                    $cookie[$elName] = $elValue;
+                }
+            }
+        }
+        $this->_cookies[] = $cookie;
+    }
+
+
+   /**
+    * Read a part of response body encoded with chunked Transfer-Encoding
+    * 
+    * @access private
+    * @return string
+    */
+    function _readChunked()
+    {
+        // at start of the next chunk?
+        if (0 == $this->_chunkLength) {
+            $line = $this->_sock->readLine();
+            if (preg_match('/^([0-9a-f]+)/i', $line, $matches)) {
+                $this->_chunkLength = hexdec($matches[1]); 
+                // Chunk with zero length indicates the end
+                if (0 == $this->_chunkLength) {
+                    $this->_sock->readLine(); // make this an eof()
+                    return '';
+                }
+            } else {
+                return '';
+            }
+        }
+        $data = $this->_sock->read($this->_chunkLength);
+        $this->_chunkLength -= strlen($data);
+        if (0 == $this->_chunkLength) {
+            $this->_sock->readLine(); // Trailing CRLF
+        }
+        return $data;
+    }
+
+
+   /**
+    * Notifies all registered listeners of an event.
+    * 
+    * @param    string  Event name
+    * @param    mixed   Additional data
+    * @access   private
+    * @see HTTP_Request::_notify()
+    */
+    function _notify($event, $data = null)
+    {
+        foreach (array_keys($this->_listeners) as $id) {
+            $this->_listeners[$id]->update($this, $event, $data);
+        }
+    }
+
+
+   /**
+    * Decodes the message-body encoded by gzip
+    *
+    * The real decoding work is done by gzinflate() built-in function, this
+    * method only parses the header and checks data for compliance with
+    * RFC 1952  
+    *
+    * @access   private
+    * @param    string  gzip-encoded data
+    * @return   string  decoded data
+    */
+    function _decodeGzip($data)
+    {
+        $length = strlen($data);
+        // If it doesn't look like gzip-encoded data, don't bother
+        if (18 > $length || strcmp(substr($data, 0, 2), "\x1f\x8b")) {
+            return $data;
+        }
+        $method = ord(substr($data, 2, 1));
+        if (8 != $method) {
+            return PEAR::raiseError('_decodeGzip(): unknown compression method');
+        }
+        $flags = ord(substr($data, 3, 1));
+        if ($flags & 224) {
+            return PEAR::raiseError('_decodeGzip(): reserved bits are set');
+        }
+
+        // header is 10 bytes minimum. may be longer, though.
+        $headerLength = 10;
+        // extra fields, need to skip 'em
+        if ($flags & 4) {
+            if ($length - $headerLength - 2 < 8) {
+                return PEAR::raiseError('_decodeGzip(): data too short');
+            }
+            $extraLength = unpack('v', substr($data, 10, 2));
+            if ($length - $headerLength - 2 - $extraLength[1] < 8) {
+                return PEAR::raiseError('_decodeGzip(): data too short');
+            }
+            $headerLength += $extraLength[1] + 2;
+        }
+        // file name, need to skip that
+        if ($flags & 8) {
+            if ($length - $headerLength - 1 < 8) {
+                return PEAR::raiseError('_decodeGzip(): data too short');
+            }
+            $filenameLength = strpos(substr($data, $headerLength), chr(0));
+            if (false === $filenameLength || $length - $headerLength - $filenameLength - 1 < 8) {
+                return PEAR::raiseError('_decodeGzip(): data too short');
+            }
+            $headerLength += $filenameLength + 1;
+        }
+        // comment, need to skip that also
+        if ($flags & 16) {
+            if ($length - $headerLength - 1 < 8) {
+                return PEAR::raiseError('_decodeGzip(): data too short');
+            }
+            $commentLength = strpos(substr($data, $headerLength), chr(0));
+            if (false === $commentLength || $length - $headerLength - $commentLength - 1 < 8) {
+                return PEAR::raiseError('_decodeGzip(): data too short');
+            }
+            $headerLength += $commentLength + 1;
+        }
+        // have a CRC for header. let's check
+        if ($flags & 1) {
+            if ($length - $headerLength - 2 < 8) {
+                return PEAR::raiseError('_decodeGzip(): data too short');
+            }
+            $crcReal   = 0xffff & crc32(substr($data, 0, $headerLength));
+            $crcStored = unpack('v', substr($data, $headerLength, 2));
+            if ($crcReal != $crcStored[1]) {
+                return PEAR::raiseError('_decodeGzip(): header CRC check failed');
+            }
+            $headerLength += 2;
+        }
+        // unpacked data CRC and size at the end of encoded data
+        $tmp = unpack('V2', substr($data, -8));
+        $dataCrc  = $tmp[1];
+        $dataSize = $tmp[2];
+
+        // finally, call the gzinflate() function
+        $unpacked = @gzinflate(substr($data, $headerLength, -8), $dataSize);
+        if (false === $unpacked) {
+            return PEAR::raiseError('_decodeGzip(): gzinflate() call failed');
+        } elseif ($dataSize != strlen($unpacked)) {
+            return PEAR::raiseError('_decodeGzip(): data size check failed');
+        } elseif ($dataCrc != crc32($unpacked)) {
+            return PEAR::raiseError('_decodeGzip(): data CRC check failed');
+        }
+        return $unpacked;
+    }
+} // End class HTTP_Response
+?>
Index: /branches/mobile/data/module/Smarty/libs/Smarty.class.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/Smarty.class.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/Config_File.class.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/Config_File.class.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.display_debug_console.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.display_debug_console.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.get_php_resource.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.get_php_resource.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.process_compiled_include.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.process_compiled_include.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.read_cache_file.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.read_cache_file.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.get_include_path.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.get_include_path.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.assign_smarty_interface.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.assign_smarty_interface.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.load_resource_plugin.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.load_resource_plugin.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.rm_auto.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.rm_auto.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.write_compiled_include.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.write_compiled_include.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.process_cached_inserts.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.process_cached_inserts.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.write_cache_file.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.write_cache_file.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.write_compiled_resource.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.write_compiled_resource.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.rmdir.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.rmdir.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.load_plugins.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.load_plugins.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.create_dir_structure.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.create_dir_structure.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.is_secure.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.is_secure.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.run_insert_handler.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.run_insert_handler.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.assemble_plugin_filepath.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.assemble_plugin_filepath.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.is_trusted.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.is_trusted.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.get_microtime.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.get_microtime.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.write_file.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.write_file.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/internals/core.smarty_include_php.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/internals/core.smarty_include_php.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.string_format.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.string_format.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.eval.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.eval.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.strip_tags.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.strip_tags.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.nl2br.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.nl2br.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.default.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.default.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.date_format.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.date_format.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.capitalize.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.capitalize.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.cycle.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.cycle.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.count_characters.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.count_characters.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.lower.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.lower.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/block.textformat.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/block.textformat.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.popup.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.popup.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.assign_debug_info.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.assign_debug_info.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.html_radios.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.html_radios.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/outputfilter.trimwhitespace.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/outputfilter.trimwhitespace.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.html_table.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.html_table.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.regex_replace.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.regex_replace.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.wordwrap.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.wordwrap.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.counter.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.counter.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.html_options.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.html_options.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.html_select_time.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.html_select_time.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/shared.make_timestamp.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/shared.make_timestamp.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.mailto.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.mailto.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.popup_init.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.popup_init.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.debug.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.debug.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.math.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.math.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.fetch.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.fetch.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.indent.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.indent.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.truncate.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.truncate.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.html_select_date.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.html_select_date.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/shared.escape_special_chars.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/shared.escape_special_chars.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.html_checkboxes.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.html_checkboxes.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.config_load.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.config_load.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.upper.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.upper.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/function.html_image.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/function.html_image.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.spacify.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.spacify.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.count_sentences.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.count_sentences.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/compiler.assign.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/compiler.assign.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.count_paragraphs.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.count_paragraphs.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.escape.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.escape.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.strip.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.strip.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.count_words.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.count_words.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.cat.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.cat.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.debug_print_var.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.debug_print_var.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/plugins/modifier.replace.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/plugins/modifier.replace.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/libs/Smarty_Compiler.class.php
===================================================================
--- /branches/mobile/data/module/Smarty/libs/Smarty_Compiler.class.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/unit_test/config.php
===================================================================
--- /branches/mobile/data/module/Smarty/unit_test/config.php	(revision 1328)
+++ /branches/mobile/data/module/Smarty/unit_test/config.php	(revision 1328)
@@ -0,0 +1,5 @@
+<?php
+
+define('SMARTY_DIR', '../libs/');
+
+?>
Index: /branches/mobile/data/module/Smarty/unit_test/smarty_unit_test.php
===================================================================
--- /branches/mobile/data/module/Smarty/unit_test/smarty_unit_test.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/unit_test/test_cases.php
===================================================================
--- /branches/mobile/data/module/Smarty/unit_test/test_cases.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/unit_test/smarty_unit_test_gui.php
===================================================================
--- /branches/mobile/data/module/Smarty/unit_test/smarty_unit_test_gui.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Smarty/demo/index.php
===================================================================
--- /branches/mobile/data/module/Smarty/demo/index.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/module/Mail/mimePart.php
===================================================================
--- /branches/mobile/data/module/Mail/mimePart.php	(revision 11406)
+++ /branches/mobile/data/module/Mail/mimePart.php	(revision 11406)
@@ -0,0 +1,351 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002-2003  Richard Heyes                                     |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.|
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Richard Heyes <richard@phpguru.org>                           |
+// +-----------------------------------------------------------------------+
+
+/**
+*
+*  Raw mime encoding class
+*
+* What is it?
+*   This class enables you to manipulate and build
+*   a mime email from the ground up.
+*
+* Why use this instead of mime.php?
+*   mime.php is a userfriendly api to this class for
+*   people who aren't interested in the internals of
+*   mime mail. This class however allows full control
+*   over the email.
+*
+* Eg.
+*
+* // Since multipart/mixed has no real body, (the body is
+* // the subpart), we set the body argument to blank.
+*
+* $params['content_type'] = 'multipart/mixed';
+* $email = new Mail_mimePart('', $params);
+*
+* // Here we add a text part to the multipart we have
+* // already. Assume $body contains plain text.
+*
+* $params['content_type'] = 'text/plain';
+* $params['encoding']     = '7bit';
+* $text = $email->addSubPart($body, $params);
+*
+* // Now add an attachment. Assume $attach is
+* the contents of the attachment
+*
+* $params['content_type'] = 'application/zip';
+* $params['encoding']     = 'base64';
+* $params['disposition']  = 'attachment';
+* $params['dfilename']    = 'example.zip';
+* $attach =& $email->addSubPart($body, $params);
+*
+* // Now build the email. Note that the encode
+* // function returns an associative array containing two
+* // elements, body and headers. You will need to add extra
+* // headers, (eg. Mime-Version) before sending.
+*
+* $email = $message->encode();
+* $email['headers'][] = 'Mime-Version: 1.0';
+*
+*
+* Further examples are available at http://www.phpguru.org
+*
+* TODO:
+*  - Set encode() to return the $obj->encoded if encode()
+*    has already been run. Unless a flag is passed to specifically
+*    re-build the message.
+*
+* @author  Richard Heyes <richard@phpguru.org>
+* @version $Revision: 1.13 $
+* @package Mail
+*/
+
+class Mail_mimePart {
+
+   /**
+    * The encoding type of this part
+    * @var string
+    */
+    var $_encoding;
+
+   /**
+    * An array of subparts
+    * @var array
+    */
+    var $_subparts;
+
+   /**
+    * The output of this part after being built
+    * @var string
+    */
+    var $_encoded;
+
+   /**
+    * Headers for this part
+    * @var array
+    */
+    var $_headers;
+
+   /**
+    * The body of this part (not encoded)
+    * @var string
+    */
+    var $_body;
+
+    /**
+     * Constructor.
+     *
+     * Sets up the object.
+     *
+     * @param $body   - The body of the mime part if any.
+     * @param $params - An associative array of parameters:
+     *                  content_type - The content type for this part eg multipart/mixed
+     *                  encoding     - The encoding to use, 7bit, 8bit, base64, or quoted-printable
+     *                  cid          - Content ID to apply
+     *                  disposition  - Content disposition, inline or attachment
+     *                  dfilename    - Optional filename parameter for content disposition
+     *                  description  - Content description
+     *                  charset      - Character set to use
+     * @access public
+     */
+    function Mail_mimePart($body = '', $params = array())
+    {
+        if (!defined('MAIL_MIMEPART_CRLF')) {
+            define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", TRUE);
+        }
+
+        foreach ($params as $key => $value) {
+            switch ($key) {
+                case 'content_type':
+                    $headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : '');
+                    break;
+
+                case 'encoding':
+                    $this->_encoding = $value;
+                    $headers['Content-Transfer-Encoding'] = $value;
+                    break;
+
+                case 'cid':
+                    $headers['Content-ID'] = '<' . $value . '>';
+                    break;
+
+                case 'disposition':
+                    $headers['Content-Disposition'] = $value . (isset($dfilename) ? '; filename="' . $dfilename . '"' : '');
+                    break;
+
+                case 'dfilename':
+                    if (isset($headers['Content-Disposition'])) {
+                        $headers['Content-Disposition'] .= '; filename="' . $value . '"';
+                    } else {
+                        $dfilename = $value;
+                    }
+                    break;
+
+                case 'description':
+                    $headers['Content-Description'] = $value;
+                    break;
+
+                case 'charset':
+                    if (isset($headers['Content-Type'])) {
+                        $headers['Content-Type'] .= '; charset="' . $value . '"';
+                    } else {
+                        $charset = $value;
+                    }
+                    break;
+            }
+        }
+
+        // Default content-type
+        if (!isset($headers['Content-Type'])) {
+            $headers['Content-Type'] = 'text/plain';
+        }
+
+        //Default encoding
+        if (!isset($this->_encoding)) {
+            $this->_encoding = '7bit';
+        }
+
+        // Assign stuff to member variables
+        $this->_encoded  = array();
+        $this->_headers  = $headers;
+        $this->_body     = $body;
+    }
+
+    /**
+     * encode()
+     *
+     * Encodes and returns the email. Also stores
+     * it in the encoded member variable
+     *
+     * @return An associative array containing two elements,
+     *         body and headers. The headers element is itself
+     *         an indexed array.
+     * @access public
+     */
+    function encode()
+    {
+        $encoded =& $this->_encoded;
+
+        if (!empty($this->_subparts)) {
+            srand((double)microtime()*1000000);
+            $boundary = '=_' . md5(rand() . microtime());
+            $this->_headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF . "\t" . 'boundary="' . $boundary . '"';
+
+            // Add body parts to $subparts
+            for ($i = 0; $i < count($this->_subparts); $i++) {
+                $headers = array();
+                $tmp = $this->_subparts[$i]->encode();
+                foreach ($tmp['headers'] as $key => $value) {
+                    $headers[] = $key . ': ' . $value;
+                }
+                $subparts[] = implode(MAIL_MIMEPART_CRLF, $headers) . MAIL_MIMEPART_CRLF . MAIL_MIMEPART_CRLF . $tmp['body'];
+            }
+
+            $encoded['body'] = '--' . $boundary . MAIL_MIMEPART_CRLF .
+                               implode('--' . $boundary . MAIL_MIMEPART_CRLF, $subparts) .
+                               '--' . $boundary.'--' . MAIL_MIMEPART_CRLF;
+
+        } else {
+            $encoded['body'] = $this->_getEncodedData($this->_body, $this->_encoding) . MAIL_MIMEPART_CRLF;
+        }
+
+        // Add headers to $encoded
+        $encoded['headers'] =& $this->_headers;
+
+        return $encoded;
+    }
+
+    /**
+     * &addSubPart()
+     *
+     * Adds a subpart to current mime part and returns
+     * a reference to it
+     *
+     * @param $body   The body of the subpart, if any.
+     * @param $params The parameters for the subpart, same
+     *                as the $params argument for constructor.
+     * @return A reference to the part you just added. It is
+     *         crucial if using multipart/* in your subparts that
+     *         you use =& in your script when calling this function,
+     *         otherwise you will not be able to add further subparts.
+     * @access public
+     */
+    function &addSubPart($body, $params)
+    {
+        $this->_subparts[] = new Mail_mimePart($body, $params);
+        return $this->_subparts[count($this->_subparts) - 1];
+    }
+
+    /**
+     * _getEncodedData()
+     *
+     * Returns encoded data based upon encoding passed to it
+     *
+     * @param $data     The data to encode.
+     * @param $encoding The encoding type to use, 7bit, base64,
+     *                  or quoted-printable.
+     * @access private
+     */
+    function _getEncodedData($data, $encoding)
+    {
+        switch ($encoding) {
+            case '8bit':
+            case '7bit':
+                return $data;
+                break;
+
+            case 'quoted-printable':
+                return $this->_quotedPrintableEncode($data);
+                break;
+
+            case 'base64':
+                return rtrim(chunk_split(base64_encode($data), 76, MAIL_MIMEPART_CRLF));
+                break;
+
+            default:
+                return $data;
+        }
+    }
+
+    /**
+     * quoteadPrintableEncode()
+     *
+     * Encodes data to quoted-printable standard.
+     *
+     * @param $input    The data to encode
+     * @param $line_max Optional max line length. Should
+     *                  not be more than 76 chars
+     *
+     * @access private
+     */
+    function _quotedPrintableEncode($input , $line_max = 76)
+    {
+        $lines  = preg_split("/\r?\n/", $input);
+        $eol    = MAIL_MIMEPART_CRLF;
+        $escape = '=';
+        $output = '';
+
+        while(list(, $line) = each($lines)){
+
+            $linlen     = strlen($line);
+            $newline = '';
+
+            for ($i = 0; $i < $linlen; $i++) {
+                $char = substr($line, $i, 1);
+                $dec  = ord($char);
+
+                if (($dec == 32) AND ($i == ($linlen - 1))){    // convert space at eol only
+                    $char = '=20';
+
+                } elseif(($dec == 9) AND ($i == ($linlen - 1))) {  // convert tab at eol only
+                    $char = '=09';
+                } elseif($dec == 9) {
+                    ; // Do nothing if a tab.
+                } elseif(($dec == 61) OR ($dec < 32 ) OR ($dec > 126)) {
+                    $char = $escape . strtoupper(sprintf('%02s', dechex($dec)));
+                }
+
+                if ((strlen($newline) + strlen($char)) >= $line_max) {        // MAIL_MIMEPART_CRLF is not counted
+                    $output  .= $newline . $escape . $eol;                    // soft line break; " =\r\n" is okay
+                    $newline  = '';
+                }
+                $newline .= $char;
+            } // end of for
+            $output .= $newline . $eol;
+        }
+        $output = substr($output, 0, -1 * strlen($eol)); // Don't want last crlf
+        return $output;
+    }
+} // End of class
+?>
Index: /branches/mobile/data/module/Mail/mime.php
===================================================================
--- /branches/mobile/data/module/Mail/mime.php	(revision 11406)
+++ /branches/mobile/data/module/Mail/mime.php	(revision 11406)
@@ -0,0 +1,713 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002-2003  Richard Heyes                                |
+// | Copyright (c) 2003-2005  The PHP Group                                |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.|
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Richard Heyes <richard@phpguru.org>                           |
+// |         Tomas V.V.Cox <cox@idecnet.com> (port to PEAR)                |
+// +-----------------------------------------------------------------------+
+//
+// $Id: mime.php,v 1.39 2005/06/13 21:24:16 cipri Exp $
+
+require_once(dirname(__FILE__) . '/../PEAR.php');
+require_once(dirname(__FILE__) . '/mimePart.php');
+
+/**
+ * Mime mail composer class. Can handle: text and html bodies, embedded html
+ * images and attachments.
+ * Documentation and examples of this class are avaible here:
+ * http://pear.php.net/manual/
+ *
+ * @notes This class is based on HTML Mime Mail class from
+ *   Richard Heyes <richard@phpguru.org> which was based also
+ *   in the mime_mail.class by Tobias Ratschiller <tobias@dnet.it> and
+ *   Sascha Schumann <sascha@schumann.cx>
+ *
+ * @author   Richard Heyes <richard.heyes@heyes-computing.net>
+ * @author   Tomas V.V.Cox <cox@idecnet.com>
+ * @package  Mail
+ * @access   public
+ */
+class Mail_mime
+{
+    /**
+     * Contains the plain text part of the email
+     * @var string
+     */
+    var $_txtbody;
+    /**
+     * Contains the html part of the email
+     * @var string
+     */
+    var $_htmlbody;
+    /**
+     * contains the mime encoded text
+     * @var string
+     */
+    var $_mime;
+    /**
+     * contains the multipart content
+     * @var string
+     */
+    var $_multipart;
+    /**
+     * list of the attached images
+     * @var array
+     */
+    var $_html_images = array();
+    /**
+     * list of the attachements
+     * @var array
+     */
+    var $_parts = array();
+    /**
+     * Build parameters
+     * @var array
+     */
+    var $_build_params = array();
+    /**
+     * Headers for the mail
+     * @var array
+     */
+    var $_headers = array();
+    /**
+     * End Of Line sequence (for serialize)
+     * @var string
+     */
+    var $_eol;
+
+
+    /**
+     * Constructor function
+     *
+     * @access public
+     */
+    function Mail_mime($crlf = "\r\n")
+    {
+        $this->_setEOL($crlf);
+        $this->_build_params = array(
+                                     'text_encoding' => '7bit',
+                                     'html_encoding' => 'quoted-printable',
+                                     '7bit_wrap'     => 998,
+                                     'html_charset'  => 'ISO-8859-1',
+                                     'text_charset'  => 'ISO-8859-1',
+                                     'head_charset'  => 'ISO-8859-1'
+                                    );
+    }
+
+    /**
+     * Wakeup (unserialize) - re-sets EOL constant
+     *
+     * @access private
+     */
+    function __wakeup()
+    {
+        $this->_setEOL($this->_eol);
+    }
+
+    /**
+     * Accessor function to set the body text. Body text is used if
+     * it's not an html mail being sent or else is used to fill the
+     * text/plain part that emails clients who don't support
+     * html should show.
+     *
+     * @param  string  $data   Either a string or
+     *                         the file name with the contents
+     * @param  bool    $isfile If true the first param should be treated
+     *                         as a file name, else as a string (default)
+     * @param  bool    $append If true the text or file is appended to
+     *                         the existing body, else the old body is
+     *                         overwritten
+     * @return mixed   true on success or PEAR_Error object
+     * @access public
+     */
+    function setTXTBody($data, $isfile = false, $append = false)
+    {
+        if (!$isfile) {
+            if (!$append) {
+                $this->_txtbody = $data;
+            } else {
+                $this->_txtbody .= $data;
+            }
+        } else {
+            $cont = $this->_file2str($data);
+            if (PEAR::isError($cont)) {
+                return $cont;
+            }
+            if (!$append) {
+                $this->_txtbody = $cont;
+            } else {
+                $this->_txtbody .= $cont;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Adds a html part to the mail
+     *
+     * @param  string  $data   Either a string or the file name with the
+     *                         contents
+     * @param  bool    $isfile If true the first param should be treated
+     *                         as a file name, else as a string (default)
+     * @return mixed   true on success or PEAR_Error object
+     * @access public
+     */
+    function setHTMLBody($data, $isfile = false)
+    {
+        if (!$isfile) {
+            $this->_htmlbody = $data;
+        } else {
+            $cont = $this->_file2str($data);
+            if (PEAR::isError($cont)) {
+                return $cont;
+            }
+            $this->_htmlbody = $cont;
+        }
+
+        return true;
+    }
+
+    /**
+     * Adds an image to the list of embedded images.
+     *
+     * @param  string  $file       The image file name OR image data itself
+     * @param  string  $c_type     The content type
+     * @param  string  $name       The filename of the image.
+     *                             Only use if $file is the image data
+     * @param  bool    $isfilename Whether $file is a filename or not
+     *                             Defaults to true
+     * @return mixed   true on success or PEAR_Error object
+     * @access public
+     */
+    function addHTMLImage($file, $c_type='application/octet-stream',
+                          $name = '', $isfilename = true)
+    {
+        $filedata = ($isfilename === true) ? $this->_file2str($file)
+                                           : $file;
+        if ($isfilename === true) {
+            $filename = ($name == '' ? basename($file) : basename($name));
+        } else {
+            $filename = basename($name);
+        }
+        if (PEAR::isError($filedata)) {
+            return $filedata;
+        }
+        $this->_html_images[] = array(
+                                      'body'   => $filedata,
+                                      'name'   => $filename,
+                                      'c_type' => $c_type,
+                                      'cid'    => md5(uniqid(time()))
+                                     );
+        return true;
+    }
+
+    /**
+     * Adds a file to the list of attachments.
+     *
+     * @param  string  $file       The file name of the file to attach
+     *                             OR the file data itself
+     * @param  string  $c_type     The content type
+     * @param  string  $name       The filename of the attachment
+     *                             Only use if $file is the file data
+     * @param  bool    $isFilename Whether $file is a filename or not
+     *                             Defaults to true
+     * @return mixed true on success or PEAR_Error object
+     * @access public
+     */
+    function addAttachment($file, $c_type = 'application/octet-stream',
+                           $name = '', $isfilename = true,
+                           $encoding = 'base64')
+    {
+        $filedata = ($isfilename === true) ? $this->_file2str($file)
+                                           : $file;
+        if ($isfilename === true) {
+            // Force the name the user supplied, otherwise use $file
+            $filename = (!empty($name)) ? $name : $file;
+        } else {
+            $filename = $name;
+        }
+        if (empty($filename)) {
+            return PEAR::raiseError(
+              'The supplied filename for the attachment can\'t be empty'
+            );
+        }
+        $filename = basename($filename);
+        if (PEAR::isError($filedata)) {
+            return $filedata;
+        }
+
+        $this->_parts[] = array(
+                                'body'     => $filedata,
+                                'name'     => $filename,
+                                'c_type'   => $c_type,
+                                'encoding' => $encoding
+                               );
+        return true;
+    }
+
+    /**
+     * Get the contents of the given file name as string
+     *
+     * @param  string  $file_name  path of file to process
+     * @return string  contents of $file_name
+     * @access private
+     */
+    function &_file2str($file_name)
+    {
+        if (!is_readable($file_name)) {
+            return PEAR::raiseError('File is not readable ' . $file_name);
+        }
+        if (!$fd = fopen($file_name, 'rb')) {
+            return PEAR::raiseError('Could not open ' . $file_name);
+        }
+        $filesize = filesize($file_name);
+        if ($filesize == 0){
+            $cont =  "";
+        }else{
+            $cont = fread($fd, $filesize);
+        }
+        fclose($fd);
+        return $cont;
+    }
+
+    /**
+     * Adds a text subpart to the mimePart object and
+     * returns it during the build process.
+     *
+     * @param mixed    The object to add the part to, or
+     *                 null if a new object is to be created.
+     * @param string   The text to add.
+     * @return object  The text mimePart object
+     * @access private
+     */
+    function &_addTextPart(&$obj, $text)
+    {
+        $params['content_type'] = 'text/plain';
+        $params['encoding']     = $this->_build_params['text_encoding'];
+        $params['charset']      = $this->_build_params['text_charset'];
+        if (is_object($obj)) {
+            return $obj->addSubpart($text, $params);
+        } else {
+            return new Mail_mimePart($text, $params);
+        }
+    }
+
+    /**
+     * Adds a html subpart to the mimePart object and
+     * returns it during the build process.
+     *
+     * @param  mixed   The object to add the part to, or
+     *                 null if a new object is to be created.
+     * @return object  The html mimePart object
+     * @access private
+     */
+    function &_addHtmlPart(&$obj)
+    {
+        $params['content_type'] = 'text/html';
+        $params['encoding']     = $this->_build_params['html_encoding'];
+        $params['charset']      = $this->_build_params['html_charset'];
+        if (is_object($obj)) {
+            return $obj->addSubpart($this->_htmlbody, $params);
+        } else {
+            return new Mail_mimePart($this->_htmlbody, $params);
+        }
+    }
+
+    /**
+     * Creates a new mimePart object, using multipart/mixed as
+     * the initial content-type and returns it during the
+     * build process.
+     *
+     * @return object  The multipart/mixed mimePart object
+     * @access private
+     */
+    function &_addMixedPart()
+    {
+        $params['content_type'] = 'multipart/mixed';
+        return new Mail_mimePart('', $params);
+    }
+
+    /**
+     * Adds a multipart/alternative part to a mimePart
+     * object (or creates one), and returns it during
+     * the build process.
+     *
+     * @param  mixed   The object to add the part to, or
+     *                 null if a new object is to be created.
+     * @return object  The multipart/mixed mimePart object
+     * @access private
+     */
+    function &_addAlternativePart(&$obj)
+    {
+        $params['content_type'] = 'multipart/alternative';
+        if (is_object($obj)) {
+            return $obj->addSubpart('', $params);
+        } else {
+            return new Mail_mimePart('', $params);
+        }
+    }
+
+    /**
+     * Adds a multipart/related part to a mimePart
+     * object (or creates one), and returns it during
+     * the build process.
+     *
+     * @param mixed    The object to add the part to, or
+     *                 null if a new object is to be created
+     * @return object  The multipart/mixed mimePart object
+     * @access private
+     */
+    function &_addRelatedPart(&$obj)
+    {
+        $params['content_type'] = 'multipart/related';
+        if (is_object($obj)) {
+            return $obj->addSubpart('', $params);
+        } else {
+            return new Mail_mimePart('', $params);
+        }
+    }
+
+    /**
+     * Adds an html image subpart to a mimePart object
+     * and returns it during the build process.
+     *
+     * @param  object  The mimePart to add the image to
+     * @param  array   The image information
+     * @return object  The image mimePart object
+     * @access private
+     */
+    function &_addHtmlImagePart(&$obj, $value)
+    {
+        $params['content_type'] = $value['c_type'];
+        $params['encoding']     = 'base64';
+        $params['disposition']  = 'inline';
+        $params['dfilename']    = $value['name'];
+        $params['cid']          = $value['cid'];
+        $obj->addSubpart($value['body'], $params);
+    }
+
+    /**
+     * Adds an attachment subpart to a mimePart object
+     * and returns it during the build process.
+     *
+     * @param  object  The mimePart to add the image to
+     * @param  array   The attachment information
+     * @return object  The image mimePart object
+     * @access private
+     */
+    function &_addAttachmentPart(&$obj, $value)
+    {
+        $params['content_type'] = $value['c_type'];
+        $params['encoding']     = $value['encoding'];
+        $params['disposition']  = 'attachment';
+        $params['dfilename']    = $value['name'];
+        $obj->addSubpart($value['body'], $params);
+    }
+
+    /**
+     * Builds the multipart message from the list ($this->_parts) and
+     * returns the mime content.
+     *
+     * @param  array  Build parameters that change the way the email
+     *                is built. Should be associative. Can contain:
+     *                text_encoding  -  What encoding to use for plain text
+     *                                  Default is 7bit
+     *                html_encoding  -  What encoding to use for html
+     *                                  Default is quoted-printable
+     *                7bit_wrap      -  Number of characters before text is
+     *                                  wrapped in 7bit encoding
+     *                                  Default is 998
+     *                html_charset   -  The character set to use for html.
+     *                                  Default is iso-8859-1
+     *                text_charset   -  The character set to use for text.
+     *                                  Default is iso-8859-1
+     *                head_charset   -  The character set to use for headers.
+     *                                  Default is iso-8859-1
+     * @return string The mime content
+     * @access public
+     */
+    function &get($build_params = null)
+    {
+        if (isset($build_params)) {
+            while (list($key, $value) = each($build_params)) {
+                $this->_build_params[$key] = $value;
+            }
+        }
+
+        if (!empty($this->_html_images) AND isset($this->_htmlbody)) {
+            foreach ($this->_html_images as $value) {
+                $regex = '#(\s)((?i)src|background|href(?-i))\s*=\s*(["\']?)' . preg_quote($value['name'], '#') .
+                         '\3#';
+                $rep = '\1\2=\3cid:' . $value['cid'] .'\3';
+                $this->_htmlbody = preg_replace($regex, $rep,
+                                       $this->_htmlbody
+                                   );
+            }
+        }
+
+        $null        = null;
+        $attachments = !empty($this->_parts)                ? true : false;
+        $html_images = !empty($this->_html_images)          ? true : false;
+        $html        = !empty($this->_htmlbody)             ? true : false;
+        $text        = (!$html AND !empty($this->_txtbody)) ? true : false;
+
+        switch (true) {
+        case $text AND !$attachments:
+            $message =& $this->_addTextPart($null, $this->_txtbody);
+            break;
+
+        case !$text AND !$html AND $attachments:
+            $message =& $this->_addMixedPart();
+            for ($i = 0; $i < count($this->_parts); $i++) {
+                $this->_addAttachmentPart($message, $this->_parts[$i]);
+            }
+            break;
+
+        case $text AND $attachments:
+            $message =& $this->_addMixedPart();
+            $this->_addTextPart($message, $this->_txtbody);
+            for ($i = 0; $i < count($this->_parts); $i++) {
+                $this->_addAttachmentPart($message, $this->_parts[$i]);
+            }
+            break;
+
+        case $html AND !$attachments AND !$html_images:
+            if (isset($this->_txtbody)) {
+                $message =& $this->_addAlternativePart($null);
+                $this->_addTextPart($message, $this->_txtbody);
+                $this->_addHtmlPart($message);
+            } else {
+                $message =& $this->_addHtmlPart($null);
+            }
+            break;
+
+        case $html AND !$attachments AND $html_images:
+            if (isset($this->_txtbody)) {
+                $message =& $this->_addAlternativePart($null);
+                $this->_addTextPart($message, $this->_txtbody);
+                $related =& $this->_addRelatedPart($message);
+            } else {
+                $message =& $this->_addRelatedPart($null);
+                $related =& $message;
+            }
+            $this->_addHtmlPart($related);
+            for ($i = 0; $i < count($this->_html_images); $i++) {
+                $this->_addHtmlImagePart($related, $this->_html_images[$i]);
+            }
+            break;
+
+        case $html AND $attachments AND !$html_images:
+            $message =& $this->_addMixedPart();
+            if (isset($this->_txtbody)) {
+                $alt =& $this->_addAlternativePart($message);
+                $this->_addTextPart($alt, $this->_txtbody);
+                $this->_addHtmlPart($alt);
+            } else {
+                $this->_addHtmlPart($message);
+            }
+            for ($i = 0; $i < count($this->_parts); $i++) {
+                $this->_addAttachmentPart($message, $this->_parts[$i]);
+            }
+            break;
+
+        case $html AND $attachments AND $html_images:
+            $message =& $this->_addMixedPart();
+            if (isset($this->_txtbody)) {
+                $alt =& $this->_addAlternativePart($message);
+                $this->_addTextPart($alt, $this->_txtbody);
+                $rel =& $this->_addRelatedPart($alt);
+            } else {
+                $rel =& $this->_addRelatedPart($message);
+            }
+            $this->_addHtmlPart($rel);
+            for ($i = 0; $i < count($this->_html_images); $i++) {
+                $this->_addHtmlImagePart($rel, $this->_html_images[$i]);
+            }
+            for ($i = 0; $i < count($this->_parts); $i++) {
+                $this->_addAttachmentPart($message, $this->_parts[$i]);
+            }
+            break;
+
+        }
+
+        if (isset($message)) {
+            $output = $message->encode();
+            $this->_headers = array_merge($this->_headers,
+                                          $output['headers']);
+            return $output['body'];
+
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Returns an array with the headers needed to prepend to the email
+     * (MIME-Version and Content-Type). Format of argument is:
+     * $array['header-name'] = 'header-value';
+     *
+     * @param  array $xtra_headers Assoc array with any extra headers.
+     *                             Optional.
+     * @return array Assoc array with the mime headers
+     * @access public
+     */
+    function &headers($xtra_headers = null)
+    {
+        // Content-Type header should already be present,
+        // So just add mime version header
+        $headers['MIME-Version'] = '1.0';
+        if (isset($xtra_headers)) {
+            $headers = array_merge($headers, $xtra_headers);
+        }
+        $this->_headers = array_merge($headers, $this->_headers);
+
+        return $this->_encodeHeaders($this->_headers);
+    }
+
+    /**
+     * Get the text version of the headers
+     * (usefull if you want to use the PHP mail() function)
+     *
+     * @param  array   $xtra_headers Assoc array with any extra headers.
+     *                               Optional.
+     * @return string  Plain text headers
+     * @access public
+     */
+    function txtHeaders($xtra_headers = null)
+    {
+        $headers = $this->headers($xtra_headers);
+        $ret = '';
+        foreach ($headers as $key => $val) {
+            $ret .= "$key: $val" . MAIL_MIME_CRLF;
+        }
+        return $ret;
+    }
+
+    /**
+     * Sets the Subject header
+     *
+     * @param  string $subject String to set the subject to
+     * access  public
+     */
+    function setSubject($subject)
+    {
+        $this->_headers['Subject'] = $subject;
+    }
+
+    /**
+     * Set an email to the From (the sender) header
+     *
+     * @param  string $email The email direction to add
+     * @access public
+     */
+    function setFrom($email)
+    {
+        $this->_headers['From'] = $email;
+    }
+
+    /**
+     * Add an email to the Cc (carbon copy) header
+     * (multiple calls to this method are allowed)
+     *
+     * @param  string $email The email direction to add
+     * @access public
+     */
+    function addCc($email)
+    {
+        if (isset($this->_headers['Cc'])) {
+            $this->_headers['Cc'] .= ", $email";
+        } else {
+            $this->_headers['Cc'] = $email;
+        }
+    }
+
+    /**
+     * Add an email to the Bcc (blank carbon copy) header
+     * (multiple calls to this method are allowed)
+     *
+     * @param  string $email The email direction to add
+     * @access public
+     */
+    function addBcc($email)
+    {
+        if (isset($this->_headers['Bcc'])) {
+            $this->_headers['Bcc'] .= ", $email";
+        } else {
+            $this->_headers['Bcc'] = $email;
+        }
+    }
+
+    /**
+     * Encodes a header as per RFC2047
+     *
+     * @param  string  $input The header data to encode
+     * @return string  Encoded data
+     * @access private
+     */
+    function _encodeHeaders($input)
+    {
+        foreach ($input as $hdr_name => $hdr_value) {
+            preg_match_all('/(\w*[\x80-\xFF]+\w*)/', $hdr_value, $matches);
+            foreach ($matches[1] as $value) {
+                $replacement = preg_replace('/([\x80-\xFF])/e',
+                                            '"=" .
+                                            strtoupper(dechex(ord("\1")))',
+                                            $value);
+                $hdr_value = str_replace($value, '=?' .
+                                         $this->_build_params['head_charset'] .
+                                         '?Q?' . $replacement . '?=',
+                                         $hdr_value);
+            }
+            $input[$hdr_name] = $hdr_value;
+        }
+
+        return $input;
+    }
+
+    /**
+     * Set the object's end-of-line and define the constant if applicable
+     *
+     * @param string $eol End Of Line sequence
+     * @access private
+     */
+    function _setEOL($eol)
+    {
+        $this->_eol = $eol;
+        if (!defined('MAIL_MIME_CRLF')) {
+            define('MAIL_MIME_CRLF', $this->_eol, true);
+        }
+    }
+
+    
+
+} // End of class
+?>
Index: /branches/mobile/data/module/Mail/mimeDecode.php
===================================================================
--- /branches/mobile/data/module/Mail/mimeDecode.php	(revision 11406)
+++ /branches/mobile/data/module/Mail/mimeDecode.php	(revision 11406)
@@ -0,0 +1,837 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+// +-----------------------------------------------------------------------+
+// | Copyright (c) 2002-2003  Richard Heyes                                |
+// | Copyright (c) 2003-2005  The PHP Group                                |
+// | All rights reserved.                                                  |
+// |                                                                       |
+// | Redistribution and use in source and binary forms, with or without    |
+// | modification, are permitted provided that the following conditions    |
+// | are met:                                                              |
+// |                                                                       |
+// | o Redistributions of source code must retain the above copyright      |
+// |   notice, this list of conditions and the following disclaimer.       |
+// | o Redistributions in binary form must reproduce the above copyright   |
+// |   notice, this list of conditions and the following disclaimer in the |
+// |   documentation and/or other materials provided with the distribution.|
+// | o The names of the authors may not be used to endorse or promote      |
+// |   products derived from this software without specific prior written  |
+// |   permission.                                                         |
+// |                                                                       |
+// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
+// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
+// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
+// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
+// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
+// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
+// |                                                                       |
+// +-----------------------------------------------------------------------+
+// | Author: Richard Heyes <richard@phpguru.org>                           |
+// +-----------------------------------------------------------------------+
+
+require_once dirname(__FILE__) . '/../PEAR.php';
+
+/**
+*  +----------------------------- IMPORTANT ------------------------------+
+*  | Usage of this class compared to native php extensions such as        |
+*  | mailparse or imap, is slow and may be feature deficient. If available|
+*  | you are STRONGLY recommended to use the php extensions.              |
+*  +----------------------------------------------------------------------+
+*
+* Mime Decoding class
+*
+* This class will parse a raw mime email and return
+* the structure. Returned structure is similar to
+* that returned by imap_fetchstructure().
+*
+* USAGE: (assume $input is your raw email)
+*
+* $decode = new Mail_mimeDecode($input, "\r\n");
+* $structure = $decode->decode();
+* print_r($structure);
+*
+* Or statically:
+*
+* $params['input'] = $input;
+* $structure = Mail_mimeDecode::decode($params);
+* print_r($structure);
+*
+* TODO:
+*  o Implement multipart/appledouble
+*  o UTF8: ???
+
+		> 4. We have also found a solution for decoding the UTF-8 
+		> headers. Therefore I made the following function:
+		> 
+		> function decode_utf8($txt) {
+		> $trans=array("Å&#8216;"=>"Ãµ","Å±"=>"Ã»","Å"=>"Ã&#8226;","Å°"
+		=>"Ã&#8250;");
+		> $txt=strtr($txt,$trans);
+		> return(utf8_decode($txt));
+		> }
+		> 
+		> And I have inserted the following line to the class:
+		> 
+		> if (strtolower($charset)=="utf-8") $text=decode_utf8($text);
+		> 
+		> ... before the following one in the "_decodeHeader" function:
+		> 
+		> $input = str_replace($encoded, $text, $input);
+		> 
+		> This way from now on it can easily decode the UTF-8 headers too.
+
+*
+* @author  Richard Heyes <richard@phpguru.org>
+* @version $Revision: 1.46 $
+* @package Mail
+*/
+class Mail_mimeDecode extends PEAR
+{
+    /**
+     * The raw email to decode
+     * @var    string
+     */
+    var $_input;
+
+    /**
+     * The header part of the input
+     * @var    string
+     */
+    var $_header;
+
+    /**
+     * The body part of the input
+     * @var    string
+     */
+    var $_body;
+
+    /**
+     * If an error occurs, this is used to store the message
+     * @var    string
+     */
+    var $_error;
+
+    /**
+     * Flag to determine whether to include bodies in the
+     * returned object.
+     * @var    boolean
+     */
+    var $_include_bodies;
+
+    /**
+     * Flag to determine whether to decode bodies
+     * @var    boolean
+     */
+    var $_decode_bodies;
+
+    /**
+     * Flag to determine whether to decode headers
+     * @var    boolean
+     */
+    var $_decode_headers;
+
+    /**
+     * Constructor.
+     *
+     * Sets up the object, initialise the variables, and splits and
+     * stores the header and body of the input.
+     *
+     * @param string The input to decode
+     * @access public
+     */
+    function Mail_mimeDecode($input)
+    {
+        list($header, $body)   = $this->_splitBodyHeader($input);
+
+        $this->_input          = $input;
+        $this->_header         = $header;
+        $this->_body           = $body;
+        $this->_decode_bodies  = false;
+        $this->_include_bodies = true;
+    }
+
+    /**
+     * Begins the decoding process. If called statically
+     * it will create an object and call the decode() method
+     * of it.
+     *
+     * @param array An array of various parameters that determine
+     *              various things:
+     *              include_bodies - Whether to include the body in the returned
+     *                               object.
+     *              decode_bodies  - Whether to decode the bodies
+     *                               of the parts. (Transfer encoding)
+     *              decode_headers - Whether to decode headers
+     *              input          - If called statically, this will be treated
+     *                               as the input
+     * @return object Decoded results
+     * @access public
+     */
+    function decode($params = null)
+    {
+        // determine if this method has been called statically
+        $isStatic = !(isset($this) && get_class($this) == __CLASS__);
+
+        // Have we been called statically?
+	// If so, create an object and pass details to that.
+        if ($isStatic AND isset($params['input'])) {
+
+            $obj = new Mail_mimeDecode($params['input']);
+            $structure = $obj->decode($params);
+
+        // Called statically but no input
+        } elseif ($isStatic) {
+            return PEAR::raiseError('Called statically and no input given');
+
+        // Called via an object
+        } else {
+            $this->_include_bodies = isset($params['include_bodies']) ?
+	                             $params['include_bodies'] : false;
+            $this->_decode_bodies  = isset($params['decode_bodies']) ?
+	                             $params['decode_bodies']  : false;
+            $this->_decode_headers = isset($params['decode_headers']) ?
+	                             $params['decode_headers'] : false;
+
+            $structure = $this->_decode($this->_header, $this->_body);
+            if ($structure === false) {
+                $structure = $this->raiseError($this->_error);
+            }
+        }
+
+        return $structure;
+    }
+
+    /**
+     * Performs the decoding. Decodes the body string passed to it
+     * If it finds certain content-types it will call itself in a
+     * recursive fashion
+     *
+     * @param string Header section
+     * @param string Body section
+     * @return object Results of decoding process
+     * @access private
+     */
+    function _decode($headers, $body, $default_ctype = 'text/plain')
+    {
+        $return = new stdClass;
+        $return->headers = array();
+        $headers = $this->_parseHeaders($headers);
+
+        foreach ($headers as $value) {
+            if (isset($return->headers[strtolower($value['name'])]) AND !is_array($return->headers[strtolower($value['name'])])) {
+                $return->headers[strtolower($value['name'])]   = array($return->headers[strtolower($value['name'])]);
+                $return->headers[strtolower($value['name'])][] = $value['value'];
+
+            } elseif (isset($return->headers[strtolower($value['name'])])) {
+                $return->headers[strtolower($value['name'])][] = $value['value'];
+
+            } else {
+                $return->headers[strtolower($value['name'])] = $value['value'];
+            }
+        }
+
+        reset($headers);
+        while (list($key, $value) = each($headers)) {
+            $headers[$key]['name'] = strtolower($headers[$key]['name']);
+            switch ($headers[$key]['name']) {
+
+                case 'content-type':
+                    $content_type = $this->_parseHeaderValue($headers[$key]['value']);
+
+                    if (preg_match('/([0-9a-z+.-]+)\/([0-9a-z+.-]+)/i', $content_type['value'], $regs)) {
+                        $return->ctype_primary   = $regs[1];
+                        $return->ctype_secondary = $regs[2];
+                    }
+
+                    if (isset($content_type['other'])) {
+                        while (list($p_name, $p_value) = each($content_type['other'])) {
+                            $return->ctype_parameters[$p_name] = $p_value;
+                        }
+                    }
+                    break;
+
+                case 'content-disposition':
+                    $content_disposition = $this->_parseHeaderValue($headers[$key]['value']);
+                    $return->disposition   = $content_disposition['value'];
+                    if (isset($content_disposition['other'])) {
+                        while (list($p_name, $p_value) = each($content_disposition['other'])) {
+                            $return->d_parameters[$p_name] = $p_value;
+                        }
+                    }
+                    break;
+
+                case 'content-transfer-encoding':
+                    $content_transfer_encoding = $this->_parseHeaderValue($headers[$key]['value']);
+                    break;
+            }
+        }
+
+        if (isset($content_type)) {
+            switch (strtolower($content_type['value'])) {
+                case 'text/plain':
+                    $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit';
+                    $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body) : null;
+                    break;
+
+                case 'text/html':
+                    $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit';
+                    $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body) : null;
+                    break;
+
+                case 'multipart/parallel':
+                case 'multipart/report': // RFC1892
+                case 'multipart/signed': // PGP
+                case 'multipart/digest':
+                case 'multipart/alternative':
+                case 'multipart/related':
+                case 'multipart/mixed':
+                    if(!isset($content_type['other']['boundary'])){
+                        $this->_error = 'No boundary found for ' . $content_type['value'] . ' part';
+                        return false;
+                    }
+
+                    $default_ctype = (strtolower($content_type['value']) === 'multipart/digest') ? 'message/rfc822' : 'text/plain';
+
+                    $parts = $this->_boundarySplit($body, $content_type['other']['boundary']);
+                    for ($i = 0; $i < count($parts); $i++) {
+                        list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]);
+                        $part = $this->_decode($part_header, $part_body, $default_ctype);
+                        if($part === false)
+                            $part = $this->raiseError($this->_error);
+                        $return->parts[] = $part;
+                    }
+                    break;
+
+                case 'message/rfc822':
+                    $obj = &new Mail_mimeDecode($body);
+                    $return->parts[] = $obj->decode(array('include_bodies' => $this->_include_bodies,
+					                                      'decode_bodies'  => $this->_decode_bodies,
+														  'decode_headers' => $this->_decode_headers));
+                    unset($obj);
+                    break;
+
+                default:
+                    if(!isset($content_transfer_encoding['value']))
+                        $content_transfer_encoding['value'] = '7bit';
+                    $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $content_transfer_encoding['value']) : $body) : null;
+                    break;
+            }
+
+        } else {
+            $ctype = explode('/', $default_ctype);
+            $return->ctype_primary   = $ctype[0];
+            $return->ctype_secondary = $ctype[1];
+            $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body) : $body) : null;
+        }
+
+        return $return;
+    }
+
+    /**
+     * Given the output of the above function, this will return an
+     * array of references to the parts, indexed by mime number.
+     *
+     * @param  object $structure   The structure to go through
+     * @param  string $mime_number Internal use only.
+     * @return array               Mime numbers
+     */
+    function &getMimeNumbers(&$structure, $no_refs = false, $mime_number = '', $prepend = '')
+    {
+        $return = array();
+        if (!empty($structure->parts)) {
+            if ($mime_number != '') {
+                $structure->mime_id = $prepend . $mime_number;
+                $return[$prepend . $mime_number] = &$structure;
+            }
+            for ($i = 0; $i < count($structure->parts); $i++) {
+
+            
+                if (!empty($structure->headers['content-type']) AND substr(strtolower($structure->headers['content-type']), 0, 8) == 'message/') {
+                    $prepend      = $prepend . $mime_number . '.';
+                    $_mime_number = '';
+                } else {
+                    $_mime_number = ($mime_number == '' ? $i + 1 : sprintf('%s.%s', $mime_number, $i + 1));
+                }
+
+                $arr = &Mail_mimeDecode::getMimeNumbers($structure->parts[$i], $no_refs, $_mime_number, $prepend);
+                foreach ($arr as $key => $val) {
+                    $no_refs ? $return[$key] = '' : $return[$key] = &$arr[$key];
+                }
+            }
+        } else {
+            if ($mime_number == '') {
+                $mime_number = '1';
+            }
+            $structure->mime_id = $prepend . $mime_number;
+            $no_refs ? $return[$prepend . $mime_number] = '' : $return[$prepend . $mime_number] = &$structure;
+        }
+        
+        return $return;
+    }
+
+    /**
+     * Given a string containing a header and body
+     * section, this function will split them (at the first
+     * blank line) and return them.
+     *
+     * @param string Input to split apart
+     * @return array Contains header and body section
+     * @access private
+     */
+    function _splitBodyHeader($input)
+    {
+        if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $input, $match)) {
+            return array($match[1], $match[2]);
+        }
+        $this->_error = 'Could not split header and body';
+        return false;
+    }
+
+    /**
+     * Parse headers given in $input and return
+     * as assoc array.
+     *
+     * @param string Headers to parse
+     * @return array Contains parsed headers
+     * @access private
+     */
+    function _parseHeaders($input)
+    {
+
+        if ($input !== '') {
+            // Unfold the input
+            $input   = preg_replace("/\r?\n/", "\r\n", $input);
+            $input   = preg_replace("/\r\n(\t| )+/", ' ', $input);
+            $headers = explode("\r\n", trim($input));
+
+            foreach ($headers as $value) {
+                $hdr_name = substr($value, 0, $pos = strpos($value, ':'));
+                $hdr_value = substr($value, $pos+1);
+                if($hdr_value[0] == ' ')
+                    $hdr_value = substr($hdr_value, 1);
+
+                $return[] = array(
+                                  'name'  => $hdr_name,
+                                  'value' => $this->_decode_headers ? $this->_decodeHeader($hdr_value) : $hdr_value
+                                 );
+            }
+        } else {
+            $return = array();
+        }
+
+        return $return;
+    }
+
+    /**
+     * Function to parse a header value,
+     * extract first part, and any secondary
+     * parts (after ;) This function is not as
+     * robust as it could be. Eg. header comments
+     * in the wrong place will probably break it.
+     *
+     * @param string Header value to parse
+     * @return array Contains parsed result
+     * @access private
+     */
+    function _parseHeaderValue($input)
+    {
+
+        if (($pos = strpos($input, ';')) !== false) {
+
+            $return['value'] = trim(substr($input, 0, $pos));
+            $input = trim(substr($input, $pos+1));
+
+            if (strlen($input) > 0) {
+
+                // This splits on a semi-colon, if there's no preceeding backslash
+                // Now works with quoted values; had to glue the \; breaks in PHP
+                // the regex is already bordering on incomprehensible
+                $splitRegex = '/([^;\'"]*[\'"]([^\'"]*([^\'"]*)*)[\'"][^;\'"]*|([^;]+))(;|$)/';
+                preg_match_all($splitRegex, $input, $matches);
+                $parameters = array();
+                for ($i=0; $i<count($matches[0]); $i++) {
+                    $param = $matches[0][$i];
+                    while (substr($param, -2) == '\;') {
+                        $param .= $matches[0][++$i];
+                    }
+                    $parameters[] = $param;
+                }
+
+                for ($i = 0; $i < count($parameters); $i++) {
+                    $param_name  = trim(substr($parameters[$i], 0, $pos = strpos($parameters[$i], '=')), "'\";\t\\ ");
+                    $param_value = trim(str_replace('\;', ';', substr($parameters[$i], $pos + 1)), "'\";\t\\ ");
+                    if ($param_value[0] == '"') {
+                        $param_value = substr($param_value, 1, -1);
+                    }
+                    $return['other'][$param_name] = $param_value;
+                    $return['other'][strtolower($param_name)] = $param_value;
+                }
+            }
+        } else {
+            $return['value'] = trim($input);
+        }
+
+        return $return;
+    }
+
+    /**
+     * This function splits the input based
+     * on the given boundary
+     *
+     * @param string Input to parse
+     * @return array Contains array of resulting mime parts
+     * @access private
+     */
+    function _boundarySplit($input, $boundary)
+    {
+        $parts = array();
+
+        $bs_possible = substr($boundary, 2, -2);
+        $bs_check = '\"' . $bs_possible . '\"';
+
+        if ($boundary == $bs_check) {
+            $boundary = $bs_possible;
+        }
+
+        $tmp = explode('--' . $boundary, $input);
+
+        for ($i = 1; $i < count($tmp) - 1; $i++) {
+            $parts[] = $tmp[$i];
+        }
+
+        return $parts;
+    }
+
+    /**
+     * Given a header, this function will decode it
+     * according to RFC2047. Probably not *exactly*
+     * conformant, but it does pass all the given
+     * examples (in RFC2047).
+     *
+     * @param string Input header value to decode
+     * @return string Decoded header value
+     * @access private
+     */
+    function _decodeHeader($input)
+    {
+        // Remove white space between encoded-words
+        $input = preg_replace('/(=\?[^?]+\?(q|b)\?[^?]*\?=)(\s)+=\?/i', '\1=?', $input);
+
+        // For each encoded-word...
+        while (preg_match('/(=\?([^?]+)\?(q|b)\?([^?]*)\?=)/i', $input, $matches)) {
+
+            $encoded  = $matches[1];
+            $charset  = $matches[2];
+            $encoding = $matches[3];
+            $text     = $matches[4];
+
+            switch (strtolower($encoding)) {
+                case 'b':
+                    $text = base64_decode($text);
+                    break;
+
+                case 'q':
+                    $text = str_replace('_', ' ', $text);
+                    preg_match_all('/=([a-f0-9]{2})/i', $text, $matches);
+                    foreach($matches[1] as $value)
+                        $text = str_replace('='.$value, chr(hexdec($value)), $text);
+                    break;
+            }
+
+            $input = str_replace($encoded, $text, $input);
+        }
+
+        return $input;
+    }
+
+    /**
+     * Given a body string and an encoding type,
+     * this function will decode and return it.
+     *
+     * @param  string Input body to decode
+     * @param  string Encoding type to use.
+     * @return string Decoded body
+     * @access private
+     */
+    function _decodeBody($input, $encoding = '7bit')
+    {
+        switch (strtolower($encoding)) {
+            case '7bit':
+                return $input;
+                break;
+
+            case 'quoted-printable':
+                return $this->_quotedPrintableDecode($input);
+                break;
+
+            case 'base64':
+                return base64_decode($input);
+                break;
+
+            default:
+                return $input;
+        }
+    }
+
+    /**
+     * Given a quoted-printable string, this
+     * function will decode and return it.
+     *
+     * @param  string Input body to decode
+     * @return string Decoded body
+     * @access private
+     */
+    function _quotedPrintableDecode($input)
+    {
+        // Remove soft line breaks
+        $input = preg_replace("/=\r?\n/", '', $input);
+
+        // Replace encoded characters
+		$input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input);
+
+        return $input;
+    }
+
+    /**
+     * Checks the input for uuencoded files and returns
+     * an array of them. Can be called statically, eg:
+     *
+     * $files =& Mail_mimeDecode::uudecode($some_text);
+     *
+     * It will check for the begin 666 ... end syntax
+     * however and won't just blindly decode whatever you
+     * pass it.
+     *
+     * @param  string Input body to look for attahcments in
+     * @return array  Decoded bodies, filenames and permissions
+     * @access public
+     * @author Unknown
+     */
+    function &uudecode($input)
+    {
+        // Find all uuencoded sections
+        preg_match_all("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", $input, $matches);
+
+        for ($j = 0; $j < count($matches[3]); $j++) {
+
+            $str      = $matches[3][$j];
+            $filename = $matches[2][$j];
+            $fileperm = $matches[1][$j];
+
+            $file = '';
+            $str = preg_split("/\r?\n/", trim($str));
+            $strlen = count($str);
+
+            for ($i = 0; $i < $strlen; $i++) {
+                $pos = 1;
+                $d = 0;
+                $len=(int)(((ord(substr($str[$i],0,1)) -32) - ' ') & 077);
+
+                while (($d + 3 <= $len) AND ($pos + 4 <= strlen($str[$i]))) {
+                    $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20);
+                    $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20);
+                    $c2 = (ord(substr($str[$i],$pos+2,1)) ^ 0x20);
+                    $c3 = (ord(substr($str[$i],$pos+3,1)) ^ 0x20);
+                    $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4));
+
+                    $file .= chr(((($c1 - ' ') & 077) << 4) | ((($c2 - ' ') & 077) >> 2));
+
+                    $file .= chr(((($c2 - ' ') & 077) << 6) |  (($c3 - ' ') & 077));
+
+                    $pos += 4;
+                    $d += 3;
+                }
+
+                if (($d + 2 <= $len) && ($pos + 3 <= strlen($str[$i]))) {
+                    $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20);
+                    $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20);
+                    $c2 = (ord(substr($str[$i],$pos+2,1)) ^ 0x20);
+                    $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4));
+
+                    $file .= chr(((($c1 - ' ') & 077) << 4) | ((($c2 - ' ') & 077) >> 2));
+
+                    $pos += 3;
+                    $d += 2;
+                }
+
+                if (($d + 1 <= $len) && ($pos + 2 <= strlen($str[$i]))) {
+                    $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20);
+                    $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20);
+                    $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4));
+
+                }
+            }
+            $files[] = array('filename' => $filename, 'fileperm' => $fileperm, 'filedata' => $file);
+        }
+
+        return $files;
+    }
+
+    /**
+     * getSendArray() returns the arguments required for Mail::send()
+     * used to build the arguments for a mail::send() call 
+     *
+     * Usage:
+     * $mailtext = Full email (for example generated by a template)
+     * $decoder = new Mail_mimeDecode($mailtext);
+     * $parts =  $decoder->getSendArray();
+     * if (!PEAR::isError($parts) {
+     *     list($recipents,$headers,$body) = $parts;
+     *     $mail = Mail::factory('smtp');
+     *     $mail->send($recipents,$headers,$body);
+     * } else {
+     *     echo $parts->message;
+     * }
+     * @return mixed   array of recipeint, headers,body or Pear_Error
+     * @access public
+     * @author Alan Knowles <alan@akbkhome.com>
+     */
+    function getSendArray()
+    {
+        // prevent warning if this is not set
+        $this->_decode_headers = FALSE;
+        $headerlist =$this->_parseHeaders($this->_header);
+        $to = "";
+        if (!$headerlist) {
+            return $this->raiseError("Message did not contain headers");
+        }
+        foreach($headerlist as $item) {
+            $header[$item['name']] = $item['value'];
+            switch (strtolower($item['name'])) {
+                case "to":
+                case "cc":
+                case "bcc":
+                    $to = ",".$item['value'];
+                default:
+                   break;
+            }
+        }
+        if ($to == "") {
+            return $this->raiseError("Message did not contain any recipents");
+        }
+        $to = substr($to,1);
+        return array($to,$header,$this->_body);
+    } 
+
+    /**
+     * Returns a xml copy of the output of
+     * Mail_mimeDecode::decode. Pass the output in as the
+     * argument. This function can be called statically. Eg:
+     *
+     * $output = $obj->decode();
+     * $xml    = Mail_mimeDecode::getXML($output);
+     *
+     * The DTD used for this should have been in the package. Or
+     * alternatively you can get it from cvs, or here:
+     * http://www.phpguru.org/xmail/xmail.dtd.
+     *
+     * @param  object Input to convert to xml. This should be the
+     *                output of the Mail_mimeDecode::decode function
+     * @return string XML version of input
+     * @access public
+     */
+    function getXML($input)
+    {
+        $crlf    =  "\r\n";
+        $output  = '<?xml version=\'1.0\'?>' . $crlf .
+                   '<!DOCTYPE email SYSTEM "http://www.phpguru.org/xmail/xmail.dtd">' . $crlf .
+                   '<email>' . $crlf .
+                   Mail_mimeDecode::_getXML($input) .
+                   '</email>';
+
+        return $output;
+    }
+
+    /**
+     * Function that does the actual conversion to xml. Does a single
+     * mimepart at a time.
+     *
+     * @param  object  Input to convert to xml. This is a mimepart object.
+     *                 It may or may not contain subparts.
+     * @param  integer Number of tabs to indent
+     * @return string  XML version of input
+     * @access private
+     */
+    function _getXML($input, $indent = 1)
+    {
+        $htab    =  "\t";
+        $crlf    =  "\r\n";
+        $output  =  '';
+        $headers = @(array)$input->headers;
+
+        foreach ($headers as $hdr_name => $hdr_value) {
+
+            // Multiple headers with this name
+            if (is_array($headers[$hdr_name])) {
+                for ($i = 0; $i < count($hdr_value); $i++) {
+                    $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value[$i], $indent);
+                }
+
+            // Only one header of this sort
+            } else {
+                $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value, $indent);
+            }
+        }
+
+        if (!empty($input->parts)) {
+            for ($i = 0; $i < count($input->parts); $i++) {
+                $output .= $crlf . str_repeat($htab, $indent) . '<mimepart>' . $crlf .
+                           Mail_mimeDecode::_getXML($input->parts[$i], $indent+1) .
+                           str_repeat($htab, $indent) . '</mimepart>' . $crlf;
+            }
+        } elseif (isset($input->body)) {
+            $output .= $crlf . str_repeat($htab, $indent) . '<body><![CDATA[' .
+                       $input->body . ']]></body>' . $crlf;
+        }
+
+        return $output;
+    }
+
+    /**
+     * Helper function to _getXML(). Returns xml of a header.
+     *
+     * @param  string  Name of header
+     * @param  string  Value of header
+     * @param  integer Number of tabs to indent
+     * @return string  XML version of input
+     * @access private
+     */
+    function _getXML_helper($hdr_name, $hdr_value, $indent)
+    {
+        $htab   = "\t";
+        $crlf   = "\r\n";
+        $return = '';
+
+        $new_hdr_value = ($hdr_name != 'received') ? Mail_mimeDecode::_parseHeaderValue($hdr_value) : array('value' => $hdr_value);
+        $new_hdr_name  = str_replace(' ', '-', ucwords(str_replace('-', ' ', $hdr_name)));
+
+        // Sort out any parameters
+        if (!empty($new_hdr_value['other'])) {
+            foreach ($new_hdr_value['other'] as $paramname => $paramvalue) {
+                $params[] = str_repeat($htab, $indent) . $htab . '<parameter>' . $crlf .
+                            str_repeat($htab, $indent) . $htab . $htab . '<paramname>' . htmlspecialchars($paramname) . '</paramname>' . $crlf .
+                            str_repeat($htab, $indent) . $htab . $htab . '<paramvalue>' . htmlspecialchars($paramvalue) . '</paramvalue>' . $crlf .
+                            str_repeat($htab, $indent) . $htab . '</parameter>' . $crlf;
+            }
+
+            $params = implode('', $params);
+        } else {
+            $params = '';
+        }
+
+        $return = str_repeat($htab, $indent) . '<header>' . $crlf .
+                  str_repeat($htab, $indent) . $htab . '<headername>' . htmlspecialchars($new_hdr_name) . '</headername>' . $crlf .
+                  str_repeat($htab, $indent) . $htab . '<headervalue>' . htmlspecialchars($new_hdr_value['value']) . '</headervalue>' . $crlf .
+                  $params .
+                  str_repeat($htab, $indent) . '</header>' . $crlf;
+
+        return $return;
+    }
+
+} // End of class
+?>
Index: /branches/mobile/data/lib/slib.php
===================================================================
--- /branches/mobile/data/lib/slib.php	(revision 11417)
+++ /branches/mobile/data/lib/slib.php	(revision 11417)
@@ -0,0 +1,2764 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+//---¤³¤Î¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ò»ØÄê
+$INC_PATH = realpath( dirname( __FILE__) );
+require_once( $INC_PATH ."/../conf/conf.php" );
+require_once( $INC_PATH ."/../class/SC_DbConn.php" );
+require_once( $INC_PATH ."/../class/SC_Query.php" );
+require_once( $INC_PATH ."/../include/session.inc" );
+
+// Á´¥Ú¡¼¥¸¶¦ÄÌ¥¨¥é¡¼
+$GLOBAL_ERR = "";
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½é´ü½èÍý
+sfInitInstall();
+
+/* ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Ð¡¼¥¸¥ç¥ó½êÆÀ */
+function sfGetDBVersion($dsn = "") {
+	if($dsn == "") {
+		if(defined('DEFAULT_DSN')) {
+			$dsn = DEFAULT_DSN;
+		} else {
+			return;
+		}
+	}
+	
+	$objQuery = new SC_Query($dsn, true, true);
+	list($db_type) = split(":", $dsn);
+	if($db_type == 'mysql') {
+		$val = $objQuery->getOne("select version()");
+		$version = "MySQL " . $val;
+	}	
+	if($db_type == 'pgsql') {
+		$val = $objQuery->getOne("select version()");
+		$arrLine = split(" " , $val);
+		$version = $arrLine[0] . " " . $arrLine[1];
+	}
+	return $version;
+}
+
+/* ¥Æ¡¼¥Ö¥ë¤ÎÂ¸ºß¥Á¥§¥Ã¥¯ */
+function sfTabaleExists($table_name, $dsn = "") {
+	if($dsn == "") {
+		if(defined('DEFAULT_DSN')) {
+			$dsn = DEFAULT_DSN;
+		} else {
+			return;
+		}
+	}
+	
+	$objQuery = new SC_Query($dsn, true, true);
+	// Àµ¾ï¤ËÀÜÂ³¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if(!$objQuery->isError()) {
+		list($db_type) = split(":", $dsn);
+		// postgresql¤Èmysql¤È¤Ç½èÍý¤òÊ¬¤±¤ë
+		if ($db_type == "pgsql") {
+			$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) {
+				return true;
+			}
+		}else if ($db_type == "mysql") {
+			$sql = "SHOW TABLE STATUS LIKE ?";
+			$arrRet = $objQuery->getAll($sql, array($table_name));
+			if(count($arrRet) > 0) {
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
+// ¥«¥é¥à¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+function sfColumnExists($table_name, $col_name, $col_type = "", $dsn = "", $add = false) {
+	if($dsn == "") {
+		if(defined('DEFAULT_DSN')) {
+			$dsn = DEFAULT_DSN;
+		} else {
+			return;
+		}
+	}
+
+	// ¥Æ¡¼¥Ö¥ë¤¬Ìµ¤±¤ì¤Ð¥¨¥é¡¼
+	if(!sfTabaleExists($table_name, $dsn)) return false;
+	
+	$objQuery = new SC_Query($dsn, true, true);
+	// Àµ¾ï¤ËÀÜÂ³¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
+	if(!$objQuery->isError()) {
+		list($db_type) = split(":", $dsn);
+		
+		// ¥«¥é¥à¥ê¥¹¥È¤ò¼èÆÀ
+		$arrRet = sfGetColumnList($table_name, $objQuery, $db_type);
+		if(count($arrRet) > 0) {
+			if(in_array($col_name, $arrRet)){
+				return true;
+			}
+		}
+	}
+	
+	// ¥«¥é¥à¤òÄÉ²Ã¤¹¤ë
+	if($add){
+		$objQuery->query("ALTER TABLE $table_name ADD $col_name $col_type ");
+		return true;
+	}
+	
+	return false;
+}
+
+// ¥Æ¡¼¥Ö¥ë¤Î¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë
+function sfGetColumnList($table_name, $objQuery = "", $db_type = DB_TYPE){
+	if($objQuery == "") $objQuery = new SC_Query();
+	$arrRet = array();
+	
+	// postgresql¤Èmysql¤È¤Ç½èÍý¤òÊ¬¤±¤ë
+	if ($db_type == "pgsql") {
+		$sql = "SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname=? AND c.oid=a.attrelid AND a.attnum > 0 ORDER BY a.attnum";
+		$arrColList = $objQuery->getAll($sql, array($table_name));
+		$arrColList = sfswaparray($arrColList);
+		$arrRet = $arrColList["attname"];
+	}else if ($db_type == "mysql") {
+		$sql = "SHOW COLUMNS FROM $table_name";
+		$arrColList = $objQuery->getAll($sql);
+		$arrColList = sfswaparray($arrColList);
+		$arrRet = $arrColList["Field"];
+	}
+	return $arrRet;
+}
+
+// ¥¤¥ó¥¹¥È¡¼¥ë½é´ü½èÍý
+function sfInitInstall() {
+	// ¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+	if(!defined('ECCUBE_INSTALL')) {
+		if(!ereg("/install/", $_SERVER['PHP_SELF'])) {
+			header("Location: ./install/");
+		}
+	} else {
+		$path = HTML_PATH . "install/index.php";
+		if(file_exists($path)) {
+			sfErrorHeader(">> /install/index.php¤Ï¡¢¥¤¥ó¥¹¥È¡¼¥ë´°Î»¸å¤Ë¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡£");
+		}
+		
+		// µì¥Ð¡¼¥¸¥ç¥ó¤Îinstall.inc¤Î¥Á¥§¥Ã¥¯
+		$path = HTML_PATH . "install.inc";
+		if(file_exists($path)) {
+			sfErrorHeader(">> /install.inc¤Ï¥»¥­¥å¥ê¥Æ¥£¡¼¥Û¡¼¥ë¤È¤Ê¤ê¤Þ¤¹¡£ºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡£");
+		}		
+	}
+}
+
+// ¥¢¥Ã¥×¥Ç¡¼¥È¤ÇÀ¸À®¤µ¤ì¤¿PHP¤òÆÉ¤ß½Ð¤·
+function sfLoadUpdateModule() {
+	// URLÀßÄê¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü
+	$main_php = ereg_replace(URL_DIR, "", $_SERVER['PHP_SELF']);
+	$extern_php = UPDATE_PATH . $main_php;
+	if(file_exists($extern_php)) {
+		require_once($extern_php);
+	}
+}
+
+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=" . CHAR_CODE . "'>\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 = "", $return_top = false, $err_msg = "") {
+	
+	if ($objSiteSess != "") {
+		$objSiteSess->setNowPage('error');
+	}
+	
+	class LC_ErrorPage {
+		function LC_ErrorPage() {
+			$this->tpl_mainpage = 'error.tpl';
+			$this->tpl_css = URL_DIR.'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;
+		case FREE_ERROR_MSG:
+			$objPage->tpl_error=$err_msg;
+			break;
+ 		default:
+	    	$objPage->tpl_error="¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
+			break;
+	}
+	
+	$objPage->return_top = $return_top;
+	
+	$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) == CHAR_CODE){
+		$data = i18n_convert($data,'SJIS',CHAR_CODE);
+	}
+	*/
+	if (mb_internal_encoding() == CHAR_CODE){
+		$data = mb_convert_encoding($data,'SJIS',CHAR_CODE);
+	}
+	
+	/* ¥Ç¡¼¥¿¤ò½ÐÎÏ */
+	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 del_flg = 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 del_flg = 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, del_flg = 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 = "del_flg = 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, $space=true) {
+	if (count($array) > 0) {
+		foreach($array as $val) {
+			if ($space) {
+				$line .= $val . ", ";
+			}else{
+				$line .= $val . ",";
+			}
+		}
+		if ($space) {
+			$line = ereg_replace(", $", "", $line);
+		}else{
+			$line = ereg_replace(",$", "", $line);
+		}
+		return $line;
+	}else{
+		return false;
+	}
+	
+}
+
+/* ÇÛÎó¤ÎÍ×ÁÇ¤òCSV¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎÏ¤¹¤ë¡£*/
+function sfGetCSVList($array) {
+	if (count($array) > 0) {
+		foreach($array as $key => $val) {
+			$val = mb_convert_encoding($val, CHAR_CODE, CHAR_CODE);
+			$line .= "\"".$val."\",";
+		}
+		$line = ereg_replace(",$", "\n", $line);
+	}else{
+		return false;
+	}
+	return $line;
+}
+
+/* ÇÛÎó¤ÎÍ×ÁÇ¤ò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 = "del_flg = 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 = "del_flg = 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("del_flg = 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 sfRound($value, $pow = 0){
+	$adjust = pow(10 ,$pow-1);
+
+	// À°¿ô³î¤Ä0½Ð¤Ê¤±¤ì¤Ð·å¿ô»ØÄê¤ò¹Ô¤¦
+	if(sfIsInt($adjust) and $pow > 1){
+		$ret = (round($value * $adjust)/$adjust);
+	}
+	
+	$ret = round($ret);
+
+	return $ret;
+}
+
+/* ¥Ý¥¤¥ó¥ÈÉÕÍ¿ */
+function sfPrePoint($price, $point_rate, $rule = POINT_RULE, $product_id = "") {
+	if(sfIsInt($product_id)) {
+		$objQuery = new SC_Query();
+	    $where = "now() >= cast(start_date as date) AND ";
+	    $where .= "now() < cast(end_date as date) AND ";
+		
+		$where .= "del_flg = 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) as count, 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.del_flg = 0 AND dtb_classcategory.del_flg = 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'];
+		$sqlval['create_date'] = "now()";
+		
+		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 AS prdcls";
+	$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']);
+		$limit = "";
+		// 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']];
+			
+			// ²èÁü¥µ¥¤¥º
+			list($image_width, $image_height) = getimagesize(IMAGE_SAVE_DIR . basename($objPage->arrProductsClass[$cnt]["main_image"]));
+			$objPage->arrProductsClass[$cnt]["tpl_image_width"] = $image_width + 60;
+			$objPage->arrProductsClass[$cnt]["tpl_image_height"] = $image_height + 80;
+			
+			// ²Á³Ê¤ÎÅÐÏ¿
+			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 = "del_flg = 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, deliv_time", "dtb_delivtime", $where, array($deliv_id));
+	}
+	
+	return $arrRet;	
+}
+
+
+// ÅÔÆ»ÉÜ¸©¡¢»ÙÊ§¤¤ÊýË¡¤«¤éÇÛÁ÷ÎÁ¶â¤ò¼èÆÀ¤¹¤ë
+function sfGetDelivFee($pref, $payment_id = "") {
+	$objQuery = new SC_Query();
+	
+	$deliv_id = "";
+	
+	// »ÙÊ§¤¤ÊýË¡¤¬»ØÄê¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ÂÐ±þ¤·¤¿ÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë
+	if($payment_id != "") {
+		$where = "del_flg = 0 AND payment_id = ?";
+		$arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id));
+		$deliv_id = $arrRet[0]['deliv_id'];
+	// »ÙÊ§¤¤ÊýË¡¤¬»ØÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ÀèÆ¬¤ÎÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë
+	} else {
+		$where = "del_flg = 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 = "del_flg = 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['memo02'] != "") {
+		$arrOther = unserialize($arrOrder['memo02']);
+		
+		foreach($arrOther as $other_key => $other_val){
+			if(sfTrim($other_val["value"]) == ""){
+				$arrOther[$other_key]["value"] = "";
+			}
+		}
+		
+		$objPage->arrOther = $arrOther;
+	}
+
+	// ÅÔÆ»ÉÜ¸©ÊÑ´¹
+	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');
+		if (defined('MOBILE_SITE')) {
+			$sqlval['order_email'] = $objCustomer->getValue('email_mobile');
+		} else {
+			$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);
+			$sqlval['create_date'] = "now()";
+			$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 allcls 
+			USING (product_id) WHERE A.category_id = ? AND A.del_flg = 0 AND status = 1 ORDER BY A.rank";
+	$arrItems = $conn->getAll($sql, array($category_id));
+
+	return $arrItems;
+}
+
+// ÆÃ¼ìÀ©¸æÊ¸»ú¤Î¼êÆ°¥¨¥¹¥±¡¼¥×
+function sfManualEscape($data) {
+	// ÇÛÎó¤Ç¤Ê¤¤¾ì¹ç
+	if(!is_array($data)) {
+		if (DB_TYPE == "pgsql") {
+			$ret = pg_escape_string($data);
+		}else if(DB_TYPE == "mysql"){
+			$ret = mysql_real_escape_string($data);
+		}
+		$ret = ereg_replace("%", "\\%", $ret);
+		$ret = ereg_replace("_", "\\_", $ret);
+		return $ret;
+	}
+	
+	// ÇÛÎó¤Î¾ì¹ç
+	foreach($data as $val) {
+		if (DB_TYPE == "pgsql") {
+			$ret = pg_escape_string($val);
+		}else if(DB_TYPE == "mysql"){
+			$ret = mysql_real_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, $commadisp = true) {
+	if($byte) {
+		if(strlen($str) > ($len + 2)) {
+			$ret =substr($str, 0, $len);
+			$cut = substr($str, $len);
+		} else {
+			$ret = $str;
+			$commadisp = false;
+		}
+	} else {
+		if(mb_strlen($str) > ($len + 1)) {
+			$ret = mb_substr($str, 0, $len);
+			$cut = mb_substr($str, $len);
+		} else {
+			$ret = $str;
+			$commadisp = false;
+		}
+	}
+
+	// ³¨Ê¸»ú¥¿¥°¤ÎÅÓÃæ¤ÇÊ¬ÃÇ¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
+	if (isset($cut)) {
+		// Ê¬³ä°ÌÃÖ¤è¤êÁ°¤ÎºÇ¸å¤Î [ °Ê¹ß¤ò¼èÆÀ¤¹¤ë¡£
+		$head = strrchr($ret, '[');
+
+		// Ê¬³ä°ÌÃÖ¤è¤ê¸å¤ÎºÇ½é¤Î ] °ÊÁ°¤ò¼èÆÀ¤¹¤ë¡£
+		$tail_pos = strpos($cut, ']');
+		if ($tail_pos !== false) {
+			$tail = substr($cut, 0, $tail_pos + 1);
+		}
+
+		// Ê¬³ä°ÌÃÖ¤è¤êÁ°¤Ë [¡¢¸å¤Ë ] ¤¬¸«¤Ä¤«¤Ã¤¿¾ì¹ç¤Ï¡¢[ ¤«¤é ] ¤Þ¤Ç¤ò
+		// ÀÜÂ³¤·¤Æ³¨Ê¸»ú¥¿¥°1¸ÄÊ¬¤Ë¤Ê¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+		if ($head !== false && $tail_pos !== false) {
+			$subject = $head . $tail;
+			if (preg_match('/^\[emoji:e?\d+\]$/', $subject)) {
+				// ³¨Ê¸»ú¥¿¥°¤¬¸«¤Ä¤«¤Ã¤¿¤Î¤Çºï½ü¤¹¤ë¡£
+				$ret = substr($ret, 0, -strlen($head));
+			}
+		}
+	}
+
+	if($commadisp){
+		$ret = $ret . "...";
+	}
+	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"] = sha1($array["password"] . ":" . AUTH_MAGIC); 
+	$arrRegist["update_date"] = "NOW()";
+	
+	$sqlval["create_date"] = "NOW()";
+	$sqlval["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 = 'CHAR_CODE') {
+	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, create_date) ";
+	$sql .= " SELECT T1.category_id, count(T2.category_id), now() FROM dtb_category AS T1 LEFT JOIN dtb_products AS T2 ";
+	$sql .= " ON T1.category_id = T2.category_id  ";
+	$sql .= " WHERE T2.del_flg = 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, create_date) ";
+		$sql .= " SELECT ?, SUM(product_count), now() 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 = "";
+	$col .= " cat.category_id,";
+	$col .= " cat.category_name,";
+	$col .= " cat.parent_category_id,";
+	$col .= " cat.level,";
+	$col .= " cat.rank,";
+	$col .= " cat.creator_id,";
+	$col .= " cat.create_date,";
+	$col .= " cat.update_date,";
+	$col .= " cat.del_flg, ";
+	$col .= " ttl.product_count";	
+	$from = "dtb_category as cat left join dtb_category_total_count as ttl on ttl.category_id = cat.category_id";
+	// ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯
+	if($count_check) {
+		$where = "del_flg = 0 AND product_count > 0";
+	} else {
+		$where = "del_flg = 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;
+}
+
+//MySQLÍÑ¤ÎSQLÊ¸¤ËÊÑ¹¹¤¹¤ë
+function sfChangeMySQL($sql){
+	// ²þ¹Ô¡¢¥¿¥Ö¤ò1¥¹¥Ú¡¼¥¹¤ËÊÑ´¹
+	$sql = preg_replace("/[\r\n\t]/"," ",$sql);
+	
+	$sql = sfChangeView($sql);		// viewÉ½¤ò¥¤¥ó¥é¥¤¥ó¥Ó¥å¡¼¤ËÊÑ´¹¤¹¤ë
+	$sql = sfChangeILIKE($sql);		// ILIKE¸¡º÷¤òLIKE¸¡º÷¤ËÊÑ´¹¤¹¤ë
+	$sql = sfChangeRANDOM($sql);	// RANDOM()¤òRAND()¤ËÊÑ´¹¤¹¤ë
+
+	return $sql;
+}
+
+// SQL¤ÎÃæ¤Ëview¤¬Â¸ºß¤·¤Æ¤¤¤ë¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¡£
+function sfInArray($sql){
+	global $arrView;
+
+	foreach($arrView as $key => $val){
+		if (strcasecmp($sql, $val) == 0){
+			$changesql = eregi_replace("($key)", "$val", $sql);
+			sfInArray($changesql);
+		}
+	}
+	return false;
+}
+
+// SQL¥·¥ó¥°¥ë¥¯¥©¡¼¥ÈÂÐ±þ
+function sfQuoteSmart($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 "'" . str_replace("'", "''", $in) . "'";
+    }
+}
+	
+// viewÉ½¤ò¥¤¥ó¥é¥¤¥ó¥Ó¥å¡¼¤ËÊÑ´¹¤¹¤ë
+function sfChangeView($sql){
+	global $arrView;
+	global $arrViewWhere;
+	
+	$arrViewTmp = $arrView;
+
+	// view¤Îwhere¤òÊÑ´¹
+	foreach($arrViewTmp as $key => $val){
+		$arrViewTmp[$key] = strtr($arrViewTmp[$key], $arrViewWhere);
+	}
+	
+	// view¤òÊÑ´¹
+	$changesql = strtr($sql, $arrViewTmp);
+
+	return $changesql;
+}
+
+// ILIKE¸¡º÷¤òLIKE¸¡º÷¤ËÊÑ´¹¤¹¤ë
+function sfChangeILIKE($sql){
+	$changesql = eregi_replace("(ILIKE )", "LIKE BINARY ", $sql);
+	return $changesql;
+}
+
+// RANDOM()¤òRAND()¤ËÊÑ´¹¤¹¤ë
+function sfChangeRANDOM($sql){
+	$changesql = eregi_replace("( RANDOM)", " RAND", $sql);
+	return $changesql;
+}
+
+// view¤Îwhere¤òÃÖ´¹¤¹¤ë
+function sfViewWhere($target, $where = "", $arrval = array(), $option = ""){
+	global $arrViewWhere;
+	$arrWhere = split("[?]", $where);
+	$where_tmp = " WHERE " . $arrWhere[0];
+	for($i = 1; $i < count($arrWhere); $i++){
+		$where_tmp .= sfQuoteSmart($arrval[$i - 1]) . $arrWhere[$i];
+	}
+	$arrViewWhere[$target] = $where_tmp . " " . $option;
+}
+
+// ¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Î¥Õ¥¡¥¤¥ë¤òºÆµ¢Åª¤Ë¥³¥Ô¡¼
+function sfCopyDir($src, $des, $mess, $override = false){
+	if(!is_dir($src)){
+		return false;
+	}
+
+	$oldmask = umask(0);
+	$mod= stat($src);
+	
+	// ¥Ç¥£¥ì¥¯¥È¥ê¤¬¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë
+	if(!file_exists($des)) {
+		if(!mkdir($des, $mod[2])) {
+			print("path:" . $des);
+		}
+	}
+	
+	$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 = sfCopyDir( $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;
+}
+
+// »ØÄê¤·¤¿¥Õ¥©¥ë¥ÀÆâ¤Î¥Õ¥¡¥¤¥ë¤òÁ´¤Æºï½ü¤¹¤ë
+function sfDelFile($dir){
+	$dh = opendir($dir);
+	// ¥Õ¥©¥ë¥ÀÆâ¤Î¥Õ¥¡¥¤¥ë¤òºï½ü
+	while($file = readdir($dh)){
+		if ($file == "." or $file == "..") continue;
+		$del_file = $dir . "/" . $file;
+		if(is_file($del_file)){
+			$ret = unlink($dir . "/" . $file);
+		}else if (is_dir($del_file)){
+			$ret = sfDelFile($del_file);
+		}
+		
+		if(!$ret){
+			return $ret;
+		}
+	}
+	// ¥Õ¥©¥ë¥À¤òºï½ü
+	return rmdir($dir);
+	
+}
+
+function sfFlush($output = " ", $sleep = 0){
+	// ¼Â¹Ô»þ´Ö¤òÀ©¸Â¤·¤Ê¤¤
+	set_time_limit(0);
+	// ½ÐÎÏ¤ò¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤·¤Ê¤¤(==ÆüËÜ¸ì¼«Æ°ÊÑ´¹¤â¤·¤Ê¤¤)
+	ob_end_clean();
+	
+	// IE¤Î¤¿¤á¤Ë256¥Ð¥¤¥È¶õÊ¸»ú½ÐÎÏ
+	echo str_pad('',256);
+	
+	// ½ÐÎÏ¤Ï¥Ö¥é¥ó¥¯¤À¤±¤Ç¤â¤¤¤¤¤È»×¤¦
+	echo $output;
+	// ½ÐÎÏ¤ò¥Õ¥é¥Ã¥·¥å¤¹¤ë
+	flush();
+	
+	ob_end_flush();
+	ob_start();	
+	
+	// »þ´Ö¤Î¤«¤«¤ë½èÍý
+	sleep($sleep);
+}
+
+// @version¤Îµ­ºÜ¤¬¤¢¤ë¥Õ¥¡¥¤¥ë¤«¤é¥Ð¡¼¥¸¥ç¥ó¤ò¼èÆÀ¤¹¤ë¡£
+function sfGetFileVersion($path) {
+	if(file_exists($path)) {
+		$src_fp = fopen($path, "rb");
+		if($src_fp) {
+			while (!feof($src_fp)) {
+				$line = fgets($src_fp);
+				if(ereg("@version", $line)) {
+					$arrLine = split(" ", $line);
+					$version = $arrLine[5];
+				}
+			}
+			fclose($src_fp);
+		}
+	}
+	return $version;
+}
+
+// »ØÄê¤·¤¿URL¤ËÂÐ¤·¤ÆPOST¤Ç¥Ç¡¼¥¿¤òÁ÷¿®¤¹¤ë
+function sfSendPostData($url, $arrData, $arrOkCode = array()){
+	require_once(DATA_PATH . "module/Request.php");
+	
+	// Á÷¿®¥¤¥ó¥¹¥¿¥ó¥¹À¸À®
+	$req = new HTTP_Request($url);
+	$req->setMethod(HTTP_REQUEST_METHOD_POST);
+	
+	// POST¥Ç¡¼¥¿Á÷¿®
+	$req->addPostDataArray($arrData);
+	
+	// ¥¨¥é¡¼¤¬Ìµ¤±¤ì¤Ð¡¢±þÅú¾ðÊó¤ò¼èÆÀ¤¹¤ë
+	if (!PEAR::isError($req->sendRequest())) {
+		
+		// ¥ì¥¹¥Ý¥ó¥¹¥³¡¼¥É¤¬¥¨¥é¡¼È½Äê¤Ê¤é¡¢¶õ¤òÊÖ¤¹
+		$res_code = $req->getResponseCode();
+		
+		if(!in_array($res_code, $arrOkCode)){
+			$response = "";
+		}else{
+			$response = $req->getResponseBody();
+		}
+		
+	} else {
+		$response = "";
+	}
+	
+	// POST¥Ç¡¼¥¿¥¯¥ê¥¢
+	$req->clearPostData();	
+	
+	return $response;
+}
+
+/* ¥Ç¥Ð¥Ã¥°ÍÑ ------------------------------------------------------------------------------------------------*/
+function sfPrintR($obj) {
+	print("<div style='font-size: 12px;color: #00FF00;'>\n");
+	print("<strong>**¥Ç¥Ð¥Ã¥°Ãæ**</strong><br />\n");
+	print("<pre>\n");
+	print_r($obj);
+	print("</pre>\n");
+	print("<strong>**¥Ç¥Ð¥Ã¥°Ãæ**</strong></div>\n");
+}
+
+?>
Index: /branches/mobile/data/lib/gdthumb.php
===================================================================
--- /branches/mobile/data/lib/gdthumb.php	(revision 9617)
+++ /branches/mobile/data/lib/gdthumb.php	(revision 9617)
@@ -0,0 +1,256 @@
+<?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=" . CHAR_CODE);
+	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, $header = false) {
+		
+		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);
+					}
+          			$imageresize($dst_im, $src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+
+					if(function_exists("imagegif")) {
+						
+						// ²èÁü½ÐÎÏ
+						if($header){
+							header("Content-Type: image/gif");
+							imagegif($dst_im);
+							return "";
+						}else{
+							$dst_file = $dst_file . ".gif";
+							imagegif($dst_im, $dst_file);
+						}
+						
+						imagedestroy($src_im);
+						imagedestroy($dst_im);
+					} else {
+						// ²èÁü½ÐÎÏ
+						if($header){
+							header("Content-Type: image/png");
+							imagepng($dst_im);
+							return "";
+						}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);
+					
+					// ²èÁü½ÐÎÏ
+					if($header){
+						header("Content-Type: image/png");
+						imagepng($dst_im);
+						return "";
+					}else{
+						$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]);
+				$imageresize( $dst_im, $src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]);
+
+				// ²èÁü½ÐÎÏ
+				if($header){
+					header("Content-Type: image/jpeg");
+					imageJpeg($dst_im);
+					return "";
+				}else{
+					$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]);
+					
+					(imagecolorstotal($src_im) == 0) ? $colortotal = 65536 : $colortotal = imagecolorstotal($src_im);
+					
+					imagetruecolortopalette($dst_im, true, $colortotal);
+				}
+				
+				// ²èÁü½ÐÎÏ
+				if($header){
+					header("Content-Type: image/png");
+					imagepng($dst_im);
+					return "";
+				}else{
+					$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: /branches/mobile/data/lib/glib.php
===================================================================
--- /branches/mobile/data/lib/glib.php	(revision 8524)
+++ /branches/mobile/data/lib/glib.php	(revision 8524)
@@ -0,0 +1,191 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+/*----------------------------------------------------------------------
+ * [Ì¾¾Î] 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) == CHAR_CODE){						//Ê¸»ú¥³¡¼¥ÉÊÑ´¹
+		$return = mb_convert_encoding($return,'SJIS',CHAR_CODE);
+		$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: /branches/mobile/data/lib/thumb.php
===================================================================
--- /branches/mobile/data/lib/thumb.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/smarty_extends/function.html_checkboxes_ex.php
===================================================================
--- /branches/mobile/data/smarty_extends/function.html_checkboxes_ex.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/smarty_extends/modifier.numeric_emoji.php
===================================================================
--- /branches/mobile/data/smarty_extends/modifier.numeric_emoji.php	(revision 11398)
+++ /branches/mobile/data/smarty_extends/modifier.numeric_emoji.php	(revision 11398)
@@ -0,0 +1,21 @@
+<?php
+/**
+ * ¿ôÃÍ¤ò¿ô»ú³¨Ê¸»ú¤ËÊÑ´¹¤¹¤ë¡£
+ *
+ * ÆþÎÏ¤¬0¡Á9¤Ç¤Ï¤Ê¤¤¾ì¹ç¡¢¤Þ¤¿¤Ï¡¢·ÈÂÓÃ¼Ëö¤«¤é¤Î¥¢¥¯¥»¥¹¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï¡¢
+ * ÆþÎÏ¤ò [ ¤È ] ¤Ç°Ï¤ó¤ÀÊ¸»úÎó¤òÊÖ¤¹¡£
+ *
+ * @param string $value ÆþÎÏ
+ * @return string ½ÐÎÏ
+ */
+function smarty_modifier_numeric_emoji($value) {
+	// ¿ô»ú³¨Ê¸»ú (0¡Á9) ¤Î³¨Ê¸»úÈÖ¹æ
+	static $numeric_emoji_index = array('134', '125', '126', '127', '128', '129', '130', '131', '132', '133');
+
+	if (GC_MobileUserAgent::isMobile() && isset($numeric_emoji_index[$value])) {
+		return '[emoji:' . $numeric_emoji_index[$value] . ']';
+	} else {
+		return '[' . $value . ']';
+	}
+}
+?>
Index: /branches/mobile/data/smarty_extends/function.html_radios_ex.php
===================================================================
--- /branches/mobile/data/smarty_extends/function.html_radios_ex.php	(revision 1328)
+++ /branches/mobile/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: /branches/mobile/data/downloads/module/ebis_tag.php
===================================================================
--- /branches/mobile/data/downloads/module/ebis_tag.php	(revision 8549)
+++ /branches/mobile/data/downloads/module/ebis_tag.php	(revision 8549)
@@ -0,0 +1,65 @@
+<?php
+/**
+ * 
+ * @copyright	2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ * @version	CVS: $Id$
+ * @link		http://www.lockon.co.jp/
+ *
+ */
+
+require_once("../../require.php");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = MODULE_PATH . 'ebis_tag.tpl';
+		$this->tpl_subtitle = 'EBiS¥¿¥°Ëä¤á¹þ¤ßµ¡Ç½';
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú³ÎÇ§
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+$objFormParam = lfInitParam($objFormParam);
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'edit':
+	// ÆþÎÏ¥¨¥é¡¼È½Äê
+	$objPage->arrErr = $objFormParam->checkError();
+	if(count($objPage->arrErr) == 0) {
+		$arrRet = $objFormParam->getHashArray();
+		$sqlval['sub_data'] = serialize($arrRet);
+		$objQuery = new SC_Query();
+		$objQuery->update("dtb_module", $sqlval, "module_id = ?", array(EBIS_TAG_MID));
+		// javascript¼Â¹Ô
+		$objPage->tpl_onload = "window.close();";
+	}
+	break;
+default:
+	$arrRet = $objQuery->select("sub_data", "dtb_module", "module_id = ?", array(EBIS_TAG_MID));
+	$arrSubData = unserialize($arrRet[0]['sub_data']);
+	$objFormParam->setParam($arrSubData);
+	break;
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);		//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display($objPage->tpl_mainpage);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+//-------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam($objFormParam) {
+	$objFormParam->addParam("¥æ¡¼¥¶ID", "user", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥¿¥°¼±ÊÌID", "cid", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	return $objFormParam;
+}
+?>
Index: /branches/mobile/data/downloads/module/mdl_epsilon/mdl_epsilon.inc
===================================================================
--- /branches/mobile/data/downloads/module/mdl_epsilon/mdl_epsilon.inc	(revision 8487)
+++ /branches/mobile/data/downloads/module/mdl_epsilon/mdl_epsilon.inc	(revision 8487)
@@ -0,0 +1,137 @@
+<?php
+/**
+ * 
+ * @copyright	2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ * @version	CVS: $Id$
+ * @link		http://www.lockon.co.jp/
+ *
+ */
+
+define("MDL_EPSILON_ID", 4);
+
+define ("CHARGE_MAX", 500000);
+define ("SEVEN_CHARGE_MAX", 300000);
+
+//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+$arrConvenience = array(
+	11 => '¥»¥Ö¥ó¥¤¥ì¥Ö¥ó'
+	,21 => '¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È'
+	,31 => '¥í¡¼¥½¥ó'
+	,32 => '¥»¥¤¥³¡¼¥Þ¡¼¥È'
+	,33 => '¥ß¥Ë¥¹¥È¥Ã¥×'
+	,34 => '¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­'
+);
+
+$arrConveni_message = array(
+	11 => "¾åµ­¤Î¥Ú¡¼¥¸¤ò¥×¥ê¥ó¥È¥¢¥¦¥È¤µ¤ì¤ë¤«Ê§¹þÉ¼ÈÖ¹æ¤ò¥á¥â¤·¤Æ¡¢
+¤ª»ÙÊ§¤¤´ü¸Â¤Þ¤Ç¤Ë¡¢ºÇ´ó¤ê¤Î¥»¥Ö¥ó¥¤¥ì¥Ö¥ó¤Ë¤ÆÂå¶â¤ò¤ª»ÙÊ§¤¤¤¯¤À¤µ¤¤¡£"
+	,21 =>"¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥ÈÅ¹Æ¬¤Ë¤´¤¶¤¤¤Þ¤¹
+Fami¥Ý¡¼¥È¡¿¥Õ¥¡¥ß¥Í¥Ã¥È¤Ë¤Æ°Ê²¼¤Î¡Ö´ë¶È¥³¡¼¥É¡×¤È¡ÖÃíÊ¸ÈÖ¹æ¡×¤òÆþÎÏ¤·¡¢
+¿½¹þ·ô¤ò°õ»ú¸å¡¢¤ª»ÙÊ§¤¤´ü¸Â¤Þ¤Ç¤ËÂå¶â¤ò¤ª»ÙÊ§¤¤²¼¤µ¤¤¡£"
+	,31 =>"¡ã¤ª»ÙÊ§¤¤ÊýË¡¡ä
+1. ¥í¡¼¥½¥ó¤ÎÅ¹Æâ¤ËÀßÃÖ¤·¤Æ¤¢¤ëLoppi¤Î¥È¥Ã¥×²èÌÌ¤ÎÃæ¤«¤é¡¢
+  ¡Ö¥¤¥ó¥¿¡¼¥Í¥Ã¥È¼õÉÕ¡×¤ò¤ªÁª¤Ó¤¯¤À¤µ¤¤¡£
+
+2. ¼¡²èÌÌ¤Î¥¸¥ã¥ó¥ë¤ÎÃæ¤«¤é¡Ö¥¤¥ó¥¿¡¼¥Í¥Ã¥È¼õÉÕ¡×¤ò¤ªÁª¤Ó¤¯¤À¤µ¤¤¡£
+
+3. ²èÌÌ¤Ë½¾¤Ã¤Æ¡Ö¤ª»ÙÊ§¤¤¼õÉÕÈÖ¹æ¡×¤È¡¢¤´ÃíÊ¸¤¤¤¿¤À¤¤¤¿ºÝ¤Î
+  ¡ÖÅÅÏÃÈÖ¹æ¡×¤ò¤´ÆþÎÏ²¼¤µ¤¤¡£¢ªLoppi¤è¤ê¡Ö¿½¹þ·ô¡×¤¬È¯·ô¤µ¤ì¤Þ¤¹¡£ 
+    ¢¨¿½¹þ·ô¤ÎÍ­¸ú»þ´Ö¤Ï30Ê¬´Ö¤Ç¤¹¡£¤ªÁá¤á¤Ë¥ì¥¸¤Ø¤ª»ý¤Á²¼¤µ¤¤¡£
+
+4. ¿½¹þ·ô¤Ë¸½¶â¤Þ¤¿¤Ï¥¯¥ì¥¸¥Ã¥È¥«¡¼¥É¤òÅº¤¨¤Æ¥ì¥¸¤Ë¤ÆÂå¶â¤ò
+   ¤ª»ÙÊ§¤¤²¼¤µ¤¤¡£
+
+5. Âå¶â¤È°ú´¹¤Ë¡ÖÎÎ¼ý½ñ¡×¤ò¤ªÅÏ¤·¤¤¤¿¤·¤Þ¤¹¡£ÎÎ¼ý½ñ¤ÏÂçÀÚ¤ËÊÝ´É
+   ¤·¤Æ¤¯¤À¤µ¤¤¡£Âå¶âÊ§¹þ¤Î¾Ú½ñ¤È¤Ê¤ê¤Þ¤¹¡£"
+	,32 =>"¡ã¤ª»ÙÊ§¤¤ÊýË¡¡ä
+1.¡¡¥»¥¤¥³¡¼¥Þ¡¼¥È¤ÎÅ¹Æâ¤ËÀßÃÖ¤·¤Æ¤¢¤ë¥»¥¤¥³¡¼¥Þ¡¼¥È¥¯¥é¥Ö¥¹¥Æ¡¼¥·¥ç¥ó
+   ¡Ê¾ðÊóÃ¼Ëö¡Ë¤Î¥È¥Ã¥×²èÌÌ¤ÎÃæ¤«¤é¡¢¡Ö¥¤¥ó¥¿¡¼¥Í¥Ã¥È¼õÉÕ¡×¤ò¤ªÁª¤Ó²¼¤µ¤¤¡£
+
+2.  ²èÌÌ¤Ë½¾¤Ã¤Æ¡Ö¤ª»ÙÊ§¤¤¼õÉÕÈÖ¹æ¡×¤È¡¢¤ª¿½¤·¹þ¤ß»þ¤Î¡ÖÅÅÏÃÈÖ¹æ¡×¤ò
+¡¡¡¡¤´ÆþÎÏ¤¤¤¿¤À¤¯¤È¥»¥¤¥³¡¼¥Þ¡¼¥È¥¯¥é¥Ö¥¹¥Æ¡¼¥·¥ç¥ó¤è¤ê¡Ö·èºÑ¥µ¡¼¥Ó¥¹
+¡¡¡¡Ê§¹þ¼è°·É¼¡¦Ê§¹þÉ¼·ó¼õÎÎ¾Ú¡¦ÎÎ¼ý½ñ¡Ê·×3Ëç¡Ë¡×¤¬È¯·ô¤µ¤ì¤Þ¤¹¡£
+
+3.  È¯·ô¤µ¤ì¤¿¡Ö·èºÑ¥µ¡¼¥Ó¥¹Ê§¹þ¼è°·É¼¡¦Ê§¹þÉ¼·ó¼õÎÎ¾Ú¡¦ÎÎ¼ý½ñ¡Ê·×3Ëç¡Ë¡×
+¡¡¡¡¤ò¤ª»ý¤Á¤Î¾å¡¢¥ì¥¸¤Ë¤ÆÂå¶â¤ò¤ª»ÙÊ§¤¤²¼¤µ¤¤¡£ "
+	,33 =>"¤ª»ÙÊ§¤¤´ü¸Â¤Þ¤Ç¤Ë¥ß¥Ë¥¹¥È¥Ã¥×¤Ë¤ÆÂå¶â¤ò¤ª»ÙÊ§¤¤²¼¤µ¤¤¡£
+¤ª»ÙÊ§¤¤¤ÎºÝ¤Ë¤Ï¡ÖÊ§¹þ¼è°·É¼¡×¤¬É¬Í×¤È¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢¾åµ­URL¤ÇÉ½¼¨
+¤µ¤ì¤ë¥Ú¡¼¥¸¤ò°õºþ¤·¤Æ¥ì¥¸¤Þ¤Ç¤ª»ý¤Á²¼¤µ¤¤¡£"
+	,34 =>"¤ª»ÙÊ§¤¤´ü¸Â¤Þ¤Ç¤Ë¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­¡¿¥ä¥Þ¥¶¥­¥Ç¥¤¥ê¡¼¥¹¥È¥¢
+¤Ë¤ÆÂå¶â¤ò¤ª»ÙÊ§¤¤²¼¤µ¤¤¡£
+¤ª»ÙÊ§¤¤¤ÎºÝ¤Ë¤Ï¡ÖÊ§¹þ¼è°·É¼¡×¤¬É¬Í×¤È¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢¾åµ­URL¤ÇÉ½¼¨
+¤µ¤ì¤ë¥Ú¡¼¥¸¤ò°õºþ¤·¤Æ¥ì¥¸¤Þ¤Ç¤ª»ý¤Á²¼¤µ¤¤¡£"
+);
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§sfGetXMLValue
+ * ½èÍýÆâÍÆ	¡§XML¥¿¥°¤ÎÆâÍÆ¤ò¼èÆÀ¤¹¤ë
+ * °ú¿ô1	¡§$arrVal	¥¥¥ Value¥Ç¡¼¥¿
+ * °ú¿ô2	¡§$tag		¥¥¥ Tag¥Ç¡¼¥¿
+ * °ú¿ô3	¡§$att		¥¥¥ ÂÐ¾Ý¥¿¥°Ì¾
+ * Ìá¤êÃÍ	¡§¼èÆÀ·ë²Ì
+ **************************************************************************************************************/
+function sfGetXMLValue($arrVal, $tag, $att) {
+	$ret = "";
+	foreach((array)$arrVal as $array) {
+		if($tag == $array['tag']) {
+			if(!is_array($array['attributes'])) {
+				continue;
+			}
+			foreach($array['attributes'] as $key => $val) {
+				if($key == $att) {
+					$ret = mb_convert_encoding(urldecode($val), 'EUC-JP', 'SJIS');
+					break;
+				}
+			}			
+		}
+	}
+	
+	return $ret;
+}
+
+/**************************************************************************************************************
+ * ´Ø¿ôÌ¾	¡§sfPostPaymentData
+ * ½èÍýÆâÍÆ	¡§¥¤¥×¥·¥í¥ó¤Ø¥Ç¡¼¥¿¤òÁ÷¿®¤¹¤ë¡£
+ * °ú¿ô1	¡§$order_url	¥¥¥ Á÷¿®ÀèURL
+ * °ú¿ô2	¡§$arrData		¥¥¥ POST¥Ç¡¼¥¿
+ **************************************************************************************************************/
+function sfPostPaymentData($order_url, $arrData, $err_page = true){
+	$arrVal = array();
+	$response = "";
+
+	// POST¥Ç¡¼¥¿¤òÁ÷¿®¤·¡¢±þÅú¾ðÊó¤ò¼èÆÀ¤¹¤ë
+	$response = sfSendPostData($order_url, $arrData, array(200));
+	
+	// ¤Ê¤Ë¤âÊÖ¤Ã¤Æ¤³¤Ê¤ì¤Ð¡¢¥¨¥é¡¼
+	if ($response == "") {
+		if ($err_page) {
+			// ¥¨¥é¡¼²èÌÌ¤òÉ½¼¨¤¹¤ë¡£
+			$_SESSION['site']['now_page'] ="";
+			sfDispSiteError(FREE_ERROR_MSG, "", true, "¹ØÆþ½èÍýÃæ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br>¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£");
+		}else{
+			return "" ;
+		}
+	}
+
+	// Shift-JIS¤òUNICODE¤ËÊÑ´¹¤¹¤ë
+	$response = str_replace("x-sjis-cp932", "UTF-8", $response);
+	// XMLÆâ¤Î¥¨¥ó¥³¡¼¥É¤âUNICODE¤ËÊÑ´¹
+	$response = mb_convert_encoding($response, "UTF-8", "UTF-8");
+
+	// XML¥Ñ¡¼¥µ¤òÀ¸À®¤¹¤ë¡£
+	$parser = xml_parser_create('utf-8');
+	
+	// ¶õÇòÊ¸»ú¤ÏÆÉ¤ßÈô¤Ð¤·¤ÆXML¤òÆÉ¤ß¼è¤ë
+	xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,"UTF-8");
+	xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
+	
+	// ÇÛÎó¤ËXML¤Î¥Ç¡¼¥¿¤ò³ÊÇ¼¤¹¤ë
+	$err = xml_parse_into_struct($parser,$response,$arrVal,$idx);
+
+	// ³«Êü¤¹¤ë
+	xml_parser_free($parser);
+	
+	return $arrVal;
+}
+
+?>
Index: /branches/mobile/data/downloads/module/mdl_epsilon/card.php
===================================================================
--- /branches/mobile/data/downloads/module/mdl_epsilon/card.php	(revision 11409)
+++ /branches/mobile/data/downloads/module/mdl_epsilon/card.php	(revision 11409)
@@ -0,0 +1,139 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+require_once(DATA_PATH . "module/Request.php");
+require_once(MODULE_PATH . "mdl_epsilon/mdl_epsilon.inc");
+
+class LC_Page {
+	function LC_Page() {
+		/** É¬¤º»ØÄê¤¹¤ë **/
+		$this->tpl_mainpage = 'mdl_epsilon/card.tpl';			// ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteInfo = $objView->objSiteInfo;
+$arrInfo = $objSiteInfo->data;
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+
+// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+$arrData = sfGetOrderTemp($uniqid);
+
+// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+// ÂåÉ½¾¦ÉÊ¾ðÊó
+$arrMainProduct = $objPage->arrProductsClass[0];
+
+// »ÙÊ§¤¤¾ðÊó¤ò¼èÆÀ
+$arrPayment = $objQuery->getall("SELECT module_id, memo01, memo02, memo03, memo04, memo05, memo06, memo07, memo08, memo09, memo10 FROM dtb_payment WHERE payment_id = ? ", array($arrData["payment_id"]));
+
+// trans_code¤ËÃÍ¤¬¤¢¤ê³î¤Ä¡¢Àµ¾ï½ªÎ»¤Î¤È¤­¤Ï¥ª¡¼¥À¡¼³ÎÇ§¤ò¹Ô¤¦¡£
+if($_GET["result"] == "1"){
+	
+	// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+	$objSiteSess->setRegistFlag();
+	
+	// GET¥Ç¡¼¥¿¤òÊÝÂ¸
+	$arrVal["credit_result"] = $_GET["result"];
+	$arrVal["memo01"] = PAYMENT_CREDIT_ID;
+	$arrVal["memo03"] = $arrPayment[0]["module_id"];
+	$sqlval["memo04"] = sfGetXMLValue($arrXML,'RESULT','TRANS_CODE');
+
+	// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥³¡¼¥É
+	$arrMemo["trans_code"] = array("name"=>"Epsilon¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥³¡¼¥É", "value" => $_GET["trans_code"]);
+	$arrVal["memo02"] = serialize($arrMemo);
+
+	// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë¹¹¿·
+	sfRegistTempOrder($uniqid, $arrVal);
+
+	// ´°Î»²èÌÌ¤Ø
+	if (GC_MobileUserAgent::isMobile()) {
+		header("Location: " .  gfAddSessionId(URL_SHOP_COMPLETE));
+	} else {
+		header("Location: " .  URL_SHOP_COMPLETE);
+	}
+}
+
+// ¥Ç¡¼¥¿Á÷¿®
+lfSendCredit($arrData, $arrPayment, $arrMainProduct);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+
+// ¥Ç¡¼¥¿Á÷¿®½èÍý
+function lfSendCredit($arrData, $arrPayment, $arrMainProduct, $again = true){
+	global $objSiteSess;
+	
+	// ¥Ç¡¼¥¿Á÷¿®ÀèCGI
+	$order_url = $arrPayment[0]["memo02"];
+
+	// Èó²ñ°÷¤Î¤È¤­¤Ï user_id ¤Ë not_member¤ÈÁ÷¤ë
+	($arrData["customer_id"] == 0) ? $user_id = "not_member" : $user_id = $arrData["customer_id"];	
+	
+	// Á÷¿®¥Ç¡¼¥¿À¸À®
+	$item_name = $arrMainProduct["name"] . "¡ß" . $arrMainProduct["quantity"] . "¸Ä (ÂåÉ½)";
+	$arrSendData = array(
+		'contract_code' => $arrPayment[0]["memo01"],						// ·ÀÌó¥³¡¼¥É
+		'user_id' => $user_id ,												// ¥æ¡¼¥¶ID
+		'user_name' => $arrData["order_name01"].$arrData["order_name02"],	// ¥æ¡¼¥¶Ì¾
+		'user_mail_add' => $arrData["order_email"],							// ¥á¡¼¥ë¥¢¥É¥ì¥¹
+		'order_number' => $arrData["order_id"],								// ¥ª¡¼¥À¡¼ÈÖ¹æ
+		'item_code' => $arrMainProduct["product_code"],						// ¾¦ÉÊ¥³¡¼¥É(ÂåÉ½)
+		'item_name' => $item_name,											// ¾¦ÉÊÌ¾(ÂåÉ½)
+		'item_price' => $arrData["payment_total"],							// ¾¦ÉÊ²Á³Ê(ÀÇ¹þ¤ßÁí³Û)
+		'st_code' => $arrPayment[0]["memo04"],								// ·èºÑ¶èÊ¬
+		'mission_code' => '1',												// ²Ý¶â¶èÊ¬(¸ÇÄê)
+		'process_code' => '1',												// ½èÍý¶èÊ¬(¸ÇÄê)
+		'xml' => '1',														// ±þÅú·Á¼°(¸ÇÄê)
+		'memo1' => "",														// Í½È÷01
+		'memo2' => ECCUBE_PAYMENT . "_" . date("YmdHis"),					// Í½È÷02
+	);
+
+	// ¥Ç¡¼¥¿Á÷¿®
+	$arrXML = sfPostPaymentData($order_url, $arrSendData);
+	
+	// ¥¨¥é¡¼¤¬¤¢¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë
+	$err_code = sfGetXMLValue($arrXML,'RESULT','ERR_CODE');
+	
+	if($err_code != "") {
+		$err_detail = sfGetXMLValue($arrXML,'RESULT','ERR_DETAIL');
+		
+		// ·èºÑ¶èÊ¬¥¨¥é¡¼¤Î¾ì¹ç¤Ë¤Ï VISA,MASTER ¤Î¤ß¤ÇºÆÁ÷¿®¤ò»î¤ß¤ë
+		if($err_code == "909" and $again){
+			$arrPayment[0]["memo04"] = "10000-0000-00000";
+			lfSendCredit($arrData, $arrPayment, $arrMainProduct, false);
+		}
+		sfDispSiteError(FREE_ERROR_MSG, "", true, "¹ØÆþ½èÍýÃæ¤Ë°Ê²¼¤Î¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br /><br /><br />¡¦" . $err_detail . "<br /><br /><br />¤³¤Î¼êÂ³¤­¤ÏÌµ¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£");
+	} else {
+		// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		
+		// ·ÈÂÓÃ¼Ëö¤Î¾ì¹ç¤Ï¡¢¥»¥Ã¥·¥ç¥óID¡¦¥ª¡¼¥À¡¼ÈÖ¹æ¡¦Ìá¤Ã¤Æ¤¯¤ëURL¤òÊÝÂ¸¤·¤Æ¤ª¤¯¡£
+		if (GC_MobileUserAgent::isMobile()) {
+			sfMobileSetExtSessionId('order_number', $arrData['order_id'], 'shopping/load_payment_module.php');
+			sfMobileSetExtSessionId('order_number', $arrData['order_id'], 'shopping/confirm.php');
+		}
+
+		$url = sfGetXMLValue($arrXML,'RESULT','REDIRECT');
+		header("Location: " . $url);
+	}
+}
+
+?>
Index: /branches/mobile/data/downloads/module/mdl_epsilon/convenience_mobile.tpl
===================================================================
--- /branches/mobile/data/downloads/module/mdl_epsilon/convenience_mobile.tpl	(revision 11409)
+++ /branches/mobile/data/downloads/module/mdl_epsilon/convenience_mobile.tpl	(revision 11409)
@@ -0,0 +1,47 @@
+<center>¥³¥ó¥Ó¥Ë·èºÑ</center>
+
+<hr>
+
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+<input type="hidden" name="mode" value="send">
+<input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->">
+
+²¼µ­¤«¤é¡¢¤ª»ÙÊ§¤¤¤¹¤ë¥³¥ó¥Ó¥Ë¤ò¤´ÁªÂò¤·¡¢É¬Í×»ö¹à¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+ÆþÎÏ¸å¡¢°ìÈÖ²¼¤Î¡Ö¼¡¤Ø¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+
+<br>
+
+¥³¥ó¥Ó¥Ë¤Î¼ïÎà<br>
+<font color="#ff0000"><!--{$arrErr.convenience}--></font>
+<!--{foreach key=key item=item from=$arrConv}-->
+<input type="radio" name="convenience" value="<!--{$key}-->" <!--{if $smarty.post.convenience == $key}-->checked<!--{/if}-->>
+<!--{$item|escape}--><br>
+<!--{/foreach}-->
+
+À«(¥«¥Ê)<br>
+<font color="#ff0000"><!--{$arrErr.order_kana01}--><!--{$arrErr.order_kana02}--></font>
+<input type="text" name="order_kana01" size="15" value="<!--{$arrForm.order_kana01|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
+
+Ì¾(¥«¥Ê)<br>
+<input type="text" name="order_kana02" size="15" value="<!--{$arrForm.order_kana02|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
+
+ÅÅÏÃÈÖ¹æ<br>
+<font color="#ff0000"><!--{$arrErr.order_tel01}--><!--{$arrErr.order_tel02}--><!--{$arrErr.order_tel03}--></font>
+<input type="text" name="order_tel01" size="6" value="<!--{$arrForm.order_tel01|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">-<input type="text" name="order_tel02" size="6" value="<!--{$arrForm.order_tel02|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">-<input type="text" name="order_tel03" size="6" value="<!--{$arrForm.order_tel03|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4"><br>
+
+<br>
+
+<center><input type="submit" value="¼¡¤Ø"></center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<center>LOCKON CO.,LTD.</center>
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/downloads/module/mdl_epsilon/convenience.php
===================================================================
--- /branches/mobile/data/downloads/module/mdl_epsilon/convenience.php	(revision 11409)
+++ /branches/mobile/data/downloads/module/mdl_epsilon/convenience.php	(revision 11409)
@@ -0,0 +1,255 @@
+<?php
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+
+require_once("../require.php");
+require_once(DATA_PATH . "module/Request.php");
+require_once(MODULE_PATH . "mdl_epsilon/mdl_epsilon.inc");
+
+class LC_Page {
+	function LC_Page() {
+		if (GC_MobileUserAgent::isMobile()) {
+			$this->tpl_mainpage = MODULE_PATH . "mdl_epsilon/convenience_mobile.tpl";
+		} else {
+			$this->tpl_mainpage = MODULE_PATH . "mdl_epsilon/convenience.tpl";
+		}
+		/*
+		 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
+		 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìÉ½¼¨¤òÍÞÀ©¤¹¤ë¡£
+		 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
+		*/
+		session_cache_limiter('private-no-expire');		
+	}
+}
+
+global $arrConvenience;
+global $arrConveni_message;
+
+$objPage = new LC_Page();
+$objView = new SC_SiteView();
+$objSiteInfo = $objView->objSiteInfo;
+$arrInfo = $objSiteInfo->data;
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+lfInitParam();
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ­¤ò¥Á¥§¥Ã¥¯
+$uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
+
+// ¥«¡¼¥È½¸·×½èÍý
+$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
+
+// °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
+$arrData = sfGetOrderTemp($uniqid);
+
+// ¥«¡¼¥È½¸·×¤ò¸µ¤ËºÇ½ª·×»»
+$arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo);
+
+// ÂåÉ½¾¦ÉÊ¾ðÊó
+$arrMainProduct = $objPage->arrProductsClass[0];
+
+// »ÙÊ§¤¤¾ðÊó¤ò¼èÆÀ
+$arrPayment = $objQuery->getall("SELECT module_id, memo01, memo02, memo03, memo04, memo05, memo06, memo07, memo08, memo09, memo10 FROM dtb_payment WHERE payment_id = ? ", array($arrData["payment_id"]));
+
+// ¥Ç¡¼¥¿Á÷¿®ÀèCGI
+$order_url = $arrPayment[0]["memo02"];
+
+switch($_POST["mode"]){
+	//Ìá¤ë
+	case 'return':
+		// Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+		$objSiteSess->setRegistFlag();
+		// ³ÎÇ§¥Ú¡¼¥¸¤Ø°ÜÆ°
+		if (GC_MobileUserAgent::isMobile()) {
+			header("Location: " . gfAddSessionId(URL_SHOP_CONFIRM));
+		} else {
+			header("Location: " . URL_SHOP_CONFIRM);
+		}
+		exit;
+		break;
+
+	case "send":
+		$arrErr = array();
+		$arrErr = $objFormParam->checkError();
+		$objPage->arrErr = $arrErr;
+		
+		// Èó²ñ°÷¤Î¤È¤­¤Ï user_id ¤Ë not_member¤ÈÁ÷¤ë
+		($arrData["customer_id"] == 0) ? $user_id = "not_member" : $user_id = $arrData["customer_id"];
+		
+		if(count($arrErr) <= 0){
+			// Á÷¿®¥Ç¡¼¥¿À¸À®
+			$item_name = $arrMainProduct["name"] . "¡ß" . $arrMainProduct["quantity"] . "¸Ä (ÂåÉ½)";
+			$arrSendData = array(
+				'contract_code' => $arrPayment[0]["memo01"],						// ·ÀÌó¥³¡¼¥É
+				'user_id' => $user_id ,												// ¥æ¡¼¥¶ID
+				'user_name' => $arrData["order_name01"].$arrData["order_name02"],	// ¥æ¡¼¥¶Ì¾
+				'user_mail_add' => $arrData["order_email"],							// ¥á¡¼¥ë¥¢¥É¥ì¥¹
+				'order_number' => $arrData["order_id"],								// ¥ª¡¼¥À¡¼ÈÖ¹æ
+				'item_code' => $arrMainProduct["product_code"],						// ¾¦ÉÊ¥³¡¼¥É(ÂåÉ½)
+				'item_name' => $item_name,											// ¾¦ÉÊÌ¾(ÂåÉ½)
+				'item_price' => $arrData["payment_total"],							// ¾¦ÉÊ²Á³Ê(ÀÇ¹þ¤ßÁí³Û)
+				'st_code' => $arrPayment[0]["memo04"],								// ·èºÑ¶èÊ¬
+				'mission_code' => '1',												// ²Ý¶â¶èÊ¬(¸ÇÄê)
+				'process_code' => '1',												// ½èÍý¶èÊ¬(¸ÇÄê)
+				'xml' => '1',														// ±þÅú·Á¼°(¸ÇÄê)
+				'conveni_code' => $_POST["convenience"],							// ¥³¥ó¥Ó¥Ë¥³¡¼¥É
+				'user_tel' => $_POST["order_tel01"].$_POST["order_tel02"].$_POST["order_tel03"],	// ÅÅÏÃÈÖ¹æ
+				'user_name_kana' => $_POST["order_kana01"].$_POST["order_kana02"],					// »áÌ¾(¥«¥Ê)
+				'haraikomi_mail' => 0,												// Ê§¹þ¥á¡¼¥ë(Á÷¿®¤·¤Ê¤¤)
+				'memo1' => "",														// Í½È÷01
+				'memo2' => ECCUBE_PAYMENT . "_" . date("YmdHis"),					// Í½È÷02
+			);
+			
+			// ¥Ç¡¼¥¿Á÷¿®
+			$arrXML = sfPostPaymentData($order_url, $arrSendData);
+			
+			// ¥¨¥é¡¼¤¬¤¢¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë
+			$err_code = sfGetXMLValue($arrXML,'RESULT','ERR_CODE');
+			
+			if($err_code != "") {
+				$err_detail = sfGetXMLValue($arrXML,'RESULT','ERR_DETAIL');
+				sfDispSiteError(FREE_ERROR_MSG, "", false, "¹ØÆþ½èÍýÃæ¤Ë°Ê²¼¤Î¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br /><br /><br />¡¦" . $err_detail);
+			} else {
+				// Àµ¾ï¤Ê¿ä°Ü¤Ç¤¢¤ë¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
+				$objSiteSess->setRegistFlag();
+
+				$conveni_code = sfGetXMLValue($arrXML,'RESULT','CONVENI_CODE');	// ¥³¥ó¥Ó¥Ë¥³¡¼¥É
+				$conveni_type = lfSetConvMSG("¥³¥ó¥Ó¥Ë¤Î¼ïÎà",$arrConvenience[$conveni_code]);	// ¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				$receipt_no   = lfSetConvMSG("Ê§¹þÉ¼ÈÖ¹æ",sfGetXMLValue($arrXML,'RESULT','RECEIPT_NO'));	// Ê§¹þÉ¼ÈÖ¹æ
+				$payment_url = lfSetConvMSG("Ê§¹þÉ¼URL",sfGetXMLValue($arrXML,'RESULT','HARAIKOMI_URL'));	// Ê§¹þÉ¼URL
+				$company_code = lfSetConvMSG("´ë¶È¥³¡¼¥É",sfGetXMLValue($arrXML,'RESULT','KIGYOU_CODE'));	// ´ë¶È¥³¡¼¥É
+				$order_no = lfSetConvMSG("¼õÉÕÈÖ¹æ",sfGetXMLValue($arrXML,'RESULT','ORDER_NUMBER'));		// ¼õÉÕÈÖ¹æ
+				$tel = lfSetConvMSG("ÅÅÏÃÈÖ¹æ",$_POST["order_tel01"]."-".$_POST["order_tel02"]."-".$_POST["order_tel03"]);	// ÅÅÏÃÈÖ¹æ
+				$payment_limit = lfSetConvMSG("»ÙÊ§´üÆü",sfGetXMLValue($arrXML,'RESULT','CONVENI_LIMIT'));	// »ÙÊ§´üÆü
+				$trans_code =  sfGetXMLValue($arrXML,'RESULT','TRANS_CODE');	// ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¥³¡¼¥É
+				
+				//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+				switch($conveni_code) {
+				//¥»¥Ö¥ó¥¤¥ì¥Ö¥ó
+				case '11':
+					$arrRet['cv_type'] = $conveni_type;			//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+					$arrRet['cv_payment_url'] = $payment_url;	//Ê§¹þÉ¼URL(PC)
+					$arrRet['cv_receipt_no'] = $receipt_no;		//Ê§¹þÉ¼ÈÖ¹æ
+					$arrRet['br1'] = lfSetConvMSG("","\n\n");
+					$arrRet['cv_message'] = lfSetConvMSG("",$arrConveni_message[$conveni_code]);
+					break;
+				//¥Õ¥¡¥ß¥ê¡¼¥Þ¡¼¥È
+				case '21':
+					$arrRet['cv_type'] = $conveni_type;			//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+					$arrRet['cv_company_code'] = $company_code;	//´ë¶È¥³¡¼¥É
+					$arrRet['cv_order_no'] = $receipt_no;		//¼õÉÕÈÖ¹æ
+					$arrRet['br1'] = lfSetConvMSG("","\n\n");
+					$arrRet['cv_message'] = lfSetConvMSG("",$arrConveni_message[$conveni_code]);
+					break;
+				//¥í¡¼¥½¥ó
+				case '31':
+					$arrRet['cv_type'] = $conveni_type;			//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+					$arrRet['cv_receipt_no'] = $receipt_no;		//Ê§¹þÉ¼ÈÖ¹æ
+					$arrRet['cv_tel'] = $tel;					//ÅÅÏÃÈÖ¹æ
+					$arrRet['br1'] = lfSetConvMSG("","\n\n");
+					$arrRet['cv_message'] = lfSetConvMSG("",$arrConveni_message[$conveni_code]);
+					break;
+				//¥»¥¤¥³¡¼¥Þ¡¼¥È
+				case '32':
+					$arrRet['cv_type'] =$conveni_type;			//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+					$arrRet['cv_receipt_no'] = $receipt_no;		//Ê§¹þÉ¼ÈÖ¹æ
+					$arrRet['cv_tel'] = $tel;					//ÅÅÏÃÈÖ¹æ
+					$arrRet['br1'] = lfSetConvMSG("","\n\n");
+					$arrRet['cv_message'] = lfSetConvMSG("",$arrConveni_message[$conveni_code]);
+					break;
+				//¥ß¥Ë¥¹¥È¥Ã¥×
+				case '33':
+					$arrRet['cv_type'] = $conveni_type;			//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+					$arrRet['cv_payment_url'] = $payment_url;	//Ê§¹þÉ¼URL
+					$arrRet['br1'] = lfSetConvMSG("","\n\n");
+					$arrRet['cv_message'] = lfSetConvMSG("",$arrConveni_message[$conveni_code]);
+					break;
+				//¥Ç¥¤¥ê¡¼¥ä¥Þ¥¶¥­
+				case '34':
+					$arrRet['cv_type'] = $conveni_type;			//¥³¥ó¥Ó¥Ë¤Î¼ïÎà
+					$arrRet['cv_payment_url'] = $payment_url;	//Ê§¹þÉ¼URL
+					$arrRet['br1'] = lfSetConvMSG("","\n\n");
+					$arrRet['cv_message'] = lfSetConvMSG("",$arrConveni_message[$conveni_code]);
+					break;
+				}
+
+				//»ÙÊ§´ü¸Â
+				$arrRet['br2'] = lfSetConvMSG("","\n\n");
+				$arrRet['cv_payment_limit'] = $payment_limit;
+				$arrRet['br3'] = lfSetConvMSG("","\n\n");
+
+				// ¥¿¥¤¥È¥ë
+				$arrRet['title'] = lfSetConvMSG("¥³¥ó¥Ó¥Ë·èºÑ", true);
+
+				
+				// ¥¹¥Æ¡¼¥¿¥¹¤ÏÌ¤Æþ¶â¤Ë¤¹¤ë
+				$sqlval['status'] = 2;
+
+				//¥³¥ó¥Ó¥Ë·èºÑ¾ðÊó¤ò³ÊÇ¼
+				$sqlval['conveni_data'] = serialize($arrRet);
+				$sqlval['memo01'] = PAYMENT_CONVENIENCE_ID;
+				$sqlval['memo02'] = serialize($arrRet);
+				$sqlval["memo03"] = $arrPayment[0]["module_id"];
+				$sqlval["memo04"] = $trans_code;
+
+				// ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ë¹¹¿·
+				sfRegistTempOrder($uniqid, $sqlval);
+
+				if (GC_MobileUserAgent::isMobile()) {
+					header("Location: " . gfAddSessionId(URL_SHOP_COMPLETE));
+				} else {
+					header("Location: " . URL_SHOP_COMPLETE);
+				}
+			}
+		}
+		break;
+		
+	default:
+		$objFormParam->setParam($arrData);
+		break;
+}
+
+// ÍøÍÑ²ÄÇ½¥³¥ó¥Ó¥Ë
+$objFormParam->setValue("convenience", $arrPayment[0]["memo05"]);
+$objFormParam->splitParamCheckBoxes("convenience");
+$arrUseConv = $objFormParam->getValue("convenience");
+foreach($arrUseConv as $key => $val){
+	$arrConv[$val] = $arrConvenience[$val];
+}
+
+// ¹ØÆþ¶â³Û¤¬30Ëü¤è¤êÂç¤­¤±¤ì¤Ð¥»¥Ö¥ó¥¤¥ì¥Ö¥ó¤ÏÍøÍÑÉÔ²Ä
+if($arrData["payment_total"] > SEVEN_CHARGE_MAX){
+	unset($arrConv[11]);
+}
+
+$objPage->arrConv = $arrConv;
+
+$objPage->arrForm =$objFormParam->getHashArray();
+
+$objView->assignobj($objPage);
+$objView->display(SITE_FRAME);
+
+//---------------------------------------------------------------------------------------------------------------------------------------------------------
+//¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
+function lfInitParam() {
+	global $objFormParam;
+	$objFormParam->addParam("¥³¥ó¥Ó¥Ë¤Î¼ïÎà", "convenience", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_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_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"));
+}
+
+function lfSetConvMSG($name, $value){
+	return array("name" => $name, "value" => $value);
+}
+
+?>
Index: /branches/mobile/data/downloads/module/mdl_epsilon/mdl_epsilon.php
===================================================================
--- /branches/mobile/data/downloads/module/mdl_epsilon/mdl_epsilon.php	(revision 10158)
+++ /branches/mobile/data/downloads/module/mdl_epsilon/mdl_epsilon.php	(revision 10158)
@@ -0,0 +1,371 @@
+<?php
+/**
+ * 
+ * @copyright	2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ * @version	CVS: $Id$
+ * @link		http://www.lockon.co.jp/
+ *
+ */
+require_once(MODULE_PATH . "mdl_epsilon/mdl_epsilon.inc");
+
+$arrPayment = array(
+	1 => '¥¯¥ì¥¸¥Ã¥È',
+	2 => '¥³¥ó¥Ó¥Ë'
+);
+
+$arrCredit = array(
+	1 => 'VISA, MASTER, Diners',
+	2 => 'JCB, AMEX'
+);
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = MODULE_PATH . 'mdl_epsilon/mdl_epsilon.tpl';
+		$this->tpl_subtitle = '¥¤¥×¥·¥í¥ó·èºÑ¥â¥¸¥å¡¼¥ë';
+		global $arrPayment;
+		$this->arrPayment = $arrPayment;
+		global $arrCredit;
+		$this->arrCredit = $arrCredit;
+		global $arrConvenience;
+		$this->arrConvenience = $arrConvenience;
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+// ¥³¥ó¥Ó¥ËÆþ¶â¥Á¥§¥Ã¥¯
+lfEpsilonCheck();
+
+// Ç§¾Ú³ÎÇ§
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+$objFormParam = lfInitParam($objFormParam);
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+// ÈÆÍÑ¹àÌÜ¤òÄÉ²Ã(É¬¿Ü¡ª¡ª)
+sfAlterMemo();
+
+switch($_POST['mode']) {
+case 'edit':
+	// ÆþÎÏ¥¨¥é¡¼È½Äê
+	$objPage->arrErr = lfCheckError();
+
+	// ¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç¤Ë¤Ï¥Ç¡¼¥¿¤ò¹¹¿·	
+	if(count($objPage->arrErr) == 0) {
+		// ¥Ç¡¼¥¿¹¹¿·
+		lfUpdPaymentDB();
+		
+		// javascript¼Â¹Ô
+		$objPage->tpl_onload = 'alert("ÅÐÏ¿´°Î»¤·¤Þ¤·¤¿¡£\n´ðËÜ¾ðÊó¡ä»ÙÊ§ÊýË¡ÀßÄê¤è¤ê¾ÜºÙÀßÄê¤ò¤·¤Æ¤¯¤À¤µ¤¤¡£"); window.close();';
+	}
+	break;
+case 'module_del':
+	// ÈÆÍÑ¹àÌÜ¤ÎÂ¸ºß¥Á¥§¥Ã¥¯
+	if(sfColumnExists("dtb_payment", "memo01")){
+		// ¥Ç¡¼¥¿¤Îºï½ü¥Õ¥é¥°¤ò¤¿¤Æ¤ë
+		$objQuery->query("UPDATE dtb_payment SET del_flg = 1 WHERE module_id = ?", array(MDL_EPSILON_ID));
+	}
+	break;
+default:
+	// ¥Ç¡¼¥¿¤Î¥í¡¼¥É
+	lfLoadData();	
+	break;
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objView->assignobj($objPage);					//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display($objPage->tpl_mainpage);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+//-------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam($objFormParam) {
+	$objFormParam->addParam("·ÀÌó¥³¡¼¥É", "code", INT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+	$objFormParam->addParam("ÀÜÂ³ÀèURL", "url", URL_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "URL_CHECK"));
+	$objFormParam->addParam("ÍøÍÑ·èºÑ", "payment", "", "", array("EXIST_CHECK"));
+	$objFormParam->addParam("ÍøÍÑ¥¯¥ì¥¸¥Ã¥È", "credit");	
+	$objFormParam->addParam("ÍøÍÑ¥³¥ó¥Ó¥Ë", "convenience");	
+	return $objFormParam;
+}
+
+// ¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+function lfCheckError(){
+	global $objFormParam;
+	
+	$arrErr = $objFormParam->checkError();
+	
+	// ÍøÍÑ¥¯¥ì¥¸¥Ã¥È¡¢ÍøÍÑ¥³¥ó¥Ó¥Ë¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯
+	$arrChkPay = $_POST["payment"];
+	foreach((array)$arrChkPay as $key => $val){
+		// ÍøÍÑ¥¯¥ì¥¸¥Ã¥È
+		if($val == 1 and count($_POST["credit"]) <= 0){
+			$arrErr["credit"] = "ÍøÍÑ¥¯¥ì¥¸¥Ã¥È¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+		// ÍøÍÑ¥³¥ó¥Ó¥Ë
+		if($val == 2 and count($_POST["convenience"]) <= 0){
+			$arrErr["convenience"] = "ÍøÍÑ¥³¥ó¥Ó¥Ë¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+		}
+	}
+
+	// sslÂÐ±þÈ½Äê
+	if(!extension_loaded('openssl') and ereg( "^https://", $_POST["url"] )){
+		$arrErr["url"] = "¤³¤Î¥µ¡¼¥Ð¡¼¤ÏSSL¤ËÂÐ±þ¤·¤Æ¤¤¤Þ¤»¤ó¡£<br>http¤ÇÀÜÂ³¤·¤Æ¤¯¤À¤µ¤¤¡£";
+	}
+
+	// ÀÜÂ³¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+	if(count($arrErr) == 0) $arrErr = lfChkConnect();
+
+	return $arrErr;
+}
+
+// ÀÜÂ³¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+function lfChkConnect(){
+	global $objQuery;
+	global $objPage;
+	
+	$arrRet = array();
+	
+	// ¥á¡¼¥ë¥¢¥É¥ì¥¹¼èÆÀ
+	$email = $objQuery->getone("SELECT email03 FROM dtb_baseinfo");
+
+	// ·ÀÌó¥³¡¼¥É	
+	(in_array(1, (array)$_POST["payment"])) ? $cre = "1" : $cre = "0";
+	(in_array(2, (array)$_POST["payment"])) ? $con = "1" : $con = "0";
+	$st_code = $cre . "0" . $con . "00-0000-00000";
+	
+	// Á÷¿®¥Ç¡¼¥¿À¸À®
+	$arrSendData = array(
+		'contract_code' => $_POST["code"],		// ·ÀÌó¥³¡¼¥É
+		'user_id' => "connect_test",			// ¥æ¡¼¥¶ID
+		'user_name' => "ÀÜÂ³¥Æ¥¹¥È",			// ¥æ¡¼¥¶Ì¾
+		'user_mail_add' => $email,				// ¥á¡¼¥ë¥¢¥É¥ì¥¹
+		'st_code' => $st_code,					// ·èºÑ¶èÊ¬
+		'process_code' => '3',					// ½èÍý¶èÊ¬(¸ÇÄê)
+		'xml' => '1',							// ±þÅú·Á¼°(¸ÇÄê)
+	);
+	
+	// ¥Ç¡¼¥¿Á÷¿®
+	$arrXML = sfPostPaymentData($_POST["url"], $arrSendData, false);
+	if($arrXML == "") {
+		$arrRet["url"] = "ÀÜÂ³¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£<br>";
+		return $arrRet;	
+	}
+	
+	// ¥¨¥é¡¼¤¬¤¢¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë
+	$err_code = sfGetXMLValue($arrXML,'RESULT','ERR_CODE');
+	switch ($err_code) {
+		case "":
+			break;
+		case "607":
+			$arrRet["code"] = "·ÀÌó¥³¡¼¥É¤¬°ã¤¤¤Þ¤¹¡£<br>";
+			return $arrRet;
+		default :
+			$arrRet["service"] = sfGetXMLValue($arrXML,'RESULT','ERR_DETAIL');
+			return $arrRet;
+	}
+
+	// ¥³¥ó¥Ó¥Ë»ØÄê¤¬¤¢¤ì¤Ð¥³¥ó¥Ó¥ËÊ¬¥ë¡¼¥×¤·¡¢¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
+	if(count($_POST["convenience"]) > 0){
+		foreach($_POST["convenience"] as $key => $val){
+			// Á÷¿®¥Ç¡¼¥¿À¸À®
+			$arrSendData['conveni_code'] = $val;			// ¥³¥ó¥Ó¥Ë¥³¡¼¥É
+			$arrSendData['user_tel'] = "0300000000";		// ¥À¥ß¡¼ÅÅÏÃÈÖ¹æ
+			$arrSendData['user_name_kana'] = "Á÷¿®¥Æ¥¹¥È";	// ¥À¥ß¡¼»áÌ¾(¥«¥Ê)
+			$arrSendData['haraikomi_mail'] = 0;				// Ê§¹þ¥á¡¼¥ë(Á÷¿®¤·¤Ê¤¤)
+			
+			// ¥Ç¡¼¥¿Á÷¿®
+			$arrXML = sfPostPaymentData($_POST["url"], $arrSendData, false);
+			if($arrXML == "") {
+				$arrRet["url"] = "ÀÜÂ³¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£<br>";
+				return $arrRet;	
+			}
+			
+			// ¥¨¥é¡¼¤¬¤¢¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë
+			$err_code = sfGetXMLValue($arrXML,'RESULT','ERR_CODE');
+			if($err_code != ""){
+				$arrRet["service"] = sfGetXMLValue($arrXML,'RESULT','ERR_DETAIL');
+				return $arrRet;
+			}
+		}
+	}
+	
+	return $arrRet;	
+}
+
+// ÅÐÏ¿¥Ç¡¼¥¿¤òÆÉ¤ß¹þ¤à
+function lfLoadData(){
+	global $objFormParam;
+	
+	//¥Ç¡¼¥¿¤ò¼èÆÀ
+	$arrRet = lfGetPaymentDB(" AND del_flg = '0'");
+	
+	// ÃÍ¤ò¥»¥Ã¥È
+	$objFormParam->setParam($arrRet[0]);
+
+	// ²èÌÌÉ½¼¨ÍÑ¤Ë¥Ç¡¼¥¿¤òÊÑ´¹
+	$arrDisp = array();
+	foreach($arrRet as $key => $val){
+		// ÍøÍÑ·èºÑ¤òÉ½¼¨ÍÑ¤ËÊÑ´¹
+		$arrDisp["payment"][$key] = $val["payment"];
+		
+		// ¥¯¥ì¥¸¥Ã¥È¤Î·èºÑ¶èÊ¬¤ò¼èÆÀ
+		if($val["payment"] == 1) $credit = $val["payment_code"];
+		
+		// ¥³¥ó¥Ó¥Ë
+		if($val["payment"] == 2) $arrDisp["convenience"] = $val["convenience"];
+	}
+	$objFormParam->setParam($arrDisp);
+	$objFormParam->splitParamCheckBoxes("convenience");
+	
+	// ¥¯¥ì¥¸¥Ã¥È
+	if(substr($credit, 0, 1)) $arrCredit["credit"][] = 1;
+	if(substr($credit, 1, 1)) $arrCredit["credit"][] = 2;
+	$objFormParam->setParam($arrCredit);
+}
+
+// DB¤«¤é¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+function lfGetPaymentDB($where = "", $arrWhereVal = array()){
+	global $objQuery;
+	
+	$arrVal = array(MDL_EPSILON_ID);
+	$arrVal = array_merge($arrVal, $arrWhereVal);
+	
+	$arrRet = array();
+	$sql = "SELECT 
+				module_id, 
+				memo01 as code, 
+				memo02 as url, 
+				memo03 as payment,
+				memo04 as payment_code, 
+				memo05 as convenience
+			FROM dtb_payment WHERE module_id = ? " . $where;
+	$arrRet = $objQuery->getall($sql, $arrVal);
+
+	return $arrRet;
+}
+
+
+// ¥Ç¡¼¥¿¤Î¹¹¿·½èÍý
+function lfUpdPaymentDB(){
+	global $objQuery;
+	global $objSess;
+	
+	// ÍøÍÑ¥³¥ó¥Ó¥Ë¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢¥Ï¥¤¥Õ¥ó¶èÀÚ¤ê¤ËÊÔ½¸¤¹¤ë
+	$convCnt = count($_POST["convenience"]);
+	if($convCnt > 0){
+		$convenience = $_POST["convenience"][0];
+		for($i = 1 ; $i < $convCnt ; $i++){
+			$convenience .= "-" . $_POST["convenience"][$i];
+		}
+	}
+		
+	// del_flg¤òºï½ü¤Ë¤·¤Æ¤ª¤¯
+	$del_sql = "UPDATE dtb_payment SET del_flg = 1 WHERE module_id = ? ";
+	$arrDel = array(MDL_EPSILON_ID);
+	$objQuery->query($del_sql, $arrDel);
+	
+	// ¥Ç¡¼¥¿ÅÐÏ¿
+	foreach($_POST["payment"] as $key => $val){
+		// ¥é¥ó¥¯¤ÎºÇÂçÃÍ¤ò¼èÆÀ¤¹¤ë
+		$max_rank = $objQuery->getone("SELECT max(rank) FROM dtb_payment");
+
+		// »ÙÊ§ÊýË¡¥Ç¡¼¥¿¤ò¼èÆÀ			
+		$arrPaymentData = lfGetPaymentDB("AND memo03 = ?", array($val));
+		
+		// ¥¯¥ì¥¸¥Ã¥È¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤Ð¥¯¥ì¥¸¥Ã¥È¤òÅÐÏ¿¤¹¤ë
+		if($val == 1){
+			(in_array(1, $_POST["credit"])) ? $visa = "1" : $visa = "0";
+			(in_array(2, $_POST["credit"])) ? $jcb = "1" : $jcb = "0";
+			$arrData = array(			
+				"payment_method" => "Epsilon¥¯¥ì¥¸¥Ã¥È"
+				,"fix" => 3
+				,"creator_id" => $objSess->member_id
+				,"create_date" => "now()"
+				,"update_date" => "now()"
+				,"upper_rule" => 500000
+				,"module_id" => MDL_EPSILON_ID
+				,"module_path" => MODULE_PATH . "mdl_epsilon/card.php"
+				,"memo01" => $_POST["code"]
+				,"memo02" => $_POST["url"]
+				,"memo03" => $val
+				,"memo04" => $visa . $jcb . "000-0000-00000"
+				,"del_flg" => "0"
+				,"charge_flg" => "2"
+				,"upper_rule_max" => CHARGE_MAX
+				
+			);
+		}
+		
+		// ¥³¥ó¥Ó¥Ë¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ì¤Ð¥³¥ó¥Ó¥Ë¤òÅÐÏ¿¤¹¤ë
+		if($val == 2){
+			
+			// ¥»¥Ö¥ó¥¤¥ì¥Ö¥ó¤Î¤ßÁªÂò¤·¤¿¾ì¹ç¤Ë¤ÏÍøÍÑ¾å¸Â¤ò30Ëü¤Ë¤¹¤ë¡£
+			if(count($_POST["convenience"]) == 1 and $_POST["convenience"][0] == 11) {
+				$upper_rule_max = SEVEN_CHARGE_MAX;
+				($arrPaymentData["upper_rule"] > $upper_rule_max or $arrPaymentData["upper_rule"] == "") ? $upper_rule = $upper_rule_max : $upper_rule = $arrPaymentData["upper_rule"];
+			}else{
+				$upper_rule_max = CHARGE_MAX;
+				$upper_rule = $upper_rule_max;
+			}
+			
+			$arrData = array(
+				"payment_method" => "Epsilon¥³¥ó¥Ó¥Ë"
+				,"fix" => 3
+				,"creator_id" => $objSess->member_id
+				,"create_date" => "now()"
+				,"update_date" => "now()"
+				,"upper_rule" => $upper_rule
+				,"module_id" => MDL_EPSILON_ID
+				,"module_path" => MODULE_PATH . "mdl_epsilon/convenience.php"
+				,"memo01" => $_POST["code"]
+				,"memo02" => $_POST["url"]
+				,"memo03" => $val
+				,"memo04" => "00100-0000-00000"
+				,"memo05" => $convenience
+				,"del_flg" => "0"
+				,"charge_flg" => "1"
+				,"upper_rule_max" => $upper_rule_max
+			);
+		}
+
+		// ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ì¤ÐUPDATE¡¢Ìµ¤±¤ì¤ÐINSERT
+		if(count($arrPaymentData) > 0){
+			$objQuery->update("dtb_payment", $arrData, " module_id = '" . MDL_EPSILON_ID . "' AND memo03 = '" . $val ."'");
+		}else{
+			$arrData["rank"] = $max_rank + 1;
+			$objQuery->insert("dtb_payment", $arrData);
+		}
+	}
+}
+
+// ¥³¥ó¥Ó¥ËÆþ¶â³ÎÇ§½èÍý
+function lfEpsilonCheck(){
+	global $objQuery;
+	
+	// trans_code ¤ò»ØÄê¤µ¤ì¤Æ¤¤¤Æ³î¤Ä¡¢Æþ¶âºÑ¤ß¤Î¾ì¹ç
+	if($_POST["trans_code"] != "" and $_POST["paid"] == 1 and $_POST["order_number"] != ""){
+		// ¥¹¥Æ¡¼¥¿¥¹¤òÆþ¶âºÑ¤ß¤ËÊÑ¹¹¤¹¤ë
+		$sql = "UPDATE dtb_order SET status = 6, update_date = now() WHERE order_id = ? AND memo04 = ? ";
+		$objQuery->query($sql, array($_POST["order_number"], $_POST["trans_code"]));
+		
+		// POST¤ÎÆâÍÆ¤òÁ´¤Æ¥í¥°ÊÝÂ¸
+		$log_path = DATA_PATH . "logs/epsilon.log";
+		gfPrintLog("epsilon conveni start---------------------------------------------------------", $log_path);
+		foreach($_POST as $key => $val){
+			gfPrintLog( "\t" . $key . " => " . $val, $log_path);
+		}
+		gfPrintLog("epsilon conveni end-----------------------------------------------------------", $log_path);
+		
+		//±þÅú·ë²Ì¤òÉ½¼¨
+		echo "1";
+	}
+}
+
+?>
Index: /branches/mobile/data/downloads/module/affiliate.php
===================================================================
--- /branches/mobile/data/downloads/module/affiliate.php	(revision 10138)
+++ /branches/mobile/data/downloads/module/affiliate.php	(revision 10138)
@@ -0,0 +1,85 @@
+<?php
+/**
+ * 
+ * @copyright	2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ * @version	CVS: $Id$
+ * @link		http://www.lockon.co.jp/
+ *
+ */
+
+ 
+ 
+require_once("./require.php");
+
+$arrConversionPage = array(
+	1 => '¾¦ÉÊ¹ØÆþ´°Î»²èÌÌ',
+	2 => '²ñ°÷ÅÐÏ¿´°Î»²èÌÌ'
+);
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+	//¥³¥ó¥¹¥È¥é¥¯¥¿
+	function LC_Page() {
+		//¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+		$this->tpl_mainpage = MODULE_PATH . 'affiliate.tpl';
+		$this->tpl_subtitle = '¥¢¥Õ¥£¥ê¥¨¥¤¥È¥¿¥°Ëä¤á¹þ¤ß';
+		global $arrConversionPage;
+		$this->arrConversionPage = $arrConversionPage;
+	}
+}
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+
+// Ç§¾Ú³ÎÇ§
+$objSess = new SC_Session();
+sfIsSuccess($objSess);
+
+// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
+$objFormParam = new SC_FormParam();
+$objFormParam = lfInitParam($objFormParam);
+// POSTÃÍ¤Î¼èÆÀ
+$objFormParam->setParam($_POST);
+
+switch($_POST['mode']) {
+case 'edit':
+	// ÆþÎÏ¥¨¥é¡¼È½Äê
+	$objPage->arrErr = $objFormParam->checkError();
+	if(count($objPage->arrErr) == 0) {
+		$arrRet = $objQuery->select("sub_data", "dtb_module", "module_id = ?", array(AFF_TAG_MID));
+		$arrSubData = unserialize($arrRet[0]['sub_data']);
+		$arrRet = $objFormParam->getHashArray();		
+		$arrSubData[$arrRet['conv_page']] = $arrRet['aff_tag'];
+		$sqlval['sub_data'] = serialize($arrSubData);
+		$objQuery = new SC_Query();
+		$objQuery->update("dtb_module", $sqlval, "module_id = ?", array(AFF_TAG_MID));
+		// javascript¼Â¹Ô
+		$objPage->tpl_onload = "window.close();";
+	}
+	break;
+// ¥³¥ó¥Ð¡¼¥¸¥ç¥ó¥Ú¡¼¥¸¤ÎÁªÂò
+case 'select':
+	if(is_numeric($_POST['conv_page'])) {
+		// sub_data¤è¤ê¥¿¥°¾ðÊó¤òÆÉ¤ß¹þ¤à
+		$conv_page = $_POST['conv_page'];
+		$arrRet = $objQuery->select("sub_data", "dtb_module", "module_id = ?", array(AFF_TAG_MID));
+		$arrSubData = unserialize($arrRet[0]['sub_data']);
+		$aff_tag = $arrSubData[$conv_page];
+		$objFormParam->setValue('conv_page', $conv_page);
+		$objFormParam->setValue('aff_tag', $aff_tag);		
+	}
+	break;
+default:
+	break;
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+$objView->assignobj($objPage);					//ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
+$objView->display($objPage->tpl_mainpage);		//¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
+//-------------------------------------------------------------------------------------------------------
+/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
+function lfInitParam($objFormParam) {
+	$objFormParam->addParam("¥³¥ó¥Ð¡¼¥¸¥ç¥ó¥Ú¡¼¥¸", "conv_page", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+	$objFormParam->addParam("¥¢¥Õ¥£¥ê¥¨¥¤¥È¥¿¥°", "aff_tag", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));	
+	return $objFormParam;
+}
+?>
Index: /branches/mobile/data/install.inc
===================================================================
--- /branches/mobile/data/install.inc	(revision 6019)
+++ /branches/mobile/data/install.inc	(revision 6019)
@@ -0,0 +1,2 @@
+<?php
+?>
Index: /branches/mobile/data/Smarty/templates/admin/design/upload.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/admin/design/upload.tpl	(revision 10419)
+++ /branches/mobile/data/Smarty/templates/admin/design/upload.tpl	(revision 10419)
@@ -0,0 +1,128 @@
+<!--{*
+/*
+ * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ */
+*}-->
+<!--¡ú¡ú¥á¥¤¥ó¥³¥ó¥Æ¥ó¥Ä¡ú¡ú-->
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->" enctype="multipart/form-data">
+<input type="hidden" name="mode" value="upload">
+<table width="878" border="0" cellspacing="0" cellpadding="0" summary=" ">
+	<tr valign="top">
+		<td background="<!--{$smarty.const.URL_DIR}-->img/contents/navi_bg.gif" height="402">
+			<!--¢§SUB NAVI-->
+			<!--{include file=$tpl_subnavi}-->
+			<!--¢¥SUB NAVI-->
+		</td>
+		<td class="mainbg">
+			<!--¢§¥¢¥Ã¥×¥í¡¼¥É¥Æ¡¼¥Ö¥ë¤³¤³¤«¤é-->
+			<table width="737" border="0" cellspacing="0" cellpadding="0" summary=" ">
+				<!--¥á¥¤¥ó¥¨¥ê¥¢-->
+				<tr>
+					<td align="center">
+						<table width="706" border="0" cellspacing="0" cellpadding="0" summary=" ">
+							<tr><td height="14"></td></tr>
+							<tr>
+								<td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/main_top.jpg" width="706" height="14" alt=""></td>
+							</tr>
+							<tr>
+								<td background="<!--{$smarty.const.URL_DIR}-->img/contents/main_left.jpg"><img src="<!--{$smarty.const.URL_DIR}-->img/common/_.gif" width="14" height="1" alt=""></td>
+								<td bgcolor="#cccccc">
+								<table width="678" border="0" cellspacing="0" cellpadding="0" summary=" ">
+									<tr>
+										<td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/contents_title_top.gif" width="678" height="7" alt=""></td>
+									</tr>
+									<tr>
+										<td background="<!--{$smarty.const.URL_DIR}-->img/contents/contents_title_left_bg.gif"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/contents_title_left.gif" width="22" height="12" alt=""></td>
+										<td bgcolor="#636469" width="638" class="fs14n"><span class="white"><!--¥³¥ó¥Æ¥ó¥Ä¥¿¥¤¥È¥ë--><!--{$template_name}--></span></td>
+										<td background="<!--{$smarty.const.URL_DIR}-->img/contents/contents_title_right_bg.gif"><img src="<!--{$smarty.const.URL_DIR}-->img/common/_.gif" width="18" height="1" alt=""></td>
+									</tr>
+									<tr>
+										<td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/contents_title_bottom.gif" width="678" height="7" alt=""></td>
+									</tr>
+									<tr>
+										<td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/main_bar.jpg" width="678" height="10" alt=""></td>
+									</tr>
+								</table>
+								<table width="678" border="0" cellspacing="0" cellpadding="0" summary=" ">
+									<tr><td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/main_bar.jpg" width="678" height="10" alt=""></td></tr>
+								</table>
+								
+								<table width="678" border="0" cellspacing="1" cellpadding="8" summary=" ">
+									<!--{assign var=key value="template_code"}-->
+									<tr class="fs12n">
+										<td bgcolor="#f2f1ec">¥Æ¥ó¥×¥ì¡¼¥È¥³¡¼¥É</td>
+										<td bgcolor="#ffffff"><span class="red"><!--{$arrErr[$key]}--></span><input type="text" name="<!--{$arrForm[$key].keyname}-->" value="<!--{$arrForm[$key].value|escape}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" class="box54"></td>
+									</tr>
+									<!--{assign var=key value="template_name"}-->
+									<tr class="fs12n">
+										<td bgcolor="#f2f1ec">¥Æ¥ó¥×¥ì¡¼¥ÈÌ¾</td>
+										<td bgcolor="#ffffff"><span class="red"><!--{$arrErr[$key]}--></span><input type="text" name="<!--{$arrForm[$key].keyname}-->" value="<!--{$arrForm[$key].value|escape}-->" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" class="box54"></td>
+									</tr>
+									<!--{assign var=key value="template_file"}-->
+									<tr class="fs12n">
+										<td bgcolor="#f2f1ec">¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë<br/><span class="red"><span class="fs14n">¢¨¥Õ¥¡¥¤¥ë·Á¼°¤Ï.tar/.tar.gz¤Î¤ß</span></span></td>
+										<td bgcolor="#ffffff"><span class="red"><!--{$arrErr[$key]}--></span><input type="file" name="<!--{$key}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" class="box54" size="64" <!--{if $arrErr.template_file}-->style="background-color:<!--{$smarty.const.ERR_COLOR|escape}-->"<!--{/if}-->></td>
+									</tr>
+								</table>
+								
+								<table width="678" border="0" cellspacing="0" cellpadding="0" summary=" ">
+									<tr>
+										<td bgcolor="#cccccc"><img src="<!--{$smarty.const.URL_DIR}-->img/common/_.gif" width="1" height="5" alt=""></td>
+										<td><img src="<!--{$smarty.const.URL_DIR}-->img/contents/tbl_top.gif" width="676" height="7" alt=""></td>
+										<td bgcolor="#cccccc"><img src="<!--{$smarty.const.URL_DIR}-->img/common/_.gif" width="1" height="5" alt=""></td>
+									</tr>
+									<tr>
+										<td bgcolor="#cccccc"><img src="<!--{$smarty.const.URL_DIR}-->img/common/_.gif" width="1" height="10" alt=""></td>
+										<td bgcolor="#e9e7de" align="center">
+										<table border="0" cellspacing="0" cellpadding="0" summary=" ">
+											<tr>
+												<td><input type="image" onMouseover="chgImgImageSubmit('<!--{$smarty.const.URL_DIR}-->img/contents/btn_upload_on.jpg',this)" onMouseout="chgImgImageSubmit('<!--{$smarty.const.URL_DIR}-->img/contents/btn_upload.jpg',this)" src="<!--{$smarty.const.URL_DIR}-->img/contents/btn_upload.jpg" width="123" height="24" alt="¥¢¥Ã¥×¥í¡¼¥É" border="0" name="subm"></td>
+											</tr>
+										</table>
+										</td>
+										<td bgcolor="#cccccc"><img src="<!--{$smarty.const.URL_DIR}-->img/common/_.gif" width="1" height="10" alt=""></td>
+									</tr>
+									<tr>
+										<td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/tbl_bottom.gif" width="678" height="8" alt=""></td>
+									</tr>
+								</table>
+								</td>
+								</td>
+								<td background="<!--{$smarty.const.URL_DIR}-->img/contents/main_right.jpg"><img src="<!--{$smarty.const.URL_DIR}-->img/common/_.gif" width="14" height="1" alt=""></td>
+							</tr>
+							<tr>
+								<td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/main_bottom.jpg" width="706" height="14" alt=""></td>
+							</tr>
+							<tr><td height="30"></td></tr>
+						</table>
+					</td>
+				</tr>
+
+				<!--¥á¥¤¥ó¥¨¥ê¥¢-->
+			</table>
+			<!--¢¥ÅÐÏ¿¥Æ¡¼¥Ö¥ë¤³¤³¤Þ¤Ç-->
+		</td>
+	</tr>
+</form>
+</table>
+<!--¡ú¡ú¥á¥¤¥ó¥³¥ó¥Æ¥ó¥Ä¡ú¡ú-->
+
+<script type="text/javascript">
+function ChangeImage(strUrl)
+{
+	document.main_img.src=strUrl;
+}
+
+// ¥â¡¼¥É¤È¥­¡¼¤ò»ØÄê¤·¤ÆSUBMIT¤ò¹Ô¤¦¡£
+function lfnModeSubmit(mode) {
+	if(!window.confirm('ÅÐÏ¿¤·¤Æ¤âµ¹¤·¤¤¤Ç¤¹¤«?')){
+		return false;
+	}
+	document.form1['mode'].value = mode;
+	return true;
+}
+
+
+</script>
Index: /branches/mobile/data/Smarty/templates/mobile/site_frame.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/site_frame.tpl	(revision 11398)
+++ /branches/mobile/data/Smarty/templates/mobile/site_frame.tpl	(revision 11398)
@@ -0,0 +1,12 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
+<title><!--{$arrSiteInfo.shop_name|escape}-->/<!--{$tpl_title|escape}--></title>
+<meta name="author" content="<!--{$arrPageLayout.author|escape}-->">
+<meta name="description" content="<!--{$arrPageLayout.description|escape}-->">
+<meta name="keywords" content="<!--{$arrPageLayout.keyword|escape}-->">
+</head>
+<!-- ¢§ £Â£Ï£Ä£ÙÉô ¥¹¥¿¡¼¥È -->
+<!--{include file='./site_main.tpl'}-->
+<!-- ¢¥ £Â£Ï£Ä£ÙÉô ¥¨¥ó¥É -->
+</html>
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/login.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/login.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/login.tpl	(revision 11418)
@@ -0,0 +1,36 @@
+<div align="center">¥í¥°¥¤¥ó</div>
+<hr>
+
+<!--¢§CONTENTS-->
+<form name="login_mypage" id="login_mypage" method="post" action="./index.php">
+	<input type="hidden" name="mode" value="login" >
+<!--{if !$tpl_valid_phone_id}-->
+	¢£°ÊÁ°¤Ë¤´ÃíÊ¸¤µ¤ì¤¿Êý<br>
+	(¥â¥Ð¥¤¥ëËô¤ÏPC¤Ç¤´ÅÐÏ¿ºÑ¤ß)<br>
+	¢§¥á¡¼¥ë¥¢¥É¥ì¥¹<br>
+	<!--{assign var=key value="login_email"}-->
+	<font color="#FF0000"><!--{$arrErr[$key]}--></font>
+	<input type="text" name="<!--{$key}-->" value="<!--{$login_email|escape}-->" 
+		maxlength="<!--{$arrForm[$key].length}-->" size="40" istyle="3"><br>
+<!--{else}-->
+	<input type="hidden" name="login_email" value="dummy">
+<!--{/if}-->
+	¢§¥Ñ¥¹¥ï¡¼¥É<br>
+	<!--{assign var=key value="login_pass"}--><font color="#FF0000"><!--{$arrErr[$key]}--></font>
+	<input type="password" name="<!--{$key}-->" maxlength="<!--{$arrForm[$key].length}-->" size="40" istyle="3"><br>
+	<center><input type="submit" value="Á÷¿®" name="log"></center><br>
+	<a href="<!--{$smarty.const.URL_DIR}-->forgot/index.php">¥Ñ¥¹¥ï¡¼¥É¤ò¤ªËº¤ì¤ÎÊý¤Ï¤³¤Á¤é</a><br>
+</form>
+<!--¢¥CONTENTS-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/refusal_complete.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/refusal_complete.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/refusal_complete.tpl	(revision 11418)
@@ -0,0 +1,16 @@
+<div align="center">Âà²ñ´°Î»</div>
+<hr>
+
+Âà²ñ¼êÂ³¤­¤¬´°Î»Ã×¤·¤Þ¤·¤¿¡£¤Þ¤¿¤Î¤´ÍøÍÑ¤ò¤ª¤Þ¤Á¤·¤Æ¤ª¤ê¤Þ¤¹¡£<br>
+<br>
+
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<hr>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
+
+
+
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/set1.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/set1.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/set1.tpl	(revision 11418)
@@ -0,0 +1,55 @@
+<div align="center">ÅÐÏ¿ÆâÍÆÊÑ¹¹ 2/3</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="set2">
+
+	<font color="#FF0000">*¤ÏÉ¬¿Ü¹àÌÜ¤Ç¤¹¡£</font><br>
+	<br>
+
+	¡ÚÀ­ÊÌ¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.sex}--></font>
+	<input type="radio" name="sex" value="1" <!--{if $arrForm.sex eq "1"}-->checked<!--{/if}--> />ÃËÀ­&nbsp;
+	<input type="radio" name="sex" value="2" <!--{if $arrForm.sex eq "2"}-->checked<!--{/if}--> />½÷À­<br>
+
+	¡ÚÀ¸Ç¯·îÆü¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.year}--><!--{$arrErr.month}--><!--{$arrErr.day}--></font>
+	<select name="year">
+		<!--{html_options options=$arrYear selected=$arrForm.year}-->
+	</select>Ç¯<br>
+	<select name="month">
+		<option value="">--</option>
+		<!--{html_options options=$arrMonth selected=$arrForm.month}-->
+	</select>·î<br>
+	<select value="" name="day">
+		<option value="">--</option>
+		<!--{html_options options=$arrDay selected=$arrForm.day}-->
+	</select>Æü<br>
+
+	<!--{assign var=key1 value="zip01"}-->
+	<!--{assign var=key2 value="zip02"}-->
+	¡ÚÍ¹ÊØÈÖ¹æ¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr[$key1]}--><!--{$arrErr[$key2]}--></font>
+	<!--{assign var="size1" value="`$smarty.const.ZIP01_LEN+2`"}-->
+	<!--{assign var="size2" value="`$smarty.const.ZIP02_LEN+2`"}-->
+	<input size="<!--{$size1}-->" type="text" name="zip01" value="<!--{if $arrForm.zip01 == ""}--><!--{$arrForm.zip01|escape}--><!--{else}--><!--{$arrForm.zip01|escape}--><!--{/if}-->" maxlength="<!--{$smarty.const.ZIP01_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input size="<!--{$size2}-->" type="text" name="zip02" value="<!--{if $arrForm.zip02 == ""}--><!--{$arrForm.zip02|escape}--><!--{else}--><!--{$arrForm.zip02|escape}--><!--{/if}-->" maxlength="<!--{$smarty.const.ZIP02_LEN}-->" istyle="4"><br>
+
+	<input type="submit" name="confirm" value="¼¡¤Ø">
+
+	<!--{foreach from=$list_data key=key item=item}-->
+		<input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->">
+	<!--{/foreach}-->
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/change_complete.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/change_complete.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/change_complete.tpl	(revision 11418)
@@ -0,0 +1,18 @@
+<div align="center">ÊÑ¹¹´°Î»</div>
+<hr>
+
+²ñ°÷ÅÐÏ¿ÆâÍÆ¤ÎÊÑ¹¹¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£<br>
+º£¸å¤È¤â¤´°¦¸Ü»ò¤ê¤Þ¤¹¤è¤¦¤è¤í¤·¤¯¤ª´ê¤¤¿½¤·¾å¤²¤Þ¤¹¡£<br>
+
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/set2.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/set2.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/set2.tpl	(revision 11418)
@@ -0,0 +1,54 @@
+<div align="center">ÅÐÏ¿ÆâÍÆÊÑ¹¹ 3/3</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="confirm">
+
+	<font color="#FF0000">*¤ÏÉ¬¿Ü¹àÌÜ¤Ç¤¹¡£</font><br>
+	<br>
+
+	¡ÚÅÔÆ»ÉÜ¸©¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.pref}--><!--{$arrErr.addr01}--><!--{$arrErr.addr02}--></font>
+	<select name="pref">
+		<option value="" selected>ÅÔÆ»ÉÜ¸©¤òÁªÂò</option>
+		<!--{html_options options=$arrPref selected=$arrForm.pref}-->
+	</select><br>
+
+	¡Ú»Ô¶èÄ®Â¼¡Û<font color="#FF0000">*</font><br>
+	<input type="text" name="addr01" value="<!--{$arrForm.addr01|escape}-->" istyle="1"><br>
+
+	¡ÚÈÖÃÏ¡Û<font color="#FF0000">*</font><br>
+	<input type="text" name="addr02" value="<!--{$arrForm.addr02|escape}-->" istyle="1"><br>
+
+	¡ÚÅÅÏÃÈÖ¹æ¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.tel01}--><!--{$arrErr.tel02}--><!--{$arrErr.tel03}--></font>
+	<!--{assign var="size" value="`$smarty.const.TEL_ITEM_LEN+2`"}-->
+	<input type="text" size="<!--{$size}-->" name="tel01" value="<!--{$arrForm.tel01|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input type="text" size="<!--{$size}-->" name="tel02" value="<!--{$arrForm.tel02|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input type="text" size="<!--{$size}-->" name="tel03" value="<!--{$arrForm.tel03|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4"><br>
+
+	¡Ú¥á¡¼¥ë¥Þ¥¬¥¸¥ó¡Û<br>
+	¤ªÆÀ¤Ê¾ðÊó¤ò´õË¾¤µ¤ì¤Þ¤¹¤«¡©<br>
+	ÇÛ¿®´õË¾<input type="checkbox" name="mail_flag" value="on" <!--{if $arrForm.mail_flag eq '2'}-->checked<!--{/if}--> /><br>
+	¡Ê´õË¾¤µ¤ì¤Ê¤¤¾ì¹ç¤Ï¥Á¥§¥Ã¥¯¤ò¤Ï¤º¤·¤Æ¤¯¤À¤µ¤¤¡Ë<br>
+	<br>
+
+	<input type="submit" name="confirm" value="¼¡¤Ø">
+
+	<!--{foreach from=$list_data key=key item=item}-->
+		<input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->">
+	<!--{/foreach}-->
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/history.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/history.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/history.tpl	(revision 11418)
@@ -0,0 +1,31 @@
+<div align="center">¹ØÆþÍúÎò</div>
+<hr>
+
+<!--{section name=cnt loop=$arrOrder}-->
+	¢£<!--{$arrOrder[cnt].create_date|sfDispDBDate}--><br>
+	ÃíÊ¸ÈÖ¹æ:<!--{$arrOrder[cnt].order_id}--><br>
+	<!--{assign var=payment_id value="`$arrOrder[cnt].payment_id`"}-->
+	¹ç·×¶â³Û:<!--{$arrOrder[cnt].payment_total|number_format}-->±ß<br>
+
+	<div align="center">
+	<form name="form1" method="post" action="history_detail.php">
+		<input type="hidden" name="order_id" value="<!--{$arrOrder[cnt].order_id}-->">
+		<input type="submit" name="submit" value="¾ÜºÙ¤ò¸«¤ë">
+	</form>
+	</div>
+	<br>
+<!--{/section}-->
+<br>
+
+<!--{$tpl_strnavi}-->
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/refusal.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/refusal.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/refusal.tpl	(revision 11418)
@@ -0,0 +1,22 @@
+<div align="center">Âà²ñ³ÎÇ§</div>
+<hr>
+<!--{$CustomerName1|escape}--> <!--{$CustomerName2|escape}-->ÍÍ¡¢²ñ°÷¤«¤éÂà²ñ¤ò¤µ¤ì¤Þ¤¹¤È¡¢ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¤ªÆÏ¤±Àè¤Î¾ðÊó¤Ê¤ÉÁ´¤Æºï½ü¤µ¤ì¤Þ¤¹¤¬¤è¤í¤·¤¤¤Ç¤·¤ç¤¦¤«¡£<br>
+<br>
+<div align="center">
+<form action="<!--{$smarty.server.PHP_SELF|escape}-->" method="post">
+	<input type="submit" name="no" value="¤¤¤¤¤¨">
+	<input type="submit" name="complete" value="¤Ï¤¤">
+</form>
+</div>
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/change_confirm.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/change_confirm.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/change_confirm.tpl	(revision 11418)
@@ -0,0 +1,49 @@
+<div align="center">ÊÑ¹¹³ÎÇ§</div>
+<hr>
+<form name="form1" id="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="complete">
+	<!--{foreach from=$list_data key=key item=item}-->
+		<input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->">
+	<!--{/foreach}-->
+	²¼µ­¤ÎÆâÍÆ¤Ç¤´ÅÐÏ¿¤·¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©<br>
+	<br>
+	¡ÚÒ°Ù±ÄÞÚ½¡Û<br>
+	<!--{$list_data.email|escape}--><br>
+	<br>
+
+	¡ÚÊß½Ü°ÄÞ³ÎÇ§ÍÑ¼ÁÌä¡Û<br>
+	<!--{$arrReminder[$list_data.reminder]|escape}--><br>
+	<br>
+
+	¡Ú¼ÁÌä¤ÎÅú¤¨¡Û<br>
+	<!--{$list_data.reminder_answer|escape}--><br>
+	<br>
+
+	¡Ú¸Ä¿Í¾ðÊó¡Û<br>
+	<!--{$list_data.name01|escape}-->¡¡<!--{$list_data.name02|escape}--><br>
+	<!--{$list_data.kana01|escape}-->¡¡<!--{$list_data.kana02|escape}--><br>
+	<!--{if $list_data.sex eq 1}-->ÃËÀ­<!--{else}-->½÷À­<!--{/if}--><br>
+	<!--{if strlen($list_data.year) > 0 && strlen($list_data.month) > 0 && strlen($list_data.day) > 0}--><!--{$list_data.year|escape}-->Ç¯<!--{$list_data.month|escape}-->·î<!--{$list_data.day|escape}-->ÆüÀ¸¤Þ¤ì<!--{else}-->Ì¤ÅÐÏ¿<!--{/if}--><br>
+	¢©<!--{$list_data.zip01|escape}--> - <!--{$list_data.zip02|escape}--><br>
+	<!--{$arrPref[$list_data.pref]|escape}--><!--{$list_data.addr01|escape}--><!--{$list_data.addr02|escape}--><br>
+	<!--{$list_data.tel01|escape}-->-<!--{$list_data.tel02|escape}-->-<!--{$list_data.tel03|escape}--><br>
+	<br>
+	
+	¡ÚÒ°ÙÏ¶Þ¼ÞÝÞ¡Û<br>
+	<!--{if $list_data.mail_flag eq 2}-->´õË¾¤¹¤ë<!--{else}-->´õË¾¤·¤Ê¤¤<!--{/if}--><br>
+	<br>
+
+	<input type="submit" name="submit" value="ÊÑ¹¹">
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/history_detail.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/history_detail.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/history_detail.tpl	(revision 11418)
@@ -0,0 +1,54 @@
+<div align="center">¹ØÆþÍúÎò¾ÜºÙ</div>
+<hr>
+
+¢£<!--{$arrDisp.create_date|sfDispDBDate}--><br>
+ÃíÊ¸ÈÖ¹æ:<!--{$arrDisp.order_id}--><br>
+<br>
+¡ÚÇÛÁ÷Àè¡Û<br>
+	<!--{assign var=key1 value="deliv_name01"}--><!--{assign var=key2 value="deliv_name02"}-->
+	<!--{$arrDisp[$key1]|escape}-->&nbsp;<!--{$arrDisp[$key2]|escape}--><br>
+	<!--{assign var=key1 value="deliv_zip01"}--><!--{assign var=key2 value="deliv_zip02"}-->
+	¢©<!--{$arrDisp[$key1]}-->-<!--{$arrDisp[$key2]}--><br>
+	<!--{assign var=pref value=`$arrDisp.deliv_pref`}--><!--{$arrPref[$pref]}-->
+	<!--{assign var=key value="deliv_addr01"}--><!--{$arrDisp[$key]|escape}-->
+	<!--{assign var=key value="deliv_addr02"}--><!--{$arrDisp[$key]|escape}--><br>
+<br>
+¡ÚÇÛÁ÷Æü»þ»ØÄê¡Û<br>
+<!--{if $arrDisp.deliv_date eq "" and $arrDelivTime[$arrDisp.deliv_time_id] eq ""}-->
+	»ØÄê¤Ê¤·<br>
+<!--{else}-->
+	<!--{$arrDisp.deliv_date|escape}--> <!--{$arrDelivTime[$arrDisp.deliv_time_id]|escape}--><br>
+<!--{/if}-->
+<br>
+¡Ú¤ª»ÙÊ§¤¤ÊýË¡¡Û<br>
+<!--{$arrPayment[$arrDisp.payment_id]|escape}--><br>
+<br>
+¡Ú¤´ÃíÊ¸ÆâÍÆ¡Û<br>
+<!--{section name=cnt loop=$arrDisp.quantity}-->
+<!--{$arrDisp.product_name[cnt]|escape}--><br>
+<a href="<!--{$smarty.const.URL_DIR}-->products/detail.php?product_id=<!--{$arrDisp.product_id[cnt]}-->">¾¦ÉÊ¹ØÆþ¾ÜºÙ¢ª</a><br>
+<!--{/section}-->
+<br>
+¡Ú¹ØÆþ¶â³Û¡Û<br>
+¾¦ÉÊ¹ç·×:<!--{$arrDisp.subtotal|number_format}-->±ß<br>
+Á÷ÎÁ:<!--{assign var=key value="deliv_fee"}--><!--{$arrDisp[$key]|escape|number_format}-->±ß<br>
+¹ç·×:<!--{$arrDisp.payment_total|number_format}-->±ß<br>
+<br>
+
+<form action="order.php" method="post">
+	<input type="hidden" name="order_id" value="<!--{$arrDisp.order_id}-->">
+	<div align="center"><input type="submit" name="submit" value="ºÆÃíÊ¸"></div>
+</form>
+
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/change.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/change.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/change.tpl	(revision 11418)
@@ -0,0 +1,59 @@
+<div align="center">ÅÐÏ¿ÆâÍÆÊÑ¹¹ 1/3</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="set1">
+
+	<font color="#FF0000">*¤ÏÉ¬¿Ü¹àÌÜ¤Ç¤¹¡£</font><br>
+	<br>
+
+	¡Ú¥á¡¼¥ë¥¢¥É¥ì¥¹¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.email}--></font>
+	<input type="text" name="email" value="<!--{$arrForm.email|escape}-->" istyle="3">
+	<br>
+
+	¡Ú¥Ñ¥¹¥ï¡¼¥É¡Û<font color="#FF0000">¢¨</font><br>
+	¡ÊÈ¾³Ñ±Ñ¿ô»ú<!--{$smarty.const.PASSWORD_LEN1}-->Ê¸»ú°Ê¾å<!--{$smarty.const.PASSWORD_LEN2}-->Ê¸»ú°ÊÆâ¡Ë<br>
+	<font color="#FF0000"><!--{$arrErr.password}--></font>
+	<!--{assign var="size" value="`$smarty.const.PASSWORD_LEN2+2`"}-->
+	<input type="password" name="password" value="<!--{$arrForm.password}-->" istyle="4" maxlength="<!--{$smarty.const.PASSWORD_LEN2}-->" size="<!--{$size}-->"><br>
+
+	¡Ú¥Ñ¥¹¥ï¡¼¥É³ÎÇ§ÍÑ¤Î¼ÁÌä¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.reminder}--></font>
+	<select name="reminder">
+		<option value="" selected>ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option>
+		<!--{html_options options=$arrReminder selected=$arrForm.reminder}-->
+	</select><br>
+
+	¡Ú¼ÁÌä¤ÎÅú¤¨¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.reminder_answer}--></font>
+	<input type="text" name="reminder_answer" value="<!--{$arrForm.reminder_answer|escape}-->" istyle="1"><br>
+
+	¡Ú¤ªÌ¾Á°¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.name01}--><!--{$arrErr.name02}--></font>
+	À«¡ÊÎã¡§½ÂÃ«¡Ë<br>
+	<input type="text" name="name01" value="<!--{$arrForm.name01|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="1"><br>
+
+	Ì¾¡ÊÎã¡§²Ö»Ò¡Ë<br>
+	<input type="text" name="name02" value="<!--{$arrForm.name02|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="1"><br>
+	<font color="#FF0000"><!--{$arrErr.kana01}--><!--{$arrErr.kana02}--></font>
+
+	¥«¥Ê/À«¡ÊÎã¡§¥·¥Ö¥ä¡Ë<br>
+	<input type="text" name="kana01" value="<!--{$arrForm.kana01|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
+
+	¥«¥Ê/Ì¾¡ÊÎã¡§¥Ï¥Ê¥³¡Ë<br>
+	<input type="text" name="kana02" value="<!--{$arrForm.kana02|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
+
+	<input type="submit" name="confirm" value="¼¡¤Ø">
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mypage/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mypage/index.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mypage/index.tpl	(revision 11418)
@@ -0,0 +1,20 @@
+<div align="center">MY¥Ú¡¼¥¸TOP</div>
+<hr>
+
+<!--{$CustomerName1|escape}--> <!--{$CustomerName2|escape}-->ÍÍ<br>
+¤¤¤Ä¤â¤´ÍøÍÑ¤¤¤¿¤À¤­¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£<br>
+<br>
+<a href="history.php" accesskey="1"><!--{1|numeric_emoji}-->¹ØÆþÍúÎò<br>
+<a href="change.php" accesskey="2"><!--{2|numeric_emoji}-->ÅÐÏ¿ÆâÍÆÊÑ¹¹<br>
+<a href="refusal.php" accesskey="3"><!--{3|numeric_emoji}-->Âà²ñ<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/error.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/error.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/error.tpl	(revision 11409)
@@ -0,0 +1,8 @@
+<!--¢§CONTENTS-->
+<!--¢§MAIN ONTENTS-->
+<!--¡ú¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸--><!--{$tpl_error}--><br>
+<!--{if $return_top}-->
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a>
+<!--{/if}-->
+<!--¢¥MAIN ONTENTS-->
+<!--¢¥CONTENTS-->
Index: /branches/mobile/data/Smarty/templates/mobile/shopping/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/shopping/index.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/shopping/index.tpl	(revision 11414)
@@ -0,0 +1,49 @@
+<!--¢§CONTENTS-->
+<!--¢§MAIN ONTENTS-->
+<div align="center"><font color="#000080">¤´ÃíÊ¸¼êÂ³¤­</font></div><br>
+<hr>
+<!--{if !$tpl_valid_phone_id}-->
+<!--¢§²ñ°÷ÅÐÏ¿¤¬¤ªºÑ¤ß¤Ç¤Ê¤¤¤ªµÒÍÍ-->
+¢£½é¤á¤Æ¤´ÃíÊ¸¤ÎÊý<br>
+(¿·µ¬¤´ÅÐÏ¿)<br>
+<form name="member_form" id="member_form" method="post" action="<!--{$smarty.const.URL_DIR}-->entry/kiyaku.php">
+	<div align="center"><input type="submit" value="¿·µ¬ÅÐÏ¿"></div><br>
+</form>
+<!--¢¥¤Þ¤À²ñ°÷ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¤ªµÒÍÍ-->
+<!--{/if}-->
+
+<!--¢§²ñ°÷ÅÐÏ¿¤¬¤ªºÑ¤ß¤Î¤ªµÒÍÍ-->
+<form name="member_form" id="member_form" method="post" action="./deliv.php">
+	<input type="hidden" name="mode" value="login">
+<!--{if !$tpl_valid_phone_id}-->
+	¢£°ÊÁ°¤Ë¤´ÃíÊ¸¤µ¤ì¤¿Êý<br>
+	(¥â¥Ð¥¤¥ëËô¤ÏPC¤Ç¤´ÅÐÏ¿ºÑ¤ß)<br>
+	¢§¥á¡¼¥ë¥¢¥É¥ì¥¹<br>
+	<!--{assign var=key value="login_email"}-->
+	<font color="#FF0000"><!--{$arrErr[$key]}--></font>
+	<input type="text" name="<!--{$key}-->" value="<!--{$tpl_login_email|escape}-->" 
+		maxlength="<!--{$arrForm[$key].length}-->" size="40" istyle="3"><br>
+<!--{else}-->
+<input type="hidden" name="login_email" value="dummy">
+<!--{/if}-->
+	¢§¥Ñ¥¹¥ï¡¼¥É<br>
+	<!--{assign var=key value="login_pass"}--><font color="#FF0000"><!--{$arrErr[$key]}--></font>
+	<input type="password" name="<!--{$key}-->" maxlength="<!--{$arrForm[$key].length}-->" size="40" istyle="3"><br>
+	<center><input type="submit" value="Á÷¿®" name="log"></center><br>
+	<a href="<!--{$smarty.const.URL_DIR}-->forgot/index.php">¥Ñ¥¹¥ï¡¼¥É¤ò¤ªËº¤ì¤ÎÊý¤Ï¤³¤Á¤é</a><br>
+</form>
+<!--¢¥²ñ°÷ÅÐÏ¿¤¬¤ªºÑ¤Î¤ªµÒÍÍ-->
+<!--¢¥MAIN ONTENTS-->
+<!--¢¥CONTENTS-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/shopping/complete.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/shopping/complete.tpl	(revision 11454)
+++ /branches/mobile/data/Smarty/templates/mobile/shopping/complete.tpl	(revision 11454)
@@ -0,0 +1,18 @@
+<center>¤´ÃíÊ¸´°Î»</center>
+
+<hr>
+
+¤´ÃíÊ¸¡¢Í­¤êÆñ¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£<br>
+¾¦ÉÊÅþÃå¤ò¤ª³Ú¤·¤ß¤Ë¤ªÂÔ¤Á²¼¤µ¤¤¤Þ¤»¡£<br>
+¤É¤¦¤¾¡¢º£¸å¤È¤â¡¢<!--{$arrInfo.shop_name|escape}-->¤ò¤è¤í¤·¤¯¤ª´ê¤¤¤·¤Þ¤¹¡£<br>
+
+<br>
+
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->">TOP¥Ú¡¼¥¸¤ËÌá¤ë</a><br>
+
+<br>
+<hr>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<center>LOCKON CO.,LTD.</center>
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/shopping/set1.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/shopping/set1.tpl	(revision 11454)
+++ /branches/mobile/data/Smarty/templates/mobile/shopping/set1.tpl	(revision 11454)
@@ -0,0 +1,50 @@
+<div align="center">¤ªÆÏ¤±ÀèÅÐÏ¿</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="set2">
+
+	<font color="#FF0000">*¤ÏÉ¬¿Ü¹àÌÜ¤Ç¤¹¡£</font><br>
+	<br>
+
+	¡ÚÅÔÆ»ÉÜ¸©¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.pref}--><!--{$arrErr.addr01}--><!--{$arrErr.addr02}--></font>
+	<select name="pref">
+		<option value="" selected>ÅÔÆ»ÉÜ¸©¤òÁªÂò</option>
+		<!--{html_options options=$arrPref selected=$arrForm.pref}-->
+	</select><br>
+
+	¡Ú»Ô¶èÄ®Â¼¡Û<font color="#FF0000">*</font><br>
+	<input type="text" name="addr01" value="<!--{$arrForm.addr01|escape}-->" istyle="1"><br>
+
+	¡ÚÈÖÃÏ¡Û<font color="#FF0000">*</font><br>
+	<input type="text" name="addr02" value="<!--{$arrForm.addr02|escape}-->" istyle="1"><br>
+
+	¡ÚÅÅÏÃÈÖ¹æ¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.tel01}--><!--{$arrErr.tel02}--><!--{$arrErr.tel03}--></font>
+	<!--{assign var="size" value="`$smarty.const.TEL_ITEM_LEN+2`"}-->
+	<input type="text" size="<!--{$size}-->" name="tel01" value="<!--{$arrForm.tel01|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input type="text" size="<!--{$size}-->" name="tel02" value="<!--{$arrForm.tel02|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input type="text" size="<!--{$size}-->" name="tel03" value="<!--{$arrForm.tel03|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4"><br>
+
+	<br>
+
+	<div align="center"><input type="submit" name="submit" value="¼¡¤Ø"></div>
+
+	<!--{foreach from=$list_data key=key item=item}-->
+		<input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->">
+	<!--{/foreach}-->
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/shopping/confirm.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/shopping/confirm.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/shopping/confirm.tpl	(revision 11409)
@@ -0,0 +1,66 @@
+<center>¤´ÃíÊ¸ÆâÍÆ³ÎÇ§</center>
+
+<hr>
+
+<form method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+<input type="hidden" name="mode" value="confirm">
+<input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->">
+
+²¼µ­¤Î¤´ÃíÊ¸ÆâÍÆ¤Ë´Ö°ã¤¤¤Ï¤´¤¶¤¤¤Þ¤»¤ó¤«¡©<br>
+
+<br>
+
+¡ÚÇÛÁ÷Àè¡Û<br>
+<!--{if $arrData.deliv_check == 1}-->
+<!--{$arrData.deliv_name01|escape}--> <!--{$arrData.deliv_name02|escape}--><br>
+¢©<!--{$arrData.deliv_zip01|escape}-->-<!--{$arrData.deliv_zip02|escape}--><br>
+<!--{$arrPref[$arrData.deliv_pref]}--><!--{$arrData.deliv_addr01|escape}--><!--{$arrData.deliv_addr02|escape}--><br>
+<!--{else}-->
+<!--{$arrData.order_name01|escape}--> <!--{$arrData.order_name02|escape}--><br>
+¢©<!--{$arrData.order_zip01|escape}-->-<!--{$arrData.order_zip02|escape}--><br>
+<!--{$arrPref[$arrData.order_pref]}--><!--{$arrData.order_addr01|escape}--><!--{$arrData.order_addr02|escape}--><br>
+<!--{/if}-->
+
+<br>
+
+¡ÚÇÛÁ÷Æü»þ»ØÄê¡Û<br>
+Æü¡§<!--{$arrData.deliv_date|escape|default:"»ØÄê¤Ê¤·"}--><br>
+»þ´Ö¡§<!--{$arrData.deliv_time|escape|default:"»ØÄê¤Ê¤·"}--><br>
+
+<br>
+
+¡Ú¤ª»ÙÊ§¤¤ÊýË¡¡Û<br>
+<!--{$arrData.payment_method|escape}--><br>
+
+<br>
+
+¡Ú¤´ÃíÊ¸ÆâÍÆ¡Û<br>
+<!--{section name=cnt loop=$arrProductsClass}-->
+<!--{$arrProductsClass[cnt].name}--> <!--{$arrProductsClass[cnt].quantity|number_format}-->¸Ä<br>
+<!--{/section}-->
+
+<br>
+
+¡Ú¹ØÆþ¶â³Û¡Û<br>
+¾¦ÉÊ¹ç·×¡§<!--{$tpl_total_pretax|number_format}--><br>
+Á÷ÎÁ¡§<!--{$arrData.deliv_fee|number_format}--><br>
+<!--{if $arrData.charge > 0}-->¼ê¿ôÎÁ¡§<!--{$arrData.charge|number_format}--><br><!--{/if}-->
+¹ç·×¡§<!--{$arrData.payment_total|number_format}--><br>
+(Æâ¾ÃÈñÀÇ¡§<!--{$arrData.tax|number_format}-->)<br>
+
+<br>
+
+<center><input type="submit" value="ÃíÊ¸"></center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<center>LOCKON CO.,LTD.</center>
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/shopping/deliv_addr.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/shopping/deliv_addr.tpl	(revision 11454)
+++ /branches/mobile/data/Smarty/templates/mobile/shopping/deliv_addr.tpl	(revision 11454)
@@ -0,0 +1,53 @@
+<div align="center">¤ªÆÏ¤±ÀèÅÐÏ¿</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="set1">
+
+	<font color="#FF0000">*¤ÏÉ¬¿Ü¹àÌÜ¤Ç¤¹¡£</font><br>
+	<br>
+
+	¡Ú¤ªÌ¾Á°¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.name01}--><!--{$arrErr.name02}--></font>
+	À«¡ÊÎã¡§½ÂÃ«¡Ë<br>
+	<input type="text" name="name01" value="<!--{$arrForm.name01|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="1"><br>
+
+	Ì¾¡ÊÎã¡§²Ö»Ò¡Ë<br>
+	<input type="text" name="name02" value="<!--{$arrForm.name02|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="1"><br>
+	<font color="#FF0000"><!--{$arrErr.kana01}--><!--{$arrErr.kana02}--></font>
+
+	¥«¥Ê/À«¡ÊÎã¡§¥·¥Ö¥ä¡Ë<br>
+	<input type="text" name="kana01" value="<!--{$arrForm.kana01|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
+
+	¥«¥Ê/Ì¾¡ÊÎã¡§¥Ï¥Ê¥³¡Ë<br>
+	<input type="text" name="kana02" value="<!--{$arrForm.kana02|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
+
+	<br>
+
+	<!--{assign var=key1 value="zip01"}-->
+	<!--{assign var=key2 value="zip02"}-->
+	¡ÚÍ¹ÊØÈÖ¹æ¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr[$key1]}--><!--{$arrErr[$key2]}--></font>
+	<!--{assign var="size1" value="`$smarty.const.ZIP01_LEN+2`"}-->
+	<!--{assign var="size2" value="`$smarty.const.ZIP02_LEN+2`"}-->
+	<input size="<!--{$size1}-->" type="text" name="zip01" value="<!--{if $arrForm.zip01 == ""}--><!--{$arrForm.zip01|escape}--><!--{else}--><!--{$zip01|escape}--><!--{/if}-->" maxlength="<!--{$smarty.const.ZIP01_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input size="<!--{$size2}-->" type="text" name="zip02" value="<!--{if $arrForm.zip02 == ""}--><!--{$arrForm.zip02|escape}--><!--{else}--><!--{$zip02|escape}--><!--{/if}-->" maxlength="<!--{$smarty.const.ZIP02_LEN}-->" istyle="4"><br>
+
+	<br>
+
+	<div align="center"><input type="submit" name="confirm" value="¼¡¤Ø"></div>
+
+</form>
+
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/shopping/payment.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/shopping/payment.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/shopping/payment.tpl	(revision 11409)
@@ -0,0 +1,69 @@
+<center>ÇÛÃ£Æü¡¦»ÙÊ§¤¤»ØÄê</center>
+
+<hr>
+
+<form method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+<input type="hidden" name="mode" value="confirm">
+<input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->">
+<!--<input type="hidden" name="message" value="">-->
+<!--{if $tpl_login == 1}-->
+<!--<input type="hidden" name="point_check" value="2">-->
+<!--{/if}-->
+
+¢£ÇÛÃ£Æü»þ»ØÄê<br>
+ÇÛÁ÷Æü»ØÄê<br>
+<!--{assign var=key value="deliv_date"}-->
+<!--{if $arrErr[$key] != ""}-->
+<font color="red"><!--{$arrErr[$key]}--></font>
+<!--{/if}-->
+<!--{if $arrDelivDate}-->
+<select name="<!--{$key}-->">
+<option value="" selected="">»ØÄê¤Ê¤·</option>
+<!--{html_options options=$arrDelivDate selected=$arrForm[$key].value}-->
+</select>
+<!--{else}-->
+¤´»ØÄêÄº¤±¤Þ¤»¤ó¡£
+<!--{/if}-->
+<br>
+
+»þ´ÖÂÓ»ØÄê<br>
+<!--{assign var=key value="deliv_time_id"}-->
+<!--{if $arrErr[$key] != ""}-->
+<font color="red"><!--{$arrErr[$key]}--></font>
+<!--{/if}-->
+<select name="<!--{$key}-->">
+<option value="" selected="">»ØÄê¤Ê¤·</option>
+<!--{html_options options=$arrDelivTime selected=$arrForm[$key].value}-->
+</select>
+<br>
+
+<br>
+
+<center>»ÙÊ§¤¤ÊýË¡»ØÄê</center>
+
+<hr>
+
+<!--{assign var=key value="payment_id"}-->
+<!--{if $arrErr[$key] != ""}-->
+<font color="red"><!--{$arrErr[$key]}--></font>
+<!--{/if}-->
+<!--{section name=cnt loop=$arrPayment}-->
+<input type="radio" name="<!--{$key}-->" value="<!--{$arrPayment[cnt].payment_id}-->" <!--{$arrPayment[cnt].payment_id|sfGetChecked:$arrForm[$key].value}-->>
+<!--{$arrPayment[cnt].payment_method|escape}-->
+<br>
+<!--{/section}-->
+
+<center><input type="submit" value="¼¡¤Ø"></center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<center>LOCKON CO.,LTD.</center>
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/shopping/set2.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/shopping/set2.tpl	(revision 11454)
+++ /branches/mobile/data/Smarty/templates/mobile/shopping/set2.tpl	(revision 11454)
@@ -0,0 +1,30 @@
+<div align="center">¤ªÆÏ¤±ÀèÅÐÏ¿³ÎÇ§</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="complete">
+
+	¡Ú¸Ä¿Í¾ðÊó¡Û<br>
+	<!--{$list_data.name01|escape}-->¡¡<!--{$list_data.name02|escape}--><br>
+	<!--{$list_data.kana01|escape}-->¡¡<!--{$list_data.kana02|escape}--><br>
+	¢©<!--{$list_data.zip01|escape}--> - <!--{$list_data.zip02|escape}--><br>
+	<!--{$arrPref[$list_data.pref]|escape}--><!--{$list_data.addr01|escape}--><!--{$list_data.addr02|escape}--><br>
+	<!--{$list_data.tel01|escape}-->-<!--{$list_data.tel02|escape}-->-<!--{$list_data.tel03|escape}--><br>
+
+	<div align="center"><input type="submit" name="submit" value="¼¡¤Ø"></div>
+
+	<!--{foreach from=$list_data key=key item=item}-->
+		<input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->">
+	<!--{/foreach}-->
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/shopping/deliv.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/shopping/deliv.tpl	(revision 11454)
+++ /branches/mobile/data/Smarty/templates/mobile/shopping/deliv.tpl	(revision 11454)
@@ -0,0 +1,49 @@
+<center>ÇÛÁ÷Àè»ØÄê</center>
+
+<hr>
+
+<!--{if $arrErr.deli != ""}-->
+<font color="#ff0000"><!--{$arrErr.deli}--></font>
+<!--{/if}-->
+
+<!--¢§CONTENTS-->
+<!--{section name=cnt loop=$arrAddr}-->
+<form method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+<input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->">
+<input type="hidden" name="deli" value="<!--{$smarty.section.cnt.iteration}-->">
+<!--{if $smarty.section.cnt.first}-->
+<input type="hidden" name="mode" value="customer_addr">
+<input type="hidden" name="other_deliv_id" value="">
+<!--{else}-->
+<input type="hidden" name="mode" value="other_addr">
+<input type="hidden" name="other_deliv_id" value="<!--{$arrAddr[cnt].other_deliv_id}-->">
+<!--{/if}-->
+¢£ÇÛÁ÷Àè<!--{$smarty.section.cnt.iteration}--><br>
+¢©<!--{$arrAddr[cnt].zip01}-->-<!--{$arrAddr[cnt].zip02}--><br>
+<!--{assign var=key value=$arrAddr[cnt].pref}--><!--{$arrPref[$key]}--><!--{$arrAddr[cnt].addr01|escape}--><br>
+<!--{if $arrAddr[cnt].addr02 != ""}-->
+<!--{$arrAddr[cnt].addr02|escape}--><br>
+<!--{/if}-->
+<center><input type="submit" value="¤³¤³¤ËÁ÷¤ë"></center>
+</form>
+<!--{/section}-->
+
+<br>
+
+¢£¤½¤ÎÂ¾¤Î¤ªÆÏ¤±Àè¤ò»ØÄê<br>
+<form method="get" action="deliv_addr.php">
+<center><input type="submit" value="¿·µ¬ÅÐÏ¿"></center>
+</form>
+<!--¢¥CONTENTS-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<center>LOCKON CO.,LTD.</center>
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/unsupported/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/unsupported/index.tpl	(revision 11403)
+++ /branches/mobile/data/Smarty/templates/mobile/unsupported/index.tpl	(revision 11403)
@@ -0,0 +1,5 @@
+<!--¢§CONTENTS-->
+<!--¢§MAIN ONTENTS-->
+ÈóÂÐ±þµ¡¼ï¤Ç¤¹¡£
+<!--¢¥MAIN ONTENTS-->
+<!--¢¥CONTENTS-->
Index: /branches/mobile/data/Smarty/templates/mobile/cart/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/cart/index.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/cart/index.tpl	(revision 11414)
@@ -0,0 +1,65 @@
+<!--¢§CONTENTS-->
+<!--¢§MAIN ONTENTS-->
+<div align="center"><font color="#000080">¤«¤´É½¼¨</font></div>
+<!--{if $tpl_message != ""}-->
+	<!--{$tpl_message}--><br>
+<!--{/if}-->
+<!--{if count($arrProductsClass) > 0}-->
+<form name="form1" id="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->" utn>
+	<input type="hidden" name="mode" value="confirm">
+	<input type="hidden" name="cart_no" value="">
+	<!--¤´ÃíÊ¸ÆâÍÆ¤³¤³¤«¤é-->
+	<hr>
+	<!--{section name=cnt loop=$arrProductsClass}-->
+		<!--{* ¾¦ÉÊÌ¾ *}--><!--{$arrProductsClass[cnt].name|escape}--><br>
+		<!--{* ²Á³Ê *}-->
+		<!--{if $arrProductsClass[cnt].price02 != ""}-->
+			\<!--{$arrProductsClass[cnt].price02|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}-->
+		<!--{else}-->
+			\<!--{$arrProductsClass[cnt].price01|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}-->
+		<!--{/if}-->
+		¡ß <!--{$arrProductsClass[cnt].quantity}--><br>
+		<!--{* ¾ÜºÙ *}-->
+		<!--{if $arrProductsClass[cnt].classcategory_name1 != ""}-->
+			<!--{$arrProductsClass[cnt].class_name1}-->:<!--{$arrProductsClass[cnt].classcategory_name1}--><br>
+		<!--{/if}-->
+		<!--{if $arrProductsClass[cnt].classcategory_name2 != ""}-->
+			<!--{$arrProductsClass[cnt].class_name2}-->:<!--{$arrProductsClass[cnt].classcategory_name2}--><br>
+		<!--{/if}-->
+		<br>
+		<!--{* ¿ôÎÌ *}-->
+    ¿ôÎÌ:<!--{$arrProductsClass[cnt].quantity}--><br>
+		<!--{* ¹ç·× *}-->
+		¾®·×:<!--{$arrProductsClass[cnt].total_pretax|number_format}-->±ß<br>
+		<div align="right"><a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProductsClass[cnt].product_id}-->">¾¦ÉÊ¹ØÆþ¾ÜºÙ¤Ø¢ª</a></div>
+		<HR>
+	<!--{/section}-->
+	¾¦ÉÊ¹ç·×:<!--{$tpl_total_pretax|number_format}-->±ß<br>
+	¹ç·×:<!--{$arrData.total-$arrData.deliv_fee|number_format}-->±ß<br>
+	<!--{if $arrData.birth_point > 0}-->
+		¤ªÃÂÀ¸·îÎß²ÝÄ<br>
+		<!--{$arrData.birth_point|number_format}-->pt<br>
+	<!--{/if}-->
+	<br>
+	<center><input type="submit" value="ÃíÊ¸¤¹¤ë" name="confirm"></center>
+</form>
+<form method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<center><input type="submit" value="¤ªÇãÊª¤òÂ³¤±¤ë" name="continue"></center>
+</form>
+<!--{else}-->
+	¢¨¸½ºß¶°ÄÆâ¤Ë¾¦ÉÊ¤Ï¤´¤¶¤¤¤Þ¤»¤ó¡<br>
+<!--{/if}-->
+<!--¢¥CONTENTS-->
+<!--¢¥MAIN CONTENTS-->
+<!--¢¥CONTENTS-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/contact/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/contact/index.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/contact/index.tpl	(revision 11414)
@@ -0,0 +1,24 @@
+<div align="center">¤ªÌä¤¤¹ç¤ï¤»</div>
+
+<hr>
+
+³Æ¼ï¤ªÌä¤¤¹ç¤»¤Ï¡¢²¼µ­¤Î¤ªÅÅÏÃËô¤Ï¥á¡¼¥ë¤Ë¤Æ¤´Ï¢Íí²¼¤µ¤¤¤Þ¤»¡£<br>
+¢£<!--{$company_name}--><br>
+¡ÚÅÅÏÃ¡Û<br>
+±Ä¶È»þ´Ö¡§<br>
+<!--{$business_hour}--><br>
+ÅÅÏÃÈÖ¹æ¡§<br>
+<!--{$tel01}-->-<!--{$tel02}-->-<!--{$tel02}--><br>
+¡ÚE-mail¡Û<br>
+<a href="mailto:<!--{$email01}-->"><!--{$email01}--></a><br>
+¢¨¤ªµÞ¤®¤Î¾ì¹ç¤Ë¤Ï¡¢¤ªÅÅÏÃ¤Ë¤Æ¤ªÌä¤¤¹ç¤»²¼¤µ¤¤¡£<br>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/magazine/confirm.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/magazine/confirm.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/magazine/confirm.tpl	(revision 11418)
@@ -0,0 +1,26 @@
+<div align="center"><!--{$arrForm.kind|escape}-->³ÎÇ§</div>
+<hr>
+<!--{$arrForm.kind|escape}-->¤ò¹Ô¤¤¤Þ¤¹¡£<br>
+°Ê²¼¤ÎÆâÍÆ¤Ç¤è¤í¤·¤¤¤Ç¤·¤ç¤¦¤«¡£<br>
+
+<br>
+<form action="confirm.php" method="post">
+	<input type="hidden" name="mode" value="<!--{$arrForm.type}-->">
+	<input type="hidden" name="email" value="<!--{$arrForm.mail|escape}-->">
+	¢£¥á¡¼¥ë¥¢¥É¥ì¥¹<br>
+	<!--{$arrForm.mail|escape}--><br>
+	<br>
+	<div align="center"><input type="submit" name="submit" value="·èÄê"></div>
+</form>
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/magazine/regist.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/magazine/regist.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/magazine/regist.tpl	(revision 11418)
@@ -0,0 +1,17 @@
+<div align="center">ÅÐÏ¿´°Î»</div>
+<hr>
+
+¥á¡¼¥ë¥Þ¥¬¥¸¥ó¤ÎÅÐÏ¿¤¬´°Î»Ã×¤·¤Þ¤·¤¿¡£<br>
+º£¸å¤È¤â¤´°¦¸Ü»ò¤ê¤Þ¤¹¤è¤¦¤è¤í¤·¤¯¤ª´ê¤¤¿½¤·¾å¤²¤Þ¤¹¡£<br>
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/magazine/cancel.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/magazine/cancel.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/magazine/cancel.tpl	(revision 11418)
@@ -0,0 +1,17 @@
+<div align="center">²ò½ü´°Î»</div>
+<hr>
+
+¥á¡¼¥ë¥Þ¥¬¥¸¥ó¤Î²ò½ü¤¬´°Î»Ã×¤·¤Þ¤·¤¿¡£<br>
+º£¸å¤È¤â¤´°¦¸Ü»ò¤ê¤Þ¤¹¤è¤¦¤è¤í¤·¤¯¤ª´ê¤¤¿½¤·¾å¤²¤Þ¤¹¡£<br>
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/magazine/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/magazine/index.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/magazine/index.tpl	(revision 11418)
@@ -0,0 +1,35 @@
+<div align="center">¥á¥ë¥Þ¥¬ÅÐÏ¿</div>
+<hr>
+¤´ÅÐÏ¿¤¤¤¿¤À¤¤¤¿¤ªµÒÍÍ¤Ø¤Ï<!--{if $arrSiteInfo.shop_name != ""}--><!--{$arrSiteInfo.shop_name|escape}-->¤è¤ê<!--{/if}-->¾¦ÉÊ¤ä¥­¥ã¥ó¥Ú¡¼¥ó¾ðÊó¤ò¥á¡¼¥ë¤Ç¤ªÆÏ¤±¤¤¤¿¤·¤Þ¤¹¡£<br>
+¢¨<!--{if $arrSiteInfo.shop_name != ""}--><!--{$arrSiteInfo.shop_name|escape}-->¤Ç¤Ï<!--{/if}-->¤´ÍøÍÑµ¬Ìó¤Ë½¾¤¤ÍøÍÑ¼Ô¤Î¥¢¥É¥ì¥¹¤òÊÝ¸î¤·¤Æ¤¤¤Þ¤¹¡£<br>
+<br>
+<form action="confirm.php" method="post">
+	¢£ÅÐÏ¿<br>
+	<font color="#FF0000"><!--{$arrErr.regist}--></font>
+	<input type="text" name="regist" value="<!--{$arrForm.regist|escape}-->" istyle="3"><br>
+	<div align="center"><input type="submit" name="btnRegist" value="¼¡¤Ø"></div>
+	<br>
+
+	¢£²ò½ü<br>
+	<font color="#FF0000"><!--{$arrErr.cancel}--></font>
+	<input type="text" name="cancel" value="<!--{$arrForm.cancel|escape}-->" istyle="3"><br>
+	<div align="center"><input type="submit" name="btnCancel" value="¼¡¤Ø"></div>
+	<br>
+</form>
+<br>
+
+¢£¥á¡¼¥ë¥¢¥É¥ì¥¹ÊÑ¹¹<br>
+¥á¡¼¥ë¥¢¥É¥ì¥¹ÊÑ¹¹´õË¾¤ÎÊý¤Ï°ìÅÙ¡¢ÅÐÏ¿²ò½ü¤·¤Æ¤«¤é¡¢¤â¤¦°ìÅÙÅÐÏ¿¤·Ä¾¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/magazine/complete.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/magazine/complete.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/magazine/complete.tpl	(revision 11418)
@@ -0,0 +1,17 @@
+<div align="center">´°Î»</div>
+<hr>
+
+¤´ÆþÎÏ¤¤¤¿¤À¤¤¤¿¥á¡¼¥ë¥¢¥É¥ì¥¹°¸¤Æ¤Ë¡¢¤´Ï¢Íí¤¬ÆÏ¤¤¤Æ¤ª¤ê¤Þ¤¹¤Î¤Ç¤´³ÎÇ§²¼¤µ¤¤¡£<br>
+º£¸å¤È¤â¤´°¦¸Ü»ò¤ê¤Þ¤¹¤è¤¦¤è¤í¤·¤¯¤ª´ê¤¤¿½¤·¾å¤²¤Þ¤¹¡£<br>
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/footer.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/footer.tpl	(revision 11398)
+++ /branches/mobile/data/Smarty/templates/mobile/footer.tpl	(revision 11398)
@@ -0,0 +1,1 @@
+<center>LOCKON CO.,LTD.</center>
Index: /branches/mobile/data/Smarty/templates/mobile/guide/usage.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/usage.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/usage.tpl	(revision 11406)
@@ -0,0 +1,22 @@
+<center>¤´ÍøÍÑÊýË¡</center>
+
+<hr>
+
+<!-- ¢§¥á¥Ë¥å¡¼ ¤³¤³¤«¤é -->
+<a href="usage.php?page=1" accesskey="1"><!--{1|numeric_emoji}-->¾¦ÉÊ¤ÎÃµ¤·Êý</a><br>
+<a href="usage.php?page=2" accesskey="2"><!--{2|numeric_emoji}-->¤´ÃíÊ¸ÊýË¡</a><br>
+<a href="usage.php?page=3" accesskey="3"><!--{3|numeric_emoji}-->¤´ÃíÊ¸¸å</a><br>
+<a href="usage.php?page=4" accesskey="4"><!--{4|numeric_emoji}-->¾¦ÉÊÅþÃå¸å</a><br>
+<!-- ¢¥¥á¥Ë¥å¡¼ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/usage1.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/usage1.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/usage1.tpl	(revision 11406)
@@ -0,0 +1,19 @@
+<center>¾¦ÉÊ¤ÎÃµ¤·Êý</center>
+
+<hr>
+
+<!-- ¢§ËÜÊ¸ ¤³¤³¤«¤é -->
+¡Ö¾¦ÉÊ¤ÎÃµ¤·Êý¡×¤ÎËÜÊ¸<br>
+<!-- ¢¥ËÜÊ¸ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/usage2.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/usage2.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/usage2.tpl	(revision 11406)
@@ -0,0 +1,19 @@
+<center>¤´ÃíÊ¸ÊýË¡</center>
+
+<hr>
+
+<!-- ¢§ËÜÊ¸ ¤³¤³¤«¤é -->
+¡Ö¤´ÃíÊ¸ÊýË¡¡×¤ÎËÜÊ¸<br>
+<!-- ¢¥ËÜÊ¸ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/index.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/index.tpl	(revision 11406)
@@ -0,0 +1,23 @@
+<center>¤´ÍøÍÑ¥¬¥¤¥É</center>
+
+<hr>
+
+<!-- ¢§¥á¥Ë¥å¡¼ ¤³¤³¤«¤é -->
+<a href="usage.php" accesskey="1"><!--{1|numeric_emoji}-->¤´ÍøÍÑÊýË¡</a><br>
+<a href="privacy.php" accesskey="2"><!--{2|numeric_emoji}-->¥×¥é¥¤¥Ð¥·¡¼¥Ý¥ê¥·¡¼</a><br>
+<a href="charge.php" accesskey="3"><!--{3|numeric_emoji}-->ÄÌ¿®ÎÁ¤Ë¤Ä¤¤¤Æ</a><br>
+<a href="kiyaku.php" accesskey="4"><!--{4|numeric_emoji}-->¤´ÍøÍÑµ¬Ìó</a><br>
+<a href="about.php" accesskey="5"><!--{5|numeric_emoji}-->±¿±Ä²ñ¼Ò¾Ò²ð</a><br>
+<!-- ¢¥¥á¥Ë¥å¡¼ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/usage3.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/usage3.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/usage3.tpl	(revision 11406)
@@ -0,0 +1,19 @@
+<center>¤´ÃíÊ¸¸å</center>
+
+<hr>
+
+<!-- ¢§ËÜÊ¸ ¤³¤³¤«¤é -->
+¡Ö¤´ÃíÊ¸¸å¡×¤ÎËÜÊ¸<br>
+<!-- ¢¥ËÜÊ¸ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/usage4.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/usage4.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/usage4.tpl	(revision 11406)
@@ -0,0 +1,19 @@
+<center>¾¦ÉÊÅþÃå¸å</center>
+
+<hr>
+
+<!-- ¢§ËÜÊ¸ ¤³¤³¤«¤é -->
+¡Ö¾¦ÉÊÅþÃå¸å¡×¤ÎËÜÊ¸<br>
+<!-- ¢¥ËÜÊ¸ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/charge.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/charge.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/charge.tpl	(revision 11406)
@@ -0,0 +1,22 @@
+<center>ÄÌ¿®ÎÁ¤Ë¤Ä¤¤¤Æ</center>
+
+<hr>
+
+<!-- ¢§ËÜÊ¸ ¤³¤³¤«¤é -->
+Åö¥µ¥¤¥È¤Î¥³¥ó¥Æ¥ó¥Ä¤Ï¡¢²¼µ­ÌÈÀÕ»ö¹à¤ò¤ªÆÉ¤ß¤Ë¤Ê¤ê¡¢¤´Î»¾µ¤¤¤¿¤À¤¤¤¿Êý¤Ë¤ª»È¤¤Äº¤±¤Þ¤¹¡£<br>
+<br>
+¥Ñ¥±¥Ã¥ÈÄÌ¿®¤Ë¤Ï·ÈÂÓ¥­¥ã¥ê¥¢»ØÄê¤ÎÄÌ¿®ÎÁ¤¬È¯À¸¤·¤Þ¤¹¡£<br>
+ÅÅÇÈ¾õ¶·¤Ê¤É¤Ë¤è¤ê¡¢¥Ñ¥±¥Ã¥ÈÄÌ¿®¤ò¤ä¤êÄ¾¤¹¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£<br>
+<!-- ¢¥ËÜÊ¸ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/about.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/about.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/about.tpl	(revision 11406)
@@ -0,0 +1,55 @@
+<center>±¿±Ä²ñ¼Ò¾Ò²ð</center>
+
+<hr>
+
+<!-- ¢§ËÜÊ¸ ¤³¤³¤«¤é -->
+<!--{if $arrSiteInfo.shop_name != ""}-->
+[emoji:38]<font color="#800000">Å¹Ì¾</font><br>
+<!--{$arrSiteInfo.shop_name|escape}--><br>
+<!--{/if}-->
+<!--{if $arrSiteInfo.company_name != ""}-->
+[emoji:39]<font color="#800000">²ñ¼ÒÌ¾</font><br>
+<!--{$arrSiteInfo.company_name|escape}--><br>
+<!--{/if}-->
+<!--{if $arrSiteInfo.zip01 != ""}-->
+[emoji:121]<font color="#800000">½»½ê</font><br>
+¢©<!--{$arrSiteInfo.zip01|escape}-->-<!--{$arrSiteInfo.zip02|escape}--><br>
+<!--{$arrSiteInfo.pref|escape}--><!--{$arrSiteInfo.addr01|escape}--><!--{$arrSiteInfo.addr02|escape}--><br>
+<!--{/if}-->
+<!--{if $arrSiteInfo.tel01 != ""}-->
+[emoji:74]<font color="#800000">ÅÅÏÃÈÖ¹æ</font><br>
+<!--{$arrSiteInfo.tel01|escape}-->-<!--{$arrSiteInfo.tel02|escape}-->-<!--{$arrSiteInfo.tel03|escape}--><br>
+<!--{/if}-->
+<!--{if $arrSiteInfo.fax01 != ""}-->
+[emoji:76]<font color="#800000">FAXÈÖ¹æ</font><br>
+<!--{$arrSiteInfo.fax01|escape}-->-<!--{$arrSiteInfo.fax02|escape}-->-<!--{$arrSiteInfo.fax03|escape}--><br>
+<!--{/if}-->
+<!--{if $arrSiteInfo.business_hour != ""}-->
+[emoji:176]<font color="#800000">±Ä¶È»þ´Ö</font><br>
+<!--{$arrSiteInfo.business_hour|escape}--><br>
+<!--{/if}-->
+<!--{if $arrSiteInfo.email02 != ""}-->
+[emoji:110]<font color="#800000">¥á¡¼¥ë¥¢¥É¥ì¥¹</font><br>
+<a href="mailto:<!--{$arrSiteInfo.email02|escape}-->"><!--{$arrSiteInfo.email02|escape}--></a><br>
+<!--{/if}-->
+<!--{if $arrSiteInfo.good_traded != ""}-->
+[emoji:72]<font color="#800000">¼è°·¾¦ÉÊ</font><br>
+<!--{$arrSiteInfo.good_traded|escape|nl2br}--><br>
+<!--{/if}-->
+<!--{if $arrSiteInfo.message != ""}-->
+[emoji:70]<font color="#800000">¥á¥Ã¥»¡¼¥¸</font><br>
+<!--{$arrSiteInfo.message|escape|nl2br}--><br>
+<!--{/if}-->
+<!-- ¢¥ËÜÊ¸ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/kiyaku.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/kiyaku.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/kiyaku.tpl	(revision 11406)
@@ -0,0 +1,30 @@
+<center>¤´ÍøÍÑµ¬Ìó(<!--{$tpl_kiyaku_index+1}-->/<!--{$tpl_kiyaku_last_index+1}-->)</center>
+
+<hr>
+
+<!-- ¢§ËÜÊ¸ ¤³¤³¤«¤é -->
+<font color="#ff0000"><!--{$tpl_kiyaku_title|escape}--></font><br>
+<!--{$tpl_kiyaku_text|escape}--><br>
+<!-- ¢¥ËÜÊ¸ ¤³¤³¤Þ¤Ç -->
+
+<!--{if !$tpl_kiyaku_is_first || !$tpl_kiyaku_is_last}-->
+<br>
+<!--{if !$tpl_kiyaku_is_first}-->
+<a href="kiyaku.php?page=<!--{$tpl_kiyaku_index-1}-->" accesskey="1"><!--{1|numeric_emoji}-->Ìá¤ë</a><br>
+<!--{/if}-->
+<!--{if !$tpl_kiyaku_is_last}-->
+<a href="kiyaku.php?page=<!--{$tpl_kiyaku_index+1}-->" accesskey="2"><!--{2|numeric_emoji}-->¿Ê¤à</a><br>
+<!--{/if}-->
+<!--{/if}-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/guide/privacy.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/guide/privacy.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/guide/privacy.tpl	(revision 11406)
@@ -0,0 +1,21 @@
+<center>¥×¥é¥¤¥Ð¥·¡¼¥Ý¥ê¥·¡¼</center>
+
+<hr>
+
+<!-- ¢§ËÜÊ¸ ¤³¤³¤«¤é -->
+<!--{$arrSiteInfo.company_name|escape}-->¤Ï¡¢¸Ä¿Í¾ðÊóÊÝ¸î¤Î½ÅÍ×À­¤Ë´Õ¤ß¡¢¡Ö¸Ä¿Í¾ðÊó¤ÎÊÝ¸î¤Ë´Ø¤¹¤ëË¡Î§¡×µÚ¤ÓËÜ¥×¥é¥¤¥Ð¥·¡¼¥Ý¥ê¥·¡¼¤ò½å¼é¤·¡¢¤ªµÒ¤µ¤Þ¤Î¥×¥é¥¤¥Ð¥·¡¼ÊÝ¸î¤ËÅØ¤á¤Þ¤¹¡£<br>
+¡¡¸Ä¿Í¾ðÊó¤ÎÄêµÁ<br>
+¤ªµÒ¤µ¤Þ¸Ä¿Í¤Ë´Ø¤¹¤ë¾ðÊó(°Ê²¼¡Ö¸Ä¿Í¾ðÊó¡×¤È¤¤¤¤¤Þ¤¹)¤Ç¤¢¤Ã¤Æ¡¢¤ªµÒ¤µ¤Þ¤Î¤ªÌ¾Á°¡¢¤´½»½ê¡¢ÅÅÏÃÈÖ¹æ¤Ê¤ÉÅö³º¤ªµÒ¤µ¤Þ¸Ä¿Í¤ò¼±ÊÌ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¾ðÊó¤ò¤µ¤·¤Þ¤¹¡£Â¾¤Î¾ðÊó¤ÈÁÈ¤ß¹ç¤ï¤»¤Æ¾È¹ç¤¹¤ë¤³¤È¤Ë¤è¤ê¸Ä¿Í¤ò¼±ÊÌ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¾ðÊó¤â´Þ¤Þ¤ì¤Þ¤¹¡£<br>
+<!-- ¢¥ËÜÊ¸ ¤³¤³¤Þ¤Ç -->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/regist/complete.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/regist/complete.tpl	(revision 11412)
+++ /branches/mobile/data/Smarty/templates/mobile/regist/complete.tpl	(revision 11412)
@@ -0,0 +1,31 @@
+<center>ËÜ²ñ°÷ÅÐÏ¿´°Î»</center>
+
+<hr>
+
+ËÜÅÐÏ¿¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£<br>
+¤½¤ì¤Ç¤Ï¥·¥ç¥Ã¥Ô¥ó¥°¤ò¤ª³Ú¤·¤ß¤¯¤À¤µ¤¤¡£<br>
+
+<br>
+
+º£¸å¤È¤â¤´°¦¸Ü»ò¤ê¤Þ¤¹¤è¤¦¤è¤í¤·¤¯¤ª´ê¤¤¿½¤·¾å¤²¤Þ¤¹¡£<br>
+
+<br>
+
+<!--{$arrSiteInfo.company_name|escape}--><br>
+TEL¡§<!--{$arrSiteInfo.tel01}-->-<!--{$arrSiteInfo.tel02}-->-<!--{$arrSiteInfo.tel03}--> <!--{if $arrSiteInfo.business_hour != ""}-->¡Ê¼õÉÕ»þ´Ö/<!--{$arrSiteInfo.business_hour}-->¡Ë<!--{/if}--><br>
+E-mail¡§<a href="mailto:<!--{$arrSiteInfo.email02|escape}-->"><!--{$arrSiteInfo.email02|escape}--></a><br>
+
+<br>
+
+<!--{if !$tpl_cart_empty}-->
+<a href="<!--{$smarty.const.URL_DIR}-->shopping/deliv.php">¤´ÃíÊ¸¼êÂ³¤­¤Ø¿Ê¤à</a><br>
+<!--{/if}-->
+
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->">TOP¥Ú¡¼¥¸¤ËÌá¤ë</a><br>
+
+<br>
+<hr>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<center>LOCKON CO.,LTD.</center>
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/regist/error.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/regist/error.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/regist/error.tpl	(revision 11409)
@@ -0,0 +1,17 @@
+<center>ËÜ²ñ°÷ÅÐÏ¿</center>
+
+<hr>
+
+<font color="#ff0000"><!--{$arrErr.id}--></font>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<center>LOCKON CO.,LTD.</center>
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/top.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/top.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/top.tpl	(revision 11418)
@@ -0,0 +1,36 @@
+<!-- ¢§¥í¥´ ¤³¤³¤«¤é -->
+<center><img src="<!--{$smarty.const.PC_URL_DIR}-->img/header/logo.gif"></center>
+<!-- ¢¥¥í¥´ ¤³¤³¤Þ¤Ç -->
+
+<br>
+
+<!-- ¢§¿·Ãå¾ðÊó ¤³¤³¤«¤é -->
+<!--{include_php file=`$smarty.const.HTML_PATH`frontparts/bloc/news.php}-->
+<!-- ¢¥¿·Ãå¾ðÊó ¤³¤³¤Þ¤Ç -->
+
+<br>
+
+<!-- ¢§¥Ô¥Ã¥¯¥¢¥Ã¥×¾¦ÉÊ ¤³¤³¤«¤é -->
+<hr>
+<!--{include_php file=`$smarty.const.HTML_PATH`frontparts/bloc/best5.php}-->
+<hr>
+<!-- ¢¥¥Ô¥Ã¥¯¥¢¥Ã¥×¾¦ÉÊ ¤³¤³¤Þ¤Ç -->
+
+<br>
+
+<!-- ¢§¥á¥Ë¥å¡¼ ¤³¤³¤«¤é -->
+<!--{1|numeric_emoji}-->¾¦ÉÊ¥«¥Æ¥´¥ê<br>
+<!--{include_php file=`$smarty.const.HTML_PATH`frontparts/bloc/category.php}-->
+<a href="products/search.php" accesskey="2"><!--{2|numeric_emoji}-->¾¦ÉÊ¸¡º÷</a><br>
+<a href="magazine/index.php" accesskey="3"><!--{3|numeric_emoji}-->¥á¥ë¥Þ¥¬ÅÐÏ¿</a><br>
+<a href="entry/new.php" accesskey="4"><!--{4|numeric_emoji}-->²ñ°÷ÅÐÏ¿¡¦Âà²ñ</a><br>
+<a href="guide/index.php" accesskey="5"><!--{5|numeric_emoji}-->¤´ÍøÍÑ¥¬¥¤¥É</a><br>
+<a href="contact/index.php" accesskey="6"><!--{6|numeric_emoji}-->¤ªÌä¤¤¹ç¤»</a><br>
+<a href="mypage/index.php" accesskey="7"><!--{7|numeric_emoji}-->My¥Ú¡¼¥¸</a><br>
+<!-- ¢¥¥á¥Ë¥å¡¼ ¤³¤³¤Þ¤Ç -->
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/forgot/secret.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/forgot/secret.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/forgot/secret.tpl	(revision 11409)
@@ -0,0 +1,30 @@
+<center>¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿Êý</center>
+
+<hr>
+
+<!--{if $errmsg}-->
+<font color="#ff0000"><!--{$errmsg}--></font><br>
+<!--{/if}-->
+
+¤´ÅÐÏ¿»þ¤ËÆþÎÏ¤·¤¿²¼µ­¼ÁÌä¤ÎÅú¤¨¤òÆþÎÏ¤·¤Æ¡Ö¼¡¤Ø¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+¢¨²¼µ­¼ÁÌä¤ÎÅú¤¨¤ò¤ªËº¤ì¤Ë¤Ê¤é¤ì¤¿¾ì¹ç¤Ï¡¢<a href="mailto:<!--{$arrSiteInfo.email02|escape}-->"><!--{$arrSiteInfo.email02|escape}--></a>¤Þ¤Ç¤´Ï¢Íí¤¯¤À¤µ¤¤¡£<br>
+
+<form action="<!--{$smarty.server.PHP_SELF|escape}-->" method="post">
+<input type="hidden" name="mode" value="secret_check">
+
+<!--{$Reminder|escape}-->¡§<input type="text" name="input_reminder" value="" size="40"><br>
+
+<center><input type="submit" value="¼¡¤Ø" name="next"></center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/forgot/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/forgot/index.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/forgot/index.tpl	(revision 11409)
@@ -0,0 +1,40 @@
+<center>¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿Êý</center>
+
+<font color="#ff0000">¢¨¿·¤·¤¯¥Ñ¥¹¥ï¡¼¥É¤òÈ¯¹Ô¤¤¤¿¤·¤Þ¤¹¤Î¤Ç¡¢¤ªËº¤ì¤Ë¤Ê¤Ã¤¿¥Ñ¥¹¥ï¡¼¥É¤Ï¤´ÍøÍÑ¤Ç¤­¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£</font>
+
+<hr>
+
+<!--{if $errmsg}-->
+<font color="#ff0000"><!--{$errmsg}--></font><br>
+<!--{/if}-->
+
+<!--{if @$tpl_kara_mail_to != ''}-->
+¢£¤´ÅÐÏ¿»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤«¤é¥á¡¼¥ë¤òÁ÷¤ì¤ëÊý¤Ï¡¢¼¡¤Î¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¶õ¥á¡¼¥ë¤òÁ÷¿®¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+<center><a href="mailto:<!--{$tpl_kara_mail_to|escape:'url'}-->">¥á¡¼¥ëÁ÷¿®</a></center>
+
+<br>
+
+¢£¥á¡¼¥ë¤òÁ÷¤ì¤Ê¤¤Êý¤Ï¡¢¤´ÅÐÏ¿»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÆþÎÏ¤·¤Æ¡Ö¼¡¤Ø¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+<!--{else}-->
+¤´ÅÐÏ¿»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÆþÎÏ¤·¤Æ¡Ö¼¡¤Ø¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+<!--{/if}-->
+
+<form action="<!--{$smarty.server.PHP_SELF|escape}-->" method="post">
+<input type="hidden" name="mode" value="mail_check">
+
+¥á¡¼¥ë¥¢¥É¥ì¥¹¡§<input type="text" name="email" value="<!--{$tpl_login_email|escape}-->" size="50" istyle="3"><br>
+
+<center><input type="submit" value="¼¡¤Ø" name="next"></center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/forgot/complete.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/forgot/complete.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/forgot/complete.tpl	(revision 11406)
@@ -0,0 +1,22 @@
+<center>¥Ñ¥¹¥ï¡¼¥É¤òËº¤ì¤¿Êý</center>
+
+<hr>
+
+¥Ñ¥¹¥ï¡¼¥É¤ÎÈ¯¹Ô¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£¥í¥°¥¤¥ó¤Ë¤Ï²¼µ­¤Î¥Ñ¥¹¥ï¡¼¥É¤ò¤´ÍøÍÑ¤¯¤À¤µ¤¤¡£<br>
+¢¨²¼µ­¥Ñ¥¹¥ï¡¼¥É¤Ï¡¢MY¥Ú¡¼¥¸¤Î¡Ö²ñ°÷ÅÐÏ¿ÆâÍÆÊÑ¹¹¡×¤è¤ê¤´ÊÑ¹¹¤¤¤¿¤À¤±¤Þ¤¹¡£<br>
+
+<br>
+
+<center><font color="red"><!--{$temp_password}--></font></center>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/mail_templates/customer_regist_mail.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mail_templates/customer_regist_mail.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/mail_templates/customer_regist_mail.tpl	(revision 11409)
@@ -0,0 +1,10 @@
+<!--{$name01}--><!--{$name02}--> ÍÍ
+
+<!--{$CONF.shop_name}-->¤Ç¤´¤¶¤¤¤Þ¤¹¡£
+
+¤³¤ÎÅÙ¤Ï²ñ°÷ÅÐÏ¿°ÍÍê¤ò¤¤¤¿¤À¤­¤Þ¤·¤Æ¤Þ¤³¤È¤ËÍ­¤êÆñ¤¦¤´¤¶¤¤¤Þ¤¹¡£
+
+ËÜ²ñ°÷ÅÐÏ¿¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£
+¥·¥ç¥Ã¥Ô¥ó¥°¤ò¤ª³Ú¤·¤ß¤¯¤À¤µ¤¤¤Þ¤»¡£
+
+º£¸å¤È¤â¤É¤¦¤¾<!--{$CONF.shop_name}-->¤ò¤è¤í¤·¤¯¤ª´ê¤¤¿½¤·¾å¤²¤Þ¤¹¡£
Index: /branches/mobile/data/Smarty/templates/mobile/mail_templates/customer_mail.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mail_templates/customer_mail.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/mail_templates/customer_mail.tpl	(revision 11409)
@@ -0,0 +1,14 @@
+¢¨ËÜ¥á¡¼¥ë¤Ï¡¢
+<!--{$CONF.shop_name}-->¤è¤ê²ñ°÷ÅÐÏ¿¤ò´õË¾¤µ¤ì¤¿Êý¤Ë¤ªÁ÷¤ê¤·¤Æ¤¤¤Þ¤¹¡£
+¤â¤·¤ª¿´Åö¤¿¤ê¤¬Ìµ¤¤¾ì¹ç¤Ï¤³¤Î¤Þ¤Þ¤³¤Î¥á¡¼¥ë¤òÇË´þ¤·¤Æ¤¤¤¿¤À¤±¤ì¤Ð²ñ°÷ÅÐÏ¿¤Ï¤Ê¤µ¤ì¤Þ¤»¤ó¡£
+
+<!--{$to_name01}--> <!--{$to_name02}--> ÍÍ
+
+<!--{$CONF.shop_name}-->¤Ç¤´¤¶¤¤¤Þ¤¹¡£
+¤³¤ÎÅÙ¤Ï²ñ°÷ÅÐÏ¿°ÍÍê¤ò¤¤¤¿¤À¤­¤Þ¤·¤Æ¡¢Í­¤êÆñ¤¦¤´¤¶¤¤¤Þ¤¹¡£
+¸½ºß¤Ï²¾ÅÐÏ¿¤Î¾õÂÖ¤Ç¤¹¡£
+¡¡¡¡¡¡~~~~~~
+ËÜ²ñ°÷ÅÐÏ¿¤ò´°Î»¤¹¤ë¤Ë¤Ï²¼µ­URL¤Ë¥¢¥¯¥»¥¹¤·¤Æ¤¯¤À¤µ¤¤¡£
+<!--{$smarty.const.SSL_URL}-->regist/index.php?mode=regist&id=<!--{$uniqid}-->
+
+¾åµ­URL¤Ë¤ÆËÜ²ñ°÷ÅÐÏ¿¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¤é²þ¤á¤Æ¤´ÅÐÏ¿ÆâÍÆ¤´³ÎÇ§¥á¡¼¥ë¤ò¤ªÁ÷¤êÃ×¤·¤Þ¤¹¡£
Index: /branches/mobile/data/Smarty/templates/mobile/mail_templates/mail_title.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mail_templates/mail_title.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/mail_templates/mail_title.tpl	(revision 11409)
@@ -0,0 +1,1 @@
+¡Ú<!--{$tpl_shopname}-->¡Û <!--{$tpl_mailtitle}-->
Index: /branches/mobile/data/Smarty/templates/mobile/mail_templates/mailmagazine_cancel.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mail_templates/mailmagazine_cancel.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mail_templates/mailmagazine_cancel.tpl	(revision 11418)
@@ -0,0 +1,10 @@
+¢¨ËÜÒ°Ù¤Ï¼«Æ°ÇÛ¿®Ò°Ù¤Ç¤¹¡
+<!--{$tpl_shopname}-->¤è¤ê¤ÒÙÏ¶Þ¹ØÆÉ²ò½ü¤ò´õË¾¤µ¤ì¤¿Êý¤Ë¤ªÁ÷¤ê¤·¤Æ¤¤¤Þ¤¹¡
+¤â¤·¤ª¿´Åö¤¿¤ê¤¬Ìµ¤¤¾ì¹ç¤Ï¤¤³¤Î¤Þ¤Þ¤³¤ÎÒ°Ù¤òÇË´þ¤·¤Æ¤¤¤¿¤À¤±¤ì¤ÐÒÙÏ¶Þ¹ØÆÉ²ò½ü¤Ï¤Ê¤µ¤ì¤Þ¤»¤ó¡
+¤Þ¤¿¤½¤Î»Ý¤<!--{$tpl_infoemail}-->¤Þ¤Ç¤´Ï¢Íí¤¤¤¿¤À¤±¤ì¤Ð¹¬¤¤¤Ç¤¹¡
+
+¸½ºß¤Ï¤Þ¤À¹ØÆÉ¤µ¤ì¤¿¾õÂÖ¤Ç¤¹¡
+´°Î»¤¹¤ë¤Ë¤Ï²¼µ­URL¤Ë±¸¾½¤·¤Æ¤¯¤À¤µ¤¤¡
+¢¨ÆþÎÏ¤µ¤ì¤¿¤ªµÒÍÍ¤Î¾ðÊó¤ÏSSL°Å¹æ²½ÄÌ¿®¤Ë¤è¤êÊÝ¸î¤µ¤ì¤Þ¤¹¡
+
+<!--{$tpl_url}-->
Index: /branches/mobile/data/Smarty/templates/mobile/mail_templates/mailmagazine_regist.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mail_templates/mailmagazine_regist.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/mail_templates/mailmagazine_regist.tpl	(revision 11418)
@@ -0,0 +1,11 @@
+¢¨ËÜÒ°Ù¤Ï¼«Æ°ÇÛ¿®Ò°Ù¤Ç¤¹¡
+<!--{$tpl_shopname}-->¤è¤ê¤ÒÙÏ¶Þ¹ØÆÉÅÐÏ¿¤ò´õË¾¤µ¤ì¤¿Êý¤Ë¤ªÁ÷¤ê¤·¤Æ¤¤¤Þ¤¹¡
+¤â¤·¤ª¿´Åö¤¿¤ê¤¬Ìµ¤¤¾ì¹ç¤Ï¤¤³¤Î¤Þ¤Þ¤³¤ÎÒ°Ù¤òÇË´þ¤·¤Æ¤¤¤¿¤À¤±¤ì¤ÐÒÙÏ¶Þ¹ØÆÉÅÐÏ¿¤Ï¤Ê¤µ¤ì¤Þ¤»¤ó¡
+¤Þ¤¿¤½¤Î»Ý¤<!--{$tpl_infoemail}-->¤Þ¤Ç¤´Ï¢Íí¤¤¤¿¤À¤±¤ì¤Ð¹¬¤¤¤Ç¤¹¡
+
+¤³¤ÎÅÙ¤Ï¤ÒÙÏ¶Þ¹ØÆÉ°ÍÍê¤ò¤¤¤¿¤À¤­¤Þ¤·¤Æ¤Í­¤êÆñ¤¦¤´¤¶¤¤¤Þ¤¹¡
+¸½ºß¤Ï²¾ÅÐÏ¿¤Î¾õÂÖ¤Ç¤¹¡
+´°Î»¤¹¤ë¤Ë¤Ï²¼µ­URL¤Ë±¸¾½¤·¤Æ¤¯¤À¤µ¤¤¡
+¢¨ÆþÎÏ¤µ¤ì¤¿¤ªµÒÍÍ¤Î¾ðÊó¤ÏSSL°Å¹æ²½ÄÌ¿®¤Ë¤è¤êÊÝ¸î¤µ¤ì¤Þ¤¹¡
+
+<!--{$tpl_url}-->
Index: /branches/mobile/data/Smarty/templates/mobile/mail_templates/order_mail.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/mail_templates/order_mail.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/mail_templates/order_mail.tpl	(revision 11409)
@@ -0,0 +1,21 @@
+<!--{$arrOrder.order_name01}--> <!--{$arrOrder.order_name02}--> ÍÍ
+
+¢£ÇÛÁ÷¾ðÊó¤È¤´ÀÁµá¶â³Û
+¤´ÃíÊ¸ÈÖ¹æ¡§<!--{$arrOrder.order_id}-->
+¤ª»ÙÊ§¹ç·×¡§¡ï <!--{$arrOrder.payment_total|number_format|default:0}-->
+¤´·èºÑÊýË¡¡§<!--{$arrOrder.payment_method}-->
+¡¡¤ªÆÏ¤±Æü¡§<!--{$arrOrder.deliv_date|default:"»ØÄê¤Ê¤·"}-->
+¤ªÆÏ¤±»þ´Ö¡§<!--{$arrOrder.deliv_time|default:"»ØÄê¤Ê¤·"}-->
+¡ý¤ªÆÏ¤±Àè
+¡¡¤ªÌ¾Á°¡¡¡§<!--{$arrOrder.deliv_name01}--> <!--{$arrOrder.deliv_name02}-->¡¡ÍÍ
+¡¡Í¹ÊØÈÖ¹æ¡§¢©<!--{$arrOrder.deliv_zip01}-->-<!--{$arrOrder.deliv_zip02}-->
+¡¡¤´½»½ê¡¡¡§<!--{$arrOrder.deliv_pref}--><!--{$arrOrder.deliv_addr01}--><!--{$arrOrder.deliv_addr02}-->
+¡¡ÅÅÏÃÈÖ¹æ¡§<!--{$arrOrder.deliv_tel01}-->-<!--{$arrOrder.deliv_tel02}-->-<!--{$arrOrder.deliv_tel03}-->
+
+¢£¤´ÃíÊ¸¾¦ÉÊÌÀºÙ
+<!--{section name=cnt loop=$arrOrderDetail}-->
+¾¦ÉÊÌ¾: <!--{$arrOrderDetail[cnt].product_name}--> <!--{$arrOrderDetail[cnt].classcategory_name1}--> <!--{$arrOrderDetail[cnt].classcategory_name2}-->
+¿ôÎÌ¡§<!--{$arrOrderDetail[cnt].quantity}--> ¸Ä
+¶â³Û¡§¡ï <!--{$arrOrderDetail[cnt].price|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}-->
+
+<!--{/section}-->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/mail.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/mail.tpl	(revision 11409)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/mail.tpl	(revision 11409)
@@ -0,0 +1,24 @@
+<center>¥á¡¼¥ë¥¢¥É¥ì¥¹ÅÐÏ¿</center>
+
+<hr>
+
+¼¡¤Î¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¶õ¥á¡¼¥ë¤òÁ÷¿®¤·¤Æ¤¯¤À¤µ¤¤¡£
+¤¹¤°¤Ë¤´°ÆÆâ¤Î¥á¡¼¥ë¤¬Á÷¿®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢¥á¡¼¥ëÆâ¤Î¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤Æ²ñ°÷¾ðÊó¤ÎÆþÎÏ¤Ë¿Ê¤ó¤Ç¤¯¤À¤µ¤¤¡£<br>
+<font color="#ff0000">¢¨¥É¥á¥¤¥ó»ØÄê¼õ¿®µ¡Ç½¤òÍøÍÑ¤µ¤ì¤Æ¤¤¤ëÊý¤Ï¡¢¥á¡¼¥ë¤òÁ÷¿®¤¹¤ëÁ°¤ËÉ¬¤º¡Ö<!--{$tpl_from_address|escape}-->¡×¤«¤é¤Î¥á¡¼¥ë¤¬¼õ¿®¤Ç¤­¤ë¤è¤¦¤ËÀßÄê¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£</font><br>
+<br>
+
+<br>
+
+<center><a href="mailto:<!--{$tpl_kara_mail_to|escape:'url'}-->">¥á¡¼¥ëÁ÷¿®</a></center>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/email_mobile_complete.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/email_mobile_complete.tpl	(revision 11415)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/email_mobile_complete.tpl	(revision 11415)
@@ -0,0 +1,17 @@
+<center>·ÈÂÓ¥á¡¼¥ëÅÐÏ¿´°Î»</center>
+
+<hr>
+
+·ÈÂÓÅÅÏÃ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÎÅÐÏ¿¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£<br>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/index.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/index.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/index.tpl	(revision 11414)
@@ -0,0 +1,63 @@
+<div align="center">²ñ°÷¾ðÊóÆþÎÏ 1/3</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="set1">
+
+	<font color="#FF0000">*¤ÏÉ¬¿Ü¹àÌÜ¤Ç¤¹¡£</font><br>
+	<br>
+
+	¡Ú¥á¡¼¥ë¥¢¥É¥ì¥¹¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.email}--></font>
+<!--{if @$tpl_kara_mail_from}-->
+  <!--{$tpl_kara_mail_from|escape}-->
+<!--{else}-->
+	<input type="text" name="email" value="<!--{$email|escape}-->" istyle="3">
+<!--{/if}-->
+  <br>
+
+	¡Ú¥Ñ¥¹¥ï¡¼¥É¡Û<font color="#FF0000">¢¨</font><br>
+	¡ÊÈ¾³Ñ±Ñ¿ô»ú<!--{$smarty.const.PASSWORD_LEN1}-->Ê¸»ú°Ê¾å<!--{$smarty.const.PASSWORD_LEN2}-->Ê¸»ú°ÊÆâ¡Ë<br>
+	<font color="#FF0000"><!--{$arrErr.password}--></font>
+	<!--{assign var="size" value="`$smarty.const.PASSWORD_LEN2+2`"}-->
+	<input type="text" name="password" value="<!--{$arrForm.password}-->" istyle="4" maxlength="<!--{$smarty.const.PASSWORD_LEN2}-->" size="<!--{$size}-->"><br>
+
+	¡Ú¥Ñ¥¹¥ï¡¼¥É³ÎÇ§ÍÑ¤Î¼ÁÌä¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.reminder}--></font>
+	<select name="reminder">
+		<option value="" selected>ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option>
+		<!--{html_options options=$arrReminder selected=$reminder}-->
+	</select><br>
+
+	¡Ú¼ÁÌä¤ÎÅú¤¨¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.reminder_answer}--></font>
+	<input type="text" name="reminder_answer" value="<!--{$reminder_answer|escape}-->" istyle="1"><br>
+
+	¡Ú¤ªÌ¾Á°¡Û<font color="#FF0000">¢¨</font><br>
+	<font color="#FF0000"><!--{$arrErr.name01}--><!--{$arrErr.name02}--></font>
+	À«¡ÊÎã¡§½ÂÃ«¡Ë<br>
+	<input type="text" name="name01" value="<!--{$name01|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="1"><br>
+
+	Ì¾¡ÊÎã¡§²Ö»Ò¡Ë<br>
+	<input type="text" name="name02" value="<!--{$name02|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="1"><br>
+	<font color="#FF0000"><!--{$arrErr.kana01}--><!--{$arrErr.kana02}--></font>
+
+	¥«¥Ê/À«¡ÊÎã¡§¥·¥Ö¥ä¡Ë<br>
+	<input type="text" name="kana01" value="<!--{$kana01|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
+
+	¥«¥Ê/Ì¾¡ÊÎã¡§¥Ï¥Ê¥³¡Ë<br>
+	<input type="text" name="kana02" value="<!--{$kana02|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" istyle="2"><br>
+
+	<input type="submit" name="confirm" value="¼¡¤Ø">
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/complete.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/complete.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/complete.tpl	(revision 11418)
@@ -0,0 +1,20 @@
+<div align="center">²ñ°÷ÅÐÏ¿´°Î»</div>
+<hr>
+
+²ñ°÷ÅÐÏ¿¤Î¼õÉÕ¤¬´°Î»¤¤¤¿¤·¤Þ¤·¤¿¡£<br>
+¸½ºß<font color="#FF0000">²¾²ñ°÷</font>¤Î¾õÂÖ¤Ç¤¹¡£<br>
+¤´ÆþÎÏ¤¤¤¿¤À¤¤¤¿¥á¡¼¥ë¥¢¥É¥ì¥¹°¸¤Æ¤Ë¡¢¤´Ï¢Íí¤¬ÆÏ¤¤¤Æ¤ª¤ê¤Þ¤¹¤Î¤Ç¡¢ËÜ²ñ°÷ÅÐÏ¿¤Ë¤Ê¤Ã¤¿¾å¤Ç¤ªÇã¤¤Êª¤ò¤ª³Ú¤·¤ß¤¯¤À¤µ¤¤¡£<br>
+º£¸å¤È¤â¤´°¦¸Ü»ò¤ê¤Þ¤¹¤è¤¦¤è¤í¤·¤¯¤ª´ê¤¤¿½¤·¾å¤²¤Þ¤¹¡£<br>
+
+<br>
+
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/new.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/new.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/new.tpl	(revision 11414)
@@ -0,0 +1,20 @@
+<div align="center">¿·µ¬¤´ÅÐÏ¿</div>
+<hr>
+
+¤´ÃíÊ¸¤ËºÝ¤·¤ÆÉ¬Í×¤ÊÆâÍÆ¡Ê¤´¼«Âð½»½êÅù¡Ë¤ò¤´ÅÐÏ¿¤·¤Æ¤¤¤¿¤À¤­¤Þ¤¹¡£<br>
+¤´ÍøÍÑ¤Îµ¬Ìó¤ò¤è¤¯¤ªÆÉ¤ß¤Î¾å¡¢¤´ÅÐÏ¿²¼¤µ¤¤¡£<br>
+<a href="kiyaku.php" accesskey="1"><!--{1|numeric_emoji}-->²ñ°÷µ¬Ìó¤òÆÉ¤à<br>
+<a href="index.php" accesskey="2"><!--{2|numeric_emoji}-->Æ±°Õ¤·¤ÆÅÐÏ¿¤Ø<br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="3"><!--{3|numeric_emoji}-->Æ±°Õ¤·¤Ê¤¤<br>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/set1.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/set1.tpl	(revision 11419)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/set1.tpl	(revision 11419)
@@ -0,0 +1,54 @@
+<div align="center">²ñ°÷¾ðÊóÆþÎÏ 2/3</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="set2">
+
+	<font color="#FF0000">*¤ÏÉ¬¿Ü¹àÌÜ¤Ç¤¹¡£</font><br>
+	<br>
+
+	¡ÚÀ­ÊÌ¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.sex}--></font>
+	<input type="radio" name="sex" value="1" <!--{if $sex eq 1}-->checked<!--{/if}--> />ÃËÀ­&nbsp;<input type="radio" name="sex" value="2" <!--{if $sex eq 2}-->checked<!--{/if}--> />½÷À­<br>
+
+	¡ÚÀ¸Ç¯·îÆü¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.year}--><!--{$arrErr.month}--><!--{$arrErr.day}--></font>
+	<select name="year">
+		<!--{html_options options=$arrYear selected=$year}-->
+	</select>Ç¯<br>
+	<select name="month">
+		<option value="">--</option>
+		<!--{html_options options=$arrMonth selected=$month}-->
+	</select>·î<br>
+	<select value="" name="day">
+		<option value="">--</option>
+		<!--{html_options options=$arrDay selected=$day}-->
+	</select>Æü<br>
+
+	<!--{assign var=key1 value="zip01"}-->
+	<!--{assign var=key2 value="zip02"}-->
+	¡ÚÍ¹ÊØÈÖ¹æ¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr[$key1]}--><!--{$arrErr[$key2]}--></font>
+	<!--{assign var="size1" value="`$smarty.const.ZIP01_LEN+2`"}-->
+	<!--{assign var="size2" value="`$smarty.const.ZIP02_LEN+2`"}-->
+	<input size="<!--{$size1}-->" type="text" name="zip01" value="<!--{if $zip01 == ""}--><!--{$arrOtherDeliv.zip01|escape}--><!--{else}--><!--{$zip01|escape}--><!--{/if}-->" maxlength="<!--{$smarty.const.ZIP01_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input size="<!--{$size2}-->" type="text" name="zip02" value="<!--{if $zip02 == ""}--><!--{$arrOtherDeliv.zip02|escape}--><!--{else}--><!--{$zip02|escape}--><!--{/if}-->" maxlength="<!--{$smarty.const.ZIP02_LEN}-->" istyle="4"><br>
+
+	<input type="submit" name="confirm" value="¼¡¤Ø">
+
+	<!--{foreach from=$list_data key=key item=item}-->
+		<input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->">
+	<!--{/foreach}-->
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/confirm.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/confirm.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/confirm.tpl	(revision 11414)
@@ -0,0 +1,45 @@
+<div align="center">ÅÐÏ¿³ÎÇ§</div>
+<hr>
+<form name="form1" id="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="complete">
+	<!--{foreach from=$list_data key=key item=item}-->
+		<input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->">
+	<!--{/foreach}-->
+	²¼µ­¤ÎÆâÍÆ¤Ç¤´ÅÐÏ¿¤·¤Æ¤â¤è¤í¤·¤¤¤Ç¤¹¤«¡©<br>
+	<br>
+	¡ÚÒ°Ù±ÄÞÚ½¡Û<br>
+	<!--{$list_data.email|escape}--><br>
+
+	¡ÚÊß½Ü°ÄÞ³ÎÇ§ÍÑ¼ÁÌä¡Û<br>
+	<!--{$arrReminder[$list_data.reminder]|escape}--><br>
+
+	¡Ú¼ÁÌä¤ÎÅú¤¨¡Û<br>
+	<!--{$list_data.reminder_answer|escape}--><br>
+
+	¡Ú¸Ä¿Í¾ðÊó¡Û<br>
+	<!--{$list_data.name01|escape}-->¡¡<!--{$list_data.name02|escape}--><br>
+	<!--{$list_data.kana01|escape}-->¡¡<!--{$list_data.kana02|escape}--><br>
+	<!--{if $list_data.sex eq 1}-->ÃËÀ­<!--{else}-->½÷À­<!--{/if}--><br>
+	<!--{if strlen($list_data.year) > 0 && strlen($list_data.month) > 0 && strlen($list_data.day) > 0}--><!--{$list_data.year|escape}-->Ç¯<!--{$list_data.month|escape}-->·î<!--{$list_data.day|escape}-->ÆüÀ¸¤Þ¤ì<!--{else}-->Ì¤ÅÐÏ¿<!--{/if}--><br>
+	¢©<!--{$list_data.zip01|escape}--> - <!--{$list_data.zip02|escape}--><br>
+	<!--{$arrPref[$list_data.pref]|escape}--><!--{$list_data.addr01|escape}--><!--{$list_data.addr02|escape}--><br>
+	<!--{$list_data.tel01|escape}-->-<!--{$list_data.tel02|escape}-->-<!--{$list_data.tel03|escape}--><br>
+	
+	¡ÚÒ°ÙÏ¶Þ¼ÞÝÞ¡Û<br>
+	<!--{if $list_data.mail_flag eq 2}-->´õË¾¤¹¤ë<!--{else}-->´õË¾¤·¤Ê¤¤<!--{/if}--><br>
+	<br>
+
+	<input type="submit" name="submit" value="ÅÐÏ¿">
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/kiyaku.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/kiyaku.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/kiyaku.tpl	(revision 11414)
@@ -0,0 +1,23 @@
+<div align="center">¤´ÍøÍÑµ¬Ìó</div>
+<hr>
+<!--{$tpl_kiyaku_text}--><br>
+
+<BR>
+<!--{if $offset != -1}-->
+	<a href="kiyaku.php?offset=<!--{$offset}-->">¼¡¤Ø¢ª</a><br><br>
+<!--{/if}-->
+
+<a href="index.php" accesskey="1"><!--{1|numeric_emoji}-->Æ±°Õ¤·¤ÆÅÐÏ¿¤Ø</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="2"><!--{2|numeric_emoji}-->Æ±°Õ¤·¤Ê¤¤</a><br>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/set2.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/set2.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/set2.tpl	(revision 11414)
@@ -0,0 +1,54 @@
+<div align="center">²ñ°÷¾ðÊóÆþÎÏ 3/3</div>
+<hr>
+<form name="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+	<input type="hidden" name="mode" value="confirm">
+
+	<font color="#FF0000">*¤ÏÉ¬¿Ü¹àÌÜ¤Ç¤¹¡£</font><br>
+	<br>
+
+	¡ÚÅÔÆ»ÉÜ¸©¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.pref}--><!--{$arrErr.addr01}--><!--{$arrErr.addr02}--></font>
+	<select name="pref">
+		<option value="" selected>ÅÔÆ»ÉÜ¸©¤òÁªÂò</option>
+		<!--{html_options options=$arrPref selected=$pref}-->
+	</select><br>
+
+	¡Ú»Ô¶èÄ®Â¼¡Û<font color="#FF0000">*</font><br>
+	<input type="text" name="addr01" value="<!--{$addr01|escape}-->" istyle="1"><br>
+
+	¡ÚÈÖÃÏ¡Û<font color="#FF0000">*</font><br>
+	<input type="text" name="addr02" value="<!--{$addr02|escape}-->" istyle="1"><br>
+
+	¡ÚÅÅÏÃÈÖ¹æ¡Û<font color="#FF0000">*</font><br>
+	<font color="#FF0000"><!--{$arrErr.tel01}--><!--{$arrErr.tel02}--><!--{$arrErr.tel03}--></font>
+	<!--{assign var="size" value="`$smarty.const.TEL_ITEM_LEN+2`"}-->
+	<input type="text" size="<!--{$size}-->" name="tel01" value="<!--{$tel01|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input type="text" size="<!--{$size}-->" name="tel02" value="<!--{$tel02|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4">
+	&nbsp;-&nbsp;
+	<input type="text" size="<!--{$size}-->" name="tel03" value="<!--{$tel03|escape}-->" maxlength="<!--{$smarty.const.TEL_ITEM_LEN}-->" istyle="4"><br>
+
+	¡Ú¥á¡¼¥ë¥Þ¥¬¥¸¥ó¡Û<br>
+	¤ªÆÀ¤Ê¾ðÊó¤ò´õË¾¤µ¤ì¤Þ¤¹¤«¡©<br>
+	ÇÛ¿®´õË¾<input type="checkbox" name="mail_flag" value="on" <!--{if $mail_flag eq 'on'}-->checked<!--{/if}--> /><br>
+	¡Ê´õË¾¤µ¤ì¤Ê¤¤¾ì¹ç¤Ï¥Á¥§¥Ã¥¯¤ò¤Ï¤º¤·¤Æ¤¯¤À¤µ¤¤¡Ë<br>
+	<br>
+
+	<input type="submit" name="confirm" value="¼¡¤Ø">
+
+	<!--{foreach from=$list_data key=key item=item}-->
+		<input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->">
+	<!--{/foreach}-->
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/entry/email_mobile.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/entry/email_mobile.tpl	(revision 11415)
+++ /branches/mobile/data/Smarty/templates/mobile/entry/email_mobile.tpl	(revision 11415)
@@ -0,0 +1,33 @@
+<center>·ÈÂÓ¥á¡¼¥ëÅÐÏ¿</center>
+
+<hr>
+
+<!--{$tpl_name|escape}-->ÍÍ<br>
+¤¤¤Ä¤â¤´ÍøÍÑ¤¤¤¿¤À¤­¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£¤´»ÈÍÑ¤Î·ÈÂÓÅÅÏÃ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¤´ÅÐÏ¿²¼¤µ¤¤¡£<br>
+
+<br>
+
+<!--{if @$tpl_kara_mail_to != ''}-->
+¼¡¤Î¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¶õ¥á¡¼¥ë¤òÁ÷¿®¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+<center><a href="mailto:<!--{$tpl_kara_mail_to|escape:'url'}-->">¥á¡¼¥ëÁ÷¿®</a></center>
+<!--{else}-->
+<form method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
+<!--{assign var=key value='email_mobile'}-->
+¢§¥á¡¼¥ë¥¢¥É¥ì¥¹<br>
+<font color="#ff0000"><!--{$arrErr[$key]|default:''}--></font>
+<input type="text" name="email_mobile" value="<!--{$arrForm[$key].value|escape}-->" size="40" maxlength="<!--{$arrForm[$key].length}-->" istyle="3"><br>
+<center><input type="submit" value="Á÷¿®"></center>
+</form>
+<!--{/if}-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/best5.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/best5.tpl	(revision 11398)
+++ /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/best5.tpl	(revision 11398)
@@ -0,0 +1,14 @@
+<!--{if count($arrBestProducts) > 0}-->
+<center>
+<!--{foreach from=$arrBestProducts item=arrProduct name=best_products}-->
+
+<!-- ¢§¥ª¥¹¥¹¥á¥³¥á¥ó¥È ¤³¤³¤«¤é -->
+<a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->">
+<!--{$arrProduct.comment|escape|nl2br}-->
+</a>
+<!-- ¢¥¥ª¥¹¥¹¥á¥³¥á¥ó¥È ¤³¤³¤Þ¤Ç -->
+
+<!--{if !$smarty.foreach.best_products.last}--><br><br><!--{/if}-->
+<!--{/foreach}-->
+</center>
+<!--{/if}-->
Index: /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/news.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/news.tpl	(revision 11398)
+++ /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/news.tpl	(revision 11398)
@@ -0,0 +1,11 @@
+<!--{if count($arrNews) > 0}-->
+<center>
+¡½¡½¡½¡½¡½¡½¡½¡½¡½<br>
+<marquee>
+<!--{if $arrNews[0].news_url}--><a href="<!--{$arrNews[0].news_url|escape}-->"><!--{/if}-->
+<!--{$arrNews[0].news_title|escape}-->
+<!--{if $arrNews[0].news_url}--></a><!--{/if}-->
+</marquee>
+¡½¡½¡½¡½¡½¡½¡½¡½¡½<br>
+</center>
+<!--{/if}-->
Index: /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/category.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/category.tpl	(revision 11398)
+++ /branches/mobile/data/Smarty/templates/mobile/frontparts/bloc/category.tpl	(revision 11398)
@@ -0,0 +1,11 @@
+<!--¢§¾¦ÉÊ¥«¥Æ¥´¥ê¡¼¤³¤³¤«¤é-->
+<!--{section name=cnt loop=$arrCat}-->
+<!--{assign var=disp_name value="`$arrCat[cnt].category_name`"}-->
+<!--{if $arrCat[cnt].has_children}-->
+<!--{assign var=path value="`$smarty.const.URL_DIR`products/category_list.php"}-->
+<!--{else}-->
+<!--{assign var=path value="`$smarty.const.URL_DIR`products/list.php"}-->
+<!--{/if}-->
+¡¡<font color="<!--{cycle values="#000000,#880000,#8888ff,#88ff88,#ff0000"}-->">¢£</font><a href="<!--{$path}-->?category_id=<!--{$arrCat[cnt].category_id}-->"><!--{$disp_name|sfCutString:20|escape}--></a><br>
+<!--{/section}-->
+<!--¢¥¾¦ÉÊ¥«¥Æ¥´¥ê¡¼¤³¤³¤Þ¤Ç-->
Index: /branches/mobile/data/Smarty/templates/mobile/products/list.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/products/list.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/products/list.tpl	(revision 11414)
@@ -0,0 +1,42 @@
+<!-- ¢§¥¿¥¤¥È¥ë ¤³¤³¤«¤é -->
+<center><!--{$tpl_subtitle|escape}--></center>
+<!-- ¢¥¥¿¥¤¥È¥ë ¤³¤³¤Þ¤Ç -->
+
+<hr>
+
+<!--{foreach from=$arrProducts key=i item=arrProduct}-->
+<!-- ¢§¾¦ÉÊ ¤³¤³¤«¤é -->
+<!--{if $i+1<9}--><!--{$i+1|numeric_emoji}--><!--{else}-->[<!--{$i+1}-->]<!--{/if}-->
+<!-- ¾¦ÉÊÌ¾ --><!--{$arrProduct.name|escape}--><br>
+
+²Á³Ê¡§
+<!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
+¡ï<!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
+<!--{else}-->
+¡ï<!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->¡Á¡ï<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
+<!--{/if}-->
+<br>
+
+<div align="right">
+<!--{if $i+1<9}-->
+<a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->" accesskey="<!--{$i+1}-->">¾¦ÉÊ¾ÜºÙ¤Ø¢ª</a>
+<!--{else}-->
+<a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->">¾¦ÉÊ¾ÜºÙ¤Ø¢ª</a>
+<!--{/if}-->
+</div>
+
+<br>
+<!-- ¢¥¾¦ÉÊ ¤³¤³¤Þ¤Ç -->
+<!--{/foreach}-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/products/select_item.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/products/select_item.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/products/select_item.tpl	(revision 11414)
@@ -0,0 +1,26 @@
+<div align="center">¿ôÎÌ»ØÄê</div>
+<hr>
+
+<!--{if $arrErr.classcategory_id2 != ""}-->
+	<font color="#FF0000">¢¨¿ôÎÌ¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡</font><br>
+<!--{/if}-->
+<form method="post" action="<!--{$smarty.server.REQUEST_URI|escape}-->">
+	<input type="text" name="quantity" size="3" value="<!--{$arrForm.quantity.value|default:1}-->" maxlength=<!--{$smarty.const.INT_LEN}--> istyle="4"><br>
+	<input type="hidden" name="mode" value="cart">
+	<input type="hidden" name="classcategory_id1" value="<!--{$arrForm.classcategory_id1.value}-->">
+	<input type="hidden" name="classcategory_id2" value="<!--{$arrForm.classcategory_id2.value}-->">
+	<input type="hidden" name="product_id" value="<!--{$tpl_product_id}-->">
+	<center><input type="submit" name="submit" value="¤«¤´¤ËÆþ¤ì¤ë"></center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/products/select_find1.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/products/select_find1.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/products/select_find1.tpl	(revision 11414)
@@ -0,0 +1,27 @@
+<div align="center"><!--{$tpl_class_name1}--></div>
+<hr>
+
+<!--{if $arrErr.classcategory_id1 != ""}-->
+	<font color="#FF0000">¢¨<!--{$tpl_class_name1}-->¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡</font><br>
+<!--{/if}-->
+<form method="post" action="<!--{$smarty.server.REQUEST_URI|escape}-->">
+	<select name="classcategory_id1">
+		<option value="">ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option>
+		<!--{html_options options=$arrClassCat1 selected=$arrForm.classcategory_id1.value}-->
+	</select><br>
+	<input type="hidden" name="mode" value="select2">
+	<input type="hidden" name="product_id" value="<!--{$tpl_product_id}-->">
+	<center><input type="submit" name="submit" value="¼¡¤Ø"></center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/products/select_find2.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/products/select_find2.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/products/select_find2.tpl	(revision 11414)
@@ -0,0 +1,28 @@
+<div align="center"><!--{$tpl_class_name2}--></div>
+<hr>
+
+<!--{if $arrErr.classcategory_id2 != ""}-->
+	<font color="#FF0000">¢¨<!--{$tpl_class_name2}-->¤òÆþÎÏ¤·¤Æ²¼¤µ¤¤¡</font><br>
+<!--{/if}-->
+<form method="post" action="<!--{$smarty.server.REQUEST_URI|escape}-->">
+	<select name="classcategory_id2">
+		<option value="">ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option>
+		<!--{html_options options=$arrClassCat2 selected=$arrForm.classcategory_id2.value}-->
+	</select><br>
+	<input type="hidden" name="mode" value="selectItem">
+	<input type="hidden" name="classcategory_id1" value="<!--{$arrForm.classcategory_id1.value}-->">
+	<input type="hidden" name="product_id" value="<!--{$tpl_product_id}-->">
+	<center><input type="submit" name="submit" value="¼¡¤Ø"></center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/products/detail.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/products/detail.tpl	(revision 11418)
+++ /branches/mobile/data/Smarty/templates/mobile/products/detail.tpl	(revision 11418)
@@ -0,0 +1,55 @@
+<!--¢§CONTENTS-->
+<!--¢§MAIN CONTENTS-->
+<!--À²ÄÙ¤³¤³¤«¤é-->
+<!--¡ú¾¦ÉÊÌ¾¡ú-->
+<div align="center"><!--{$arrProduct.name|escape}--></div>
+<hr>
+<!--À²ÄÙ¤³¤³¤Þ¤Ç-->
+<!--¾ÜºÙ¤³¤³¤«¤é-->
+<!--{assign var=key value="main_image"}-->
+<img src="<!--{$arrFile[$key].filepath}-->"><br>
+<!--¡ú¾ÜºÙÒ²ÝºÒÝÄ¡ú-->
+[emoji:76]<!--{$arrProduct.main_comment|nl2br}--><br>
+<br>
+<!--±²ºÝ-->
+<!--¡ú²Á³Ê¡ú-->
+<font color="#FF0000">²Á³Ê(ÀÇ¹þ):
+<!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
+	<!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
+<!--{else}-->
+	<!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->¥<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
+<!--{/if}-->
+±ß</font><br/>
+<!--{if $arrProduct.price01_max > 0}-->
+<font color="#FF0000">»²¹Í»Ô¾ì²Á³Ê:
+<!--{if $arrProduct.price01_min == $arrProduct.price01_max}-->
+<!--{$arrProduct.price01_min|number_format}-->
+<!--{else}-->
+<!--{$arrProduct.price01_min|number_format}-->¥<!--{$arrProduct.price01_max|number_format}-->
+<!--{/if}-->
+±ß</font><br>
+<!--{/if}-->
+<form name="form1" method="post" action="<!--{$smarty.server.REQUEST_URI|escape}-->">
+	<input type="hidden" name="mode" value="select">
+	<input type="hidden" name="product_id" value="<!--{$tpl_product_id}-->">
+<!--{if $tpl_stock_find}-->
+	<!--¡ú¾¦ÉÊ¤òÁª¤Ö¡ú-->
+	<center><input type="submit" name="select" id="cart" value="¤³¤Î¾¦ÉÊ¤òÁª¤Ö"></center>
+<!--{else}-->
+	<font color="#FF0000">¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¤Âþº£ÉÊÀÚ¤ìÃæ¤Ç¤¹¡</font>
+<!--{/if}-->
+</form>
+<!--¾ÜºÙ¤³¤³¤Þ¤Ç-->
+<!--¢¥CONTENTS-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/products/search.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/products/search.tpl	(revision 11414)
+++ /branches/mobile/data/Smarty/templates/mobile/products/search.tpl	(revision 11414)
@@ -0,0 +1,25 @@
+<center>¾¦ÉÊ¸¡º÷</center>
+
+<hr>
+
+¤ªÃµ¤·¤Î¾¦ÉÊÌ¾¡¦·¿ÈÖ¤òÆþÎÏ¤·¤Æ¤¯¤À¤µ¤¤¡£<br>
+
+<form method="get" action="<!--{$smarty.const.URL_DIR}-->products/list.php">
+<center>
+<input type="hidden" name="mode" value="search">
+<input type="text" name="name" size="18" maxlength="50" value="<!--{$smarty.get.name|escape}-->"><br>
+<input type="submit" name="search" value="¸¡º÷">
+</center>
+</form>
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/products/category_list.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/products/category_list.tpl	(revision 11406)
+++ /branches/mobile/data/Smarty/templates/mobile/products/category_list.tpl	(revision 11406)
@@ -0,0 +1,28 @@
+<center><!--{$arrCategory.category_name|escape}--></center>
+
+<hr>
+
+<!--{foreach from=$arrChildren key=i item=arrChild}-->
+<!--{if $arrChild.has_children}-->
+<!--{assign var=path value="`$smarty.const.URL_DIR`products/category_list.php"}-->
+<!--{else}-->
+<!--{assign var=path value="`$smarty.const.URL_DIR`products/list.php"}-->
+<!--{/if}-->
+<!--{if $i+1<9}-->
+<a href="<!--{$path}-->?category_id=<!--{$arrChild.category_id}-->" accesskey="<!--{$i+1}-->"><!--{$i+1|numeric_emoji}--><!--{$arrChild.category_name|escape}-->(<!--{$arrChild.product_count}-->)</a><br>
+<!--{else}-->
+[<!--{$i+1}-->]<a href="<!--{$path}-->?category_id=<!--{$arrChild.category_id}-->"><!--{$arrChild.category_name|escape}-->(<!--{$arrChild.product_count}-->)</a><br>
+<!--{/if}-->
+<!--{/foreach}-->
+
+<br>
+<hr>
+
+<a href="<!--{$smarty.const.URL_CART_TOP}-->" accesskey="9"><!--{9|numeric_emoji}-->¤«¤´¤ò¸«¤ë</a><br>
+<a href="<!--{$smarty.const.URL_SITE_TOP}-->" accesskey="0"><!--{0|numeric_emoji}-->TOP¥Ú¡¼¥¸¤Ø</a><br>
+
+<br>
+
+<!-- ¢§¥Õ¥Ã¥¿¡¼ ¤³¤³¤«¤é -->
+<!--{include file='footer.tpl'}-->
+<!-- ¢¥¥Õ¥Ã¥¿¡¼ ¤³¤³¤Þ¤Ç -->
Index: /branches/mobile/data/Smarty/templates/mobile/site_main.tpl
===================================================================
--- /branches/mobile/data/Smarty/templates/mobile/site_main.tpl	(revision 11398)
+++ /branches/mobile/data/Smarty/templates/mobile/site_main.tpl	(revision 11398)
@@ -0,0 +1,9 @@
+<body bgcolor="#ffffff" text="#555555" link="#3a75af" vlink="#3a75af" alink="#3a75af">
+<!--¢§MAIN-->
+<!--{include file=$tpl_mainpage}-->
+<!--¢¥MAIN-->
+<!--{* EBiS¥¿¥°É½¼¨ÍÑ *}-->
+<!--{$tpl_mainpage|sfPrintEbisTag}-->
+<!--{* ¥¢¥Õ¥£¥ê¥¨¥¤¥È¥¿¥°É½¼¨ÍÑ *}-->
+<!--{$tpl_conv_page|sfPrintAffTag:$tpl_aff_option}-->
+</body>
Index: /branches/mobile/data/include/mobile_image_map_docomo.csv
===================================================================
--- /branches/mobile/data/include/mobile_image_map_docomo.csv	(revision 11459)
+++ /branches/mobile/data/include/mobile_image_map_docomo.csv	(revision 11459)
@@ -0,0 +1,226 @@
+D209i(D209i_B),D209i,5000,N,96,96,gif,3000,N
+D209i(D209i_A),D209i/c10,10000,N,96,96,gif,8000,N
+D2101V,D2101V,100000,Y,120,120,jpg,20000,Y
+D210i,D210i,10000,N,96,96,gif,8000,N
+D211i,D211i,10000,Y,100,100,gif,8000,Y
+D251i,D251i,10000,Y,132,132,jpg,8000,Y
+D251iS,D251iS,10000,Y,132,132,jpg,8000,Y
+D252i,D252i,10000,Y,176,176,jpg,8000,Y
+D253i,D253i,10000,Y,176,176,jpg,8000,Y
+D253iWM(MusicPORTER),D253iWM,10000,Y,220,216,jpg,8000,Y
+D501i,D501i,5000,N,96,96,gif,3000,N
+D502i(D502i_B),D502i,5000,N,96,96,gif,3000,N
+D502i(D502i_A),D502i/c10,10000,N,96,96,gif,5000,N
+D503i,D503i,10000,Y,132,132,gif,8000,Y
+D503iS,D503iS,10000,Y,132,132,gif,8000,Y
+D504i,D504i,10000,Y,132,132,jpg,8000,Y
+D505i,D505i,20000,Y,240,240,jpg,18000,Y
+D505iS,D505iS,20000,Y,240,240,jpg,18000,Y
+D506i,D506i,20000,Y,240,240,jpg,18000,Y
+D701i,D701i,100000,Y,230,224,jpg,20000,Y
+D701iWM(Music Porter II),D701iWM,100000,Y,230,224,jpg,20000,Y
+D702i,D702i,100000,Y,230,224,jpg,20000,Y
+D702iBCL,D702iBCL,100000,Y,230,224,jpg,20000,Y
+D702iF,D702iF,100000,Y,230,224,jpg,20000,Y
+D851iWM(Music Porter X),D851iWM,100000,Y,230,224,jpg,20000,Y
+D900i,D900i,100000,Y,240,240,jpg,20000,Y
+D901i,D901i,100000,Y,230,224,jpg,20000,Y
+D901iS,D901iS,100000,Y,230,224,jpg,20000,Y
+D902i,D902i,100000,Y,230,224,jpg,20000,Y
+D902iS,D902iS,100000,Y,230,224,jpg,20000,Y
+D903i,D903i,100000,Y,230,224,jpg,20000,Y
+ER209i(ER209i_B),ER209i,5000,N,120,120,gif,3000,N
+ER209i(ER209i_A),ER209i/c15,15000,N,120,120,gif,8000,N
+F2051,F2051,100000,Y,176,176,jpg,20000,Y
+F209i(F209i_B),F209i,5000,N,96,96,gif,3000,N
+F209i(F209i_A),F209i/c10,10000,N,96,96,gif,8000,N
+F2102V,F2102V,100000,Y,176,176,jpg,20000,Y
+F210i,F210i,10000,N,96,96,gif,8000,N
+F211i,F211i,10000,Y,96,96,gif,8000,Y
+F212i,F212i,10000,Y,132,132,jpg,8000,Y
+F251i,F251i,10000,Y,132,132,jpg,8000,Y
+F501i,F501i,5000,N,112,112,gif,3000,N
+F502i(F502i_B),F502i,5000,N,96,96,gif,3000,N
+F502i(F502i_A),F502i/c10,10000,N,96,96,gif,8000,N
+F502it(F502it_B),F502it,5000,N,96,96,gif,3000,N
+F502it(F502it_A),F502it/c10,10000,N,96,96,gif,8000,N
+F503i,F503i,10000,Y,120,120,gif,8000,Y
+F503iS,F503iS,10000,Y,120,120,gif,8000,Y
+F504i,F504i,10000,Y,132,132,jpg,8000,Y
+F504iS,F504iS,10000,Y,132,132,jpg,8000,Y
+F505i,F505i,20000,Y,240,240,jpg,18000,Y
+F505iGPS,F505iGPS,20000,Y,240,240,jpg,18000,Y
+F506i,F506i,20000,Y,240,240,jpg,18000,Y
+F661i,F661i,10000,Y,132,132,jpg,8000,Y
+F671i,F671i,10000,N,120,120,gif,8000,N
+F671iS,F671iS,10000,Y,160,160,jpg,8000,Y
+F672i,F672i,10000,Y,160,160,jpg,8000,Y
+F700i,F700i,100000,Y,230,224,jpg,20000,Y
+F700iS,F700iS,100000,Y,230,224,jpg,20000,Y
+F702iD,F702iD,100000,Y,230,224,jpg,20000,Y
+F880iES(FOMA¤é¤¯¤é¤¯¥Û¥ó),F880iES,100000,Y,240,240,jpg,20000,Y
+F881iES(FOMA¤é¤¯¤é¤¯¥Û¥óII),F881iES,100000,Y,240,240,jpg,20000,Y
+F882iES,F882iES,100000,Y,240,240,jpg,20000,Y
+F900i,F900i,100000,Y,230,224,jpg,20000,Y
+F900iC,F900iC,100000,Y,230,224,jpg,20000,Y
+F900iT,F900iT,100000,Y,230,224,jpg,20000,Y
+F901iC,F901iC,100000,Y,230,224,jpg,20000,Y
+F901iS,F901iS,100000,Y,230,224,jpg,20000,Y
+F902i,F902i,100000,Y,230,224,jpg,20000,Y
+F902iS,F902iS,100000,Y,230,224,jpg,20000,Y
+F903i,F903i,100000,Y,230,224,jpg,20000,Y
+ISIM101,ISIM101,-,-,240,240,jpg,20000,N
+ISIM60,ISIM60,-,-,176,176,jpg,20000,N
+ISIM70,ISIM70,-,-,240,240,jpg,20000,N
+KO209i,KO209i,5000,N,96,96,gif,3000,N
+KO210i(KO210i_B),KO210i,5000,N,96,96,gif,3000,N
+KO210i(KO210i_A),KO210i/c10,10000,N,96,96,gif,8000,N
+L600i,L600i,100000,Y,176,176,jpg,20000,Y
+L601i (SIMPURE L1),L601i,100000,Y,176,176,jpg,20000,Y
+SH2101V,MST_v_SH2101V,100000,Y,240,240,jpg,20000,Y
+N2001,N2001,10000,Y,118,112,jpg,8000,Y
+N2002,N2002,100000,Y,118,112,jpg,20000,Y
+N2051,N2051,100000,Y,176,176,jpg,20000,Y
+N209i(N209i_B),N209i,5000,N,108,108,gif,3000,N
+N209i(N209i_A),N209i/c08,8000,N,108,108,gif,6000,N
+N2102V,N2102V,100000,Y,176,176,jpg,20000,Y
+N210i(N210i_B),N210i,5000,N,118,112,gif,3000,N
+N210i(N210i_A),N210i/c10,10000,N,118,112,gif,8000,N
+N211i,N211i,10000,Y,118,112,jpg,8000,Y
+N211iS,N211iS,10000,Y,118,112,jpg,8000,Y
+N251i,N251i,10000,Y,132,132,jpg,8000,Y
+N251iS,N251iS,10000,Y,132,132,jpg,8000,Y
+N252i,N252i,10000,Y,132,132,jpg,8000,Y
+N253i,N253i,10000,Y,160,160,jpg,8000,Y
+N2701(N2701_B),N2701,100000,Y,176,176,jpg,20000,Y
+N2701(N2701_A),N2701/c10,10000,Y,176,176,jpg,8000,Y
+N501i,N501i,5000,N,118,112,gif,3000,N
+N502i(N502i_B),N502i,5000,N,118,112,gif,3000,N
+N502i(N502i_A),N502i/c08,8000,N,118,112,gif,6000,N
+N502it(N502it_B),N502it,5000,N,118,112,gif,3000,N
+N502it(N502it_A),N502it/c10,10000,N,118,112,gif,8000,N
+N503i,N503i,10000,Y,118,112,jpg,8000,Y
+N503iS,N503iS,10000,Y,118,112,jpg,8000,Y
+N504i,N504i,10000,Y,160,160,jpg,8000,Y
+N504iS,N504iS,10000,Y,160,160,jpg,8000,Y
+N505i,N505i,20000,Y,240,240,jpg,18000,Y
+N505iS,N505iS,20000,Y,240,240,jpg,18000,Y
+N506i,N506i,20000,Y,240,240,jpg,18000,Y
+N506iS,N506iS,20000,Y,240,240,jpg,18000,Y
+N506iSII(N506iS2),N506iS2,20000,Y,240,240,jpg,18000,Y
+N600i,N600i,100000,Y,176,176,jpg,20000,Y
+N601i,N601i,100000,Y,240,240,jpg,20000,Y
+N700i,N700i,100000,Y,240,240,jpg,20000,Y
+N701i,N701i,100000,Y,240,240,jpg,20000,Y
+N701iECO,N701iECO,100000,Y,240,240,jpg,20000,Y
+N702iD,N702iD,100000,Y,240,240,jpg,20000,Y
+N702iS,N702iS,100000,Y,240,240,jpg,20000,Y
+N821i(N821i_B),N821i,5000,N,118,112,gif,3000,N
+N821i(N821i_A),N821i/c08,8000,N,118,112,gif,6000,N
+N900i,N900i,100000,Y,240,240,jpg,20000,Y
+N900iG,N900iG,100000,Y,240,240,jpg,20000,Y
+N900iL,N900iL,100000,Y,240,240,jpg,20000,Y
+N900iS,N900iS,100000,Y,240,240,jpg,20000,Y
+N901iC,N901iC,100000,Y,240,240,jpg,20000,Y
+N901iS,N901iS,100000,Y,240,240,jpg,20000,Y
+N902i,N902i,100000,Y,240,240,jpg,20000,Y
+N902iS,N902iS,100000,Y,240,240,jpg,20000,Y
+N902iX(HIGH SPEED),N902iX,100000,Y,240,240,jpg,20000,Y
+N903i,N903i,100000,Y,240,240,jpg,20000,Y
+NM502i(NM502i_B),NM502i,5000,N,111,104,gif,3000,N
+NM502i(NM502i_A),NM502i/c10,10000,N,111,104,gif,8000,N
+NM850iG,NM850iG,100000,Y,176,176,jpg,20000,Y
+P2002,P2002,100000,Y,118,112,jpg,20000,Y
+P209i(P209i_B),P209i,5000,N,96,96,gif,3000,N
+P209i(P209i_A),P209i/c10,10000,N,96,96,gif,8000,N
+P209iS(P209iS_B),P209is,5000,N,96,96,gif,3000,N
+P209iS(P209iS_A),P209is/c10,10000,N,96,96,gif,8000,N
+P2101V,P2101V,100000,Y,163,160,jpg,20000,Y
+P2102V,P2102V,100000,Y,176,176,jpg,20000,Y
+P210i(P210i_B),P210i,5000,N,96,96,gif,3000,N
+P210i(P210i_A),P210i/c10,10000,N,96,96,gif,8000,N
+P211i,P211i,10000,Y,120,120,jpg,8000,Y
+P211iS,P211iS,10000,Y,120,120,jpg,8000,Y
+P213i(prosolid),P213i,10000,Y,132,132,jpg,8000,Y
+P251iS,P251iS,10000,Y,132,132,jpg,8000,Y
+P252i,P252i,10000,Y,132,132,jpg,8000,Y
+P252iS,P252iS,10000,Y,132,132,jpg,8000,Y
+P253i,P253i,10000,Y,132,132,jpg,8000,Y
+P253iS(Lechiffon),P253iS,10000,Y,132,132,jpg,8000,Y
+P501i,P501i,5000,N,96,96,gif,3000,N
+P502i(P502i_B),P502i,5000,N,96,96,gif,3000,N
+P502i(P502i_A),P502i/c10,10000,N,96,96,gif,8000,N
+P503i,P503i,10000,Y,120,120,jpg,8000,Y
+P503iS,P503iS,10000,Y,120,120,jpg,8000,Y
+P504i,P504i,10000,Y,132,132,jpg,8000,Y
+P504iS,P504iS,10000,Y,132,132,jpg,8000,Y
+P505i,P505i,20000,Y,240,240,jpg,18000,Y
+P505iS,P505iS,20000,Y,240,240,jpg,18000,Y
+P506iC,P506iC,20000,Y,240,240,jpg,18000,Y
+P651ps(P651ps_B),P651ps,500096,96,gif,3000,N
+P651ps(P651ps_A),P651ps/c10,1000096,96,gif,3000,N
+P700i,P700i,100000,Y,240,240,jpg,20000,Y
+P701iD,P701iD,100000,Y,240,240,jpg,20000,Y
+P702i,P702i,100000,Y,240,240,jpg,20000,Y
+P702iD,P702iD,100000,Y,240,240,jpg,20000,Y
+P821i(P821i_B),P821i,5000,N,118,112,gif,3000,N
+P821i(P821i_A),P821i/c08,8000,N,118,112,gif,6000,N
+P851i(prosolidII),P851i,100000,Y,240,240,jpg,20000,Y
+P900i,P900i,100000,Y,240,240,jpg,20000,Y
+P900iV,P900iV,100000,Y,240,240,jpg,20000,Y
+P901i,P901i,100000,Y,240,240,jpg,20000,Y
+P901iS,P901iS,100000,Y,240,240,jpg,20000,Y
+P901iTV,P901iTV,100000,Y,240,240,jpg,20000,Y
+P902i,P902i,100000,Y,240,240,jpg,20000,Y
+P902iS,P902iS,100000,Y,240,240,jpg,20000,Y
+P903i,P903i,100000,Y,240,240,jpg,20000,Y
+R209i,R209i,5000,N,96,96,gif,3000,N
+R211i,R211i,10000,Y,96,96,jpg,8000,Y
+R691i,R691i,5000,N,96,96,gif,3000,N
+R692i,R692i,10000,Y,96,96,jpg,8000,Y
+SA700iS,SA700iS,100000,Y,240,240,jpg,20000,Y
+SA702i,SA702i,100000,Y,240,240,jpg,20000,Y
+SA800i,SA800i,100000,Y,240,240,jpg,20000,Y
+SH251i,SH251i,10000,N,120,120,jpg,8000,N
+SH251iS,SH251iS,10000,N,176,176,jpg,8000,N
+SH252i,SH252i,20000,Y,240,240,jpg,18000,Y
+SH505i,SH505i,20000,Y,240,240,jpg,18000,Y
+SH505i,SH505i2,20000,Y,240,240,jpg,18000,Y
+SH505iS,SH505iS,20000,Y,240,240,jpg,18000,Y
+SH506iC,SH506iC,20000,Y,240,240,jpg,18000,Y
+SH700i,SH700i,100000,Y,230,230,jpg,20000,Y
+SH700iS,SH700iS,100000,Y,240,240,jpg,20000,Y
+SH702iD,SH702iD,100000,Y,240,240,jpg,20000,Y
+SH702iS,SH702iS,100000,Y,240,240,jpg,20000,Y
+SH821i(SH821i_B),SH821i,5000,N,96,96,gif,3000,N
+SH821i(SH821i_A),SH821i/c10,10000,N,96,96,gif,8000,N
+SH851i(DOLCE),SH851i,100000,Y,240,240,jpg,20000,Y
+SH900i,SH900i,100000,Y,240,240,jpg,20000,Y
+SH901iC,SH901iC,100000,Y,240,240,jpg,20000,Y
+SH901iS,SH901iS,100000,Y,240,240,jpg,20000,Y
+SH902i,SH902i,100000,Y,240,240,jpg,20000,Y
+SH902iS,SH902iS,100000,Y,240,240,jpg,20000,Y
+SH902iSL,SH902iSL,100000,Y,240,240,jpg,20000,Y
+SH903i,SH903i,100000,Y,240,240,jpg,20000,Y
+SO210i,SO210i,10000,N,120,120,gif,8000,N
+SO211i,SO211i,10000,Y,120,120,jpg,8000,Y
+SO212i,SO212i,10000,Y,120,120,jpg,8000,Y
+SO213i(premini),SO213i,10000,Y,120,120,jpg,8000,Y
+SO213iS(premini-S),SO213iS,10000,Y,120,120,jpg,8000,Y
+SO213iWR(RADIDEN),SO213iWR,10000,Y,120,120,jpg,8000,Y
+SO502i,SO502i,5000,N,120,120,gif,3000,N
+SO502iWM,SO502iWM,10000,N,120,120,gif,8000,N
+SO503i,SO503i,10000,Y,120,120,gif,8000,Y
+SO503iS,SO503iS,10000,Y,120,120,gif,8000,Y
+SO504i,SO504i,10000,Y,120,120,jpg,8000,Y
+SO505i,SO505i,20000,Y,256,256,jpg,18000,Y
+SO505iS,SO505iS,20000,Y,240,240,jpg,18000,Y
+SO506i(premini-II),SO506i,20000,Y,240,240,jpg,18000,Y
+SO506iC,SO506iC,20000,Y,240,240,jpg,18000,Y
+SO506iS(premini-IIS),SO506iS,20000,Y,240,240,jpg,18000,Y
+SO702i,SO702i,100000,Y,240,240,jpg,20000,Y
+SO902i,SO902i,100000,Y,240,240,jpg,20000,Y
+SO902iWP+,SO902iWP+,100000,Y,240,240,jpg,20000,Y
+SO903i,SO903i,100000,Y,240,240,jpg,20000,Y
+T2101V,T2101V,100000,Y,176,176,jpg,20000,Y
+*,*,100000,Y,240,240,jpg,20000,Y
Index: /branches/mobile/data/include/image_converter.inc
===================================================================
--- /branches/mobile/data/include/image_converter.inc	(revision 11458)
+++ /branches/mobile/data/include/image_converter.inc	(revision 11458)
@@ -0,0 +1,144 @@
+<?php
+/**
+ * ²èÁü¥Õ¥¡¥¤¥ë¤ÎÊÑ´¹¤ò¹Ô¤¦
+ */
+class ImageConverter {
+	var $outputImageDir;		// ÊÑ´¹¸å¤Î²èÁü¤ÎÊÝÂ¸Àè
+	var $outputImageType;		// ÊÑ´¹¸å¤Î²èÁü¤Î·Á¼°
+	var $outputImageWidth;		// ÊÑ´¹¸å¤Î²èÁü¤Î²£Éý
+	var $outputImageHeight;		// ÊÑ´¹¸å¤Î²èÁü¤Î¹â¤µ
+	var $outputImageFileSize;	// ÊÑ´¹¸å¤Î²èÁü¤Î¥Õ¥¡¥¤¥ë¥µ¥¤¥º
+
+	// ¥³¥ó¥¹¥È¥é¥¯¥¿
+	function ImageConverter() {
+		$this->outputImageDir    = realpath(realpath(dirname(__FILE__)));
+		$this->outputImageType   = 'jpeg';
+		$this->outputImageWidth  = 320;
+		$this->outputImageHeight = NULL;
+		$this->outputFileSize    = 20000;
+	}
+
+	// ÊÑ´¹¼Â¹Ô
+	function execute($inputImagePath) {
+		// Á°½èÍý
+		$filestat         = @stat($inputImagePath);
+		$imagesize        = getimagesize($inputImagePath);
+		$inputImageWidth  = $imagesize[0];
+		$inputImageHeight = $imagesize[1];
+		$inputImageType   = $imagesize[2];
+		$outputImageName  = sha1($inputImagePath . '_' . $this->outputImageWidth . '_' . $this->outputFileSize . '_' . $filestat['mtime']) . '.' . $this->outputImageType;
+		$outputImagePath  = $this->outputImageDir . '/' . $outputImageName;
+
+		// ÊÑ´¹¸å¤Î²èÁü¤Î¹â¤µ¤¬»ØÄê¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÊÑ´¹¸å¤Î²èÁü¤Î²£Éý¤«¤éµá¤á¤ë
+		if (is_null($this->outputImageHeight)) {
+			$this->outputImageHeight = $inputImageHeight * ($this->outputImageWidth / $inputImageWidth);
+		}
+
+		// ¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¤«³ÎÇ§¤·¡¢Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Î¤ßºîÀ®¤¹¤ë
+		if (file_exists($outputImagePath)) {
+			$info['convert'] = FALSE;
+		} else {
+			// ¸µ¥Õ¥¡¥¤¥ëºîÀ®
+			switch($inputImageType) {
+			case 1:
+				// gif
+				$tempImage = imagecreatefromgif($inputImagePath);
+				break;
+			case 2:
+				// jpeg
+				$tempImage = imagecreatefromjpeg($inputImagePath);
+				break;
+			case 3:
+				// png
+				$tempImage = imagecreatefrompng($inputImagePath);
+				break;
+			case 6:
+				// bmp
+				$tempImage = imagecreatefromwbmp($inputImagePath);
+				break;
+			}
+
+			if (!$tempImage) {
+				return false;
+			}
+
+			$scale = 1.0;
+			$outputImagePathTemp = $outputImagePath . '.tmp-' . rand();
+			do {
+				// ¶õ¥Õ¥¡¥¤¥ëºîÀ®
+				$outputImage = ImageCreateTruecolor($this->outputImageWidth * $scale, $this->outputImageHeight * $scale);
+				ImageCopyResampled($outputImage, $tempImage, 0, 0, 0, 0, $this->outputImageWidth * $scale, $this->outputImageHeight * $scale, $inputImageWidth, $inputImageHeight);
+
+				// ¥Õ¥¡¥¤¥ë½ÐÎÏ
+
+				@unlink($outputImagePathTemp);
+
+				switch ($this->outputImageType) {
+				case 1:
+				case 'gif':
+					imagegif($outputImage, $outputImagePathTemp);
+					break;
+				default:
+				case 2:
+				case 'jpg':
+				case 'jpeg':
+					$quality = 75;
+					// É½¼¨²ÄÇ½¤Ê¥Õ¥¡¥¤¥ë¥µ¥¤¥º°Ê²¼¤Ë¤Ê¤ë¤Þ¤Ç¡¢10%¤º¤Ä¥¯¥ª¥ê¥Æ¥£¤òÄ´À°¤¹¤ë
+					do {
+						@unlink($outputImagePathTemp);
+						imagejpeg($outputImage, $outputImagePathTemp, $quality);
+						$quality -= 10;
+						clearstatcache();
+					} while (filesize($outputImagePathTemp) > $this->outputFileSize && $quality > 0);
+					break;
+				case 3:
+				case 'png':
+					imagepng($outputImage, $outputImagePathTemp);
+					break;
+				case 6:
+				case 'bmp':
+					imagewbmp($outputImage, $outputImagePathTemp);
+					break;
+				}
+
+				// ¥á¥â¥ê³«Êü
+				imagedestroy($outputImage);
+
+				$scale -= 0.1;
+				clearstatcache();
+			} while (filesize($outputImagePathTemp) > $this->outputFileSize && $scale >= 0.5);
+
+			rename($outputImagePathTemp, $outputImagePath);
+
+			// ¥á¥â¥ê³«Êü
+			imagedestroy($tempImage);
+
+			$info['convert'] = TRUE;
+		}
+
+		$info['outputImagePath']  = $outputImagePath;
+		$info['outputImageName']  = $outputImageName;
+		return $info;
+
+	}
+
+	// Setter
+	function setOutputDir($outputDir)   { $this->outputImageDir   = $outputDir;  }
+	function setImageType($imageType)   { $this->outputImageType  = $imageType;  }
+	function setImageWidth($imageWidth) { $this->outputImageWidth = $imageWidth; }
+	function setFileSize($fileSize)     { $this->outputFileSize   = $fileSize;   }
+	// function setImageHeight($imageHeight) { $this->outputImageHeight = $imageHeight; }
+
+	// Getter
+	function getOutputDir()   { return $this->outputDir;         }
+	function getImageType()   { return $this->outputImageType;   }
+	function getImageWidth()  { return $this->outputImageWidth;  }
+	function getImageHeight() { return $this->outputImageHeight; }
+
+	/*
+	 * PrivateMethod
+	 */
+	function beforeExecute() {
+	}
+}
+?>
Index: /branches/mobile/data/include/mobile_emoji_map_softbank.inc
===================================================================
--- /branches/mobile/data/include/mobile_emoji_map_softbank.inc	(revision 11398)
+++ /branches/mobile/data/include/mobile_emoji_map_softbank.inc	(revision 11398)
@@ -0,0 +1,260 @@
+<?php
+/**
+ * SoftBankÍÑ³¨Ê¸»ú¥³¡¼¥É (Shift JIS)
+ */
+
+return array(
+	'1'   => "\x1b\$Gj\x0f",
+	'2'   => "\x1b\$Gi\x0f",
+	'3'   => "\x1b\$Gk\x0f",
+	'4'   => "\x1b\$Gh\x0f",
+	'5'   => "\x1b\$E]\x0f",
+	'6'   => "\x1b\$Pc\x0f",
+	'7'   => "[\x96\xb6]", // [Ì¸]
+	'8'   => "\x1b\$P\\\x0f",
+	'9'   => "\x1b\$F_\x0f",
+	'10'  => "\x1b\$F`\x0f",
+	'11'  => "\x1b\$Fa\x0f",
+	'12'  => "\x1b\$Fb\x0f",
+	'13'  => "\x1b\$Fc\x0f",
+	'14'  => "\x1b\$Fd\x0f",
+	'15'  => "\x1b\$Fe\x0f",
+	'16'  => "\x1b\$Ff\x0f",
+	'17'  => "\x1b\$Fg\x0f",
+	'18'  => "\x1b\$Fh\x0f",
+	'19'  => "\x1b\$Fi\x0f",
+	'20'  => "\x1b\$Fj\x0f",
+	'21'  => null,
+	'22'  => "\x1b\$G6\x0f",
+	'23'  => "\x1b\$G4\x0f",
+	'24'  => "\x1b\$G5\x0f",
+	'25'  => "\x1b\$G8\x0f",
+	'26'  => "\x1b\$G3\x0f",
+	'27'  => "\x1b\$PJ\x0f",
+	'28'  => "\x1b\$ER\x0f",
+	'29'  => "[\xce\xdf\xb9\xaf\xc4\xcd\xde\xd9]", // [¥Ý¥±¥Ã¥È¥Ù¥ë]
+	'30'  => "\x1b\$G>\x0f",
+	'31'  => "\x1b\$PT\x0f",
+	'32'  => "\x1b\$PU\x0f",
+	'33'  => "\x1b\$G;\x0f",
+	'34'  => "\x1b\$PN\x0f",
+	'35'  => "\x1b\$Ey\x0f",
+	'36'  => "\x1b\$F\"\x0f",
+	'37'  => "\x1b\$G=\x0f",
+	'38'  => "\x1b\$GV\x0f",
+	'39'  => "\x1b\$GX\x0f",
+	'40'  => "\x1b\$Es\x0f",
+	'41'  => "\x1b\$Eu\x0f",
+	'42'  => "\x1b\$Em\x0f",
+	'43'  => "\x1b\$Et\x0f",
+	'44'  => "\x1b\$Ex\x0f",
+	'45'  => "\x1b\$Ev\x0f",
+	'46'  => "\x1b\$GZ\x0f",
+	'47'  => "\x1b\$Eo\x0f",
+	'48'  => "\x1b\$En\x0f",
+	'49'  => "\x1b\$Eq\x0f",
+	'50'  => "\x1b\$Gc\x0f",
+	'51'  => "\x1b\$Ge\x0f",
+	'52'  => "\x1b\$Gd\x0f",
+	'53'  => "\x1b\$Gg\x0f",
+	'54'  => "\x1b\$E@\x0f",
+	'55'  => "\x1b\$E^\x0f",
+	'56'  => "\x1b\$O3\x0f",
+	'57'  => "\x1b\$G\\\x0f",
+	'58'  => "\x1b\$G]\x0f",
+	'59'  => "\x1b\$FV\x0f",
+	'60'  => null,
+	'61'  => "\x1b\$O*\x0f",
+	'62'  => "\x1b\$Q\"\x0f",
+	'63'  => "\x1b\$Q#\x0f",
+	'64'  => null,
+	'65'  => "\x1b\$EE\x0f",
+	'66'  => "\x1b\$O.\x0f",
+	'67'  => "\x1b\$F(\x0f",
+	'68'  => "\x1b\$G(\x0f",
+	'69'  => "\x1b\$OC\x0f",
+	'70'  => "\x1b\$Eh\x0f",
+	'71'  => "\x1b\$O4\x0f",
+	'72'  => "\x1b\$E2\x0f",
+	'73'  => "\x1b\$Ok\x0f",
+	'74'  => "\x1b\$G)\x0f",
+	'75'  => "\x1b\$G*\x0f",
+	'76'  => "\x1b\$O!\x0f",
+	'77'  => "\x1b\$EJ\x0f",
+	'78'  => "[\xb9\xde\xb0\xd1]", // [¥²¡¼¥à]
+	'79'  => "\x1b\$EF\x0f",
+	'80'  => "\x1b\$F,\x0f",
+	'81'  => "\x1b\$F.\x0f",
+	'82'  => "\x1b\$F-\x0f",
+	'83'  => "\x1b\$F/\x0f",
+	'84'  => "\x1b\$P9\x0f",
+	'85'  => "\x1b\$P;\x0f",
+	'86'  => "\x1b\$G0\x0f",
+	'87'  => "\x1b\$G1\x0f",
+	'88'  => "\x1b\$G2\x0f",
+	'89'  => "\x1b\$FX\x0f",
+	'90'  => "\x1b\$FW\x0f",
+	'91'  => "\x1b\$QV\x0f",
+	'92'  => "\x1b\$G'\x0f",
+	'93'  => "[\xd2\xb6\xde\xc8]", // [¥á¥¬¥Í]
+	'94'  => "\x1b\$F*\x0f",
+	'95'  => "\x81\x9c", // ¡ü
+	'96'  => "\x1b\$Gl\x0f",
+	'97'  => "\x1b\$Gl\x0f",
+	'98'  => "\x1b\$Gl\x0f",
+	'99'  => "\x81\x9b", // ¡û
+	'100' => "\x1b\$Gr\x0f",
+	'101' => "\x1b\$Go\x0f",
+	'102' => "\x1b\$G<\x0f",
+	'103' => "\x1b\$GS\x0f",
+	'104' => "\x1b\$FY\x0f",
+	'105' => "\x1b\$E\$\x0f",
+	'106' => "\x1b\$E#\x0f",
+	'107' => "\x1b\$G+\x0f",
+	'108' => "[i\xd3\xb0\xc4\xde]", // [i¥â¡¼¥É]
+	'109' => "[i\xd3\xb0\xc4\xde]", // [i¥â¡¼¥É]
+	'110' => "\x1b\$E#\x0f",
+	'111' => "[\xc4\xde\xba\xd3]", // [¥É¥³¥â]
+	'112' => "[\xc4\xde\xba\xd3\xce\xdf\xb2\xdd\xc4]", // [¥É¥³¥â¥Ý¥¤¥ó¥È]
+	'113' => '\\',
+	'114' => '[FREE]',
+	'115' => "\x1b\$FI\x0f",
+	'116' => "\x1b\$G_\x0f",
+	'117' => null,
+	'118' => '[CL]',
+	'119' => "\x1b\$E4\x0f",
+	'120' => "\x1b\$F2\x0f",
+	'121' => null,
+	'122' => "\x1b\$F1\x0f",
+	'123' => "\x1b\$F0\x0f",
+	'124' => '[Q]',
+	'125' => "\x1b\$F<\x0f",
+	'126' => "\x1b\$F=\x0f",
+	'127' => "\x1b\$F>\x0f",
+	'128' => "\x1b\$F?\x0f",
+	'129' => "\x1b\$F@\x0f",
+	'130' => "\x1b\$FA\x0f",
+	'131' => "\x1b\$FB\x0f",
+	'132' => "\x1b\$FC\x0f",
+	'133' => "\x1b\$FD\x0f",
+	'134' => "\x1b\$FE\x0f",
+	'135' => "\x1b\$Fm\x0f",
+	'136' => "\x1b\$GB\x0f",
+	'137' => "\x1b\$OG\x0f",
+	'138' => "\x1b\$GC\x0f",
+	'139' => "\x1b\$OG\x0f",
+	'140' => "\x1b\$Gw\x0f",
+	'141' => "\x1b\$Gy\x0f",
+	'142' => "\x1b\$Gx\x0f",
+	'143' => "\x1b\$P'\x0f",
+	'144' => "\x1b\$P&\x0f",
+	'145' => "\x1b\$FV\x0f",
+	'146' => "\x1b\$G^\x0f",
+	'147' => "\x1b\$EC\x0f",
+	'148' => null,
+	'149' => "\x1b\$G#\x0f",
+	'150' => "\x1b\$ON\x0f",
+	'151' => "\x1b\$E/\x0f",
+	'152' => "\x1b\$OT\x0f",
+	'153' => "\x1b\$G-\x0f",
+	'154' => "\x1b\$O1\x0f",
+	'155' => "\x1b\$OF\x0f",
+	'156' => "\x1b\$FX\x0f",
+	'157' => "\x1b\$E\\\x0f",
+	'158' => "\x1b\$GA\x0f",
+	'159' => '!?',
+	'160' => '!!',
+	'161' => null,
+	'162' => "\x1b\$OQ\x0f",
+	'163' => "\x1b\$OQ\x0f",
+	'164' => "\x1b\$OP\x0f",
+	'165' => null,
+	'166' => null,
+	'167' => "\x1b\$OD\x0f",
+	'168' => "[\x82\xd3\x82\xad\x82\xeb]", // [¤Õ¤¯¤í]
+	'169' => "[\xcd\xdf\xdd]", // [¥Ú¥ó]
+	'170' => null,
+	'171' => "\x1b\$E?\x0f",
+	'172' => "\x1b\$Pk\x0f",
+	'173' => '[SOON]',
+	'174' => '[ON]',
+	'175' => '[end]',
+	'176' => "\x1b\$GM\x0f",
+	'e1'  => "[i\xb1\xcc\xdf\xd8]", // [i¥¢¥×¥ê]
+	'e2'  => "[i\xb1\xcc\xdf\xd8]", // [i¥¢¥×¥ê]
+	'e3'  => "\x1b\$G&\x0f",
+	'e4'  => "[\x8d\xe0\x95\x7a]", // [ºâÉÛ]
+	'e5'  => "\x1b\$O<\x0f",
+	'e6'  => "[\xbc\xde\xb0\xdd\xbd\xde]", // [¥¸¡¼¥ó¥º]
+	'e7'  => "[\xbd\xc9\xce\xde]", // [¥¹¥Î¥Ü]
+	'e8'  => "\x1b\$OE\x0f",
+	'e9'  => "[\xc4\xde\xb1]", // [¥É¥¢]
+	'e10' => "\x1b\$EO\x0f",
+	'e11' => "\x1b\$G,\x0f",
+	'e12' => "\x1b\$E#\x0f\x1b\$OH\x0f",
+	'e13' => "[\xda\xdd\xc1]", // [¥ì¥ó¥Á]
+	'e14' => "\x1b\$O!\x0f",
+	'e15' => "\x1b\$E.\x0f",
+	'e16' => "\x1b\$GT\x0f",
+	'e17' => "[\x8d\xbb\x8e\x9e\x8c\x76]", // [º½»þ·×]
+	'e18' => "\x1b\$EV\x0f",
+	'e19' => "\x1b\$OX\x0f",
+	'e20' => "[\x98\x72\x8e\x9e\x8c\x76]", // [ÏÓ»þ·×]
+	'e21' => "\x1b\$P#\x0f",
+	'e22' => "\x1b\$P*\x0f",
+	'e23' => "\x1b\$P5\x0f\x1b\$OQ\x0f",
+	'e24' => "\x1b\$E(\x0f",
+	'e25' => "\x1b\$P6\x0f",
+	'e26' => "\x1b\$P.\x0f",
+	'e27' => "\x1b\$E&\x0f",
+	'e28' => "\x1b\$G.\x0f",
+	'e29' => "\x1b\$E%\x0f",
+	'e30' => "\x1b\$P%\x0f",
+	'e31' => "\x1b\$P*\x0f",
+	'e32' => "\x1b\$P&\x0f",
+	'e33' => "\x1b\$P\"\x0f",
+	'e34' => "\x1b\$P1\x0f",
+	'e35' => "\x1b\$P3\x0f",
+	'e36' => '[NG]',
+	'e37' => "[\xb8\xd8\xaf\xcc\xdf]", // [¥¯¥ê¥Ã¥×]
+	'e38' => "\x1b\$Fn\x0f",
+	'e39' => "\x1b\$QW\x0f",
+	'e40' => "\x1b\$E5\x0f",
+	'e41' => "\x1b\$O5\x0f",
+	'e42' => null,
+	'e43' => "\x1b\$Fo\x0f",
+	'e44' => "\x1b\$Fr\x0f",
+	'e45' => "[\x8b\xd6]", // [¶Ø]
+	'e46' => "\x1b\$FK\x0f",
+	'e47' => "[\x8d\x87]", // [¹ç]
+	'e48' => "\x1b\$FJ\x0f",
+	'e49' => "\x81\xcc", // ¢Î
+	'e50' => "\x81\xaa\x81\xab", // ¢¬¢­
+	'e51' => "\x1b\$Ew\x0f",
+	'e52' => "\x1b\$P^\x0f",
+	'e53' => "\x1b\$G[\x0f",
+	'e54' => "\x1b\$E0\x0f",
+	'e55' => "[\xc1\xaa\xd8\xb0]", // [¥Á¥§¥ê¡¼]
+	'e56' => "\x1b\$O\$\x0f",
+	'e57' => "[\xca\xde\xc5\xc5]", // [¥Ð¥Ê¥Ê]
+	'e58' => "\x1b\$Oe\x0f",
+	'e59' => "\x1b\$E0\x0f",
+	'e60' => "\x1b\$E8\x0f",
+	'e61' => "\x1b\$GP\x0f",
+	'e62' => "\x1b\$Ob\x0f",
+	'e63' => "\x1b\$Gf\x0f",
+	'e64' => "\x1b\$O+\x0f",
+	'e65' => "\x1b\$O`\x0f",
+	'e66' => "\x1b\$OY\x0f",
+	'e67' => "[\xb6\xc0\xc2\xd1\xd8]", // [¥«¥¿¥Ä¥à¥ê]
+	'e68' => "\x1b\$QC\x0f",
+	'e69' => "\x1b\$Gu\x0f",
+	'e70' => "\x1b\$G9\x0f",
+	'e71' => "\x1b\$Gv\x0f",
+	'e72' => "\x1b\$P\$\x0f",
+	'e73' => "\x1b\$G:\x0f",
+	'e74' => "\x1b\$E+\x0f",
+	'e75' => "\x1b\$Gd\x0f",
+	'e76' => "\x1b\$E'\x0f"
+);
+?>
Index: /branches/mobile/data/include/mobile_image_map_softbank.csv
===================================================================
--- /branches/mobile/data/include/mobile_image_map_softbank.csv	(revision 11459)
+++ /branches/mobile/data/include/mobile_image_map_softbank.csv	(revision 11459)
@@ -0,0 +1,146 @@
+705P,705P,300000,Y,240,240,jpg,15000,Y
+705SC,705SC,300000,Y,230,230,jpg,15000,Y
+706SC,706SC,300000,Y,230,230,jpg,15000,Y
+707SC,707SC,300000,Y,230,230,jpg,15000,Y
+810SH,810SH,300000,Y,480,480,jpg,15000,Y
+810T,810T,300000,Y,240,240,jpg,15000,Y
+811SH,811SH,300000,Y,480,480,jpg,15000,Y
+811T,811T,300000,Y,240,240,jpg,15000,Y
+910SH,910SH,300000,Y,480,480,jpg,15000,Y
+910T,910T,300000,Y,240,240,jpg,15000,Y
+911SH,911SH,300000,Y,234,232,jpg,15000,Y
+J-D03,J-D03,6000,N,120,120,jpg,5000,N
+J-D04,J-D04,6000,N,120,120,jpg,5000,N
+J-D05,J-D05,6000,N,132,132,jpg,5000,N
+J-D06,J-D06,6000,N,132,132,jpg,5000,N
+J-D07,J-D07,6000,N,128,128,jpg,5000,N
+J-D08,J-D08,6000,N,132,132,jpg,5000,N
+J-D31,J-D31,6000,N,120,120,jpg,5000,N
+J-DN02,J-DN02,6000,N,116,112,png,5000,N
+J-DN02_a,J-DN02_a,6000,N,116,112,png,5000,N
+J-DN02_b,J-DN02_b,6000,N,116,112,png,5000,N
+J-DN03,J-DN03,6000,N,120,120,jpg,5000,N
+J-DN03_a,J-DN03_a,6000,N,120,120,jpg,5000,N
+J-K03,J-K03,6000,N,120,120,jpg,5000,N
+J-K04,J-K04,6000,N,120,120,jpg,5000,N
+J-K05,J-K05,6000,N,120,120,jpg,5000,N
+J-K51,J-K51,12000,Y,128,128,jpg,10000,Y
+J-N03,J-N03,6000,N,120,120,jpg,5000,N
+J-N03II,J-N03B,6000,N,120,120,jpg,5000,N
+J-N04,J-N04,6000,N,120,120,jpg,5000,N
+J-N05,J-N05,6000,N,160,160,jpg,5000,N
+J-N51,J-N51,12000,Y,160,160,jpg,10000,Y
+J-NM01,J-NM01,6000,N,120,120,jpg,5000,N
+J-NM01_a,J-NM01_a,6000,N,120,120,jpg,5000,N
+J-NM01_b,J-NM01_b,6000,N,120,120,jpg,5000,N
+J-NM02,J-NM02,6000,N,120,120,jpg,5000,N
+J-P02,J-P02,6000,N,96,96,png,5000,N
+J-P02_a,J-P02_a,6000,N,96,96,png,5000,N
+J-P03,J-P03,6000,N,96,96,png,5000,N
+J-P51,J-P51,12000,Y,120,120,jpg,10000,Y
+J-PE03,J-PE03,6000,N,120,120,jpg,5000,N
+J-PE03_a,J-PE03_a,6000,N,120,120,jpg,5000,N
+J-PE03_b,J-PE03_b,6000,N,120,120,jpg,5000,N
+J-PE03_c,J-PE03_c,6000,N,120,120,jpg,5000,N
+J-PE03II,J-PE03B,6000,N,120,120,jpg,5000,N
+J-PE03II(J-PE03B_a),J-PE03B_a,6000,N,120,120,jpg,5000,N
+J-SA02,J-SA02,6000,N,96,96,png,5000,N
+J-SA03,J-SA03,6000,N,120,120,jpg,5000,N
+J-SA03_a,J-SA03_a,6000,N,120,120,jpg,5000,N
+J-SA03_b,J-SA03_b,6000,N,120,120,jpg,5000,N
+J-SA04,J-SA04,6000,N,120,120,jpg,5000,N
+J-SA04_a,J-SA04_a,6000,N,120,120,jpg,5000,N
+J-SA05,J-SA05,6000,N,120,120,jpg,5000,N
+J-SA06,J-SA06,6000,N,132,132,jpg,5000,N
+J-SA51,J-SA51,12000,Y,132,132,jpg,10000,Y
+J-SA51_a,J-SA51_a,12000,Y,132,132,jpg,10000,Y
+J-SH02,J-SH02,6000,N,96,96,png,5000,N
+J-SH02_a,J-SH02_a,6000,N,96,96,png,5000,N
+J-SH03,J-SH03,6000,N,96,96,png,5000,N
+J-SH03_a,J-SH03_a,6000,N,96,96,png,5000,N
+J-SH04,J-SH04,6000,N,96,96,jpg,5000,N
+J-SH04_a,J-SH04_a,6000,N,96,96,jpg,5000,N
+J-SH04_b,J-SH04_b,6000,N,96,96,jpg,5000,N
+J-SH04_c,J-SH04_c,6000,N,96,96,jpg,5000,N
+J-SH04B,J-SH04B,6000,N,96,96,jpg,5000,N
+J-SH04B_a,J-SH04B_a,6000,N,96,96,jpg,5000,N
+J-SH05,J-SH05,6000,N,120,120,jpg,5000,N
+J-SH05_a,J-SH05_a,6000,N,120,120,jpg,5000,N
+J-SH06,J-SH06,6000,N,96,96,jpg,5000,N
+J-SH07,J-SH07,6000,N,120,120,jpg,5000,N
+J-SH08,J-SH08,6000,N,120,120,jpg,5000,N
+J-SH09,J-SH09,6000,N,120,120,jpg,5000,N
+J-SH09_a,J-SH09_a,6000,N,120,120,jpg,5000,N
+J-SH010,J-SH10,6000,N,240,240,jpg,5000,N
+J-SH010_a,J-SH10_a,6000,N,240,240,jpg,5000,N
+J-SH51,J-SH51,12000,Y,120,120,jpg,10000,Y
+J-SH51_a,J-SH51_a,12000,Y,120,120,jpg,10000,Y
+J-SH52,J-SH52,12000,Y,120,120,jpg,10000,Y
+J-SH53,J-SH53,12000,Y,240,240,jpg,10000,Y
+J-SH53_a,J-SH53_a,12000,Y,240,240,jpg,10000,Y
+J-T04,J-T04,6000,N,96,96,png,5000,N
+J-T04_a,J-T04_a,6000,N,96,96,png,5000,N
+J-T05,J-T05,6000,N,120,120,jpg,5000,N
+J-T06,J-T06,6000,N,120,120,jpg,5000,N
+J-T06_a,J-T06_a,6000,N,120,120,jpg,5000,N
+J-T07,J-T07,6000,N,144,144,jpg,5000,N
+J-T08,J-T08,6000,N,222,222,jpg,5000,N
+J-T09,J-T09,6000,N,144,144,jpg,5000,N
+J-T010,J-T10,6000,N,240,240,jpg,5000,N
+J-T51,J-T51,12000,Y,144,144,jpg,10000,Y
+V702sMO,MOT-C980,300000,Y,176,176,jpg,15000,Y
+V702MO,MOT-V980,300000,Y,176,176,jpg,15000,Y
+V102D,V102D,6000,N,128,128,jpg,5000,N
+V201SH,V201SH,6000,N,240,240,jpg,5000,N
+V301D,V301D,6000,N,132,132,jpg,5000,N
+V301D_n,V301D_n,6000,N,132,132,jpg,5000,N
+V301SH,V301SH,6000,N,240,240,jpg,5000,N
+V301T,V301T,6000,N,222,216,jpg,5000,N
+V302SH,V302SH,6000,N,240,240,jpg,5000,N
+V302T,V302T,6000,N,144,144,jpg,5000,N
+V303T(KOTO),V303T,6000,N,222,216,jpg,5000,N
+V304T,V304T,6000,N,221,216,jpg,5000,N
+V401D,V401D,6000,N,240,240,jpg,5000,N
+V401SA,V401SA,6000,N,240,240,jpg,5000,N
+V401SH,V401SH,6000,N,240,240,jpg,5000,N
+V401T,V401T,6000,N,240,240,jpg,5000,N
+V402SH,V402SH,6000,N,240,240,jpg,5000,N
+V403SH,V403SH,6000,N,240,240,jpg,5000,N
+V501SH,V501SH,30000,Y,240,240,jpg,10000,Y
+V501T,V501T,30000,Y,240,240,jpg,10000,Y
+V502T,V502T,30000,Y,240,240,jpg,10000,Y
+V601N,V601N,12000,Y,160,160,jpg,10000,Y
+V601SH,V601SH,12000,Y,240,240,jpg,10000,Y
+V601T,V601T,30000,Y,240,240,jpg,10000,Y
+V602SH,V602SH,30000,Y,240,240,jpg,10000,Y
+V602T,V602T,30000,Y,240,240,jpg,10000,Y
+V603SH,V603SH,30000,Y,240,240,jpg,10000,Y
+V603T,V603T,30000,Y,240,240,jpg,10000,Y
+V604SH,V604SH,30000,Y,240,240,jpg,10000,Y
+V604T,V604T,30000,Y,240,240,jpg,10000,Y
+V702NK,V702NK,300000,Y,176,176,jpg,15000,Y
+V702NKII(V702NK2),V702NK2,300000,Y,176,176,jpg,15000,Y
+V703N,V703N,300000,Y,240,240,jpg,15000,Y
+V703SH,V703SH,300000,Y,240,240,jpg,15000,Y
+V703SHf,V703SHf,300000,Y,240,240,jpg,15000,Y
+V705SH,V705SH,300000,Y,240,240,jpg,15000,Y
+V705T,V705T,300000,Y,240,240,jpg,15000,Y
+V801SA,V801SA,200000,Y,240,240,jpg,18000,Y
+V801SA_a,V801SA_a,200000,Y,240,240,jpg,18000,Y
+V801SH,V801SH,200000,Y,240,240,jpg,18000,Y
+V802N,V802N,300000,Y,240,240,jpg,15000,Y
+V802SE,V802SE,300000,Y,176,176,jpg,15000,Y
+V802SH,V802SH,300000,Y,240,240,jpg,15000,Y
+V803T,V803T,300000,Y,240,240,jpg,15000,Y
+V804N,V804N,300000,Y,240,240,jpg,15000,Y
+V804NK,V804NK,300000,Y,240,240,jpg,15000,Y
+V804SH,V804SH,300000,Y,240,240,jpg,15000,Y
+V804SS,V804SS,300000,Y,240,240,jpg,15000,Y
+V902SH,V902SH,300000,Y,240,240,jpg,15000,Y
+V902T,V902T,300000,Y,240,240,jpg,15000,Y
+V903SH,V903SH,300000,Y,240,240,jpg,15000,Y
+V903T,V903T,300000,Y,240,240,jpg,15000,Y
+V904SH,V904SH,300000,Y,240,240,jpg,15000,Y
+V904T,V904T,300000,Y,240,240,jpg,15000,Y
+V905SH,V905SH,300000,Y,240,240,jpg,15000,Y
+*,*,300000,Y,240,240,jpg,15000,Y
Index: /branches/mobile/data/include/mobile_emoji_map_ezweb.inc
===================================================================
--- /branches/mobile/data/include/mobile_emoji_map_ezweb.inc	(revision 11398)
+++ /branches/mobile/data/include/mobile_emoji_map_ezweb.inc	(revision 11398)
@@ -0,0 +1,260 @@
+<?php
+/**
+ * EZwebÍÑ³¨Ê¸»ú¥³¡¼¥É (Shift JIS)
+ */
+
+return array(
+	'1'   => '<img localsrc="44">',
+	'2'   => '<img localsrc="107">',
+	'3'   => '<img localsrc="95">',
+	'4'   => '<img localsrc="191">',
+	'5'   => '<img localsrc="16">',
+	'6'   => '<img localsrc="190">',
+	'7'   => '<img localsrc="305">',
+	'8'   => '<img localsrc="481">',
+	'9'   => '<img localsrc="192">',
+	'10'  => '<img localsrc="193">',
+	'11'  => '<img localsrc="194">',
+	'12'  => '<img localsrc="195">',
+	'13'  => '<img localsrc="196">',
+	'14'  => '<img localsrc="197">',
+	'15'  => '<img localsrc="198">',
+	'16'  => '<img localsrc="199">',
+	'17'  => '<img localsrc="200">',
+	'18'  => '<img localsrc="201">',
+	'19'  => '<img localsrc="202">',
+	'20'  => '<img localsrc="203">',
+	'21'  => null,
+	'22'  => '<img localsrc="45">',
+	'23'  => '<img localsrc="306">',
+	'24'  => '<img localsrc="220">',
+	'25'  => '<img localsrc="219">',
+	'26'  => '<img localsrc="421">',
+	'27'  => '<img localsrc="307">',
+	'28'  => '<img localsrc="222">',
+	'29'  => '<img localsrc="308">',
+	'30'  => '<img localsrc="172">',
+	'31'  => '<img localsrc="341">',
+	'32'  => '<img localsrc="217">',
+	'33'  => '<img localsrc="125">',
+	'34'  => '<img localsrc="125">',
+	'35'  => '<img localsrc="216">',
+	'36'  => '<img localsrc="379">',
+	'37'  => '<img localsrc="168">',
+	'38'  => '<img localsrc="112">',
+	'39'  => '<img localsrc="156">',
+	'40'  => '<img localsrc="375">',
+	'41'  => '<img localsrc="376">',
+	'42'  => '<img localsrc="212">',
+	'43'  => '<img localsrc="205">',
+	'44'  => '<img localsrc="378">',
+	'45'  => '<img localsrc="206">',
+	'46'  => '<img localsrc="213">',
+	'47'  => '<img localsrc="208">',
+	'48'  => '<img localsrc="99">',
+	'49'  => '<img localsrc="207">',
+	'50'  => '<img localsrc="146">',
+	'51'  => '<img localsrc="93">',
+	'52'  => '<img localsrc="52">',
+	'53'  => '<img localsrc="65">',
+	'54'  => '<img localsrc="245">',
+	'55'  => '<img localsrc="124">',
+	'56'  => '<img localsrc="104">',
+	'57'  => '<img localsrc="289">',
+	'58'  => '<img localsrc="110">',
+	'59'  => '<img localsrc="70">',
+	'60'  => null,
+	'61'  => '<img localsrc="294">',
+	'62'  => '<img localsrc="309">',
+	'63'  => '<img localsrc="494">',
+	'64'  => '<img localsrc="311">',
+	'65'  => '<img localsrc="106">',
+	'66'  => '<img localsrc="176">',
+	'67'  => '<img localsrc="177">',
+	'68'  => '<img localsrc="94">',
+	'69'  => '<img localsrc="83">',
+	'70'  => '<img localsrc="122">',
+	'71'  => '<img localsrc="312">',
+	'72'  => '<img localsrc="144">',
+	'73'  => '<img localsrc="313">',
+	'74'  => '<img localsrc="85">',
+	'75'  => '<img localsrc="161">',
+	'76'  => '<img localsrc="395">',
+	'77'  => '<img localsrc="288">',
+	'78'  => '<img localsrc="232">',
+	'79'  => '<img localsrc="300">',
+	'80'  => '<img localsrc="414">',
+	'81'  => '<img localsrc="314">',
+	'82'  => '<img localsrc="315">',
+	'83'  => '<img localsrc="316">',
+	'84'  => '<img localsrc="317">',
+	'85'  => '<img localsrc="318">',
+	'86'  => '<img localsrc="817">',
+	'87'  => '<img localsrc="319">',
+	'88'  => '<img localsrc="320">',
+	'89'  => '<img localsrc="43">',
+	'90'  => '<img localsrc="42">',
+	'91'  => '<img localsrc="728">',
+	'92'  => '<img localsrc="729">',
+	'93'  => '<img localsrc="116">',
+	'94'  => '<img localsrc="178">',
+	'95'  => '<img localsrc="321">',
+	'96'  => '<img localsrc="322">',
+	'97'  => '<img localsrc="323">',
+	'98'  => '<img localsrc="15">',
+	'99'  => "\x81\x9b", // ¡û
+	'100' => '<img localsrc="134">',
+	'101' => '<img localsrc="251">',
+	'102' => '<img localsrc="169">',
+	'103' => '<img localsrc="234">',
+	'104' => '<img localsrc="71">',
+	'105' => '<img localsrc="513">',
+	'106' => '<img localsrc="784">',
+	'107' => '<img localsrc="166">',
+	'108' => "[i\xd3\xb0\xc4\xde]", // [i¥â¡¼¥É]
+	'109' => "[i\xd3\xb0\xc4\xde]", // [i¥â¡¼¥É]
+	'110' => '<img localsrc="108">',
+	'111' => "[\xc4\xde\xba\xd3]", // [¥É¥³¥â]
+	'112' => "[\xc4\xde\xba\xd3\xce\xdf\xb2\xdd\xc4]", // [¥É¥³¥â¥Ý¥¤¥ó¥È]
+	'113' => '<img localsrc="109">',
+	'114' => '<img localsrc="299">',
+	'115' => '<img localsrc="385">',
+	'116' => '<img localsrc="120">',
+	'117' => '<img localsrc="118">',
+	'118' => '<img localsrc="324">',
+	'119' => '<img localsrc="119">',
+	'120' => '<img localsrc="334">',
+	'121' => '<img localsrc="730">',
+	'122' => "[\xcc\xd8\xb0\xc0\xde\xb2\xd4\xd9]", // [¥Õ¥ê¡¼¥À¥¤¥ä¥ë]
+	'123' => '<img localsrc="818">',
+	'124' => '<img localsrc="4">',
+	'125' => '<img localsrc="180">',
+	'126' => '<img localsrc="181">',
+	'127' => '<img localsrc="182">',
+	'128' => '<img localsrc="183">',
+	'129' => '<img localsrc="184">',
+	'130' => '<img localsrc="185">',
+	'131' => '<img localsrc="186">',
+	'132' => '<img localsrc="187">',
+	'133' => '<img localsrc="188">',
+	'134' => '<img localsrc="325">',
+	'135' => '<img localsrc="326">',
+	'136' => '<img localsrc="51">',
+	'137' => '<img localsrc="803">',
+	'138' => '<img localsrc="265">',
+	'139' => '<img localsrc="266">',
+	'140' => '<img localsrc="257">',
+	'141' => '<img localsrc="258">',
+	'142' => '<img localsrc="441">',
+	'143' => '<img localsrc="444">',
+	'144' => '<img localsrc="327">',
+	'145' => '<img localsrc="731">',
+	'146' => '<img localsrc="343">',
+	'147' => '<img localsrc="224">',
+	'148' => null,
+	'149' => '<img localsrc="273">',
+	'150' => '<img localsrc="420">',
+	'151' => '<img localsrc="77">',
+	'152' => '<img localsrc="262">',
+	'153' => '<img localsrc="281">',
+	'154' => '<img localsrc="268">',
+	'155' => '<img localsrc="291">',
+	'156' => '<img localsrc="732">',
+	'157' => '<img localsrc="261">',
+	'158' => '<img localsrc="2">',
+	'159' => '<img localsrc="733">',
+	'160' => '<img localsrc="734">',
+	'161' => '<img localsrc="329">',
+	'162' => '<img localsrc="330">',
+	'163' => '<img localsrc="263">',
+	'164' => '<img localsrc="282">',
+	'165' => null,
+	'166' => '<img localsrc="735">',
+	'167' => '<img localsrc="226">',
+	'168' => "[\x82\xd3\x82\xad\x82\xeb]", // [¤Õ¤¯¤í]
+	'169' => '<img localsrc="508">',
+	'170' => null,
+	'171' => "[\x82\xa2\x82\xb7]", // [¤¤¤¹]
+	'172' => '<img localsrc="490">',
+	'173' => '[SOON]',
+	'174' => '[ON]',
+	'175' => '[end]',
+	'176' => '<img localsrc="46">',
+	'e1'  => "[i\xb1\xcc\xdf\xd8]", // [i¥¢¥×¥ê]
+	'e2'  => "[i\xb1\xcc\xdf\xd8]", // [i¥¢¥×¥ê]
+	'e3'  => '<img localsrc="335">',
+	'e4'  => '<img localsrc="290">',
+	'e5'  => '<img localsrc="295">',
+	'e6'  => '<img localsrc="805">',
+	'e7'  => '<img localsrc="221">',
+	'e8'  => '<img localsrc="48">',
+	'e9'  => "[\xc4\xde\xb1]", // [¥É¥¢]
+	'e10' => '<img localsrc="233">',
+	'e11' => '<img localsrc="337">',
+	'e12' => '<img localsrc="806">',
+	'e13' => '<img localsrc="152">',
+	'e14' => '<img localsrc="149">',
+	'e15' => '<img localsrc="354">',
+	'e16' => '<img localsrc="72">',
+	'e17' => '<img localsrc="58">',
+	'e18' => '<img localsrc="215">',
+	'e19' => '<img localsrc="423">',
+	'e20' => '<img localsrc="25">',
+	'e21' => '<img localsrc="441">',
+	'e22' => '<img localsrc="446">',
+	'e23' => '<img localsrc="257"><img localsrc="330">',
+	'e24' => '<img localsrc="351">',
+	'e25' => '<img localsrc="779">',
+	'e26' => '<img localsrc="450">',
+	'e27' => '<img localsrc="349">',
+	'e28' => '<img localsrc="287">',
+	'e29' => '<img localsrc="264">',
+	'e30' => '<img localsrc="348">',
+	'e31' => '<img localsrc="446">',
+	'e32' => '<img localsrc="443">',
+	'e33' => '<img localsrc="440">',
+	'e34' => '<img localsrc="259">',
+	'e35' => '<img localsrc="791">',
+	'e36' => '[NG]',
+	'e37' => '<img localsrc="143">',
+	'e38' => '<img localsrc="81">',
+	'e39' => '<img localsrc="54">',
+	'e40' => '<img localsrc="218">',
+	'e41' => '<img localsrc="279">',
+	'e42' => '<img localsrc="807">',
+	'e43' => '<img localsrc="82">',
+	'e44' => '<img localsrc="1">',
+	'e45' => "[\x8b\xd6]", // [¶Ø]
+	'e46' => '<img localsrc="387">',
+	'e47' => "[\x8d\x87]", // [¹ç]
+	'e48' => '<img localsrc="386">',
+	'e49' => '<img localsrc="808">',
+	'e50' => '<img localsrc="809">',
+	'e51' => '<img localsrc="377">',
+	'e52' => '<img localsrc="810">',
+	'e53' => '<img localsrc="342">',
+	'e54' => '<img localsrc="53">',
+	'e55' => '<img localsrc="241">',
+	'e56' => '<img localsrc="113">',
+	'e57' => '<img localsrc="739">',
+	'e58' => '<img localsrc="434">',
+	'e59' => '<img localsrc="811">',
+	'e60' => '<img localsrc="133">',
+	'e61' => '<img localsrc="235">',
+	'e62' => '<img localsrc="244">',
+	'e63' => '<img localsrc="239">',
+	'e64' => '<img localsrc="400">',
+	'e65' => '<img localsrc="333">',
+	'e66' => '<img localsrc="424">',
+	'e67' => '<img localsrc="812">',
+	'e68' => '<img localsrc="78">',
+	'e69' => '<img localsrc="252">',
+	'e70' => '<img localsrc="203">',
+	'e71' => '<img localsrc="454">',
+	'e72' => '<img localsrc="814">',
+	'e73' => '<img localsrc="248">',
+	'e74' => '<img localsrc="254">',
+	'e75' => '<img localsrc="12">',
+	'e76' => '<img localsrc="350">'
+);
+?>
Index: /branches/mobile/data/include/mobile_image_map_ezweb.csv
===================================================================
--- /branches/mobile/data/include/mobile_image_map_ezweb.csv	(revision 11459)
+++ /branches/mobile/data/include/mobile_image_map_ezweb.csv	(revision 11459)
@@ -0,0 +1,194 @@
+C303CA,CA11,1400,Y,120,120,bmp,1300,N
+C311CA,CA12,1400,Y,120,120,bmp,1300,N
+C409CA,CA13,7500,Y,120,120,png,6000,Y
+C452CA,CA14,7500,Y,120,120,png,6000,Y
+A3012CA,CA21,9000,Y,125,120,jpg,8000,Y
+A5302CA,CA22,9000,Y,125,120,jpg,20000,Y
+A5401CA A5401CA II(A5401CA),CA23,9000,Y,123,120,jpg,20000,Y
+A5403CA,CA24,9000,Y,230,224,jpg,20000,Y
+A5406CA,CA25,9000,Y,230,224,jpg,20000,Y
+A5407CA,CA26,9000,Y,230,224,jpg,20000,Y
+A5512CA,CA27,9000,Y,230,224,jpg,20000,Y
+A5513CA(G'zOne TYPE-R),CA28,9000,Y,230,224,jpg,20000,Y
+W21CA W21CA II(W21CA),CA31,9000,Y,123,120,jpg,20000,Y
+W31CA,CA32,9000,Y,230,224,jpg,20000,Y
+W41CA,CA33,9000,Y,230,224,jpg,20000,Y
+W42CA,CA34,9000,Y,232,232,jpg,20000,Y
+W43CA,CA35,9000,Y,232,232,jpg,20000,Y
+C202DE,DN01,1400,Y,108,104,bmp,1300,N
+C402DE,DN11,7500,Y,120,120,png,6000,Y
+C201H(C201H_A),HI01,1400,Y,120,120,bmp,1300,N
+C201H(C201H_A),HI02,1400,Y,120,120,bmp,1300,N
+C302H,HI11,1400,Y,120,120,bmp,1300,N
+C309H,HI12,7500,Y,120,120,png,6000,N
+C407H,HI13,7500,Y,120,120,png,6000,Y
+C451H,HI14,7500,Y,120,120,png,6000,Y
+C3001H,HI21,9000,Y,120,120,jpg,8000,Y
+A5303H,HI23,9000,Y,125,120,jpg,20000,Y
+A5303H II(A5303H2),HI24,9000,Y,125,120,jpg,20000,Y
+W11H,HI31,9000,Y,233,232,jpg,20000,Y
+W21H,HI32,9000,Y,123,120,jpg,20000,Y
+W22H,HI33,9000,Y,230,224,jpg,20000,Y
+W31H(PENCK),HI34,9000,Y,230,224,jpg,20000,Y
+W32H,HI35,9000,Y,230,224,jpg,20000,Y
+W41H,HI36,9000,Y,230,224,jpg,20000,Y
+W42H,HI37,9000,Y,232,232,jpg,20000,Y
+W43H,HI38,9000,Y,232,232,jpg,20000,Y
+C307K,KC11,1400,Y,121,120,bmp,1300,N
+C313K,KC12,1400,Y,120,120,png,1300,N
+C414K,KC13,7500,Y,120,120,jpg,6000,Y
+A1012K A1012K II(A1012K),KC14,7500,Y,120,120,jpg,6000,Y
+A1013K,KC15,7500,Y,120,120,jpg,6000,Y
+C3002K,KC21,9000,Y,128,128,jpg,7000,Y
+A5305K,KC22,9000,Y,125,120,jpg,20000,Y
+A1401K,KC23,9000,Y,126,120,jpg,20000,Y
+A5502K(A5502K_A),KC24,9000,Y,234,232,jpg,20000,Y
+A5502K(A5502K_B),KC25,9000,Y,234,232,jpg,20000,Y
+A1403KB01K(A1403K),KC26,9000,Y,234,232,jpg,20000,Y
+A5515K,KC27,9000,Y,234,232,jpg,20000,Y
+A5521K,KC28,9000,Y,234,232,jpg,20000,Y
+W11K,KC31,9000,Y,233,232,jpg,20000,Y
+W21K,KC32,9000,Y,234,232,jpg,20000,Y
+W31K W31K II(W31K),KC33,9000,Y,234,232,jpg,20000,Y
+W32K,KC34,9000,Y,234,232,jpg,20000,Y
+W41K,KC35,9000,Y,232,232,jpg,20000,Y
+W42K,KC36,9000,Y,232,232,jpg,20000,Y
+W43K,KC37,9000,Y,232,232,jpg,20000,Y
+W44K,KC38,9000,Y,232,232,jpg,20000,Y
+D303K,KCC1,1400121,120,bmp,1300,N
+D304K,KCC2,1400121,120,bmp,1300,N
+702G,KCI1,1400121,120,bmp,1300,N
+703G,KCI2,1400121,120,bmp,1300,N
+TK01,KCT1,1400,Y,121,120,bmp,1300,Y
+TK02,KCT2,1400,Y,121,120,bmp,1300,Y
+TK0K,KCT3,1400,Y,121,120,bmp,1300,Y
+TK03,KCT4,7500,Y,96,96,png,6000,Y
+TK04,KCT5,7500,Y,96,96,png,6000,Y
+TK05,KCT6,7500,Y,96,96,png,6000,Y
+TK11,KCT7,7500,Y,96,96,png,6000,Y
+TK12,KCT8,7500,Y,120,120,png,6000,Y
+TK21,KCT9,7500,Y,120,120,jpg,6000,Y
+TK22,KCTA,7500,Y,120,120,jpg,6000,Y
+TK23,KCTB,7500,Y,120,120,png,6000,Y
+TK31,KCTC,7500,Y,120,120,jpg,6000,Y
+TK40,KCTD,7500,Y,120,120,jpg,6000,Y
+TK51,KCTE,7500,Y,120,120,jpg,6000,Y
+TK41,KCU1,9000,Y,114,112,jpg,8000,Y
+C308P(C308P_A),MA11,1400,Y,122,120,bmp,1300,N
+C308P(C308P_B),MA12,1400,Y,122,120,bmp,1300,N
+C408P,MA13,7500,Y,115,112,png,6000,Y
+C3003P,MA21,9000,Y,132,132,jpg,8000,Y
+D305P(D305P_A),MAC1,1400122,120,bmp,1300,N
+D305P(D305P_B),MAC2,1400122,120,bmp,1300,N
+704G(704G_A),MAI1,1400122,120,bmp,1300,N
+D704G(704G_B),MAI2,1400122,120,bmp,1300,N
+TP01(TP01_A),MAT1,1400,Y,122,120,bmp,1300,Y
+TP01(TP01_B),MAT2,1400,Y,122,120,bmp,1300,Y
+TP11,MAT3,7500,Y,96,96,png,6000,Y
+TD11,MIT1,7500,Y,120,120,png,6000,Y
+A1405PT,PT21,9000,Y,240,240,jpg,20000,Y
+A1406PT,PT22,9000,Y,240,240,jpg,20000,Y
+A3011SA,SA21,9000,Y,126,120,jpg,8000,Y
+A3015SA,SA22,9000,Y,126,120,jpg,8000,Y
+A1302SA,SA24,9000,Y,132,132,jpg,20000,Y
+A1303SA,SA25,9000,Y,132,132,jpg,20000,Y
+A5503SA,SA26,9000,Y,225,224,jpg,20000,Y
+A5505SA,SA27,9000,Y,225,224,jpg,20000,Y
+A1305SA,SA28,9000,Y,124,120,jpg,20000,Y
+A5522SA,SA29,9000,Y,235,232,jpg,20000,Y
+W21SA,SA31,9000,Y,225,224,jpg,20000,Y
+W22SA,SA32,9000,Y,230,224,jpg,20000,Y
+W31SA W31SA II(W31SA),SA33,9000,Y,230,224,jpg,20000,Y
+W32SA,SA34,9000,Y,228,224,jpg,20000,Y
+W33SA,SA35,9000,Y,228,224,jpg,20000,Y
+W41SA,SA36,9000,Y,228,224,jpg,20000,Y
+E02SA,SA37,9000,Y,228 ,224 ,jpg,20000,Y
+W43SA,SA38,9000,Y,228,224,jpg,20000,Y
+W41SH,SH31,9000,Y,229,224,jpg,20000,Y
+C305S,SN11,1400,Y,120,120,bmp,1300,N
+C404S(C404S_A),SN12,7500,Y,120,120,png,6000,Y
+C406S,SN13,7500,Y,120,120,png,6000,Y
+C404S(C404S_B),SN14,7500,Y,120,120,png,6000,Y
+C413S(C413S_B),SN15,7500,Y,120,120,png,6000,Y
+C413S(C413S_A),SN16,7500,Y,120,120,png,6000,Y
+C1002S,SN17,7500,Y,120,120,png,6000,Y
+A3014S,SN21,9000,Y,120,120,jpg,8000,Y
+A1101S,SN22,9000,Y,120,120,jpg,8000,Y
+A1301S,SN23,9000,Y,120,120,jpg,20000,Y
+A5402S,SN24,9000,Y,120,120,jpg,20000,Y
+A5404S,SN25,9000,Y,240,240,jpg,20000,Y
+A1402S,SN26,9000,Y,228,224,jpg,20000,Y
+A1402S II(A1402S2_A),SN27,9000,Y,228,224,jpg,20000,Y
+A1402S II ¥«¥á¥éÌµ¤·(A1402S2_B),SN28,9000,Y,228,224,jpg,20000,Y
+A1404S A1404S II(A1404S),SN29,9000,Y,228,224,jpg,20000,Y
+W21S,SN31,9000,Y,228,224,jpg,20000,Y
+W31S,SN32,9000,Y,228,224,jpg,20000,Y
+W32S,SN33,9000,Y,228,224,jpg,20000,Y
+W41S,SN34,9000,Y,228,224,jpg,20000,Y
+W32S,SN35,9000,Y,228,224,jpg,20000,Y
+W42S,SN36,9000,Y,228,224,jpg,20000,Y
+W43S,SN37,9000,Y,228,224,jpg,20000,Y
+D306S,SNC1,1400120,120,bmp,1300,N
+705G,SNI1,1400120,120,bmp,1300,N
+C403ST,ST11,7500,Y,120,120,png,6000,Y
+C411ST,ST12,7500,Y,120,120,png,6000,Y
+A1011ST,ST13,7500,Y,120,120,jpg,6000,Y
+A1014ST,ST14,7500,Y,120,120,jpg,6000,Y
+A5306ST,ST21,9000,Y,125,120,jpg,20000,Y
+A5307ST(INFOBAR),ST22,9000,Y,125,120,jpg,20000,Y
+A5405SA,ST23,9000,Y,127,120,jpg,20000,Y
+A5507SA,ST24,9000,Y,235,232,jpg,20000,Y
+A5508SA(talby),ST25,9000,Y,235,232,jpg,20000,Y
+A5510SA(Sweets),ST26,9000,Y,235,232,jpg,20000,Y
+A5514SA,ST27,9000,Y,235,232,jpg,20000,Y
+A5518SA,ST28,9000,Y,235,232,jpg,20000,Y
+A5519SA(Sweets pure),ST29,9000,Y,235,232,jpg,20000,Y
+A5520SA,ST2A,9000,Y,235,232,jpg,20000,Y
+W42SA,ST31,9000,Y,235,232,jpg,20000,Y
+C304SA,SY11,1400,Y,128,128,bmp,1300,N
+C401SA,SY12,7500,Y,120,120,png,6000,Y
+C405SA,SY13,1400,Y,120,120,png,1300,Y
+C412SA,SY14,7500,Y,120,120,png,6000,Y
+C1001SA,SY15,7500,Y,120,120,png,6000,Y
+D301SA,SYC1,1400128,128,bmp,1300,N
+TS01,SYT1,1400,Y,128,128,bmp,1300,Y
+TS02,SYT2,7500,Y,96,96,png,6000,Y
+TS11,SYT3,7500,Y,120,120,jpg,6000,Y
+TS31,SYT4,7500,Y,120,120,jpg,6000,Y
+TS41,SYT5,7500,Y,132,132,jpg,6000,Y
+C301T,TS11,1400,Y,120,120,bmp,1300,N
+C310T,TS12,7500,Y,96,96,png,6000,N
+C410T,TS13,7500,Y,96,96,png,6000,Y
+C415T,TS14,7500,Y,96,96,png,6000,Y
+C5001T,TS21,9000,Y,144,144,jpg,20000,Y
+A3013T,TS22,9000,Y,144,144,jpg,7740,Y
+A5301T,TS23,9000,Y,144,144,jpg,20000,Y
+A5304T,TS24,9000,Y,144,144,jpg,20000,Y
+A1304T A1304T II(A1304T),TS25,9000,Y,144,144,jpg,20000,Y
+A5501T,TS26,9000,Y,240,240,jpg,20000,Y
+A5504T,TS27,9000,Y,229,224,jpg,20000,Y
+A5506T,TS28,9000,Y,229,224,jpg,20000,Y
+A5509T,TS29,9000,Y,229,224,jpg,20000,Y
+A5511T,TS2A,9000,Y,229,224,jpg,20000,Y
+A5516T,TS2B,9000,Y,229,224,jpg,20000,Y
+A5517T,TS2C,9000,Y,229,224,jpg,20000,Y
+W21T,TS31,9000,Y,229,224,jpg,20000,Y
+W31T,TS32,9000,Y,229,224,jpg,20000,Y
+W32T,TS33,9000,Y,229,224,jpg,20000,Y
+W41T,TS34,9000,Y,229,224,jpg,20000,Y
+W42T(neon),TS35,9000,Y,229,224,jpg,20000,Y
+W43T,TS36,9000,Y,229,224,jpg,20000,Y
+W44T,TS37,9000,Y,229,224,jpg,20000,Y
+W45T,TS38,9000,Y,229,224,jpg,20000,Y
+D302T,TSC1,1400120,120,bmp,1300,N
+701G,TSI1,1400120,120,bmp,1300,N
+TT01,TST1,1400,Y,120,120,bmp,1300,Y
+TT02,TST2,1400,Y,120,120,bmp,1300,Y
+TT03,TST3,7500,Y,120,120,png,6000,Y
+TT11,TST4,7500,Y,120,120,jpg,6000,Y
+TT21,TST5,7500,Y,140,140,jpg,6000,Y
+TT22,TST6,7500,Y,140,140,jpg,6000,Y
+TT31,TST7,7500,Y,140,140,jpg,6000,Y
+TT32,TST8,7500,Y,140,140,jpg,6000,Y
+TT51,TST9,7500,Y,120,120,jpg,6000,Y
+*,*,9000,Y,229,224,jpg,20000,Y
Index: /branches/mobile/data/include/php_ini.inc
===================================================================
--- /branches/mobile/data/include/php_ini.inc	(revision 8537)
+++ /branches/mobile/data/include/php_ini.inc	(revision 8537)
@@ -0,0 +1,20 @@
+<?php
+
+ini_set("mbstring.language", "Japanese");
+ini_set("mbstring.http_input", CHAR_CODE);
+ini_set("mbstring.http_output", CHAR_CODE);
+ini_set("auto_detect_line_endings", 1);
+ini_set("default_charset", CHAR_CODE);
+ini_set("mbstring.internal_encoding", CHAR_CODE);
+ini_set("mbstring.detect_order", "auto");
+ini_set("mbstring.substitute_character", "none");
+
+// °Ü¹Ô¤ÏINI_SET¤ÇÊÑ¹¹²ÄÇ½¤«¤É¤¦¤«¤¬ÈùÌ¯¤Ê¤Î¤Ç .htaccess ¤ÇÊÑ¹¹¤¹¤ë
+/*
+ini_set("mbstring.language", "Japanese");
+ini_set("output_handler", "mb_output_handler");
+ini_set("mbstring.encoding_translation", 1);
+ini_set("magic_quotes_gpc", 0);
+*/
+
+?>
Index: /branches/mobile/data/include/mobile.inc
===================================================================
--- /branches/mobile/data/include/mobile.inc	(revision 11457)
+++ /branches/mobile/data/include/mobile.inc	(revision 11457)
@@ -0,0 +1,414 @@
+<?php
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥È¶¦Í­´Ø¿ô¥Õ¥¡¥¤¥ë
+ */
+
+require_once DATA_PATH . 'module/Net/URL.php';
+require_once DATA_PATH . 'class/SC_DbConn.php';
+require_once DATA_PATH . 'class/SC_Query.php';
+
+/**
+ * EC-CUBE ¤¬¥µ¥Ý¡¼¥È¤¹¤ë·ÈÂÓÃ¼Ëö¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+ * ÈóÂÐ±þÃ¼Ëö¤Î¾ì¹ç¤Ï unsupported/index.php ¤Ø¥ê¥À¥¤¥ì¥¯¥È¤¹¤ë¡£
+ *
+ * @return void
+ */
+function lfMobileCheckCompatibility() {
+	if (!GC_MobileUserAgent::isSupported()) {
+		header('Location: ' . URL_DIR . 'unsupported/index.php');
+		exit;
+	}
+}
+
+/**
+ * ÆþÎÏ¥Ç¡¼¥¿¤òÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ËÊÑ´¹¤·¡¢³¨Ê¸»ú¤ò½üµî¤¹¤ë¡£
+ *
+ * @param string &$value ÆþÎÏ¥Ç¡¼¥¿¤Ø¤Î»²¾È
+ * @return void
+ */
+function lfMobileConvertInputValue(&$value) {
+	// Shift JIS ¤«¤éÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ËÊÑ´¹¤¹¤ë¡£
+	// SoftBank °Ê³°¤Î³¨Ê¸»ú¤Ï³°»úÎÎ°è¤Ë´Þ¤Þ¤ì¤ë¤¿¤á¡¢¤³¤ÎÃÊ³¬¤Ç½üµî¤µ¤ì¤ë¡£
+	$value = mb_convert_encoding($value, CHAR_CODE, 'SJIS');
+
+	// SoftBank ¤Î³¨Ê¸»ú¤ò½üµî¤¹¤ë¡£
+	$value = preg_replace('/\\x1b\\$[^\\x0f]*\\x0f/', '', $value);
+}
+
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥ÈÍÑ¤ÎÆþÎÏ¤Î½é´ü½èÍý¤ò¹Ô¤¦¡£
+ *
+ * @return void
+ */
+function lfMobileInitInput() {
+	array_walk($_GET, 'lfMobileConvertInputValue');
+	array_walk($_POST, 'lfMobileConvertInputValue');
+	array_walk($_REQUEST, 'lfMobileConvertInputValue');
+}
+
+/**
+ * dtb_mobile_ext_session_id ¥Æ¡¼¥Ö¥ë¤ò¸¡º÷¤·¤Æ¥»¥Ã¥·¥ç¥óID¤ò¼èÆÀ¤¹¤ë¡£
+ *
+ * @return string|null ¼èÆÀ¤·¤¿¥»¥Ã¥·¥ç¥óID¤òÊÖ¤¹¡£
+ *                     ¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï null ¤òÊÖ¤¹¡£
+ */
+function lfMobileGetExtSessionId() {
+	if (!preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['SCRIPT_NAME'], $matches)) {
+		return null;
+	}
+
+	$url = $matches[1];
+	$time = date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME);
+	$objQuery = new SC_Query;
+
+	foreach ($_REQUEST as $key => $value) {
+		$session_id = $objQuery->get('dtb_mobile_ext_session_id', 'session_id',
+		                             'param_key = ? AND param_value = ? AND url = ? AND create_date >= ?',
+		                             array($key, $value, $url, $time));
+		if (isset($session_id)) {
+			return $session_id;
+		}
+	}
+
+	return null;
+}
+
+/**
+ * ¥Ñ¥é¥á¡¼¥¿¡¼¤«¤éÍ­¸ú¤Ê¥»¥Ã¥·¥ç¥óID¤ò¼èÆÀ¤¹¤ë¡£
+ *
+ * @return string|false ¼èÆÀ¤·¤¿Í­¸ú¤Ê¥»¥Ã¥·¥ç¥óID¤òÊÖ¤¹¡£
+ *                      ¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+ */
+function lfMobileGetSessionId() {
+	// ¥Ñ¥é¥á¡¼¥¿¡¼¤«¤é¥»¥Ã¥·¥ç¥óID¤ò¼èÆÀ¤¹¤ë¡£
+	$sessionId = @$_POST[session_name()];
+	if (!isset($sessionId)) {
+		$sessionId = @$_GET[session_name()];
+	}
+	if (!isset($sessionId)) {
+		$sessionId = lfMobileGetExtSessionId();
+	}
+	if (!isset($sessionId)) {
+		return false;
+	}
+
+	// ¥»¥Ã¥·¥ç¥óID¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	if (preg_match('/^[0-9a-zA-Z,-]{32,}$/', $sessionId) < 1) {
+		gfPrintLog("Invalid session id : sid=$sessionId");
+		return false;
+	}
+
+	// ¥»¥Ã¥·¥ç¥óID¤ÎÂ¸ºß¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	if (sfSessRead($sessionId) === null) {
+		gfPrintLog("Non-existent session id : sid=$sessionId");
+		return false;
+	}
+
+	return session_id($sessionId);
+}
+
+/**
+ * ¥»¥Ã¥·¥ç¥ó¥Ç¡¼¥¿¤¬Í­¸ú¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+ *
+ * @return boolean ¥»¥Ã¥·¥ç¥ó¥Ç¡¼¥¿¤¬Í­¸ú¤Ê¾ì¹ç¤Ï true¡¢Ìµ¸ú¤Ê¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£
+ */
+function lfMobileValidateSession() {
+	// ÇÛÎó mobile ¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	if (!is_array(@$_SESSION['mobile'])) {
+		return false;
+	}
+
+	// Í­¸ú´ü¸Â¤ò²á¤®¤Æ¤¤¤Ê¤¤¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	if (intval(@$_SESSION['mobile']['expires']) < time()) {
+		gfPrintLog("Session expired at " .
+		           date('Y/m/d H:i:s', @$_SESSION['mobile']['expires']) .
+		           ' : sid=' . session_id());
+
+		return false;
+	}
+
+	// ·ÈÂÓÃ¼Ëö¤Îµ¡¼ï¤¬°ìÃ×¤¹¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
+	$model = GC_MobileUserAgent::getModel();
+	if (@$_SESSION['mobile']['model'] != $model) {
+		gfPrintLog("User agent model mismatch : " .
+		           "\"$model\" != \"" . @$_SESSION['mobile']['model'] .
+		           '" (expected), sid=' . session_id());
+		return false;
+	}
+
+	return true;
+}
+
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥ÈÍÑ¤Î¥»¥Ã¥·¥ç¥ó´ØÏ¢¤Î½é´ü½èÍý¤ò¹Ô¤¦¡£
+ *
+ * @return void
+ */
+function lfMobileInitSession() {
+	// ¥»¥Ã¥·¥ç¥óID¤Î¼õ¤±ÅÏ¤·¤Ë¥¯¥Ã¥­¡¼¤ò»ÈÍÑ¤·¤Ê¤¤¡£
+	ini_set('session.use_cookies', '0');
+
+	// ¥Ñ¥é¥á¡¼¥¿¡¼¤«¤éÍ­¸ú¤Ê¥»¥Ã¥·¥ç¥óID¤ò¼èÆÀ¤¹¤ë¡£
+	$sessionId = lfMobileGetSessionId();
+
+	session_start();
+
+	// ¥»¥Ã¥·¥ç¥óID¤Þ¤¿¤Ï¥»¥Ã¥·¥ç¥ó¥Ç¡¼¥¿¤¬Ìµ¸ú¤Ê¾ì¹ç¤Ï¡¢¥»¥Ã¥·¥ç¥óID¤òºÆÀ¸À®
+	// ¤·¡¢¥»¥Ã¥·¥ç¥ó¥Ç¡¼¥¿¤ò½é´ü²½¤¹¤ë¡£
+	if ($sessionId === false || !lfMobileValidateSession()) {
+		session_regenerate_id();
+		$_SESSION = array('mobile' => array('model'    => GC_MobileUserAgent::getModel(),
+		                                    'phone_id' => GC_MobileUserAgent::getId(),
+		                                    'expires'  => time() + MOBILE_SESSION_LIFETIME));
+
+		// ¿·¤·¤¤¥»¥Ã¥·¥ç¥óID¤òÉÕ²Ã¤·¤Æ¥ê¥À¥¤¥ì¥¯¥È¤¹¤ë¡£
+		if ($_SERVER['REQUEST_METHOD'] == 'GET') {
+			// GET ¤Î¾ì¹ç¤ÏÆ±¤¸¥Ú¡¼¥¸¤Ë¥ê¥À¥¤¥ì¥¯¥È¤¹¤ë¡£
+			header('Location: ' . gfAddSessionId());
+		} else {
+			// GET °Ê³°¤Î¾ì¹ç¤Ï¥È¥Ã¥×¥Ú¡¼¥¸¤Ø¥ê¥À¥¤¥ì¥¯¥È¤¹¤ë¡£
+			header('Location: ' . URL_SITE_TOP . '?' . SID);
+		}
+		exit;
+	}
+
+	// ·ÈÂÓÃ¼ËöID¤ò¼èÆÀ¤Ç¤­¤¿¾ì¹ç¤Ï¥»¥Ã¥·¥ç¥ó¥Ç¡¼¥¿¤ËÊÝÂ¸¤¹¤ë¡£
+	$phoneId = GC_MobileUserAgent::getId();
+	if ($phoneId !== false) {
+		$_SESSION['mobile']['phone_id'] = $phoneId;
+	}
+
+	// ¥»¥Ã¥·¥ç¥ó¤ÎÍ­¸ú´ü¸Â¤ò¹¹¿·¤¹¤ë¡£
+	$_SESSION['mobile']['expires'] = time() + MOBILE_SESSION_LIFETIME;
+}
+
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥ÈÍÑ¤Î½ÐÎÏ¤Î½é´ü½èÍý¤ò¹Ô¤¦¡£
+ *
+ * ½ÐÎÏ¤ÎÎ®¤ì
+ * 1. Smarty
+ * 2. ÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤«¤é Shift JIS ¤ËÊÑ´¹¤¹¤ë¡£
+ * 3. Á´³Ñ¥«¥¿¥«¥Ê¤òÈ¾³Ñ¥«¥¿¥«¥Ê¤ËÊÑ´¹¤¹¤ë¡£
+ * 4. ²èÁüÍÑ¤Î¥¿¥°¤òÄ´À°¤¹¤ë¡£
+ * 5. ³¨Ê¸»ú¥¿¥°¤ò³¨Ê¸»ú¥³¡¼¥É¤ËÊÑ´¹¤¹¤ë¡£
+ * 6. ½ÐÎÏ
+ *
+ * @return void
+ */
+function lfMobileInitOutput() {
+	// Smarty ÍÑ¤Î¥Ç¥£¥ì¥¯¥È¥ê¡¼¤òºîÀ®¤¹¤ë¡£
+	@mkdir(COMPILE_DIR);
+
+	// ½ÐÎÏÍÑ¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ò Shift JIS ¤Ë¸ÇÄê¤¹¤ë¡£
+	mb_http_output('SJIS-win');
+
+	// ³¨Ê¸»ú¥¿¥°¤ò³¨Ê¸»ú¥³¡¼¥É¤ËÊÑ´¹¤¹¤ë¡£
+	ob_start(array('GC_MobileEmoji', 'handler'));
+
+	// Ã¼Ëö¤Ë¹ç¤ï¤»¤Æ²èÁü¥µ¥¤¥º¤òÊÑ´¹¤¹¤ë¡£
+	ob_start(array('GC_MobileImage', 'handler'));
+
+	// Á´³Ñ¥«¥¿¥«¥Ê¤òÈ¾³Ñ¥«¥¿¥«¥Ê¤ËÊÑ´¹¤¹¤ë¡£
+	ob_start(create_function('$buffer', 'return mb_convert_kana($buffer, "k", "SJIS-win");'));
+
+	// ÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤«¤é Shift JIS ¤ËÊÑ´¹¤¹¤ë¡£
+	ob_start('mb_output_handler');
+}
+
+/**
+ * ¥â¥Ð¥¤¥ë¥µ¥¤¥ÈÍÑ¤Î½é´ü½èÍý¤ò¹Ô¤¦¡£
+ *
+ * @return void
+ */
+function sfMobileInit() {
+	lfMobileInitInput();
+
+	if (basename(dirname($_SERVER['SCRIPT_NAME'])) != 'unsupported') {
+		lfMobileCheckCompatibility();
+		lfMobileInitSession();
+	}
+
+	lfMobileInitOutput();
+}
+
+/**
+ * LocationÅù¤Ç¥»¥Ã¥·¥ç¥óID¤òÉÕ²Ã¤¹¤ëÉ¬Í×¤¬¤¢¤ëURL¤Ë¥»¥Ã¥·¥ç¥óID¤òÉÕ²Ã¤¹¤ë¡£
+ *
+ * @return String
+ */
+function gfAddSessionId($url = null) {
+	$objURL = new Net_URL($url);
+	$objURL->addQueryString(session_name(), session_id());
+	return $objURL->getURL();
+}
+
+/**
+ * ¶õ¥á¡¼¥ëÍÑ¤Î¥È¡¼¥¯¥ó¤òÀ¸À®¤¹¤ë¡£
+ *
+ * @return string À¸À®¤·¤¿¥È¡¼¥¯¥ó¤òÊÖ¤¹¡£
+ */
+function lfGenerateKaraMailToken() {
+	$token_chars = '0123456789abcdefghijklmnopqrstuvwxyz';
+	$token_chars_length = strlen($token_chars);
+	$token_length = 10;
+	$token = '';
+
+	while ($token_length > 0) {
+		$token .= $token_chars{mt_rand(0, $token_chars_length - 1)};
+		--$token_length;
+	}
+
+	return $token;
+}
+
+/**
+ * ¶õ¥á¡¼¥ë´ÉÍý¥Æ¡¼¥Ö¥ë¤Ë¿·µ¬¥¨¥ó¥È¥ê¡¼¤òÅÐÏ¿¤·¡¢¥È¡¼¥¯¥ó¤òÊÖ¤¹¡£
+ *
+ * @param string $next_url ¶õ¥á¡¼¥ë¼õ¤±ÉÕ¤±¸å¤ËÁ«°Ü¤µ¤»¤ë¥Ú¡¼¥¸ (¥â¥Ð¥¤¥ë¥µ¥¤¥È¥È¥Ã¥×¤«¤é¤ÎÁêÂÐURL)
+ * @param string $session_id ¥»¥Ã¥·¥ç¥óID (¾ÊÎ¬¤·¤¿¾ì¹ç¤Ï¸½ºß¤Î¥»¥Ã¥·¥ç¥óID)
+ * @return string|false ¥È¡¼¥¯¥ó¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ïfalse¤òÊÖ¤¹¡£
+ */
+function gfPrepareKaraMail($next_url, $session_id = null) {
+	if (!isset($session_id)) {
+		$session_id = session_id();
+	}
+
+	$objQuery = new SC_Query;
+
+	// GC
+	$time = date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME);
+	$objQuery->delete('dtb_mobile_kara_mail', 'email IS NULL AND create_date < ?', array($time));
+
+	$objQuery->delete('dtb_mobile_kara_mail', 'session_id = ?', array($session_id));
+
+	$arrValues = array('session_id' => $session_id,
+	                   'next_url'   => $next_url);
+
+	$try = 10;
+
+	while ($try > 0) {
+		$arrValues['token'] = $token = lfGenerateKaraMailToken();
+
+		$objQuery->insert('dtb_mobile_kara_mail', $arrValues);
+		$count = $objQuery->count('dtb_mobile_kara_mail', 'token = ?', array($token));
+
+		if ($count == 1) {
+			break;
+		}
+
+		$objQuery->delete('dtb_mobile_kara_mail', 'session_id = ?', array($session_id));
+		$token = false;
+		--$try;
+	}
+
+	return $token;
+}
+
+/**
+ * ¶õ¥á¡¼¥ë¤«¤é¼èÆÀ¤·¤¿¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò¶õ¥á¡¼¥ë´ÉÍý¥Æ¡¼¥Ö¥ë¤ËÅÐÏ¿¤¹¤ë¡£
+ *
+ * @param string $token ¥È¡¼¥¯¥ó
+ * @param string $email ¥á¡¼¥ë¥¢¥É¥ì¥¹
+ * @return boolean À®¸ù¤·¤¿¾ì¹ç¤Ïtrue¡¢¼ºÇÔ¤·¤¿¾ì¹ç¤Ïfalse¤òÊÖ¤¹¡£
+ */
+function gfRegisterKaraMail($token, $email) {
+	$objQuery = new SC_Query;
+
+	// GC
+	$time = date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME);
+	$objQuery->delete('dtb_mobile_kara_mail',
+	                  '(email IS NULL AND create_date < ?) OR (email IS NOT NULL AND receive_date < ?)',
+	                  array($time, $time));
+
+	$kara_mail_id = $objQuery->get('dtb_mobile_kara_mail', 'kara_mail_id', 'token = ?', array($token));
+	if (!isset($kara_mail_id)) {
+		return false;
+	}
+
+	$arrValues = array('email' => $email);
+	$arrRawValues = array('receive_date' => 'now()');
+	$objQuery->update('dtb_mobile_kara_mail', $arrValues, 'kara_mail_id = ?', array($kara_mail_id), $arrRawValues);
+
+	return true;
+}
+
+/**
+ * ¶õ¥á¡¼¥ë´ÉÍý¥Æ¡¼¥Ö¥ë¤«¤é¥È¡¼¥¯¥ó¤¬°ìÃ×¤¹¤ë¹Ô¤òºï½ü¤·¡¢
+ * ¼¡¤ËÁ«°Ü¤µ¤»¤ë¥Ú¡¼¥¸¤ÎURL¤òÊÖ¤¹¡£¡¡
+ *
+ * ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ï $_SESSION['mobile']['kara_mail_from'] ¤ËÅÐÏ¿¤µ¤ì¤ë¡£
+ *
+ * @param string $token ¥È¡¼¥¯¥ó
+ * @return string|false URL¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ïfalse¤òÊÖ¤¹¡£
+ */
+function gfFinishKaraMail($token) {
+	$objQuery = new SC_Query;
+
+	$arrRow = $objQuery->getrow('dtb_mobile_kara_mail', 'session_id, next_url, email',
+	                            'token = ? AND email IS NOT NULL AND receive_date >= ?',
+	                            array($token, date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME)));
+	if (!isset($arrRow)) {
+		return false;
+	}
+
+	$objQuery->delete('dtb_mobile_kara_mail', 'token = ?', array($token));
+
+	list($session_id, $next_url, $email) = $arrRow;
+	$objURL = new Net_URL(SITE_URL . $next_url);
+	$objURL->addQueryString(session_name(), $session_id);
+	$url = $objURL->getURL();
+
+	session_id($session_id);
+	session_start();
+	$_SESSION['mobile']['kara_mail_from'] = $email;
+	session_write_close();
+
+	return $url;
+}
+
+/**
+ * ³°Éô¥µ¥¤¥ÈÏ¢·ÈÍÑ¤Ë¥»¥Ã¥·¥ç¥óID¤È¥Ñ¥é¥á¡¼¥¿¡¼¤ÎÁÈ¤ß¹ç¤ï¤»¤òÊÝÂ¸¤¹¤ë¡£
+ *
+ * @param string $param_key ¥Ñ¥é¥á¡¼¥¿¡¼Ì¾
+ * @param string $param_value ¥Ñ¥é¥á¡¼¥¿¡¼ÃÍ
+ * @param string $url URL
+ * @return void
+ */
+function sfMobileSetExtSessionId($param_key, $param_value, $url) {
+	$objQuery = new SC_Query;
+
+	// GC
+	$time = date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME);
+	$objQuery->delete('dtb_mobile_ext_session_id', 'create_date < ?', array($time));
+
+	$arrValues = array('session_id'  => session_id(),
+	                   'param_key'   => $param_key,
+	                   'param_value' => $param_value,
+	                   'url'         => $url);
+
+	$objQuery->insert('dtb_mobile_ext_session_id', $arrValues);
+}
+
+/**
+ * ¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬·ÈÂÓ¤Î¤â¤Î¤«¤É¤¦¤«¤òÈ½ÊÌ¤¹¤ë¡£
+ *
+ * @param string $address ¥á¡¼¥ë¥¢¥É¥ì¥¹
+ * @return boolean ·ÈÂÓ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î¾ì¹ç¤Ïtrue¡¢¤½¤ì°Ê³°¤Î¾ì¹ç¤Ïfalse¤òÊÖ¤¹¡£
+ */
+function gfIsMobileMailAddress($address) {
+	$arrMobileMailDomains = array('docomo.ne.jp', 'ezweb.ne.jp', 'softbank.ne.jp', 'vodafone.ne.jp');
+
+	if (defined('MOBILE_ADDITIONAL_MAIL_DOMAINS')) {
+		$arrMobileMailDomains = array_merge($arrMobileMailDomains, split('[ ,]+', MOBILE_ADDITIONAL_MAIL_DOMAINS));
+	}
+
+	foreach ($arrMobileMailDomains as $domain) {
+		$domain = str_replace('.', '\\.', $domain);
+		if (preg_match("/@([^@]+\\.)?$domain\$/", $address)) {
+			return true;
+		}
+	}
+
+	return false;
+}
+?>
Index: /branches/mobile/data/include/mobile_emoji_map_docomo.inc
===================================================================
--- /branches/mobile/data/include/mobile_emoji_map_docomo.inc	(revision 11398)
+++ /branches/mobile/data/include/mobile_emoji_map_docomo.inc	(revision 11398)
@@ -0,0 +1,260 @@
+<?php
+/**
+ * i¥â¡¼¥ÉÍÑ³¨Ê¸»ú¥³¡¼¥É (Shift JIS)
+ */
+
+return array(
+	'1'   => "\xf8\x9f",
+	'2'   => "\xf8\xa0",
+	'3'   => "\xf8\xa1",
+	'4'   => "\xf8\xa2",
+	'5'   => "\xf8\xa3",
+	'6'   => "\xf8\xa4",
+	'7'   => "\xf8\xa5",
+	'8'   => "\xf8\xa6",
+	'9'   => "\xf8\xa7",
+	'10'  => "\xf8\xa8",
+	'11'  => "\xf8\xa9",
+	'12'  => "\xf8\xaa",
+	'13'  => "\xf8\xab",
+	'14'  => "\xf8\xac",
+	'15'  => "\xf8\xad",
+	'16'  => "\xf8\xae",
+	'17'  => "\xf8\xaf",
+	'18'  => "\xf8\xb0",
+	'19'  => "\xf8\xb1",
+	'20'  => "\xf8\xb2",
+	'21'  => "\xf8\xb3",
+	'22'  => "\xf8\xb4",
+	'23'  => "\xf8\xb5",
+	'24'  => "\xf8\xb6",
+	'25'  => "\xf8\xb7",
+	'26'  => "\xf8\xb8",
+	'27'  => "\xf8\xb9",
+	'28'  => "\xf8\xba",
+	'29'  => "\xf8\xbb",
+	'30'  => "\xf8\xbc",
+	'31'  => "\xf8\xbd",
+	'32'  => "\xf8\xbe",
+	'33'  => "\xf8\xbf",
+	'34'  => "\xf8\xc0",
+	'35'  => "\xf8\xc1",
+	'36'  => "\xf8\xc2",
+	'37'  => "\xf8\xc3",
+	'38'  => "\xf8\xc4",
+	'39'  => "\xf8\xc5",
+	'40'  => "\xf8\xc6",
+	'41'  => "\xf8\xc7",
+	'42'  => "\xf8\xc8",
+	'43'  => "\xf8\xc9",
+	'44'  => "\xf8\xca",
+	'45'  => "\xf8\xcb",
+	'46'  => "\xf8\xcc",
+	'47'  => "\xf8\xcd",
+	'48'  => "\xf8\xce",
+	'49'  => "\xf8\xcf",
+	'50'  => "\xf8\xd0",
+	'51'  => "\xf8\xd1",
+	'52'  => "\xf8\xd2",
+	'53'  => "\xf8\xd3",
+	'54'  => "\xf8\xd4",
+	'55'  => "\xf8\xd5",
+	'56'  => "\xf8\xd6",
+	'57'  => "\xf8\xd7",
+	'58'  => "\xf8\xd8",
+	'59'  => "\xf8\xd9",
+	'60'  => "\xf8\xda",
+	'61'  => "\xf8\xdb",
+	'62'  => "\xf8\xdc",
+	'63'  => "\xf8\xdd",
+	'64'  => "\xf8\xde",
+	'65'  => "\xf8\xdf",
+	'66'  => "\xf8\xe0",
+	'67'  => "\xf8\xe1",
+	'68'  => "\xf8\xe2",
+	'69'  => "\xf8\xe3",
+	'70'  => "\xf8\xe4",
+	'71'  => "\xf8\xe5",
+	'72'  => "\xf8\xe6",
+	'73'  => "\xf8\xe7",
+	'74'  => "\xf8\xe8",
+	'75'  => "\xf8\xe9",
+	'76'  => "\xf8\xea",
+	'77'  => "\xf8\xeb",
+	'78'  => "\xf8\xec",
+	'79'  => "\xf8\xed",
+	'80'  => "\xf8\xee",
+	'81'  => "\xf8\xef",
+	'82'  => "\xf8\xf0",
+	'83'  => "\xf8\xf1",
+	'84'  => "\xf8\xf2",
+	'85'  => "\xf8\xf3",
+	'86'  => "\xf8\xf4",
+	'87'  => "\xf8\xf5",
+	'88'  => "\xf8\xf6",
+	'89'  => "\xf8\xf7",
+	'90'  => "\xf8\xf8",
+	'91'  => "\xf8\xf9",
+	'92'  => "\xf8\xfa",
+	'93'  => "\xf8\xfb",
+	'94'  => "\xf8\xfc",
+	'95'  => "\xf9\x40",
+	'96'  => "\xf9\x41",
+	'97'  => "\xf9\x42",
+	'98'  => "\xf9\x43",
+	'99'  => "\xf9\x44",
+	'100' => "\xf9\x45",
+	'101' => "\xf9\x46",
+	'102' => "\xf9\x47",
+	'103' => "\xf9\x48",
+	'104' => "\xf9\x49",
+	'105' => "\xf9\x72",
+	'106' => "\xf9\x73",
+	'107' => "\xf9\x74",
+	'108' => "\xf9\x75",
+	'109' => "\xf9\x76",
+	'110' => "\xf9\x77",
+	'111' => "\xf9\x78",
+	'112' => "\xf9\x79",
+	'113' => "\xf9\x7a",
+	'114' => "\xf9\x7b",
+	'115' => "\xf9\x7c",
+	'116' => "\xf9\x7d",
+	'117' => "\xf9\x7e",
+	'118' => "\xf9\x80",
+	'119' => "\xf9\x81",
+	'120' => "\xf9\x82",
+	'121' => "\xf9\x83",
+	'122' => "\xf9\x84",
+	'123' => "\xf9\x85",
+	'124' => "\xf9\x86",
+	'125' => "\xf9\x87",
+	'126' => "\xf9\x88",
+	'127' => "\xf9\x89",
+	'128' => "\xf9\x8a",
+	'129' => "\xf9\x8b",
+	'130' => "\xf9\x8c",
+	'131' => "\xf9\x8d",
+	'132' => "\xf9\x8e",
+	'133' => "\xf9\x8f",
+	'134' => "\xf9\x90",
+	'135' => "\xf9\xb0",
+	'136' => "\xf9\x91",
+	'137' => "\xf9\x92",
+	'138' => "\xf9\x93",
+	'139' => "\xf9\x94",
+	'140' => "\xf9\x95",
+	'141' => "\xf9\x96",
+	'142' => "\xf9\x97",
+	'143' => "\xf9\x98",
+	'144' => "\xf9\x99",
+	'145' => "\xf9\x9a",
+	'146' => "\xf9\x9b",
+	'147' => "\xf9\x9c",
+	'148' => "\xf9\x9d",
+	'149' => "\xf9\x9e",
+	'150' => "\xf9\x9f",
+	'151' => "\xf9\xa0",
+	'152' => "\xf9\xa1",
+	'153' => "\xf9\xa2",
+	'154' => "\xf9\xa3",
+	'155' => "\xf9\xa4",
+	'156' => "\xf9\xa5",
+	'157' => "\xf9\xa6",
+	'158' => "\xf9\xa7",
+	'159' => "\xf9\xa8",
+	'160' => "\xf9\xa9",
+	'161' => "\xf9\xaa",
+	'162' => "\xf9\xab",
+	'163' => "\xf9\xac",
+	'164' => "\xf9\xad",
+	'165' => "\xf9\xae",
+	'166' => "\xf9\xaf",
+	'167' => "\xf9\x50",
+	'168' => "\xf9\x51",
+	'169' => "\xf9\x52",
+	'170' => "\xf9\x55",
+	'171' => "\xf9\x56",
+	'172' => "\xf9\x57",
+	'173' => "\xf9\x5b",
+	'174' => "\xf9\x5c",
+	'175' => "\xf9\x5d",
+	'176' => "\xf9\x5e",
+	'e1'  => "\xf9\xb1",
+	'e2'  => "\xf9\xb2",
+	'e3'  => "\xf9\xb3",
+	'e4'  => "\xf9\xb4",
+	'e5'  => "\xf9\xb5",
+	'e6'  => "\xf9\xb6",
+	'e7'  => "\xf9\xb7",
+	'e8'  => "\xf9\xb8",
+	'e9'  => "\xf9\xb9",
+	'e10' => "\xf9\xba",
+	'e11' => "\xf9\xbb",
+	'e12' => "\xf9\xbc",
+	'e13' => "\xf9\xbd",
+	'e14' => "\xf9\xbe",
+	'e15' => "\xf9\xbf",
+	'e16' => "\xf9\xc0",
+	'e17' => "\xf9\xc1",
+	'e18' => "\xf9\xc2",
+	'e19' => "\xf9\xc3",
+	'e20' => "\xf9\xc4",
+	'e21' => "\xf9\xc5",
+	'e22' => "\xf9\xc6",
+	'e23' => "\xf9\xc7",
+	'e24' => "\xf9\xc8",
+	'e25' => "\xf9\xc9",
+	'e26' => "\xf9\xca",
+	'e27' => "\xf9\xcb",
+	'e28' => "\xf9\xcc",
+	'e29' => "\xf9\xcd",
+	'e30' => "\xf9\xce",
+	'e31' => "\xf9\xcf",
+	'e32' => "\xf9\xd0",
+	'e33' => "\xf9\xd1",
+	'e34' => "\xf9\xd2",
+	'e35' => "\xf9\xd3",
+	'e36' => "\xf9\xd4",
+	'e37' => "\xf9\xd5",
+	'e38' => "\xf9\xd6",
+	'e39' => "\xf9\xd7",
+	'e40' => "\xf9\xd8",
+	'e41' => "\xf9\xd9",
+	'e42' => "\xf9\xda",
+	'e43' => "\xf9\xdb",
+	'e44' => "\xf9\xdc",
+	'e45' => "\xf9\xdd",
+	'e46' => "\xf9\xde",
+	'e47' => "\xf9\xdf",
+	'e48' => "\xf9\xe0",
+	'e49' => "\xf9\xe1",
+	'e50' => "\xf9\xe2",
+	'e51' => "\xf9\xe3",
+	'e52' => "\xf9\xe4",
+	'e53' => "\xf9\xe5",
+	'e54' => "\xf9\xe6",
+	'e55' => "\xf9\xe7",
+	'e56' => "\xf9\xe8",
+	'e57' => "\xf9\xe9",
+	'e58' => "\xf9\xea",
+	'e59' => "\xf9\xeb",
+	'e60' => "\xf9\xec",
+	'e61' => "\xf9\xed",
+	'e62' => "\xf9\xee",
+	'e63' => "\xf9\xef",
+	'e64' => "\xf9\xf0",
+	'e65' => "\xf9\xf1",
+	'e66' => "\xf9\xf2",
+	'e67' => "\xf9\xf3",
+	'e68' => "\xf9\xf4",
+	'e69' => "\xf9\xf5",
+	'e70' => "\xf9\xf6",
+	'e71' => "\xf9\xf7",
+	'e72' => "\xf9\xf8",
+	'e73' => "\xf9\xf9",
+	'e74' => "\xf9\xfa",
+	'e75' => "\xf9\xfb",
+	'e76' => "\xf9\xfc"
+);
+?>
Index: /branches/mobile/.buildpath
===================================================================
--- /branches/mobile/.buildpath	(revision 10565)
+++ /branches/mobile/.buildpath	(revision 10565)
@@ -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>
