Example #1
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     // --- リクエスト変数
     $c_commu_id = $requests['c_commu_id'];
     $c_commu_topic_id = $requests['c_commu_topic_id'];
     $c_member_ids = $requests['c_member_ids'];
     $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_event_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     // 対象者に自分が含まれている
     if (in_array($u, $c_member_ids)) {
         handle_kengen_error();
     }
     //---
     //メッセージ送信
     list($msg_subject, $msg_body) = create_message_event_message($u, $body, $c_commu_topic_id);
     foreach ($c_member_ids as $key => $value) {
         db_message_send_message_event_message($u, $value, $msg_subject, $msg_body);
     }
     $p = array('target_c_commu_topic_id' => $c_commu_topic_id);
     openpne_redirect('ktai', 'page_c_event_mail_end', $p);
 }
 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);
     $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_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();
     }
     //---
     $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';
 }
Example #3
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $c_member_ids = $requests['c_member_id'];
     $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 (!$c_member_ids) {
         $p = array('target_c_commu_topic_id' => $c_commu_topic_id, 'msg' => "紹介先の" . WORD_MY_FRIEND . "を選択してださい");
         openpne_redirect('pc', 'page_c_event_invite', $p);
     }
     //--- 権限チェック
     // イベント閲覧権限がないと送信できない
     if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) {
         handle_kengen_error();
     }
     // 自分が送信対象に含まれている
     if (in_array($u, $c_member_ids)) {
         handle_kengen_error();
     }
     //---
     list($msg_subject, $msg_body) = create_message_event_invite($u, $body, $c_commu_topic_id);
     foreach ($c_member_ids as $key => $value) {
         db_message_send_message_event_invite($u, $value, $msg_subject, $msg_body);
     }
     $p = array('target_c_commu_topic_id' => $c_commu_topic_id);
     openpne_redirect('pc', 'page_c_event_invite_end', $p);
 }
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $pw = $GLOBALS['KTAI_PASSWD'];
     // --- リクエスト変数
     $target_c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $page = $requests['page'];
     // ----------
     $c_topic = db_commu_c_topic4c_commu_topic_id_2($target_c_commu_topic_id);
     $c_commu_id = $c_topic['c_commu_id'];
     $page_size = 20;
     //ページ
     $this->set("page", $page);
     //メンバーリスト
     $list = db_commu_c_event_member_list4c_commu_topic_id_2($target_c_commu_topic_id, $page_size, $page);
     $this->set("c_event_member_list", $list[0]);
     $this->set('is_prev', $list[1]);
     $this->set('is_next', $list[2]);
     $pager = array();
     $pager['start'] = $page_size * ($page - 1) + 1;
     $pager['end'] = $pager['start'] + count($list[0]) - 1;
     $this->set('pager', $pager);
     // イベント
     $this->set('c_event', $c_topic);
     //コミュニティID
     $this->set("c_commu_id", $c_commu_id);
     //イベントID
     $this->set("c_commu_topic_id", $target_c_commu_topic_id);
     //コミュニティのメンバー数
     $this->set("count_member", db_commu_count_c_event_member_list4c_commu_topic_id_2($target_c_commu_topic_id));
     return 'success';
 }
 function execute($requests)
 {
     $v = array();
     $target_c_commu_topic_ids = $requests['target_c_commu_topic_ids'];
     // トピックが選択されていない場合はエラー
     if (!$target_c_commu_topic_ids) {
         admin_client_redirect('topic_list', "トピックが選択されていません");
     }
     $id_ary = split(":", $target_c_commu_topic_ids);
     $v = array();
     $topic_list = array();
     foreach ($id_ary as $id) {
         $topic = db_commu_c_topic4c_commu_topic_id_2($id);
         if (!$topic) {
             admin_client_redirect('topic_list', '指定されたトピック・イベントは存在しません');
         }
         $member = db_member_c_member4c_member_id($topic['c_member_id']);
         $topic['count_comments'] = _db_count_c_commu_topic_comments4c_commu_topic_id($topic['c_commu_topic_id']);
         $commu = db_commu_c_commu4c_commu_id($topic['c_commu_id']);
         $topic['commu_name'] = $commu['name'];
         $topic['c_member'] = $member;
         $topic['original_filename'] = db_file_original_filename4filename($topic['filename']);
         array_push($topic_list, $topic);
     }
     $this->set('topic_list', $topic_list);
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $this->set('target_c_commu_topic_ids', $target_c_commu_topic_ids);
     $v['SNS_NAME'] = SNS_NAME;
     $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     $this->set($v);
     return 'success';
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $c_member_ids = $requests['c_member_id'];
     $body = $requests['body'];
     // ----------
     if (!$c_member_ids) {
         $p = array('target_c_commu_topic_id' => $c_commu_topic_id);
         openpne_redirect('pc', 'page_c_event_mail', $p);
     }
     $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_event_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if (in_array($u, $c_member_ids)) {
         handle_kengen_error();
     }
     //---
     $this->set('c_commu', db_commu_c_commu4c_commu_id($c_commu_id));
     $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id));
     $this->set('c_mail_member', db_commu_c_event_mail_confirm_list4c_member_ids($c_member_ids));
     $this->set('body', $body);
     $this->set('c_member_ids', implode(',', $c_member_ids));
     $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['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);
 }
Example #8
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'];
     $c_member_id = $requests['c_member_id'];
     $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();
     }
     // 自分が送信対象
     if ($u == $c_member_id) {
         handle_kengen_error();
     }
     //---
     list($msg_subject, $msg_body) = create_message_event_invite($u, $body, $c_commu_topic_id);
     db_message_send_message_event_invite($u, $c_member_id, $msg_subject, $msg_body);
     $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'];
     // ----------
     $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();
     }
     //---
     $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['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);
 }
