Index: /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.php
===================================================================
--- /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.php	(revision 17531)
+++ /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.php	(revision 17531)
@@ -0,0 +1,111 @@
+<?php
+/**
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+/*
+ * ¥â¥¸¥å¡¼¥ë¥Ð¡¼¥¸¥ç¥óÉ½µ­
+ * @version ### ### 1.0
+ */
+require_once(MODULE_PATH . "mdl_zaikorobot/mdl_zaikorobot.inc");
+
+//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
+class LC_Page {
+    //¥³¥ó¥¹¥È¥é¥¯¥¿
+    function LC_Page() {
+        //¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
+        $this->tpl_mainpage = MODULE_PATH . 'mdl_zaikorobot/mdl_zaikorobot.tpl';
+        $this->tpl_subtitle = 'zaiko robotÏ¢·È¥â¥¸¥å¡¼¥ë';
+    }
+}
+$objPage = new LC_Page();
+$objView = new SC_AdminView();
+$objQuery = new SC_Query();
+
+// Ç§¾Ú³ÎÇ§
+$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) {
+        // ¥Ç¡¼¥¿¹¹¿·
+        sfZaikoSetModuleDB(MDL_ZAIKOROBOT_ID, $objFormParam);
+        // ·èºÑ·ë²Ì¼õÉÕ¥Õ¥¡¥¤¥ë¤Î¥³¥Ô¡¼
+        copy(MODULE_PATH. "mdl_zaikorobot/hunglead_stock.php", HTML_PATH. "user_data/hunglead_stock.php");
+        // ´°Î»ÄÌÃÎ
+        $objPage->tpl_onload = 'alert("ÅÐÏ¿´°Î»¤·¤Þ¤·¤¿¡£");window.close();';
+    }
+    break;
+default:
+    // ¥Ç¡¼¥¿¤Î¥í¡¼¥É
+    lfLoadData();	
+    break;
+}
+
+$objPage->arrForm = $objFormParam->getFormParamList();
+
+$objView->assignobj($objPage);
+$objView->display($objPage->tpl_mainpage);
+
+//-----------------------------------------------------------------------
+
+/**
+ * ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
+ */ 
+function lfInitParam($objFormParam) {
+    $objFormParam->addParam("ID", "id", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
+    $objFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));	
+    return $objFormParam;
+}
+
+/**
+ * ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+ */
+function lfCheckError() {
+    global $objFormParam;
+    $arrErr = $objFormParam->checkError();
+    return $arrErr;
+}
+
+/**
+ * ÅÐÏ¿¥Ç¡¼¥¿¤Î¼èÆÀ
+ */
+function lfLoadData() {
+    global $objFormParam;
+    //¥Ç¡¼¥¿¤ò¼èÆÀ
+    $arrRet = sfZaikoGetModuleDB(MDL_ZAIKOROBOT_ID);
+    // ÃÍ¤ò¥»¥Ã¥È
+    $objFormParam->setParam($arrRet);
+}
+
+?>
Index: /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.inc
===================================================================
--- /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.inc	(revision 17531)
+++ /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.inc	(revision 17531)
@@ -0,0 +1,107 @@
+<?php
+/**
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+define("MDL_ZAIKOROBOT_ID", 15);
+define("MODULE_NAME", "zaiko robotÏ¢Æ°¥â¥¸¥å¡¼¥ë");
+
+//================================================================================
+
+/**
+ * DB¤Ë¥Ç¡¼¥¿ÅÐÏ¿
+ */
+function sfZaikoSetModuleDB($module_id, $objFormParam) {
+    $objQuery = new SC_Query();
+    $arrRet = $objFormParam->getHashArray();
+    foreach($arrRet as $key => $val) {
+        $arrVal[$key] = $val;
+    }    
+    $sqlval['sub_data'] = serialize($arrVal);
+    $objQuery->update("dtb_module", $sqlval, "module_id = ?", array($module_id));
+}
+
+/**
+ * DB¤«¤é¥Ç¡¼¥¿¼èÆÀ
+ */
+function sfZaikoGetModuleDB($module_id) {
+    $objQuery = new SC_Query();
+    $arrVal = array($module_id);
+    $arrRet = array();
+    $sql = "SELECT sub_data
+            FROM dtb_module WHERE module_id = ?";
+    $arrRet = $objQuery->getall($sql, $arrVal);
+    return unserialize($arrRet[0]['sub_data']);
+}
+
+/**
+ * ID¥Á¥§¥Ã¥¯
+ */
+function sfZaikoIdCheck() {
+    $ret = sfZaikoGetModuleDb(MDL_ZAIKOROBOT_ID);
+    // Ç§¾ÚÀ®¸ù
+    if (isset($_POST['sys_id']) && isset($_POST['sys_pass']) && 
+        $ret['id'] == $_POST['sys_id'] && $ret['pass'] == $_POST['sys_pass']) {
+        return true;
+    // Ç§¾Ú¥¨¥é¡¼
+    } else {
+        echo "NG\n";
+        echo "auth_error";
+        exit;
+    }
+}
+
+/**
+ * ºß¸ËÄ´À°
+ */
+function sfZaikoUpdate() {
+    if (isset($_POST['product'])) {
+        $objQuery = new SC_Query();
+        $cnt = "0";
+        foreach($_POST['product'] as $key => $val) {
+            $table = "dtb_products_class";
+            $where = "product_id = ? AND product_code = ?";
+            $arrval = array();
+            $arrval[] = empty($val['product_id']) ? "0" : $val['product_id'];
+            $arrval[] = empty($val['product_code']) ? "0" : $val['product_code'];
+            // ºß¸Ë¹¹¿·
+            if (sfDataExists($table, $where, $arrval) === true) {
+                $sqlval['stock'] = empty($val['stock']) ? "0" : $val['stock'];
+                $objQuery->update($table, $sqlval, $where, $arrval);
+            // ¾¦ÉÊ¥¨¥é¡¼
+            } else {
+                $cnt++;
+                if ($cnt == "1") $mes = "NG\n";
+                $mes .= "no_product(product_id=". $arrval[0]. ",product_code=". $arrval[1]. ")\n";
+            }
+        }
+        // À®¸ù
+        if ($cnt == "0") {
+           $mes = "OK";
+        }
+    // ¥¯¥¨¥ê¡¼¥¨¥é¡¼
+    } else {
+        $mes = "NG\n". "no_query";
+    }
+    echo $mes;
+    exit;
+}
+
+?>
Index: /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.tpl
===================================================================
--- /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.tpl	(revision 17531)
+++ /tags/mdl_zaikorobot-1.0/mdl_zaikorobot.tpl	(revision 17531)
@@ -0,0 +1,168 @@
+<!--{*
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+*}-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="content-type" content="application/xhtml+xml; charset=<!--{$smarty.const.CHAR_CODE}-->" />
+<meta http-equiv="content-script-type" content="text/javascript" />
+<meta http-equiv="content-style-type" content="text/css" />
+<link rel="stylesheet" href="<!--{$smarty.const.URL_DIR}-->admin/css/contents.css" type="text/css" media="all" />
+<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/css.js"></script>
+<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/navi.js"></script>
+<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/win_op.js"></script>
+<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/site.js"></script>
+<script type="text/javascript" src="<!--{$smarty.const.URL_DIR}-->js/admin.js"></script>
+<!--{include file='css/contents.tpl'}-->
+<title><!--{$tpl_subtitle}--></title>
+<script type="text/javascript">
+<!--
+self.moveTo(20,20);self.focus();
+
+function win_open(URL){
+    var WIN;
+    WIN = window.open(URL);
+    WIN.focus();
+}
+//-->
+</script>
+</head>
+
+<body bgcolor="#ffffff" text="#666666" link="#007bb7" vlink="#007bb7" alink="#cc0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload='<!--{$tpl_onload}-->'>
+<noscript>
+<link rel="stylesheet" href="<!--{$smarty.const.URL_DIR}-->admin/css/common.css" type="text/css" />
+</noscript>
+
+<div align="center">
+<!--¡ú¡ú¥á¥¤¥ó¥³¥ó¥Æ¥ó¥Ä¡ú¡ú-->
+<table width="500" border="0" cellspacing="0" cellpadding="0" summary=" ">
+<form name="form1" id="form1" method="post" action="<!--{$smarty.server.REQUEST_URI|escape}-->">
+<input type="hidden" name="mode" value="edit">
+	<tr valign="top">
+		<td class="mainbg">
+			<!--¢§ÅÐÏ¿¥Æ¡¼¥Ö¥ë¤³¤³¤«¤é-->
+			<table width="500" border="0" cellspacing="0" cellpadding="0" summary=" ">
+				<!--¥á¥¤¥ó¥¨¥ê¥¢-->
+				<tr>
+					<td align="center">
+						<table width="470" 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="470" 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="442" border="0" cellspacing="0" cellpadding="0" summary=" ">
+										<tr>
+											<td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/contents_title_top.gif" width="442" 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="402" class="fs14n"><span class="white"><!--¥³¥ó¥Æ¥ó¥Ä¥¿¥¤¥È¥ë--><!--{$tpl_subtitle}--></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="442" height="7" alt=""></td>
+										</tr>
+										<tr>
+											<td colspan="3"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/main_bar.jpg" width="442" height="10" alt=""></td>
+										</tr>
+									</table>
+
+									<table width="442" border="0" cellspacing="1" cellpadding="8" summary=" ">
+										<tr class="fs12n">
+											<td bgcolor="#ffffff">
+												zaiko robotÏ¢Æ°¥â¥¸¥å¡¼¥ë¤ò¤´ÍøÍÑÄº¤¯¤Ë¤Ï¡¢¥æ¡¼¥¶ÍÍ¤´¼«¿È¤Ç¥Ï¥ó¥°¥ê¡¼¥É³ô¼°²ñ¼Ò¤È¤´·ÀÌóÄº¤¯É¬Í×¤¬¤¢¤ê¤Þ¤¹¡£ <br/>
+												¤ª¿½¤·¹þ¤ß¤Ë¤Ä¤­¤Þ¤·¤Æ¤Ï¡¢²¼µ­¤Î¥Ú¡¼¥¸¤è¤ê¤ªÌä¤¤¹ç¤ï¤»²¼¤µ¤¤¡£<br/><br/>
+												<a href="#" onClick="win_open('http://www.hunglead.com/')" > ¡ä¡ä¥Ï¥ó¥°¥ê¡¼¥É³ô¼°²ñ¼Ò</a>
+											</td>
+										</tr>
+									</table>
+									<table width="442" border="0" cellspacing="0" cellpadding="0" summary=" ">
+										<tr><td><img src="<!--{$smarty.const.URL_DIR}-->img/contents/main_bar.jpg" width="442" height="10" alt=""></td></tr>
+									</table>
+
+									<table width="442" border="0" cellspacing="1" cellpadding="8" summary=" ">
+										<tr class="fs12n">
+											<td width="" bgcolor="#f3f3f3">ID<span class="red">¢¨</span></td>
+											<td width="337" bgcolor="#ffffff">
+											<!--{assign var=key value="id"}-->
+											<span class="red12"><!--{$arrErr[$key]}--></span>
+											<input type="text" name="<!--{$key}-->" style="ime-mode:disabled; <!--{$arrErr[$key]|sfGetErrorColor}-->" value="<!--{$arrForm[$key].value}-->" class="box10" maxlength="<!--{$arrForm[$key].length}-->">
+											</td>
+										</tr>
+										<tr class="fs12n">
+											<td width="" bgcolor="#f3f3f3">¥Ñ¥¹¥ï¡¼¥É<span class="red">¢¨</span></td>
+											<td width="337" bgcolor="#ffffff">
+											<!--{assign var=key value="pass"}-->
+											<span class="red12"><!--{$arrErr[$key]}--></span>
+											<input type="text" name="<!--{$key}-->" style="ime-mode:disabled; <!--{$arrErr[$key]|sfGetErrorColor}-->" value="<!--{$arrForm[$key].value}-->" class="box10" maxlength="<!--{$arrForm[$key].length}-->">
+											</td>
+										</tr>
+									</table>
+
+									<table width="442" 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="440" 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_regist_on.jpg',this)" onMouseout="chgImgImageSubmit('<!--{$smarty.const.URL_DIR}-->img/contents/btn_regist.jpg',this)" src="<!--{$smarty.const.URL_DIR}-->img/contents/btn_regist.jpg" width="123" height="24" alt="¤³¤ÎÆâÍÆ¤ÇÅÐÏ¿¤¹¤ë" border="0" name="subm" onClick="document.body.style.cursor = 'wait';"></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="442" height="8" alt=""></td>
+										</tr>
+									</table>
+								</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="470" height="14" alt=""></td>
+							</tr>
+							<tr><td height="30"></td></tr>
+						</table>
+					</td>
+				</tr>
+				<!--¥á¥¤¥ó¥¨¥ê¥¢-->
+			</table>
+			<!--¢¥ÅÐÏ¿¥Æ¡¼¥Ö¥ë¤³¤³¤Þ¤Ç-->
+		</td>
+	</tr>
+</form>
+</table>
+<!--¡ú¡ú¥á¥¤¥ó¥³¥ó¥Æ¥ó¥Ä¡ú¡ú-->
+</div>
+
+</body>
+</html>
Index: /tags/mdl_zaikorobot-1.0/hunglead_stock.php
===================================================================
--- /tags/mdl_zaikorobot-1.0/hunglead_stock.php	(revision 17531)
+++ /tags/mdl_zaikorobot-1.0/hunglead_stock.php	(revision 17531)
@@ -0,0 +1,34 @@
+<?php
+/**
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+require_once "../require.php";
+require_once MODULE_PATH. "mdl_zaikorobot/mdl_zaikorobot.inc";
+
+set_time_limit(0);
+
+// ID¥Á¥§¥Ã¥¯
+if (sfZaikoIdCheck() === true) {
+    // ºß¸ËÄ´À°
+    sfZaikoUpdate();
+}
+
+?>
