function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; // --- リクエスト変数 $target_c_member_id = $requests['target_c_member_id']; $body = $requests['body']; // ---------- //TODO: 空のとき削除でもよいのでは? if (!$body) { $p = array('target_c_member_id' => $target_c_member_id, 'msg' => 33); openpne_redirect('ktai', 'page_f_intro_edit', $p); } //--- 権限チェック //フレンド $status = db_friend_status($u, $target_c_member_id); if (!$status['is_friend']) { handle_kengen_error(); } //--- if (OPENPNE_USE_POINT_RANK) { //紹介文を書いた人にポイント付与 if (!db_friend_intro_body4c_member_id($u, $target_c_member_id)) { $point = db_action_get_point4c_action_id(5); db_point_add_point($u, $point); } } db_friend_update_c_friend_intro($u, $target_c_member_id, $body); // メール送信 do_f_intro_edit_update_c_friend_send_mail($u, $target_c_member_id); $p = array('target_c_member_id' => $target_c_member_id); openpne_redirect('ktai', 'page_fh_intro', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $category_id = $requests['category_id']; $asin = $requests['asin']; $body = $requests['body']; $satisfaction_level = $requests['satisfaction_level']; // ---------- $c_review_comment = db_review_add_write_c_review_comment4asin_c_member_id($asin, $u); if ($c_review_comment) { $p = array('c_review_id' => $c_review_comment['c_review_id']); openpne_redirect('pc', 'page_h_review_list_product', $p); } $product = db_review_write_product4asin($asin); if (!$product) { handle_kengen_error(); } //c_reviewへ登録 $c_review_id = do_c_review_add_insert_c_review($product, $category_id); //c_review_commentへ登録 if ($c_review_id) { do_c_review_add_insert_c_review_comment($c_review_id, $u, $body, $satisfaction_level); } if (OPENPNE_USE_POINT_RANK) { //レビューを書いた人にポイント付与 $point = db_action_get_point4c_action_id(6); db_point_add_point($u, $point); } $p = array('c_review_id' => $c_review_id); openpne_redirect('pc', 'page_h_review_list_product', $p); }
function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $c_commu_id = $requests['target_c_commu_id']; $title = $requests['title']; $body = $requests['body']; // ---------- //--- 権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': //コミュニティ参加者 $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { ktai_display_error("トピックは管理者だけが作成できます"); } break; } //--- $insert_c_commu_topic = array("name" => $title, "c_commu_id" => $c_commu_id, "c_member_id" => $u, "event_flag" => 0); $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic); $insert_c_commu_topic_comment = array("c_commu_id" => $c_commu_id, "c_member_id" => $u, "body" => $body, "number" => 0, "c_commu_topic_id" => $c_commu_topic_id, "image_filename1" => "", "image_filename2" => "", "image_filename3" => ""); $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment); //お知らせメール送信(携帯へ) send_bbs_info_mail($insert_id, $u); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($insert_id, $u); if (OPENPNE_USE_POINT_RANK) { //トピックを作成した人にポイント付与 $point = db_action_get_point4c_action_id(9); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('ktai', 'page_c_bbs', $p); }
function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $subject = $requests['subject']; $body = $requests['body']; $public_flag = util_cast_public_flag_diary($requests['public_flag']); $target_c_diary_id = $requests['target_c_diary_id']; $is_comment_input = $requests['is_comment_input']; // ---------- if (is_null($subject) || $subject === '') { $_REQUEST['msg'] = 2; openpne_forward('ktai', 'page', 'h_diary_edit'); exit; } if (is_null($body) || $body === '') { $_REQUEST['msg'] = 1; openpne_forward('ktai', 'page', 'h_diary_edit'); exit; } if (!$target_c_diary_id) { // 新規作成 $target_c_diary_id = db_diary_insert_c_diary($u, $subject, $body, $public_flag, $is_comment_input); if (OPENPNE_USE_POINT_RANK) { //日記を書いた人にポイント付与 $point = db_action_get_point4c_action_id(4); db_point_add_point($u, $point); } } else { // 編集 $c_diary = db_diary_get_c_diary4id($target_c_diary_id); if ($c_diary['c_member_id'] != $u) { handle_kengen_error(); } db_diary_update_c_diary($target_c_diary_id, $subject, $body, $public_flag, $is_comment_input); } $p = array('target_c_member_id' => $u); openpne_redirect('ktai', 'page_fh_diary_list', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $target_c_member_id = $requests['target_c_member_id']; $body = $requests['body']; $c_member_id_list = $requests['c_member_id_list']; // ---------- if (!$c_member_id_list) { $p = array('target_c_member_id' => $target_c_member_id, 'msg' => "紹介先の" . WORD_MY_FRIEND . "を選択してださい"); openpne_redirect('pc', 'page_f_invite', $p); } if (is_null($body) || $body === '') { $p = array('target_c_member_id' => $target_c_member_id, 'msg' => "メッセージを入力してください"); openpne_redirect('pc', 'page_f_invite', $p); } //--- 権限チェック //フレンド foreach ($c_member_id_list as $c_member_id) { if (!db_friend_is_friend($c_member_id, $u)) { handle_kengen_error(); } } //--- list($msg_subject, $msg_body) = create_message_friend_invite($u, $body, $target_c_member_id); foreach ($c_member_id_list as $key => $value) { db_message_send_message_syoukai_member($u, $value, $msg_subject, $msg_body); } if (OPENPNE_USE_POINT_RANK) { //メンバー紹介をした人にポイント付与 $point = db_action_get_point4c_action_id(8); db_point_add_point($u, $point); } $p = array('target_c_member_id' => $target_c_member_id); openpne_redirect('pc', 'page_f_home', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $target_c_diary_id = $requests['target_c_diary_id']; $tmpfile_1 = $requests['tmpfile_1']; $tmpfile_2 = $requests['tmpfile_2']; $tmpfile_3 = $requests['tmpfile_3']; $body = $requests['body']; // ---------- if (is_null($body) || $body === '') { $p = array('target_c_diary_id' => $target_c_diary_id, 'msg' => "コメントを入力してださい"); openpne_redirect('pc', 'page_fh_diary', $p); } //--- 権限チェック $c_diary = db_diary_get_c_diary4id($target_c_diary_id); $target_c_member_id = $c_diary['c_member_id']; $target_c_member = db_member_c_member4c_member_id($target_c_member_id); if ($u != $target_c_member_id) { // check public_flag if (!pne_check_diary_public_flag($target_c_diary_id, $u)) { openpne_redirect('pc', 'page_h_err_diary_access'); } //アクセスブロック設定 if (db_member_is_access_block($u, $target_c_member_id)) { openpne_redirect('pc', 'page_h_access_block'); } } //日記コメント停止設定 if (OPENPNE_USE_DIARY_COMMENT && !$c_diary['is_comment_input']) { openpne_forward('pc', 'page', 'fh_diary'); exit; } if (!db_diary_is_writable_comment4c_diary_id($target_c_diary_id)) { $_REQUEST['msg'] = 'コメントが1000番に達したので、この' . WORD_DIARY . 'にはコメントできません'; openpne_forward('pc', 'page', 'fh_diary'); exit; } //--- //---画像アップロードサイズチェック $filesize = 0; if ($tmpfile_1) { $filesize += util_image_get_c_tmp_filesize4filename("dc_{$c_diary_comment_id}_1", $tmpfile_1); } if ($tmpfile_2) { $filesize += util_image_get_c_tmp_filesize4filename("dc_{$c_diary_comment_id}_2", $tmpfile_2); } if ($tmpfile_3) { $filesize += util_image_get_c_tmp_filesize4filename("dc_{$c_diary_comment_id}_3", $tmpfile_3); } if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'diary'); if ($result) { if ($result == 2) { $result = 3; } $_REQUEST['msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', 'fh_diary'); exit; } } //日記コメント書き込み $c_diary_comment_id = db_diary_insert_c_diary_comment($u, $target_c_diary_id, $body); $sessid = session_id(); $filename_1 = image_insert_c_image4tmp("dc_{$c_diary_comment_id}_1", $tmpfile_1, $u); $filename_2 = image_insert_c_image4tmp("dc_{$c_diary_comment_id}_2", $tmpfile_2, $u); $filename_3 = image_insert_c_image4tmp("dc_{$c_diary_comment_id}_3", $tmpfile_3, $u); t_image_clear_tmp($sessid); db_diary_insert_c_diary_comment_images($c_diary_comment_id, $filename_1, $filename_2, $filename_3); //日記コメント記入履歴更新 if ($u != $target_c_member_id) { db_diary_insert_c_diary_comment_log($u, $target_c_diary_id); } db_diary_update_c_diary_comment_log($target_c_diary_id); //日記コメントが書き込まれたので日記自体を未読扱いにする db_diary_update_c_diary_is_checked($target_c_diary_id, 0); // お知らせメール送信(携帯へ) if ($u != $target_c_member_id) { send_diary_comment_info_mail($c_diary_comment_id, $u); } if (OPENPNE_USE_POINT_RANK) { // コメント者と被コメント者が違う場合にポイント加算 if ($u != $target_c_member_id) { //書いた人にポイント付与 $point = db_action_get_point4c_action_id(3); db_point_add_point($u, $point); //書かれた人にポイント付与 $point = db_action_get_point4c_action_id(2); db_point_add_point($target_c_member_id, $point); } } $p = array('target_c_diary_id' => $target_c_diary_id, 'comment_count' => db_diary_count_c_diary_comment4c_diary_id($target_c_diary_id)); openpne_redirect('pc', 'page_fh_diary', $p); }
/** * アクションIDからポイントを取得する * * @param int $c_action_id アクションID * @return int ポイントID */ function op_action_get_point4c_action_id($c_action_id) { return db_action_get_point4c_action_id($c_action_id); }
/** * 日記コメント投稿 */ function add_diary_comment($c_diary_id) { //--- 権限チェック $c_diary = db_diary_get_c_diary4id($c_diary_id); $target_c_member_id = $c_diary['c_member_id']; $target_c_member = db_member_c_member4c_member_id($target_c_member_id); if ($this->c_member_id != $target_c_member_id) { // check public_flag if (!pne_check_diary_public_flag($c_diary_id, $this->c_member_id)) { $this->error_mail(WORD_DIARY . 'にアクセスできないため投稿できませんでした。'); m_debug_log('mail_sns::add_diary_comment() not a member'); return false; } //アクセスブロック設定 if (db_member_is_access_block($this->c_member_id, $target_c_member_id)) { $this->error_mail(WORD_DIARY . 'にアクセスできないため投稿できませんでした。'); m_debug_log('mail_sns::add_diary_comment() access block'); return false; } } //--- // コメント許可設定取得 if (OPENPNE_USE_DIARY_COMMENT && !$c_diary['is_comment_input']) { $this->error_mail('現在この' . WORD_DIARY . 'にはコメントできません。'); m_debug_log('mail_sns::add_diary_comment() comment block'); return false; } $body = $this->decoder->get_text_body(); if ($body === '') { $this->error_mail('本文が空のため投稿できませんでした。'); m_debug_log('mail_sns::add_diary_comment() body is empty'); 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, 'diary'); if ($result) { $msg = util_image_get_upload_err_msg($result); $this->error_mail($msg); m_debug_log('mail_sns::add_diary_comment() size over'); return false; } } //日記コメント書き込み $ins_id = db_diary_insert_c_diary_comment($this->c_member_id, $c_diary_id, $body); //日記コメント記入履歴追加 if ($this->c_member_id != $target_c_member_id) { db_diary_insert_c_diary_comment_log($this->c_member_id, $c_diary_id); } //日記コメント記入履歴更新 db_diary_update_c_diary_comment_log($c_diary_id); // 写真登録 $image_num = 1; $filenames = array(1 => '', 2 => '', 3 => ''); foreach ($images as $image) { $image_ext = $image['ext']; $image_data = $image['data']; $filename = 'dc_' . $ins_id . '_' . $image_num . '_' . time() . '.' . $image_ext; db_image_insert_c_image($filename, $image_data, $image['filesize'], $this->c_member_id); $filenames[$image_num] = $filename; $image_num++; if ($image_num > 3) { break; } } db_diary_insert_c_diary_comment_images($ins_id, $filenames[1], $filenames[2], $filenames[3]); //お知らせメール送信(携帯へ) if ($this->c_member_id != $target_c_member_id) { send_diary_comment_info_mail($ins_id, $this->c_member_id); } //日記コメントが書き込まれたので日記自体を未読扱いにする if ($this->c_member_id != $target_c_member_id) { db_diary_update_c_diary_is_checked($c_diary_id, 0); } if (OPENPNE_USE_POINT_RANK) { // コメント者と被コメント者が違う場合にポイント加算 if ($this->c_member_id != $target_c_member_id) { //書いた人にポイント付与 $point = db_action_get_point4c_action_id(3); db_point_add_point($this->c_member_id, $point); //書かれた人にポイント付与 $point = db_action_get_point4c_action_id(2); db_point_add_point($target_c_member_id, $point); } } return true; }
function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_commu_topic_id = $requests['target_c_commu_topic_id']; $body = $requests['body']; // ---------- //--- 権限チェック //コミュニティ参加者 $c_commu_topic = db_commu_c_commu_topic4c_commu_topic_id($target_c_commu_topic_id); if ($c_commu_topic['event_flag']) { $c_event_member_count = db_commu_count_c_event_member_list4c_commu_topic_id($target_c_commu_topic_id); } $c_commu_id = $c_commu_topic['c_commu_id']; $c_commu = db_commu_c_commu4c_commu_id($c_commu_topic['c_commu_id']); switch ($c_commu['is_comment']) { case 'public': //誰でもコメント可能 break; case 'member': $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; } //--- if (is_null($body) || $body === '') { //bodyが無い時のエラー処理 $p = array('target_c_commu_topic_id' => $target_c_commu_topic_id, 'msg' => 1); openpne_redirect('ktai', 'page_c_bbs', $p); } if ($requests['join_event'] || $requests['cancel_event']) { if (!db_commu_is_event_join_date($target_c_commu_topic_id)) { handle_kengen_error(); } } $insert_id = db_commu_insert_c_commu_topic_comment_2($u, $target_c_commu_topic_id, $body); //イベントのメンバーに追加 if ($requests['join_event']) { if ($c_commu_topic['capacity'] && $c_commu_topic['capacity'] <= $c_event_member_count) { $p = array('target_c_commu_topic_id' => $target_c_commu_topic_id, 'msg' => 45); openpne_redirect('ktai', 'page_c_bbs', $p); } else { db_commu_insert_c_event_member($target_c_commu_topic_id, $u); } } elseif ($requests['cancel_event']) { db_commu_delete_c_event_member($target_c_commu_topic_id, $u); } //お知らせメール送信(携帯へ) send_bbs_info_mail($insert_id, $u); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($insert_id, $u); if (OPENPNE_USE_POINT_RANK) { //トピック・イベントにコメントした人にポイント付与 $point = db_action_get_point4c_action_id(11); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $target_c_commu_topic_id); openpne_redirect('ktai', 'page_c_bbs', $p); }
/** * メンバー登録を行う * * @param array $c_member * @param array $c_member_secure * @param array $c_member_profile_list * @param bool $is_password_encrypted パスワードが既に暗号化済みかどうか * @return int */ function util_regist_c_member($c_member, $c_member_secure, $c_member_profile_list = array(), $is_password_encrypted = false) { // メール受信設定をデフォルト値に $c_member['is_receive_mail'] = 1; $c_member['is_receive_ktai_mail'] = 1; $c_member['is_receive_daily_news'] = 1; // メンバー登録 $u = db_member_insert_c_member($c_member, $c_member_secure, $is_password_encrypted); if ($u === false) { // メンバー登録に失敗した場合 return false; } if (OPENPNE_USE_POINT_RANK) { //入会者にポイント加算 $point = db_action_get_point4c_action_id(1); db_point_add_point($u, $point); //メンバー招待をした人にポイント加算 $point = db_action_get_point4c_action_id(7); db_point_add_point($c_member['c_member_id_invite'], $point); } // c_member_profile db_member_update_c_member_profile($u, $c_member_profile_list); // 招待者とフレンドリンク db_friend_insert_c_friend($u, $c_member['c_member_id_invite']); //管理画面で指定したコミュニティに強制参加 $c_commu_id_list = db_commu_regist_join_list(); foreach ($c_commu_id_list as $c_commu_id) { db_commu_join_c_commu($c_commu_id, $u); } // ログインIDを登録 if (OPENPNE_AUTH_MODE == 'pneid') { $login_id = strtolower($c_member['login_id']); db_member_insert_username($u, $login_id); } return $u; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $c_commu_id = $requests['c_commu_id']; $title = $requests['title']; $image_filename1_tmpfile = $requests['image_filename1_tmpfile']; $image_filename2_tmpfile = $requests['image_filename2_tmpfile']; $image_filename3_tmpfile = $requests['image_filename3_tmpfile']; $body = $requests['body']; //---添付ファイル 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'] = $c_commu_id; $_REQUEST['err_msg'] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string')); openpne_forward('pc', 'page', "c_topic_add"); exit; } } } //---権限チェック $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': //コミュニティ参加者 $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($c_commu_id, $u)) { $_REQUEST['target_c_commu_id'] = $c_commu_id; $_REQUEST['msg'] = "トピックは管理者だけが作成できます"; openpne_forward('pc', 'page', "c_home"); exit; } break; } //---画像アップロードサイズチェック $filesize = 0; if ($image_filename1_tmpfile) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_1", $image_filename1_tmpfile); } if ($image_filename2_tmpfile) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_2", $image_filename2_tmpfile); } if ($image_filename3_tmpfile) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_3", $image_filename3_tmpfile); } if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'commu'); if ($result) { if ($result == 2) { $result = 3; } $_REQUEST['target_c_commu_id'] = $c_commu_id; $_REQUEST['msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', "c_topic_add"); exit; } } //--- $insert_c_commu_topic = array("name" => $title, "c_commu_id" => $c_commu_id, "c_member_id" => $u, "event_flag" => 0); $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic); if ($image_filename1_tmpfile) { $filename1 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_1", $image_filename1_tmpfile, $u); } if ($image_filename2_tmpfile) { $filename2 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_2", $image_filename2_tmpfile, $u); } if ($image_filename3_tmpfile) { $filename3 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_3", $image_filename3_tmpfile, $u); } if (OPENPNE_USE_FILEUPLOAD) { // 添付ファイルをDBに入れる if ($filename4_tmpfile) { $filename4 = file_insert_c_file4tmp("t_{$c_commu_topic_id}_4", $filename4_tmpfile, $filename4_original_filename); } } //テンポラリファイルを削除(画像と同時) t_image_clear_tmp(session_id()); t_file_clear_tmp(session_id()); $insert_c_commu_topic_comment = array("c_commu_id" => $c_commu_id, "c_member_id" => $u, "body" => $body, "number" => 0, "c_commu_topic_id" => $c_commu_topic_id, "image_filename1" => !empty($filename1) ? $filename1 : '', "image_filename2" => !empty($filename2) ? $filename2 : '', "image_filename3" => !empty($filename3) ? $filename3 : '', "filename4" => !empty($filename4) ? $filename4 : ''); $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment); //お知らせメール送信(携帯へ) send_bbs_info_mail($insert_id, $u); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($insert_id, $u); if (OPENPNE_USE_POINT_RANK) { //トピックを作成した人にポイント付与 $point = db_action_get_point4c_action_id(9); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('pc', 'page_c_topic_detail', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $tmpfile1 = $requests['image_filename1_tmpfile']; $tmpfile2 = $requests['image_filename2_tmpfile']; $tmpfile3 = $requests['image_filename3_tmpfile']; // ---------- //---添付ファイル if (OPENPNE_USE_FILEUPLOAD) { $filename4_tmpfile = $requests['filename4_tmpfile']; $filename4_original_filename = $requests['filename4_original_filename']; if ($filename4_tmpfile) { // 拡張子制限 if (!util_check_file_extention($filename4_original_filename)) { $_REQUEST['target_c_commu_id'] = $requests['c_commu_id']; $_REQUEST['err_msg'] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string')); openpne_forward('pc', 'page', "c_event_add"); exit; } } } //--- 権限チェック //コミュニティ参加者 list($event, $errors) = p_c_event_add_confirm_event4request(true); $c_commu = db_commu_c_commu4c_commu_id2($event['c_commu_id']); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': $status = db_common_commu_status($u, $event['c_commu_id']); if (!$status['is_commu_member']) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($event['c_commu_id'], $u)) { $_REQUEST['target_c_commu_id'] = $event['c_commu_id']; $_REQUEST['msg'] = "イベントは管理者だけが作成できます"; openpne_forward('pc', 'page', "c_home"); exit; } break; } //--- // エラーチェック $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 ($tmpfile1) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_1", $tmpfile1); } if ($tmpfile2) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_2", $tmpfile2); } if ($tmpfile3) { $filesize += util_image_get_c_tmp_filesize4filename("t_{$c_commu_topic_id}_3", $tmpfile3); } 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 ($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; } 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']; } $insert_c_commu_topic = array("name" => $event['title'], "c_commu_id" => $event['c_commu_id'], "c_member_id" => $u, "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']); $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic); if ($tmpfile1) { $filename1 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_1", $tmpfile1, $u); } if ($tmpfile2) { $filename2 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_2", $tmpfile2, $u); } if ($tmpfile3) { $filename3 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_3", $tmpfile3, $u); } if (OPENPNE_USE_FILEUPLOAD) { // 添付ファイルをDBに入れる if ($filename4_tmpfile) { $filename4 = file_insert_c_file4tmp("t_{$c_commu_topic_id}_4", $filename4_tmpfile, $filename4_original_filename); } } //テンポラリファイルを削除(画像と同時) t_image_clear_tmp(session_id()); t_file_clear_tmp(session_id()); $insert_c_commu_topic_comment = array("c_commu_id" => $event['c_commu_id'], "c_member_id" => $u, "body" => $event['detail'], "number" => 0, "c_commu_topic_id" => $c_commu_topic_id, "image_filename1" => !empty($filename1) ? $filename1 : '', "image_filename2" => !empty($filename2) ? $filename2 : '', "image_filename3" => !empty($filename3) ? $filename3 : '', "filename4" => !empty($filename4) ? $filename4 : ''); $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment); //お知らせメール送信(携帯へ) send_bbs_info_mail($insert_id, $u); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($insert_id, $u); db_commu_insert_c_event_member_as_admin($c_commu_topic_id, $u); if (OPENPNE_USE_POINT_RANK) { //イベントを作成した人にポイント付与 $point = db_action_get_point4c_action_id(10); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('pc', 'page_c_event_detail', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $body = $requests['body']; $tmpfile1 = $requests['image_filename1_tmpfile']; $tmpfile2 = $requests['image_filename2_tmpfile']; $tmpfile3 = $requests['image_filename3_tmpfile']; // ---------- // 添付ファイル if (OPENPNE_USE_FILEUPLOAD) { $filename4_tmpfile = $requests['filename4_tmpfile']; $filename4_original_filename = $requests['filename4_original_filename']; if ($filename4_tmpfile) { // 拡張子制限 if (!util_check_file_extention($filename4_original_filename)) { $_REQUEST['target_c_commu_topic_id'] = $c_commu_topic_id; $_REQUEST['err_msg'] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string')); openpne_forward('pc', 'page', "c_topic_detail"); exit; } } } //--- 権限チェック //コミュニティ参加者 $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); switch ($c_commu['is_comment']) { case 'public': //誰でもコメント可能 break; case 'member': $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; } if (!db_commu_is_writable_c_commu_topic_comment4c_commu_topic_id($c_commu_topic_id)) { $err_msg[] = 'コメントが1000番に達したので、このトピックにはコメントできません'; $_REQUEST['err_msg'] = $err_msg; openpne_forward('pc', 'page', "c_topic_detail"); exit; } //--- //---画像アップロードサイズチェック $filesize = 0; if ($tmpfile1) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_id}_1", $tmpfile1); } if ($tmpfile2) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_id}_2", $tmpfile2); } if ($tmpfile3) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_id}_3", $tmpfile3); } if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'commu'); if ($result) { if ($result == 2) { $result = 3; } $_REQUEST['err_msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', "c_topic_detail"); exit; } } $number = db_commu_c_commu_topic_comment_number4c_commu_topic_id($c_commu_topic_id); $insert_c_commu_topic_comment = array("c_commu_id" => $c_commu_id, "c_member_id" => $u, "body" => $body, "number" => $number, "c_commu_topic_id" => $c_commu_topic_id); $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment); if ($tmpfile1) { $filename1 = image_insert_c_image4tmp("tc_{$insert_id}_1", $tmpfile1, $u); } if ($tmpfile2) { $filename2 = image_insert_c_image4tmp("tc_{$insert_id}_2", $tmpfile2, $u); } if ($tmpfile3) { $filename3 = image_insert_c_image4tmp("tc_{$insert_id}_3", $tmpfile3, $u); } if (OPENPNE_USE_FILEUPLOAD) { // 添付ファイルをDBに入れる if ($filename4_tmpfile) { $filename4 = file_insert_c_file4tmp("tc_{$insert_id}_4", $filename4_tmpfile, $filename4_original_filename); } } t_image_clear_tmp(session_id()); t_file_clear_tmp(session_id()); db_commu_update_c_commu_topic_comment_images($insert_id, $filename1, $filename2, $filename3); db_commu_update_c_commu_topic_comment_file($insert_id, $filename4); //お知らせメール送信(携帯へ) send_bbs_info_mail($insert_id, $u); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($insert_id, $u); if (OPENPNE_USE_POINT_RANK) { //トピック・イベントにコメントした人にポイント付与 $point = db_action_get_point4c_action_id(11); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('pc', 'page_c_topic_detail', $p); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $subject = $requests['subject']; $body = $requests['body']; $public_flag = util_cast_public_flag_diary($requests['public_flag']); $tmpfile_1 = $requests['tmpfile_1']; $tmpfile_2 = $requests['tmpfile_2']; $tmpfile_3 = $requests['tmpfile_3']; $category = array_unique(preg_split('/\\s+/', $requests['category'])); $is_comment_input = $requests['is_comment_input']; // ---------- $sessid = session_id(); $c_member_id = $u; if (count($category) > 5) { $_REQUEST['msg'] = 'カテゴリは5つまでしか指定できません'; openpne_forward('pc', 'page', 'h_diary_add'); exit; } foreach ($category as $value) { if (mb_strwidth($value) > 20) { $_REQUEST['msg'] = 'カテゴリはひとつにつき全角10文字(半角20文字)以内で入力してください'; openpne_forward('pc', 'page', 'h_diary_add'); exit; } } // 画像アップロード可能サイズチェック $filesize = 0; if ($tmpfile_1) { $filesize += util_image_get_c_tmp_filesize4filename("d_{$c_diary_id}_1", $tmpfile_1); } if ($tmpfile_2) { $filesize += util_image_get_c_tmp_filesize4filename("d_{$c_diary_id}_2", $tmpfile_2); } if ($tmpfile_3) { $filesize += util_image_get_c_tmp_filesize4filename("d_{$c_diary_id}_3", $tmpfile_3); } if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'diary'); if ($result) { if ($result == 2) { $result = 3; } $_REQUEST['msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', 'h_diary_add'); exit; } } if (!OPENPNE_USE_DIARY_COMMENT) { $is_comment_input = 1; } $c_diary_id = db_diary_insert_c_diary($c_member_id, $subject, $body, $public_flag, $is_comment_input); $c_diary_category_list = db_diary_category_list4c_member_id($c_member_id); foreach ($category as $value) { if (empty($value)) { break; } // 同一のカテゴリ名が登録済みかどうかを確認 $c_category_id = 0; foreach ($c_diary_category_list as $c_diary_category) { if ($c_diary_category['category_name'] == $value) { $c_category_id = $c_diary_category['c_diary_category_id']; break; } } // 未登録の場合は新規に登録する if (!$c_category_id) { $c_category_id = db_diary_category_insert_category($c_member_id, $value); } db_diary_category_insert_c_diary_category_diary($c_diary_id, $c_category_id); } $filename_1 = image_insert_c_image4tmp("d_{$c_diary_id}_1", $tmpfile_1, $u); $filename_2 = image_insert_c_image4tmp("d_{$c_diary_id}_2", $tmpfile_2, $u); $filename_3 = image_insert_c_image4tmp("d_{$c_diary_id}_3", $tmpfile_3, $u); t_image_clear_tmp($sessid); db_diary_update_c_diary($c_diary_id, $subject, $body, $public_flag, $is_comment_input, $filename_1, $filename_2, $filename_3); if (OPENPNE_USE_POINT_RANK) { //日記を書いた人にポイント付与 $point = db_action_get_point4c_action_id(4); db_point_add_point($u, $point); } $p = array('target_c_diary_id' => $c_diary_id); openpne_redirect('pc', 'page_fh_diary', $p); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; //--- 権限チェック //コミュニティ参加者 list($event, $errors) = p_c_event_add_confirm_event4request(true); $c_commu = db_commu_c_commu4c_commu_id2($event['c_commu_id']); switch ($c_commu['is_topic']) { case 'public': //誰でも作成可能 break; case 'member': $status = db_common_commu_status($u, $event['c_commu_id']); if (!$status['is_commu_member']) { handle_kengen_error(); } break; case 'admin_only': //トピック作成権限チェック if (!db_commu_is_c_commu_admin($event['c_commu_id'], $u)) { ktai_display_error("イベントは管理者だけが作成できます"); } break; } //--- //--- エラーチェック $err_msg = $errors; 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 ($err_msg) { $_REQUEST = $event; $_REQUEST['target_c_commu_id'] = $event['c_commu_id']; $_REQUEST['err_msg'] = $err_msg; openpne_forward('ktai', 'page', "c_event_add"); exit; } //--- 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 = ''; } $insert_c_commu_topic = array("name" => $event['title'], "c_commu_id" => $event['c_commu_id'], "c_member_id" => $u, "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']); $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic); $insert_c_commu_topic_comment = array("c_commu_id" => $event['c_commu_id'], "c_member_id" => $u, "body" => $event['detail'], "number" => 0, "c_commu_topic_id" => $c_commu_topic_id, "image_filename1" => '', "image_filename2" => '', "image_filename3" => ''); $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment); //お知らせメール送信(携帯へ) send_bbs_info_mail($insert_id, $u); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($insert_id, $u); db_commu_insert_c_event_member_as_admin($c_commu_topic_id, $u); if (OPENPNE_USE_POINT_RANK) { //イベントを作成した人にポイント付与 $point = db_action_get_point4c_action_id(10); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('ktai', 'page_c_bbs', $p); }
function execute($requests) { $tail = $GLOBALS['KTAI_URL_TAIL']; $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_diary_id = $requests['target_c_diary_id']; $body = $requests['body']; // ---------- if (is_null($body) || $body === '') { $p = array('target_c_diary_id' => $target_c_diary_id, 'msg' => 1); openpne_redirect('ktai', 'page_fh_diary', $p); } //--- 権限チェック $c_diary = db_diary_get_c_diary4id($target_c_diary_id); $target_c_member_id = $c_diary['c_member_id']; $target_c_member = db_member_c_member4c_member_id($target_c_member_id); if ($u != $target_c_member_id) { // check public_flag if (!pne_check_diary_public_flag($target_c_diary_id, $u)) { openpne_redirect('ktai', 'page_h_err_diary_access'); } //アクセスブロック設定 if (db_member_is_access_block($u, $target_c_member_id)) { openpne_redirect('ktai', 'page_h_access_block'); } } //日記コメント停止設定 if (OPENPNE_USE_DIARY_COMMENT && !$c_diary['is_comment_input']) { $p = array('target_c_diary_id' => $target_c_diary_id); openpne_redirect('ktai', 'page_fh_diary', $p); } if (!db_diary_is_writable_comment4c_diary_id($target_c_diary_id)) { $p = array('target_c_diary_id' => $target_c_diary_id, 'msg' => 47); openpne_redirect('ktai', 'page_fh_diary', $p); } //--- $insert_id = db_diary_insert_c_diary_comment($u, $target_c_diary_id, $body); //日記コメント記入履歴追加 if ($u != $target_c_member_id) { db_diary_insert_c_diary_comment_log($u, $target_c_diary_id); } //日記コメント記入履歴更新 db_diary_update_c_diary_comment_log($target_c_diary_id); //日記コメントが書き込まれたので日記自体を未読扱いにする db_diary_update_c_diary_is_checked($target_c_diary_id, 0); // お知らせメール送信(携帯へ) if ($u != $target_c_member_id) { send_diary_comment_info_mail($insert_id, $u); } if (OPENPNE_USE_POINT_RANK) { // コメント者と被コメント者が違う場合にポイント加算 if ($u != $target_c_member_id) { //書いた人にポイント付与 $point = db_action_get_point4c_action_id(3); db_point_add_point($u, $point); //書かれた人にポイント付与 $point = db_action_get_point4c_action_id(2); db_point_add_point($target_c_member_id, $point); } } $p = array('target_c_diary_id' => $target_c_diary_id); openpne_redirect('ktai', 'page_fh_diary', $p); }