Changeset 15315
- Timestamp:
- 2007/08/20 18:17:01 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel/data/lib/slib.php
r15046 r15315 29 29 } 30 30 } 31 31 32 32 $objQuery = new SC_Query($dsn, true, true); 33 33 list($db_type) = split(":", $dsn); … … 35 35 $val = $objQuery->getOne("select version()"); 36 36 $version = "MySQL " . $val; 37 } 37 } 38 38 if($db_type == 'pgsql') { 39 39 $val = $objQuery->getOne("select version()"); … … 53 53 } 54 54 } 55 55 56 56 $objQuery = new SC_Query($dsn, true, true); 57 57 // Àµ¾ï¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç … … 65 65 pg_class 66 66 WHERE 67 (relkind = 'r' OR relkind = 'v') AND 68 relname = ? 67 (relkind = 'r' OR relkind = 'v') AND 68 relname = ? 69 69 GROUP BY 70 70 relname"; … … 96 96 // ¥Æ¡¼¥Ö¥ë¤¬Ìµ¤±¤ì¤Ð¥¨¥é¡¼ 97 97 if(!sfTabaleExists($table_name, $dsn)) return false; 98 98 99 99 $objQuery = new SC_Query($dsn, true, true); 100 100 // Àµ¾ï¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç 101 101 if(!$objQuery->isError()) { 102 102 list($db_type) = split(":", $dsn); 103 103 104 104 // ¥«¥é¥à¥ê¥¹¥È¤ò¼èÆÀ 105 105 $arrRet = sfGetColumnList($table_name, $objQuery, $db_type); … … 110 110 } 111 111 } 112 112 113 113 // ¥«¥é¥à¤òÄɲ乤ë 114 114 if($add){ … … 116 116 return true; 117 117 } 118 118 119 119 return false; 120 120 } … … 132 132 // ¥Æ¡¼¥Ö¥ë¤¬Ìµ¤±¤ì¤Ð¥¨¥é¡¼ 133 133 if(!sfTabaleExists($table_name, $dsn)) return false; 134 134 135 135 $objQuery = new SC_Query($dsn, true, true); 136 136 // Àµ¾ï¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç 137 137 if(!$objQuery->isError()) { 138 list($db_type) = split(":", $dsn); 138 list($db_type) = split(":", $dsn); 139 139 switch($db_type) { 140 140 case 'pgsql': … … 144 144 case 'mysql': 145 145 // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î¸ºß³Îǧ 146 $arrRet = $objQuery->getAll("SHOW INDEX FROM ? WHERE Key_name = ?", array($table_name, $index_name)); 146 $arrRet = $objQuery->getAll("SHOW INDEX FROM ? WHERE Key_name = ?", array($table_name, $index_name)); 147 147 break; 148 148 default: … … 154 154 } 155 155 } 156 156 157 157 // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤òºîÀ®¤¹¤ë 158 158 if($add){ … … 162 162 break; 163 163 case 'mysql': 164 $objQuery->query("CREATE INDEX ? ON ? (?(?))", array($index_name, $table_name, $col_name, $length)); 164 $objQuery->query("CREATE INDEX ? ON ? (?(?))", array($index_name, $table_name, $col_name, $length)); 165 165 break; 166 166 default: … … 168 168 } 169 169 return true; 170 } 170 } 171 171 return false; 172 172 } … … 193 193 $objQuery->exec($sql); 194 194 } 195 195 196 196 return $ret; 197 197 } … … 201 201 * ¥Ç¡¼¥¿¤¬Â¸ºß¤¹¤ë¾ì¹ç¡¢É¬¤º1°Ê¾å¤Î¿ôÃͤ¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¡£ 202 202 * 0¤òÊÖ¤·¤¿¾ì¹ç¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤ÇÂбþ¤¹¤ë¤³¤È¡£ 203 * 203 * 204 204 * @param $control_id ´ÉÍýID 205 205 * @param $dsn DataSource … … 232 232 $control_flg = $arrSiteControl[0]["control_flg"]; 233 233 } 234 234 235 235 return $control_flg; 236 236 } … … 240 240 if($objQuery == "") $objQuery = new SC_Query(); 241 241 $arrRet = array(); 242 242 243 243 // postgresql¤Èmysql¤È¤Ç½èÍý¤òʬ¤±¤ë 244 244 if ($db_type == "pgsql") { … … 268 268 sfErrorHeader(">> /install/index.php¤Ï¡¢¥¤¥ó¥¹¥È¡¼¥ë´°Î»¸å¤Ë¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡£"); 269 269 } 270 270 271 271 // µì¥Ð¡¼¥¸¥ç¥ó¤Îinstall.php¤Î¥Á¥§¥Ã¥¯ 272 272 $path = HTML_PATH . "install.php"; 273 273 if(file_exists($path)) { 274 274 sfErrorHeader(">> /install.php¤Ï¥»¥¥å¥ê¥Æ¥£¡¼¥Û¡¼¥ë¤È¤Ê¤ê¤Þ¤¹¡£ºï½ü¤·¤Æ¤¯¤À¤µ¤¤¡£"); 275 } 275 } 276 276 } 277 277 } … … 312 312 $GLOBAL_ERR.= " </tr>\n"; 313 313 $GLOBAL_ERR.= "</table>\n"; 314 314 315 315 if($print) { 316 316 print($GLOBAL_ERR); … … 320 320 /* ¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨ */ 321 321 function sfDispError($type) { 322 322 323 323 class LC_ErrorPage { 324 324 function LC_ErrorPage() { … … 330 330 $objPage = new LC_ErrorPage(); 331 331 $objView = new SC_AdminView(); 332 332 333 333 switch ($type) { 334 334 case LOGIN_ERROR: … … 348 348 break; 349 349 } 350 350 351 351 $objView->assignobj($objPage); 352 352 $objView->display(LOGIN_FRAME); 353 353 354 354 exit; 355 355 } … … 358 358 function sfDispSiteError($type, $objSiteSess = "", $return_top = false, $err_msg = "", $is_mobile = false) { 359 359 global $objCampaignSess; 360 360 361 361 if ($objSiteSess != "") { 362 362 $objSiteSess->setNowPage('error'); 363 363 } 364 364 365 365 class LC_ErrorPage { 366 366 function LC_ErrorPage() { … … 370 370 } 371 371 } 372 372 373 373 $objPage = new LC_ErrorPage(); 374 374 375 375 if($is_mobile === true) { 376 $objView = new SC_MobileView(); 376 $objView = new SC_MobileView(); 377 377 } else { 378 378 $objView = new SC_SiteView(); 379 379 } 380 380 381 381 switch ($type) { 382 382 case PRODUCT_NOT_FOUND: … … 450 450 break; 451 451 } 452 452 453 453 $objPage->return_top = $return_top; 454 454 455 455 $objView->assignobj($objPage); 456 456 457 457 if(is_object($objCampaignSess)) { 458 458 // ¥Õ¥ì¡¼¥à¤òÁªÂò(¥¥ã¥ó¥Ú¡¼¥ó¥Ú¡¼¥¸¤«¤éÁ«°Ü¤Ê¤éÊѹ¹) … … 460 460 } else { 461 461 $objView->display(SITE_FRAME); 462 } 462 } 463 463 exit; 464 464 } … … 481 481 // sfErrorHeader('>> referrer¤¬Ìµ¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£'); 482 482 } else { 483 $domain = sfIsHTTPS() ? SSL_URL : SITE_URL; 484 $pattern = sprintf('|^%s.*|', $domain); 483 $siteurl = preg_quote(SITE_URL, "/"); 484 $sslurl = preg_quote(SSL_URL, "/"); 485 486 $pattern = "/^($siteurl|$sslurl)/"; 485 487 $referer = $_SERVER['HTTP_REFERER']; 486 488 487 489 // ´ÉÍý²èÌ̤«¤é°Ê³°¤ÎÁ«°Ü¤Î¾ì¹ç¤Ï¥¨¥é¡¼²èÌ̤òɽ¼¨ 488 if ( !preg_match($pattern, $referer)) {490 if ( !preg_match($pattern, $referer) ) { 489 491 if ($disp_error) sfDispError(INVALID_MOVE_ERRORR); 490 492 return false; … … 496 498 /** 497 499 * HTTPS¤«¤É¤¦¤«¤òȽÄê 498 * 500 * 499 501 * @return bool 500 502 */ … … 530 532 if($ret != true) { 531 533 // ¥¨¥é¡¼¥Ú¡¼¥¸¤Îɽ¼¨ 532 sfDispSiteError(PAGE_ERROR, $objSiteSess, false, "", $is_mobile); 534 sfDispSiteError(PAGE_ERROR, $objSiteSess, false, "", $is_mobile); 533 535 } 534 536 } … … 545 547 sfDispSiteError(CANCEL_PURCHASE, $objSiteSess); 546 548 } 547 549 548 550 // ¥«¡¼¥ÈÆâ¤¬¶õ¤Ç¤Ê¤¤¤« || ¹ØÆþ¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤«¤éÊѲ½¤¬¤Ê¤¤¤« 549 551 $quantity = $objCartSess->getTotalQuantity(); … … 559 561 /* DBÍÑÆüÉÕʸ»úÎó¼èÆÀ */ 560 562 function sfGetTimestamp($year, $month, $day, $last = false) { 561 if($year != "" && $month != "" && $day != "") { 563 if($year != "" && $month != "" && $day != "") { 562 564 if($last) { 563 565 $time = "23:59:59"; … … 581 583 582 584 function sfCSVDownload($data, $prefix = ""){ 583 585 584 586 if($prefix == "") { 585 587 $dir_name = sfUpDirName(); … … 588 590 $file_name = $prefix . date("ymdHis") .".csv"; 589 591 } 590 592 591 593 /* HTTP¥Ø¥Ã¥À¤Î½ÐÎÏ */ 592 594 Header("Content-disposition: attachment; filename=${file_name}"); … … 594 596 Header("Cache-Control: "); 595 597 Header("Pragma: "); 596 598 597 599 /* i18n¢· ¤À¤ÈÀµ¾ï¤Ëưºî¤·¤Ê¤¤¤¿¤á¡¢mb¢· ¤ËÊѹ¹ 598 600 if (i18n_discover_encoding($data) == CHAR_CODE){ … … 603 605 $data = mb_convert_encoding($data,'SJIS',CHAR_CODE); 604 606 } 605 607 606 608 /* ¥Ç¡¼¥¿¤ò½ÐÎÏ */ 607 609 echo $data; … … 623 625 $url = ereg_replace(URL_DIR . "$", "", SITE_URL); 624 626 } 625 627 626 628 if($get != "") { 627 629 header("Location: ". $url . $_SERVER['PHP_SELF'] . "?" . $get); … … 671 673 // ÂоݹàÌܤΥé¥ó¥¯¤ò¼èÆÀ 672 674 $rank = $objQuery->get($table, "rank", $where, array($id)); 673 675 674 676 // ¥é¥ó¥¯¤¬1(ºÇ¾®ÃÍ)¤è¤ê¤âÂ礤¤¾ì¹ç¤Ë¼Â¹Ô¤¹¤ë¡£ 675 677 if($rank > 1) { … … 693 695 $objQuery = new SC_Query(); 694 696 $objQuery->begin(); 695 697 696 698 // ¼«¿È¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë 697 $rank = $objQuery->get($tableName, "rank", "$keyIdColumn = ?", array($keyId)); 699 $rank = $objQuery->get($tableName, "rank", "$keyIdColumn = ?", array($keyId)); 698 700 $max = $objQuery->max($tableName, "rank", $where); 699 701 700 702 // ÃͤÎÄ´À°¡ÊµÕ½ç¡Ë 701 703 if($pos > $max) { … … 706 708 $position = $max - $pos + 1; 707 709 } 708 710 709 711 if( $position > $rank ) $term = "rank - 1"; //Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤êÂ礤¤¾ì¹ç 710 712 if( $position < $rank ) $term = "rank + 1"; //Æþ¤ìÂØ¤¨Àè¤Î½ç°Ì¤¬Æþ¤ì´¹¤¨¸µ¤Î½ç°Ì¤è¤ê¾®¤µ¤¤¾ì¹ç … … 715 717 $sql.= " AND $where"; 716 718 } 717 719 718 720 if( $position > $rank ) $objQuery->exec( $sql, array( $rank + 1, $position )); 719 721 if( $position < $rank ) $objQuery->exec( $sql, array( $position, $rank - 1 )); … … 724 726 $sql.= " AND $where"; 725 727 } 726 728 727 729 $objQuery->exec( $sql, array( $position, $keyId ) ); 728 730 $objQuery->commit(); … … 734 736 $objQuery = new SC_Query(); 735 737 $objQuery->begin(); 736 // ºï½ü¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£ 738 // ºï½ü¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£ 737 739 $where = "$colname = ?"; 738 740 if($andwhere != "") { … … 750 752 $objQuery->delete($table, "$colname = ?", array($id)); 751 753 } 752 754 753 755 // Äɲå쥳¡¼¥É¤Î¥é¥ó¥¯¤è¤ê¾å¤Î¥ì¥³¡¼¥É¤ò°ì¤Ä¤º¤é¤¹¡£ 754 756 $where = "rank > ?"; … … 765 767 $objQuery = new SC_Query(); 766 768 $arrCol = split("[, ]", $col); 767 769 768 770 $where = "del_flg = 0"; 769 771 770 772 if($addwhere != "") { 771 773 $where.= " AND $addwhere"; 772 774 } 773 775 774 776 foreach($arrCol as $val) { 775 777 if($val != "") { … … 782 784 } 783 785 $ret = $objQuery->get($table, $col, $where, $arrval); 784 786 785 787 if($ret != "") { 786 788 return true; … … 806 808 function sfMergeCheckBoxes($array, $max) { 807 809 $ret = ""; 808 if(is_array($array)) { 810 if(is_array($array)) { 809 811 foreach($array as $val) { 810 812 $arrTmp[$val] = "1"; 811 813 } 812 814 } 813 for($i = 1; $i <= $max; $i++) { 815 for($i = 1; $i <= $max; $i++) { 814 816 if($arrTmp[$i] == "1") { 815 817 $ret.= "1"; … … 830 832 $ret.= "-$val"; 831 833 } else { 832 $ret = $val; 834 $ret = $val; 833 835 } 834 836 } … … 849 851 } 850 852 } 851 for($i = 1; $i <= $max; $i++) { 853 for($i = 1; $i <= $max; $i++) { 852 854 if($arrTmp[$i] == "1") { 853 855 $ret.= "1"; … … 856 858 } 857 859 } 858 859 if($ret != "") { 860 861 if($ret != "") { 860 862 $ret.= "%"; 861 863 } … … 905 907 // ¥¡¼¤ÈÃͤò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ 906 908 function sfArrKeyValue($arrList, $keyname, $valname, $len_max = "", $keysize = "") { 907 909 908 910 $max = count($arrList); 909 911 910 912 if($len_max != "" && $max > $len_max) { 911 913 $max = $len_max; 912 914 } 913 915 914 916 for($cnt = 0; $cnt < $max; $cnt++) { 915 917 if($keysize != "") { … … 919 921 } 920 922 $val = $arrList[$cnt][$valname]; 921 923 922 924 if(!isset($arrRet[$key])) { 923 925 $arrRet[$key] = $val; 924 926 } 925 927 926 928 } 927 929 return $arrRet; … … 930 932 // ¥¡¼¤ÈÃͤò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ(Ãͤ¬Ê£¿ô¤Î¾ì¹ç) 931 933 function sfArrKeyValues($arrList, $keyname, $valname, $len_max = "", $keysize = "", $connect = "") { 932 934 933 935 $max = count($arrList); 934 936 935 937 if($len_max != "" && $max > $len_max) { 936 938 $max = $len_max; 937 939 } 938 940 939 941 for($cnt = 0; $cnt < $max; $cnt++) { 940 942 if($keysize != "") { … … 944 946 } 945 947 $val = $arrList[$cnt][$valname]; 946 948 947 949 if($connect != "") { 948 950 $arrRet[$key].= "$val".$connect; 949 951 } else { 950 $arrRet[$key][] = $val; 952 $arrRet[$key][] = $val; 951 953 } 952 954 } … … 974 976 return false; 975 977 } 976 978 977 979 } 978 980 … … 1044 1046 if ( ! is_numeric($value) ){ 1045 1047 return false; 1046 } 1047 1048 } 1049 1048 1050 if ( strlen($value) > 9 ) { 1049 1051 return false; 1050 1052 } 1051 1053 1052 1054 return true; 1053 1055 } … … 1067 1069 $objQuery = new SC_Query(); 1068 1070 $where = "del_flg = 0"; 1069 1071 1070 1072 if($addwhere != "") { 1071 1073 $where.= " AND $addwhere"; 1072 1074 } 1073 1075 1074 1076 $objQuery->setoption("ORDER BY rank DESC"); 1075 1077 1076 1078 if($products_check) { 1077 1079 $col = "T1.category_id, category_name, level"; … … 1082 1084 $from = "dtb_category"; 1083 1085 } 1084 1086 1085 1087 $arrRet = $objQuery->select($col, $from, $where); 1086 1088 1087 1089 $max = count($arrRet); 1088 1090 for($cnt = 0; $cnt < $max; $cnt++) { … … 1111 1113 $arrRet = $objQuery->select($col, "dtb_category", $where); 1112 1114 $max = count($arrRet); 1113 1115 1114 1116 for($cnt = 0; $cnt < $max; $cnt++) { 1115 1117 if($parent_zero) { … … 1117 1119 $arrValue[$cnt] = $arrRet[$cnt]['category_id']; 1118 1120 } else { 1119 $arrValue[$cnt] = ""; 1121 $arrValue[$cnt] = ""; 1120 1122 } 1121 1123 } else { 1122 1124 $arrValue[$cnt] = $arrRet[$cnt]['category_id']; 1123 1125 } 1124 1126 1125 1127 $arrOutput[$cnt] = ""; 1126 /* 1128 /* 1127 1129 for($n = 1; $n < $arrRet[$cnt]['level']; $n++) { 1128 1130 $arrOutput[$cnt].= "¡¡"; … … 1195 1197 $len = count($arrId); 1196 1198 $where = ""; 1197 1199 1198 1200 for($cnt = 0; $cnt < $len; $cnt++) { 1199 1201 if($where == "") { … … 1203 1205 } 1204 1206 } 1205 1207 1206 1208 $objQuery->setorder("level"); 1207 1209 $arrRet = $objQuery->select($col, $table, $where, $arrId); 1208 return $arrRet; 1210 return $arrRet; 1209 1211 } 1210 1212 … … 1221 1223 } 1222 1224 // µì¥«¥Æ¥´¥ê¤Ç¤Î¥é¥ó¥¯ºï½ü½èÍý 1223 // °Üư¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£ 1225 // °Üư¥ì¥³¡¼¥É¤Î¥é¥ó¥¯¤ò¼èÆÀ¤¹¤ë¡£ 1224 1226 $where = "$id_name = ?"; 1225 1227 $rank = $objQuery->get($table, "rank", $where, array($id)); … … 1265 1267 $real_tax = $tax / 100; 1266 1268 $ret = $price * (1 + $real_tax); 1267 1269 1268 1270 switch($tax_rule) { 1269 1271 // »Í¼Î¸ÞÆþ … … 1295 1297 $ret = (round($value * $adjust)/$adjust); 1296 1298 } 1297 1299 1298 1300 $ret = round($ret); 1299 1301 … … 1307 1309 $where = "now() >= cast(start_date as date) AND "; 1308 1310 $where .= "now() < cast(end_date as date) AND "; 1309 1311 1310 1312 $where .= "del_flg = 0 AND campaign_id IN (SELECT campaign_id FROM dtb_campaign_detail where product_id = ? )"; 1311 1313 //ÅÐÏ¿(¹¹¿·)ÆüÉÕ½ç … … 1357 1359 // ¥¡¼¤ÈÃͤò¥»¥Ã¥È¤·¤¿ÇÛÎó¤ò¼èÆÀ 1358 1360 $arrRet = sfArrKeyValue($arrList, 'class_id', 'count'); 1359 1361 1360 1362 return $arrRet; 1361 1363 } … … 1366 1368 $where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0"; 1367 1369 $count = $objQuery->count("dtb_products_class", $where, array($product_id)); 1368 1370 1369 1371 // ¤¹¤Ç¤Ëµ¬³ÊÅÐÏ¿¤¬¤Ê¤¤¾ì¹ç 1370 1372 if($count == 0) { … … 1382 1384 $sqlval['creator_id'] = $_SESSION['member_id']; 1383 1385 $sqlval['create_date'] = "now()"; 1384 1386 1385 1387 if($_SESSION['member_id'] == "") { 1386 1388 $sqlval['creator_id'] = '0'; 1387 1389 } 1388 1390 1389 1391 // INSERT¤Î¼Â¹Ô 1390 1392 $objQuery->insert("dtb_products_class", $sqlval); … … 1407 1409 /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ */ 1408 1410 function sfGetProductsClass($arrID) { 1409 list($product_id, $classcategory_id1, $classcategory_id2) = $arrID; 1410 1411 list($product_id, $classcategory_id1, $classcategory_id2) = $arrID; 1412 1411 1413 if($classcategory_id1 == "") { 1412 1414 $classcategory_id1 = '0'; … … 1415 1417 $classcategory_id2 = '0'; 1416 1418 } 1417 1419 1418 1420 // ¾¦Éʵ¬³Ê¼èÆÀ 1419 1421 $objQuery = new SC_Query(); … … 1430 1432 // ¾¦Éʤιç·×¸Ä¿ô 1431 1433 $total_quantity = $objCartSess->getTotalQuantity(true); 1432 1434 1433 1435 // ÀǶâ¤Î¼èÆÀ 1434 1436 $arrData['tax'] = $objPage->tpl_total_tax; 1435 1437 // ¾®·×¤Î¼èÆÀ 1436 $arrData['subtotal'] = $objPage->tpl_total_pretax; 1437 1438 $arrData['subtotal'] = $objPage->tpl_total_pretax; 1439 1438 1440 // ¹ç·×Á÷ÎÁ¤Î¼èÆÀ 1439 1441 $arrData['deliv_fee'] = 0; 1440 1442 1441 1443 // ¾¦Éʤ´¤È¤ÎÁ÷ÎÁ¤¬Í¸ú¤Î¾ì¹ç 1442 1444 if (OPTION_PRODUCT_DELIV_FEE == 1) { 1443 1445 $arrData['deliv_fee']+= $objCartSess->getAllProductsDelivFee(); 1444 1446 } 1445 1447 1446 1448 // ÇÛÁ÷¶È¼Ô¤ÎÁ÷ÎÁ¤¬Í¸ú¤Î¾ì¹ç 1447 1449 if (OPTION_DELIV_FEE == 1) { … … 1449 1451 $arrData['deliv_fee']+= sfGetDelivFee($arrData['deliv_pref'], $arrData['payment_id']); 1450 1452 } 1451 1453 1452 1454 // Á÷ÎÁ̵ÎÁ¤Î¹ØÆþ¿ô¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç 1453 1455 if(DELIV_FREE_AMOUNT > 0) { 1454 1456 if($total_quantity >= DELIV_FREE_AMOUNT) { 1455 1457 $arrData['deliv_fee'] = 0; 1456 } 1457 } 1458 1458 } 1459 } 1460 1459 1461 // Á÷ÎÁ̵ÎÁ¾ò·ï¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç 1460 1462 if($arrInfo['free_rule'] > 0) { … … 1473 1475 // ²Ã»»¥Ý¥¤¥ó¥È¤Î·×»» 1474 1476 $arrData['add_point'] = sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo); 1475 1477 1476 1478 if($objCustomer != "") { 1477 1479 // ÃÂÀ¸Æü·î¤Ç¤¢¤Ã¤¿¾ì¹ç … … 1481 1483 } 1482 1484 } 1483 1485 1484 1486 if($arrData['add_point'] < 0) { 1485 1487 $arrData['add_point'] = 0; 1486 1488 } 1487 1489 1488 1490 return $arrData; 1489 1491 } … … 1495 1497 // µ¬³ÊʬÎà̾°ìÍ÷ 1496 1498 $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 1497 1499 1498 1500 $objPage->tpl_total_pretax = 0; // ÈñÍѹç·×(Àǹþ¤ß) 1499 1501 $objPage->tpl_total_tax = 0; // ¾ÃÈñÀǹç·× 1500 1502 $objPage->tpl_total_point = 0; // ¥Ý¥¤¥ó¥È¹ç·× 1501 1503 1502 1504 // ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ 1503 1505 $arrCart = $objCartSess->getCartList(); … … 1506 1508 1507 1509 for ($i = 0; $i < $max; $i++) { 1508 // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ 1510 // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ 1509 1511 $arrData = sfGetProductsClass($arrCart[$i]['id']); 1510 1512 $limit = ""; 1511 1513 // DB¤Ë¸ºß¤¹¤ë¾¦ÉÊ 1512 1514 if (count($arrData) > 0) { 1513 1514 // ¹ØÆþÀ©¸Â¿ô¤òµá¤á¤ë¡£ 1515 1516 // ¹ØÆþÀ©¸Â¿ô¤òµá¤á¤ë¡£ 1515 1517 if ($arrData['stock_unlimited'] != '1' && $arrData['sale_unlimited'] != '1') { 1516 1518 if($arrData['sale_limit'] < $arrData['stock']) { … … 1527 1529 } 1528 1530 } 1529 1531 1530 1532 if($limit != "" && $limit < $arrCart[$i]['quantity']) { 1531 1533 // ¥«¡¼¥ÈÆâ¾¦ÉÊ¿ô¤òÀ©¸Â¤Ë¹ç¤ï¤»¤ë … … 1536 1538 $quantity = $arrCart[$i]['quantity']; 1537 1539 } 1538 1540 1539 1541 $objPage->arrProductsClass[$cnt] = $arrData; 1540 1542 $objPage->arrProductsClass[$cnt]['quantity'] = $quantity; … … 1544 1546 $objPage->arrProductsClass[$cnt]['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']]; 1545 1547 $objPage->arrProductsClass[$cnt]['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']]; 1546 1548 1547 1549 // ²èÁü¥µ¥¤¥º 1548 1550 list($image_width, $image_height) = getimagesize(IMAGE_SAVE_DIR . basename($objPage->arrProductsClass[$cnt]["main_image"])); 1549 1551 $objPage->arrProductsClass[$cnt]["tpl_image_width"] = $image_width + 60; 1550 1552 $objPage->arrProductsClass[$cnt]["tpl_image_height"] = $image_height + 80; 1551 1553 1552 1554 // ²Á³Ê¤ÎÅÐÏ¿ 1553 1555 if ($arrData['price02'] != "") { … … 1570 1572 } 1571 1573 } 1572 1574 1573 1575 // Á´¾¦Éʹç·×¶â³Û(Àǹþ¤ß) 1574 1576 $objPage->tpl_total_pretax = $objCartSess->getAllProductsTotal($arrInfo); … … 1577 1579 // Á´¾¦Éʹç·×¥Ý¥¤¥ó¥È 1578 1580 $objPage->tpl_total_point = $objCartSess->getAllProductsPoint(); 1579 1580 return $objPage; 1581 1582 return $objPage; 1581 1583 } 1582 1584 … … 1589 1591 $str = sprintf("%04d/%02d/%02d %02d:%02d", $y, $m, $d, $H, $M); 1590 1592 } else { 1591 $str = sprintf("%04d/%02d/%02d", $y, $m, $d, $H, $M); 1593 $str = sprintf("%04d/%02d/%02d", $y, $m, $d, $H, $M); 1592 1594 } 1593 1595 } else { … … 1599 1601 function sfGetDelivTime($payment_id = "") { 1600 1602 $objQuery = new SC_Query(); 1601 1603 1602 1604 $deliv_id = ""; 1603 1605 1604 1606 if($payment_id != "") { 1605 1607 $where = "del_flg = 0 AND payment_id = ?"; … … 1607 1609 $deliv_id = $arrRet[0]['deliv_id']; 1608 1610 } 1609 1611 1610 1612 if($deliv_id != "") { 1611 1613 $objQuery->setorder("time_id"); … … 1613 1615 $arrRet= $objQuery->select("time_id, deliv_time", "dtb_delivtime", $where, array($deliv_id)); 1614 1616 } 1615 1616 return $arrRet; 1617 1618 return $arrRet; 1617 1619 } 1618 1620 … … 1621 1623 function sfGetDelivFee($pref, $payment_id = "") { 1622 1624 $objQuery = new SC_Query(); 1623 1625 1624 1626 $deliv_id = ""; 1625 1627 1626 1628 // »Ùʧ¤¤ÊýË¡¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢Âбþ¤·¤¿ÇÛÁ÷¶È¼Ô¤ò¼èÆÀ¤¹¤ë 1627 1629 if($payment_id != "") { … … 1635 1637 $objQuery->setLimitOffset(1); 1636 1638 $arrRet = $objQuery->select("deliv_id", "dtb_deliv", $where); 1637 $deliv_id = $arrRet[0]['deliv_id']; 1638 } 1639 1639 $deliv_id = $arrRet[0]['deliv_id']; 1640 } 1641 1640 1642 // ÇÛÁ÷¶È¼Ô¤«¤éÇÛÁ÷ÎÁ¤ò¼èÆÀ 1641 1643 if($deliv_id != "") { 1642 1644 1643 1645 // ÅÔÆ»Éܸ©¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢ÅìµþÅÔ¤ÎÈÖ¹æ¤ò»ØÄꤷ¤Æ¤ª¤¯ 1644 1646 if($pref == "") { 1645 1647 $pref = 13; 1646 1648 } 1647 1649 1648 1650 $objQuery = new SC_Query(); 1649 1651 $where = "deliv_id = ? AND pref = ?"; 1650 1652 $arrRet= $objQuery->select("fee", "dtb_delivfee", $where, array($deliv_id, $pref)); 1651 } 1652 return $arrRet[0]['fee']; 1653 } 1654 return $arrRet[0]['fee']; 1653 1655 } 1654 1656 … … 1660 1662 $objQuery->setorder("fix, rank DESC"); 1661 1663 $arrRet = $objQuery->select("payment_id, payment_method, rule", "dtb_payment", $where); 1662 return $arrRet; 1664 return $arrRet; 1663 1665 } 1664 1666 … … 1689 1691 $objPage->tpl_footer = $arrRet[0]['footer']; 1690 1692 $tmp_subject = $arrRet[0]['subject']; 1691 1693 1692 1694 $objSiteInfo = new SC_SiteInfo(); 1693 1695 $arrInfo = $objSiteInfo->data; 1694 1696 1695 1697 $objMailView = new SC_SiteView(); 1696 1698 // ¥á¡¼¥ëËÜʸ¤Î¼èÆÀ 1697 1699 $objMailView->assignobj($objPage); 1698 1700 $body = $objMailView->fetch($arrMAILTPLPATH[$template_id]); 1699 1701 1700 1702 // ¥á¡¼¥ëÁ÷¿®½èÍý 1701 1703 $objSendMail = new GC_SendMail(); … … 1711 1713 function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true) { 1712 1714 global $arrMAILTPLPATH; 1713 1715 1714 1716 $objPage = new LC_Page(); 1715 1717 $objSiteInfo = new SC_SiteInfo(); 1716 1718 $arrInfo = $objSiteInfo->data; 1717 1719 $objPage->arrInfo = $arrInfo; 1718 1720 1719 1721 $objQuery = new SC_Query(); 1720 1722 1721 1723 if($subject == "" && $header == "" && $footer == "") { 1722 1724 // ¥á¡¼¥ë¥Æ¥ó¥×¥ì¡¼¥È¾ðÊó¤Î¼èÆÀ … … 1731 1733 $tmp_subject = $subject; 1732 1734 } 1733 1735 1734 1736 // ¼õÃí¾ðÊó¤Î¼èÆÀ 1735 1737 $where = "order_id = ?"; … … 1737 1739 $arrOrder = $arrRet[0]; 1738 1740 $arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id)); 1739 1741 1740 1742 $objPage->Message_tmp = $arrOrder['message']; 1741 1743 1742 1744 // ¸ÜµÒ¾ðÊó¤Î¼èÆÀ 1743 1745 $customer_id = $arrOrder['customer_id']; … … 1751 1753 if($arrOrder['memo02'] != "") { 1752 1754 $arrOther = unserialize($arrOrder['memo02']); 1753 1755 1754 1756 foreach($arrOther as $other_key => $other_val){ 1755 1757 if(sfTrim($other_val["value"]) == ""){ … … 1757 1759 } 1758 1760 } 1759 1761 1760 1762 $objPage->arrOther = $arrOther; 1761 1763 } … … 1764 1766 global $arrPref; 1765 1767 $objPage->arrOrder['deliv_pref'] = $arrPref[$objPage->arrOrder['deliv_pref']]; 1766 1768 1767 1769 $objPage->arrOrderDetail = $arrOrderDetail; 1768 1770 1769 1771 $objCustomer = new SC_Customer(); 1770 1772 $objPage->tpl_user_point = $objCustomer->getValue('point'); 1771 1773 1772 1774 $objMailView = new SC_SiteView(); 1773 1775 // ¥á¡¼¥ëËÜʸ¤Î¼èÆÀ 1774 1776 $objMailView->assignobj($objPage); 1775 1777 $body = $objMailView->fetch($arrMAILTPLPATH[$template_id]); 1776 1778 1777 1779 // ¥á¡¼¥ëÁ÷¿®½èÍý 1778 1780 $objSendMail = new GC_SendMail(); … … 1782 1784 1783 1785 $tosubject = sfMakeSubject($tmp_subject); 1784 1786 1785 1787 $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); 1786 1788 $objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " ". $arrOrder["order_name02"] ." ÍÍ"); … … 1814 1816 $error = $arrInfo['email04']; 1815 1817 $objSendMail->setItem($to, $subject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); 1816 $objSendMail->sendMail(); 1818 $objSendMail->sendMail(); 1817 1819 } 1818 1820 … … 1832 1834 //·ï̾¤Ë¥Æ¥ó¥×¥ì¡¼¥È¤òÍѤ¤¤ë 1833 1835 function sfMakeSubject($subject){ 1834 1836 1835 1837 $objQuery = new SC_Query(); 1836 1838 $objMailView = new SC_SiteView(); 1837 1839 $objPage = new LC_Page(); 1838 1840 1839 1841 $arrInfo = $objQuery->select("*","dtb_baseinfo"); 1840 1842 $arrInfo = $arrInfo[0]; … … 1844 1846 $mailtitle = $objMailView->fetch('mail_templates/mail_title.tpl'); 1845 1847 $ret = $mailtitle.$subject; 1846 return $ret; 1848 return $ret; 1847 1849 } 1848 1850 … … 1859 1861 } 1860 1862 $sqlval['mail_body'] = $body; 1861 1863 1862 1864 $objQuery = new SC_Query(); 1863 1865 $objQuery->insert("dtb_mail_history", $sqlval); … … 1936 1938 $now_dir = getcwd(); // require¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤Î¤Ç¡¢cgi¼Â¹Ô¥Ç¥£¥ì¥¯¥È¥ê¤Ë°Üư¤¹¤ë 1937 1939 chdir($dir); 1938 1940 1939 1941 // ¥Ñ¥¤¥×ÅϤ·¤Ç¥³¥Þ¥ó¥É¥é¥¤¥ó¤«¤écgiµ¯Æ° 1940 1942 $cmd = "$path card_no=$card_no name01=$name01 name02=$name02 card_exp=$card_exp amount=$amount order_id=$order_id jpo_info=$jpo_info"; 1941 1943 1942 1944 $tmpResult = popen($cmd, "r"); 1943 1945 1944 1946 // ·ë²Ì¼èÆÀ 1945 1947 while( ! FEOF ( $tmpResult ) ) { … … 1948 1950 pclose($tmpResult); // ¥Ñ¥¤¥×¤òÊĤ¸¤ë 1949 1951 chdir($now_dir); //¡¡¸µ¤Ë¤¤¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ëµ¢¤ë 1950 1952 1951 1953 // ·ë²Ì¤òÏ¢ÁÛÇÛÎ󤨳ÊǼ 1952 1954 $result = ereg_replace("&$", "", $result); … … 1955 1957 $return[$key] = $val; 1956 1958 } 1957 1959 1958 1960 return $return; 1959 1961 } … … 2041 2043 // ¹ØÆþ¾¦Éʤιç·×¥Ý¥¤¥ó¥È¤«¤éÍøÍѤ·¤¿¥Ý¥¤¥ó¥È¤Î¥Ý¥¤¥ó¥È´¹»»²ÁÃͤò°ú¤¯Êý¼° 2042 2044 $add_point = $totalpoint - intval($use_point * ($arrInfo['point_rate'] / 100)); 2043 2045 2044 2046 if($add_point < 0) { 2045 2047 $add_point = '0'; … … 2061 2063 // ´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÆâÍÆ¤ò¼èÆÀ¤¹¤ë 2062 2064 $sql = "SELECT name, main_image, main_list_image, price01_min, price01_max, price02_min, price02_max, point_rate, 2063 A.product_id, A.comment FROM dtb_best_products as A LEFT JOIN vw_products_allclass AS allcls 2065 A.product_id, A.comment FROM dtb_best_products as A LEFT JOIN vw_products_allclass AS allcls 2064 2066 USING (product_id) WHERE A.category_id = ? AND A.del_flg = 0 AND status = 1 ORDER BY A.rank"; 2065 2067 $arrItems = $conn->getAll($sql, array($category_id)); … … 2081 2083 return $ret; 2082 2084 } 2083 2085 2084 2086 // ÇÛÎó¤Î¾ì¹ç 2085 2087 foreach($data as $val) { … … 2142 2144 $line = array(); 2143 2145 $ret = ""; 2144 2146 2145 2147 while($str[$i] != "") { 2146 2148 $line[$cnt].=$str[$i]; … … 2151 2153 } 2152 2154 } 2153 2155 2154 2156 foreach($line as $val) { 2155 2157 $ret.=$val; … … 2171 2173 $str = ereg_replace("[/]+", "/", $str); 2172 2174 $ret = $head . $str; 2173 return $ret; 2175 return $ret; 2174 2176 } 2175 2177 2176 2178 function sfEncodeFile($filepath, $enc_type, $out_dir) { 2177 2179 $ifp = fopen($filepath, "r"); 2178 2180 2179 2181 $basename = basename($filepath); 2180 2182 $outpath = $out_dir . "enc_" . $basename; 2181 2183 2182 2184 $ofp = fopen($outpath, "w+"); 2183 2185 2184 2186 while(!feof($ifp)) { 2185 2187 $line = fgets($ifp); … … 2187 2189 fwrite($ofp, $line); 2188 2190 } 2189 2191 2190 2192 fclose($ofp); 2191 2193 fclose($ifp); 2192 2194 2193 2195 return $outpath; 2194 2196 } … … 2245 2247 $end_year = $year; 2246 2248 $end_month = $month; 2247 2249 2248 2250 // ³«»Ï·î¤¬½ªÎ»·î¤ÈƱ¤¸¤«Èݤ« 2249 2251 $same_month = false; 2250 2252 2251 2253 // ³ºÅö·î¤ÎËöÆü¤òµá¤á¤ë¡£ 2252 2254 $end_last_day = date("d", mktime(0, 0, 0, $month + 1, 0, $year)); 2253 2255 2254 2256 // ·î¤ÎËöÆü¤¬Äù¤áÆü¤è¤ê¾¯¤Ê¤¤¾ì¹ç 2255 2257 if($end_last_day < $close_day) { … … 2259 2261 $end_day = $close_day; 2260 2262 } 2261 2263 2262 2264 // Á°·î¤Î¼èÆÀ 2263 2265 $tmp_year = date("Y", mktime(0, 0, 0, $month, 0, $year)); … … 2265 2267 // Á°·î¤ÎËöÆü¤òµá¤á¤ë¡£ 2266 2268 $start_last_day = date("d", mktime(0, 0, 0, $month, 0, $year)); 2267 2269 2268 2270 // Á°·î¤ÎËöÆü¤¬Äù¤áÆü¤è¤ê¾¯¤Ê¤¤¾ì¹ç 2269 2271 if ($start_last_day < $close_day) { … … 2273 2275 $tmp_day = $close_day; 2274 2276 } 2275 2277 2276 2278 // Àè·î¤ÎËöÆü¤ÎÍâÆü¤ò¼èÆÀ¤¹¤ë 2277 2279 $start_year = date("Y", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year)); 2278 2280 $start_month = date("m", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year)); 2279 2281 $start_day = date("d", mktime(0, 0, 0, $tmp_month, $tmp_day + 1, $tmp_year)); 2280 2282 2281 2283 // ÆüÉդκîÀ® 2282 2284 $start_date = sprintf("%d/%d/%d 00:00:00", $start_year, $start_month, $start_day); 2283 2285 $end_date = sprintf("%d/%d/%d 23:59:59", $end_year, $end_month, $end_day); 2284 2286 2285 2287 return array($start_date, $end_date); 2286 2288 } … … 2290 2292 $hex = substr($hexrgb, 0, 2); 2291 2293 $r = hexdec($hex) / 255; 2292 2294 2293 2295 $hex = substr($hexrgb, 2, 2); 2294 2296 $g = hexdec($hex) / 255; 2295 2297 2296 2298 $hex = substr($hexrgb, 4, 2); 2297 2299 $b = hexdec($hex) / 255; 2298 2299 return array($r, $g, $b); 2300 2301 return array($r, $g, $b); 2300 2302 } 2301 2303 … … 2305 2307 $objConn = new SC_DBConn(); 2306 2308 $objPage = new LC_Page(); 2307 2309 2308 2310 $random_id = sfGetUniqRandomId(); 2309 2311 $arrRegistMailMagazine["mail_flag"] = $mail_flag; … … 2312 2314 $arrRegistMailMagazine["end_flag"]='0'; 2313 2315 $arrRegistMailMagazine["update_date"] = 'now()'; 2314 2316 2315 2317 //¥á¥ë¥Þ¥¬²¾ÅÐÏ¿Íѥե饰 2316 2318 $flag = $objQuery->count("dtb_customer_mail_temp", "email=?", array($email)); … … 2320 2322 $objConn->autoExecute("dtb_customer_mail_temp",$arrRegistMailMagazine); 2321 2323 break; 2322 2324 2323 2325 case '1': 2324 2326 $objConn->autoExecute("dtb_customer_mail_temp",$arrRegistMailMagazine, "email = '" .addslashes($email). "'"); … … 2333 2335 $objPage->tpl_kindname = "HTML"; 2334 2336 break; 2335 2337 2336 2338 case '2': 2337 2339 $objPage->tpl_name = "ÅÐÏ¿"; 2338 2340 $objPage->tpl_kindname = "¥Æ¥¥¹¥È"; 2339 2341 break; 2340 2342 2341 2343 case '3': 2342 2344 $objPage->tpl_name = "²ò½ü"; … … 2384 2386 } else { 2385 2387 $path = $_SERVER["REQUEST_URI"]; 2386 } 2388 } 2387 2389 2388 2390 if($_GET['tpl'] != "") { … … 2397 2399 2398 2400 if($is_mobile === true) { 2399 $objView = new SC_MobileView(); 2401 $objView = new SC_MobileView(); 2400 2402 $objView->assignobj($objPage); 2401 $objView->display(SITE_FRAME); 2403 $objView->display(SITE_FRAME); 2402 2404 } else if(file_exists($template_path)) { 2403 2405 $objView = new SC_UserView(TEMPLATE_FTP_DIR, COMPILE_FTP_DIR); … … 2414 2416 function sfEditCustomerData($array, $arrRegistColumn) { 2415 2417 $objQuery = new SC_Query(); 2416 2418 2417 2419 foreach ($arrRegistColumn as $data) { 2418 2420 if ($data["column"] != "password") { … … 2431 2433 2432 2434 //-- ¥Ñ¥¹¥ï¡¼¥É¤Î¹¹¿·¤¬¤¢¤ë¾ì¹ç¤Ï°Å¹æ²½¡£¡Ê¹¹¿·¤¬¤Ê¤¤¾ì¹ç¤ÏUPDATEʸ¤ò¹½À®¤·¤Ê¤¤¡Ë 2433 if ($array["password"] != DEFAULT_PASSWORD) $arrRegist["password"] = sha1($array["password"] . ":" . AUTH_MAGIC); 2435 if ($array["password"] != DEFAULT_PASSWORD) $arrRegist["password"] = sha1($array["password"] . ":" . AUTH_MAGIC); 2434 2436 $arrRegist["update_date"] = "NOW()"; 2435 2437 2436 2438 //-- ÊÔ½¸ÅÐÏ¿¼Â¹Ô 2437 2439 if (defined('MOBILE_SITE')) { … … 2447 2449 function sf_mb_convert_encoding($str, $encode = 'CHAR_CODE') { 2448 2450 return mb_convert_encoding($str, $encode); 2449 } 2451 } 2450 2452 2451 2453 // PHP¤Îmktime´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë 2452 2454 function sf_mktime($format, $hour=0, $minute=0, $second=0, $month=1, $day=1, $year=1999) { 2453 2455 return date($format,mktime($hour, $minute, $second, $month, $day, $year)); 2454 } 2456 } 2455 2457 2456 2458 // PHP¤Îdate´Ø¿ô¤òSmarty¤Ç¤â»È¤¨¤ë¤è¤¦¤Ë¤¹¤ë … … 2478 2480 function sfCategory_Count($objQuery){ 2479 2481 $sql = ""; 2480 2482 2481 2483 //¥Æ¡¼¥Ö¥ëÆâÍÆ¤Îºï½ü 2482 2484 $objQuery->query("DELETE FROM dtb_category_count"); 2483 2485 $objQuery->query("DELETE FROM dtb_category_total_count"); 2484 2486 2485 2487 //³Æ¥«¥Æ¥´¥êÆâ¤Î¾¦ÉÊ¿ô¤ò¿ô¤¨¤Æ³ÊǼ 2486 2488 $sql = " INSERT INTO dtb_category_count(category_id, product_count, create_date) "; … … 2490 2492 $sql .= " GROUP BY T1.category_id, T2.category_id "; 2491 2493 $objQuery->query($sql); 2492 2494 2493 2495 //»Ò¥«¥Æ¥´¥êÆâ¤Î¾¦ÉÊ¿ô¤ò½¸·×¤¹¤ë 2494 2496 $arrCat = $objQuery->getAll("SELECT * FROM dtb_category"); 2495 2497 2496 2498 $sql = ""; 2497 2499 foreach($arrCat as $key => $val){ 2498 2500 2499 2501 // »ÒID°ìÍ÷¤ò¼èÆÀ 2500 $arrRet = sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $val['category_id']); 2502 $arrRet = sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $val['category_id']); 2501 2503 $line = sfGetCommaList($arrRet); 2502 2504 2503 2505 $sql = " INSERT INTO dtb_category_total_count(category_id, product_count, create_date) "; 2504 2506 $sql .= " SELECT ?, SUM(product_count), now() FROM dtb_category_count "; 2505 2507 $sql .= " WHERE category_id IN (" . $line . ")"; 2506 2508 2507 2509 $objQuery->query($sql, array($val['category_id'])); 2508 2510 } … … 2513 2515 2514 2516 if(count($arrKeys) <= 0 and count($arrValues) <= 0) return array(); 2515 2517 2516 2518 $keys = array_values($arrKeys); 2517 $vals = array_values($arrValues); 2518 2519 $max = max( count( $keys ), count( $vals ) ); 2520 $combine_ary = array(); 2521 for($i=0; $i<$max; $i++) { 2522 $combine_ary[$keys[$i]] = $vals[$i]; 2523 } 2524 if(is_array($combine_ary)) return $combine_ary; 2525 2526 return false; 2519 $vals = array_values($arrValues); 2520 2521 $max = max( count( $keys ), count( $vals ) ); 2522 $combine_ary = array(); 2523 for($i=0; $i<$max; $i++) { 2524 $combine_ary[$keys[$i]] = $vals[$i]; 2525 } 2526 if(is_array($combine_ary)) return $combine_ary; 2527 2528 return false; 2527 2529 } 2528 2530 … … 2532 2534 $col = $pid_name . "," . $id_name; 2533 2535 $arrData = $objQuery->select($col, $table); 2534 2536 2535 2537 $arrPID = array(); 2536 2538 $arrPID[] = $id; 2537 2539 $arrChildren = array(); 2538 2540 $arrChildren[] = $id; 2539 2541 2540 2542 $arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrPID); 2541 2543 2542 2544 while(count($arrRet) > 0) { 2543 2545 $arrChildren = array_merge($arrChildren, $arrRet); 2544 2546 $arrRet = sfGetChildrenArraySub($arrData, $pid_name, $id_name, $arrRet); 2545 2547 } 2546 2548 2547 2549 return $arrChildren; 2548 2550 } … … 2552 2554 $arrChildren = array(); 2553 2555 $max = count($arrData); 2554 2556 2555 2557 for($i = 0; $i < $max; $i++) { 2556 2558 foreach($arrPID as $val) { … … 2559 2561 } 2560 2562 } 2561 } 2563 } 2562 2564 return $arrChildren; 2563 2565 } … … 2569 2571 $col = $pid_name . "," . $id_name; 2570 2572 $arrData = $objQuery->select($col, $table); 2571 2573 2572 2574 $arrParents = array(); 2573 2575 $arrParents[] = $id; 2574 2576 $child = $id; 2575 2577 2576 2578 $ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $child); 2577 2579 … … 2580 2582 $ret = sfGetParentsArraySub($arrData, $pid_name, $id_name, $ret); 2581 2583 } 2582 2584 2583 2585 $arrParents = array_reverse($arrParents); 2584 2586 2585 2587 return $arrParents; 2586 2588 } … … 2602 2604 function sfGetBrothersArray($arrData, $pid_name, $id_name, $arrPID) { 2603 2605 $max = count($arrData); 2604 2606 2605 2607 $arrBrothers = array(); 2606 2608 foreach($arrPID as $id) { … … 2617 2619 $arrBrothers[] = $arrData[$i][$id_name]; 2618 2620 } 2619 } 2621 } 2620 2622 } 2621 2623 return $arrBrothers; … … 2625 2627 function sfGetUnderChildrenArray($arrData, $pid_name, $id_name, $parent) { 2626 2628 $max = count($arrData); 2627 2629 2628 2630 $arrChildren = array(); 2629 2631 // »ÒID¤ò¸¡º÷¤¹¤ë … … 2632 2634 $arrChildren[] = $arrData[$i][$id_name]; 2633 2635 } 2634 } 2636 } 2635 2637 return $arrChildren; 2636 2638 } … … 2650 2652 $col .= " cat.update_date,"; 2651 2653 $col .= " cat.del_flg, "; 2652 $col .= " ttl.product_count"; 2654 $col .= " ttl.product_count"; 2653 2655 $from = "dtb_category as cat left join dtb_category_total_count as ttl on ttl.category_id = cat.category_id"; 2654 2656 // ÅÐÏ¿¾¦ÉÊ¿ô¤Î¥Á¥§¥Ã¥¯ … … 2660 2662 $objQuery->setoption("ORDER BY rank DESC"); 2661 2663 $arrRet = $objQuery->select($col, $from, $where); 2662 2664 2663 2665 $arrParentID = sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id); 2664 2666 2665 2667 foreach($arrRet as $key => $array) { 2666 2668 foreach($arrParentID as $val) { … … 2679 2681 // ¾¦Éʤ¬Â°¤¹¤ë¥«¥Æ¥´¥êID¤ò½Ä¤Ë¼èÆÀ 2680 2682 $objQuery = new SC_Query(); 2681 $arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id); 2683 $arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id); 2682 2684 $ConbName = ""; 2683 2685 2684 2686 // ¥«¥Æ¥´¥ê¡¼Ì¾¾Î¤ò¼èÆÀ¤¹¤ë 2685 2687 foreach($arrCatID as $key => $val){ … … 2691 2693 // ºÇ¸å¤Î ¡Ã ¤ò¥«¥Ã¥È¤¹¤ë 2692 2694 $ConbName = substr_replace($ConbName, "", strlen($ConbName) - 2, 2); 2693 2695 2694 2696 return $ConbName; 2695 2697 } … … 2700 2702 $objQuery = new SC_Query(); 2701 2703 $arrRet = array(); 2702 $arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id); 2704 $arrCatID = sfGetParents($objQuery, "dtb_category", "parent_category_id", "category_id", $category_id); 2703 2705 $arrRet['id'] = $arrCatID[0]; 2704 2706 2705 2707 // ¥«¥Æ¥´¥ê¡¼Ì¾¾Î¤ò¼èÆÀ¤¹¤ë 2706 2708 $sql = "SELECT category_name FROM dtb_category WHERE category_id = ?"; 2707 2709 $arrVal = array($arrRet['id']); 2708 2710 $arrRet['name'] = $objQuery->getOne($sql,$arrVal); 2709 2711 2710 2712 return $arrRet; 2711 2713 } … … 2715 2717 // ²þ¹Ô¡¢¥¿¥Ö¤ò1¥¹¥Ú¡¼¥¹¤ËÊÑ´¹ 2716 2718 $sql = preg_replace("/[\r\n\t]/"," ",$sql); 2717 2719 2718 2720 $sql = sfChangeView($sql); // viewɽ¤ò¥¤¥ó¥é¥¤¥ó¥Ó¥å¡¼¤ËÊÑ´¹¤¹¤ë 2719 2721 $sql = sfChangeILIKE($sql); // ILIKE¸¡º÷¤òLIKE¸¡º÷¤ËÊÑ´¹¤¹¤ë … … 2738 2740 // SQL¥·¥ó¥°¥ë¥¯¥©¡¼¥ÈÂбþ 2739 2741 function sfQuoteSmart($in){ 2740 2742 2741 2743 if (is_int($in) || is_double($in)) { 2742 2744 return $in; … … 2749 2751 } 2750 2752 } 2751 2753 2752 2754 // viewɽ¤ò¥¤¥ó¥é¥¤¥ó¥Ó¥å¡¼¤ËÊÑ´¹¤¹¤ë 2753 2755 function sfChangeView($sql){ 2754 2756 global $arrView; 2755 2757 global $arrViewWhere; 2756 2758 2757 2759 $arrViewTmp = $arrView; 2758 2760 … … 2761 2763 $arrViewTmp[$key] = strtr($arrViewTmp[$key], $arrViewWhere); 2762 2764 } 2763 2765 2764 2766 // view¤òÊÑ´¹ 2765 2767 $changesql = strtr($sql, $arrViewTmp); … … 2799 2801 $oldmask = umask(0); 2800 2802 $mod= stat($src); 2801 2803 2802 2804 // ¥Ç¥£¥ì¥¯¥È¥ê¤¬¤Ê¤±¤ì¤ÐºîÀ®¤¹¤ë 2803 2805 if(!file_exists($des)) { … … 2806 2808 } 2807 2809 } 2808 2810 2809 2811 $fileArray=glob( $src."*" ); 2810 2812 foreach( $fileArray as $key => $data_ ){ … … 2819 2821 break; 2820 2822 } 2821 2823 2822 2824 mb_ereg("^(.*[\/])(.*)",$data_, $matches); 2823 2825 $data=$matches[2]; … … 2853 2855 $ret = sfDelFile($del_file); 2854 2856 } 2855 2857 2856 2858 if(!$ret){ 2857 2859 return $ret; 2858 2860 } 2859 2861 } 2860 2862 2861 2863 // ÊĤ¸¤ë 2862 2864 closedir($dh); 2863 2865 2864 2866 // ¥Õ¥©¥ë¥À¤òºï½ü 2865 2867 return rmdir($dir); 2866 2868 } 2867 2869 2868 /* 2870 /* 2869 2871 * ´Ø¿ô̾¡§sfWriteFile 2870 2872 * °ú¿ô1 ¡§½ñ¤¹þ¤à¥Ç¡¼¥¿ … … 2893 2895 chmod($path, $permission); 2894 2896 } 2895 2897 2896 2898 return true; 2897 2899 } 2898 2900 2899 2901 function sfFlush($output = " ", $sleep = 0){ 2900 2902 // ¼Â¹Ô»þ´Ö¤òÀ©¸Â¤·¤Ê¤¤ … … 2902 2904 // ½ÐÎϤò¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤·¤Ê¤¤(==ÆüËܸ켫ưÊÑ´¹¤â¤·¤Ê¤¤) 2903 2905 ob_end_clean(); 2904 2906 2905 2907 // IE¤Î¤¿¤á¤Ë256¥Ð¥¤¥È¶õʸ»ú½ÐÎÏ 2906 2908 echo str_pad('',256); 2907 2909 2908 2910 // ½ÐÎϤϥ֥é¥ó¥¯¤À¤±¤Ç¤â¤¤¤¤¤È»×¤¦ 2909 2911 echo $output; 2910 2912 // ½ÐÎϤò¥Õ¥é¥Ã¥·¥å¤¹¤ë 2911 2913 flush(); 2912 2914 2913 2915 ob_end_flush(); 2914 ob_start(); 2915 2916 ob_start(); 2917 2916 2918 // »þ´Ö¤Î¤«¤«¤ë½èÍý 2917 2919 sleep($sleep); … … 2939 2941 function sfSendPostData($url, $arrData, $arrOkCode = array()){ 2940 2942 require_once(DATA_PATH . "module/Request.php"); 2941 2943 2942 2944 // Á÷¿®¥¤¥ó¥¹¥¿¥ó¥¹À¸À® 2943 2945 $req = new HTTP_Request($url); 2944 2946 2945 2947 $req->addHeader('User-Agent', 'DoCoMo/2.0¡¡P2101V(c100)'); 2946 2948 $req->setMethod(HTTP_REQUEST_METHOD_POST); 2947 2949 2948 2950 // POST¥Ç¡¼¥¿Á÷¿® 2949 2951 $req->addPostDataArray($arrData); 2950 2952 2951 2953 // ¥¨¥é¡¼¤¬Ìµ¤±¤ì¤Ð¡¢±þÅú¾ðÊó¤ò¼èÆÀ¤¹¤ë 2952 2954 if (!PEAR::isError($req->sendRequest())) { 2953 2955 2954 2956 // ¥ì¥¹¥Ý¥ó¥¹¥³¡¼¥É¤¬¥¨¥é¡¼È½Äê¤Ê¤é¡¢¶õ¤òÊÖ¤¹ 2955 2957 $res_code = $req->getResponseCode(); 2956 2958 2957 2959 if(!in_array($res_code, $arrOkCode)){ 2958 2960 $response = ""; … … 2960 2962 $response = $req->getResponseBody(); 2961 2963 } 2962 2964 2963 2965 } else { 2964 2966 $response = ""; 2965 2967 } 2966 2968 2967 2969 // POST¥Ç¡¼¥¿¥¯¥ê¥¢ 2968 $req->clearPostData(); 2969 2970 $req->clearPostData(); 2971 2970 2972 return $response; 2971 2973 }
Note: See TracChangeset
for help on using the changeset viewer.