コード例 #1
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     // ----------
     list($event, $errors) = p_c_event_add_confirm_event4request(true);
     if ($event['invite_period_year'] . $event['invite_period_month'] . $event['invite_period_day'] != '') {
         $invite_period = $event['invite_period_year'] . "-" . $event['invite_period_month'] . "-" . $event['invite_period_day'];
     } else {
         $invite_period = '';
     }
     //--- 権限チェック
     //イベント管理者 or コミュニティ管理者
     if (!db_commu_is_c_event_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($event['c_commu_id'], $u)) {
         handle_kengen_error();
     }
     //---
     //エラーチェック
     $err_msg = $errors;
     if (!$event['open_date_month'] || !$event['open_date_day'] || !$event['open_date_year']) {
         $err_msg[] = "開催日時を入力してください";
     } elseif (!t_checkdate($event['open_date_month'], $event['open_date_day'], $event['open_date_year'])) {
         $err_msg[] = "開催日時は存在しません";
     } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0)) {
         $err_msg[] = "開催日時は過去に指定できません";
     }
     if ($event['invite_period_month'] . $event['invite_period_day'] . $event['invite_period_year'] != "") {
         if (!$event['invite_period_month'] || !$event['invite_period_day'] || !$event['invite_period_year']) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (!t_checkdate($event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year']) < mktime(0, 0, 0)) {
             $err_msg[] = "募集期限は過去に指定できません";
         } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は開催日時より未来に指定できません";
         }
     }
     if ($err_msg) {
         $_REQUEST = $event;
         $_REQUEST['err_msg'] = $err_msg;
         $_REQUEST['target_c_commu_topic_id'] = $c_commu_topic_id;
         openpne_forward('ktai', 'page', "c_event_edit");
         exit;
     }
     $update_c_commu_topic = array('name' => $event['title'], 'open_date' => $event['open_date_year'] . "-" . $event['open_date_month'] . "-" . $event['open_date_day'], 'open_date_comment' => $event['open_date_comment'], 'open_pref_id' => $event['open_pref_id'], 'open_pref_comment' => $event['open_pref_comment'], 'invite_period' => $invite_period, 'event_flag' => 1, 'capacity' => $event['capacity']);
     db_commu_update_c_commu_topic($c_commu_topic_id, $update_c_commu_topic);
     $update_c_commu_topic_comment = array('body' => $event['detail']);
     db_commu_update_c_commu_topic_comment($c_commu_topic_id, $update_c_commu_topic_comment);
     $p = array('target_c_commu_topic_id' => $c_commu_topic_id);
     openpne_redirect('ktai', 'page_c_bbs', $p);
 }
コード例 #2
0
 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');
 }
コード例 #3
0
 function execute($requests)
 {
     //<PCKTAI
     if (OPENPNE_AUTH_MODE == 'slavepne' || !((OPENPNE_REGIST_FROM & OPENPNE_REGIST_FROM_KTAI) >> 1)) {
         openpne_redirect('ktai', 'page_o_login', array('msg' => 42));
     }
     //>
     // --- リクエスト変数
     $ses = $requests['ses'];
     $aff_id = $requests['aff_id'];
     // ----------
     //--- 権限チェック
     //セッションが有効
     // セッションが有効かどうか
     if (!($pre = db_member_c_member_ktai_pre4session($ses))) {
         // 無効の場合、login へリダイレクト
         openpne_redirect('ktai', 'page_o_login', array('msg' => 42));
     }
     // メールアドレスが登録できるかどうか
     if (!util_is_regist_mail_address($pre['ktai_address'])) {
         openpne_redirect('ktai', 'page_o_login', array('msg' => 42));
     }
     //---
     $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_regist'] && $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 (IS_GET_EASY_ACCESS_ID != 0) {
         $easy_access_id = OpenPNE_KtaiID::getID();
         if (!$easy_access_id && (IS_GET_EASY_ACCESS_ID == 2 || IS_GET_EASY_ACCESS_ID == 3) && !$pre['is_disabled_regist_easy_access_id']) {
             openpne_redirect('ktai', 'page_o_regist_ktai_uid_err');
         }
         if (db_member_c_member_id4easy_access_id($easy_access_id)) {
             $errors[] = 'この携帯個体識別番号はすでに登録されています';
         }
         if (db_member_easy_access_id_is_blacklist(md5($easy_access_id))) {
             ktai_display_error('新規登録を完了できませんでした。');
         }
     }
     if (OPENPNE_AUTH_MODE == 'pneid') {
         // ログインIDの重複チェック
         if (db_member_c_member_id4username($prof['login_id'])) {
             $errors[] = 'このログインIDはすでに登録されています';
         }
     }
     // 入力エラー
     if ($errors) {
         ktai_display_error($errors);
     }
     // insert c_member
     $prof['c_member_id_invite'] = $pre['c_member_id_invite'];
     // 参加承認制
     if (IS_SNS_ENTRY_CONFIRM) {
         $c_member_secure = array('password' => $prof['password'], 'c_password_query_answer' => $prof['password_query_answer'], 'ktai_address' => $pre['ktai_address'], 'regist_address' => $pre['ktai_address'], 'nickname' => $prof['nickname'], 'birth_year' => $prof['birth_year'], 'birth_month' => $prof['birth_month'], 'birth_day' => $prof['birth_day'], 'public_flag_birth_year' => $prof['public_flag_birth_year'], 'public_flag_birth_month_day' => $prof['public_flag_birth_month_day'], 'c_password_query_id' => $prof['c_password_query_id'], 'is_sns_entry_confirm' => 1);
         // 仮登録IDを割り出す
         $c_member_pre_id = db_member_insert_c_member_pre_from_ktai($prof['c_member_id_invite'], $pre['ktai_address'], $pre['ktai_address'], $pre['session']);
         // c_member_pre_profile にデータ挿入
         db_member_update_c_member_pre_profile($c_member_pre_id, $c_member_profile_list);
         if ($easy_access_id) {
             $c_member_secure['easy_access_id'] = $easy_access_id;
         }
         if (OPENPNE_AUTH_MODE == 'pneid') {
             $c_member_secure['login_id'] = $prof['login_id'];
         }
         // 登録
         db_member_update_c_member_pre4c_member_pre_id($c_member_pre_id, $c_member_secure);
         // delete c_member_ktai_pre
         db_member_delete_c_member_ktai_pre4id($pre['c_member_ktai_pre_id']);
         openpne_redirect('ktai', 'page_o_regist_wait');
     }
     $c_member_secure = array('password' => $prof['password'], 'password_query_answer' => $prof['password_query_answer'], 'pc_address' => '', 'ktai_address' => $pre['ktai_address'], 'regist_address' => $pre['ktai_address']);
     if (!($c_member_id = util_regist_c_member($prof, $c_member_secure, $c_member_profile_list))) {
         openpne_redirect('ktai', 'page_o_login', array('msg' => 42));
     }
     // 個体識別番号の登録
     if ($easy_access_id) {
         db_member_update_easy_access_id($c_member_id, $easy_access_id);
     }
     // delete c_member_ktai_pre
     db_member_delete_c_member_ktai_pre4id($pre['c_member_ktai_pre_id']);
     do_insert_c_member_mail_send($c_member_id, $prof['password'], $pre['ktai_address']);
     // 登録完了メール(管理者宛)
     if (SEND_USER_DATA) {
         do_common_send_mail_regist4admin($c_member_id);
     }
     if ($aff_id) {
         $p = array('aff_id' => $aff_id);
     } else {
         $p = array();
     }
     $p['c_member_id'] = $c_member_id;
     openpne_redirect('ktai', 'page_o_regist_end', $p);
 }
