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['AUTH']->uid(); // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $page = $requests['page']; // ---------- $page_size = 30; $c_member_id = $u; //--- 権限チェック //コミュニティメンバー if (!db_commu_is_c_commu_member($c_commu_id, $u)) { handle_kengen_error(); } //--- $this->set('c_member', db_member_c_member4c_member_id($c_member_id)); list($c_review_list, $is_prev, $is_next, $total_num, $start_num, $end_num) = db_review_list_product_c_review_list4c_member_id($c_member_id, $page, $page_size); $this->set('c_review_list', $c_review_list); $this->set("is_prev", $is_prev); $this->set("is_next", $is_next); $this->set("page", $page); $this->set("total_num", $total_num); $this->set('start_num', $start_num); $this->set('end_num', $end_num); $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); $this->set('c_commu', $c_commu); $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $c_review_id = $requests['c_review_id']; // ---------- //--- 権限チェック //コミュニティメンバー if (!db_commu_is_c_commu_member($c_commu_id, $u)) { handle_kengen_error(); } //--- if (!$c_review_id) { $_REQUEST['target_c_commu_id'] = $c_commu_id; openpne_forward('pc', 'page', "c_member_review_add"); exit; } $c_member_review = db_review_c_member_review_add_confirm_c_member_review4c_review_id($c_review_id, $u); if (!$c_member_review) { handle_kengen_error(); } $this->set('c_member_review', $c_member_review); $this->set('c_commu', db_commu_c_commu4c_commu_id($c_commu_id)); $this->set('c_review_id', $c_review_id); $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); return 'success'; }
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['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_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(); $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) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_commu_id = $requests['target_c_commu_id']; // ---------- $c_commu = db_commu_c_commu4c_commu_id($target_c_commu_id); //コミュニティの存在の有無 if (!$c_commu) { openpne_redirect('ktai', 'page_h_home'); } //--- 権限チェック //未処理 //掲示板の閲覧権限チェック tplでやっている $this->set("is_c_commu_view", db_commu_is_c_commu_view4c_commu_idAc_member_id($target_c_commu_id, $u)); $this->set("is_c_commu_member", db_commu_is_c_commu_member($target_c_commu_id, $u)); $this->set('is_c_commu_admin', db_commu_is_c_commu_admin($target_c_commu_id, $u)); //--- //管理画面HTML $this->set('c_siteadmin', p_common_c_siteadmin4target_pagename('k_c_home')); //コミュニティ情報 $this->set("c_commu", db_commu_c_commu4c_commu_id_k($target_c_commu_id)); // 副管理者情報 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("c_commu_member_list", db_commu_c_commu_member_list_random4c_commu_id($target_c_commu_id, 5)); //参加コミュニティの新着トピック書き込み $this->set("new_topic_comment", db_commu_new_topic_comment4c_commu_id($target_c_commu_id, 5)); //参加コミュニティの新着イベント書き込み $this->set("new_topic_comment_event", db_commu_new_topic_comment4c_commu_id($target_c_commu_id, 5, 1)); //自分($u)とこのコミュとの関係 $this->set("relation_c_member_and_c_commu", db_commu_relationship_between_member_commu($target_c_commu_id, $u)); //コミュニティメール(ktai)受信設定 $this->set("is_receive_mail", db_commu_is_receive_mail_ktai($target_c_commu_id, $u)); //コミュニティメール(pc)受信設定 $this->set("is_receive_mail_pc", db_commu_is_receive_mail_pc($target_c_commu_id, $u)); //管理者からのメッセージ受信設定 $this->set("is_receive_message", db_commu_is_receive_message($target_c_commu_id, $u)); $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_ktai_entry_point', fetch_inc_entry_point($this->getView(), 'ktai_c_home')); return 'success'; }
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['AUTH']->uid(); // --- リクエスト変数 $target_c_commu_id = $requests['target_c_commu_id']; // ---------- $is_admin = db_commu_is_c_commu_admin($target_c_commu_id, $u); $is_member = db_commu_is_c_commu_member($target_c_commu_id, $u); if ($is_admin) { $p = array('target_c_commu_id' => $target_c_commu_id); openpne_redirect('pc', 'page_c_taikai_err_admin', $p); } if (!$is_member) { $p = array('target_c_commu_id' => $target_c_commu_id); openpne_redirect('pc', 'page_c_taikai_err_no_member', $p); } $this->set('inc_navi', fetch_inc_navi("c", $target_c_commu_id)); $this->set('c_commu', db_commu_c_commu4c_commu_id($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']; $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) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $page = $requests['page']; // ---------- $page_size = 20; $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); list($c_member_review, $is_prev, $is_next, $total_num, $start_num, $end_num) = db_review_c_member_review_c_member_review4c_commu_id($c_commu_id, $page, $page_size); $this->set('c_member_review', $c_member_review); $this->set("is_prev", $is_prev); $this->set("is_next", $is_next); $this->set("page", $page); $this->set("total_num", $total_num); $this->set('start_num', $start_num); $this->set('end_num', $end_num); $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); $this->set('c_commu', $c_commu); $this->set("is_c_commu_member", db_commu_is_c_commu_member($c_commu_id, $u)); return 'success'; }
function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_commu_id = $requests['target_c_commu_id']; // ---------- //--- 権限チェック //コミュニティメンバー and 管理者でない $is_admin = db_commu_is_c_commu_admin($target_c_commu_id, $u); $is_member = db_commu_is_c_commu_member($target_c_commu_id, $u); if ($is_admin) { ktai_display_error(k_p_common_msg4msg_id(10)); } if (!$is_member) { ktai_display_error(k_p_common_msg4msg_id(11)); } //--- db_commu_delete_c_commu_member($target_c_commu_id, $u); $p = array('target_c_commu_id' => $target_c_commu_id); openpne_redirect('ktai', 'page_c_home', $p); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_commu_id = $requests['target_c_commu_id']; // ---------- $c_commu = db_commu_c_commu4c_commu_id($target_c_commu_id); //コミュニティの存在の有無 if (!$c_commu) { openpne_redirect('ktai', 'page_h_home'); } $is_c_commu_member = db_commu_is_c_commu_member($target_c_commu_id, $u); $relation_c_member_and_c_commu = db_commu_relationship_between_member_commu($target_c_commu_id, $u); $is_unused_pc_bbs = util_is_unused_mail('m_pc_bbs_info'); $is_unused_ktai_bbs = util_is_unused_mail('m_ktai_bbs_info'); if (!$is_c_commu_member) { handle_kengen_error(); } elseif ($is_unused_pc_bbs && $is_unused_ktai_bbs) { handle_kengen_error(); } $c_member_secure = db_member_c_member_secure4c_member_id($u); if (empty($c_member_secure['pc_address'])) { $is_registered_pc_address = false; } else { $is_registered_pc_address = true; } //コミュニティ情報 $this->set("c_commu", db_commu_c_commu4c_commu_id_k($target_c_commu_id)); //コミュニティメール(ktai)受信設定 $this->set("is_receive_mail", db_commu_is_receive_mail_ktai($target_c_commu_id, $u)); //コミュニティメール(pc)受信設定 $this->set("is_receive_mail_pc", db_commu_is_receive_mail_pc($target_c_commu_id, $u)); //管理者からのメッセージ受信設定 $this->set("is_receive_message", db_commu_is_receive_message($target_c_commu_id, $u)); // PCメールアドレス登録状況 $this->set('is_registered_pc_address', $is_registered_pc_address); 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['AUTH']->uid(); // --- リクエスト変数 $target_c_commu_id = $requests['target_c_commu_id']; // ---------- //--- 権限チェック //コミュニティメンバーで管理者ではない $is_admin = db_commu_is_c_commu_admin($target_c_commu_id, $u); $is_member = db_commu_is_c_commu_member($target_c_commu_id, $u); if ($is_admin) { $p = array('target_c_commu_id' => $target_c_commu_id); openpne_redirect('pc', 'page_c_taikai_err_admin', $p); } if (!$is_member) { $p = array('target_c_commu_id' => $target_c_commu_id); openpne_redirect('pc', 'page_c_taikai_err_no_member', $p); } //--- db_commu_delete_c_commu_member($target_c_commu_id, $u); $p = array('target_c_commu_id' => $target_c_commu_id); openpne_redirect('pc', 'page_c_home', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $page = $requests['page']; // ---------- $page_size = 20; $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); //コミュニティの存在の有無 if (!$c_commu) { openpne_redirect('pc', 'page_h_err_c_home'); } $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); $this->set("c_commu", $c_commu); list($result, $is_prev, $is_next, $total_num, $start_num, $end_num) = db_commu_c_topic_list4target_c_commu_id($c_commu_id, $u, $page, $page_size, 1, 1); $this->set("c_topic_list", $result); $this->set("is_prev", $is_prev); $this->set("is_next", $is_next); $this->set("page", $page); $this->set("total_num", $total_num); $this->set('start_num', $start_num); $this->set('end_num', $end_num); //--- 権限チェック $is_c_commu_member = db_commu_is_c_commu_member($c_commu_id, $u); if (!$is_c_commu_member && $c_commu['is_open'] == "member") { $is_warning = true; } else { $is_warning = false; } $this->set("is_warning", $is_warning); //--- $this->set("is_c_commu_admin", db_commu_is_c_commu_admin($c_commu_id, $u)); $this->set("is_c_commu_member", $is_c_commu_member); 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 add_commu_topic_comment($c_commu_topic_id) { if (!($topic = db_commu_c_commu_topic4c_commu_topic_id_3($c_commu_topic_id))) { return false; } $c_commu_id = $topic['c_commu_id']; if (!db_commu_is_c_commu_member($c_commu_id, $this->c_member_id)) { $this->error_mail(WORD_COMMUNITY . 'に参加していないため投稿できませんでした。'); m_debug_log('mail_sns::add_commu_topic_comment() not a member'); return false; } $images = $this->decoder->get_images(); if ($images === false) { $this->error_mail('画像は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください。'); return false; } // 画像アップロード可能サイズチェック if ($images) { $filesize = 0; $image_num = 1; foreach ($images as $image) { $filesize += $image['filesize']; $image_num++; if ($image_num > 3) { break; } } $result = util_image_check_add_image_upload($filesize, $this->c_member_id, 'commu'); if ($result) { $msg = util_image_get_upload_err_msg($result); $this->error_mail($msg); m_debug_log('mail_sns::add_commu_topic_comment() imagesize is full'); return false; } } $body = $this->decoder->get_text_body(); if ($body === '') { $this->error_mail('本文が空のため投稿できませんでした。'); m_debug_log('mail_sns::add_commu_topic_comment() body is empty'); return false; } // 書き込みをDBに追加 $ins_id = db_commu_insert_c_commu_topic_comment($c_commu_id, $topic['c_commu_topic_id'], $this->c_member_id, $body); // 写真登録 $image_num = 1; foreach ($images as $image) { $image_ext = $image['ext']; $image_data = $image['data']; $filename = 'tc_' . $ins_id . '_' . $image_num . '_' . time() . '.' . $image_ext; db_image_insert_c_image($filename, $image_data, $image['filesize'], $this->c_member_id); db_commu_update_c_commu_topic_comment_image($ins_id, $filename, $image_num); $image_num++; if ($image_num > 3) { break; } } //お知らせメール送信(携帯へ) send_bbs_info_mail($ins_id, $this->c_member_id); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($ins_id, $this->c_member_id); if (OPENPNE_USE_POINT_RANK) { //トピック・イベントにコメントした人にポイント付与 $point = db_action_get_point4c_action_id(11); db_point_add_point($this->c_member_id, $point); } return true; }
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'; }
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 db_commu_get_c_join_status($c_member_id, $c_commu_id) { if (db_commu_is_c_commu_member($c_commu_id, $c_member_id)) { return STATUS_C_JOIN_ALREADY; } $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); if ($c_commu['is_admit'] == "public") { return STATUS_C_JOIN_REQUEST_FREE; } if (db_commu_is_c_commu_join_wait($c_commu_id, $c_member_id)) { return STATUS_C_JOIN_WAIT; } return STATUS_C_JOIN_REQUEST_NEED; }
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']; $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); }
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 _db_is_c_commu_member($c_commu_id, $c_member_id) { return db_commu_is_c_commu_member($c_commu_id, $c_member_id); }
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'; }