function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; // ---------- //--- 権限チェック $c_commu_topic = db_commu_c_commu_topic4c_commu_topic_id($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_member']) { handle_kengen_error(); } if (!$c_commu_topic['event_flag']) { handle_kengen_error(); } if (db_commu_is_writable_c_commu_topic_comment4c_commu_topic_id($c_commu_topic_id)) { handle_kengen_error(); } $is_c_event_member = db_commu_is_c_event_member($c_commu_topic_id, $u); if (!$is_c_event_member) { ktai_display_error('イベントに参加していません'); } if (!db_commu_is_event_join_date($c_commu_topic_id)) { ktai_display_error('イベントの募集期限が過ぎています'); } db_commu_delete_c_event_member($c_commu_topic_id, $u); $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']; // ---------- //-- 権限チェック $err_msg = array(); $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } if (!$c_topic['event_flag']) { handle_kengen_error(); } if (db_commu_is_writable_c_commu_topic_comment4c_commu_topic_id($c_commu_topic_id)) { handle_kengen_error(); } $is_c_event_member = db_commu_is_c_event_member($c_commu_topic_id, $u); if (!$is_c_event_member) { $err_msg[] = 'イベントに参加していません。'; $_REQUEST['err_msg'] = $err_msg; openpne_forward('pc', 'page', 'c_event_detail'); exit; } if (!db_commu_is_event_join_date($c_commu_topic_id)) { $err_msg[] = 'イベントの募集期限が過ぎています'; $_REQUEST['err_msg'] = $err_msg; openpne_forward('pc', 'page', "c_event_detail"); exit; } db_commu_delete_c_event_member($c_commu_topic_id, $u); $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('pc', 'page_c_event_detail', $p); }
function do_c_event_add_delete_c_event_member($c_commu_topic_id, $c_member_id) { return db_commu_delete_c_event_member($c_commu_topic_id, $c_member_id); }
function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_commu_topic_id = $requests['target_c_commu_topic_id']; $body = $requests['body']; // ---------- //--- 権限チェック //コミュニティ参加者 $c_commu_topic = db_commu_c_commu_topic4c_commu_topic_id($target_c_commu_topic_id); if ($c_commu_topic['event_flag']) { $c_event_member_count = db_commu_count_c_event_member_list4c_commu_topic_id($target_c_commu_topic_id); } $c_commu_id = $c_commu_topic['c_commu_id']; $c_commu = db_commu_c_commu4c_commu_id($c_commu_topic['c_commu_id']); switch ($c_commu['is_comment']) { case 'public': //誰でもコメント可能 break; case 'member': $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; } //--- if (is_null($body) || $body === '') { //bodyが無い時のエラー処理 $p = array('target_c_commu_topic_id' => $target_c_commu_topic_id, 'msg' => 1); openpne_redirect('ktai', 'page_c_bbs', $p); } if ($requests['join_event'] || $requests['cancel_event']) { if (!db_commu_is_event_join_date($target_c_commu_topic_id)) { handle_kengen_error(); } } $insert_id = db_commu_insert_c_commu_topic_comment_2($u, $target_c_commu_topic_id, $body); //イベントのメンバーに追加 if ($requests['join_event']) { if ($c_commu_topic['capacity'] && $c_commu_topic['capacity'] <= $c_event_member_count) { $p = array('target_c_commu_topic_id' => $target_c_commu_topic_id, 'msg' => 45); openpne_redirect('ktai', 'page_c_bbs', $p); } else { db_commu_insert_c_event_member($target_c_commu_topic_id, $u); } } elseif ($requests['cancel_event']) { db_commu_delete_c_event_member($target_c_commu_topic_id, $u); } //お知らせメール送信(携帯へ) 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(11); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $target_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']; $body = $requests['body']; $tmpfile1 = $requests['image_filename1_tmpfile']; $tmpfile2 = $requests['image_filename2_tmpfile']; $tmpfile3 = $requests['image_filename3_tmpfile']; $add_event_member = $requests['add_event_member']; // ---------- //---添付ファイル 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; } } } //-- 権限チェック //コミュニティ参加者 $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); switch ($c_commu['is_comment']) { case 'public': //誰でもコメント可能 break; case 'member': $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; } if (!db_commu_is_writable_c_commu_topic_comment4c_commu_topic_id($c_commu_topic_id)) { $err_msg[] = 'コメントが1000番に達したので、このイベントにはコメントできません'; $_REQUEST['err_msg'] = $err_msg; openpne_forward('pc', 'page', "c_event_detail"); exit; } //--- //---画像アップロードサイズチェック $filesize = 0; if ($tmpfile1) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$tc_id}_1", $tmpfile1); } if ($tmpfile2) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$tc_id}_2", $tmpfile2); } if ($tmpfile3) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$tc_id}_3", $tmpfile3); } if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'commu'); if ($result) { if ($result == 2) { $result = 3; } $_REQUEST['err_msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', "c_event_detail"); exit; } } if ($add_event_member == 1 && $c_topic['capacity'] && $c_topic['capacity'] <= $c_topic['member_num']) { $err_msg[] = 'イベントの参加者数制限を超えています'; $_REQUEST['err_msg'] = $err_msg; openpne_forward('pc', 'page', "c_event_detail"); exit; } if ($add_event_member) { if (!db_commu_is_event_join_date($c_commu_topic_id)) { handle_kengen_error(); } } //イベントのメンバーに追加 if ($add_event_member == 1) { db_commu_insert_c_event_member($c_commu_topic_id, $u); } elseif ($add_event_member == -1) { db_commu_delete_c_event_member($c_commu_topic_id, $u); } $number = db_commu_c_commu_topic_comment_number4c_commu_topic_id($c_commu_topic_id); $insert_c_commu_topic_comment = array("c_commu_id" => $c_commu_id, "c_member_id" => $u, "body" => $body, "number" => $number, "c_commu_topic_id" => $c_commu_topic_id); $tc_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment); if ($tmpfile1) { $filename1 = image_insert_c_image4tmp("tc_{$tc_id}_1", $tmpfile1, $u); } if ($tmpfile2) { $filename2 = image_insert_c_image4tmp("tc_{$tc_id}_2", $tmpfile2, $u); } if ($tmpfile3) { $filename3 = image_insert_c_image4tmp("tc_{$tc_id}_3", $tmpfile3, $u); } db_commu_update_c_commu_topic_comment_images($tc_id, $filename1, $filename2, $filename3); if (OPENPNE_USE_FILEUPLOAD) { // 添付ファイルをDBに入れる if ($filename4_tmpfile) { $filename4 = file_insert_c_file4tmp("tc_{$tc_id}_4", $filename4_tmpfile, $filename4_original_filename); db_commu_update_c_commu_topic_comment_file($tc_id, $filename4); } } //テンポラリファイルを削除(画像と同時) t_image_clear_tmp(session_id()); t_file_clear_tmp(session_id()); //お知らせメール送信(携帯へ) send_bbs_info_mail($tc_id, $u); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($tc_id, $u); if (OPENPNE_USE_POINT_RANK) { //トピック・イベントにコメントした人にポイント付与 $point = db_action_get_point4c_action_id(11); 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 db_commu_delete_c_commu_member($c_commu_id, $c_member_id) { //function cache削除 cache_drop_c_commu($c_commu_id); cache_drop_c_commu_list4c_member_id($c_member_id); //おすすめレビューを削除 $sql = 'DELETE FROM c_commu_review' . ' WHERE c_commu_id = ? AND c_member_id = ?'; $params = array(intval($c_commu_id), intval($c_member_id)); db_query($sql, $params); //副管理者なら副管理者のポストを空に $sql = 'UPDATE c_commu' . ' SET c_member_id_sub_admin = 0' . ' WHERE c_commu_id = ? AND c_member_id_sub_admin = ?'; db_query($sql, $params); //管理者承認依頼 $sql = 'DELETE FROM c_commu_admin_confirm' . ' WHERE c_commu_id = ? AND c_member_id_to = ?'; db_query($sql, $params); //副管理者承認依頼 $sql = 'DELETE FROM c_commu_sub_admin_confirm' . ' WHERE c_commu_id = ? AND c_member_id_to = ?'; db_query($sql, $params); //参加イベント情報削除 $sql = 'SELECT ct.c_commu_topic_id' . ' FROM c_commu_topic ct' . ' LEFT JOIN c_event_member cem ON ct.c_commu_topic_id = cem.c_commu_topic_id' . ' WHERE ct.c_commu_id = ?' . ' AND cem.c_member_id = ?'; $c_commu_topic_id_list = db_get_col($sql, $params, 'main'); foreach ($c_commu_topic_id_list as $c_commu_topic_id) { db_commu_delete_c_event_member($c_commu_topic_id, $c_member_id); } //コミュニティから退会 $sql = 'DELETE FROM c_commu_member' . ' WHERE c_commu_id = ? AND c_member_id = ?'; db_query($sql, $params); }