コード例 #4
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     $mode = $requests['mode'];
     $errors = array();
     $validator = new OpenPNE_Validator();
     $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();
     $validator->addRequests($_REQUEST['profile']);
     $validator->addRules(util_get_validate_rules_profile('config'));
     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) {
         $_REQUEST['msg'] = array_shift($errors);
         $mode = "input";
     }
     switch ($mode) {
         case "input":
             $prof['profile'] = $c_member_profile_list;
             $_REQUEST['prof'] = $prof;
             openpne_forward('pc', 'page', "h_config_prof");
             exit;
             break;
         default:
         case "confirm":
             $prof['profile'] = $c_member_profile_list;
             $_REQUEST['prof'] = $prof;
             // page:h_config_prof_confirm への値の引渡し
             openpne_forward('pc', 'page', "h_config_prof_confirm");
             exit;
             break;
         case "register":
             db_member_config_prof_new($u, $prof);
             db_member_update_c_member_profile($u, $c_member_profile_list);
             db_member_update_c_member_config($u, 'IS_SEARCH_RESULT', $prof['is_search_result']);
             openpne_redirect('pc', 'page_h_prof');
             break;
     }
 }
コード例 #5
0
 function execute($requests)
 {
     //<PCKTAI
     if (OPENPNE_AUTH_MODE == 'slavepne' || !(OPENPNE_REGIST_FROM & OPENPNE_REGIST_FROM_PC)) {
         client_redirect_login();
     }
     //>
     $sid = $requests['sid'];
     if (!db_member_is_active_sid($sid)) {
         $p = array('msg_code' => 'invalid_url');
         openpne_redirect('pc', 'page_o_tologin', $p);
     }
     $pre = db_member_c_member_pre4sid($sid);
     $mode = $requests['mode'];
     $errors = array();
     $validator = new OpenPNE_Validator();
     if ($mode == 'register') {
         session_name('OpenPNEpcregist');
         @session_start();
         $validator->addRequests($_SESSION['prof']);
         $requests['password2'] = $_SESSION['prof']['password'];
     } else {
         $validator->addRequests($_REQUEST);
     }
     $validator->addRules($this->_getValidateRules());
     if (!$validator->validate()) {
         $errors = $validator->getErrors();
     }
     $prof = $validator->getParams();
     if ($prof['password'] !== $requests['password2']) {
         $errors['password2'] = 'パスワードが一致していません';
     }
     //--- c_profile の項目をチェック
     $validator = new OpenPNE_Validator();
     if ($mode == 'register') {
         $validator->addRequests($_SESSION['prof']['profile']);
         $public_flag_list = $_SESSION['prof']['public_flag'];
     } else {
         $validator->addRequests($_REQUEST['profile']);
         $public_flag_list = $_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(), $public_flag_list);
     // 必須項目チェック
     $profile_list = db_member_c_profile_list4null();
     foreach ($profile_list as $profile) {
         $value = $c_member_profile_list[$profile['name']]['value'];
         if ($profile['disp_regist'] && $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 (OPENPNE_AUTH_MODE == 'pneid') {
         // ログインIDの重複チェック
         if (db_member_c_member_id4username($prof['login_id'])) {
             $errors[] = 'このログインIDはすでに登録されています';
         }
     }
     if ($mode != 'input' && $errors) {
         $_REQUEST['err_msg'] = $errors;
         $mode = 'input';
         @session_start();
         $_SESSION['prof'] = $_REQUEST;
         unset($_SESSION['password']);
     }
     switch ($mode) {
         case 'input':
             $prof['profile'] = $c_member_profile_list;
             unset($prof['password']);
             openpne_forward('pc', 'page', 'o_regist_prof');
             exit;
         case 'confirm':
         default:
             $prof['profile'] = $c_member_profile_list;
             session_name('OpenPNEpcregist');
             @session_start();
             $_SESSION['prof'] = $_REQUEST;
             $_REQUEST['prof'] = $prof;
             openpne_forward('pc', 'page', 'o_regist_prof_confirm');
             exit;
         case 'register':
             $pre = db_member_c_member_pre4sid($sid);
             // delete cookie
             setcookie(session_name(), '', time() - 3600, ini_get('session.cookie_path'));
             if (IS_GET_EASY_ACCESS_ID != 3 || $pre['is_disabled_regist_easy_access_id']) {
                 // 管理者へ承認申請
                 if (IS_SNS_ENTRY_CONFIRM) {
                     // c_member_pre にデータ挿入
                     $c_member_pre_secure = array('session' => $pre['session'], 'nickname' => $prof['nickname'], 'birth_year' => $prof['birth_year'], 'birth_month' => $prof['birth_month'], 'birth_day' => $prof['birth_day'], 'public_flag_birth_year' => $prof['public_flag_birth_year'], 'public_flag_birth_month_day' => $prof['public_flag_birth_month_day'], 'password' => $prof['password'], 'c_password_query_id' => $prof['c_password_query_id'], 'c_password_query_answer' => $prof['c_password_query_answer'], 'pc_address' => $pre['pc_address'], 'regist_address' => $pre['pc_address'], 'is_sns_entry_confirm' => 1);
                     // c_member_pre_profile にデータ挿入
                     db_member_update_c_member_pre_profile($pre['c_member_pre_id'], $c_member_profile_list);
                     if (OPENPNE_AUTH_MODE == 'pneid') {
                         $c_member_pre_secure['login_id'] = $prof['login_id'];
                     }
                     db_member_update_c_member_pre4c_member_pre_id($pre['c_member_pre_id'], $c_member_pre_secure);
                     openpne_redirect('pc', 'page_o_regist_wait', array('c_member_id' => $u));
                 }
                 // メンバー登録時の携帯個体識別番号取得設定が「PC・携帯登録時に個体識別番号を必須にする」でない場合、メンバー登録処理をおこなう
                 $c_member = $prof;
                 $c_member['c_member_id_invite'] = $pre['c_member_id_invite'];
                 $c_member_secure = array('password' => $prof['password'], 'password_query_answer' => $prof['c_password_query_answer'], 'pc_address' => $pre['pc_address'], 'ktai_address' => '', 'regist_address' => $pre['pc_address']);
                 // メンバー登録
                 $u = util_regist_c_member($c_member, $c_member_secure, $c_member_profile_list);
                 // pre の内容を削除
                 db_member_delete_c_member_pre4sid($sid);
                 // 登録完了メール送信
                 do_regist_prof_do_regist2_mail_send($u);
                 // 登録完了メール(管理者宛)
                 if (SEND_USER_DATA) {
                     do_common_send_mail_regist4admin($u);
                 }
                 openpne_redirect('pc', 'page_o_regist_end', array('c_member_id' => $u));
             } else {
                 // メンバー登録時の携帯個体識別番号取得設定が「PC・携帯登録時に個体識別番号を必須にする」である場合、
                 // ここでのメンバー登録はすべてスキップする。入力した項目は c_member_pre とc_member_pre_profile に
                 // 保持しておき、携帯の登録が完了した場合に、メンバー登録も完了する
                 // c_member_pre_profile にデータ挿入
                 db_member_update_c_member_pre_profile($pre['c_member_pre_id'], $c_member_profile_list);
                 // c_member_pre にデータ挿入
                 $c_member_pre_secure = array('session' => $pre['session'], 'nickname' => $prof['nickname'], 'birth_year' => $prof['birth_year'], 'birth_month' => $prof['birth_month'], 'birth_day' => $prof['birth_day'], 'public_flag_birth_year' => $prof['public_flag_birth_year'], 'public_flag_birth_month_day' => $prof['public_flag_birth_month_day'], 'password' => $prof['password'], 'c_password_query_id' => $prof['c_password_query_id'], 'password_query_answer' => $prof['c_password_query_answer'], 'pc_address' => $pre['pc_address'], 'regist_address' => $pre['pc_address']);
                 if (OPENPNE_AUTH_MODE == 'pneid') {
                     $c_member_pre_secure['login_id'] = $prof['login_id'];
                 }
                 db_member_update_c_member_pre_secure($pre['c_member_pre_id'], $c_member_pre_secure);
                 openpne_redirect('pc', 'page_o_regist_ktai_address', array('sid' => $pre['session']));
             }
     }
 }
コード例 #6
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     // ----------
     $upfile_obj1 = $_FILES['image_filename1'];
     $upfile_obj2 = $_FILES['image_filename2'];
     $upfile_obj3 = $_FILES['image_filename3'];
     $upfile_obj4 = $_FILES['filename4'];
     list($event, $errors) = p_c_event_add_confirm_event4request(true);
     if ($event['invite_period_year'] . $event['invite_period_month'] . $event['invite_period_day'] != '') {
         $invite_period = $event['invite_period_year'] . "-" . $event['invite_period_month'] . "-" . $event['invite_period_day'];
     } else {
         $invite_period = "";
     }
     $c_commu_id = $event['c_commu_id'];
     //--- 権限チェック
     //イベント管理者 or コミュニティ管理者
     if (!db_commu_is_c_event_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id);
     if ($c_commu['is_topic'] == 'admin_only' && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if ($c_commu['is_topic'] == 'member' && !db_commu_is_c_commu_member($c_commu_id, $u)) {
         handle_kengen_error();
     }
     //---
     //エラーチェック
     $err_msg = $errors;
     $filesize = 0;
     $del_file = array();
     if (!$event['open_date_month'] || !$event['open_date_day'] || !$event['open_date_year']) {
         $err_msg[] = "開催日時を入力してください";
     } elseif (!t_checkdate($event['open_date_month'], $event['open_date_day'], $event['open_date_year'])) {
         $err_msg[] = "開催日時は存在しません";
     } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0)) {
         $err_msg[] = "開催日時は過去に指定できません";
     }
     if ($event['invite_period_month'] . $event['invite_period_day'] . $event['invite_period_year'] != "") {
         if (!$event['invite_period_month'] || !$event['invite_period_day'] || !$event['invite_period_year']) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (!t_checkdate($event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year']) < mktime(0, 0, 0)) {
             $err_msg[] = "募集期限は過去に指定できません";
         } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は開催日時より未来に指定できません";
         }
     }
     $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
     if (!empty($upfile_obj1) && $upfile_obj1['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj1))) {
             $err_msg[] = '画像1は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
         if ($c_topic['image_filename1']) {
             $del_file[] = $c_topic['image_filename1'];
         }
     }
     if (!empty($upfile_obj2) && $upfile_obj2['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj2))) {
             $err_msg[] = '画像2は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
         if ($c_topic['image_filename2']) {
             $del_file[] = $c_topic['image_filename2'];
         }
     }
     if (!empty($upfile_obj3) && $upfile_obj3['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj3))) {
             $err_msg[] = '画像3は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
         if ($c_topic['image_filename3']) {
             $del_file[] = $c_topic['image_filename3'];
         }
     }
     // 画像アップロード可能サイズチェック
     if (!$err_msg && $filesize) {
         $result = util_image_check_change_image_upload($filesize, $del_file, $u, 'commu');
         if ($result) {
             if ($result == 2) {
                 $result = 3;
             }
             $err_msg[] = util_image_get_upload_err_msg($result);
         }
     }
     if (OPENPNE_USE_FILEUPLOAD) {
         if (!empty($upfile_obj4) && $upfile_obj4['error'] !== UPLOAD_ERR_NO_FILE) {
             // ファイルサイズ制限
             if ($upfile_obj4['size'] === 0 || $upfile_obj4['size'] > FILE_MAX_FILESIZE * 1024) {
                 $err_msg[] = 'ファイルは' . FILE_MAX_FILESIZE . 'KB以内のファイルにしてください(ただし空のファイルはアップロードできません)';
             }
             // 拡張子制限
             if (!util_check_file_extention($upfile_obj4['name'])) {
                 $err_msg[] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string'));
             }
         }
     }
     if ($err_msg) {
         $_REQUEST = $event;
         $_REQUEST['err_msg'] = $err_msg;
         $_REQUEST['target_c_commu_topic_id'] = $c_commu_topic_id;
         openpne_forward('pc', 'page', "c_event_edit");
         exit;
     }
     // 画像アップデート
     $filename1 = image_insert_c_image_direct($upfile_obj1, "t_{$c_commu_topic_id}_1", $u);
     $filename2 = image_insert_c_image_direct($upfile_obj2, "t_{$c_commu_topic_id}_2", $u);
     $filename3 = image_insert_c_image_direct($upfile_obj3, "t_{$c_commu_topic_id}_3", $u);
     //ファイルアップロード
     $sessid = session_id();
     t_image_clear_tmp($sessid);
     if (OPENPNE_USE_FILEUPLOAD) {
         $tmpfile4 = t_file_save2tmp($upfile_obj4, $sessid, "t_4");
     }
     if ($tmpfile4) {
         $filename4 = file_insert_c_file4tmp("t_{$c_commu_topic_id}_4", $tmpfile4, $upfile_obj4['name']);
     }
     t_file_clear_tmp(session_id());
     $update_c_commu_topic = array('name' => $event['title'], 'open_date' => $event['open_date_year'] . "-" . $event['open_date_month'] . "-" . $event['open_date_day'], 'open_date_comment' => $event['open_date_comment'], 'open_pref_id' => $event['open_pref_id'], 'open_pref_comment' => $event['open_pref_comment'], 'invite_period' => $invite_period, 'event_flag' => 1, 'capacity' => $event['capacity']);
     db_commu_update_c_commu_topic($c_commu_topic_id, $update_c_commu_topic);
     $update_c_commu_topic_comment = array('body' => $event['detail']);
     // 画像アップロード可能サイズチェックで使用するため移動
     //        $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
     if ($filename1) {
         $update_c_commu_topic_comment["image_filename1"] = $filename1;
         db_image_data_delete($c_topic['image_filename1'], $u);
     }
     if ($filename2) {
         $update_c_commu_topic_comment["image_filename2"] = $filename2;
         db_image_data_delete($c_topic['image_filename2'], $u);
     }
     if ($filename3) {
         $update_c_commu_topic_comment["image_filename3"] = $filename3;
         db_image_data_delete($c_topic['image_filename3'], $u);
     }
     if ($filename4) {
         $update_c_commu_topic_comment['filename4'] = $filename4;
         db_file_delete_c_file($c_topic['filename']);
     }
     db_commu_update_c_commu_topic_comment($c_commu_topic_id, $update_c_commu_topic_comment);
     $p = array('target_c_commu_topic_id' => $c_commu_topic_id);
     openpne_redirect('pc', 'page_c_event_detail', $p);
 }
コード例 #7
0
 function execute($requests)
 {
     $member_file = $_FILES['member_file'];
     $limit = 1000;
     // 行数制限
     if (empty($member_file) || $member_file['error'] === UPLOAD_ERR_NO_FILE) {
         $this->handleError('ファイルを指定してください');
     }
     $filename_parts = explode('.', $member_file['name']);
     if (array_pop($filename_parts) != 'csv') {
         $this->handleError('拡張子は.csvにしてください');
     }
     $handle = fopen($member_file['tmp_name'], 'r');
     if (($data = fgetcsv($handle, 4096)) === false) {
         $this->handleError('ファイルの内容が空です');
     }
     $required_list = array('nickname', 'mail_address', 'password');
     if (OPENPNE_AUTH_MODE == 'pneid') {
         $required_list[] = 'login_id';
     }
     foreach ($required_list as $required) {
         if (!in_array($required, $data)) {
             $this->handleError('1行目: ' . $required . 'は必須項目です');
         }
     }
     $title = array();
     foreach ($data as $key => $value) {
         $matches = array();
         if (preg_match('/^profile\\[(.*)\\]$/', $value, $matches)) {
             $is_profile = true;
             $name = $matches[1];
             $c_profile = db_member_c_profile4name($name);
         } else {
             $is_profile = false;
             $name = $value;
             $c_profile = null;
         }
         $title[$key] = array('is_profile' => $is_profile, 'name' => $name, 'c_profile' => $c_profile);
     }
     $row = 1;
     // 1行目がタイトル行
     $count = 0;
     // メンバー登録に成功した数
     while (($data = fgetcsv($handle, 4096)) !== false && $row <= $limit) {
         $row++;
         $data_member = array();
         $data_profile = array();
         foreach ($data as $key => $value) {
             if (empty($title[$key])) {
                 continue;
             }
             $name = $title[$key]['name'];
             if ($title[$key]['is_profile']) {
                 if ($title[$key]['c_profile']['form_type'] === 'checkbox') {
                     $data_profile[$name] = explode(',', $value);
                 } else {
                     $data_profile[$name] = $value;
                 }
             } else {
                 $data_member[$name] = $value;
             }
         }
         if (is_ktai_mail_address($data_member['mail_address'])) {
             $data_member['mail_address'] = str_replace('"', '', $data_member['mail_address']);
         }
         // validate
         $errors = array();
         $validator = new OpenPNE_Validator();
         $validator->addRequests($data_member);
         $validator->addRules($this->_getValidateRules());
         if (!$validator->validate()) {
             $errors = array_merge($errors, $validator->getErrors());
         }
         $member = $validator->getParams();
         // mail_address
         if (!db_common_is_mailaddress($member['mail_address'])) {
             $errors[] = "メールアドレス [{$member['mail_address']}] はメールアドレスとして正しくありません";
         } elseif (db_member_is_sns_join4mail_address($member['mail_address'])) {
             $errors[] = "メールアドレス [{$member['mail_address']}] は既に登録済みです";
         } elseif (!db_member_is_limit_domain4mail_address($member['mail_address'])) {
             $errors[] = "メールアドレス [{$member['mail_address']}] は登録できません";
         }
         // login_id
         if (OPENPNE_AUTH_MODE == 'pneid') {
             if (db_member_c_member_id4username($member['login_id'])) {
                 $errors[] = "ログインID[{$member['login_id']}]は既に登録済みです";
             }
         }
         // 生年月日のチェック
         if ($member['birth_year'] || $member['birth_month'] || $member['birth_day']) {
             if (!t_checkdate($member['birth_month'], $member['birth_day'], $member['birth_year'])) {
                 $errors[] = '生年月日を正しく入力してください';
             } elseif (t_isFutureDate($member['birth_day'], $member['birth_month'], $member['birth_year'])) {
                 $errors[] = '生年月日を未来に設定することはできません';
             }
         }
         if ($errors) {
             $this->handleError("{$row}行目:" . array_shift($errors));
         }
         // profile
         $c_member_profile = db_member_check_profile($data_profile, array());
         // register
         // メールアドレスが携帯メールアドレスのドメインの場合は、
         // 携帯メールアドレスとして登録する
         if (is_ktai_mail_address($member['mail_address'])) {
             $ktai_address = $member['mail_address'];
             $pc_address = '';
         } else {
             $ktai_address = '';
             $pc_address = $member['mail_address'];
         }
         $c_member = array('nickname' => $member['nickname'], 'birth_year' => $member['birth_year'], 'birth_month' => $member['birth_month'], 'birth_day' => $member['birth_day'], 'c_password_query_id' => 0, 'c_member_id_invite' => 1, 'is_receive_mail' => 1, 'is_receive_ktai_mail' => 1, 'is_receive_daily_news' => 1, 'public_flag_birth_year' => $member['public_flag_birth_year'], 'public_flag_birth_month_day' => $member['public_flag_birth_month_day']);
         if (OPENPNE_AUTH_MODE == 'pneid') {
             $c_member['login_id'] = $member['login_id'];
         }
         $c_member_secure = array('password' => $member['password'], 'pc_address' => $pc_address, 'ktai_address' => $ktai_address, 'regist_address' => $member['mail_address']);
         if (!util_regist_c_member($c_member, $c_member_secure, $c_member_profile)) {
             $this->handleError("{$row}行目:メンバー登録に失敗しました");
         }
         $count++;
     }
     fclose($handle);
     admin_client_redirect('import_c_member', "{$count}件のインポートが完了しました");
 }
コード例 #8
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $tmpfile1 = $requests['image_filename1_tmpfile'];
     $tmpfile2 = $requests['image_filename2_tmpfile'];
     $tmpfile3 = $requests['image_filename3_tmpfile'];
     // ----------
     //---添付ファイル
     if (OPENPNE_USE_FILEUPLOAD) {
         $filename4_tmpfile = $requests['filename4_tmpfile'];
         $filename4_original_filename = $requests['filename4_original_filename'];
         if ($filename4_tmpfile) {
             // 拡張子制限
             if (!util_check_file_extention($filename4_original_filename)) {
                 $_REQUEST['target_c_commu_id'] = $requests['c_commu_id'];
                 $_REQUEST['err_msg'] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string'));
                 openpne_forward('pc', 'page', "c_event_add");
                 exit;
             }
         }
     }
     //--- 権限チェック
     //コミュニティ参加者
     list($event, $errors) = p_c_event_add_confirm_event4request(true);
     $c_commu = db_commu_c_commu4c_commu_id2($event['c_commu_id']);
     switch ($c_commu['is_topic']) {
         case 'public':
             //誰でも作成可能
             break;
         case 'member':
             $status = db_common_commu_status($u, $event['c_commu_id']);
             if (!$status['is_commu_member']) {
                 handle_kengen_error();
             }
             break;
         case 'admin_only':
             //トピック作成権限チェック
             if (!db_commu_is_c_commu_admin($event['c_commu_id'], $u)) {
                 $_REQUEST['target_c_commu_id'] = $event['c_commu_id'];
                 $_REQUEST['msg'] = "イベントは管理者だけが作成できます";
                 openpne_forward('pc', 'page', "c_home");
                 exit;
             }
             break;
     }
     //---
     // エラーチェック
     $err_msg = $errors;
     $filesize = 0;
     if (!$event['open_date_month'] || !$event['open_date_day'] || !$event['open_date_year']) {
         $err_msg[] = "開催日時を入力してください";
     } elseif (!t_checkdate($event['open_date_month'], $event['open_date_day'], $event['open_date_year'])) {
         $err_msg[] = "開催日時は存在しません";
     } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0)) {
         $err_msg[] = "開催日時は過去に指定できません";
     }
     if ($event['invite_period_month'] . $event['invite_period_day'] . $event['invite_period_year'] != "") {
         if (!$event['invite_period_month'] || !$event['invite_period_day'] || !$event['invite_period_year']) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (!t_checkdate($event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year']) < mktime(0, 0, 0)) {
             $err_msg[] = "募集期限は過去に指定できません";
         } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は開催日時より未来に指定できません";
         }
     }
     // 画像アップロード可能サイズチェック
     if ($tmpfile1) {
         $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_1", $tmpfile1);
     }
     if ($tmpfile2) {
         $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_2", $tmpfile2);
     }
     if ($tmpfile3) {
         $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_3", $tmpfile3);
     }
     if ($filesize) {
         $result = util_image_check_add_image_upload($filesize, $u, 'commu');
         if ($result) {
             if ($result == 2) {
                 $result = 3;
             }
             $err_msg[] = util_image_get_upload_err_msg($result);
         }
     }
     if ($err_msg) {
         $_REQUEST = $event;
         $_REQUEST['target_c_commu_id'] = $event['c_commu_id'];
         $_REQUEST['err_msg'] = $err_msg;
         openpne_forward('pc', 'page', "c_event_add");
         exit;
     }
     if ($event['invite_period_year'] . $event['invite_period_month'] . $event['invite_period_day'] != "") {
         $invite_period = $event['invite_period_year'] . "-" . $event['invite_period_month'] . "-" . $event['invite_period_day'];
     }
     $insert_c_commu_topic = array("name" => $event['title'], "c_commu_id" => $event['c_commu_id'], "c_member_id" => $u, "open_date" => $event['open_date_year'] . "-" . $event['open_date_month'] . "-" . $event['open_date_day'], "open_date_comment" => $event['open_date_comment'], "open_pref_id" => $event['open_pref_id'], "open_pref_comment" => $event['open_pref_comment'], "invite_period" => $invite_period, "event_flag" => 1, "capacity" => $event['capacity']);
     $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic);
     if ($tmpfile1) {
         $filename1 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_1", $tmpfile1, $u);
     }
     if ($tmpfile2) {
         $filename2 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_2", $tmpfile2, $u);
     }
     if ($tmpfile3) {
         $filename3 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_3", $tmpfile3, $u);
     }
     if (OPENPNE_USE_FILEUPLOAD) {
         // 添付ファイルをDBに入れる
         if ($filename4_tmpfile) {
             $filename4 = file_insert_c_file4tmp("t_{$c_commu_topic_id}_4", $filename4_tmpfile, $filename4_original_filename);
         }
     }
     //テンポラリファイルを削除(画像と同時)
     t_image_clear_tmp(session_id());
     t_file_clear_tmp(session_id());
     $insert_c_commu_topic_comment = array("c_commu_id" => $event['c_commu_id'], "c_member_id" => $u, "body" => $event['detail'], "number" => 0, "c_commu_topic_id" => $c_commu_topic_id, "image_filename1" => !empty($filename1) ? $filename1 : '', "image_filename2" => !empty($filename2) ? $filename2 : '', "image_filename3" => !empty($filename3) ? $filename3 : '', "filename4" => !empty($filename4) ? $filename4 : '');
     $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment);
     //お知らせメール送信(携帯へ)
     send_bbs_info_mail($insert_id, $u);
     //お知らせメール送信(PCへ)
     send_bbs_info_mail_pc($insert_id, $u);
     db_commu_insert_c_event_member_as_admin($c_commu_topic_id, $u);
     if (OPENPNE_USE_POINT_RANK) {
         //イベントを作成した人にポイント付与
         $point = db_action_get_point4c_action_id(10);
         db_point_add_point($u, $point);
     }
     $p = array('target_c_commu_topic_id' => $c_commu_topic_id);
     openpne_redirect('pc', 'page_c_event_detail', $p);
 }
