| 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
|
|---|
| 4 | *
|
|---|
| 5 | * http://www.lockon.co.jp/
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | //---¤³¤Î¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ò»ØÄê
|
|---|
| 9 | $INC_PATH = realpath( dirname( __FILE__) );
|
|---|
| 10 | require_once( $INC_PATH ."/../conf/conf.php" );
|
|---|
| 11 | require_once( $INC_PATH ."/../class/SC_DbConn.php" );
|
|---|
| 12 | require_once( $INC_PATH ."/../class/SC_Query.php" );
|
|---|
| 13 | require_once( $INC_PATH ."/../class/SC_CampaignSession.php" );
|
|---|
| 14 | require_once( $INC_PATH ."/../include/session.inc" );
|
|---|
| 15 |
|
|---|
| 16 | // Á´¥Ú¡¼¥¸¶¦ÄÌ¥¨¥é¡¼
|
|---|
| 17 | $GLOBAL_ERR = "";
|
|---|
| 18 | // ¥¤¥ó¥¹¥È¡¼¥ë½é´ü½èÍý
|
|---|
| 19 | sfInitInstall();
|
|---|
| 20 |
|
|---|
| 21 | /* ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Ð¡¼¥¸¥ç¥ó½êÆÀ */
|
|---|
| 22 | function sfGetDBVersion($dsn = "") {
|
|---|
| 23 | if($dsn == "") {
|
|---|
| 24 | if(defined('DEFAULT_DSN')) {
|
|---|
| 25 | $dsn = DEFAULT_DSN;
|
|---|
| 26 | } else {
|
|---|
| 27 | return;
|
|---|
| 28 | }
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | $objQuery = new SC_Query($dsn, true, true);
|
|---|
| 32 | list($db_type) = split(":", $dsn);
|
|---|
| 33 | if($db_type == 'mysql') {
|
|---|
| 34 | $val = $objQuery->getOne("select version()");
|
|---|
| 35 | $version = "MySQL " . $val;
|
|---|
| 36 | }
|
|---|
| 37 | if($db_type == 'pgsql') {
|
|---|
| 38 | $val = $objQuery->getOne("select version()");
|
|---|
| 39 | $arrLine = split(" " , $val);
|
|---|
| 40 | $version = $arrLine[0] . " " . $arrLine[1];
|
|---|
| 41 | }
|
|---|
| 42 | return $version;
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | /* ¥Æ¡¼¥Ö¥ë¤Î¸ºß¥Á¥§¥Ã¥¯ */
|
|---|
| 46 | function sfTabaleExists($table_name, $dsn = "") {
|
|---|
| 47 | if($dsn == "") {
|
|---|
| 48 | if(defined('DEFAULT_DSN')) {
|
|---|
| 49 | $dsn = DEFAULT_DSN;
|
|---|
| 50 | } else {
|
|---|
| 51 | return;
|
|---|
| 52 | }
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | $objQuery = new SC_Query($dsn, true, true);
|
|---|
| 56 | // Àµ¾ï¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
|
|---|
| 57 | if(!$objQuery->isError()) {
|
|---|
| 58 | list($db_type) = split(":", $dsn);
|
|---|
| 59 | // postgresql¤Èmysql¤È¤Ç½èÍý¤òʬ¤±¤ë
|
|---|
| 60 | if ($db_type == "pgsql") {
|
|---|
| 61 | $sql = "SELECT
|
|---|
| 62 | relname
|
|---|
| 63 | FROM
|
|---|
| 64 | pg_class
|
|---|
| 65 | WHERE
|
|---|
| 66 | (relkind = 'r' OR relkind = 'v') AND
|
|---|
| 67 | relname = ?
|
|---|
| 68 | GROUP BY
|
|---|
| 69 | relname";
|
|---|
| 70 | $arrRet = $objQuery->getAll($sql, array($table_name));
|
|---|
| 71 | if(count($arrRet) > 0) {
|
|---|
| 72 | return true;
|
|---|
| 73 | }
|
|---|
| 74 | }else if ($db_type == "mysql") {
|
|---|
| 75 | $sql = "SHOW TABLE STATUS LIKE ?";
|
|---|
| 76 | $arrRet = $objQuery->getAll($sql, array($table_name));
|
|---|
| 77 | if(count($arrRet) > 0) {
|
|---|
| 78 | return true;
|
|---|
| 79 | }
|
|---|
| 80 | }
|
|---|
| 81 | }
|
|---|
| 82 | return false;
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | // ¥«¥é¥à¤Î¸ºß¥Á¥§¥Ã¥¯¤ÈºîÀ®
|
|---|
| 86 | function sfColumnExists($table_name, $col_name, $col_type = "", $dsn = "", $add = false) {
|
|---|
| 87 | if($dsn == "") {
|
|---|
| 88 | if(defined('DEFAULT_DSN')) {
|
|---|
| 89 | $dsn = DEFAULT_DSN;
|
|---|
| 90 | } else {
|
|---|
| 91 | return;
|
|---|
| 92 | }
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | // ¥Æ¡¼¥Ö¥ë¤¬Ìµ¤±¤ì¤Ð¥¨¥é¡¼
|
|---|
| 96 | if(!sfTabaleExists($table_name, $dsn)) return false;
|
|---|
| 97 |
|
|---|
| 98 | $objQuery = new SC_Query($dsn, true, true);
|
|---|
| 99 | // Àµ¾ï¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
|
|---|
| 100 | if(!$objQuery->isError()) {
|
|---|
| 101 | list($db_type) = split(":", $dsn);
|
|---|
| 102 |
|
|---|
| 103 | // ¥«¥é¥à¥ê¥¹¥È¤ò¼èÆÀ
|
|---|
| 104 | $arrRet = sfGetColumnList($table_name, $objQuery, $db_type);
|
|---|
| 105 | if(count($arrRet) > 0) {
|
|---|
| 106 | if(in_array($col_name, $arrRet)){
|
|---|
| 107 | return true;
|
|---|
| 108 | }
|
|---|
| 109 | }
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | // ¥«¥é¥à¤òÄɲ乤ë
|
|---|
| 113 | if($add){
|
|---|
| 114 | $objQuery->query("ALTER TABLE $table_name ADD $col_name $col_type ");
|
|---|
| 115 | return true;
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | return false;
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î¸ºß¥Á¥§¥Ã¥¯¤ÈºîÀ®
|
|---|
| 122 | function sfIndexExists($table_name, $col_name, $index_name, $length = "", $dsn = "", $add = false) {
|
|---|
| 123 | if($dsn == "") {
|
|---|
| 124 | if(defined('DEFAULT_DSN')) {
|
|---|
| 125 | $dsn = DEFAULT_DSN;
|
|---|
| 126 | } else {
|
|---|
| 127 | return;
|
|---|
| 128 | }
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | // ¥Æ¡¼¥Ö¥ë¤¬Ìµ¤±¤ì¤Ð¥¨¥é¡¼
|
|---|
| 132 | if(!sfTabaleExists($table_name, $dsn)) return false;
|
|---|
| 133 |
|
|---|
| 134 | $objQuery = new SC_Query($dsn, true, true);
|
|---|
| 135 | // Àµ¾ï¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
|
|---|
| 136 | if(!$objQuery->isError()) {
|
|---|
| 137 | list($db_type) = split(":", $dsn);
|
|---|
| 138 | switch($db_type) {
|
|---|
| 139 | case 'pgsql':
|
|---|
| 140 | // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î¸ºß³Îǧ
|
|---|
| 141 | $arrRet = $objQuery->getAll("SELECT relname FROM pg_class WHERE relname = ?", array($index_name));
|
|---|
| 142 | break;
|
|---|
| 143 | case 'mysql':
|
|---|
| 144 | // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î¸ºß³Îǧ
|
|---|
| 145 | $arrRet = $objQuery->getAll("SHOW INDEX FROM ? WHERE Key_name = ?", array($table_name, $index_name));
|
|---|
| 146 | break;
|
|---|
| 147 | default:
|
|---|
| 148 | return false;
|
|---|
| 149 | }
|
|---|
| 150 | // ¤¹¤Ç¤Ë¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬Â¸ºß¤¹¤ë¾ì¹ç
|
|---|
| 151 | if(count($arrRet) > 0) {
|
|---|
| 152 | return true;
|
|---|
| 153 | }
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤òºîÀ®¤¹¤ë
|
|---|
| 157 | if($add){
|
|---|
| 158 | switch($db_type) {
|
|---|
| 159 | case 'pgsql':
|
|---|
| 160 | $objQuery->query("CREATE INDEX ? ON ? (?)", array($index_name, $table_name, $col_name));
|
|---|
| 161 | break;
|
|---|
| 162 | case 'mysql':
|
|---|
| 163 | $objQuery->query("CREATE INDEX ? ON ? (?(?))", array($index_name, $table_name, $col_name, $length));
|
|---|
| 164 | break;
|
|---|
| 165 | default:
|
|---|
| 166 | return false;
|
|---|
| 167 | }
|
|---|
| 168 | return true;
|
|---|
| 169 | }
|
|---|
| 170 | return false;
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | // ¥Ç¡¼¥¿¤Î¸ºß¥Á¥§¥Ã¥¯
|
|---|
| 174 | function sfDataExists($table_name, $where, $arrval, $dsn = "", $sql = "", $add = false) {
|
|---|
| 175 | if($dsn == "") {
|
|---|
| 176 | if(defined('DEFAULT_DSN')) {
|
|---|
| 177 | $dsn = DEFAULT_DSN;
|
|---|
| 178 | } else {
|
|---|
| 179 | return;
|
|---|
| 180 | }
|
|---|
| 181 | }
|
|---|
| 182 | $objQuery = new SC_Query($dsn, true, true);
|
|---|
| 183 | $count = $objQuery->count($table_name, $where, $arrval);
|
|---|
| 184 |
|
|---|
| 185 | if($count > 0) {
|
|---|
| 186 | $ret = true;
|
|---|
| 187 | } else {
|
|---|
| 188 | $ret = false;
|
|---|
| 189 | }
|
|---|
| 190 | // ¥Ç¡¼¥¿¤òÄɲ乤ë
|
|---|
| 191 | if(!$ret && $add) {
|
|---|
| 192 | $objQuery->exec($sql);
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | return $ret;
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| 198 | /*
|
|---|
| 199 | * ¥µ¥¤¥È´ÉÍý¾ðÊ󤫤éÃͤò¼èÆÀ¤¹¤ë¡£
|
|---|
| 200 | * ¥Ç¡¼¥¿¤¬Â¸ºß¤¹¤ë¾ì¹ç¡¢É¬¤º1°Ê¾å¤Î¿ôÃͤ¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¡£
|
|---|
| 201 | * 0¤òÊÖ¤·¤¿¾ì¹ç¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤ÇÂбþ¤¹¤ë¤³¤È¡£
|
|---|
| 202 | *
|
|---|
| 203 | * @param $control_id ´ÉÍýID
|
|---|
| 204 | * @param $dsn DataSource
|
|---|
| 205 | * @return $control_flg ¥Õ¥é¥°
|
|---|
| 206 | */
|
|---|
| 207 | function sfGetSiteControlFlg($control_id, $dsn = "") {
|
|---|
| 208 |
|
|---|
| 209 | // ¥Ç¡¼¥¿¥½¡¼¥¹
|
|---|
| 210 | if($dsn == "") {
|
|---|
| 211 | if(defined('DEFAULT_DSN')) {
|
|---|
| 212 | $dsn = DEFAULT_DSN;
|
|---|
| 213 | } else {
|
|---|
| 214 | return;
|
|---|
| 215 | }
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 | // ¥¯¥¨¥êÀ¸À®
|
|---|
| 219 | $target_column = "control_flg";
|
|---|
| 220 | $table_name = "dtb_site_control";
|
|---|
| 221 | $where = "control_id = ?";
|
|---|
| 222 | $arrval = array($control_id);
|
|---|
| 223 | $control_flg = 0;
|
|---|
| 224 |
|
|---|
| 225 | // ¥¯¥¨¥êȯ¹Ô
|
|---|
| 226 | $objQuery = new SC_Query($dsn, true, true);
|
|---|
| 227 | $arrSiteControl = $objQuery->select($target_column, $table_name, $where, $arrval);
|
|---|
| 228 |
|
|---|
| 229 | // ¥Ç¡¼¥¿¤¬Â¸ºß¤¹¤ì¤Ð¥Õ¥é¥°¤ò¼èÆÀ¤¹¤ë
|
|---|
| 230 | if (count($arrSiteControl) > 0) {
|
|---|
| 231 | $control_flg = $arrSiteControl[0]["control_flg"];
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | return $control_flg;
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 | // ¥Æ¡¼¥Ö¥ë¤Î¥«¥é¥à°ìÍ÷¤ò¼èÆÀ¤¹¤ë
|
|---|
| 238 | function sfGetColumnList($table_name, $objQuery = "", $db_type = DB_TYPE){
|
|---|
| 239 | if($objQuery == "") $objQuery = new SC_Query();
|
|---|
| 240 | $arrRet = array();
|
|---|
| 241 |
|
|---|
| 242 | // postgresql¤Èmysql¤È¤Ç½èÍý¤òʬ¤±¤ë
|
|---|
| 243 | if ($db_type == "pgsql") {
|
|---|
| 244 | $sql = "SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname=? AND c.oid=a.attrelid AND a.attnum > 0 AND not a.attname like '........pg.dropped.%........' ORDER BY a.attnum";
|
|---|
| 245 | $arrColList = $objQuery->getAll($sql, array($table_name));
|
|---|
| 246 | $arrColList = sfswaparray($arrColList);
|
|---|
| 247 | $arrRet = $arrColList["attname"];
|
|---|
| 248 | }else if ($db_type == "mysql") {
|
|---|
| 249 | $sql = "SHOW COLUMNS FROM $table_name";
|
|---|
| 250 | $arrColList = $objQuery->getAll($sql);
|
|---|
| 251 | $arrColList = sfswaparray($arrColList);
|
|---|
| 252 | $arrRet = $arrColList["Field"];
|
|---|
| 253 | }
|
|---|
| 254 | return $arrRet;
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | // ¥¤¥ó¥¹¥È¡¼¥ë½é´ü½èÍý
|
|---|
| 258 | function sfInitInstall() {
|
|---|
| 259 | // ¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
|
|---|
| 260 | if(!defined('ECCUBE_INSTALL')) {
|
|---|
| 261 | if(!ereg("/install/", $_SERVER['PHP_SELF'])) {
|
|---|
| 262 | header("Location: ./install/");
|
|---|
| 263 | }
|
|---|
| 264 | } else {
|
|---|
| 265 | $path = HTML_PATH . "install/index.php";
|
|---|
| 266 | if(file_exists($path)) {
|
|---|
| 267 | sfErrorHeader(">> /install/index.php¤Ï¡¢¥¤¥ó¥¹¥È¡¼¥ë´°Î»¸å¤Ë¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡£");
|
|---|
| 268 | }
|
|---|
| 269 |
|
|---|
| 270 | // µì¥Ð¡¼¥¸¥ç¥ó¤Îinstall.php¤Î¥Á¥§¥Ã¥¯
|
|---|
| 271 | $path = HTML_PATH . "install.php";
|
|---|
| 272 | if(file_exists($path)) {
|
|---|
| 273 | sfErrorHeader(">> /install.php¤Ï¥»¥¥å¥ê¥Æ¥£¡¼¥Û¡¼¥ë¤È¤Ê¤ê¤Þ¤¹¡£ºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡£");
|
|---|
| 274 | }
|
|---|
| 275 | }
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | // ¥¢¥Ã¥×¥Ç¡¼¥È¤ÇÀ¸À®¤µ¤ì¤¿PHP¤òÆÉ¤ß½Ð¤·
|
|---|
| 279 | function sfLoadUpdateModule() {
|
|---|
| 280 | // URLÀßÄê¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü
|
|---|
| 281 | $main_php = ereg_replace(URL_DIR, "", $_SERVER['PHP_SELF']);
|
|---|
| 282 | $extern_php = UPDATE_PATH . $main_php;
|
|---|
| 283 | if(file_exists($extern_php)) {
|
|---|
| 284 | require_once($extern_php);
|
|---|
| 285 | }
|
|---|
| 286 | }
|
|---|
| 287 |
|
|---|
| 288 | function sf_getBasisData() {
|
|---|
| 289 | //DB¤«¤éÀßÄê¾ðÊó¤ò¼èÆÀ
|
|---|
| 290 | $objConn = new SC_DbConn(DEFAULT_DSN);
|
|---|
| 291 | $result = $objConn->getAll("SELECT * FROM dtb_baseinfo");
|
|---|
| 292 | if(is_array($result[0])) {
|
|---|
| 293 | foreach ( $result[0] as $key=>$value ){
|
|---|
| 294 | $CONF["$key"] = $value;
|
|---|
| 295 | }
|
|---|
| 296 | }
|
|---|
| 297 | return $CONF;
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 | // Áõ¾þÉÕ¤¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤Îɽ¼¨
|
|---|
| 301 | function sfErrorHeader($mess, $print = false) {
|
|---|
| 302 | global $GLOBAL_ERR;
|
|---|
| 303 | if($GLOBAL_ERR == "") {
|
|---|
| 304 | $GLOBAL_ERR = "<meta http-equiv='Content-Type' content='text/html; charset=" . CHAR_CODE . "'>\n";
|
|---|
| 305 | }
|
|---|
| 306 | $GLOBAL_ERR.= "<table width='100%' border='0' cellspacing='0' cellpadding='0' summary=' '>\n";
|
|---|
| 307 | $GLOBAL_ERR.= "<tr>\n";
|
|---|
| 308 | $GLOBAL_ERR.= "<td bgcolor='#ffeebb' height='25' colspan='2' align='center'>\n";
|
|---|
| 309 | $GLOBAL_ERR.= "<SPAN style='color:red; font-size:12px'><strong>" . $mess . "</strong></span>\n";
|
|---|
| 310 | $GLOBAL_ERR.= "</td>\n";
|
|---|
| 311 | $GLOBAL_ERR.= " </tr>\n";
|
|---|
| 312 | $GLOBAL_ERR.= "</table>\n";
|
|---|
| 313 |
|
|---|
| 314 | if($print) {
|
|---|
| 315 | print($GLOBAL_ERR);
|
|---|
| 316 | }
|
|---|
| 317 | }
|
|---|
| 318 |
|
|---|
| 319 | /* ¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨ */
|
|---|
| 320 | function sfDispError($type) {
|
|---|
| 321 |
|
|---|
| 322 | class LC_ErrorPage {
|
|---|
| 323 | function LC_ErrorPage() {
|
|---|
| 324 | $this->tpl_mainpage = 'login_error.tpl';
|
|---|
| 325 | $this->tpl_title = '¥¨¥é¡¼';
|
|---|
| 326 | }
|
|---|
| 327 | }
|
|---|
| 328 |
|
|---|
| 329 | $objPage = new LC_ErrorPage();
|
|---|
| 330 | $objView = new SC_AdminView();
|
|---|
| 331 |
|
|---|
| 332 | switch ($type) {
|
|---|
| 333 | case LOGIN_ERROR:
|
|---|
| 334 | $objPage->tpl_error="£É£Ä¤Þ¤¿¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />¤â¤¦°ìÅÙ¤´³Îǧ¤Î¤¦¤¨¡¢ºÆÅÙÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£";
|
|---|
| 335 | break;
|
|---|
| 336 | case ACCESS_ERROR:
|
|---|
| 337 | $objPage->tpl_error="¥í¥°¥¤¥óǧ¾Ú¤Î͸ú´ü¸ÂÀÚ¤ì¤Î²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£<br />¤â¤¦°ìÅÙ¤´³Îǧ¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
|
|---|
| 338 | break;
|
|---|
| 339 | case AUTH_ERROR:
|
|---|
| 340 | $objPage->tpl_error="¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ï¥¢¥¯¥»¥¹¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó¡£<br />¤â¤¦°ìÅÙ¤´³Îǧ¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
|
|---|
| 341 | break;
|
|---|
| 342 | case INVALID_MOVE_ERRORR:
|
|---|
| 343 | $objPage->tpl_error="ÉÔÀµ¤Ê¥Ú¡¼¥¸°Üư¤Ç¤¹¡£<br />¤â¤¦°ìÅÙ¤´³Îǧ¤Î¤¦¤¨¡¢ºÆÅÙÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£";
|
|---|
| 344 | break;
|
|---|
| 345 | default:
|
|---|
| 346 | $objPage->tpl_error="¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br />¤â¤¦°ìÅÙ¤´³Îǧ¤Î¤¦¤¨¡¢ºÆÅÙ¥í¥°¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£";
|
|---|
| 347 | break;
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | $objView->assignobj($objPage);
|
|---|
| 351 | $objView->display(LOGIN_FRAME);
|
|---|
| 352 |
|
|---|
| 353 | exit;
|
|---|
| 354 | }
|
|---|
| 355 |
|
|---|
| 356 | /* ¥µ¥¤¥È¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨ */
|
|---|
| 357 | function sfDispSiteError($type, $objSiteSess = "", $return_top = false, $err_msg = "", $is_mobile = false) {
|
|---|
| 358 | global $objCampaignSess;
|
|---|
| 359 |
|
|---|
| 360 | if ($objSiteSess != "") {
|
|---|
| 361 | $objSiteSess->setNowPage('error');
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | class LC_ErrorPage {
|
|---|
| 365 | function LC_ErrorPage() {
|
|---|
| 366 | $this->tpl_mainpage = 'error.tpl';
|
|---|
| 367 | $this->tpl_css = URL_DIR.'css/layout/error.css';
|
|---|
| 368 | $this->tpl_title = '¥¨¥é¡¼';
|
|---|
| 369 | }
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 | $objPage = new LC_ErrorPage();
|
|---|
| 373 |
|
|---|
| 374 | if($is_mobile === true) {
|
|---|
| 375 | $objView = new SC_MobileView();
|
|---|
| 376 | } else {
|
|---|
| 377 | $objView = new SC_SiteView();
|
|---|
| 378 | }
|
|---|
| 379 |
|
|---|
| 380 | switch ($type) {
|
|---|
| 381 | case PRODUCT_NOT_FOUND:
|
|---|
| 382 | $objPage->tpl_error="¤´»ØÄê¤Î¥Ú¡¼¥¸¤Ï¤´¤¶¤¤¤Þ¤»¤ó¡£";
|
|---|
| 383 | break;
|
|---|
| 384 | case PAGE_ERROR:
|
|---|
| 385 | $objPage->tpl_error="ÉÔÀµ¤Ê¥Ú¡¼¥¸°Üư¤Ç¤¹¡£";
|
|---|
| 386 | break;
|
|---|
| 387 | case CART_EMPTY:
|
|---|
| 388 | $objPage->tpl_error="¥«¡¼¥È¤Ë¾¦Éʤ¬¤¬¤¢¤ê¤Þ¤»¤ó¡£";
|
|---|
| 389 | break;
|
|---|
| 390 | case CART_ADD_ERROR:
|
|---|
| 391 | $objPage->tpl_error="¹ØÆþ½èÍýÃæ¤Ï¡¢¥«¡¼¥È¤Ë¾¦ÉʤòÄɲ乤뤳¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£";
|
|---|
| 392 | break;
|
|---|
| 393 | case CANCEL_PURCHASE:
|
|---|
| 394 | $objPage->tpl_error="¤³¤Î¼ê³¤¤Ï̵¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£°Ê²¼¤ÎÍ×°ø¤¬¹Í¤¨¤é¤ì¤Þ¤¹¡£<br />¡¦¥»¥Ã¥·¥ç¥ó¾ðÊó¤Î͸ú´ü¸Â¤¬ÀÚ¤ì¤Æ¤ë¾ì¹ç<br />¡¦¹ØÆþ¼ê³¤Ãæ¤Ë¿·¤·¤¤¹ØÆþ¼ê³¤¤ò¼Â¹Ô¤·¤¿¾ì¹ç<br />¡¦¤¹¤Ç¤Ë¹ØÆþ¼ê³¤¤ò´°Î»¤·¤Æ¤¤¤ë¾ì¹ç";
|
|---|
| 395 | break;
|
|---|
| 396 | case CATEGORY_NOT_FOUND:
|
|---|
| 397 | $objPage->tpl_error="¤´»ØÄê¤Î¥«¥Æ¥´¥ê¤Ï¸ºß¤·¤Þ¤»¤ó¡£";
|
|---|
| 398 | break;
|
|---|
| 399 | case SITE_LOGIN_ERROR:
|
|---|
| 400 | $objPage->tpl_error="¥á¡¼¥ë¥¢¥É¥ì¥¹¤â¤·¤¯¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£";
|
|---|
| 401 | break;
|
|---|
| 402 | case TEMP_LOGIN_ERROR:
|
|---|
| 403 | $objPage->tpl_error="¥á¡¼¥ë¥¢¥É¥ì¥¹¤â¤·¤¯¤Ï¥Ñ¥¹¥ï¡¼¥É¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£<br />ËÜÅÐÏ¿¤¬¤ªºÑ¤ß¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢²¾ÅÐÏ¿¥á¡¼¥ë¤ËµºÜ¤µ¤ì¤Æ¤¤¤ë<br />URL¤è¤êËÜÅÐÏ¿¤ò¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£";
|
|---|
| 404 | break;
|
|---|
| 405 | case CUSTOMER_ERROR:
|
|---|
| 406 | $objPage->tpl_error="ÉÔÀµ¤Ê¥¢¥¯¥»¥¹¤Ç¤¹¡£";
|
|---|
| 407 | break;
|
|---|
| 408 | case SOLD_OUT:
|
|---|
| 409 | $objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¤´¹ØÆþ¤ÎľÁ°¤ÇÇä¤êÀڤ줿¾¦Éʤ¬¤¢¤ê¤Þ¤¹¡£¤³¤Î¼ê³¤¤Ï̵¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
|
|---|
| 410 | break;
|
|---|
| 411 | case CART_NOT_FOUND:
|
|---|
| 412 | $objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¥«¡¼¥ÈÆâ¤Î¾¦ÉʾðÊó¤Î¼èÆÀ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£¤³¤Î¼ê³¤¤Ï̵¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
|
|---|
| 413 | break;
|
|---|
| 414 | case LACK_POINT:
|
|---|
| 415 | $objPage->tpl_error="¿½¤·Ìõ¤´¤¶¤¤¤Þ¤»¤ó¤¬¡¢¥Ý¥¤¥ó¥È¤¬ÉÔ¤·¤Æ¤ª¤ê¤Þ¤¹¡£¤³¤Î¼ê³¤¤Ï̵¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£";
|
|---|
| 416 | break;
|
|---|
| 417 | case FAVORITE_ERROR:
|
|---|
| 418 | $objPage->tpl_error="´û¤Ë¤ªµ¤¤ËÆþ¤ê¤ËÄɲäµ¤ì¤Æ¤¤¤ë¾¦ÉʤǤ¹¡£";
|
|---|
| 419 | break;
|
|---|
| 420 | case EXTRACT_ERROR:
|
|---|
| 421 | $objPage->tpl_error="¥Õ¥¡¥¤¥ë¤Î²òÅà¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\n»ØÄê¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë½ñ¤¹þ¤ß¸¢¸Â¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£";
|
|---|
| 422 | break;
|
|---|
| 423 | case FTP_DOWNLOAD_ERROR:
|
|---|
| 424 | $objPage->tpl_error="¥Õ¥¡¥¤¥ë¤ÎFTP¥À¥¦¥ó¥í¡¼¥É¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
|
|---|
| 425 | break;
|
|---|
| 426 | case FTP_LOGIN_ERROR:
|
|---|
| 427 | $objPage->tpl_error="FTP¥í¥°¥¤¥ó¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
|
|---|
| 428 | break;
|
|---|
| 429 | case FTP_CONNECT_ERROR:
|
|---|
| 430 | $objPage->tpl_error="FTP¥í¥°¥¤¥ó¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£";
|
|---|
| 431 | break;
|
|---|
| 432 | case CREATE_DB_ERROR:
|
|---|
| 433 | $objPage->tpl_error="DB¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\n»ØÄê¤Î¥æ¡¼¥¶¡¼¤Ë¤Ï¡¢DBºîÀ®¤Î¸¢¸Â¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£";
|
|---|
| 434 | break;
|
|---|
| 435 | case DB_IMPORT_ERROR:
|
|---|
| 436 | $objPage->tpl_error="¥Ç¡¼¥¿¥Ù¡¼¥¹¹½Â¤¤Î¥¤¥ó¥Ý¡¼¥È¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\nsql¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤Æ¤¤¤ë²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£";
|
|---|
| 437 | break;
|
|---|
| 438 | case FILE_NOT_FOUND:
|
|---|
| 439 | $objPage->tpl_error="»ØÄê¤Î¥Ñ¥¹¤Ë¡¢ÀßÄê¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤»¤ó¡£";
|
|---|
| 440 | break;
|
|---|
| 441 | case WRITE_FILE_ERROR:
|
|---|
| 442 | $objPage->tpl_error="ÀßÄê¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤á¤Þ¤»¤ó¡£\nÀßÄê¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤ß¸¢¸Â¤òÍ¿¤¨¤Æ¤¯¤À¤µ¤¤¡£";
|
|---|
| 443 | break;
|
|---|
| 444 | case FREE_ERROR_MSG:
|
|---|
| 445 | $objPage->tpl_error=$err_msg;
|
|---|
| 446 | break;
|
|---|
| 447 | default:
|
|---|
| 448 | $objPage->tpl_error="¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£";
|
|---|
| 449 | break;
|
|---|
| 450 | }
|
|---|
| 451 |
|
|---|
| 452 | $objPage->return_top = $return_top;
|
|---|
| 453 |
|
|---|
| 454 | $objView->assignobj($objPage);
|
|---|
| 455 |
|
|---|
| 456 | if(is_object($objCampaignSess)) {
|
|---|
| 457 | // ¥Õ¥ì¡¼¥à¤òÁªÂò(¥¥ã¥ó¥Ú¡¼¥ó¥Ú¡¼¥¸¤«¤éÁ«°Ü¤Ê¤éÊѹ¹)
|
|---|
| 458 | $objCampaignSess->pageView($objView);
|
|---|
| 459 | } else {
|
|---|
| 460 | $objView->display(SITE_FRAME);
|
|---|
| 461 | }
|
|---|
| 462 | exit;
|
|---|
| 463 | }
|
|---|
| 464 |
|
|---|
| 465 | /* ǧ¾Ú¤Î²ÄÈÝȽÄê */
|
|---|
| 466 | function sfIsSuccess($objSess, $disp_error = true) {
|
|---|
| 467 | $ret = $objSess->IsSuccess();
|
|---|
| 468 | if($ret != SUCCESS) {
|
|---|
| 469 | if($disp_error) {
|
|---|
| 470 | // ¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨
|
|---|
| 471 | sfDispError($ret);
|
|---|
| 472 | }
|
|---|
| 473 | return false;
|
|---|
| 474 | }
|
|---|
| 475 | // ¥ê¥Õ¥¡¥é¡¼¥Á¥§¥Ã¥¯(CSRF¤Î»ÃÄêŪ¤ÊÂкö)
|
|---|
| 476 | // ¡Ö¥ê¥Õ¥¡¥é̵¡× ¤Î¾ì¹ç¤Ï¥¹¥ë¡¼
|
|---|
| 477 | // ¡Ö¥ê¥Õ¥¡¥éÍ¡× ¤«¤Ä ¡Ö´ÉÍý²èÌ̤«¤é¤ÎÁ«°Ü¤Ç¤Ê¤¤¡× ¾ì¹ç¤Ë¥¨¥é¡¼²èÌ̤òɽ¼¨¤¹¤ë
|
|---|
| 478 | if ( empty($_SERVER['HTTP_REFERER']) ) {
|
|---|
| 479 | // ·Ù¹ðɽ¼¨¤µ¤»¤ë¡©
|
|---|
| 480 | // sfErrorHeader('>> referrer¤¬Ìµ¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£');
|
|---|
| 481 | } else {
|
|---|
| 482 | $domain = sfIsHTTPS() ? SSL_URL : SITE_URL;
|
|---|
| 483 | $pattern = sprintf('|^%s.*|', $domain);
|
|---|
| 484 | $referer = $_SERVER['HTTP_REFERER'];
|
|---|
| 485 |
|
|---|
| 486 | // ´ÉÍý²èÌ̤«¤é°Ê³°¤ÎÁ«°Ü¤Î¾ì¹ç¤Ï¥¨¥é¡¼²èÌ̤òɽ¼¨
|
|---|
| 487 | if (!preg_match($pattern, $referer)) {
|
|---|
| 488 | if ($disp_error) sfDispError(INVALID_MOVE_ERRORR);
|
|---|
| 489 | return false;
|
|---|
| 490 | }
|
|---|
| 491 | }
|
|---|
| 492 | return true;
|
|---|
| 493 | }
|
|---|
| 494 |
|
|---|
| 495 | /**
|
|---|
| 496 | * HTTPS¤«¤É¤¦¤«¤òȽÄê
|
|---|
| 497 | *
|
|---|
| 498 | * @return bool
|
|---|
| 499 | */
|
|---|
| 500 | function sfIsHTTPS () {
|
|---|
| 501 | // HTTPS»þ¤Ë¤Ï$_SERVER['HTTPS']¤Ë¤Ï¶õ¤Ç¤Ê¤¤Ãͤ¬Æþ¤ë
|
|---|
| 502 | // $_SERVER['HTTPS'] != 'off' ¤ÏIISÍÑ
|
|---|
| 503 | if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
|
|---|
| 504 | return true;
|
|---|
| 505 | } else {
|
|---|
| 506 | return false;
|
|---|
| 507 | }
|
|---|
| 508 | }
|
|---|
| 509 |
|
|---|
| 510 | /**
|
|---|
| 511 | * Àµµ¬¤ÎÁ«°Ü¤¬¤µ¤ì¤Æ¤¤¤ë¤«¤òȽÄê
|
|---|
| 512 | * Á°²èÌ̤Çuniqid¤òËä¤á¹þ¤ó¤Ç¤ª¤¯É¬Íפ¬¤¢¤ë
|
|---|
| 513 | * @param obj SC_Session, SC_SiteSession
|
|---|
| 514 | * @return bool
|
|---|
| 515 | */
|
|---|
| 516 | function sfIsValidTransition($objSess) {
|
|---|
| 517 | // Á°²èÌ̤«¤éPOST¤µ¤ì¤ëuniqid¤¬Àµ¤·¤¤¤â¤Î¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯
|
|---|
| 518 | $uniqid = $objSess->getUniqId();
|
|---|
| 519 | if ( !empty($_POST['uniqid']) && ($_POST['uniqid'] === $uniqid) ) {
|
|---|
| 520 | return true;
|
|---|
| 521 | } else {
|
|---|
| 522 | return false;
|
|---|
| 523 | }
|
|---|
| 524 | }
|
|---|
| 525 |
|
|---|
| 526 | /* Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¤¬¹Ô¤ï¤ì¤¿¤«È½Äê */
|
|---|
| 527 | function sfIsPrePage($objSiteSess, $is_mobile = false) {
|
|---|
| 528 | $ret = $objSiteSess->isPrePage();
|
|---|
| 529 | if($ret != true) {
|
|---|
| 530 | // ¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨
|
|---|
| 531 | sfDispSiteError(PAGE_ERROR, $objSiteSess, false, "", $is_mobile);
|
|---|
| 532 | }
|
|---|
| 533 | }
|
|---|
| 534 |
|
|---|
| 535 | function sfCheckNormalAccess($objSiteSess, $objCartSess) {
|
|---|
| 536 | // ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ
|
|---|
| 537 | $uniqid = $objSiteSess->getUniqId();
|
|---|
| 538 | // ¹ØÆþ¥Ü¥¿¥ó¤ò²¡¤·¤¿»þ¤Î¥«¡¼¥ÈÆâÍÆ¤¬¥³¥Ô¡¼¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¤ß¥³¥Ô¡¼¤¹¤ë¡£
|
|---|
| 539 | $objCartSess->saveCurrentCart($uniqid);
|
|---|
| 540 | // POST¤Î¥æ¥Ë¡¼¥¯ID¤È¥»¥Ã¥·¥ç¥ó¤Î¥æ¥Ë¡¼¥¯ID¤òÈæ³Ó(¥æ¥Ë¡¼¥¯ID¤¬POST¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥¹¥ë¡¼)
|
|---|
| 541 | $ret = $objSiteSess->checkUniqId();
|
|---|
| 542 |
|
|---|
| 543 | if($ret != true) {
|
|---|
| 544 | // ¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨
|
|---|
| 545 | sfDispSiteError(CANCEL_PURCHASE, $objSiteSess);
|
|---|
| 546 | }
|
|---|
| 547 |
|
|---|
| 548 | // ¥«¡¼¥ÈÆâ¤¬¶õ¤Ç¤Ê¤¤¤« || ¹ØÆþ¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤«¤éÊѲ½¤¬¤Ê¤¤¤«
|
|---|
| 549 | $quantity = $objCartSess->getTotalQuantity();
|
|---|
| 550 | $ret = $objCartSess->checkChangeCart();
|
|---|
| 551 | if($ret == true || !($quantity > 0)) {
|
|---|
| 552 | // ¥«¡¼¥È¾ðÊóɽ¼¨¤Ë¶¯À©°Üư¤¹¤ë
|
|---|
| 553 | header("Location: ".URL_CART_TOP);
|
|---|
| 554 | exit;
|
|---|
| 555 | }
|
|---|
| 556 | return $uniqid;
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | /* DBÍÑÆüÉÕʸ»úÎó¼èÆÀ */
|
|---|
| 560 | function sfGetTimestamp($year, $month, $day, $last = false) {
|
|---|
| 561 | if($year != "" && $month != "" && $day != "") {
|
|---|
| 562 | if($last) {
|
|---|
| 563 | $time = "23:59:59";
|
|---|
| 564 | } else {
|
|---|
| 565 | $time = "00:00:00";
|
|---|
| 566 | }
|
|---|
| 567 | $date = $year."-".$month."-".$day." ".$time;
|
|---|
| 568 | } else {
|
|---|
| 569 | $date = "";
|
|---|
| 570 | }
|
|---|
| 571 | return $date;
|
|---|
| 572 | }
|
|---|
| 573 |
|
|---|
| 574 | // INT·¿¤Î¿ôÃÍ¥Á¥§¥Ã¥¯
|
|---|
| 575 | function sfIsInt($value) {
|
|---|
| 576 | if($value != "" && strlen($value) <= INT_LEN && is_numeric($value)) {
|
|---|
| 577 | return true;
|
|---|
| 578 | }
|
|---|
| 579 | return false;
|
|---|
| 580 | }
|
|---|
| 581 |
|
|---|
| 582 | function sfCSVDownload($data, $prefix = ""){
|
|---|
| 583 |
|
|---|
| 584 | if($prefix == "") {
|
|---|
| 585 | $dir_name = sfUpDirName();
|
|---|
| 586 | $file_name = $dir_name . date("ymdHis") .".csv";
|
|---|
| 587 | } else {
|
|---|
| 588 | $file_name = $prefix . date("ymdHis") .".csv";
|
|---|
| 589 | }
|
|---|
| 590 |
|
|---|
| 591 | /* HTTP¥Ø¥Ã¥À¤Î½ÐÎÏ */
|
|---|
| 592 | Header("Content-disposition: attachment; filename=${file_name}");
|
|---|
| 593 | Header("Content-type: application/octet-stream; name=${file_name}");
|
|---|
| 594 | Header("Cache-Control: ");
|
|---|
| 595 | Header("Pragma: ");
|
|---|
| 596 |
|
|---|
| 597 | /* i18n¢· ¤À¤ÈÀµ¾ï¤Ëưºî¤·¤Ê¤¤¤¿¤á¡¢mb¢· ¤ËÊѹ¹
|
|---|
| 598 | if (i18n_discover_encoding($data) == CHAR_CODE){
|
|---|
| 599 | $data = i18n_convert($data,'SJIS',CHAR_CODE);
|
|---|
| 600 | }
|
|---|
| 601 | */
|
|---|
| 602 | if (mb_internal_encoding() == CHAR_CODE){
|
|---|
| 603 | $data = mb_convert_encoding($data,'SJIS',CHAR_CODE);
|
|---|
| 604 | }
|
|---|
| 605 |
|
|---|
| 606 | /* ¥Ç¡¼¥¿¤ò½ÐÎÏ */
|
|---|
| 607 | echo $data;
|
|---|
| 608 | }
|
|---|
| 609 |
|
|---|
| 610 | /* 1³¬Áؾå¤Î¥Ç¥£¥ì¥¯¥È¥ê̾¤ò¼èÆÀ¤¹¤ë */
|
|---|
| 611 | function sfUpDirName() {
|
|---|
| 612 | $path = $_SERVER['PHP_SELF'];
|
|---|
| 613 | $arrVal = split("/", $path);
|
|---|
| 614 | $cnt = count($arrVal);
|
|---|
| 615 | return $arrVal[($cnt - 2)];
|
|---|
| 616 | }
|
|---|
| 617 |
|
|---|
| 618 | // ¸½ºß¤Î¥µ¥¤¥È¤ò¹¹¿·¡Ê¤¿¤À¤·¥Ý¥¹¥È¤Ï¹Ô¤ï¤Ê¤¤¡Ë
|
|---|
| 619 | function sfReload($get = "") {
|
|---|
| 620 | if ($_SERVER["SERVER_PORT"] == "443" ){
|
|---|
| 621 | $url = ereg_replace(URL_DIR . "$", "", SSL_URL);
|
|---|
| 622 | } else {
|
|---|
| 623 | $url = ereg_replace(URL_DIR . "$", "", SITE_URL);
|
|---|
| 624 | }
|
|---|
| 625 |
|
|---|
| 626 | if($get != "") {
|
|---|
| 627 | header("Location: ". $url . $_SERVER['PHP_SELF'] . "?" . $get);
|
|---|
| 628 | } else {
|
|---|
| 629 | header("Location: ". $url . $_SERVER['PHP_SELF']);
|
|---|
| 630 | }
|
|---|
| 631 | exit;
|
|---|
| 632 | }
|
|---|
| 633 |
|
|---|
| 634 | // ¥é¥ó¥¥ó¥°¤ò¾å¤²¤ë¡£
|
|---|
| 635 | function sfRankUp($table, $colname, $id, $andwhere = "") {
|
|---|
| 636 | $objQuery = new SC_Query();
|
|---|
| 637 | $objQuery->begin();
|
|---|
| 638 | $where = "$colname = ?";
|
|---|
| 639 | if($andwhere != "") {
|
|---|
| 640 | $where.= " AND $andwhere";
|
|---|
| 641 | }
|
|---|
| 642 | // ÂоݹàÌܤΥé¥ó¥¯¤ò¼èÆÀ
|
|---|
| 643 | $rank = $objQuery->get($table, "rank", $where, array($id));
|
|---|
| 644 | // ¥é¥ó¥¯¤ÎºÇÂçÃͤò¼èÆÀ
|
|---|
| 645 | $maxrank = $objQuery->max($table, "rank", $andwhere);
|
|---|
| 646 | // ¥é¥ó¥¯¤¬ºÇÂçÃͤè¤ê¤â¾®¤µ¤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
|
|---|
| 647 | if($rank < $maxrank) {
|
|---|
| 648 | // ¥é¥ó¥¯¤¬°ì¤Ä¾å¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
|
|---|
| 649 | $where = "rank = ?";
|
|---|
| 650 | if($andwhere != "") {
|
|---|
| 651 | $where.= " AND $andwhere";
|
|---|
| 652 | }
|
|---|
| 653 | $uprank = $rank + 1;
|
|---|
| 654 | $up_id = $objQuery->get($table, $colname, $where, array($uprank));
|
|---|
| 655 | // ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
|
|---|
| 656 | $sqlup = "UPDATE $table SET rank = ?, update_date = Now() WHERE $colname = ?";
|
|---|
| 657 | $objQuery->exec($sqlup, array($rank + 1, $id));
|
|---|
| 658 | $objQuery->exec($sqlup, array($rank, $up_id));
|
|---|
| 659 | }
|
|---|
| 660 | $objQuery->commit();
|
|---|
| 661 | }
|
|---|
| 662 |
|
|---|
| 663 | // ¥é¥ó¥¥ó¥°¤ò²¼¤²¤ë¡£
|
|---|
| 664 | function sfRankDown($table, $colname, $id, $andwhere = "") {
|
|---|
| 665 | $objQuery = new SC_Query();
|
|---|
| 666 | $objQuery->begin();
|
|---|
| 667 | $where = "$colname = ?";
|
|---|
| 668 | if($andwhere != "") {
|
|---|
| 669 | $where.= " AND $andwhere";
|
|---|
| 670 | }
|
|---|
| 671 | // ÂоݹàÌܤΥé¥ó¥¯¤ò¼èÆÀ
|
|---|
| 672 | $rank = $objQuery->get($table, "rank", $where, array($id));
|
|---|
| 673 |
|
|---|
| 674 | // ¥é¥ó¥¯¤¬1(ºÇ¾®ÃÍ)¤è¤ê¤âÂ礤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£
|
|---|
| 675 | if($rank > 1) {
|
|---|
| 676 | // ¥é¥ó¥¯¤¬°ì¤Ä²¼¤ÎID¤ò¼èÆÀ¤¹¤ë¡£
|
|---|
| 677 | $where = "rank = ?";
|
|---|
| 678 | if($andwhere != "") {
|
|---|
| 679 | $where.= " AND $andwhere";
|
|---|
| 680 | }
|
|---|
| 681 | $downrank = $rank - 1;
|
|---|
| 682 | $down_id = $objQuery->get($table, $colname, $where, array($downrank));
|
|---|
| 683 | // ¥é¥ó¥¯Æþ¤ìÂØ¤¨¤Î¼Â¹Ô
|
|---|
| 684 | $sqlup = "UPDATE $table SET rank = ?, update_date = Now() WHERE $colname = ?";
|
|---|
| 685 | $objQuery->exec($sqlup, array($rank - 1, $id));
|
|---|
| 686 | $objQuery->exec($sqlup, array($rank, $down_id));
|
|---|
| 687 | }
|
|---|
| 688 | $objQuery->commit();
|
|---|
| 689 | }
|
|---|
| 690 |
|
|---|
| 691 | //----¡¡»ØÄê½ç°Ì¤Ø°Üư
|
|---|
| 692 | function sfMoveRank($tableName, $keyIdColumn, $keyId, $pos, $where = "") {
|
|---|
| 693 | $objQuery = new SC_Query();
|
|---|
| 694 | $objQuery->begin();
|
|---|
| 695 |
|
|---|
| 696 | // ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë
|
|---|
| 697 | $rank = $objQuery->get($tableName, "rank", "$keyIdColumn = ?", array($keyId));
|
|---|
| 698 | $max = $objQuery->max($tableName, "rank", $where);
|
|---|
| 699 |
|
|---|
| 700 | // ÃͤÎÄ´À°¡ÊµÕ½ç¡Ë
|
|---|
| 701 | if($pos > $max) {
|
|---|
| 702 | $position = 1;
|
|---|
| 703 | } else if($pos < 1) {
|
|---|
| 704 | $position = $max;
|
|---|
| 705 | } else {
|
|---|
| 706 | $position = $max - $pos + 1;
|
|---|
| 707 | }
|
|---|
| 708 |
|
|---|
| 709 | if( $position > $rank ) $term = "rank - 1"; //Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤êÂ礤¤¾ì¹ç
|
|---|
| 710 | if( $position < $rank ) $term = "rank + 1"; //Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤ê¾®¤µ¤¤¾ì¹ç
|
|---|
| 711 |
|
|---|
| 712 | //--¡¡»ØÄꤷ¤¿½ç°Ì¤Î¾¦Éʤ«¤é°Üư¤µ¤»¤ë¾¦ÉʤޤǤÎrank¤ò£±¤Ä¤º¤é¤¹
|
|---|
| 713 | $sql = "UPDATE $tableName SET rank = $term, update_date = NOW() WHERE rank BETWEEN ? AND ? AND del_flg = 0";
|
|---|
| 714 | if($where != "") {
|
|---|
| 715 | $sql.= " AND $where";
|
|---|
| 716 | }
|
|---|
| 717 |
|
|---|
| 718 | if( $position > $rank ) $objQuery->exec( $sql, array( $rank + 1, $position ));
|
|---|
| 719 | if( $position < $rank ) $objQuery->exec( $sql, array( $position, $rank - 1 ));
|
|---|
| 720 |
|
|---|
| 721 | //-- »ØÄꤷ¤¿½ç°Ì¤Ørank¤ò½ñ¤´¹¤¨¤ë¡£
|
|---|
| 722 | $sql = "UPDATE $tableName SET rank = ?, update_date = NOW() WHERE $keyIdColumn = ? AND del_flg = 0 ";
|
|---|
| 723 | if($where != "") {
|
|---|
| 724 | $sql.= " AND $where";
|
|---|
| 725 | }
|
|---|
| 726 |
|
|---|
| 727 | $objQuery->exec( $sql, array( $position, $keyId ) );
|
|---|
| 728 | $objQuery->commit();
|
|---|
| 729 | }
|
|---|
| 730 |
|
|---|
| 731 | // ¥é¥ó¥¯¤ò´Þ¤à¥ì¥³¡¼¥É¤Îºï½ü
|
|---|
| 732 | // ¥ì¥³¡¼¥É¤´¤Èºï½ü¤¹¤ë¾ì¹ç¤Ï¡¢$delete¤òtrue¤Ë¤¹¤ë¡£
|
|---|
| 733 | function sfDeleteRankRecord($table, $colname, $id, $andwhere = "", $delete = false) {
|
|---|
| 734 | $objQuery = new SC_Query();
|
|---|
| 735 | $objQuery->begin();
|
|---|
| 736 | // ºï½ü¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
|
|---|
| 737 | $where = "$colname = ?";
|
|---|
| 738 | if($andwhere != "") {
|
|---|
| 739 | $where.= " AND $andwhere";
|
|---|
| 740 | }
|
|---|
| 741 | $rank = $objQuery->get($table, "rank", $where, array($id));
|
|---|
| 742 |
|
|---|
| 743 | if(!$delete) {
|
|---|
| 744 | // ¥é¥ó¥¯¤òºÇ²¼°Ì¤Ë¤¹¤ë¡¢DEL¥Õ¥é¥°ON
|
|---|
| 745 | $sqlup = "UPDATE $table SET rank = 0, del_flg = 1, update_date = Now() ";
|
|---|
| 746 | $sqlup.= "WHERE $colname = ?";
|
|---|
| 747 | // UPDATE¤Î¼Â¹Ô
|
|---|
| 748 | $objQuery->exec($sqlup, array($id));
|
|---|
| 749 | } else {
|
|---|
| 750 | $objQuery->delete($table, "$colname = ?", array($id));
|
|---|
| 751 | }
|
|---|
| 752 |
|
|---|
| 753 | // Äɲå쥳¡¼¥É¤Î¥é¥ó¥¯¤è¤ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä¤º¤é¤¹¡£
|
|---|
| 754 | $where = "rank > ?";
|
|---|
| 755 | if($andwhere != "") {
|
|---|
| 756 | $where.= " AND $andwhere";
|
|---|
| 757 | }
|
|---|
| 758 | $sqlup = "UPDATE $table SET rank = (rank - 1) WHERE $where";
|
|---|
| 759 | $objQuery->exec($sqlup, array($rank));
|
|---|
| 760 | $objQuery->commit();
|
|---|
| 761 | }
|
|---|
| 762 |
|
|---|
| 763 | // ¥ì¥³¡¼¥É¤Î¸ºß¥Á¥§¥Ã¥¯
|
|---|
| 764 | function sfIsRecord($table, $col, $arrval, $addwhere = "") {
|
|---|
| 765 | $objQuery = new SC_Query();
|
|---|
| 766 | $arrCol = split("[, ]", $col);
|
|---|
| 767 |
|
|---|
| 768 | $where = "del_flg = 0";
|
|---|
| 769 |
|
|---|
| 770 | if($addwhere != "") {
|
|---|
| 771 | $where.= " AND $addwhere";
|
|---|
| 772 | }
|
|---|
| 773 |
|
|---|
| 774 | foreach($arrCol as $val) {
|
|---|
| 775 | if($val != "") {
|
|---|
| 776 | if($where == "") {
|
|---|
| 777 | $where = "$val = ?";
|
|---|
| 778 | } else {
|
|---|
| 779 | $where.= " AND $val = ?";
|
|---|
| 780 | }
|
|---|
| 781 | }
|
|---|
| 782 | }
|
|---|
| 783 | $ret = $objQuery->get($table, $col, $where, $arrval);
|
|---|
| 784 |
|
|---|
| 785 | if($ret != "") {
|
|---|
| 786 | return true;
|
|---|
| 787 | }
|
|---|
| 788 | return false;
|
|---|
| 789 | }
|
|---|
| 790 |
|
|---|
| 791 | // ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃͤò¥Þ¡¼¥¸
|
|---|
| 792 | function sfMergeCBValue($keyname, $max) {
|
|---|
| 793 | $conv = "";
|
|---|
| 794 | $cnt = 1;
|
|---|
| 795 | for($cnt = 1; $cnt <= $max; $cnt++) {
|
|---|
| 796 | if ($_POST[$keyname . $cnt] == "1") {
|
|---|
| 797 | $conv.= "1";
|
|---|
| 798 | } else {
|
|---|
| 799 | $conv.= "0";
|
|---|
| 800 | }
|
|---|
| 801 | }
|
|---|
| 802 | return $conv;
|
|---|
| 803 | }
|
|---|
| 804 |
|
|---|
| 805 | // html_checkboxes¤ÎÃͤò¥Þ¡¼¥¸¤·¤Æ2¿Ê¿ô·Á¼°¤ËÊѹ¹¤¹¤ë¡£
|
|---|
| 806 | function sfMergeCheckBoxes($array, $max) {
|
|---|
| 807 | $ret = "";
|
|---|
| 808 | if(is_array($array)) {
|
|---|
| 809 | foreach($array as $val) {
|
|---|
| 810 | $arrTmp[$val] = "1";
|
|---|
| 811 | }
|
|---|
| 812 | }
|
|---|
| 813 | for($i = 1; $i <= $max; $i++) {
|
|---|
| 814 | if($arrTmp[$i] == "1") {
|
|---|
| 815 | $ret.= "1";
|
|---|
| 816 | } else {
|
|---|
| 817 | $ret.= "0";
|
|---|
| 818 | }
|
|---|
| 819 | }
|
|---|
| 820 | return $ret;
|
|---|
| 821 | }
|
|---|
| 822 |
|
|---|
| 823 |
|
|---|
| 824 | // html_checkboxes¤ÎÃͤò¥Þ¡¼¥¸¤·¤Æ¡Ö-¡×¤Ç¤Ä¤Ê¤²¤ë¡£
|
|---|
| 825 | function sfMergeParamCheckBoxes($array) {
|
|---|
| 826 | $ret = '';
|
|---|
| 827 | if(is_array($array)) {
|
|---|
| 828 | foreach($array as $val) {
|
|---|
| 829 | if($ret != "") {
|
|---|
| 830 | $ret.= "-$val";
|
|---|
| 831 | } else {
|
|---|
| 832 | $ret = $val;
|
|---|
| 833 | }
|
|---|
| 834 | }
|
|---|
| 835 | } else {
|
|---|
| 836 | $ret = $array;
|
|---|
| 837 | }
|
|---|
| 838 | return $ret;
|
|---|
| 839 | }
|
|---|
| 840 |
|
|---|
| 841 | // html_checkboxes¤ÎÃͤò¥Þ¡¼¥¸¤·¤ÆSQL¸¡º÷ÍѤËÊѹ¹¤¹¤ë¡£
|
|---|
| 842 | function sfSearchCheckBoxes($array) {
|
|---|
| 843 | $max = 0;
|
|---|
| 844 | $ret = "";
|
|---|
| 845 | foreach($array as $val) {
|
|---|
| 846 | $arrTmp[$val] = "1";
|
|---|
| 847 | if($val > $max) {
|
|---|
| 848 | $max = $val;
|
|---|
| 849 | }
|
|---|
| 850 | }
|
|---|
| 851 | for($i = 1; $i <= $max; $i++) {
|
|---|
| 852 | if($arrTmp[$i] == "1") {
|
|---|
| 853 | $ret.= "1";
|
|---|
| 854 | } else {
|
|---|
| 855 | $ret.= "_";
|
|---|
| 856 | }
|
|---|
| 857 | }
|
|---|
| 858 |
|
|---|
| 859 | if($ret != "") {
|
|---|
| 860 | $ret.= "%";
|
|---|
| 861 | }
|
|---|
| 862 | return $ret;
|
|---|
| 863 | }
|
|---|
| 864 |
|
|---|
| 865 | // 2¿Ê¿ô·Á¼°¤ÎÃͤòhtml_checkboxesÂбþ¤ÎÃͤËÀÚ¤êÂØ¤¨¤ë
|
|---|
| 866 | function sfSplitCheckBoxes($val) {
|
|---|
| 867 | $len = strlen($val);
|
|---|
| 868 | for($i = 0; $i < $len; $i++) {
|
|---|
| 869 | if(substr($val, $i, 1) == "1") {
|
|---|
| 870 | $arrRet[] = ($i + 1);
|
|---|
| 871 | }
|
|---|
| 872 | }
|
|---|
| 873 | return $arrRet;
|
|---|
| 874 | }
|
|---|
| 875 |
|
|---|
| 876 | // ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃͤò¥Þ¡¼¥¸
|
|---|
| 877 | function sfMergeCBSearchValue($keyname, $max) {
|
|---|
| 878 | $conv = "";
|
|---|
| 879 | $cnt = 1;
|
|---|
| 880 | for($cnt = 1; $cnt <= $max; $cnt++) {
|
|---|
| 881 | if ($_POST[$keyname . $cnt] == "1") {
|
|---|
| 882 | $conv.= "1";
|
|---|
| 883 | } else {
|
|---|
| 884 | $conv.= "_";
|
|---|
| 885 | }
|
|---|
| 886 | }
|
|---|
| 887 | return $conv;
|
|---|
| 888 | }
|
|---|
| 889 |
|
|---|
| 890 | // ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃͤòʬ²ò
|
|---|
| 891 | function sfSplitCBValue($val, $keyname = "") {
|
|---|
| 892 | $len = strlen($val);
|
|---|
| 893 | $no = 1;
|
|---|
| 894 | for ($cnt = 0; $cnt < $len; $cnt++) {
|
|---|
| 895 | if($keyname != "") {
|
|---|
| 896 | $arr[$keyname . $no] = substr($val, $cnt, 1);
|
|---|
| 897 | } else {
|
|---|
| 898 | $arr[] = substr($val, $cnt, 1);
|
|---|
| 899 | }
|
|---|
| 900 | $no++;
|
|---|
| 901 | }
|
|---|
| 902 | return $arr;
|
|---|
| 903 | }
|
|---|
| 904 |
|
|---|
| 905 | // ¥¡¼¤ÈÃͤò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ
|
|---|
| 906 | function sfArrKeyValue($arrList, $keyname, $valname, $len_max = "", $keysize = "") {
|
|---|
| 907 |
|
|---|
| 908 | $max = count($arrList);
|
|---|
| 909 |
|
|---|
| 910 | if($len_max != "" && $max > $len_max) {
|
|---|
| 911 | $max = $len_max;
|
|---|
| 912 | }
|
|---|
| 913 |
|
|---|
| 914 | for($cnt = 0; $cnt < $max; $cnt++) {
|
|---|
| 915 | if($keysize != "") {
|
|---|
| 916 | $key = sfCutString($arrList[$cnt][$keyname], $keysize);
|
|---|
| 917 | } else {
|
|---|
| 918 | $key = $arrList[$cnt][$keyname];
|
|---|
| 919 | }
|
|---|
| 920 | $val = $arrList[$cnt][$valname];
|
|---|
| 921 |
|
|---|
| 922 | if(!isset($arrRet[$key])) {
|
|---|
| 923 | $arrRet[$key] = $val;
|
|---|
| 924 | }
|
|---|
| 925 |
|
|---|
| 926 | }
|
|---|
| 927 | return $arrRet;
|
|---|
| 928 | }
|
|---|
| 929 |
|
|---|
| 930 | // ¥¡¼¤ÈÃͤò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ(Ãͤ¬Ê£¿ô¤Î¾ì¹ç)
|
|---|
| 931 | function sfArrKeyValues($arrList, $keyname, $valname, $len_max = "", $keysize = "", $connect = "") {
|
|---|
| 932 |
|
|---|
| 933 | $max = count($arrList);
|
|---|
| 934 |
|
|---|
| 935 | if($len_max != "" && $max > $len_max) {
|
|---|
| 936 | $max = $len_max;
|
|---|
| 937 | }
|
|---|
| 938 |
|
|---|
| 939 | for($cnt = 0; $cnt < $max; $cnt++) {
|
|---|
| 940 | if($keysize != "") {
|
|---|
| 941 | $key = sfCutString($arrList[$cnt][$keyname], $keysize);
|
|---|
| 942 | } else {
|
|---|
| 943 | $key = $arrList[$cnt][$keyname];
|
|---|
| 944 | }
|
|---|
| 945 | $val = $arrList[$cnt][$valname];
|
|---|
| 946 |
|
|---|
| 947 | if($connect != "") {
|
|---|
| 948 | $arrRet[$key].= "$val".$connect;
|
|---|
| 949 | } else {
|
|---|
| 950 | $arrRet[$key][] = $val;
|
|---|
| 951 | }
|
|---|
| 952 | }
|
|---|
| 953 | return $arrRet;
|
|---|
| 954 | }
|
|---|
| 955 |
|
|---|
| 956 | // ÇÛÎó¤ÎÃͤò¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊÖ¤¹¡£
|
|---|
| 957 | function sfGetCommaList($array, $space=true) {
|
|---|
| 958 | if (count($array) > 0) {
|
|---|
| 959 | $line = "";
|
|---|
| 960 | foreach($array as $val) {
|
|---|
| 961 | if ($space) {
|
|---|
| 962 | $line .= $val . ", ";
|
|---|
| 963 | }else{
|
|---|
| 964 | $line .= $val . ",";
|
|---|
| 965 | }
|
|---|
| 966 | }
|
|---|
| 967 | if ($space) {
|
|---|
| 968 | $line = ereg_replace(", $", "", $line);
|
|---|
| 969 | }else{
|
|---|
| 970 | $line = ereg_replace(",$", "", $line);
|
|---|
| 971 | }
|
|---|
| 972 | return $line;
|
|---|
| 973 | }else{
|
|---|
| 974 | return false;
|
|---|
| 975 | }
|
|---|
| 976 |
|
|---|
| 977 | }
|
|---|
| 978 |
|
|---|
| 979 | /* ÇÛÎó¤ÎÍ×ÁǤòCSV¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎϤ¹¤ë¡£*/
|
|---|
| 980 | function sfGetCSVList($array) {
|
|---|
| 981 | if (count($array) > 0) {
|
|---|
| 982 | foreach($array as $key => $val) {
|
|---|
| 983 | $val = mb_convert_encoding($val, CHAR_CODE, CHAR_CODE);
|
|---|
| 984 | $line .= "\"".$val."\",";
|
|---|
| 985 | }
|
|---|
| 986 | $line = ereg_replace(",$", "\n", $line);
|
|---|
| 987 | }else{
|
|---|
| 988 | return false;
|
|---|
| 989 | }
|
|---|
| 990 | return $line;
|
|---|
| 991 | }
|
|---|
| 992 |
|
|---|
| 993 | /* ÇÛÎó¤ÎÍ×ÁǤòPDF¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç½ÐÎϤ¹¤ë¡£*/
|
|---|
| 994 | function sfGetPDFList($array) {
|
|---|
| 995 | foreach($array as $key => $val) {
|
|---|
| 996 | $line .= "\t".$val;
|
|---|
| 997 | }
|
|---|
| 998 | $line.="\n";
|
|---|
| 999 | return $line;
|
|---|
| 1000 | }
|
|---|
| 1001 |
|
|---|
| 1002 |
|
|---|
| 1003 |
|
|---|
| 1004 | /*-----------------------------------------------------------------*/
|
|---|
| 1005 | /* check_set_term
|
|---|
| 1006 | /* ǯ·îÆü¤ËÊ̤줿2¤Ä¤Î´ü´Ö¤ÎÂÅÅöÀ¤ò¥Á¥§¥Ã¥¯¤·¡¢À°¹çÀ¤È´ü´Ö¤òÊÖ¤¹
|
|---|
| 1007 | /*¡¡°ú¿ô (³«»Ïǯ,³«»Ï·î,³«»ÏÆü,½ªÎ»Ç¯,½ªÎ»·î,½ªÎ»Æü)
|
|---|
| 1008 | /*¡¡ÌáÃÍ array(£±¡¤£²¡¤£³¡Ë
|
|---|
| 1009 | /* £±¡¥³«»Ïǯ·îÆü (YYYY/MM/DD 000000)
|
|---|
| 1010 | /* £²¡¥½ªÎ»Ç¯·îÆü (YYYY/MM/DD 235959)
|
|---|
| 1011 | /* £³¡¥¥¨¥é¡¼ ( 0 = OK, 1 = NG )
|
|---|
| 1012 | /*-----------------------------------------------------------------*/
|
|---|
| 1013 | function sfCheckSetTerm ( $start_year, $start_month, $start_day, $end_year, $end_month, $end_day ) {
|
|---|
| 1014 |
|
|---|
| 1015 | // ´ü´Ö»ØÄê
|
|---|
| 1016 | $error = 0;
|
|---|
| 1017 | if ( $start_month || $start_day || $start_year){
|
|---|
| 1018 | if ( ! checkdate($start_month, $start_day , $start_year) ) $error = 1;
|
|---|
| 1019 | } else {
|
|---|
| 1020 | $error = 1;
|
|---|
| 1021 | }
|
|---|
| 1022 | if ( $end_month || $end_day || $end_year){
|
|---|
| 1023 | if ( ! checkdate($end_month ,$end_day ,$end_year) ) $error = 2;
|
|---|
| 1024 | }
|
|---|
| 1025 | if ( ! $error ){
|
|---|
| 1026 | $date1 = $start_year ."/".sprintf("%02d",$start_month) ."/".sprintf("%02d",$start_day) ." 000000";
|
|---|
| 1027 | $date2 = $end_year ."/".sprintf("%02d",$end_month) ."/".sprintf("%02d",$end_day) ." 235959";
|
|---|
| 1028 | if ($date1 > $date2) $error = 3;
|
|---|
| 1029 | } else {
|
|---|
| 1030 | $error = 1;
|
|---|
| 1031 | }
|
|---|
| 1032 | return array($date1, $date2, $error);
|
|---|
| 1033 | }
|
|---|
| 1034 |
|
|---|
| 1035 | // ¥¨¥é¡¼²Õ½ê¤ÎÇØ·Ê¿§¤òÊѹ¹¤¹¤ë¤¿¤á¤Îfunction SC_View¤ÇÆÉ¤ß¹þ¤à
|
|---|
| 1036 | function sfSetErrorStyle(){
|
|---|
| 1037 | return 'style="background-color:'.ERR_COLOR.'"';
|
|---|
| 1038 | }
|
|---|
| 1039 |
|
|---|
| 1040 | /* DB¤ËÅϤ¹¿ôÃͤΥÁ¥§¥Ã¥¯
|
|---|
| 1041 | * 10·å°Ê¾å¤Ï¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥¨¥é¡¼¤òµ¯¤³¤¹¤Î¤Ç¡£
|
|---|
| 1042 | */
|
|---|
| 1043 | function sfCheckNumLength( $value ){
|
|---|
| 1044 | if ( ! is_numeric($value) ){
|
|---|
| 1045 | return false;
|
|---|
| 1046 | }
|
|---|
| 1047 |
|
|---|
| 1048 | if ( strlen($value) > 9 ) {
|
|---|
| 1049 | return false;
|
|---|
| 1050 | }
|
|---|
| 1051 |
|
|---|
| 1052 | return true;
|
|---|
| 1053 | }
|
|---|
| 1054 |
|
|---|
| 1055 | // °ìÃפ·¤¿ÃͤΥ¡¼Ì¾¤ò¼èÆÀ
|
|---|
| 1056 | function sfSearchKey($array, $word, $default) {
|
|---|
| 1057 | foreach($array as $key => $val) {
|
|---|
| 1058 | if($val == $word) {
|
|---|
| 1059 | return $key;
|
|---|
| 1060 | }
|
|---|
| 1061 | }
|
|---|
| 1062 | return $default;
|
|---|
| 1063 | }
|
|---|
| 1064 |
|
|---|
| 1065 | // ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ($products_check:true¾¦ÉÊÅÐÏ¿ºÑ¤ß¤Î¤â¤Î¤À¤±¼èÆÀ)
|
|---|
| 1066 | function sfGetCategoryList($addwhere = "", $products_check = false, $head = CATEGORY_HEAD) {
|
|---|
| 1067 | $objQuery = new SC_Query();
|
|---|
| 1068 | $where = "del_flg = 0";
|
|---|
| 1069 |
|
|---|
| 1070 | if($addwhere != "") {
|
|---|
| 1071 | $where.= " AND $addwhere";
|
|---|
| 1072 | }
|
|---|
| 1073 |
|
|---|
| 1074 | $objQuery->setoption("ORDER BY rank DESC");
|
|---|
| 1075 |
|
|---|
| 1076 | if($products_check) {
|
|---|
| 1077 | $col = "T1.category_id, category_name, level";
|
|---|
| 1078 | $from = "dtb_category AS T1 LEFT JOIN dtb_category_total_count AS T2 ON T1.category_id = T2.category_id";
|
|---|
| 1079 | $where .= " AND product_count > 0";
|
|---|
| 1080 | } else {
|
|---|
| 1081 | $col = "category_id, category_name, level";
|
|---|
| 1082 | $from = "dtb_category";
|
|---|
| 1083 | }
|
|---|
| 1084 |
|
|---|
| 1085 | $arrRet = $objQuery->select($col, $from, $where);
|
|---|
| 1086 |
|
|---|
| 1087 | $max = count($arrRet);
|
|---|
| 1088 | for($cnt = 0; $cnt < $max; $cnt++) {
|
|---|
| 1089 | $id = $arrRet[$cnt]['category_id'];
|
|---|
| 1090 | $name = $arrRet[$cnt]['category_name'];
|
|---|
| 1091 | $arrList[$id] = "";
|
|---|
| 1092 | /*
|
|---|
| 1093 | for($n = 1; $n < $arrRet[$cnt]['level']; $n++) {
|
|---|
| 1094 | $arrList[$id].= "¡¡";
|
|---|
| 1095 | }
|
|---|
| 1096 | */
|
|---|
| 1097 | for($cat_cnt = 0; $cat_cnt < $arrRet[$cnt]['level']; $cat_cnt++) {
|
|---|
| 1098 | $arrList[$id].= $head;
|
|---|
| 1099 | }
|
|---|
| 1100 | $arrList[$id].= $name;
|
|---|
| 1101 | }
|
|---|
| 1102 | return $arrList;
|
|---|
| 1103 | }
|
|---|
| 1104 |
|
|---|
| 1105 | // ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ¡Ê¿Æ¥«¥Æ¥´¥ê¤ÎValue:0)
|
|---|
| 1106 | function sfGetLevelCatList($parent_zero = true) {
|
|---|
| 1107 | $objQuery = new SC_Query();
|
|---|
| 1108 | $col = "category_id, category_name, level";
|
|---|
| 1109 | $where = "del_flg = 0";
|
|---|
| 1110 | $objQuery->setoption("ORDER BY rank DESC");
|
|---|
| 1111 | $arrRet = $objQuery->select($col, "dtb_category", $where);
|
|---|
| 1112 | $max = count($arrRet);
|
|---|
| 1113 |
|
|---|
| 1114 | for($cnt = 0; $cnt < $max; $cnt++) {
|
|---|
| 1115 | if($parent_zero) {
|
|---|
| 1116 | if($arrRet[$cnt]['level'] == LEVEL_MAX) {
|
|---|
| 1117 | $arrValue[$cnt] = $arrRet[$cnt]['category_id'];
|
|---|
| 1118 | } else {
|
|---|
| 1119 | $arrValue[$cnt] = "";
|
|---|
| 1120 | }
|
|---|
| 1121 | } else {
|
|---|
| 1122 | $arrValue[$cnt] = $arrRet[$cnt]['category_id'];
|
|---|
| 1123 | }
|
|---|
| 1124 |
|
|---|
| 1125 | $arrOutput[$cnt] = "";
|
|---|
| 1126 | /*
|
|---|
| 1127 | for($n = 1; $n < $arrRet[$cnt]['level']; $n++) {
|
|---|
| 1128 | $arrOutput[$cnt].= "¡¡";
|
|---|
| 1129 | }
|
|---|
| 1130 | */
|
|---|
| 1131 | for($cat_cnt = 0; $cat_cnt < $arrRet[$cnt]['level']; $cat_cnt++) {
|
|---|
| 1132 | $arrOutput[$cnt].= CATEGORY_HEAD;
|
|---|
| 1133 | }
|
|---|
| 1134 | $arrOutput[$cnt].= $arrRet[$cnt]['category_name'];
|
|---|
| 1135 | }
|
|---|
| 1136 | return array($arrValue, $arrOutput);
|
|---|
| 1137 | }
|
|---|
| 1138 |
|
|---|
| 1139 | function sfGetErrorColor($val) {
|
|---|
| 1140 | if($val != "") {
|
|---|
| 1141 | return "background-color:" . ERR_COLOR;
|
|---|
| 1142 | }
|
|---|
| 1143 | return "";
|
|---|
| 1144 | }
|
|---|
| 1145 |
|
|---|
| 1146 |
|
|---|
| 1147 | function sfGetEnabled($val) {
|
|---|
| 1148 | if( ! $val ) {
|
|---|
| 1149 | return " disabled=\"disabled\"";
|
|---|
| 1150 | }
|
|---|
| 1151 | return "";
|
|---|
| 1152 | }
|
|---|
| 1153 |
|
|---|
| 1154 | function sfGetChecked($param, $value) {
|
|---|
| 1155 | if($param == $value) {
|
|---|
| 1156 | return "checked=\"checked\"";
|
|---|
| 1157 | }
|
|---|
| 1158 | return "";
|
|---|
| 1159 | }
|
|---|
| 1160 |
|
|---|
| 1161 | // SELECT¥Ü¥Ã¥¯¥¹Íѥꥹ¥È¤ÎºîÀ®
|
|---|
| 1162 | function sfGetIDValueList($table, $keyname, $valname) {
|
|---|
| 1163 | $objQuery = new SC_Query();
|
|---|
| 1164 | $col = "$keyname, $valname";
|
|---|
| 1165 | $objQuery->setwhere("del_flg = 0");
|
|---|
| 1166 | $objQuery->setorder("rank DESC");
|
|---|
| 1167 | $arrList = $objQuery->select($col, $table);
|
|---|
| 1168 | $count = count($arrList);
|
|---|
| 1169 | for($cnt = 0; $cnt < $count; $cnt++) {
|
|---|
| 1170 | $key = $arrList[$cnt][$keyname];
|
|---|
| 1171 | $val = $arrList[$cnt][$valname];
|
|---|
| 1172 | $arrRet[$key] = $val;
|
|---|
| 1173 | }
|
|---|
| 1174 | return $arrRet;
|
|---|
| 1175 | }
|
|---|
| 1176 |
|
|---|
| 1177 | function sfTrim($str) {
|
|---|
| 1178 | $ret = ereg_replace("^[¡¡ \n\r]*", "", $str);
|
|---|
| 1179 | $ret = ereg_replace("[¡¡ \n\r]*$", "", $ret);
|
|---|
| 1180 | return $ret;
|
|---|
| 1181 | }
|
|---|
| 1182 |
|
|---|
| 1183 | /* ½ê°¤¹¤ë¤¹¤Ù¤Æ¤Î³¬ÁؤοÆID¤òÇÛÎó¤ÇÊÖ¤¹ */
|
|---|
| 1184 | function sfGetParents($objQuery, $table, $pid_name, $id_name, $id) {
|
|---|
| 1185 | $arrRet = sfGetParentsArray($table, $pid_name, $id_name, $id);
|
|---|
| 1186 | // ÇÛÎó¤ÎÀèÆ¬1¤Ä¤òºï½ü¤¹¤ë¡£
|
|---|
| 1187 | array_shift($arrRet);
|
|---|
| 1188 | return $arrRet;
|
|---|
| 1189 | }
|
|---|
| 1190 |
|
|---|
| 1191 |
|
|---|
| 1192 | /* ¿ÆID¤ÎÇÛÎó¤ò¸µ¤ËÆÃÄê¤Î¥«¥é¥à¤ò¼èÆÀ¤¹¤ë¡£*/
|
|---|
| 1193 | function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId ) {
|
|---|
| 1194 | $col = $col_name;
|
|---|
| 1195 | $len = count($arrId);
|
|---|
| 1196 | $where = "";
|
|---|
| 1197 |
|
|---|
| 1198 | for($cnt = 0; $cnt < $len; $cnt++) {
|
|---|
| 1199 | if($where == "") {
|
|---|
| 1200 | $where = "$id_name = ?";
|
|---|
| 1201 | } else {
|
|---|
| 1202 | $where.= " OR $id_name = ?";
|
|---|
| 1203 | }
|
|---|
| 1204 | }
|
|---|
| 1205 |
|
|---|
| 1206 | $objQuery->setorder("level");
|
|---|
| 1207 | $arrRet = $objQuery->select($col, $table, $where, $arrId);
|
|---|
| 1208 | return $arrRet;
|
|---|
| 1209 | }
|
|---|
| 1210 |
|
|---|
| 1211 | /* »ÒID¤ÎÇÛÎó¤òÊÖ¤¹ */
|
|---|
| 1212 | function sfGetChildsID($table, $pid_name, $id_name, $id) {
|
|---|
| 1213 | $arrRet = sfGetChildrenArray($table, $pid_name, $id_name, $id);
|
|---|
| 1214 | return $arrRet;
|
|---|
| 1215 | }
|
|---|
| 1216 |
|
|---|
| 1217 | /* ¥«¥Æ¥´¥êÊѹ¹»þ¤Î°Üư½èÍý */
|
|---|
| 1218 | function sfMoveCatRank($objQuery, $table, $id_name, $cat_name, $old_catid, $new_catid, $id) {
|
|---|
| 1219 | if ($old_catid == $new_catid) {
|
|---|
| 1220 | return;
|
|---|
| 1221 | }
|
|---|
| 1222 | // µì¥«¥Æ¥´¥ê¤Ç¤Î¥é¥ó¥¯ºï½ü½èÍý
|
|---|
| 1223 | // °Üư¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
|
|---|
| 1224 | $where = "$id_name = ?";
|
|---|
| 1225 | $rank = $objQuery->get($table, "rank", $where, array($id));
|
|---|
| 1226 | // ºï½ü¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤è¤ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä²¼¤Ë¤º¤é¤¹¡£
|
|---|
| 1227 | $where = "rank > ? AND $cat_name = ?";
|
|---|
| 1228 | $sqlup = "UPDATE $table SET rank = (rank - 1) WHERE $where";
|
|---|
| 1229 | $objQuery->exec($sqlup, array($rank, $old_catid));
|
|---|
| 1230 | // ¿·¥«¥Æ¥´¥ê¤Ç¤ÎÅÐÏ¿½èÍý
|
|---|
| 1231 | // ¿·¥«¥Æ¥´¥ê¤ÎºÇÂç¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£
|
|---|
| 1232 | $max_rank = $objQuery->max($table, "rank", "$cat_name = ?", array($new_catid)) + 1;
|
|---|
| 1233 | $where = "$id_name = ?";
|
|---|
| 1234 | $sqlup = "UPDATE $table SET rank = ? WHERE $where";
|
|---|
| 1235 | $objQuery->exec($sqlup, array($max_rank, $id));
|
|---|
| 1236 | }
|
|---|
| 1237 |
|
|---|
| 1238 | /* ÀǶâ·×»» */
|
|---|
| 1239 | function sfTax($price, $tax, $tax_rule) {
|
|---|
| 1240 | $real_tax = $tax / 100;
|
|---|
| 1241 | $ret = $price * $real_tax;
|
|---|
| 1242 | switch($tax_rule) {
|
|---|
| 1243 | // »Í¼Î¸ÞÆþ
|
|---|
| 1244 | case 1:
|
|---|
| 1245 | $ret = round($ret);
|
|---|
| 1246 | break;
|
|---|
| 1247 | // ÀÚ¤ê¼Î¤Æ
|
|---|
| 1248 | case 2:
|
|---|
| 1249 | $ret = floor($ret);
|
|---|
| 1250 | break;
|
|---|
| 1251 | // ÀÚ¤ê¾å¤²
|
|---|
| 1252 | case 3:
|
|---|
| 1253 | $ret = ceil($ret);
|
|---|
| 1254 | break;
|
|---|
| 1255 | // ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
|
|---|
| 1256 | default:
|
|---|
| 1257 | $ret = ceil($ret);
|
|---|
| 1258 | break;
|
|---|
| 1259 | }
|
|---|
| 1260 | return $ret;
|
|---|
| 1261 | }
|
|---|
| 1262 |
|
|---|
| 1263 | /* ÀǶâÉÕÍ¿ */
|
|---|
| 1264 | function sfPreTax($price, $tax, $tax_rule) {
|
|---|
| 1265 | $real_tax = $tax / 100;
|
|---|
| 1266 | $ret = $price * (1 + $real_tax);
|
|---|
| 1267 |
|
|---|
| 1268 | switch($tax_rule) {
|
|---|
| 1269 | // »Í¼Î¸ÞÆþ
|
|---|
| 1270 | case 1:
|
|---|
| 1271 | $ret = round($ret);
|
|---|
| 1272 | break;
|
|---|
| 1273 | // ÀÚ¤ê¼Î¤Æ
|
|---|
| 1274 | case 2:
|
|---|
| 1275 | $ret = floor($ret);
|
|---|
| 1276 | break;
|
|---|
| 1277 | // ÀÚ¤ê¾å¤²
|
|---|
| 1278 | case 3:
|
|---|
| 1279 | $ret = ceil($ret);
|
|---|
| 1280 | break;
|
|---|
| 1281 | // ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
|
|---|
| 1282 | default:
|
|---|
| 1283 | $ret = ceil($ret);
|
|---|
| 1284 | break;
|
|---|
| 1285 | }
|
|---|
| 1286 | return $ret;
|
|---|
| 1287 | }
|
|---|
| 1288 |
|
|---|
| 1289 | // ·å¿ô¤ò»ØÄꤷ¤Æ»Í¼Î¸ÞÆþ
|
|---|
| 1290 | function sfRound($value, $pow = 0){
|
|---|
| 1291 | $adjust = pow(10 ,$pow-1);
|
|---|
| 1292 |
|
|---|
| 1293 | // À°¿ô³î¤Ä0½Ð¤Ê¤±¤ì¤Ð·å¿ô»ØÄê¤ò¹Ô¤¦
|
|---|
| 1294 | if(sfIsInt($adjust) and $pow > 1){
|
|---|
| 1295 | $ret = (round($value * $adjust)/$adjust);
|
|---|
| 1296 | }
|
|---|
| 1297 |
|
|---|
| 1298 | $ret = round($ret);
|
|---|
| 1299 |
|
|---|
| 1300 | return $ret;
|
|---|
| 1301 | }
|
|---|
| 1302 |
|
|---|
| 1303 | /* ¥Ý¥¤¥ó¥ÈÉÕÍ¿ */
|
|---|
| 1304 | function sfPrePoint($price, $point_rate, $rule = POINT_RULE, $product_id = "") {
|
|---|
| 1305 | if(sfIsInt($product_id)) {
|
|---|
| 1306 | $objQuery = new SC_Query();
|
|---|
| 1307 | $where = "now() >= cast(start_date as date) AND ";
|
|---|
| 1308 | $where .= "now() < cast(end_date as date) AND ";
|
|---|
| 1309 |
|
|---|
| 1310 | $where .= "del_flg = 0 AND campaign_id IN (SELECT campaign_id FROM dtb_campaign_detail where product_id = ? )";
|
|---|
| 1311 | //ÅÐÏ¿(¹¹¿·)ÆüÉÕ½ç
|
|---|
| 1312 | $objQuery->setorder('update_date DESC');
|
|---|
| 1313 | //¥¥ã¥ó¥Ú¡¼¥ó¥Ý¥¤¥ó¥È¤Î¼èÆÀ
|
|---|
| 1314 | $arrRet = $objQuery->select("campaign_name, campaign_point_rate", "dtb_campaign", $where, array($product_id));
|
|---|
| 1315 | }
|
|---|
| 1316 | //Ê£¿ô¤Î¥¥ã¥ó¥Ú¡¼¥ó¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¾¦Éʤϡ¢ºÇ¿·¤Î¥¥ã¥ó¥Ú¡¼¥ó¤«¤é¥Ý¥¤¥ó¥È¤ò¼èÆÀ
|
|---|
| 1317 | if($arrRet[0]['campaign_point_rate'] != "") {
|
|---|
| 1318 | $campaign_point_rate = $arrRet[0]['campaign_point_rate'];
|
|---|
| 1319 | $real_point = $campaign_point_rate / 100;
|
|---|
| 1320 | } else {
|
|---|
| 1321 | $real_point = $point_rate / 100;
|
|---|
| 1322 | }
|
|---|
| 1323 | $ret = $price * $real_point;
|
|---|
| 1324 | switch($rule) {
|
|---|
| 1325 | // »Í¼Î¸ÞÆþ
|
|---|
| 1326 | case 1:
|
|---|
| 1327 | $ret = round($ret);
|
|---|
| 1328 | break;
|
|---|
| 1329 | // ÀÚ¤ê¼Î¤Æ
|
|---|
| 1330 | case 2:
|
|---|
| 1331 | $ret = floor($ret);
|
|---|
| 1332 | break;
|
|---|
| 1333 | // ÀÚ¤ê¾å¤²
|
|---|
| 1334 | case 3:
|
|---|
| 1335 | $ret = ceil($ret);
|
|---|
| 1336 | break;
|
|---|
| 1337 | // ¥Ç¥Õ¥©¥ë¥È:ÀÚ¤ê¾å¤²
|
|---|
| 1338 | default:
|
|---|
| 1339 | $ret = ceil($ret);
|
|---|
| 1340 | break;
|
|---|
| 1341 | }
|
|---|
| 1342 | //¥¥ã¥ó¥Ú¡¼¥ó¾¦Éʤξì¹ç
|
|---|
| 1343 | if($campaign_point_rate != "") {
|
|---|
| 1344 | $ret = "(".$arrRet[0]['campaign_name']."¥Ý¥¤¥ó¥ÈΨ".$campaign_point_rate."%)".$ret;
|
|---|
| 1345 | }
|
|---|
| 1346 | return $ret;
|
|---|
| 1347 | }
|
|---|
| 1348 |
|
|---|
| 1349 | /* µ¬³ÊʬÎà¤Î·ï¿ô¼èÆÀ */
|
|---|
| 1350 | function sfGetClassCatCount() {
|
|---|
| 1351 | $sql = "select count(dtb_class.class_id) as count, dtb_class.class_id ";
|
|---|
| 1352 | $sql.= "from dtb_class inner join dtb_classcategory on dtb_class.class_id = dtb_classcategory.class_id ";
|
|---|
| 1353 | $sql.= "where dtb_class.del_flg = 0 AND dtb_classcategory.del_flg = 0 ";
|
|---|
| 1354 | $sql.= "group by dtb_class.class_id, dtb_class.name";
|
|---|
| 1355 | $objQuery = new SC_Query();
|
|---|
| 1356 | $arrList = $objQuery->getall($sql);
|
|---|
| 1357 | // ¥¡¼¤ÈÃͤò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ
|
|---|
| 1358 | $arrRet = sfArrKeyValue($arrList, 'class_id', 'count');
|
|---|
| 1359 |
|
|---|
| 1360 | return $arrRet;
|
|---|
| 1361 | }
|
|---|
| 1362 |
|
|---|
| 1363 | /* µ¬³Ê¤ÎÅÐÏ¿ */
|
|---|
| 1364 | function sfInsertProductClass($objQuery, $arrList, $product_id) {
|
|---|
| 1365 | // ¤¹¤Ç¤Ëµ¬³ÊÅÐÏ¿¤¬¤¢¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
|
|---|
| 1366 | $where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0";
|
|---|
| 1367 | $count = $objQuery->count("dtb_products_class", $where, array($product_id));
|
|---|
| 1368 |
|
|---|
| 1369 | // ¤¹¤Ç¤Ëµ¬³ÊÅÐÏ¿¤¬¤Ê¤¤¾ì¹ç
|
|---|
| 1370 | if($count == 0) {
|
|---|
| 1371 | // ´û¸µ¬³Ê¤Îºï½ü
|
|---|
| 1372 | $where = "product_id = ?";
|
|---|
| 1373 | $objQuery->delete("dtb_products_class", $where, array($product_id));
|
|---|
| 1374 | $sqlval['product_id'] = $product_id;
|
|---|
| 1375 | $sqlval['classcategory_id1'] = '0';
|
|---|
| 1376 | $sqlval['classcategory_id2'] = '0';
|
|---|
| 1377 | $sqlval['product_code'] = $arrList["product_code"];
|
|---|
| 1378 | $sqlval['stock'] = $arrList["stock"];
|
|---|
| 1379 | $sqlval['stock_unlimited'] = $arrList["stock_unlimited"];
|
|---|
| 1380 | $sqlval['price01'] = $arrList['price01'];
|
|---|
| 1381 | $sqlval['price02'] = $arrList['price02'];
|
|---|
| 1382 | $sqlval['creator_id'] = $_SESSION['member_id'];
|
|---|
| 1383 | $sqlval['create_date'] = "now()";
|
|---|
| 1384 |
|
|---|
| 1385 | if($_SESSION['member_id'] == "") {
|
|---|
| 1386 | $sqlval['creator_id'] = '0';
|
|---|
| 1387 | }
|
|---|
| 1388 |
|
|---|
| 1389 | // INSERT¤Î¼Â¹Ô
|
|---|
| 1390 | $objQuery->insert("dtb_products_class", $sqlval);
|
|---|
| 1391 | }
|
|---|
| 1392 | }
|
|---|
| 1393 |
|
|---|
| 1394 | function sfGetProductClassId($product_id, $classcategory_id1, $classcategory_id2) {
|
|---|
| 1395 | $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
|
|---|
| 1396 | $objQuery = new SC_Query();
|
|---|
| 1397 | $ret = $objQuery->get("dtb_products_class", "product_class_id", $where, Array($product_id, $classcategory_id1, $classcategory_id2));
|
|---|
| 1398 | return $ret;
|
|---|
| 1399 | }
|
|---|
| 1400 |
|
|---|
| 1401 | /* ʸËö¤Î¡Ö/¡×¤ò¤Ê¤¯¤¹ */
|
|---|
| 1402 | function sfTrimURL($url) {
|
|---|
| 1403 | $ret = ereg_replace("[/]+$", "", $url);
|
|---|
| 1404 | return $ret;
|
|---|
| 1405 | }
|
|---|
| 1406 |
|
|---|
| 1407 | /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ */
|
|---|
| 1408 | function sfGetProductsClass($arrID) {
|
|---|
| 1409 | list($product_id, $classcategory_id1, $classcategory_id2) = $arrID;
|
|---|
| 1410 |
|
|---|
| 1411 | if($classcategory_id1 == "") {
|
|---|
| 1412 | $classcategory_id1 = '0';
|
|---|
| 1413 | }
|
|---|
| 1414 | if($classcategory_id2 == "") {
|
|---|
| 1415 | $classcategory_id2 = '0';
|
|---|
| 1416 | }
|
|---|
| 1417 |
|
|---|
| 1418 | // ¾¦Éʵ¬³Ê¼èÆÀ
|
|---|
| 1419 | $objQuery = new SC_Query();
|
|---|
| 1420 | $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";
|
|---|
| 1421 | $table = "vw_product_class AS prdcls";
|
|---|
| 1422 | $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
|
|---|
| 1423 | $objQuery->setorder("rank1 DESC, rank2 DESC");
|
|---|
| 1424 | $arrRet = $objQuery->select($col, $table, $where, array($product_id, $classcategory_id1, $classcategory_id2));
|
|---|
| 1425 | return $arrRet[0];
|
|---|
| 1426 | }
|
|---|
| 1427 |
|
|---|
| 1428 | /* ½¸·×¾ðÊó¤ò¸µ¤ËºÇ½ª·×»» */
|
|---|
| 1429 | function sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer = "") {
|
|---|
| 1430 | // ¾¦Éʤιç·×¸Ä¿ô
|
|---|
| 1431 | $total_quantity = $objCartSess->getTotalQuantity(true);
|
|---|
| 1432 |
|
|---|
| 1433 | // ÀǶâ¤Î¼èÆÀ
|
|---|
| 1434 | $arrData['tax'] = $objPage->tpl_total_tax;
|
|---|
| 1435 | // ¾®·×¤Î¼èÆÀ
|
|---|
| 1436 | $arrData['subtotal'] = $objPage->tpl_total_pretax;
|
|---|
| 1437 |
|
|---|
| 1438 | // ¹ç·×Á÷ÎÁ¤Î¼èÆÀ
|
|---|
| 1439 | $arrData['deliv_fee'] = 0;
|
|---|
| 1440 |
|
|---|
| 1441 | // ¾¦Éʤ´¤È¤ÎÁ÷ÎÁ¤¬Í¸ú¤Î¾ì¹ç
|
|---|
| 1442 | if (OPTION_PRODUCT_DELIV_FEE == 1) {
|
|---|
| 1443 | $arrData['deliv_fee']+= $objCartSess->getAllProductsDelivFee();
|
|---|
| 1444 | }
|
|---|
| 1445 |
|
|---|
| 1446 | // ÇÛÁ÷¶È¼Ô¤ÎÁ÷ÎÁ¤¬Í¸ú¤Î¾ì¹ç
|
|---|
| 1447 | if (OPTION_DELIV_FEE == 1) {
|
|---|
| 1448 | // Á÷ÎÁ¤Î¹ç·×¤ò·×»»¤¹¤ë
|
|---|
| 1449 | $arrData['deliv_fee']+= sfGetDelivFee($arrData['deliv_pref'], $arrData['payment_id']);
|
|---|
| 1450 | }
|
|---|
| 1451 |
|
|---|
| 1452 | // Á÷ÎÁ̵ÎÁ¤Î¹ØÆþ¿ô¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç
|
|---|
| 1453 | if(DELIV_FREE_AMOUNT > 0) {
|
|---|
| 1454 | if($total_quantity >= DELIV_FREE_AMOUNT) {
|
|---|
| 1455 | $arrData['deliv_fee'] = 0;
|
|---|
| 1456 | }
|
|---|
| 1457 | }
|
|---|
| 1458 |
|
|---|
| 1459 | // Á÷ÎÁ̵ÎÁ¾ò·ï¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç
|
|---|
| 1460 | if($arrInfo['free_rule'] > 0) {
|
|---|
| 1461 | // ¾®·×¤¬ÌµÎÁ¾ò·ï¤òͤ¨¤Æ¤¤¤ë¾ì¹ç
|
|---|
| 1462 | if($arrData['subtotal'] >= $arrInfo['free_rule']) {
|
|---|
| 1463 | $arrData['deliv_fee'] = 0;
|
|---|
| 1464 | }
|
|---|
| 1465 | }
|
|---|
| 1466 |
|
|---|
| 1467 | // ¹ç·×¤Î·×»»
|
|---|
| 1468 | $arrData['total'] = $objPage->tpl_total_pretax; // ¾¦Éʹç·×
|
|---|
| 1469 | $arrData['total']+= $arrData['deliv_fee']; // Á÷ÎÁ
|
|---|
| 1470 | $arrData['total']+= $arrData['charge']; // ¼ê¿ôÎÁ
|
|---|
| 1471 | // ¤ª»Ùʧ¤¤¹ç·×
|
|---|
| 1472 | $arrData['payment_total'] = $arrData['total'] - ($arrData['use_point'] * POINT_VALUE);
|
|---|
| 1473 | // ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»»
|
|---|
| 1474 | $arrData['add_point'] = sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo);
|
|---|
| 1475 |
|
|---|
| 1476 | if($objCustomer != "") {
|
|---|
| 1477 | // ÃÂÀ¸Æü·î¤Ç¤¢¤Ã¤¿¾ì¹ç
|
|---|
| 1478 | if($objCustomer->isBirthMonth()) {
|
|---|
| 1479 | $arrData['birth_point'] = BIRTH_MONTH_POINT;
|
|---|
| 1480 | $arrData['add_point'] += $arrData['birth_point'];
|
|---|
| 1481 | }
|
|---|
| 1482 | }
|
|---|
| 1483 |
|
|---|
| 1484 | if($arrData['add_point'] < 0) {
|
|---|
| 1485 | $arrData['add_point'] = 0;
|
|---|
| 1486 | }
|
|---|
| 1487 |
|
|---|
| 1488 | return $arrData;
|
|---|
| 1489 | }
|
|---|
| 1490 |
|
|---|
| 1491 | /* ¥«¡¼¥ÈÆâ¾¦Éʤν¸·×½èÍý */
|
|---|
| 1492 | function sfTotalCart($objPage, $objCartSess, $arrInfo) {
|
|---|
| 1493 | // µ¬³Ê̾°ìÍ÷
|
|---|
| 1494 | $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
|
|---|
| 1495 | // µ¬³ÊʬÎà̾°ìÍ÷
|
|---|
| 1496 | $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
|
|---|
| 1497 |
|
|---|
| 1498 | $objPage->tpl_total_pretax = 0; // ÈñÍѹç·×(Àǹþ¤ß)
|
|---|
| 1499 | $objPage->tpl_total_tax = 0; // ¾ÃÈñÀǹç·×
|
|---|
| 1500 | $objPage->tpl_total_point = 0; // ¥Ý¥¤¥ó¥È¹ç·×
|
|---|
| 1501 |
|
|---|
| 1502 | // ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
|
|---|
| 1503 | $arrCart = $objCartSess->getCartList();
|
|---|
| 1504 | $max = count($arrCart);
|
|---|
| 1505 | $cnt = 0;
|
|---|
| 1506 |
|
|---|
| 1507 | for ($i = 0; $i < $max; $i++) {
|
|---|
| 1508 | // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ
|
|---|
| 1509 | $arrData = sfGetProductsClass($arrCart[$i]['id']);
|
|---|
| 1510 | $limit = "";
|
|---|
| 1511 | // DB¤Ë¸ºß¤¹¤ë¾¦ÉÊ
|
|---|
| 1512 | if (count($arrData) > 0) {
|
|---|
| 1513 |
|
|---|
| 1514 | // ¹ØÆþÀ©¸Â¿ô¤òµá¤á¤ë¡£
|
|---|
| 1515 | if ($arrData['stock_unlimited'] != '1' && $arrData['sale_unlimited'] != '1') {
|
|---|
| 1516 | if($arrData['sale_limit'] < $arrData['stock']) {
|
|---|
| 1517 | $limit = $arrData['sale_limit'];
|
|---|
| 1518 | } else {
|
|---|
| 1519 | $limit = $arrData['stock'];
|
|---|
| 1520 | }
|
|---|
| 1521 | } else {
|
|---|
| 1522 | if ($arrData['sale_unlimited'] != '1') {
|
|---|
| 1523 | $limit = $arrData['sale_limit'];
|
|---|
| 1524 | }
|
|---|
| 1525 | if ($arrData['stock_unlimited'] != '1') {
|
|---|
| 1526 | $limit = $arrData['stock'];
|
|---|
| 1527 | }
|
|---|
| 1528 | }
|
|---|
| 1529 |
|
|---|
| 1530 | if($limit != "" && $limit < $arrCart[$i]['quantity']) {
|
|---|
| 1531 | // ¥«¡¼¥ÈÆâ¾¦ÉÊ¿ô¤òÀ©¸Â¤Ë¹ç¤ï¤»¤ë
|
|---|
| 1532 | $objCartSess->setProductValue($arrCart[$i]['id'], 'quantity', $limit);
|
|---|
| 1533 | $quantity = $limit;
|
|---|
| 1534 | $objPage->tpl_message = "¢¨¡Ö" . $arrData['name'] . "¡×¤ÏÈÎÇäÀ©¸Â¤·¤Æ¤ª¤ê¤Þ¤¹¡¢°ìÅ٤ˤ³¤ì°Ê¾å¤Î¹ØÆþ¤Ï¤Ç¤¤Þ¤»¤ó¡£";
|
|---|
| 1535 | } else {
|
|---|
| 1536 | $quantity = $arrCart[$i]['quantity'];
|
|---|
| 1537 | }
|
|---|
| 1538 |
|
|---|
| 1539 | $objPage->arrProductsClass[$cnt] = $arrData;
|
|---|
| 1540 | $objPage->arrProductsClass[$cnt]['quantity'] = $quantity;
|
|---|
| 1541 | $objPage->arrProductsClass[$cnt]['cart_no'] = $arrCart[$i]['cart_no'];
|
|---|
| 1542 | $objPage->arrProductsClass[$cnt]['class_name1'] = $arrClassName[$arrData['class_id1']];
|
|---|
| 1543 | $objPage->arrProductsClass[$cnt]['class_name2'] = $arrClassName[$arrData['class_id2']];
|
|---|
| 1544 | $objPage->arrProductsClass[$cnt]['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
|
|---|
| 1545 | $objPage->arrProductsClass[$cnt]['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
|
|---|
| 1546 |
|
|---|
| 1547 | // ²èÁü¥µ¥¤¥º
|
|---|
| 1548 | list($image_width, $image_height) = getimagesize(IMAGE_SAVE_DIR . basename($objPage->arrProductsClass[$cnt]["main_image"]));
|
|---|
| 1549 | $objPage->arrProductsClass[$cnt]["tpl_image_width"] = $image_width + 60;
|
|---|
| 1550 | $objPage->arrProductsClass[$cnt]["tpl_image_height"] = $image_height + 80;
|
|---|
| 1551 |
|
|---|
| 1552 | // ²Á³Ê¤ÎÅÐÏ¿
|
|---|
| 1553 | if ($arrData['price02'] != "") {
|
|---|
| 1554 | $objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price02']);
|
|---|
| 1555 | $objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price02'];
|
|---|
| 1556 | } else {
|
|---|
| 1557 | $objCartSess->setProductValue($arrCart[$i]['id'], 'price', $arrData['price01']);
|
|---|
| 1558 | $objPage->arrProductsClass[$cnt]['uniq_price'] = $arrData['price01'];
|
|---|
| 1559 | }
|
|---|
| 1560 | // ¥Ý¥¤¥ó¥ÈÉÕͿΨ¤ÎÅÐÏ¿
|
|---|
| 1561 | $objCartSess->setProductValue($arrCart[$i]['id'], 'point_rate', $arrData['point_rate']);
|
|---|
| 1562 | // ¾¦Éʤ´¤È¤Î¹ç·×¶â³Û
|
|---|
| 1563 | $objPage->arrProductsClass[$cnt]['total_pretax'] = $objCartSess->getProductTotal($arrInfo, $arrCart[$i]['id']);
|
|---|
| 1564 | // Á÷ÎÁ¤Î¹ç·×¤ò·×»»¤¹¤ë
|
|---|
| 1565 | $objPage->tpl_total_deliv_fee+= ($arrData['deliv_fee'] * $arrCart[$i]['quantity']);
|
|---|
| 1566 | $cnt++;
|
|---|
| 1567 | } else {
|
|---|
| 1568 | // DB¤Ë¾¦Éʤ¬¸«¤Ä¤«¤é¤Ê¤¤¾ì¹ç¤Ï¥«¡¼¥È¾¦Éʤκï½ü
|
|---|
| 1569 | $objCartSess->delProductKey('id', $arrCart[$i]['id']);
|
|---|
| 1570 | }
|
|---|
| 1571 | }
|
|---|
| 1572 |
|
|---|
| 1573 | // Á´¾¦Éʹç·×¶â³Û(Àǹþ¤ß)
|
|---|
| 1574 | $objPage->tpl_total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
|
|---|
| 1575 | // Á´¾¦Éʹç·×¾ÃÈñÀÇ
|
|---|
| 1576 | $objPage->tpl_total_tax = $objCartSess->getAllProductsTax($arrInfo);
|
|---|
| 1577 | // Á´¾¦Éʹç·×¥Ý¥¤¥ó¥È
|
|---|
| 1578 | $objPage->tpl_total_point = $objCartSess->getAllProductsPoint();
|
|---|
| 1579 |
|
|---|
| 1580 | return $objPage;
|
|---|
| 1581 | }
|
|---|
| 1582 |
|
|---|
| 1583 | /* DB¤«¤é¼è¤ê½Ð¤·¤¿ÆüÉÕ¤Îʸ»úÎó¤òÄ´À°¤¹¤ë¡£*/
|
|---|
| 1584 | function sfDispDBDate($dbdate, $time = true) {
|
|---|
| 1585 | list($y, $m, $d, $H, $M) = split("[- :]", $dbdate);
|
|---|
| 1586 |
|
|---|
| 1587 | if(strlen($y) > 0 && strlen($m) > 0 && strlen($d) > 0) {
|
|---|
| 1588 | if ($time) {
|
|---|
| 1589 | $str = sprintf("%04d/%02d/%02d %02d:%02d", $y, $m, $d, $H, $M);
|
|---|
| 1590 | } else {
|
|---|
| 1591 | $str = sprintf("%04d/%02d/%02d", $y, $m, $d, $H, $M);
|
|---|
| 1592 | }
|
|---|
| 1593 | } else {
|
|---|
| 1594 | $str = "";
|
|---|
| 1595 | }
|
|---|
| 1596 | return $str;
|
|---|
| 1597 | }
|
|---|
| 1598 |
|
|---|
| 1599 | function sfGetDelivTime($payment_id = "") {
|
|---|
| 1600 | $objQuery = new SC_Query();
|
|---|
| 1601 |
|
|---|
| 1602 | $deliv_id = "";
|
|---|
| 1603 |
|
|---|
| 1604 | if($payment_id != "") {
|
|---|
| 1605 | $where = "del_flg = 0 AND payment_id = ?";
|
|---|
| 1606 | $arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id));
|
|---|
| 1607 | $deliv_id = $arrRet[0]['deliv_id'];
|
|---|
| 1608 | }
|
|---|
| 1609 |
|
|---|
| 1610 | if($deliv_id != "") {
|
|---|
| 1611 | $objQuery->setorder("time_id");
|
|---|
| 1612 | $where = "deliv_id = ?";
|
|---|
| 1613 | $arrRet= $objQuery->select("time_id, deliv_time", "dtb_delivtime", $where, array($deliv_id));
|
|---|
| 1614 | }
|
|---|
| 1615 |
|
|---|
| 1616 | return $arrRet;
|
|---|
| 1617 | }
|
|---|
| 1618 |
|
|---|
| 1619 |
|
|---|
| 1620 | // ÅÔÆ»Éܸ©¡¢»Ùʧ¤¤ÊýË¡¤«¤éÇÛÁ÷ÎÁ¶â¤ò¼èÆÀ¤¹¤ë
|
|---|
| 1621 | function sfGetDelivFee($pref, $payment_id = "") {
|
|---|
| 1622 | $objQuery = new SC_Query();
|
|---|
| 1623 |
|
|---|
| 1624 | $deliv_id = "";
|
|---|
| 1625 |
|
|---|
| 1626 | // »Ùʧ¤¤ÊýË¡¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢Âбþ¤·¤¿ÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë
|
|---|
| 1627 | if($payment_id != "") {
|
|---|
| 1628 | $where = "del_flg = 0 AND payment_id = ?";
|
|---|
| 1629 | $arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id));
|
|---|
| 1630 | $deliv_id = $arrRet[0]['deliv_id'];
|
|---|
| 1631 | // »Ùʧ¤¤ÊýË¡¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ÀèÆ¬¤ÎÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë
|
|---|
| 1632 | } else {
|
|---|
| 1633 | $where = "del_flg = 0";
|
|---|
| 1634 | $objQuery->setOrder("rank DESC");
|
|---|
| 1635 | $objQuery->setLimitOffset(1);
|
|---|
| 1636 | $arrRet = $objQuery->select("deliv_id", "dtb_deliv", $where);
|
|---|
| 1637 | $deliv_id = $arrRet[0]['deliv_id'];
|
|---|
| 1638 | }
|
|---|
| 1639 |
|
|---|
| 1640 | // ÇÛÁ÷¶È¼Ô¤«¤éÇÛÁ÷ÎÁ¤ò¼èÆÀ
|
|---|
| 1641 | if($deliv_id != "") {
|
|---|
| 1642 |
|
|---|
| 1643 | // ÅÔÆ»Éܸ©¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ÅìµþÅÔ¤ÎÈÖ¹æ¤ò»ØÄꤷ¤Æ¤ª¤¯
|
|---|
| 1644 | if($pref == "") {
|
|---|
| 1645 | $pref = 13;
|
|---|
| 1646 | }
|
|---|
| 1647 |
|
|---|
| 1648 | $objQuery = new SC_Query();
|
|---|
| 1649 | $where = "deliv_id = ? AND pref = ?";
|
|---|
| 1650 | $arrRet= $objQuery->select("fee", "dtb_delivfee", $where, array($deliv_id, $pref));
|
|---|
| 1651 | }
|
|---|
| 1652 | return $arrRet[0]['fee'];
|
|---|
| 1653 | }
|
|---|
| 1654 |
|
|---|
| 1655 | /* »Ùʧ¤¤ÊýË¡¤Î¼èÆÀ */
|
|---|
| 1656 | function sfGetPayment() {
|
|---|
| 1657 | $objQuery = new SC_Query();
|
|---|
| 1658 | // ¹ØÆþ¶â³Û¤¬¾ò·ï³Û°Ê²¼¤Î¹àÌܤò¼èÆÀ
|
|---|
| 1659 | $where = "del_flg = 0";
|
|---|
| 1660 | $objQuery->setorder("fix, rank DESC");
|
|---|
| 1661 | $arrRet = $objQuery->select("payment_id, payment_method, rule", "dtb_payment", $where);
|
|---|
| 1662 | return $arrRet;
|
|---|
| 1663 | }
|
|---|
| 1664 |
|
|---|
| 1665 | /* ÇÛÎó¤ò¥¡¼Ì¾¤´¤È¤ÎÇÛÎó¤ËÊѹ¹¤¹¤ë */
|
|---|
| 1666 | function sfSwapArray($array) {
|
|---|
| 1667 | $max = count($array);
|
|---|
| 1668 | for($i = 0; $i < $max; $i++) {
|
|---|
| 1669 | foreach($array[$i] as $key => $val) {
|
|---|
| 1670 | $arrRet[$key][] = $val;
|
|---|
| 1671 | }
|
|---|
| 1672 | }
|
|---|
| 1673 | return $arrRet;
|
|---|
| 1674 | }
|
|---|
| 1675 |
|
|---|
| 1676 | /* ¤«¤±»»¤ò¤¹¤ë¡ÊSmartyÍÑ) */
|
|---|
| 1677 | function sfMultiply($num1, $num2) {
|
|---|
| 1678 | return ($num1 * $num2);
|
|---|
| 1679 | }
|
|---|
| 1680 |
|
|---|
| 1681 | /** |
|---|
| 1682 | * DB¤ËÅÐÏ¿¤µ¤ì¤¿¥Æ¥ó¥×¥ì¡¼¥È¥á¡¼¥ë¤ÎÁ÷¿® |
|---|
| 1683 | * ¢¨¸½ºß¤Ï»ÈÍѤ·¤Ê¤¤´Ø¿ô |
|---|
| 1684 | */
|
|---|
| 1685 | function sfSendTemplateMail($to, $to_name, $template_id, $objPage) {
|
|---|
| 1686 | global $arrMAILTPLPATH;
|
|---|
| 1687 | $objQuery = new SC_Query();
|
|---|
| 1688 | // ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¾ðÊó¤Î¼èÆÀ
|
|---|
| 1689 | $where = "template_id = ?";
|
|---|
| 1690 | $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id));
|
|---|
| 1691 | $objPage->tpl_header = $arrRet[0]['header'];
|
|---|
| 1692 | $objPage->tpl_footer = $arrRet[0]['footer'];
|
|---|
| 1693 | $tmp_subject = $arrRet[0]['subject'];
|
|---|
| 1694 |
|
|---|
| 1695 | $objSiteInfo = new SC_SiteInfo();
|
|---|
| 1696 | $arrInfo = $objSiteInfo->data;
|
|---|
| 1697 |
|
|---|
| 1698 | $objMailView = new SC_SiteView();
|
|---|
| 1699 | // ¥á¡¼¥ëËÜʸ¤Î¼èÆÀ
|
|---|
| 1700 | $objMailView->assignobj($objPage);
|
|---|
| 1701 | $body = $objMailView->fetch($arrMAILTPLPATH[$template_id]);
|
|---|
| 1702 |
|
|---|
| 1703 | // ¥á¡¼¥ëÁ÷¿®½èÍý
|
|---|
| 1704 | $objSendMail = new GC_SendMail();
|
|---|
| 1705 | $from = $arrInfo['email03'];
|
|---|
| 1706 | $error = $arrInfo['email04'];
|
|---|
| 1707 | $tosubject = $tmp_subject;
|
|---|
| 1708 | $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error);
|
|---|
| 1709 | $objSendMail->setTo($to, $to_name);
|
|---|
| 1710 | $objSendMail->sendMail(); // ¥á¡¼¥ëÁ÷¿®
|
|---|
| 1711 | }
|
|---|
| 1712 |
|
|---|
| 1713 | /** |
|---|
| 1714 | * |
|---|
| 1715 | * ¼õÃí´°Î»¥á¡¼¥ë¤ÎÁ÷¿® |
|---|
| 1716 | * |
|---|
| 1717 | * template_id¤ËÂбþ¤¹¤ësend_type¤¬ |
|---|
| 1718 | * 1¤Ê¤éPCÍѥ᡼¥ë, |
|---|
| 1719 | * 2¤Ê¤é¥â¥Ð¥¤¥ëÍѥ᡼¥ë |
|---|
| 1720 | * ¤òÁ÷¿®¤¹¤ë |
|---|
| 1721 | */
|
|---|
| 1722 | function sfSendOrderMail($order_id, $template_id, $subject = "", $body = "", $send = true) { |
|---|
| 1723 | global $arrMAILTPLPATH; |
|---|
| 1724 |
|
|---|
| 1725 | $objPage = new LC_Page();
|
|---|
| 1726 | $objSiteInfo = new SC_SiteInfo();
|
|---|
| 1727 | $arrInfo = $objSiteInfo->data;
|
|---|
| 1728 | $objPage->arrInfo = $arrInfo;
|
|---|
| 1729 |
|
|---|
| 1730 | $objQuery = new SC_Query(); |
|---|
| 1731 | |
|---|
| 1732 | $where = "template_id = ?";
|
|---|
| 1733 | $arrTemplate = $objQuery->select("subject, body, send_type", "dtb_mailtemplate", $where, array($template_id)); |
|---|
| 1734 | // send_type¤ò¼èÆÀ |
|---|
| 1735 | $send_type = $arrTemplate[0]['send_type']; |
|---|
| 1736 |
|
|---|
| 1737 | if($subject == "" && $body == "" ) {
|
|---|
| 1738 | // ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¾ðÊó¤Î¼èÆÀ
|
|---|
| 1739 | $objPage->tpl_body = $arrTemplate[0]['body'];
|
|---|
| 1740 | $tmp_subject = $arrTemplate[0]['subject'];
|
|---|
| 1741 | } else {
|
|---|
| 1742 | $objPage->tpl_body = $body;
|
|---|
| 1743 | $tmp_subject = $subject;
|
|---|
| 1744 | }
|
|---|
| 1745 |
|
|---|
| 1746 | // ¼õÃí¾ðÊó¤Î¼èÆÀ
|
|---|
| 1747 | $where = "order_id = ?";
|
|---|
| 1748 | $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
|
|---|
| 1749 | $arrOrder = $arrRet[0];
|
|---|
| 1750 | $arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id));
|
|---|
| 1751 |
|
|---|
| 1752 | $objPage->Message_tmp = $arrOrder['message'];
|
|---|
| 1753 |
|
|---|
| 1754 | // ¸ÜµÒ¾ðÊó¤Î¼èÆÀ
|
|---|
| 1755 | $customer_id = $arrOrder['customer_id'];
|
|---|
| 1756 | $arrRet = $objQuery->select("point,name01,name02", "dtb_customer", "customer_id = ?", array($customer_id));
|
|---|
| 1757 | $arrCustomer = $arrRet[0];
|
|---|
| 1758 |
|
|---|
| 1759 | $objPage->arrCustomer = $arrCustomer;
|
|---|
| 1760 | $objPage->arrOrder = $arrOrder;
|
|---|
| 1761 |
|
|---|
| 1762 | //¤½¤Î¾·èºÑ¾ðÊó
|
|---|
| 1763 | if($arrOrder['memo02'] != "") {
|
|---|
| 1764 | $arrOther = unserialize($arrOrder['memo02']);
|
|---|
| 1765 |
|
|---|
| 1766 | foreach($arrOther as $other_key => $other_val){
|
|---|
| 1767 | if(sfTrim($other_val["value"]) == ""){
|
|---|
| 1768 | $arrOther[$other_key]["value"] = "";
|
|---|
| 1769 | }
|
|---|
| 1770 | }
|
|---|
| 1771 | $objPage->arrOther = $arrOther;
|
|---|
| 1772 | }
|
|---|
| 1773 |
|
|---|
| 1774 | // ÅÔÆ»Éܸ©ÊÑ´¹
|
|---|
| 1775 | global $arrPref;
|
|---|
| 1776 | $objPage->arrOrder['deliv_pref'] = $arrPref[$objPage->arrOrder['deliv_pref']];
|
|---|
| 1777 |
|
|---|
| 1778 | $objPage->arrOrderDetail = $arrOrderDetail;
|
|---|
| 1779 |
|
|---|
| 1780 | $objCustomer = new SC_Customer();
|
|---|
| 1781 | $objPage->tpl_user_point = $objCustomer->getValue('point');
|
|---|
| 1782 | |
|---|
| 1783 | $objMailView = new SC_SiteView(); |
|---|
| 1784 |
|
|---|
| 1785 | // ¥á¡¼¥ëËÜʸ¤Î¼èÆÀ
|
|---|
| 1786 | $objMailView->assignobj($objPage);
|
|---|
| 1787 |
|
|---|
| 1788 | $name = $objPage->arrOrder['order_name01']." ".$objPage->arrOrder['order_name02'];
|
|---|
| 1789 | $objPage->tpl_body = ereg_replace( "(\{name\})", $name , $objPage->tpl_body );
|
|---|
| 1790 | $tmp_subject = ereg_replace( "(\{name\})", $name , $tmp_subject );
|
|---|
| 1791 |
|
|---|
| 1792 | // ¼õÃíÆ°ÅªÉôʬ¤ò¼èÆÀ |
|---|
| 1793 | $body = $objMailView->fetch($arrMAILTPLPATH[$send_type]);
|
|---|
| 1794 | $body = ereg_replace( "(\{order\})", $body , $objPage->tpl_body );
|
|---|
| 1795 |
|
|---|
| 1796 | // ¥á¡¼¥ëÁ÷¿®½èÍý
|
|---|
| 1797 | $objSendMail = new GC_SendMail();
|
|---|
| 1798 | $bcc = $arrInfo['email01'];
|
|---|
| 1799 | $from = $arrInfo['email03'];
|
|---|
| 1800 | $error = $arrInfo['email04'];
|
|---|
| 1801 |
|
|---|
| 1802 | $tosubject = sfMakeSubject($tmp_subject);
|
|---|
| 1803 |
|
|---|
| 1804 | $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
|
|---|
| 1805 | $objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " ". $arrOrder["order_name02"] ." ÍÍ");
|
|---|
| 1806 |
|
|---|
| 1807 | // Á÷¿®¥Õ¥é¥°:true¤Î¾ì¹ç¤Ï¡¢Á÷¿®¤¹¤ë¡£
|
|---|
| 1808 | if($send) {
|
|---|
| 1809 | if ($objSendMail->sendMail()) {
|
|---|
| 1810 | sfSaveMailHistory($order_id, $template_id, $tosubject, $body);
|
|---|
| 1811 | }
|
|---|
| 1812 | }
|
|---|
| 1813 | return $objSendMail;
|
|---|
| 1814 | }
|
|---|
| 1815 |
|
|---|
| 1816 | /** |
|---|
| 1817 | * ¥Æ¥ó¥×¥ì¡¼¥È¤ò»ÈÍѤ·¤¿¥á¡¼¥ë¤ÎÁ÷¿® |
|---|
| 1818 | * ¢¨¸½ºß¤Ï»ÈÍѤ·¤Ê¤¤´Ø¿ô |
|---|
| 1819 | */
|
|---|
| 1820 | function sfSendTplMail($to, $subject, $tplpath, $objPage) {
|
|---|
| 1821 | $objMailView = new SC_SiteView();
|
|---|
| 1822 | $objSiteInfo = new SC_SiteInfo();
|
|---|
| 1823 | $arrInfo = $objSiteInfo->data;
|
|---|
| 1824 | // ¥á¡¼¥ëËÜʸ¤Î¼èÆÀ
|
|---|
| 1825 | $objPage->tpl_shopname=$arrInfo['shop_name'];
|
|---|
| 1826 | $objPage->tpl_infoemail = $arrInfo['email02'];
|
|---|
| 1827 | $objMailView->assignobj($objPage);
|
|---|
| 1828 | $body = $objMailView->fetch($tplpath);
|
|---|
| 1829 | // ¥á¡¼¥ëÁ÷¿®½èÍý
|
|---|
| 1830 | $objSendMail = new GC_SendMail();
|
|---|
| 1831 | $to = mb_encode_mimeheader($to);
|
|---|
| 1832 | $bcc = $arrInfo['email01'];
|
|---|
| 1833 | $from = $arrInfo['email03'];
|
|---|
| 1834 | $error = $arrInfo['email04'];
|
|---|
| 1835 | $objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
|
|---|
| 1836 | $objSendMail->sendMail();
|
|---|
| 1837 | }
|
|---|
| 1838 |
|
|---|
| 1839 | // Ä̾ï¤Î¥á¡¼¥ëÁ÷¿®
|
|---|
| 1840 | function sfSendMail($to, $subject, $body) {
|
|---|
| 1841 | $objSiteInfo = new SC_SiteInfo();
|
|---|
| 1842 | $arrInfo = $objSiteInfo->data;
|
|---|
| 1843 | // ¥á¡¼¥ëÁ÷¿®½èÍý
|
|---|
| 1844 | $objSendMail = new GC_SendMail();
|
|---|
| 1845 | $bcc = $arrInfo['email01'];
|
|---|
| 1846 | $from = $arrInfo['email03'];
|
|---|
| 1847 | $error = $arrInfo['email04'];
|
|---|
| 1848 | $objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
|
|---|
| 1849 | $objSendMail->sendMail();
|
|---|
| 1850 | }
|
|---|
| 1851 |
|
|---|
| 1852 | //·ï̾¤Ë¥Æ¥ó¥×¥ì¡¼¥È¤òÍѤ¤¤ë
|
|---|
| 1853 | function sfMakeSubject($subject){
|
|---|
| 1854 |
|
|---|
| 1855 | $objQuery = new SC_Query();
|
|---|
| 1856 | $objMailView = new SC_SiteView();
|
|---|
| 1857 | $objPage = new LC_Page();
|
|---|
| 1858 |
|
|---|
| 1859 | $arrInfo = $objQuery->select("*","dtb_baseinfo");
|
|---|
| 1860 | $arrInfo = $arrInfo[0];
|
|---|
| 1861 | $objPage->tpl_shopname=$arrInfo['shop_name'];
|
|---|
| 1862 | $objPage->tpl_infoemail=$subject;
|
|---|
| 1863 | $objMailView->assignobj($objPage);
|
|---|
| 1864 | $mailtitle = $objMailView->fetch('mail_templates/mail_title.tpl');
|
|---|
| 1865 | $ret = $mailtitle.$subject;
|
|---|
| 1866 | return $ret;
|
|---|
| 1867 | }
|
|---|
| 1868 |
|
|---|
| 1869 | // ¥á¡¼¥ëÇÛ¿®ÍúÎò¤Ø¤ÎÅÐÏ¿
|
|---|
| 1870 | function sfSaveMailHistory($order_id, $template_id, $subject, $body) {
|
|---|
| 1871 | $sqlval['subject'] = $subject;
|
|---|
| 1872 | $sqlval['order_id'] = $order_id;
|
|---|
| 1873 | $sqlval['template_id'] = $template_id;
|
|---|
| 1874 | $sqlval['send_date'] = "Now()";
|
|---|
| 1875 | if($_SESSION['member_id'] != "") {
|
|---|
| 1876 | $sqlval['creator_id'] = $_SESSION['member_id'];
|
|---|
| 1877 | } else {
|
|---|
| 1878 | $sqlval['creator_id'] = '0';
|
|---|
| 1879 | }
|
|---|
| 1880 | $sqlval['mail_body'] = $body;
|
|---|
| 1881 |
|
|---|
| 1882 | $objQuery = new SC_Query();
|
|---|
| 1883 | $objQuery->insert("dtb_mail_history", $sqlval);
|
|---|
| 1884 | }
|
|---|
| 1885 |
|
|---|
| 1886 | /* ²ñ°÷¾ðÊó¤ò°ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤Ø */
|
|---|
| 1887 | function sfGetCustomerSqlVal($uniqid, $sqlval) {
|
|---|
| 1888 | $objCustomer = new SC_Customer();
|
|---|
| 1889 | // ²ñ°÷¾ðÊóÅÐÏ¿½èÍý
|
|---|
| 1890 | if ($objCustomer->isLoginSuccess()) {
|
|---|
| 1891 | // ÅÐÏ¿¥Ç¡¼¥¿¤ÎºîÀ®
|
|---|
| 1892 | $sqlval['order_temp_id'] = $uniqid;
|
|---|
| 1893 | $sqlval['update_date'] = 'Now()';
|
|---|
| 1894 | $sqlval['customer_id'] = $objCustomer->getValue('customer_id');
|
|---|
| 1895 | $sqlval['order_name01'] = $objCustomer->getValue('name01');
|
|---|
| 1896 | $sqlval['order_name02'] = $objCustomer->getValue('name02');
|
|---|
| 1897 | $sqlval['order_kana01'] = $objCustomer->getValue('kana01');
|
|---|
| 1898 | $sqlval['order_kana02'] = $objCustomer->getValue('kana02');
|
|---|
| 1899 | $sqlval['order_sex'] = $objCustomer->getValue('sex');
|
|---|
| 1900 | $sqlval['order_zip01'] = $objCustomer->getValue('zip01');
|
|---|
| 1901 | $sqlval['order_zip02'] = $objCustomer->getValue('zip02');
|
|---|
| 1902 | $sqlval['order_pref'] = $objCustomer->getValue('pref');
|
|---|
| 1903 | $sqlval['order_addr01'] = $objCustomer->getValue('addr01');
|
|---|
| 1904 | $sqlval['order_addr02'] = $objCustomer->getValue('addr02');
|
|---|
| 1905 | $sqlval['order_tel01'] = $objCustomer->getValue('tel01');
|
|---|
| 1906 | $sqlval['order_tel02'] = $objCustomer->getValue('tel02');
|
|---|
| 1907 | $sqlval['order_tel03'] = $objCustomer->getValue('tel03');
|
|---|
| 1908 | if (defined('MOBILE_SITE')) {
|
|---|
| 1909 | $sqlval['order_email'] = $objCustomer->getValue('email_mobile');
|
|---|
| 1910 | } else {
|
|---|
| 1911 | $sqlval['order_email'] = $objCustomer->getValue('email');
|
|---|
| 1912 | }
|
|---|
| 1913 | $sqlval['order_job'] = $objCustomer->getValue('job');
|
|---|
| 1914 | $sqlval['order_birth'] = $objCustomer->getValue('birth');
|
|---|
| 1915 | }
|
|---|
| 1916 | return $sqlval;
|
|---|
| 1917 | }
|
|---|
| 1918 |
|
|---|
| 1919 | // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Ø¤Î½ñ¤¹þ¤ß½èÍý
|
|---|
| 1920 | function sfRegistTempOrder($uniqid, $sqlval) {
|
|---|
| 1921 | if($uniqid != "") {
|
|---|
| 1922 | // ´û¸¥Ç¡¼¥¿¤Î¥Á¥§¥Ã¥¯
|
|---|
| 1923 | $objQuery = new SC_Query();
|
|---|
| 1924 | $where = "order_temp_id = ?";
|
|---|
| 1925 | $cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
|
|---|
| 1926 | // ´û¸¥Ç¡¼¥¿¤¬¤Ê¤¤¾ì¹ç
|
|---|
| 1927 | if ($cnt == 0) {
|
|---|
| 1928 | // ½é²ó½ñ¤¹þ¤ß»þ¤Ë²ñ°÷¤ÎÅÐÏ¿ºÑ¤ß¾ðÊó¤ò¼è¤ê¹þ¤à
|
|---|
| 1929 | $sqlval = sfGetCustomerSqlVal($uniqid, $sqlval);
|
|---|
| 1930 | $sqlval['create_date'] = "now()";
|
|---|
| 1931 | $objQuery->insert("dtb_order_temp", $sqlval);
|
|---|
| 1932 | } else {
|
|---|
| 1933 | $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
|
|---|
| 1934 | }
|
|---|
| 1935 | }
|
|---|
| 1936 | }
|
|---|
| 1937 |
|
|---|
| 1938 | /* ²ñ°÷ÅÐÏ¿¤¬¤¢¤ë¤«¤É¤¦¤«¤Î¥Á¥§¥Ã¥¯(²¾²ñ°÷¤ò´Þ¤Þ¤Ê¤¤) */
|
|---|
| 1939 | function sfCheckCustomerMailMaga($email) {
|
|---|
| 1940 | $col = "email, mailmaga_flg, customer_id";
|
|---|
| 1941 | $from = "dtb_customer";
|
|---|
| 1942 | $where = "email = ? AND status = 2 AND del_flg = 0";
|
|---|
| 1943 | $objQuery = new SC_Query();
|
|---|
| 1944 | $arrRet = $objQuery->select($col, $from, $where, array($email));
|
|---|
| 1945 | // ²ñ°÷¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë
|
|---|
| 1946 | if($arrRet[0]['customer_id'] != "") {
|
|---|
| 1947 | return true;
|
|---|
| 1948 | }
|
|---|
| 1949 | return false;
|
|---|
| 1950 | }
|
|---|
| 1951 |
|
|---|
| 1952 | // ¥«¡¼¥É¤Î½èÍý·ë²Ì¤òÊÖ¤¹
|
|---|
| 1953 | function sfGetAuthonlyResult($dir, $file_name, $name01, $name02, $card_no, $card_exp, $amount, $order_id, $jpo_info = "10"){
|
|---|
| 1954 |
|
|---|
| 1955 | $path = $dir .$file_name; // cgi¥Õ¥¡¥¤¥ë¤Î¥Õ¥ë¥Ñ¥¹À¸À®
|
|---|
| 1956 | $now_dir = getcwd(); // require¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤Î¤Ç¡¢cgi¼Â¹Ô¥Ç¥£¥ì¥¯¥È¥ê¤Ë°Üư¤¹¤ë
|
|---|
| 1957 | chdir($dir);
|
|---|
| 1958 |
|
|---|
| 1959 | // ¥Ñ¥¤¥×ÅϤ·¤Ç¥³¥Þ¥ó¥É¥é¥¤¥ó¤«¤écgiµ¯Æ°
|
|---|
| 1960 | $cmd = "$path card_no=$card_no name01=$name01 name02=$name02 card_exp=$card_exp amount=$amount order_id=$order_id jpo_info=$jpo_info";
|
|---|
| 1961 |
|
|---|
| 1962 | $tmpResult = popen($cmd, "r");
|
|---|
| 1963 |
|
|---|
| 1964 | // ·ë²Ì¼èÆÀ
|
|---|
| 1965 | while( ! FEOF ( $tmpResult ) ) {
|
|---|
| 1966 | $result .= FGETS($tmpResult);
|
|---|
| 1967 | }
|
|---|
| 1968 | pclose($tmpResult); // ¥Ñ¥¤¥×¤òÊĤ¸¤ë
|
|---|
| 1969 | chdir($now_dir); //¡¡¸µ¤Ë¤¤¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ëµ¢¤ë
|
|---|
| 1970 |
|
|---|
| 1971 | // ·ë²Ì¤òÏ¢ÁÛÇÛÎ󤨳ÊǼ
|
|---|
| 1972 | $result = ereg_replace("&$", "", $result);
|
|---|
| 1973 | foreach (explode("&",$result) as $data) {
|
|---|
| 1974 | list($key, $val) = explode("=", $data, 2);
|
|---|
| 1975 | $return[$key] = $val;
|
|---|
| 1976 | }
|
|---|
| 1977 |
|
|---|
| 1978 | return $return;
|
|---|
| 1979 | }
|
|---|
| 1980 |
|
|---|
| 1981 | // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤«¤é¾ðÊó¤ò¼èÆÀ¤¹¤ë
|
|---|
| 1982 | function sfGetOrderTemp($order_temp_id) {
|
|---|
| 1983 | $objQuery = new SC_Query();
|
|---|
| 1984 | $where = "order_temp_id = ?";
|
|---|
| 1985 | $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($order_temp_id));
|
|---|
| 1986 | return $arrRet[0];
|
|---|
| 1987 | }
|
|---|
| 1988 |
|
|---|
| 1989 | // ¥«¥Æ¥´¥êID¼èÆÀȽÄêÍѤΥ°¥í¡¼¥Ð¥ëÊÑ¿ô(°ìÅÙ¼èÆÀ¤µ¤ì¤Æ¤¤¤¿¤éºÆ¼èÆÀ¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë)
|
|---|
| 1990 | $g_category_on = false;
|
|---|
| 1991 | $g_category_id = "";
|
|---|
| 1992 |
|
|---|
| 1993 | /* ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¤ò¼èÆÀ¤¹¤ë */
|
|---|
| 1994 | function sfGetCategoryId($product_id, $category_id) {
|
|---|
| 1995 | global $g_category_on;
|
|---|
| 1996 | global $g_category_id;
|
|---|
| 1997 | if(!$g_category_on) {
|
|---|
| 1998 | $g_category_on = true;
|
|---|
| 1999 | $category_id = (int) $category_id;
|
|---|
| 2000 | $product_id = (int) $product_id;
|
|---|
| 2001 | if(sfIsInt($category_id) && sfIsRecord("dtb_category","category_id", $category_id)) {
|
|---|
| 2002 | $g_category_id = $category_id;
|
|---|
| 2003 | } else if (sfIsInt($product_id) && sfIsRecord("dtb_products","product_id", $product_id, "status = 1")) {
|
|---|
| 2004 | $objQuery = new SC_Query();
|
|---|
| 2005 | $where = "product_id = ?";
|
|---|
| 2006 | $category_id = $objQuery->get("dtb_products", "category_id", $where, array($product_id));
|
|---|
| 2007 | $g_category_id = $category_id;
|
|---|
| 2008 | } else {
|
|---|
| 2009 | // ÉÔÀµ¤Ê¾ì¹ç¤Ï¡¢0¤òÊÖ¤¹¡£
|
|---|
| 2010 | $g_category_id = 0;
|
|---|
| 2011 | }
|
|---|
| 2012 | }
|
|---|
| 2013 | return $g_category_id;
|
|---|
| 2014 | }
|
|---|
| 2015 |
|
|---|
| 2016 | // ROOTID¼èÆÀȽÄêÍѤΥ°¥í¡¼¥Ð¥ëÊÑ¿ô(°ìÅÙ¼èÆÀ¤µ¤ì¤Æ¤¤¤¿¤éºÆ¼èÆÀ¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë)
|
|---|
| 2017 | $g_root_on = false;
|
|---|
| 2018 | $g_root_id = "";
|
|---|
| 2019 |
|
|---|
| 2020 | /* ÁªÂòÃæ¤Î¥¢¥¤¥Æ¥à¤Î¥ë¡¼¥È¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë */
|
|---|
| 2021 | function sfGetRootId() {
|
|---|
| 2022 | global $g_root_on;
|
|---|
| 2023 | global $g_root_id;
|
|---|
| 2024 | if(!$g_root_on) {
|
|---|
| 2025 | $g_root_on = true;
|
|---|
| 2026 | $objQuery = new SC_Query();
|
|---|
| 2027 | if($_GET['product_id'] != "" || $_GET['category_id'] != "") {
|
|---|
| 2028 | // ÁªÂòÃæ¤Î¥«¥Æ¥´¥êID¤òȽÄꤹ¤ë
|
|---|
| 2029 | $category_id = sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
|
|---|
| 2030 | // ROOT¥«¥Æ¥´¥êID¤Î¼èÆÀ
|
|---|
| 2031 | $arrRet = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id);
|
|---|
| 2032 | $root_id = $arrRet[0];
|
|---|
| 2033 | } else {
|
|---|
| 2034 | // ROOT¥«¥Æ¥´¥êID¤ò¤Ê¤·¤ËÀßÄꤹ¤ë
|
|---|
| 2035 | $root_id = "";
|
|---|
| 2036 | }
|
|---|
| 2037 | $g_root_id = $root_id;
|
|---|
| 2038 | }
|
|---|
| 2039 | return $g_root_id;
|
|---|
| 2040 | }
|
|---|
| 2041 |
|
|---|
| 2042 | /* ¥«¥Æ¥´¥ê¤«¤é¾¦Éʤò¸¡º÷¤¹¤ë¾ì¹ç¤ÎWHEREʸ¤ÈÃͤòÊÖ¤¹ */
|
|---|
| 2043 | function sfGetCatWhere($category_id) {
|
|---|
| 2044 | // »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
|
|---|
| 2045 | $arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $category_id);
|
|---|
| 2046 | $tmp_where = "";
|
|---|
| 2047 | foreach ($arrRet as $val) {
|
|---|
| 2048 | if($tmp_where == "") {
|
|---|
| 2049 | $tmp_where.= " category_id IN ( ?";
|
|---|
| 2050 | } else {
|
|---|
| 2051 | $tmp_where.= ",? ";
|
|---|
| 2052 | }
|
|---|
| 2053 | $arrval[] = $val;
|
|---|
| 2054 | }
|
|---|
| 2055 | $tmp_where.= " ) ";
|
|---|
| 2056 | return array($tmp_where, $arrval);
|
|---|
| 2057 | }
|
|---|
| 2058 |
|
|---|
| 2059 | /* ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»»¼° */
|
|---|
| 2060 | function sfGetAddPoint($totalpoint, $use_point, $arrInfo) {
|
|---|
| 2061 | // ¹ØÆþ¾¦Éʤιç·×¥Ý¥¤¥ó¥È¤«¤éÍøÍѤ·¤¿¥Ý¥¤¥ó¥È¤Î¥Ý¥¤¥ó¥È´¹»»²ÁÃͤò°ú¤¯Êý¼°
|
|---|
| 2062 | $add_point = $totalpoint - intval($use_point * ($arrInfo['point_rate'] / 100));
|
|---|
| 2063 |
|
|---|
| 2064 | if($add_point < 0) {
|
|---|
| 2065 | $add_point = '0';
|
|---|
| 2066 | }
|
|---|
| 2067 | return $add_point;
|
|---|
| 2068 | }
|
|---|
| 2069 |
|
|---|
| 2070 | /* °ì°Õ¤«¤Äͽ¬¤µ¤ì¤Ë¤¯¤¤ID */
|
|---|
| 2071 | function sfGetUniqRandomId($head = "") {
|
|---|
| 2072 | // ͽ¬¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¥é¥ó¥À¥àʸ»úÎó¤òÉÕÍ¿¤¹¤ë¡£
|
|---|
| 2073 | $random = gfMakePassword(8);
|
|---|
| 2074 | // Ʊ°ì¥Û¥¹¥ÈÆâ¤Ç°ì°Õ¤ÊID¤òÀ¸À®
|
|---|
| 2075 | $id = uniqid($head);
|
|---|
| 2076 | return ($id . $random);
|
|---|
| 2077 | }
|
|---|
| 2078 |
|
|---|
| 2079 | // ¥«¥Æ¥´¥êÊÌ¥ª¥¹¥¹¥áÉʤμèÆÀ
|
|---|
| 2080 | function sfGetBestProducts( $conn, $category_id = 0){
|
|---|
| 2081 | // ´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÆâÍÆ¤ò¼èÆÀ¤¹¤ë
|
|---|
| 2082 | $sql = "SELECT name, main_image, main_list_image, price01_min, price01_max, price02_min, price02_max, point_rate,
|
|---|
| 2083 | A.product_id, A.comment FROM dtb_best_products as A LEFT JOIN vw_products_allclass AS allcls
|
|---|
| 2084 | USING (product_id) WHERE A.category_id = ? AND A.del_flg = 0 AND status = 1 ORDER BY A.rank";
|
|---|
| 2085 | $arrItems = $conn->getAll($sql, array($category_id));
|
|---|
| 2086 |
|
|---|
| 2087 | return $arrItems;
|
|---|
| 2088 | }
|
|---|
| 2089 |
|
|---|
| 2090 | // ÆÃ¼ìÀ©¸æÊ¸»ú¤Î¼êư¥¨¥¹¥±¡¼¥×
|
|---|
| 2091 | function sfManualEscape($data) {
|
|---|
| 2092 | // ÇÛÎó¤Ç¤Ê¤¤¾ì¹ç
|
|---|
| 2093 | if(!is_array($data)) {
|
|---|
| 2094 | if (DB_TYPE == "pgsql") {
|
|---|
| 2095 | $ret = pg_escape_string($data);
|
|---|
| 2096 | }else if(DB_TYPE == "mysql"){
|
|---|
| 2097 | $ret = mysql_real_escape_string($data);
|
|---|
| 2098 | }
|
|---|
| 2099 | $ret = ereg_replace("%", "\\%", $ret);
|
|---|
| 2100 | $ret = ereg_replace("_", "\\_", $ret);
|
|---|
| 2101 | return $ret;
|
|---|
| 2102 | }
|
|---|
| 2103 |
|
|---|
| 2104 | // ÇÛÎó¤Î¾ì¹ç
|
|---|
| 2105 | foreach($data as $val) {
|
|---|
| 2106 | if (DB_TYPE == "pgsql") {
|
|---|
| 2107 | $ret = pg_escape_string($val);
|
|---|
| 2108 | }else if(DB_TYPE == "mysql"){
|
|---|
| 2109 | $ret = mysql_real_escape_string($val);
|
|---|
| 2110 | }
|
|---|
| 2111 |
|
|---|
| 2112 | $ret = ereg_replace("%", "\\%", $ret);
|
|---|
| 2113 | $ret = ereg_replace("_", "\\_", $ret);
|
|---|
| 2114 | $arrRet[] = $ret;
|
|---|
| 2115 | }
|
|---|
| 2116 |
|
|---|
| 2117 | return $arrRet;
|
|---|
| 2118 | }
|
|---|
| 2119 |
|
|---|
| 2120 | // ¼õÃíÈÖ¹æ¡¢ÍøÍѥݥ¤¥ó¥È¡¢²Ã»»¥Ý¥¤¥ó¥È¤«¤éºÇ½ª¥Ý¥¤¥ó¥È¤ò¼èÆÀ
|
|---|
| 2121 | function sfGetCustomerPoint($order_id, $use_point, $add_point) {
|
|---|
| 2122 | $objQuery = new SC_Query();
|
|---|
| 2123 | $arrRet = $objQuery->select("customer_id", "dtb_order", "order_id = ?", array($order_id));
|
|---|
| 2124 | $customer_id = $arrRet[0]['customer_id'];
|
|---|
| 2125 | if($customer_id != "" && $customer_id >= 1) {
|
|---|
| 2126 | $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id));
|
|---|
| 2127 | $point = $arrRet[0]['point'];
|
|---|
| 2128 | $total_point = $arrRet[0]['point'] - $use_point + $add_point;
|
|---|
| 2129 | } else {
|
|---|
| 2130 | $total_point = "";
|
|---|
| 2131 | $point = "";
|
|---|
| 2132 | }
|
|---|
| 2133 | return array($point, $total_point);
|
|---|
| 2134 | }
|
|---|
| 2135 |
|
|---|
| 2136 | /* ¥É¥á¥¤¥ó´Ö¤Ç͸ú¤Ê¥»¥Ã¥·¥ç¥ó¤Î¥¹¥¿¡¼¥È */
|
|---|
| 2137 | function sfDomainSessionStart() {
|
|---|
| 2138 | $ret = session_id();
|
|---|
| 2139 | /*
|
|---|
| 2140 | ¥Ø¥Ã¥À¡¼¤òÁ÷¿®¤·¤Æ¤¤¤Æ¤âsession_start()¤¬É¬Íפʥڡ¼¥¸¤¬¤¢¤ë¤Î¤Ç
|
|---|
| 2141 | ¥³¥á¥ó¥È¥¢¥¦¥È¤·¤Æ¤ª¤¯
|
|---|
| 2142 | if($ret == "" && !headers_sent()) {
|
|---|
| 2143 | */
|
|---|
| 2144 | if($ret == "") {
|
|---|
| 2145 | /* ¥»¥Ã¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤Î»ØÄê
|
|---|
| 2146 | ¡¦¥Ö¥é¥¦¥¶¤òÊĤ¸¤ë¤Þ¤Ç͸ú
|
|---|
| 2147 | ¡¦¤¹¤Ù¤Æ¤Î¥Ñ¥¹¤Ç͸ú
|
|---|
| 2148 | ¡¦Æ±¤¸¥É¥á¥¤¥ó´Ö¤Ç¶¦Í */
|
|---|
| 2149 | session_set_cookie_params (0, "/", DOMAIN_NAME);
|
|---|
| 2150 |
|
|---|
| 2151 | if(!ini_get("session.auto_start")){
|
|---|
| 2152 | // ¥»¥Ã¥·¥ç¥ó³«»Ï
|
|---|
| 2153 | session_start();
|
|---|
| 2154 | }
|
|---|
| 2155 | }
|
|---|
| 2156 | }
|
|---|
| 2157 |
|
|---|
| 2158 | /* ʸ»úÎó¤Ë¶¯À©Åª¤Ë²þ¹Ô¤òÆþ¤ì¤ë */
|
|---|
| 2159 | function sfPutBR($str, $size) {
|
|---|
| 2160 | $i = 0;
|
|---|
| 2161 | $cnt = 0;
|
|---|
| 2162 | $line = array();
|
|---|
| 2163 | $ret = "";
|
|---|
| 2164 |
|
|---|
| 2165 | while($str[$i] != "") {
|
|---|
| 2166 | $line[$cnt].=$str[$i];
|
|---|
| 2167 | $i++;
|
|---|
| 2168 | if(strlen($line[$cnt]) > $size) {
|
|---|
| 2169 | $line[$cnt].="<br />";
|
|---|
| 2170 | $cnt++;
|
|---|
| 2171 | }
|
|---|
| 2172 | }
|
|---|
| 2173 |
|
|---|
| 2174 | foreach($line as $val) {
|
|---|
| 2175 | $ret.=$val;
|
|---|
| 2176 | }
|
|---|
| 2177 | return $ret;
|
|---|
| 2178 | }
|
|---|
| 2179 |
|
|---|
| 2180 | // Æó²ó°Ê¾å·«¤êÊÖ¤µ¤ì¤Æ¤¤¤ë¥¹¥é¥Ã¥·¥å[/]¤ò°ì¤Ä¤ËÊÑ´¹¤¹¤ë¡£
|
|---|
| 2181 | function sfRmDupSlash($istr){
|
|---|
| 2182 | if(ereg("^http://", $istr)) {
|
|---|
| 2183 | $str = substr($istr, 7);
|
|---|
| 2184 | $head = "http://";
|
|---|
| 2185 | } else if(ereg("^https://", $istr)) {
|
|---|
| 2186 | $str = substr($istr, 8);
|
|---|
| 2187 | $head = "https://";
|
|---|
| 2188 | } else {
|
|---|
| 2189 | $str = $istr;
|
|---|
| 2190 | }
|
|---|
| 2191 | $str = ereg_replace("[/]+", "/", $str);
|
|---|
| 2192 | $ret = $head . $str;
|
|---|
| 2193 | return $ret;
|
|---|
| 2194 | }
|
|---|
| 2195 |
|
|---|
| 2196 | function sfEncodeFile($filepath, $enc_type, $out_dir) {
|
|---|
| 2197 | $ifp = fopen($filepath, "r");
|
|---|
| 2198 |
|
|---|
| 2199 | $basename = basename($filepath);
|
|---|
| 2200 | $outpath = $out_dir . "enc_" . $basename;
|
|---|
| 2201 |
|
|---|
| 2202 | $ofp = fopen($outpath, "w+");
|
|---|
| 2203 |
|
|---|
| 2204 | while(!feof($ifp)) {
|
|---|
| 2205 | $line = fgets($ifp);
|
|---|
| 2206 | $line = mb_convert_encoding($line, $enc_type, "auto");
|
|---|
| 2207 | fwrite($ofp, $line);
|
|---|
| 2208 | }
|
|---|
| 2209 |
|
|---|
| 2210 | fclose($ofp);
|
|---|
| 2211 | fclose($ifp);
|
|---|
| 2212 |
|
|---|
| 2213 | return $outpath;
|
|---|
| 2214 | }
|
|---|
| 2215 |
|
|---|
| 2216 | function sfCutString($str, $len, $byte = true, $commadisp = true) {
|
|---|
| 2217 | if($byte) {
|
|---|
| 2218 | if(strlen($str) > ($len + 2)) {
|
|---|
| 2219 | $ret =substr($str, 0, $len);
|
|---|
| 2220 | $cut = substr($str, $len);
|
|---|
| 2221 | } else {
|
|---|
| 2222 | $ret = $str;
|
|---|
| 2223 | $commadisp = false;
|
|---|
| 2224 | }
|
|---|
| 2225 | } else {
|
|---|
| 2226 | if(mb_strlen($str) > ($len + 1)) {
|
|---|
| 2227 | $ret = mb_substr($str, 0, $len);
|
|---|
| 2228 | $cut = mb_substr($str, $len);
|
|---|
| 2229 | } else {
|
|---|
| 2230 | $ret = $str;
|
|---|
| 2231 | $commadisp = false;
|
|---|
| 2232 | }
|
|---|
| 2233 | }
|
|---|
| 2234 |
|
|---|
| 2235 | // ³¨Ê¸»ú¥¿¥°¤ÎÅÓÃæ¤ÇʬÃǤµ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
|
|---|
| 2236 | if (isset($cut)) {
|
|---|
| 2237 | // ʬ³ä°ÌÃÖ¤è¤êÁ°¤ÎºÇ¸å¤Î [ °Ê¹ß¤ò¼èÆÀ¤¹¤ë¡£
|
|---|
| 2238 | $head = strrchr($ret, '[');
|
|---|
| 2239 |
|
|---|
| 2240 | // ʬ³ä°ÌÃÖ¤è¤ê¸å¤ÎºÇ½é¤Î ] °ÊÁ°¤ò¼èÆÀ¤¹¤ë¡£
|
|---|
| 2241 | $tail_pos = strpos($cut, ']');
|
|---|
| 2242 | if ($tail_pos !== false) {
|
|---|
| 2243 | $tail = substr($cut, 0, $tail_pos + 1);
|
|---|
| 2244 | }
|
|---|
| 2245 |
|
|---|
| 2246 | // ʬ³ä°ÌÃÖ¤è¤êÁ°¤Ë [¡¢¸å¤Ë ] ¤¬¸«¤Ä¤«¤Ã¤¿¾ì¹ç¤Ï¡¢[ ¤«¤é ] ¤Þ¤Ç¤ò
|
|---|
| 2247 | // Àܳ¤·¤Æ³¨Ê¸»ú¥¿¥°1¸Äʬ¤Ë¤Ê¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
|
|---|
| 2248 | if ($head !== false && $tail_pos !== false) {
|
|---|
| 2249 | $subject = $head . $tail;
|
|---|
| 2250 | if (preg_match('/^\[emoji:e?\d+\]$/', $subject)) {
|
|---|
| 2251 | // ³¨Ê¸»ú¥¿¥°¤¬¸«¤Ä¤«¤Ã¤¿¤Î¤Çºï½ü¤¹¤ë¡£
|
|---|
| 2252 | $ret = substr($ret, 0, -strlen($head));
|
|---|
| 2253 | }
|
|---|
| 2254 | }
|
|---|
| 2255 | }
|
|---|
| 2256 |
|
|---|
| 2257 | if($commadisp){
|
|---|
| 2258 | $ret = $ret . "...";
|
|---|
| 2259 | }
|
|---|
| 2260 | return $ret;
|
|---|
| 2261 | }
|
|---|
| 2262 |
|
|---|
| 2263 | // ǯ¡¢·î¡¢Äù¤áÆü¤«¤é¡¢Àè·î¤ÎÄù¤áÆü+1¡¢º£·î¤ÎÄù¤áÆü¤òµá¤á¤ë¡£
|
|---|
| 2264 | function sfTermMonth($year, $month, $close_day) {
|
|---|
| 2265 | $end_year = $year;
|
|---|
| 2266 | $end_month = $month;
|
|---|
| 2267 |
|
|---|
| 2268 | // ³«»Ï·î¤¬½ªÎ»·î¤ÈƱ¤¸¤«Èݤ«
|
|---|
| 2269 | $same_month = false;
|
|---|
| 2270 |
|
|---|
| 2271 | // ³ºÅö·î¤ÎËöÆü¤òµá¤á¤ë¡£
|
|---|
| 2272 | $end_last_day = date("d", mktime(0, 0, 0, $month + 1, 0, $year));
|
|---|
| 2273 |
|
|---|
| 2274 | // ·î¤ÎËöÆü¤¬Äù¤áÆü¤è¤ê¾¯¤Ê¤¤¾ì¹ç
|
|---|
| 2275 | if($end_last_day < $close_day) {
|
|---|
| 2276 | // Äù¤áÆü¤ò·îËöÆü¤Ë¹ç¤ï¤»¤ë
|
|---|
| 2277 | $end_day = $end_last_day;
|
|---|
| 2278 | } else {
|
|---|
| 2279 | $end_day = $close_day;
|
|---|
| 2280 | }
|
|---|
| 2281 |
|
|---|
| 2282 | // Á°·î¤Î¼èÆÀ
|
|---|
| 2283 | $tmp_year = date("Y", mktime(0, 0, 0, $month, 0, $year));
|
|---|
| 2284 | $tmp_month = date("m", mktime(0, 0, 0, $month, 0, $year));
|
|---|
| 2285 | // Á°·î¤ÎËöÆü¤òµá¤á¤ë¡£
|
|---|
| 2286 | $start_last_day = date("d", mktime(0, 0, 0, $month, 0, $year));
|
|---|
| 2287 |
|
|---|
| 2288 | // Á°·î¤ÎËöÆü¤¬Äù¤áÆü¤è¤ê¾¯¤Ê¤¤¾ì¹ç
|
|---|
| 2289 | if ($start_last_day < $close_day) {
|
|---|
| 2290 | // ·îËöÆü¤Ë¹ç¤ï¤»¤ë
|
|---|
| 2291 | $tmp_day = $start_last_day;
|
|---|
| 2292 | } else {
|
|---|
| 2293 | $tmp_day = $close_day;
|
|---|
| 2294 | }
|
|---|
| 2295 |
|
|---|
| 2296 | // Àè·î¤ÎËöÆü¤ÎÍâÆü¤ò¼èÆÀ¤¹¤ë
|
|---|
| 2297 | $start_year = date("Y", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
|
|---|
| 2298 | $start_month = date("m", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
|
|---|
| 2299 | $start_day = date("d", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year));
|
|---|
| 2300 |
|
|---|
| 2301 | // ÆüÉդκîÀ®
|
|---|
| 2302 | $start_date = sprintf("%d/%d/%d 00:00:00", $start_year, $start_month, $start_day);
|
|---|
| 2303 | $end_date = sprintf("%d/%d/%d 23:59:59", $end_year, $end_month, $end_day);
|
|---|
| 2304 |
|
|---|
| 2305 | return array($start_date, $end_date);
|
|---|
| 2306 | }
|
|---|
| 2307 |
|
|---|
| 2308 | // PDFÍѤÎRGB¥«¥é¡¼¤òÊÖ¤¹
|
|---|
| 2309 | function sfGetPdfRgb($hexrgb) {
|
|---|
| 2310 | $hex = substr($hexrgb, 0, 2);
|
|---|
| 2311 | $r = hexdec($hex) / 255;
|
|---|
| 2312 |
|
|---|
| 2313 | $hex = substr($hexrgb, 2, 2);
|
|---|
| 2314 | $g = hexdec($hex) / 255;
|
|---|
| 2315 |
|
|---|
| 2316 | $hex = substr($hexrgb, 4, 2);
|
|---|
| 2317 | $b = hexdec($hex) / 255;
|
|---|
| 2318 |
|
|---|
| 2319 | return array($r, $g, $b);
|
|---|
| 2320 | }
|
|---|
| 2321 |
|
|---|
| 2322 | //¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤È¥á¡¼¥ëÇÛ¿®
|
|---|
| 2323 | function sfRegistTmpMailData($mail_flag, $email){
|
|---|
| 2324 | $objQuery = new SC_Query();
|
|---|
| 2325 | $objConn = new SC_DBConn();
|
|---|
| 2326 | $objPage = new LC_Page();
|
|---|
| 2327 |
|
|---|
| 2328 | $random_id = sfGetUniqRandomId();
|
|---|
| 2329 | $arrRegistMailMagazine["mail_flag"] = $mail_flag;
|
|---|
| 2330 | $arrRegistMailMagazine["email"] = $email;
|
|---|
| 2331 | $arrRegistMailMagazine["temp_id"] =$random_id;
|
|---|
| 2332 | $arrRegistMailMagazine["end_flag"]='0';
|
|---|
| 2333 | $arrRegistMailMagazine["update_date"] = 'now()';
|
|---|
| 2334 |
|
|---|
| 2335 | //¥á¥ë¥Þ¥¬²¾ÅÐÏ¿Íѥե饰
|
|---|
| 2336 | $flag = $objQuery->count("dtb_customer_mail_temp", "email=?", array($email));
|
|---|
| 2337 | $objConn->query("BEGIN");
|
|---|
| 2338 | switch ($flag){
|
|---|
| 2339 | case '0':
|
|---|
| 2340 | $objConn->autoExecute("dtb_customer_mail_temp",$arrRegistMailMagazine);
|
|---|
| 2341 | break;
|
|---|
| 2342 |
|
|---|
| 2343 | case '1':
|
|---|
| 2344 | $objConn->autoExecute("dtb_customer_mail_temp",$arrRegistMailMagazine, "email = '" .addslashes($email). "'");
|
|---|
| 2345 | break;
|
|---|
| 2346 | }
|
|---|
| 2347 | $objConn->query("COMMIT");
|
|---|
| 2348 | $subject = sfMakeSubject('¥á¥ë¥Þ¥¬²¾ÅÐÏ¿¤¬´°Î»¤·¤Þ¤·¤¿¡£');
|
|---|
| 2349 | $objPage->tpl_url = SSL_URL."mailmagazine/regist.php?temp_id=".$arrRegistMailMagazine['temp_id'];
|
|---|
| 2350 | switch ($mail_flag){
|
|---|
| 2351 | case '1':
|
|---|
| 2352 | $objPage->tpl_name = "ÅÐÏ¿";
|
|---|
| 2353 | $objPage->tpl_kindname = "HTML";
|
|---|
| 2354 | break;
|
|---|
| 2355 |
|
|---|
| 2356 | case '2':
|
|---|
| 2357 | $objPage->tpl_name = "ÅÐÏ¿";
|
|---|
| 2358 | $objPage->tpl_kindname = "¥Æ¥¥¹¥È";
|
|---|
| 2359 | break;
|
|---|
| 2360 |
|
|---|
| 2361 | case '3':
|
|---|
| 2362 | $objPage->tpl_name = "²ò½ü";
|
|---|
| 2363 | break;
|
|---|
| 2364 | }
|
|---|
| 2365 | $objPage->tpl_email = $email;
|
|---|
| 2366 | sfSendTplMail($email, $subject, 'mail_templates/mailmagazine_temp.tpl', $objPage);
|
|---|
| 2367 | }
|
|---|
| 2368 |
|
|---|
| 2369 | // ºÆµ¢Åª¤Ë¿ÃÊÇÛÎó¤ò¸¡º÷¤·¤Æ°ì¼¡¸µÇÛÎó(Hidden°úÅϤ·ÍÑÇÛÎó)¤ËÊÑ´¹¤¹¤ë¡£
|
|---|
| 2370 | function sfMakeHiddenArray($arrSrc, $arrDst = array(), $parent_key = "") {
|
|---|
| 2371 | if(is_array($arrSrc)) {
|
|---|
| 2372 | foreach($arrSrc as $key => $val) {
|
|---|
| 2373 | if($parent_key != "") {
|
|---|
| 2374 | $keyname = $parent_key . "[". $key . "]";
|
|---|
| 2375 | } else {
|
|---|
| 2376 | $keyname = $key;
|
|---|
| 2377 | }
|
|---|
| 2378 | if(is_array($val)) {
|
|---|
| 2379 | $arrDst = sfMakeHiddenArray($val, $arrDst, $keyname);
|
|---|
| 2380 | } else {
|
|---|
| 2381 | $arrDst[$keyname] = $val;
|
|---|
| 2382 | }
|
|---|
| 2383 | }
|
|---|
| 2384 | }
|
|---|
| 2385 | return $arrDst;
|
|---|
| 2386 | }
|
|---|
| 2387 |
|
|---|
| 2388 | // DB¼èÆÀÆü»þ¤ò¥¿¥¤¥à¤ËÊÑ´¹
|
|---|
| 2389 | function sfDBDatetoTime($db_date) {
|
|---|
| 2390 | $date = ereg_replace("\..*$","",$db_date);
|
|---|
| 2391 | $time = strtotime($date);
|
|---|
| 2392 | return $time;
|
|---|
| 2393 | }
|
|---|
| 2394 |
|
|---|
| 2395 | /** |
|---|
| 2396 | * ½ÐÎϤκݤ˥ƥó¥×¥ì¡¼¥È¤òÀÚ¤êÂØ¤¨¤é¤ì¤ë |
|---|
| 2397 | * 1.4.3a-beta°Ê¹ß¤Ç¤Ï»ÈÍѤ·¤Ê¤¤ |
|---|
| 2398 | *
|
|---|
| 2399 | * index.php?tpl=test.tpl
|
|---|
| 2400 | */
|
|---|
| 2401 | function sfCustomDisplay($objPage, $is_mobile = false) {
|
|---|
| 2402 | $basename = basename($_SERVER["REQUEST_URI"]);
|
|---|
| 2403 |
|
|---|
| 2404 | if($basename == "") {
|
|---|
| 2405 | $path = $_SERVER["REQUEST_URI"] . "index.php";
|
|---|
| 2406 | } else {
|
|---|
| 2407 | $path = $_SERVER["REQUEST_URI"];
|
|---|
| 2408 | }
|
|---|
| 2409 |
|
|---|
| 2410 | if($_GET['tpl'] != "") {
|
|---|
| 2411 | $tpl_name = $_GET['tpl'];
|
|---|
| 2412 | } else {
|
|---|
| 2413 | $tpl_name = ereg_replace("^/", "", $path);
|
|---|
| 2414 | $tpl_name = ereg_replace("/", "_", $tpl_name);
|
|---|
| 2415 | $tpl_name = ereg_replace("(\.php$|\.html$)", ".tpl", $tpl_name);
|
|---|
| 2416 | }
|
|---|
| 2417 |
|
|---|
| 2418 | $template_path = TEMPLATE_FTP_DIR . $tpl_name;
|
|---|
| 2419 |
|
|---|
| 2420 | if($is_mobile === true) {
|
|---|
| 2421 | $objView = new SC_MobileView();
|
|---|
| 2422 | $objView->assignobj($objPage);
|
|---|
| 2423 | $objView->display(SITE_FRAME);
|
|---|
| 2424 | } else if(file_exists($template_path)) {
|
|---|
| 2425 | $objView = new SC_UserView(TEMPLATE_FTP_DIR, COMPILE_FTP_DIR);
|
|---|
| 2426 | $objView->assignobj($objPage);
|
|---|
| 2427 | $objView->display($tpl_name);
|
|---|
| 2428 | } else {
|
|---|
| 2429 | $objView = new SC_SiteView();
|
|---|
| 2430 | $objView->assignobj($objPage);
|
|---|
| 2431 | $objView->display(SITE_FRAME);
|
|---|
| 2432 | }
|
|---|
| 2433 | }
|
|---|
| 2434 |
|
|---|
| 2435 | //²ñ°÷ÊÔ½¸ÅÐÏ¿½èÍý
|
|---|
| 2436 | function sfEditCustomerData($array, $arrRegistColumn) {
|
|---|
| 2437 | $objQuery = new SC_Query();
|
|---|
| 2438 |
|
|---|
| 2439 | foreach ($arrRegistColumn as $data) {
|
|---|
| 2440 | if ($data["column"] != "password") {
|
|---|
| 2441 | if($array[ $data['column'] ] != "") {
|
|---|
| 2442 | $arrRegist[ $data["column"] ] = $array[ $data["column"] ];
|
|---|
| 2443 | } else {
|
|---|
| 2444 | $arrRegist[ $data['column'] ] = NULL;
|
|---|
| 2445 | }
|
|---|
| 2446 | }
|
|---|
| 2447 | }
|
|---|
| 2448 | if (strlen($array["year"]) > 0 && strlen($array["month"]) > 0 && strlen($array["day"]) > 0) {
|
|---|
| 2449 | $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
|
|---|
| 2450 | } else {
|
|---|
| 2451 | $arrRegist["birth"] = NULL;
|
|---|
| 2452 | }
|
|---|
| 2453 |
|
|---|
| 2454 | //-- ¥Ñ¥¹¥ï¡¼¥É¤Î¹¹¿·¤¬¤¢¤ë¾ì¹ç¤Ï°Å¹æ²½¡£¡Ê¹¹¿·¤¬¤Ê¤¤¾ì¹ç¤ÏUPDATEʸ¤ò¹½À®¤·¤Ê¤¤¡Ë
|
|---|
| 2455 | if ($array["password"] != DEFAULT_PASSWORD) $arrRegist["password"] = sha1($array["password"] . ":" . AUTH_MAGIC);
|
|---|
| 2456 | $arrRegist["update_date"] = "NOW()";
|
|---|
| 2457 |
|
|---|
| 2458 | //-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô
|
|---|
| 2459 | if (defined('MOBILE_SITE')) {
|
|---|
| 2460 | $arrRegist['email_mobile'] = $arrRegist['email'];
|
|---|
| 2461 | unset($arrRegist['email']);
|
|---|
| 2462 | }
|
|---|
| 2463 | $objQuery->begin();
|
|---|
| 2464 | $objQuery->update("dtb_customer", $arrRegist, "customer_id = ? ", array($array['customer_id']));
|
|---|
| 2465 | $objQuery->commit();
|
|---|
| 2466 | }
|
|---|
| 2467 |
|
|---|
| 2468 | // PHP¤Îmb_convert_encoding´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
|
|---|
| 2469 | function sf_mb_convert_encoding($str, $encode = 'CHAR_CODE') {
|
|---|
| 2470 | return mb_convert_encoding($str, $encode);
|
|---|
| 2471 | }
|
|---|
| 2472 |
|
|---|
| 2473 | // PHP¤Îmktime´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
|
|---|
| 2474 | function sf_mktime($format, $hour=0, $minute=0, $second=0, $month=1, $day=1, $year=1999) {
|
|---|
| 2475 | return date($format,mktime($hour, $minute, $second, $month, $day, $year));
|
|---|
| 2476 | }
|
|---|
| 2477 |
|
|---|
| 2478 | // PHP¤Îdate´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë
|
|---|
| 2479 | function sf_date($format, $timestamp = '') {
|
|---|
| 2480 | return date( $format, $timestamp);
|
|---|
| 2481 | }
|
|---|
| 2482 |
|
|---|
| 2483 | // ¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤Î·¿¤òÊÑ´¹¤¹¤ë
|
|---|
| 2484 | function sfChangeCheckBox($data , $tpl = false){
|
|---|
| 2485 | if ($tpl) {
|
|---|
| 2486 | if ($data == 1){
|
|---|
| 2487 | return 'checked';
|
|---|
| 2488 | }else{
|
|---|
| 2489 | return "";
|
|---|
| 2490 | }
|
|---|
| 2491 | }else{
|
|---|
| 2492 | if ($data == "on"){
|
|---|
| 2493 | return 1;
|
|---|
| 2494 | }else{
|
|---|
| 2495 | return 2;
|
|---|
| 2496 | }
|
|---|
| 2497 | }
|
|---|
| 2498 | }
|
|---|
| 2499 |
|
|---|
| 2500 | function sfCategory_Count($objQuery){
|
|---|
| 2501 | $sql = "";
|
|---|
| 2502 |
|
|---|
| 2503 | //¥Æ¡¼¥Ö¥ëÆâÍÆ¤Îºï½ü
|
|---|
| 2504 | $objQuery->query("DELETE FROM dtb_category_count");
|
|---|
| 2505 | $objQuery->query("DELETE FROM dtb_category_total_count");
|
|---|
| 2506 |
|
|---|
| 2507 | //³Æ¥«¥Æ¥´¥êÆâ¤Î¾¦ÉÊ¿ô¤ò¿ô¤¨¤Æ³ÊǼ
|
|---|
| 2508 | $sql = " INSERT INTO dtb_category_count(category_id, product_count, create_date) ";
|
|---|
| 2509 | $sql .= " SELECT T1.category_id, count(T2.category_id), now() FROM dtb_category AS T1 LEFT JOIN dtb_products AS T2 ";
|
|---|
| 2510 | $sql .= " ON T1.category_id = T2.category_id ";
|
|---|
| 2511 | $sql .= " WHERE T2.del_flg = 0 AND T2.status = 1 ";
|
|---|
| 2512 | $sql .= " GROUP BY T1.category_id, T2.category_id ";
|
|---|
| 2513 | $objQuery->query($sql);
|
|---|
| 2514 |
|
|---|
| 2515 | //»Ò¥«¥Æ¥´¥êÆâ¤Î¾¦ÉÊ¿ô¤ò½¸·×¤¹¤ë
|
|---|
| 2516 | $arrCat = $objQuery->getAll("SELECT * FROM dtb_category");
|
|---|
| 2517 |
|
|---|
| 2518 | $sql = "";
|
|---|
| 2519 | foreach($arrCat as $key => $val){
|
|---|
| 2520 |
|
|---|
| 2521 | // »ÒID°ìÍ÷¤ò¼èÆÀ
|
|---|
| 2522 | $arrRet = sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $val['category_id']);
|
|---|
| 2523 | $line = sfGetCommaList($arrRet);
|
|---|
| 2524 |
|
|---|
| 2525 | $sql = " INSERT INTO dtb_category_total_count(category_id, product_count, create_date) ";
|
|---|
| 2526 | $sql .= " SELECT ?, SUM(product_count), now() FROM dtb_category_count ";
|
|---|
| 2527 | $sql .= " WHERE category_id IN (" . $line . ")";
|
|---|
| 2528 |
|
|---|
| 2529 | $objQuery->query($sql, array($val['category_id']));
|
|---|
| 2530 | }
|
|---|
| 2531 | }
|
|---|
| 2532 |
|
|---|
| 2533 | // 2¤Ä¤ÎÇÛÎó¤òÍѤ¤¤ÆÏ¢ÁÛÇÛÎó¤òºîÀ®¤¹¤ë
|
|---|
| 2534 | function sfarrCombine($arrKeys, $arrValues) {
|
|---|
| 2535 |
|
|---|
| 2536 | if(count($arrKeys) <= 0 and count($arrValues) <= 0) return array();
|
|---|
| 2537 |
|
|---|
| 2538 | $keys = array_values($arrKeys);
|
|---|
| 2539 | $vals = array_values($arrValues);
|
|---|
| 2540 |
|
|---|
| 2541 | $max = max( count( $keys ), count( $vals ) );
|
|---|
| 2542 | $combine_ary = array();
|
|---|
| 2543 | for($i=0; $i<$max; $i++) {
|
|---|
| 2544 | $combine_ary[$keys[$i]] = $vals[$i];
|
|---|
| 2545 | }
|
|---|
| 2546 | if(is_array($combine_ary)) return $combine_ary;
|
|---|
| 2547 |
|
|---|
| 2548 | return false;
|
|---|
| 2549 | }
|
|---|
| 2550 |
|
|---|
| 2551 | /* ³¬Áع½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤é»ÒIDÇÛÎó¤ò¼èÆÀ¤¹¤ë */
|
|---|
| 2552 | function sfGetChildrenArray($table, $pid_name, $id_name, $id) {
|
|---|
| 2553 | $objQuery = new SC_Query();
|
|---|
| 2554 | $col = $pid_name . "," . $id_name;
|
|---|
| 2555 | $arrData = $objQuery->select($col, $table);
|
|---|
| 2556 |
|
|---|
| 2557 | $arrPID = array();
|
|---|
| 2558 | $arrPID[] = $id;
|
|---|
| 2559 | $arrChildren = array();
|
|---|
| 2560 | $arrChildren[] = $id;
|
|---|
| 2561 |
|
|---|
| 2562 | $arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID);
|
|---|
| 2563 |
|
|---|
| 2564 | while(count($arrRet) > 0) {
|
|---|
| 2565 | $arrChildren = array_merge($arrChildren, $arrRet);
|
|---|
| 2566 | $arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrRet);
|
|---|
| 2567 | }
|
|---|
| 2568 |
|
|---|
| 2569 | return $arrChildren;
|
|---|
| 2570 | }
|
|---|
| 2571 |
|
|---|
| 2572 | /* ¿ÆIDľ²¼¤Î»ÒID¤ò¤¹¤Ù¤Æ¼èÆÀ¤¹¤ë */
|
|---|
| 2573 | function sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID) {
|
|---|
| 2574 | $arrChildren = array();
|
|---|
| 2575 | $max = count($arrData);
|
|---|
| 2576 |
|
|---|
| 2577 | for($i = 0; $i < $max; $i++) {
|
|---|
| 2578 | foreach($arrPID as $val) {
|
|---|
| 2579 | if($arrData[$i][$pid_name] == $val) {
|
|---|
| 2580 | $arrChildren[] = $arrData[$i][$id_name];
|
|---|
| 2581 | }
|
|---|
| 2582 | }
|
|---|
| 2583 | }
|
|---|
| 2584 | return $arrChildren;
|
|---|
| 2585 | }
|
|---|
| 2586 |
|
|---|
| 2587 |
|
|---|
| 2588 | /* ³¬Áع½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤é¿ÆIDÇÛÎó¤ò¼èÆÀ¤¹¤ë */
|
|---|
| 2589 | function sfGetParentsArray($table, $pid_name, $id_name, $id) {
|
|---|
| 2590 | $objQuery = new SC_Query();
|
|---|
| 2591 | $col = $pid_name . "," . $id_name;
|
|---|
| 2592 | $arrData = $objQuery->select($col, $table);
|
|---|
| 2593 |
|
|---|
| 2594 | $arrParents = array();
|
|---|
| 2595 | $arrParents[] = $id;
|
|---|
| 2596 | $child = $id;
|
|---|
| 2597 |
|
|---|
| 2598 | $ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $child);
|
|---|
| 2599 |
|
|---|
| 2600 | while($ret != "") {
|
|---|
| 2601 | $arrParents[] = $ret;
|
|---|
| 2602 | $ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $ret);
|
|---|
| 2603 | }
|
|---|
| 2604 |
|
|---|
| 2605 | $arrParents = array_reverse($arrParents);
|
|---|
| 2606 |
|
|---|
| 2607 | return $arrParents;
|
|---|
| 2608 | }
|
|---|
| 2609 |
|
|---|
| 2610 | /* »ÒID½ê°¤¹¤ë¿ÆID¤ò¼èÆÀ¤¹¤ë */
|
|---|
| 2611 | function sfGetParentsArraySub($arrData, $pid_name, $id_name, $child) {
|
|---|
| 2612 | $max = count($arrData);
|
|---|
| 2613 | $parent = "";
|
|---|
| 2614 | for($i = 0; $i < $max; $i++) {
|
|---|
| 2615 | if($arrData[$i][$id_name] == $child) {
|
|---|
| 2616 | $parent = $arrData[$i][$pid_name];
|
|---|
| 2617 | break;
|
|---|
| 2618 | }
|
|---|
| 2619 | }
|
|---|
| 2620 | return $parent;
|
|---|
| 2621 | }
|
|---|
| 2622 |
|
|---|
| 2623 | /* ³¬Áع½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤éÍ¿¤¨¤é¤ì¤¿ID¤Î·»Äï¤ò¼èÆÀ¤¹¤ë */
|
|---|
| 2624 | function sfGetBrothersArray($arrData, $pid_name, $id_name, $arrPID) {
|
|---|
| 2625 | $max = count($arrData);
|
|---|
| 2626 |
|
|---|
| 2627 | $arrBrothers = array();
|
|---|
| 2628 | foreach($arrPID as $id) {
|
|---|
| 2629 | // ¿ÆID¤ò¸¡º÷¤¹¤ë
|
|---|
| 2630 | for($i = 0; $i < $max; $i++) {
|
|---|
| 2631 | if($arrData[$i][$id_name] == $id) {
|
|---|
| 2632 | $parent = $arrData[$i][$pid_name];
|
|---|
| 2633 | break;
|
|---|
| 2634 | }
|
|---|
| 2635 | }
|
|---|
| 2636 | // ·»ÄïID¤ò¸¡º÷¤¹¤ë
|
|---|
| 2637 | for($i = 0; $i < $max; $i++) {
|
|---|
| 2638 | if($arrData[$i][$pid_name] == $parent) {
|
|---|
| 2639 | $arrBrothers[] = $arrData[$i][$id_name];
|
|---|
| 2640 | }
|
|---|
| 2641 | }
|
|---|
| 2642 | }
|
|---|
| 2643 | return $arrBrothers;
|
|---|
| 2644 | }
|
|---|
| 2645 |
|
|---|
| 2646 | /* ³¬Áع½Â¤¤Î¥Æ¡¼¥Ö¥ë¤«¤éÍ¿¤¨¤é¤ì¤¿ID¤Îľ°¤Î»Ò¤ò¼èÆÀ¤¹¤ë */
|
|---|
| 2647 | function sfGetUnderChildrenArray($arrData, $pid_name, $id_name, $parent) {
|
|---|
| 2648 | $max = count($arrData);
|
|---|
| 2649 |
|
|---|
| 2650 | $arrChildren = array();
|
|---|
| 2651 | // »ÒID¤ò¸¡º÷¤¹¤ë
|
|---|
| 2652 | for($i = 0; $i < $max; $i++) {
|
|---|
| 2653 | if($arrData[$i][$pid_name] == $parent) {
|
|---|
| 2654 | $arrChildren[] = $arrData[$i][$id_name];
|
|---|
| 2655 | }
|
|---|
| 2656 | }
|
|---|
| 2657 | return $arrChildren;
|
|---|
| 2658 | }
|
|---|
| 2659 |
|
|---|
| 2660 |
|
|---|
| 2661 | // ¥«¥Æ¥´¥ê¥Ä¥ê¡¼¤Î¼èÆÀ
|
|---|
| 2662 | function sfGetCatTree($parent_category_id, $count_check = false) {
|
|---|
| 2663 | $objQuery = new SC_Query();
|
|---|
| 2664 | $col = "";
|
|---|
| 2665 | $col .= " cat.category_id,";
|
|---|
| 2666 | $col .= " cat.category_name,";
|
|---|
| 2667 | $col .= " cat.parent_category_id,";
|
|---|
| 2668 | $col .= " cat.level,";
|
|---|
| 2669 | $col .= " cat.rank,";
|
|---|
| 2670 | $col .= " cat.creator_id,";
|
|---|
| 2671 | $col .= " cat.create_date,";
|
|---|
| 2672 | $col .= " cat.update_date,";
|
|---|
| 2673 | $col .= " cat.del_flg, ";
|
|---|
| 2674 | $col .= " ttl.product_count";
|
|---|
| 2675 | $from = "dtb_category as cat left join dtb_category_total_count as ttl on ttl.category_id = cat.category_id";
|
|---|
| 2676 | // ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯
|
|---|
| 2677 | if($count_check) {
|
|---|
| 2678 | $where = "del_flg = 0 AND product_count > 0";
|
|---|
| 2679 | } else {
|
|---|
| 2680 | $where = "del_flg = 0";
|
|---|
| 2681 | }
|
|---|
| 2682 | $objQuery->setoption("ORDER BY rank DESC");
|
|---|
| 2683 | $arrRet = $objQuery->select($col, $from, $where);
|
|---|
| 2684 |
|
|---|
| 2685 | $arrParentID = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id);
|
|---|
| 2686 |
|
|---|
| 2687 | foreach($arrRet as $key => $array) {
|
|---|
| 2688 | foreach($arrParentID as $val) {
|
|---|
| 2689 | if($array['category_id'] == $val) {
|
|---|
| 2690 | $arrRet[$key]['display'] = 1;
|
|---|
| 2691 | break;
|
|---|
| 2692 | }
|
|---|
| 2693 | }
|
|---|
| 2694 | }
|
|---|
| 2695 |
|
|---|
| 2696 | return $arrRet;
|
|---|
| 2697 | }
|
|---|
| 2698 |
|
|---|
| 2699 | // ¿Æ¥«¥Æ¥´¥ê¡¼¤òÏ¢·ë¤·¤¿Ê¸»úÎó¤ò¼èÆÀ¤¹¤ë
|
|---|
| 2700 | function sfGetCatCombName($category_id){
|
|---|
| 2701 | // ¾¦Éʤ¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ
|
|---|
| 2702 | $objQuery = new SC_Query();
|
|---|
| 2703 | $arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);
|
|---|
| 2704 | $ConbName = "";
|
|---|
| 2705 |
|
|---|
| 2706 | // ¥«¥Æ¥´¥ê¡¼Ì¾¾Î¤ò¼èÆÀ¤¹¤ë
|
|---|
| 2707 | foreach($arrCatID as $key => $val){
|
|---|
| 2708 | $sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
|
|---|
| 2709 | $arrVal = array($val);
|
|---|
| 2710 | $CatName = $objQuery->getOne($sql,$arrVal);
|
|---|
| 2711 | $ConbName .= $CatName . ' | ';
|
|---|
| 2712 | }
|
|---|
| 2713 | // ºÇ¸å¤Î ¡Ã ¤ò¥«¥Ã¥È¤¹¤ë
|
|---|
| 2714 | $ConbName = substr_replace($ConbName, "", strlen($ConbName) - 2, 2);
|
|---|
| 2715 |
|
|---|
| 2716 | return $ConbName;
|
|---|
| 2717 | }
|
|---|
| 2718 |
|
|---|
| 2719 | // »ØÄꤷ¤¿¥«¥Æ¥´¥ê¡¼ID¤ÎÂ祫¥Æ¥´¥ê¡¼¤ò¼èÆÀ¤¹¤ë
|
|---|
| 2720 | function sfGetFirstCat($category_id){
|
|---|
| 2721 | // ¾¦Éʤ¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ
|
|---|
| 2722 | $objQuery = new SC_Query();
|
|---|
| 2723 | $arrRet = array();
|
|---|
| 2724 | $arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id);
|
|---|
| 2725 | $arrRet['id'] = $arrCatID[0];
|
|---|
| 2726 |
|
|---|
| 2727 | // ¥«¥Æ¥´¥ê¡¼Ì¾¾Î¤ò¼èÆÀ¤¹¤ë
|
|---|
| 2728 | $sql = "SELECT category_name FROM dtb_category WHERE category_id = ?";
|
|---|
| 2729 | $arrVal = array($arrRet['id']);
|
|---|
| 2730 | $arrRet['name'] = $objQuery->getOne($sql,$arrVal);
|
|---|
| 2731 |
|
|---|
| 2732 | return $arrRet;
|
|---|
| 2733 | }
|
|---|
| 2734 |
|
|---|
| 2735 | //MySQLÍѤÎSQLʸ¤ËÊѹ¹¤¹¤ë
|
|---|
| 2736 | function sfChangeMySQL($sql){
|
|---|
| 2737 | // ²þ¹Ô¡¢¥¿¥Ö¤ò1¥¹¥Ú¡¼¥¹¤ËÊÑ´¹
|
|---|
| 2738 | $sql = preg_replace("/[\r\n\t]/"," ",$sql);
|
|---|
| 2739 |
|
|---|
| 2740 | $sql = sfChangeView($sql); // viewɽ¤ò¥¤¥ó¥é¥¤¥ó¥Ó¥å¡¼¤ËÊÑ´¹¤¹¤ë
|
|---|
| 2741 | $sql = sfChangeILIKE($sql); // ILIKE¸¡º÷¤òLIKE¸¡º÷¤ËÊÑ´¹¤¹¤ë
|
|---|
| 2742 | $sql = sfChangeRANDOM($sql); // RANDOM()¤òRAND()¤ËÊÑ´¹¤¹¤ë
|
|---|
| 2743 |
|
|---|
| 2744 | return $sql;
|
|---|
| 2745 | }
|
|---|
| 2746 |
|
|---|
| 2747 | // SQL¤ÎÃæ¤Ëview¤¬Â¸ºß¤·¤Æ¤¤¤ë¤«¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¡£
|
|---|
| 2748 | function sfInArray($sql){
|
|---|
| 2749 | global $arrView;
|
|---|
| 2750 |
|
|---|
| 2751 | foreach($arrView as $key => $val){
|
|---|
| 2752 | if (strcasecmp($sql, $val) == 0){
|
|---|
| 2753 | $changesql = eregi_replace("($key)", "$val", $sql);
|
|---|
| 2754 | sfInArray($changesql);
|
|---|
| 2755 | }
|
|---|
| 2756 | }
|
|---|
| 2757 | return false;
|
|---|
| 2758 | }
|
|---|
| 2759 |
|
|---|
| 2760 | // SQL¥·¥ó¥°¥ë¥¯¥©¡¼¥ÈÂбþ
|
|---|
| 2761 | function sfQuoteSmart($in){
|
|---|
| 2762 |
|
|---|
| 2763 | if (is_int($in) || is_double($in)) {
|
|---|
| 2764 | return $in;
|
|---|
| 2765 | } elseif (is_bool($in)) {
|
|---|
| 2766 | return $in ? 1 : 0;
|
|---|
| 2767 | } elseif (is_null($in)) {
|
|---|
| 2768 | return 'NULL';
|
|---|
| 2769 | } else {
|
|---|
| 2770 | return "'" . str_replace("'", "''", $in) . "'";
|
|---|
| 2771 | }
|
|---|
| 2772 | }
|
|---|
| 2773 |
|
|---|
| 2774 | // viewɽ¤ò¥¤¥ó¥é¥¤¥ó¥Ó¥å¡¼¤ËÊÑ´¹¤¹¤ë
|
|---|
| 2775 | function sfChangeView($sql){
|
|---|
| 2776 | global $arrView;
|
|---|
| 2777 | global $arrViewWhere;
|
|---|
| 2778 |
|
|---|
| 2779 | $arrViewTmp = $arrView;
|
|---|
| 2780 |
|
|---|
| 2781 | // view¤Îwhere¤òÊÑ´¹
|
|---|
| 2782 | foreach($arrViewTmp as $key => $val){
|
|---|
| 2783 | $arrViewTmp[$key] = strtr($arrViewTmp[$key], $arrViewWhere);
|
|---|
| 2784 | }
|
|---|
| 2785 |
|
|---|
| 2786 | // view¤òÊÑ´¹
|
|---|
| 2787 | $changesql = strtr($sql, $arrViewTmp);
|
|---|
| 2788 |
|
|---|
| 2789 | return $changesql;
|
|---|
| 2790 | }
|
|---|
| 2791 |
|
|---|
| 2792 | // ILIKE¸¡º÷¤òLIKE¸¡º÷¤ËÊÑ´¹¤¹¤ë
|
|---|
| 2793 | function sfChangeILIKE($sql){
|
|---|
| 2794 | $changesql = eregi_replace("(ILIKE )", "LIKE BINARY ", $sql);
|
|---|
| 2795 | return $changesql;
|
|---|
| 2796 | }
|
|---|
| 2797 |
|
|---|
| 2798 | // RANDOM()¤òRAND()¤ËÊÑ´¹¤¹¤ë
|
|---|
| 2799 | function sfChangeRANDOM($sql){
|
|---|
| 2800 | $changesql = eregi_replace("( RANDOM)", " RAND", $sql);
|
|---|
| 2801 | return $changesql;
|
|---|
| 2802 | }
|
|---|
| 2803 |
|
|---|
| 2804 | // view¤Îwhere¤òÃÖ´¹¤¹¤ë
|
|---|
| 2805 | function sfViewWhere($target, $where = "", $arrval = array(), $option = ""){
|
|---|
| 2806 | global $arrViewWhere;
|
|---|
| 2807 | $arrWhere = split("[?]", $where);
|
|---|
| 2808 | $where_tmp = " WHERE " . $arrWhere[0];
|
|---|
| 2809 | for($i = 1; $i < count($arrWhere); $i++){
|
|---|
| 2810 | $where_tmp .= sfQuoteSmart($arrval[$i - 1]) . $arrWhere[$i];
|
|---|
| 2811 | }
|
|---|
| 2812 | $arrViewWhere[$target] = $where_tmp . " " . $option;
|
|---|
| 2813 | }
|
|---|
| 2814 |
|
|---|
| 2815 | // ¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Î¥Õ¥¡¥¤¥ë¤òºÆµ¢Åª¤Ë¥³¥Ô¡¼
|
|---|
| 2816 | function sfCopyDir($src, $des, $mess, $override = false){
|
|---|
| 2817 | if(!is_dir($src)){
|
|---|
| 2818 | return false;
|
|---|
| 2819 | }
|
|---|
| 2820 |
|
|---|
| 2821 | $oldmask = umask(0);
|
|---|
| 2822 | $mod= stat($src);
|
|---|
| 2823 |
|
|---|
| 2824 | // ¥Ç¥£¥ì¥¯¥È¥ê¤¬¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë
|
|---|
| 2825 | if(!file_exists($des)) {
|
|---|
| 2826 | if(!mkdir($des, $mod[2])) {
|
|---|
| 2827 | print("path:" . $des);
|
|---|
| 2828 | }
|
|---|
| 2829 | }
|
|---|
| 2830 |
|
|---|
| 2831 | $fileArray=glob( $src."*" );
|
|---|
| 2832 | foreach( $fileArray as $key => $data_ ){
|
|---|
| 2833 | // CVS´ÉÍý¥Õ¥¡¥¤¥ë¤Ï¥³¥Ô¡¼¤·¤Ê¤¤
|
|---|
| 2834 | if(ereg("/CVS/Entries", $data_)) {
|
|---|
| 2835 | break;
|
|---|
| 2836 | }
|
|---|
| 2837 | if(ereg("/CVS/Repository", $data_)) {
|
|---|
| 2838 | break;
|
|---|
| 2839 | }
|
|---|
| 2840 | if(ereg("/CVS/Root", $data_)) {
|
|---|
| 2841 | break;
|
|---|
| 2842 | }
|
|---|
| 2843 |
|
|---|
| 2844 | mb_ereg("^(.*[\/])(.*)",$data_, $matches);
|
|---|
| 2845 | $data=$matches[2];
|
|---|
| 2846 | if( is_dir( $data_ ) ){
|
|---|
| 2847 | $mess = sfCopyDir( $data_.'/', $des.$data.'/', $mess, $override);
|
|---|
| 2848 | }else{
|
|---|
| 2849 | if(!$override && file_exists($des.$data)) {
|
|---|
| 2850 | $mess.= $des.$data . "¡§¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤¹\n";
|
|---|
| 2851 | } else {
|
|---|
| 2852 | if(@copy( $data_, $des.$data)) {
|
|---|
| 2853 | $mess.= $des.$data . "¡§¥³¥Ô¡¼À®¸ù\n";
|
|---|
| 2854 | } else {
|
|---|
| 2855 | $mess.= $des.$data . "¡§¥³¥Ô¡¼¼ºÇÔ\n";
|
|---|
| 2856 | }
|
|---|
| 2857 | }
|
|---|
| 2858 | $mod=stat($data_ );
|
|---|
| 2859 | }
|
|---|
| 2860 | }
|
|---|
| 2861 | umask($oldmask);
|
|---|
| 2862 | return $mess;
|
|---|
| 2863 | }
|
|---|
| 2864 |
|
|---|
| 2865 | // »ØÄꤷ¤¿¥Õ¥©¥ë¥ÀÆâ¤Î¥Õ¥¡¥¤¥ë¤òÁ´¤Æºï½ü¤¹¤ë
|
|---|
| 2866 | function sfDelFile($dir){
|
|---|
| 2867 | $dh = opendir($dir);
|
|---|
| 2868 | // ¥Õ¥©¥ë¥ÀÆâ¤Î¥Õ¥¡¥¤¥ë¤òºï½ü
|
|---|
| 2869 | while($file = readdir($dh)){
|
|---|
| 2870 | if ($file == "." or $file == "..") continue;
|
|---|
| 2871 | $del_file = $dir . "/" . $file;
|
|---|
| 2872 | if(is_file($del_file)){
|
|---|
| 2873 | $ret = unlink($dir . "/" . $file);
|
|---|
| 2874 | }else if (is_dir($del_file)){
|
|---|
| 2875 | $ret = sfDelFile($del_file);
|
|---|
| 2876 | }
|
|---|
| 2877 |
|
|---|
| 2878 | if(!$ret){
|
|---|
| 2879 | return $ret;
|
|---|
| 2880 | }
|
|---|
| 2881 | }
|
|---|
| 2882 |
|
|---|
| 2883 | // ÊĤ¸¤ë
|
|---|
| 2884 | closedir($dh);
|
|---|
| 2885 |
|
|---|
| 2886 | // ¥Õ¥©¥ë¥À¤òºï½ü
|
|---|
| 2887 | return rmdir($dir);
|
|---|
| 2888 | }
|
|---|
| 2889 |
|
|---|
| 2890 | /*
|
|---|
| 2891 | * ´Ø¿ô̾¡§sfWriteFile
|
|---|
| 2892 | * °ú¿ô1 ¡§½ñ¤¹þ¤à¥Ç¡¼¥¿
|
|---|
| 2893 | * °ú¿ô2 ¡§¥Õ¥¡¥¤¥ë¥Ñ¥¹
|
|---|
| 2894 | * °ú¿ô3 ¡§½ñ¤¹þ¤ß¥¿¥¤¥×
|
|---|
| 2895 | * °ú¿ô4 ¡§¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó
|
|---|
| 2896 | * Ìá¤êÃÍ¡§·ë²Ì¥Õ¥é¥° À®¸ù¤Ê¤é true ¼ºÇԤʤé false
|
|---|
| 2897 | * ÀâÌÀ¡¡¡§¥Õ¥¡¥¤¥ë½ñ¤½Ð¤·
|
|---|
| 2898 | */
|
|---|
| 2899 | function sfWriteFile($str, $path, $type, $permission = "") {
|
|---|
| 2900 | //¥Õ¥¡¥¤¥ë¤ò³«¤¯
|
|---|
| 2901 | if (!($file = fopen ($path, $type))) {
|
|---|
| 2902 | return false;
|
|---|
| 2903 | }
|
|---|
| 2904 |
|
|---|
| 2905 | //¥Õ¥¡¥¤¥ë¥í¥Ã¥¯
|
|---|
| 2906 | flock ($file, LOCK_EX);
|
|---|
| 2907 | //¥Õ¥¡¥¤¥ë¤Î½ñ¤¹þ¤ß
|
|---|
| 2908 | fputs ($file, $str);
|
|---|
| 2909 | //¥Õ¥¡¥¤¥ë¥í¥Ã¥¯¤Î²ò½ü
|
|---|
| 2910 | flock ($file, LOCK_UN);
|
|---|
| 2911 | //¥Õ¥¡¥¤¥ë¤òÊĤ¸¤ë
|
|---|
| 2912 | fclose ($file);
|
|---|
| 2913 | // ¸¢¸Â¤ò»ØÄê
|
|---|
| 2914 | if($permission != "") {
|
|---|
| 2915 | chmod($path, $permission);
|
|---|
| 2916 | }
|
|---|
| 2917 |
|
|---|
| 2918 | return true;
|
|---|
| 2919 | }
|
|---|
| 2920 |
|
|---|
| 2921 | function sfFlush($output = " ", $sleep = 0){
|
|---|
| 2922 | // ¼Â¹Ô»þ´Ö¤òÀ©¸Â¤·¤Ê¤¤
|
|---|
| 2923 | set_time_limit(0);
|
|---|
| 2924 | // ½ÐÎϤò¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤·¤Ê¤¤(==ÆüËܸ켫ưÊÑ´¹¤â¤·¤Ê¤¤)
|
|---|
| 2925 | ob_end_clean();
|
|---|
| 2926 |
|
|---|
| 2927 | // IE¤Î¤¿¤á¤Ë256¥Ð¥¤¥È¶õʸ»ú½ÐÎÏ
|
|---|
| 2928 | echo str_pad('',256);
|
|---|
| 2929 |
|
|---|
| 2930 | // ½ÐÎϤϥ֥é¥ó¥¯¤À¤±¤Ç¤â¤¤¤¤¤È»×¤¦
|
|---|
| 2931 | echo $output;
|
|---|
| 2932 | // ½ÐÎϤò¥Õ¥é¥Ã¥·¥å¤¹¤ë
|
|---|
| 2933 | flush();
|
|---|
| 2934 |
|
|---|
| 2935 | ob_end_flush();
|
|---|
| 2936 | ob_start();
|
|---|
| 2937 |
|
|---|
| 2938 | // »þ´Ö¤Î¤«¤«¤ë½èÍý
|
|---|
| 2939 | sleep($sleep);
|
|---|
| 2940 | }
|
|---|
| 2941 |
|
|---|
| 2942 | // @version¤ÎµºÜ¤¬¤¢¤ë¥Õ¥¡¥¤¥ë¤«¤é¥Ð¡¼¥¸¥ç¥ó¤ò¼èÆÀ¤¹¤ë¡£
|
|---|
| 2943 | function sfGetFileVersion($path) {
|
|---|
| 2944 | if(file_exists($path)) {
|
|---|
| 2945 | $src_fp = fopen($path, "rb");
|
|---|
| 2946 | if($src_fp) {
|
|---|
| 2947 | while (!feof($src_fp)) {
|
|---|
| 2948 | $line = fgets($src_fp);
|
|---|
| 2949 | if(ereg("@version", $line)) {
|
|---|
| 2950 | $arrLine = split(" ", $line);
|
|---|
| 2951 | $version = $arrLine[5];
|
|---|
| 2952 | }
|
|---|
| 2953 | }
|
|---|
| 2954 | fclose($src_fp);
|
|---|
| 2955 | }
|
|---|
| 2956 | }
|
|---|
| 2957 | return $version;
|
|---|
| 2958 | }
|
|---|
| 2959 |
|
|---|
| 2960 | // »ØÄꤷ¤¿URL¤ËÂФ·¤ÆPOST¤Ç¥Ç¡¼¥¿¤òÁ÷¿®¤¹¤ë
|
|---|
| 2961 | function sfSendPostData($url, $arrData, $arrOkCode = array()){
|
|---|
| 2962 | require_once(DATA_PATH . "module/Request.php");
|
|---|
| 2963 |
|
|---|
| 2964 | // Á÷¿®¥¤¥ó¥¹¥¿¥ó¥¹À¸À®
|
|---|
| 2965 | $req = new HTTP_Request($url);
|
|---|
| 2966 |
|
|---|
| 2967 | $req->addHeader('User-Agent', 'DoCoMo/2.0¡¡P2101V(c100)');
|
|---|
| 2968 | $req->setMethod(HTTP_REQUEST_METHOD_POST);
|
|---|
| 2969 |
|
|---|
| 2970 | // POST¥Ç¡¼¥¿Á÷¿®
|
|---|
| 2971 | $req->addPostDataArray($arrData);
|
|---|
| 2972 |
|
|---|
| 2973 | // ¥¨¥é¡¼¤¬Ìµ¤±¤ì¤Ð¡¢±þÅú¾ðÊó¤ò¼èÆÀ¤¹¤ë
|
|---|
| 2974 | if (!PEAR::isError($req->sendRequest())) {
|
|---|
| 2975 |
|
|---|
| 2976 | // ¥ì¥¹¥Ý¥ó¥¹¥³¡¼¥É¤¬¥¨¥é¡¼È½Äê¤Ê¤é¡¢¶õ¤òÊÖ¤¹
|
|---|
| 2977 | $res_code = $req->getResponseCode();
|
|---|
| 2978 |
|
|---|
| 2979 | if(!in_array($res_code, $arrOkCode)){
|
|---|
| 2980 | $response = "";
|
|---|
| 2981 | }else{
|
|---|
| 2982 | $response = $req->getResponseBody();
|
|---|
| 2983 | }
|
|---|
| 2984 |
|
|---|
| 2985 | } else {
|
|---|
| 2986 | $response = "";
|
|---|
| 2987 | }
|
|---|
| 2988 |
|
|---|
| 2989 | // POST¥Ç¡¼¥¿¥¯¥ê¥¢
|
|---|
| 2990 | $req->clearPostData();
|
|---|
| 2991 |
|
|---|
| 2992 | return $response;
|
|---|
| 2993 | }
|
|---|
| 2994 |
|
|---|
| 2995 | /** ¥Ç¥Ð¥Ã¥°ÍÑ´Ø¿ô **/
|
|---|
| 2996 |
|
|---|
| 2997 | /**
|
|---|
| 2998 | * ÅϤµ¤ì¤¿ÊÑ¿ô¤òDump¤¹¤ë
|
|---|
| 2999 | *
|
|---|
| 3000 | * @param mixed $obj Dump¤·¤¿¤¤ÊÑ¿ô
|
|---|
| 3001 | * @param string $color ½ÐÎϤ¹¤ë¿§
|
|---|
| 3002 | *
|
|---|
| 3003 | * @return void ¤Ê¤·
|
|---|
| 3004 | */
|
|---|
| 3005 | function sfPrintR($obj, $color='green') {
|
|---|
| 3006 | if ( DEBUG_MODE === false ) {
|
|---|
| 3007 | return;
|
|---|
| 3008 | }
|
|---|
| 3009 |
|
|---|
| 3010 | $arrColor = array(
|
|---|
| 3011 | 'green' => '#00FF00',
|
|---|
| 3012 | 'red' => '#FF0000',
|
|---|
| 3013 | 'blue' => '#0000FF'
|
|---|
| 3014 | );
|
|---|
| 3015 |
|
|---|
| 3016 | if ( empty($arrColor[$color]) ) {
|
|---|
| 3017 | $color = $arrColor['green'];
|
|---|
| 3018 | } else {
|
|---|
| 3019 | $color = $arrColor[$color];
|
|---|
| 3020 | }
|
|---|
| 3021 |
|
|---|
| 3022 | print("<div style='font-size: 12px;color: $color;'>\n");
|
|---|
| 3023 | print("<strong>**¥Ç¥Ð¥Ã¥°Ãæ**</strong><br />\n");
|
|---|
| 3024 | print("<pre>\n");
|
|---|
| 3025 | print_r($obj);
|
|---|
| 3026 | print("</pre>\n");
|
|---|
| 3027 | print("<strong>**¥Ç¥Ð¥Ã¥°Ãæ**</strong></div>\n");
|
|---|
| 3028 | }
|
|---|
| 3029 |
|
|---|
| 3030 | ?>
|
|---|