Example #11
0
 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);
     $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();
     }
     //---
     $this->set("host", OPENPNE_URL);
     $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);
     //フレンドリストをアサインする
     $this->set("c_friend_list", db_friend_c_friend_list4c_member_id2($u));
     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_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_event_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     //---
     $this->set('c_commu', db_commu_c_commu4c_commu_id($c_commu_id));
     $this->set('c_commu_id', $c_commu_id);
     return 'success';
 }
Example #13
0
 function execute($requests)
 {
     $v = array();
     $target_c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $v = array();
     $topic = db_commu_c_topic4c_commu_topic_id_2($target_c_commu_topic_id);
     if (!$topic) {
         admin_client_redirect('topic_list', '指定されたトピック・イベントは存在しません');
     }
     $member = db_member_c_member4c_member_id($topic['c_member_id']);
     $topic['count_comments'] = _db_count_c_commu_topic_comments4c_commu_topic_id($topic['c_commu_topic_id']);
     $commu = db_commu_c_commu4c_commu_id($topic['c_commu_id']);
     $topic['commu_name'] = $commu['name'];
     $topic['c_member'] = $member;
     $topic['original_filename'] = db_file_original_filename4filename($topic['filename']);
     $this->set('topic', $topic);
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $v['SNS_NAME'] = SNS_NAME;
     $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     $this->set($v);
     return 'success';
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $page = $requests['page'];
     // ----------
     $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();
     }
     //---
     $this->set('c_commu', db_commu_c_commu4c_commu_id($c_commu_id));
     $this->set('c_topic', $c_topic);
     $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id));
     $this->set('page', $page);
     $page_size = 50;
     $c_event_member_list = db_commu_c_event_member_list4c_commu_topic_id($c_commu_topic_id, $page, $page_size);
     $total_c_event_member = db_commu_count_c_event_member_list4c_commu_topic_id($c_commu_topic_id);
     $start_num = ($page - 1) * $page_size + 1;
     $end_num = $page * $page_size;
     if ($end_num > $total_c_event_member) {
         $end_num = $total_c_event_member;
     }
     $end_page = ceil($total_c_event_member / $page_size);
     for ($i = 1; $i <= $end_page; $i++) {
         $page_num[] = $i;
     }
     $this->set("page_num", $page_num);
     $this->set('c_event_member_list', $c_event_member_list);
     $this->set('total_c_event_member', $total_c_event_member);
     $this->set('is_prev', $start_num != 1);
     $this->set('is_next', $end_num != $total_c_event_member);
     $this->set('start_num', $start_num);
     $this->set('end_num', $end_num);
     return 'success';
 }
Example #15
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_commu_topic_id = $requests['target_c_commu_topic_id'];
     // ----------
     $c_commu = db_commu_c_commu4c_commu_topic_id($target_c_commu_topic_id);
     $c_commu_id = $c_commu['c_commu_id'];
     if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) {
         handle_kengen_error();
     }
     $target_c_commu_topic = db_commu_c_topic4c_commu_topic_id_2($target_c_commu_topic_id);
     if (!$target_c_commu_topic['event_flag']) {
         handle_kengen_error();
     }
     $this->set('c_commu_topic', $target_c_commu_topic);
     // コミュニティ
     $this->set("c_commu", $c_commu);
     // ランダムフレンドリスト
     //    イベント参加済のメンバーも含まれる
     $this->set("c_friend_list", db_friend_ktai_c_friend_list_random4c_member_id($u));
     return 'success';
 }
Example #16
0
function c_event_detail_c_topic4c_commu_topic_id($c_commu_topic_id)
{
    return db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
}
Example #17
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'];
     $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';
 }
Example #18
0
 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';
 }
Example #19
0
 function get_main_data($input, $id)
 {
     //日記の場合
     if ($input['data_type'] < 2) {
         $data = db_diary_get_c_diary4id($id);
         $ret['subject'] = $data['subject'];
         $ret['datetime'] = $this->conv_timestamp_to_datetime(strtotime($data['r_datetime']));
         $ret['description'] = array('id' => $data['c_member_id'], 'isopen' => $data['public_flag'], 'contents' => $data['body']);
         //トピック・イベントの場合
     } else {
         //トピック
         if ($input['data_type'] < 4) {
             $data = db_commu_c_topic4c_commu_topic_id($id);
             //イベント
         } else {
             $data = db_commu_c_topic4c_commu_topic_id_2($id);
         }
         $commu = db_commu_c_commu4c_commu_id($data['c_commu_id']);
         $ret['subject'] = $data['name'];
         $ret['datetime'] = $this->conv_timestamp_to_datetime(strtotime($data['r_datetime']));
         $ret['description'] = array('id' => $data['c_member_id'], 'isopen' => $commu['public_flag'], 'community' => $commu['name'], 'contents' => $data['body']);
         //イベントに限り参加人数・開催日を追記
         if ($input['data_type'] >= 4) {
             $ret['description'] += array('number' => $data['member_num'], 'opendate' => $data['open_date']);
         }
     }
     return $ret;
 }
Example #20
0
function db_commu_is_event_join_capacity($c_commu_topic_id)
{
    $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
    if (!$c_topic['capacity']) {
        return true;
    }
    if ($c_topic['capacity'] > $c_topic['member_num']) {
        return true;
    }
    return false;
}
 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);
 }
Example #22
0
 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'];
     // ----------
     $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);
 }
Example #24
0
 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_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';
 }