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['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_capacity($c_commu_topic_id)) { $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_insert_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 execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $body = $requests['body']; $button = $requests['button']; // ---------- $upfile_obj1 = $_FILES['image_filename1']; $upfile_obj2 = $_FILES['image_filename2']; $upfile_obj3 = $_FILES['image_filename3']; //添付ファイル $upfile_obj4 = $_FILES['uploadfile']; $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_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; } //--- if ($button == "イベントに参加する") { $event_write['add_event_member'] = 1; } elseif ($button == "参加をキャンセルする") { $event_write['add_event_member'] = -1; } //エラーチェック $err_msg = array(); $filesize = 0; if (trim($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 (!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 ($event_write['add_event_member'] === 1 && $c_topic['capacity'] && $c_topic['capacity'] <= $c_topic['member_num']) { $err_msg[] = 'イベントの参加者数制限を超えています'; } if ($event_write['add_event_member']) { if (!db_commu_is_event_join_date($c_commu_topic_id)) { $err_msg[] = '現在このイベントへの参加・キャンセルの変更はできません'; } } if ($err_msg) { $_REQUEST['err_msg'] = $err_msg; $_REQUEST['body'] = $body; openpne_forward('pc', 'page', "c_event_detail"); exit; } $sessid = session_id(); t_image_clear_tmp($sessid); t_file_clear_tmp($sessid); $tmpfile1 = t_image_save2tmp($upfile_obj1, $sessid, "tc_1"); $tmpfile2 = t_image_save2tmp($upfile_obj2, $sessid, "tc_2"); $tmpfile3 = t_image_save2tmp($upfile_obj3, $sessid, "tc_3"); if (OPENPNE_USE_FILEUPLOAD) { // 一時ファイルをvar/tmpにコピー $tmpfile4 = t_file_save2tmp($upfile_obj4, $sessid, "tc_4"); } $this->set('inc_navi', fetch_inc_navi("c", $c_commu_id)); $event_write['target_c_commu_id'] = $c_commu_id; $event_write['target_c_commu_topic_id'] = $c_commu_topic_id; $event_write['body'] = $body; $event_write['image_filename1_tmpfile'] = $tmpfile1; $event_write['image_filename2_tmpfile'] = $tmpfile2; $event_write['image_filename3_tmpfile'] = $tmpfile3; $event_write['image_filename1'] = $upfile_obj1["name"]; $event_write['image_filename2'] = $upfile_obj2["name"]; $event_write['image_filename3'] = $upfile_obj3["name"]; $event_write['filename4_tmpfile'] = $tmpfile4; $event_write['filename4_original_filename'] = $upfile_obj4["name"]; $this->set('event_write', $event_write); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $page = $requests['page']; $err_msg = $requests['err_msg']; $body = $requests['body']; // ---------- $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(); } //--- $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); if (!$c_commu) { openpne_redirect('pc', 'page_h_err_c_home'); } if (!$c_topic['event_flag']) { $p = array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id']); openpne_redirect('pc', 'page_c_topic_detail', $p); } $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); //詳細部分 $this->set('c_commu', $c_commu); $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id); $c_topic['original_filename'] = db_file_original_filename4filename($c_topic['filename']); $this->set('c_topic', $c_topic); //書き込み一覧部分 if ($requests['page_size'] == 100) { $page_size = 100; } else { $page_size = 20; } if ($requests['order'] === 'asc') { $desc = false; } else { $desc = true; } list($c_topic_write, $pager) = db_commu_c_topic_write4c_commu_topic_id($c_commu_topic_id, $page, $page_size, $desc); foreach ($c_topic_write as $key => $value) { if ($value['filename']) { $c_topic_write[$key]['original_filename'] = db_file_original_filename4filename($value['filename']); } } $this->set('c_topic_write', $c_topic_write); $this->set('pager', $pager); $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_event_member', db_commu_is_c_event_member($c_commu_topic_id, $u)); $this->set('is_c_event_admin', db_commu_is_c_event_admin($c_commu_topic_id, $u)); $this->set('is_event_join_date', db_commu_is_event_join_date($c_commu_topic_id)); $this->set('is_event_join_capacity', db_commu_is_event_join_capacity($c_commu_topic_id)); $this->set('is_writable_comment', db_commu_is_writable_c_commu_topic_comment4c_commu_topic_id($c_commu_topic_id)); $this->set('err_msg', $err_msg); $this->set('body', $body); $this->set('c_member_id', $u); // 許可されている拡張子のリスト $this->set('allowed_extensions', util_get_file_allowed_extensions('string')); return 'success'; }
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']; // ---------- // 添付ファイル 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_topic_id'] = $c_commu_topic_id; $_REQUEST['err_msg'] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string')); openpne_forward('pc', 'page', "c_topic_detail"); exit; } } } //--- 権限チェック //コミュニティ参加者 $c_topic = db_commu_c_topic4c_commu_topic_id($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_topic_detail"); exit; } //--- //---画像アップロードサイズチェック $filesize = 0; if ($tmpfile1) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_id}_1", $tmpfile1); } if ($tmpfile2) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_id}_2", $tmpfile2); } if ($tmpfile3) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_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_topic_detail"); exit; } } $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); $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment); if ($tmpfile1) { $filename1 = image_insert_c_image4tmp("tc_{$insert_id}_1", $tmpfile1, $u); } if ($tmpfile2) { $filename2 = image_insert_c_image4tmp("tc_{$insert_id}_2", $tmpfile2, $u); } if ($tmpfile3) { $filename3 = image_insert_c_image4tmp("tc_{$insert_id}_3", $tmpfile3, $u); } if (OPENPNE_USE_FILEUPLOAD) { // 添付ファイルをDBに入れる if ($filename4_tmpfile) { $filename4 = file_insert_c_file4tmp("tc_{$insert_id}_4", $filename4_tmpfile, $filename4_original_filename); } } t_image_clear_tmp(session_id()); t_file_clear_tmp(session_id()); db_commu_update_c_commu_topic_comment_images($insert_id, $filename1, $filename2, $filename3); db_commu_update_c_commu_topic_comment_file($insert_id, $filename4); //お知らせメール送信(携帯へ) 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' => $c_commu_topic_id); openpne_redirect('pc', 'page_c_topic_detail', $p); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $target_response_comment_id = $requests['target_response_comment_id']; $page = $requests['page']; // ---------- $page_size = 5; // トピックのコメントリスト if ($requests['order'] === 'asc') { $desc = false; } else { $desc = true; } list($list, $pager) = db_commu_c_topic_write4c_commu_topic_id($c_commu_topic_id, $page, $page_size, $desc); foreach ($list as $key => $value) { if ($value['filename']) { $list[$key]['original_filename'] = db_file_original_filename4filename($value['filename']); } } $this->set('c_commu_topic_comment_list', $list); $this->set('pager', $pager); //トピック名 $this->set('c_commu_topic_name', db_commu_c_commu_topic_name4c_commu_topic_id($c_commu_topic_id)); //トピックID $this->set('c_commu_topic_id', $c_commu_topic_id); //トピック $c_commu_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id); $c_commu_topic['original_filename'] = db_file_original_filename4filename($c_commu_topic['filename']); $this->set('c_commu_topic', $c_commu_topic); //コミュニティ $c_commu = db_commu_c_commu4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_commu['c_commu_id']; $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); $this->set('c_commu', $c_commu); //--- 権限チェック //コミュニティの存在の有無 if (!$c_commu) { handle_kengen_error(); } //コミュニティ掲示板閲覧権限 if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { handle_kengen_error(); } if ($target_response_comment_id) { $target_comment = db_commu_c_commu_topic_comment4c_commu_topic_comment_id($target_response_comment_id); $response_set = db_member_c_member4c_member_id_LIGHT($target_comment['c_member_id']); $this->set('response_comment_format', '>>' . $target_comment['number'] . ' ' . $response_set['nickname'] . "さん\n"); } //掲示板の閲覧権限 tplでやっている $this->set('is_c_commu_view', db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu['c_commu_id'], $u)); $this->set('is_c_commu_member', db_commu_is_c_commu_member($c_commu['c_commu_id'], $u)); $this->set('is_c_event_member', db_commu_is_c_event_member($c_commu_topic_id, $u)); $this->set('is_c_event_admin', db_commu_is_c_event_admin($c_commu_topic_id, $u)); $this->set('is_event_join_date', db_commu_is_event_join_date($c_commu_topic_id)); $this->set('is_event_join_capacity', db_commu_is_event_join_capacity($c_commu_topic_id)); $this->set('is_writable_comment', db_commu_is_writable_c_commu_topic_comment4c_commu_topic_id($c_commu_topic_id)); //メンバーがコミュニティ管理者かどうか $this->set('is_admin', db_commu_is_admin4c_member_id_c_commu_topic_id($u, $c_commu_topic_id)); //コミュニティ管理者 $this->set('c_member_admin', db_commu_c_member_admin4c_commu_topic_id($c_commu_topic_id)); if (MAIL_ADDRESS_HASHED) { $mail_address = "t{$c_commu_topic_id}-" . t_get_user_hash($u) . '@' . MAIL_SERVER_DOMAIN; } else { $mail_address = "t{$c_commu_topic_id}" . '@' . MAIL_SERVER_DOMAIN; } $mail_address = MAIL_ADDRESS_PREFIX . $mail_address; $this->set('mail_address', $mail_address); return 'success'; }