function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $title = $requests['title']; $body = $requests['body']; $event_flag = $requests['event_flag']; $err_msg = $requests['err_msg']; // ---------- //--- 権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': //コミュニティメンバー if (!db_commu_is_c_commu_member($c_commu_id, $u)) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { handle_kengen_error(); } break; } // --- $this->set('c_commu', db_commu_c_commu4c_commu_id($c_commu_id)); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; //--- 権限チェック if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } if (!db_commu_is_c_topic_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(); } //--- $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); $this->set('c_commu_id', $c_commu_id); $this->set('c_commu_topic_id', $c_commu_topic_id); return 'success'; }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; //--- 権限チェック if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } if (!db_commu_is_c_topic_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) { handle_kengen_error(); } //--- if (MAIL_ADDRESS_HASHED) { $mail_address = 'ti' . $c_commu_topic_id . '-' . t_get_user_hash($u) . "@" . MAIL_SERVER_DOMAIN; } else { $mail_address = 'ti' . $c_commu_topic_id . "@" . MAIL_SERVER_DOMAIN; } $mail_address = MAIL_ADDRESS_PREFIX . $mail_address; $this->set('mail_address', $mail_address); $this->set('c_topic', $c_topic); $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id)); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id); //--- 権限チェック //イベントの管理者 or コミュニティ管理者 if (!db_commu_is_c_event_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_topic['c_commu_id'], $u)) { handle_kengen_error(); } $c_commu = db_commu_c_commu4c_commu_id2($c_topic['c_commu_id']); if ($c_commu['is_topic'] == 'admin_only' && !db_commu_is_c_commu_admin($c_topic['c_commu_id'], $u)) { handle_kengen_error(); } if ($c_commu['is_topic'] == 'member' && !db_commu_is_c_commu_member($c_topic['c_commu_id'], $u)) { handle_kengen_error(); } //--- db_file_delete_c_file($c_topic['filename']); db_commu_delete_c_commu_topic_comment_file($c_commu_topic_id); $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('pc', 'page_c_event_edit', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $target_c_commu_topic_id = $requests['target_c_commu_topic_id']; //--- 権限チェック //コミュニティ管理者 or トピック作成者 $c_commu_topic = db_commu_c_commu_topic4c_commu_topic_id($target_c_commu_topic_id); $c_commu_id = $c_commu_topic['c_commu_id']; $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_admin'] && $c_commu_topic['c_member_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(); } //--- db_commu_delete_c_commu_topic($target_c_commu_topic_id); $p = array('target_c_commu_id' => $c_commu_topic['c_commu_id']); if ($c_commu_topic['event_flag']) { openpne_redirect('pc', 'page_c_event_list', $p); } else { openpne_redirect('pc', 'page_c_topic_list', $p); } }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $c_commu_id = $requests['target_c_commu_id']; $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); //コミュニティの存在の有無 if (!$c_commu) { openpne_redirect('pc', 'page_h_err_c_home'); } $inc_navi = fetch_inc_navi('c', $c_commu_id); $this->set('inc_navi', $inc_navi); $this->set('c_commu', $c_commu); // 副管理者情報 if ($c_commu['c_member_id_sub_admin']) { $c_member_sub_admin = db_member_c_member4c_member_id($c_commu['c_member_id_sub_admin']); $this->set('sub_admin', $c_member_sub_admin); } $this->set('is_c_commu_admin', db_commu_is_c_commu_admin($c_commu_id, $u)); $this->set('is_c_commu_member', db_commu_is_c_commu_member($c_commu_id, $u)); $this->set('is_c_commu_view', db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)); $this->set('is_receive_mail', db_commu_is_receive_mail_ktai($c_commu_id, $u)); $this->set('is_receive_mail_pc', db_commu_is_receive_mail_pc($c_commu_id, $u)); $this->set('is_receive_message', db_commu_is_receive_message($c_commu_id, $u)); //コミュニティメンバー $c_commu_member_list = db_commu_c_commu_member_list4c_commu_id($c_commu_id, 9); $this->set('c_commu_member_list', $c_commu_member_list); $c_member_secure = db_member_c_member_secure4c_member_id($u); if (empty($c_member_secure['ktai_address'])) { $is_registered_ktai_address = false; } else { $is_registered_ktai_address = true; } //非公開コミュニティに管理者から招待されたかどうか $this->set('admin_invite', db_commu_c_commu4c_admin_invite_id($c_commu_id, $u)); //参加コミュニティの新着トピック書き込み $new_topic_comment = db_commu_new_topic_comment4c_commu_id($c_commu_id, 7); $this->set('new_topic_comment', $new_topic_comment); //参加コミュニティの新着イベント書き込み $new_topic_comment_event = db_commu_new_topic_comment4c_commu_id($c_commu_id, 7, 1); $this->set('new_topic_comment_event', $new_topic_comment_event); //参加コミュニティの新着おすすめレビュー $this->set('new_commu_review', db_review_new_commu_review4c_commu_id($c_commu_id, 7)); // 携帯メールアドレス登録状況 $this->set('is_registered_ktai_address', $is_registered_ktai_address); $this->set('is_unused_pc_bbs', util_is_unused_mail('m_pc_bbs_info')); $this->set('is_unused_ktai_bbs', util_is_unused_mail('m_ktai_bbs_info')); // inc_entry_point $this->set('inc_entry_point', fetch_inc_entry_point($this->getView(), 'c_home')); return 'success'; }
function execute($requests) { $v = array(); // コミュ情報 $c_commu = db_commu_c_commu4c_commu_id2($requests['target_c_commu_id']); $c_member_list = db_admin_commu_c_members_all_get4c_commu_id($requests['target_c_commu_id']); if (empty($c_member_list)) { openpne_redirect('admin', 'page_list_c_commu'); } $v['c_commu'] = $c_commu; $v['c_member_list'] = $c_member_list; $v['target_c_commu_id'] = $requests['target_c_commu_id']; $this->set($v); return 'success'; }
function execute($requests) { $v = array(); $target_c_commu_id = $requests['target_c_commu_id']; $v = array(); $commu = db_commu_c_commu4c_commu_id2($target_c_commu_id); if (!$commu) { admin_client_redirect('list_c_commu', '指定された' . WORD_COMMUNITY . 'は存在しません'); } $commu['c_member'] = db_member_c_member4c_member_id($commu['c_member_id_admin']); $this->set('commu', $commu); $v['SNS_NAME'] = SNS_NAME; $v['OPENPNE_VERSION'] = OPENPNE_VERSION; $this->set($v); return 'success'; }
function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $title = $requests['title']; $body = $requests['body']; // ---------- //--- 権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': //コミュニティ参加者 $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { ktai_display_error("トピックは管理者だけが作成できます"); } break; } //--- $insert_c_commu_topic = array("name" => $title, "c_commu_id" => $c_commu_id, "c_member_id" => $u, "event_flag" => 0); $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic); $insert_c_commu_topic_comment = array("c_commu_id" => $c_commu_id, "c_member_id" => $u, "body" => $body, "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); if (OPENPNE_USE_POINT_RANK) { //トピックを作成した人にポイント付与 $point = db_action_get_point4c_action_id(9); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('ktai', 'page_c_bbs', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $title = $requests['title']; $body = $requests['body']; $err_msg = $requests['err_msg']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; //--- 権限チェック if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } if (!db_commu_is_c_topic_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(); } //--- if ($c_topic['event_flag']) { $p = array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id']); openpne_redirect('pc', 'page_c_event_edit', $p); } $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); if ($err_msg) { $c_topic['name'] = $title; $c_topic['body'] = $body; } if (!empty($c_topic['filename'])) { $original_filename = db_file_original_filename4filename($c_topic['filename']); $c_topic['original_filename'] = $original_filename; } $this->set('err_msg', $err_msg); $this->set('c_topic', $c_topic); // 許可されている拡張子のリスト $this->set('allowed_extensions', util_get_file_allowed_extensions('string')); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $title = $requests['title']; $body = $requests['body']; $event_flag = $requests['event_flag']; $err_msg = $requests['err_msg']; // ---------- if ($event_flag == 1) { $p = array('target_c_commu_id' => $c_commu_id); openpne_redirect('pc', 'page_c_event_add', $p); } //--- 権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); // トピック作成権限 switch ($c_commu['is_topic']) { case 'public': // 誰でも作成可能 break; case 'member': //コミュニティメンバー if (!db_commu_is_c_commu_member($c_commu_id, $u)) { handle_kengen_error(); } break; case 'admin_only': //管理者のみ if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { handle_kengen_error(); } } // --- $this->set('inc_navi', fetch_inc_navi("c", $c_commu_id)); $this->set("c_commu", $c_commu); $this->set('err_msg', $err_msg); $this->set('title', $title); $this->set('body', $body); // 許可されている拡張子のリスト $this->set('allowed_extensions', util_get_file_allowed_extensions('string')); return 'success'; }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $title = $requests['title']; $body = $requests['body']; $err_msg = $requests['err_msg']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; //--- 権限チェック if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } if (!db_commu_is_c_topic_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(); } //--- if ($c_topic['event_flag']) { $p = array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id']); openpne_redirect('ktai', 'page_c_event_edit', $p); } if ($err_msg) { $c_topic['name'] = $title; $c_topic['body'] = $body; } $this->set('err_msg', $err_msg); $this->set('c_topic', $c_topic); $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id)); return 'success'; }
function execute($requests) { $target_c_commu_id = $requests['target_c_commu_id']; $page = $requests['page']; $page_size = 100; // コミュ情報 $c_commu = db_commu_c_commu4c_commu_id2($target_c_commu_id); // コミュニティメンバ取得 list($c_member_list, $is_prev, $is_next, $total_num, $start_num, $end_num) = db_admin_commu_c_members4c_commu_id($target_c_commu_id, $page_size, $page); if (empty($c_member_list)) { // 存在しないコミュはコミュリストにリダイレクト openpne_redirect('admin', 'page_list_c_commu'); } $this->set('c_commu', $c_commu); $this->set('c_member_list', $c_member_list); $this->set('target_c_commu_id', $target_c_commu_id); $this->set('page', $page); $this->set('page_size', $page_size); $pager = util_make_pager($page, $page_size, $total_num); $this->set('pager', $pager); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $target_c_commu_id = $requests['target_c_commu_id']; $body = $requests['body']; // ---------- //--- 権限チェック //コミュニティ管理者 if (!db_commu_is_c_commu_admin($target_c_commu_id, $u)) { handle_kengen_error(); } //--- $this->set('inc_navi', fetch_inc_navi('c', $target_c_commu_id)); //メンバー情報 $this->set("member", db_member_c_member4c_member_id($u)); //コミュニティID $this->set("c_commu_id", $target_c_commu_id); //コミュニティ $this->set("c_commu", db_commu_c_commu4c_commu_id2($target_c_commu_id)); return 'success'; }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $img_num = $requests['img_num']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; //--- 権限チェック if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } if (!db_commu_is_c_topic_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) { handle_kengen_error(); } //--- $target_image_filename = ''; switch ($img_num) { case '1': $target_image_filename = $c_topic['image_filename1']; break; case '2': $target_image_filename = $c_topic['image_filename2']; break; case '3': $target_image_filename = $c_topic['image_filename3']; break; } if (empty($target_image_filename)) { handle_kengen_error(); } $this->set('c_topic', $c_topic); $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id)); $this->set('img_num', $img_num); $this->set('target_image_filename', $target_image_filename); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $err_msg = $requests['err_msg']; // ---------- //--- 権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': //コミュニティメンバー if (!db_commu_is_c_commu_member($c_commu_id, $u)) { handle_kengen_error(); } break; case 'admin_only': //管理者のみ if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { handle_kengen_error(); } } //--- $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id)); $this->set("year", db_commu_year4null()); $this->set('month', p_regist_prof_c_profile_month_list4null()); $this->set('day', p_regist_prof_c_profile_day_list4null()); $this->set('pref', p_regist_prof_c_profile_pref_list4null()); $this->set('event', p_c_event_add_confirm_event4request()); $this->set('err_msg', $err_msg); // 許可されている拡張子のリスト $this->set('allowed_extensions', util_get_file_allowed_extensions('string')); return 'success'; }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $err_msg = $requests['err_msg']; // ---------- //--- 権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': //コミュニティメンバー if (!db_commu_is_c_commu_member($c_commu_id, $u)) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { handle_kengen_error(); } break; } //--- $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id)); $this->set("year", db_commu_year4null()); $this->set('month', p_regist_prof_c_profile_month_list4null()); $this->set('day', p_regist_prof_c_profile_day_list4null()); $this->set('pref', p_regist_prof_c_profile_pref_list4null()); $this->set('event', p_c_event_add_confirm_event4request()); $this->set('err_msg', $err_msg); return 'success'; }
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'; }
function p_c_home_c_commu4c_commu_id($c_commu_id) { return db_commu_c_commu4c_commu_id2($c_commu_id); }
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); }
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); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $err_msg = $requests['err_msg']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; //--- 権限チェック if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } if (!db_commu_is_c_topic_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(); } //--- if (!$c_topic['event_flag']) { openpne_redirect('ktai', 'page_c_topic_edit', array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id'])); } $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id)); $this->set("year", db_commu_year4null()); $this->set('month', p_regist_prof_c_profile_month_list4null()); $this->set('day', p_regist_prof_c_profile_day_list4null()); $this->set('pref', p_regist_prof_c_profile_pref_list4null()); $this->set('err_msg', $err_msg); //編集確認画面でエラーがでたときここに戻ってくる。そのときのためにrequestから取得 //保留 if ($err_msg) { $c_topic_temp = p_c_event_add_confirm_event4request(); $c_topic['name'] = $c_topic_temp['title']; $c_topic['body'] = $c_topic_temp['detail']; $c_topic['open_date_comment'] = $c_topic_temp['open_date_comment']; $c_topic['open_pref_id'] = $c_topic_temp['open_pref_id']; $c_topic['open_pref_comment'] = $c_topic_temp['open_pref_comment']; $c_topic['open_date_year'] = $c_topic_temp['open_date_year']; $c_topic['open_date_month'] = $c_topic_temp['open_date_month']; $c_topic['open_date_day'] = $c_topic_temp['open_date_day']; $c_topic['invite_period_year'] = $c_topic_temp['invite_period_year']; $c_topic['invite_period_month'] = $c_topic_temp['invite_period_month']; $c_topic['invite_period_day'] = $c_topic_temp['invite_period_day']; } else { $open_date_arr = explode("-", $c_topic['open_date']); $invite_period_arr = explode("-", $c_topic['invite_period']); $c_topic['open_date_year'] = $open_date_arr[0]; $c_topic['open_date_month'] = $open_date_arr[1]; $c_topic['open_date_day'] = $open_date_arr[2]; $c_topic['invite_period_year'] = $invite_period_arr[0]; $c_topic['invite_period_month'] = $invite_period_arr[1]; $c_topic['invite_period_day'] = $invite_period_arr[2]; } $this->set('event', $c_topic); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $c_commu_id = $requests['c_commu_id']; $title = $requests['title']; $image_filename1_tmpfile = $requests['image_filename1_tmpfile']; $image_filename2_tmpfile = $requests['image_filename2_tmpfile']; $image_filename3_tmpfile = $requests['image_filename3_tmpfile']; $body = $requests['body']; //---添付ファイル 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'] = $c_commu_id; $_REQUEST['err_msg'] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string')); openpne_forward('pc', 'page', "c_topic_add"); exit; } } } //---権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': //コミュニティ参加者 $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { $_REQUEST['target_c_commu_id'] = $c_commu_id; $_REQUEST['msg'] = "トピックは管理者だけが作成できます"; openpne_forward('pc', 'page', "c_home"); exit; } break; } //---画像アップロードサイズチェック $filesize = 0; if ($image_filename1_tmpfile) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_1", $image_filename1_tmpfile); } if ($image_filename2_tmpfile) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_2", $image_filename2_tmpfile); } if ($image_filename3_tmpfile) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_3", $image_filename3_tmpfile); } if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'commu'); if ($result) { if ($result == 2) { $result = 3; } $_REQUEST['target_c_commu_id'] = $c_commu_id; $_REQUEST['msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', "c_topic_add"); exit; } } //--- $insert_c_commu_topic = array("name" => $title, "c_commu_id" => $c_commu_id, "c_member_id" => $u, "event_flag" => 0); $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic); if ($image_filename1_tmpfile) { $filename1 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_1", $image_filename1_tmpfile, $u); } if ($image_filename2_tmpfile) { $filename2 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_2", $image_filename2_tmpfile, $u); } if ($image_filename3_tmpfile) { $filename3 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_3", $image_filename3_tmpfile, $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" => $c_commu_id, "c_member_id" => $u, "body" => $body, "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); if (OPENPNE_USE_POINT_RANK) { //トピックを作成した人にポイント付与 $point = db_action_get_point4c_action_id(9); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('pc', 'page_c_topic_detail', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $body = $requests['body']; $title = $requests['title']; // ---------- $upfile_obj1 = $_FILES['image_filename1']; $upfile_obj2 = $_FILES['image_filename2']; $upfile_obj3 = $_FILES['image_filename3']; $upfile_obj4 = $_FILES['filename4']; //--- 権限チェック //トピック作成者 or コミュニティ管理者 $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; if (!db_commu_is_c_topic_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 = array(); $filesize = 0; $del_file = array(); if (is_null($title) || $title === '') { $err_msg[] = "タイトルを入力してください"; } if (is_null($body) || $body === '') { $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 ($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['err_msg'] = $err_msg; $_REQUEST['target_c_commu_topic_id'] = $c_commu_topic_id; $_REQUEST['title'] = $title; $_REQUEST['body'] = $body; openpne_forward('pc', 'page', "c_topic_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' => $title, 'event_flag' => 0); db_commu_update_c_commu_topic($c_commu_topic_id, $update_c_commu_topic); $update_c_commu_topic_comment = array('body' => $body); $c_topic = db_commu_c_topic4c_commu_topic_id($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_topic_detail', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $err_msg = $requests['err_msg']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; //--- 権限チェック if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } if (!db_commu_is_c_topic_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(); } //--- if (!$c_topic['event_flag']) { $p = array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id']); openpne_redirect('pc', 'page_c_topic_edit', $p); } if (!empty($c_topic['filename'])) { $c_topic['original_filename'] = db_file_original_filename4filename($c_topic['filename']); } $this->set('inc_navi', fetch_inc_navi("c", $c_commu_id)); $this->set("year", db_commu_year4null()); $this->set('month', p_regist_prof_c_profile_month_list4null()); $this->set('day', p_regist_prof_c_profile_day_list4null()); $this->set('pref', p_regist_prof_c_profile_pref_list4null()); $this->set('err_msg', $err_msg); //編集確認画面でエラーがでたときここに戻ってくる。そのときのためにrequestから取得 //保留 if ($err_msg) { $c_topic_temp = p_c_event_add_confirm_event4request(); $c_topic['name'] = $c_topic_temp['title']; $c_topic['body'] = $c_topic_temp['detail']; $c_topic['open_date_comment'] = $c_topic_temp['open_date_comment']; $c_topic['open_pref_id'] = $c_topic_temp['open_pref_id']; $c_topic['open_pref_comment'] = $c_topic_temp['open_pref_comment']; $c_topic['open_date_year'] = $c_topic_temp['open_date_year']; $c_topic['open_date_month'] = $c_topic_temp['open_date_month']; $c_topic['open_date_day'] = $c_topic_temp['open_date_day']; $c_topic['invite_period_year'] = $c_topic_temp['invite_period_year']; $c_topic['invite_period_month'] = $c_topic_temp['invite_period_month']; $c_topic['invite_period_day'] = $c_topic_temp['invite_period_day']; } else { $open_date_arr = explode("-", $c_topic['open_date']); $invite_period_arr = explode("-", $c_topic['invite_period']); $c_topic['open_date_year'] = $open_date_arr[0]; $c_topic['open_date_month'] = $open_date_arr[1]; $c_topic['open_date_day'] = $open_date_arr[2]; $c_topic['invite_period_year'] = $invite_period_arr[0]; $c_topic['invite_period_month'] = $invite_period_arr[1]; $c_topic['invite_period_day'] = $invite_period_arr[2]; } $this->set('event', $c_topic); // 許可されている拡張子のリスト $this->set('allowed_extensions', util_get_file_allowed_extensions('string')); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $title = $requests['title']; $body = $requests['body']; // ---------- //--- 権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { handle_kengen_error(); } break; } //画像ファイル $upfile_obj1 = $_FILES['image_filename1']; $upfile_obj2 = $_FILES['image_filename2']; $upfile_obj3 = $_FILES['image_filename3']; //添付ファイル $upfile_obj4 = $_FILES['uploadfile']; $err_msg = array(); $filesize = 0; 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['err_msg'] = $err_msg; openpne_forward('pc', 'page', "c_topic_add"); exit; } $sessid = session_id(); //----- t_image_clear_tmp($sessid); t_file_clear_tmp($sessid); //画像をvar/tmpフォルダにコピー $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", $c_commu_id)); $c_topic = array('c_commu_id' => $c_commu_id, 'title' => $title, 'body' => $body, 'image_filename1_tmpfile' => $tmpfile1, 'image_filename2_tmpfile' => $tmpfile2, 'image_filename3_tmpfile' => $tmpfile3, 'image_filename1' => $upfile_obj1["name"], 'image_filename2' => $upfile_obj2["name"], 'image_filename3' => $upfile_obj3["name"], 'filename4_tmpfile' => $tmpfile4, 'filename4_original_filename' => $upfile_obj4["name"]); $this->set('c_topic', $c_topic); return 'success'; }
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); }