function execute($requests) { $c_commu_list = array(); $list = db_commu_regist_join_list(); foreach ($list as $c_commu_id) { $c_commu_list[] = db_commu_c_commu4c_commu_id($c_commu_id); } $this->set('c_commu_list', $c_commu_list); return 'success'; }
function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; $errors = array(); $validator = new OpenPNE_Validator(); $validator->addRequests($_REQUEST); $validator->addRules($this->_getValidateRules()); if (!$validator->validate()) { $errors = $validator->getErrors(); } $prof = $validator->getParams(); //--- c_profile の項目をチェック $validator = new OpenPNE_Validator(); $validator->addRequests($_REQUEST['profile']); $validator->addRules(util_get_validate_rules_profile('regist')); if (!$validator->validate()) { $errors = array_merge($errors, $validator->getErrors()); } // 値の整合性をチェック(DB) $c_member_profile_list = db_member_check_profile($validator->getParams(), $_REQUEST['public_flag']); // 必須項目チェック $profile_list = db_member_c_profile_list4null(); foreach ($profile_list as $profile) { $value = $c_member_profile_list[$profile['name']]['value']; if ($profile['disp_config'] && $profile['is_required']) { if (is_null($value) || $value === '' || $value === array()) { $errors[$profile['name']] = $profile['caption'] . 'を入力してください'; } } } // 生年月日のチェック if (!t_checkdate($prof['birth_month'], $prof['birth_day'], $prof['birth_year'])) { $errors[] = '生年月日を正しく入力してください'; } if (t_isFutureDate($prof['birth_day'], $prof['birth_month'], $prof['birth_year'])) { $errors[] = '生年月日を未来に設定することはできません'; } // 入力エラー if ($errors) { ktai_display_error($errors); } db_member_config_prof_new($u, $prof); // insert c_member_profile db_member_update_c_member_profile($u, $c_member_profile_list); //管理画面で指定したコミュニティに強制参加 $c_commu_id_list = db_commu_regist_join_list(); foreach ($c_commu_id_list as $c_commu_id) { db_commu_join_c_commu($c_commu_id, $u); } openpne_redirect('ktai', 'page_h_home'); }
/** * メンバー登録を行う * * @param array $c_member * @param array $c_member_secure * @param array $c_member_profile_list * @param bool $is_password_encrypted パスワードが既に暗号化済みかどうか * @return int */ function util_regist_c_member($c_member, $c_member_secure, $c_member_profile_list = array(), $is_password_encrypted = false) { // メール受信設定をデフォルト値に $c_member['is_receive_mail'] = 1; $c_member['is_receive_ktai_mail'] = 1; $c_member['is_receive_daily_news'] = 1; // メンバー登録 $u = db_member_insert_c_member($c_member, $c_member_secure, $is_password_encrypted); if ($u === false) { // メンバー登録に失敗した場合 return false; } if (OPENPNE_USE_POINT_RANK) { //入会者にポイント加算 $point = db_action_get_point4c_action_id(1); db_point_add_point($u, $point); //メンバー招待をした人にポイント加算 $point = db_action_get_point4c_action_id(7); db_point_add_point($c_member['c_member_id_invite'], $point); } // c_member_profile db_member_update_c_member_profile($u, $c_member_profile_list); // 招待者とフレンドリンク db_friend_insert_c_friend($u, $c_member['c_member_id_invite']); //管理画面で指定したコミュニティに強制参加 $c_commu_id_list = db_commu_regist_join_list(); foreach ($c_commu_id_list as $c_commu_id) { db_commu_join_c_commu($c_commu_id, $u); } // ログインIDを登録 if (OPENPNE_AUTH_MODE == 'pneid') { $login_id = strtolower($c_member['login_id']); db_member_insert_username($u, $login_id); } return $u; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $mode = $requests['mode']; $errors = array(); $validator = new OpenPNE_Validator(); if ($mode == 'register') { $validator->addRequests($_SESSION['prof_req']); } else { $validator->addRequests($_REQUEST); } $validator->addRules($this->_getValidateRules()); if (!$validator->validate()) { $errors = array_merge($errors, $validator->getErrors()); } $prof = $validator->getParams(); //--- c_profile の項目をチェック $validator = new OpenPNE_Validator(); if ($mode == 'register') { $validator->addRequests($_SESSION['prof_req']['profile']); $request_public_flags = $_SESSION['prof_req']['public_flag']; } else { $validator->addRequests($_REQUEST['profile']); $request_public_flags = $_REQUEST['public_flag']; } $validator->addRules(util_get_validate_rules_profile('regist')); if (!$validator->validate()) { $errors = array_merge($errors, $validator->getErrors()); } // 値の整合性をチェック(DB) $c_member_profile_list = db_member_check_profile($validator->getParams(), $request_public_flags); // 必須項目チェック $profile_list = db_member_c_profile_list4null(); foreach ($profile_list as $profile) { $value = $c_member_profile_list[$profile['name']]['value']; if ($profile['disp_config'] && $profile['is_required']) { if (is_null($value) || $value === '' || $value === array()) { $errors[$profile['name']] = $profile['caption'] . 'を入力してください'; } } } // 生年月日のチェック if (!t_checkdate($prof['birth_month'], $prof['birth_day'], $prof['birth_year'])) { $errors[] = '生年月日を正しく入力してください'; } if (t_isFutureDate($prof['birth_day'], $prof['birth_month'], $prof['birth_year'])) { $errors[] = '生年月日を未来に設定することはできません'; } $prof['profile'] = $c_member_profile_list; if ($errors && $mode != "input") { $_REQUEST['msg'] = array_shift($errors); $mode = "input"; $_SESSION['prof'] = $prof; unset($_SESSION['prof_req']); } switch ($mode) { case "input": openpne_forward('pc', 'page', "h_regist_prof"); exit; break; default: case "confirm": $_SESSION['prof_req'] = $_REQUEST; $_SESSION['prof'] = $prof; openpne_forward('pc', 'page', "h_regist_prof_confirm"); exit; break; case "register": db_member_config_prof_new($u, $prof); db_member_update_c_member_profile($u, $c_member_profile_list); //管理画面で指定したコミュニティに強制参加 $c_commu_id_list = db_commu_regist_join_list(); foreach ($c_commu_id_list as $c_commu_id) { db_commu_join_c_commu($c_commu_id, $u); } unset($_SESSION['prof']); openpne_redirect('pc', 'page_h_home'); break; } }