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(); $target_c_commu_topic_comment_id = $requests['target_c_commu_topic_comment_id']; //--- 権限チェック //コミュニティ管理者 or コミュニティ参加者 $c_commu_topic_comment = db_commu_c_commu_topic_comment4c_commu_topic_comment_id_2($target_c_commu_topic_comment_id); $c_commu_topic = db_commu_c_commu_topic4c_commu_topic_id($c_commu_topic_comment['c_commu_topic_id']); $c_commu_id = $c_commu_topic['c_commu_id']; $status = db_common_commu_status($u, $c_commu_id); if ($c_commu_topic_comment['number'] == "0") { handle_kengen_error(); } if (!$status['is_commu_admin'] && $c_commu_topic_comment['c_member_id'] != $u) { handle_kengen_error(); } //--- db_commu_delete_c_commu_topic_comment($target_c_commu_topic_comment_id); if ($c_commu_topic['event_flag']) { $action = 'page_c_event_detail'; } else { $action = 'page_c_topic_detail'; } $p = array('target_c_commu_topic_id' => $c_commu_topic_comment['c_commu_topic_id']); openpne_redirect('pc', $action, $p); }
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_capacity($c_commu_topic_id)) { ktai_display_error('イベントの参加者数制限を超えています'); } if (!db_commu_is_event_join_date($c_commu_topic_id)) { ktai_display_error('イベントの募集期限が過ぎています'); } db_commu_insert_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['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; $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(); } //--- db_commu_delete_c_commu_topic($target_c_commu_topic_id); $p = array('target_c_commu_id' => $c_commu_topic['c_commu_id']); openpne_redirect('ktai', 'page_c_home', $p); }
function create_message_event_invite($u, $body, $c_commu_topic_id) { $msg_subject = 'イベント紹介メッセージ'; $c_member = db_member_c_member4c_member_id_LIGHT($u); $c_commu_topic = db_commu_c_commu_topic4c_commu_topic_id($c_commu_topic_id); $p = array('target_c_commu_topic_id' => $c_commu_topic_id); $url = openpne_gen_url('pc', 'page_c_event_detail', $p); // メッセージ中に書いてあるURLがSNS内でありセッションパラメータを含んでいた場合は削除 $body = db_ktai_delete_url_session_parameter($body); $msg_body = <<<EOD {$c_member['nickname']}さんからイベント紹介メッセージが届いています。 イベント名: {$c_commu_topic['name']} メッセージ: {$body} このイベントのURL {$url} EOD; return array($msg_subject, $msg_body); }
function _do_c_bbs_c_commu_topic4c_commu_topic_id($c_commu_topic_id) { return db_commu_c_commu_topic4c_commu_topic_id($c_commu_topic_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 kanshi_db_commu_delete_c_commu_topic($c_commu_topic_id) { if (db_commu_c_commu_topic4c_commu_topic_id($c_commu_topic_id)) { //function cacheの削除 cache_drop_c_commu_topic($c_commu_topic_id); // c_commu_topic_comment(画像) $sql = 'SELECT image_filename1, image_filename2, image_filename3, filename' . ' FROM c_commu_topic_comment WHERE c_commu_topic_id = ?'; $params = array(intval($c_commu_topic_id)); $topic_comment_list = db_get_all($sql, $params); foreach ($topic_comment_list as $topic_comment) { image_data_delete($topic_comment['image_filename1']); image_data_delete($topic_comment['image_filename2']); image_data_delete($topic_comment['image_filename3']); db_file_delete_c_file($topic_comment['filename']); } $sql = 'DELETE FROM c_commu_topic_comment WHERE c_commu_topic_id = ?'; db_query($sql, $params); $sql = 'DELETE FROM c_event_member WHERE c_commu_topic_id = ?'; db_query($sql, $params); $sql = 'DELETE FROM c_commu_topic WHERE c_commu_topic_id = ?'; if (db_query($sql, $params)) { return array(1, 0, ''); } else { return array(0, 2, 'DB更新エラー'); } } else { // return array(0, 99, '既に削除されているか存在しません'); // 監視ツールがリトライを行ってしまう為、成功フラグを返してしまう return array(1, 0, ''); } }
/** * トピックコメント書き込み */ function db_commu_insert_c_commu_topic_comment_2($c_member_id, $target_c_commu_topic_id, $body) { $c_commu_topic = db_commu_c_commu_topic4c_commu_topic_id($target_c_commu_topic_id); $target_c_commu_topic_id = $c_commu_topic['c_commu_topic_id']; $target_c_commu_id = $c_commu_topic['c_commu_id']; return db_commu_insert_c_commu_topic_comment($target_c_commu_id, $target_c_commu_topic_id, $c_member_id, $body); }