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