コード例 #9
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     //--- 権限チェック
     //コミュニティ参加者
     list($event, $errors) = p_c_event_add_confirm_event4request(true);
     $c_commu = db_commu_c_commu4c_commu_id2($event['c_commu_id']);
     switch ($c_commu['is_topic']) {
         case 'public':
             //誰でも作成可能
             break;
         case 'member':
             $status = db_common_commu_status($u, $event['c_commu_id']);
             if (!$status['is_commu_member']) {
                 handle_kengen_error();
             }
             break;
         case 'admin_only':
             //トピック作成権限チェック
             if (!db_commu_is_c_commu_admin($event['c_commu_id'], $u)) {
                 ktai_display_error("イベントは管理者だけが作成できます");
             }
             break;
     }
     //---
     //--- エラーチェック
     $err_msg = $errors;
     if (!$event['open_date_month'] || !$event['open_date_day'] || !$event['open_date_year']) {
         $err_msg[] = "開催日時を入力してください";
     } elseif (!t_checkdate($event['open_date_month'], $event['open_date_day'], $event['open_date_year'])) {
         $err_msg[] = "開催日時は存在しません";
     } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0)) {
         $err_msg[] = "開催日時は過去に指定できません";
     }
     if ($event['invite_period_month'] . $event['invite_period_day'] . $event['invite_period_year'] != "") {
         if (!$event['invite_period_month'] || !$event['invite_period_day'] || !$event['invite_period_year']) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (!t_checkdate($event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year']) < mktime(0, 0, 0)) {
             $err_msg[] = "募集期限は過去に指定できません";
         } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は開催日時より未来に指定できません";
         }
     }
     if ($err_msg) {
         $_REQUEST = $event;
         $_REQUEST['target_c_commu_id'] = $event['c_commu_id'];
         $_REQUEST['err_msg'] = $err_msg;
         openpne_forward('ktai', 'page', "c_event_add");
         exit;
     }
     //---
     if ($event['invite_period_year'] . $event['invite_period_month'] . $event['invite_period_day'] != "") {
         $invite_period = $event['invite_period_year'] . "-" . $event['invite_period_month'] . "-" . $event['invite_period_day'];
     } else {
         $invite_period = '';
     }
     $insert_c_commu_topic = array("name" => $event['title'], "c_commu_id" => $event['c_commu_id'], "c_member_id" => $u, "open_date" => $event['open_date_year'] . "-" . $event['open_date_month'] . "-" . $event['open_date_day'], "open_date_comment" => $event['open_date_comment'], "open_pref_id" => $event['open_pref_id'], "open_pref_comment" => $event['open_pref_comment'], "invite_period" => $invite_period, "event_flag" => 1, 'capacity' => $event['capacity']);
     $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic);
     $insert_c_commu_topic_comment = array("c_commu_id" => $event['c_commu_id'], "c_member_id" => $u, "body" => $event['detail'], "number" => 0, "c_commu_topic_id" => $c_commu_topic_id, "image_filename1" => '', "image_filename2" => '', "image_filename3" => '');
     $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment);
     //お知らせメール送信(携帯へ)
     send_bbs_info_mail($insert_id, $u);
     //お知らせメール送信(PCへ)
     send_bbs_info_mail_pc($insert_id, $u);
     db_commu_insert_c_event_member_as_admin($c_commu_topic_id, $u);
     if (OPENPNE_USE_POINT_RANK) {
         //イベントを作成した人にポイント付与
         $point = db_action_get_point4c_action_id(10);
         db_point_add_point($u, $point);
     }
     $p = array('target_c_commu_topic_id' => $c_commu_topic_id);
     openpne_redirect('ktai', 'page_c_bbs', $p);
 }
