Changeset 22340 for branches/version-2_12-dev/data/class
- Timestamp:
- 2013/01/24 15:49:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_Customer.php
r22206 r22340 35 35 * 会員情報の登録・編集処理を行う. 36 36 * 37 * @param array $arr ay登録するデータの配列(SC_FormParamのgetDbArrayの戻り値)37 * @param array $arrData 登録するデータの配列(SC_FormParamのgetDbArrayの戻り値) 38 38 * @param array $customer_id nullの場合はinsert, 存在する場合はupdate 39 39 * @access public 40 40 * @return integer 登録編集したユーザーのcustomer_id 41 41 */ 42 function sfEditCustomerData($arr ay, $customer_id = null) {42 function sfEditCustomerData($arrData, $customer_id = null) { 43 43 $objQuery =& SC_Query_Ex::getSingletonInstance(); 44 44 $objQuery->begin(); 45 45 46 $array['update_date'] = 'CURRENT_TIMESTAMP'; // 更新日 46 $old_version_flag = false; 47 48 $arrData['update_date'] = 'CURRENT_TIMESTAMP'; // 更新日 47 49 48 50 // salt値の生成(insert時)または取得(update時)。 … … 51 53 52 54 // 旧バージョン(2.11未満)からの移行を考慮 53 if (empty($salt)) $old_version_flag = true; 55 if (strlen($salt) === 0) { 56 $old_version_flag = true; 57 } 54 58 } else { 55 59 $salt = SC_Utils_Ex::sfGetRandomString(10); 56 $arr ay['salt'] = $salt;60 $arrData['salt'] = $salt; 57 61 } 58 62 //-- パスワードの更新がある場合は暗号化 59 if ($arr ay['password'] == DEFAULT_PASSWORD or $array['password'] == '') {63 if ($arrData['password'] == DEFAULT_PASSWORD or $arrData['password'] == '') { 60 64 //更新しない 61 unset($arr ay['password']);65 unset($arrData['password']); 62 66 } else { 63 67 // 旧バージョン(2.11未満)からの移行を考慮 … … 65 69 $is_password_updated = true; 66 70 $salt = SC_Utils_Ex::sfGetRandomString(10); 67 $arr ay['salt'] = $salt;68 } 69 70 $arr ay['password'] = SC_Utils_Ex::sfGetHashString($array['password'], $salt);71 $arrData['salt'] = $salt; 72 } 73 74 $arrData['password'] = SC_Utils_Ex::sfGetHashString($arrData['password'], $salt); 71 75 } 72 76 //-- 秘密の質問の更新がある場合は暗号化 73 if ($arr ay['reminder_answer'] == DEFAULT_PASSWORD or $array['reminder_answer'] == '') {77 if ($arrData['reminder_answer'] == DEFAULT_PASSWORD or $arrData['reminder_answer'] == '') { 74 78 //更新しない 75 unset($arr ay['reminder_answer']);79 unset($arrData['reminder_answer']); 76 80 77 81 // 旧バージョン(2.11未満)からの移行を考慮 … … 79 83 // パスワードが更新される場合は、平文になっている秘密の質問を暗号化する 80 84 $reminder_answer = $objQuery->get('reminder_answer', 'dtb_customer', 'customer_id = ? ', array($customer_id)); 81 $arr ay['reminder_answer'] = SC_Utils_Ex::sfGetHashString($reminder_answer, $salt);85 $arrData['reminder_answer'] = SC_Utils_Ex::sfGetHashString($reminder_answer, $salt); 82 86 } 83 87 } else { … … 85 89 if ($old_version_flag && !$is_password_updated) { 86 90 // パスワードが更新されない場合は、平文のままにする 87 unset($arr ay['salt']);91 unset($arrData['salt']); 88 92 } else { 89 $arr ay['reminder_answer'] = SC_Utils_Ex::sfGetHashString($array['reminder_answer'], $salt);93 $arrData['reminder_answer'] = SC_Utils_Ex::sfGetHashString($arrData['reminder_answer'], $salt); 90 94 } 91 95 } … … 94 98 if (is_numeric($customer_id)) { 95 99 // 編集 96 $objQuery->update('dtb_customer', $arr ay, 'customer_id = ? ', array($customer_id));100 $objQuery->update('dtb_customer', $arrData, 'customer_id = ? ', array($customer_id)); 97 101 } else { 98 102 // 新規登録 … … 100 104 // 会員ID 101 105 $customer_id = $objQuery->nextVal('dtb_customer_customer_id'); 102 $arr ay['customer_id'] = $customer_id;106 $arrData['customer_id'] = $customer_id; 103 107 // 作成日 104 if (is_null($arr ay['create_date'])) {105 $arr ay['create_date'] = 'CURRENT_TIMESTAMP';106 } 107 $objQuery->insert('dtb_customer', $arr ay);108 if (is_null($arrData['create_date'])) { 109 $arrData['create_date'] = 'CURRENT_TIMESTAMP'; 110 } 111 $objQuery->insert('dtb_customer', $arrData); 108 112 } 109 113 110 114 $objQuery->commit(); 115 111 116 return $customer_id; 112 117 } … … 122 127 function sfGetCustomerPoint($order_id, $use_point, $add_point) { 123 128 $objQuery =& SC_Query_Ex::getSingletonInstance(); 129 124 130 $arrRet = $objQuery->select('customer_id', 'dtb_order', 'order_id = ?', array($order_id)); 125 131 $customer_id = $arrRet[0]['customer_id']; … … 137 143 $point = ''; 138 144 } 145 139 146 return array($point, $total_point); 140 147 } … … 206 213 || strlen($arrResults['email_mobile']) >= 1 && $email === $arrResults['email_mobile'] 207 214 ; 215 208 216 return $return; 209 217 } … … 239 247 $arrForm['reminder_answer'] = DEFAULT_PASSWORD; 240 248 } 249 241 250 return $arrForm; 242 251 } … … 255 264 function sfGetCustomerDataFromId($customer_id, $add_where = '', $arrAddVal = array()) { 256 265 $objQuery =& SC_Query_Ex::getSingletonInstance(); 266 257 267 if ($add_where == '') { 258 268 $where = 'customer_id = ?'; … … 266 276 $arrData = $objQuery->getRow('*', 'dtb_customer', $where, $arrAddVal); 267 277 } 278 268 279 return $arrData; 269 280 } … … 282 293 $exists = $objQuery->exists('dtb_customer', 'secret_key = ?', array($uniqid)); 283 294 } while ($exists); 295 284 296 return $uniqid; 285 297 } … … 295 307 function sfGetCustomerId($uniqid, $check_status = false) { 296 308 $objQuery =& SC_Query_Ex::getSingletonInstance(); 309 297 310 $where = 'secret_key = ?'; 298 311 … … 382 395 */ 383 396 function sfCustomerRegisterParam(&$objFormParam, $isAdmin = false, $is_mypage = false) { 384 $objFormParam->addParam('パスワード', 'password', STEXT_LEN, 'a', array('EXIST_CHECK', 'SPTAB_CHECK', 'ALNUM_CHECK', 'MAX_LENGTH_CHECK'));397 $objFormParam->addParam('パスワード', 'password', PASSWORD_MAX_LEN, 'a', array('EXIST_CHECK', 'SPTAB_CHECK', 'ALNUM_CHECK')); 385 398 $objFormParam->addParam('パスワード確認用の質問の答え', 'reminder_answer', STEXT_LEN, 'aKV', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK')); 386 399 $objFormParam->addParam('パスワード確認用の質問', 'reminder', STEXT_LEN, 'n', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); … … 394 407 if (SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE) { 395 408 $objFormParam->addParam('メールアドレス', 'email', null, 'a', array('NO_SPTAB', 'EXIST_CHECK', 'EMAIL_CHECK', 'SPTAB_CHECK' ,'EMAIL_CHAR_CHECK')); 396 $objFormParam->addParam('パスワード(確認)', 'password02', STEXT_LEN, 'a', array('EXIST_CHECK', 'SPTAB_CHECK' ,'ALNUM_CHECK'), '', false);409 $objFormParam->addParam('パスワード(確認)', 'password02', PASSWORD_MAX_LEN, 'a', array('EXIST_CHECK', 'SPTAB_CHECK' ,'ALNUM_CHECK'), '', false); 397 410 if (!$isAdmin) { 398 411 $objFormParam->addParam('メールアドレス(確認)', 'email02', null, 'a', array('NO_SPTAB', 'EXIST_CHECK', 'EMAIL_CHECK','SPTAB_CHECK' , 'EMAIL_CHAR_CHECK'), '', false); … … 457 470 unset($objErr->arrErr['reminder_answer']); 458 471 } 472 459 473 return $objErr->arrErr; 460 474 } … … 493 507 function sfCustomerRegisterErrorCheck(&$objErr, $isAdmin = false) { 494 508 $objErr->doFunc(array('生年月日', 'year', 'month', 'day'), array('CHECK_BIRTHDAY')); 509 $objErr->doFunc(array('パスワード', 'password', PASSWORD_MIN_LEN, PASSWORD_MAX_LEN) ,array('NUM_RANGE_CHECK')); 495 510 496 511 if (SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE) { 497 512 if (!$isAdmin) { 498 $objErr->doFunc(array('パスワード', 'password', PASSWORD_MIN_LEN, PASSWORD_MAX_LEN) ,array('SPTAB_CHECK', 'NUM_RANGE_CHECK'));499 513 $objErr->doFunc(array('メールアドレス', 'メールアドレス(確認)', 'email', 'email02') ,array('EQUAL_CHECK')); 500 514 } … … 507 521 $objErr->doFunc(array('携帯メールアドレス', 'email_mobile'), array('CHECK_REGIST_CUSTOMER_EMAIL', 'MOBILE_EMAIL_CHECK')); 508 522 } 523 509 524 return $objErr; 510 525 } … … 600 615 $arrErr = array_merge($arrErr, $objErr->arrErr); 601 616 } 617 602 618 return $arrErr; 603 619 } … … 613 629 $objQuery =& SC_Query_Ex::getSingletonInstance(); 614 630 $objSelect = new SC_CustomerList_Ex($arrParam, 'customer'); 631 615 632 $page_max = SC_Utils_Ex::sfGetSearchPageMax($arrParam['search_page_max']); 616 633 $disp_pageno = $arrParam['search_pageno']; … … 645 662 public function checkTempCustomer($login_email) { 646 663 $objQuery =& SC_Query_Ex::getSingletonInstance(); 664 647 665 $where = 'email = ? AND status = 1 AND del_flg = 0'; 648 666 $exists = $objQuery->exists('dtb_customer', $where, array($login_email)); 667 649 668 return $exists; 650 669 }
Note: See TracChangeset
for help on using the changeset viewer.