コード例 #10
0
 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;
     }
 }
コード例 #11
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_commu_id = $requests['target_c_commu_id'];
     // ----------
     //--- 権限チェック
     $c_commu = db_commu_c_commu4c_commu_id2($target_c_commu_id);
     switch ($c_commu['is_topic']) {
         case 'public':
             //誰でも作成可能
             break;
         case 'member':
             //コミュニティメンバー
             if (!db_commu_is_c_commu_member($target_c_commu_id, $u)) {
                 handle_kengen_error();
             }
             break;
         case 'admin_only':
             //トピック作成権限チェック
             if (!db_commu_is_c_commu_admin($target_c_commu_id, $u)) {
                 handle_kengen_error();
             }
             break;
     }
     //---
     list($event, $errors) = p_c_event_add_confirm_event4request(true);
     $upfile_obj1 = $_FILES['image_filename1'];
     $upfile_obj2 = $_FILES['image_filename2'];
     $upfile_obj3 = $_FILES['image_filename3'];
     $upfile_obj4 = $_FILES['uploadfile'];
     // エラーチェック
     $err_msg = $errors;
     $filesize = 0;
     if (!$event['open_date_month'] || !$event['open_date_day'] || !$event['open_date_year']) {
         $err_msg[] = "開催日時を入力してください";
     } elseif (!t_checkdate($event['open_date_month'], $event['open_date_day'], $event['open_date_year'])) {
         $err_msg[] = "開催日時は存在しません";
     } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0)) {
         $err_msg[] = "開催日時は過去に指定できません";
     }
     if ($event['invite_period_month'] . $event['invite_period_day'] . $event['invite_period_year'] != "") {
         if (!$event['invite_period_month'] || !$event['invite_period_day'] || !$event['invite_period_year']) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (!t_checkdate($event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year']) < mktime(0, 0, 0)) {
             $err_msg[] = "募集期限は過去に指定できません";
         } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は開催日時より未来に指定できません";
         }
     }
     if (!empty($upfile_obj1) && $upfile_obj1['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj1))) {
             $err_msg[] = '画像1は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
     }
     if (!empty($upfile_obj2) && $upfile_obj2['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj2))) {
             $err_msg[] = '画像2は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
     }
     if (!empty($upfile_obj3) && $upfile_obj3['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj3))) {
             $err_msg[] = '画像3は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
     }
     // 画像アップロード可能サイズチェック
     if ($filesize) {
         $result = util_image_check_add_image_upload($filesize, $u, 'commu');
         if ($result) {
             if ($result == 2) {
                 $result = 3;
             }
             $err_msg[] = util_image_get_upload_err_msg($result);
         }
     }
     if (OPENPNE_USE_FILEUPLOAD) {
         if (!empty($upfile_obj4) && $upfile_obj4['error'] !== UPLOAD_ERR_NO_FILE) {
             // ファイルサイズ制限
             if ($upfile_obj4['size'] === 0 || $upfile_obj4['size'] > FILE_MAX_FILESIZE * 1024) {
                 $err_msg[] = 'ファイルは' . FILE_MAX_FILESIZE . 'KB以内のファイルにしてください(ただし空のファイルはアップロードできません)';
             }
             // 拡張子制限
             if (!util_check_file_extention($upfile_obj4['name'])) {
                 $err_msg[] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string'));
             }
         }
     }
     if ($err_msg) {
         $_REQUEST = $event;
         $_REQUEST['target_c_commu_id'] = $event['c_commu_id'];
         $_REQUEST['err_msg'] = $err_msg;
         openpne_forward('pc', 'page', "c_event_add");
         exit;
     }
     //画像をvar/tmpフォルダにコピー
     $sessid = session_id();
     t_image_clear_tmp($sessid);
     $tmpfile1 = t_image_save2tmp($upfile_obj1, $sessid, "t_1");
     $tmpfile2 = t_image_save2tmp($upfile_obj2, $sessid, "t_2");
     $tmpfile3 = t_image_save2tmp($upfile_obj3, $sessid, "t_3");
     if (OPENPNE_USE_FILEUPLOAD) {
         // 一次ファイルをvar/tmpにコピー
         $tmpfile4 = t_file_save2tmp($upfile_obj4, $sessid, "t_4");
     }
     $this->set('inc_navi', fetch_inc_navi("c", $target_c_commu_id));
     $pref_list = p_regist_prof_c_profile_pref_list4null();
     $event = p_c_event_add_confirm_event4request();
     $event['open_pref_value'] = $pref_list[$event['open_pref_id']];
     $event['image_filename1_tmpfile'] = $tmpfile1;
     $event['image_filename2_tmpfile'] = $tmpfile2;
     $event['image_filename3_tmpfile'] = $tmpfile3;
     $event['filename4_tmpfile'] = $tmpfile4;
     $event['image_filename1'] = $upfile_obj1['name'];
     $event['image_filename2'] = $upfile_obj2['name'];
     $event['image_filename3'] = $upfile_obj3['name'];
     $event['filename4_original_filename'] = $upfile_obj4['name'];
     $this->set('event', $event);
     return 'success';
 }