function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $subject = $requests['subject']; $body = $requests['body']; $public_flag = util_cast_public_flag_diary($requests['public_flag']); $category = $requests['category']; $is_comment_input = $requests['is_comment_input']; // ---------- $sessid = session_id(); t_image_clear_tmp($sessid); $upfiles = array(1 => $_FILES['upfile_1'], $_FILES['upfile_2'], $_FILES['upfile_3']); $tmpfiles = array(1 => '', '', ''); $filesize = 0; foreach ($upfiles as $key => $upfile) { if (!empty($upfile) && $upfile['error'] !== UPLOAD_ERR_NO_FILE) { if (!($image = t_check_image($upfile))) { $_REQUEST['msg'] = '画像は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください'; openpne_forward('pc', 'page', 'h_diary_add'); exit; } else { $filesize += $image['size']; $tmpfiles[$key] = t_image_save2tmp($upfile, $sessid, "d_{$key}", $image['format']); } } } $category_list = array_unique(preg_split('/\\s+/', $category)); if (count($category_list) > 5) { $_REQUEST['msg'] = 'カテゴリは5つまでしか指定できません'; openpne_forward('pc', 'page', 'h_diary_add'); exit; } foreach ($category_list as $value) { if (mb_strwidth($value) > 20) { $_REQUEST['msg'] = 'カテゴリはひとつにつき全角10文字(半角20文字)以内で入力してください'; openpne_forward('pc', 'page', 'h_diary_add'); exit; } } // 画像アップロード可能サイズチェック if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'diary'); if ($result) { if ($result == 2) { $result = 3; } $msg = util_image_get_upload_err_msg($result); $_REQUEST['msg'] = $msg; openpne_forward('pc', 'page', 'h_diary_add'); exit; } } $this->set('inc_navi', fetch_inc_navi('h')); //プロフィール $this->set("member", db_member_c_member4c_member_id($u)); $form_val = array("subject" => $subject, "body" => $body, "public_flag" => $public_flag, "upfile_1" => $_FILES['upfile_1'], "upfile_2" => $_FILES['upfile_2'], "upfile_3" => $_FILES['upfile_3'], "tmpfile_1" => $tmpfiles[1], "tmpfile_2" => $tmpfiles[2], "tmpfile_3" => $tmpfiles[3], "category" => join(" ", $category_list), "is_comment_input" => $is_comment_input); $this->set("form_val", $form_val); return 'success'; }
function execute($requests) { if (!OPENPNE_USE_ALBUM) { handle_kengen_error(); } $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $target_c_album_id = $requests['target_c_album_id']; $subject = $requests['subject']; $description = $requests['description']; $public_flag = $requests['public_flag']; // ---------- //--- 権限チェック $c_album = db_album_get_c_album4c_album_id($target_c_album_id); if ($c_album['c_member_id'] != $u) { handle_kengen_error(); } //--- //写真データ一時ファイル削除 $sessid = session_id(); t_image_clear_tmp($sessid); $upfiles = array(1 => $_FILES['upfile_1']); $tmpfiles = array(1 => ''); $filesize = 0; foreach ($upfiles as $key => $upfile) { if ($upfile['error'] !== UPLOAD_ERR_NO_FILE) { if (!($image = t_check_image($upfile))) { $_REQUEST['msg'] = '写真は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください'; openpne_forward('pc', 'page', 'h_album_cover_edit'); exit; } else { $filesize += $image['size']; $tmpfiles[$key] = t_image_save2tmp($upfile, $sessid, "a_{$target_c_album_id}_{$key}", $image['format']); } } } // 画像アップロード可能サイズチェック if ($filesize) { $del_file = array(); if ($c_album['album_cover_image']) { $del_file[] = $c_album['album_cover_image']; } $result = util_image_check_change_image_upload($filesize, $del_file, $u, 'other'); if ($result) { $sessid = session_id(); t_image_clear_tmp($sessid); $_REQUEST['msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', 'h_album_cover_edit'); exit; } } $this->set('inc_navi', fetch_inc_navi("h")); $form_val = array("target_c_album_id" => $target_c_album_id, "subject" => $subject, "description" => $description, "public_flag" => $public_flag, "upfile_1" => $_FILES['upfile_1'], "tmpfile_1" => $tmpfiles[1]); $this->set("form_val", $form_val); return 'success'; }
function execute($requests) { if (!OPENPNE_USE_ALBUM) { handle_kengen_error(); } $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $subject = $requests['subject']; $description = $requests['description']; $public_flag = $requests['public_flag']; // ---------- $upfile_obj = $_FILES['image_filename']; //表紙の写真 if (!empty($upfile_obj) && $upfile_obj['error'] !== UPLOAD_ERR_NO_FILE) { if (!($image = t_check_image($upfile_obj))) { $err_msg[] = '写真は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください'; } else { // 画像アップロード可能サイズチェック $result = util_image_check_add_image_upload($image['size'], $u, 'other'); if ($result) { $err_msg[] = util_image_get_upload_err_msg($result); } } } if ($err_msg) { $_REQUEST['err_msg'] = $err_msg; openpne_forward('pc', 'page', "h_album_add"); exit; } $this->set('inc_navi', fetch_inc_navi('h')); //写真をvar/tmpフォルダにコピー $sessid = session_id(); t_image_clear_tmp($sessid); if (file_exists($upfile_obj["tmp_name"])) { $tmpfile = t_image_save2tmp($upfile_obj, $sessid, "c"); } $form_val = array("subject" => $subject, "description" => $description, "public_flag" => $public_flag, 'tmpfile' => $tmpfile, 'image_filename' => $upfile_obj['name']); $this->set("form_val", $form_val); return 'success'; }
function execute($requests) { if (!OPENPNE_USE_ALBUM) { handle_kengen_error(); } $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $target_c_album_id = $requests['target_c_album_id']; $subject = $requests['subject']; $image_description1 = $requests['image_description1']; $image_description2 = $requests['image_description2']; $image_description3 = $requests['image_description3']; $image_description4 = $requests['image_description4']; $image_description5 = $requests['image_description5']; // ---------- $c_album = db_album_get_c_album4c_album_id($target_c_album_id); if ($c_album['c_member_id'] != $u) { handle_kengen_error(); } $sessid = session_id(); t_image_clear_tmp($sessid); $upfiles = array(1 => $_FILES['upfile_1'], $_FILES['upfile_2'], $_FILES['upfile_3'], $_FILES['upfile_4'], $_FILES['upfile_5']); $tmpfiles = array(1 => '', '', '', '', ''); $is_set_file = false; foreach ($upfiles as $key => $upfile) { if ($upfile['name']) { $is_set_file = true; break; } } if (!$is_set_file) { $_REQUEST['msg'] = '写真を指定してください'; openpne_forward('pc', 'page', 'h_album_image_add'); exit; } $filesize_all = 0; foreach ($upfiles as $key => $upfile) { if ($upfile['error'] !== UPLOAD_ERR_NO_FILE) { if (!($image = t_check_image($upfile))) { $_REQUEST['msg'] = '写真は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください'; openpne_forward('pc', 'page', 'h_album_image_add'); exit; } else { $filesize_all += $image['size']; $tmpfiles[$key] = t_image_save2tmp($upfile, $sessid, "a_{$target_c_album_id}_{$key}", $image['format']); } } } // 画像アップロード可能サイズチェック $result = util_image_check_add_image_upload($filesize_all, $u, 'album'); if ($result) { if ($result == 2) { $result = 3; } t_image_clear_tmp($sessid); $msg = util_image_get_upload_err_msg($result); $p = array('msg' => $msg, 'target_c_album_id' => $target_c_album_id); openpne_redirect('pc', 'page_h_album_image_add', $p); } if (!db_album_is_insertable4c_member_id($u, $filesize_all)) { t_image_clear_tmp($sessid); $msg = 'これ以上写真を投稿することができません。'; if (!db_album_is_insertable4c_member_id($u)) { $msg .= '登録済みの写真を削除してからやり直してください。'; } else { $msg .= '投稿する写真を減らすか、ファイルサイズを変更してやり直してください。'; } $p = array('msg' => $msg, 'target_c_album_id' => $target_c_album_id); openpne_redirect('pc', 'page_h_album_image_add', $p); } $this->set('inc_navi', fetch_inc_navi('h')); $form_val = array("target_c_album_id" => $target_c_album_id, "subject" => $subject, "upfile_1" => $_FILES['upfile_1'], "upfile_2" => $_FILES['upfile_2'], "upfile_3" => $_FILES['upfile_3'], "upfile_4" => $_FILES['upfile_4'], "upfile_5" => $_FILES['upfile_5'], "tmpfile_1" => $tmpfiles[1], "tmpfile_2" => $tmpfiles[2], "tmpfile_3" => $tmpfiles[3], "tmpfile_4" => $tmpfiles[4], "tmpfile_5" => $tmpfiles[5]); //ファイル写真を指定しているものだけ説明文を設定 foreach ($tmpfiles as $key => $tmpfile) { $name = "image_description{$key}"; if ($tmpfile) { $form_val["{$name}"] = ${$name}; } } $this->set("form_val", $form_val); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $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': if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($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; } //画像ファイル $upfile_obj1 = $_FILES['image_filename1']; $upfile_obj2 = $_FILES['image_filename2']; $upfile_obj3 = $_FILES['image_filename3']; //添付ファイル $upfile_obj4 = $_FILES['uploadfile']; $err_msg = array(); $filesize = 0; 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['err_msg'] = $err_msg; openpne_forward('pc', 'page', "c_topic_add"); exit; } $sessid = session_id(); //----- t_image_clear_tmp($sessid); t_file_clear_tmp($sessid); //画像をvar/tmpフォルダにコピー $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", $c_commu_id)); $c_topic = array('c_commu_id' => $c_commu_id, 'title' => $title, 'body' => $body, 'image_filename1_tmpfile' => $tmpfile1, 'image_filename2_tmpfile' => $tmpfile2, 'image_filename3_tmpfile' => $tmpfile3, 'image_filename1' => $upfile_obj1["name"], 'image_filename2' => $upfile_obj2["name"], 'image_filename3' => $upfile_obj3["name"], 'filename4_tmpfile' => $tmpfile4, 'filename4_original_filename' => $upfile_obj4["name"]); $this->set('c_topic', $c_topic); return 'success'; }
function execute($requests) { if (!OPENPNE_USE_ALBUM) { handle_kengen_error(); } $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $target_c_album_image_id = $requests['target_c_album_image_id']; $image_description = $requests['image_description']; // ---------- $sessid = session_id(); t_image_clear_tmp($sessid); // アルバムの写真データ取得 $c_album_image = db_album_image_get_c_album_image4id($target_c_album_image_id); $target_c_album_id = $c_album_image['c_album_id']; //アルバムデータ取得 $c_album = db_album_get_c_album4c_album_id($target_c_album_id); //--- 権限チェック if ($u != $c_album['c_member_id']) { handle_kengen_error(); } $upfile = $_FILES['upfile_1']; $tmpfile = ''; if ($upfile['error'] !== UPLOAD_ERR_NO_FILE) { if (!($image = t_check_image($upfile))) { $_REQUEST['msg'] = '写真は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください'; openpne_forward('pc', 'page', 'h_album_image_edit'); exit; } $tmpfile = t_image_save2tmp($upfile, $sessid, "a_{$target_c_album_id}_1", $image['format']); // 画像アップロード可能サイズチェック $del_file = array(); if ($c_album_image['image_filename']) { $del_file[] = $c_album_image['image_filename']; } $result = util_image_check_change_image_upload($image['size'], $del_file, $u, 'album'); if ($result) { t_image_clear_tmp($sessid); $msg = util_image_get_upload_err_msg($result); $p = array('msg' => $msg, 'target_c_album_id' => $target_c_album_id, 'target_c_album_image_id' => $target_c_album_image_id); openpne_redirect('pc', 'page_h_album_image_edit', $p); } // 置き換えたときのファイルサイズを出すために、追加ファイルサイズから置き換わるファイルサイズを減算 $filesize = $upfile['size'] - $c_album_image['filesize']; if (!db_album_is_insertable4c_member_id($u, $filesize)) { t_image_clear_tmp($sessid); $msg = 'これ以上写真を投稿することができません。'; if (!db_album_is_insertable4c_member_id($u)) { $msg .= '登録済みの写真を削除してからやり直してください。'; } else { $msg .= 'ファイルサイズを変更してやり直してください。'; } $p = array('msg' => $msg, 'target_c_album_id' => $target_c_album_id, 'target_c_album_image_id' => $target_c_album_image_id); openpne_redirect('pc', 'page_h_album_image_edit', $p); } } $this->set('inc_navi', fetch_inc_navi("h")); $form_val = array("target_c_album_id" => $target_c_album_id, "target_c_album_image_id" => $target_c_album_image_id, "image_description" => $image_description, "upfile_1" => $upfile, "tmpfile_1" => $tmpfile); $this->set("form_val", $form_val); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $name = $requests['name']; $c_commu_category_id = $requests['c_commu_category_id']; $info = $requests['info']; $is_admit = $requests['is_admit']; $is_open = $requests['is_open']; // ---------- $upfile_obj = $_FILES['image_filename']; //Category Check if (!db_commu_c_commu_category4is_create_commu()) { openpne_redirect('pc', 'page_h_err_c_commu_add'); } //TODO: $err_msg = array(); if (db_commu_is_commu4c_commu_name($name)) { $err_msg[] = 'その' . WORD_COMMUNITY . 'はすでに存在します'; } if (!db_commu_c_commu_category_is_create_commu($c_commu_category_id)) { $err_msg[] = '指定されたカテゴリは選択できません'; } if (!empty($upfile_obj) && $upfile_obj['error'] !== UPLOAD_ERR_NO_FILE) { if (!($image = t_check_image($upfile_obj))) { $err_msg[] = '画像は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください'; } // 画像アップロード可能サイズチェック $filesize = $image['size']; $result = util_image_check_add_image_upload($filesize, $u, 'other'); if ($result) { $err_msg[] = util_image_get_upload_err_msg($result); } } if ($err_msg) { $_REQUEST['err_msg'] = $err_msg; openpne_forward('pc', 'page', "h_com_add"); exit; } //----- $this->set('inc_navi', fetch_inc_navi('h')); $c_commu_category_list = db_commu_c_commu_category4null(); $public_flag_list = array('is_admit' => array('public' => '誰でも参加可能', 'auth' => '管理者の承認が必要'), 'is_open' => array('public' => '全員に公開', 'member' => WORD_COMMUNITY . '参加者にのみ公開')); foreach ($c_commu_category_list as $each_c_commu_categfory) { if ($each_c_commu_categfory['c_commu_category_id'] == $c_commu_category_id) { $c_commu_category_value = $each_c_commu_categfory['name']; } } $is_admit_value = $public_flag_list['is_admit'][$is_admit]; $is_open_value = $public_flag_list['is_open'][$is_open]; $this->set("c_commu_category_value", $c_commu_category_value); $this->set("is_admit_value", $is_admit_value); $this->set("is_open_value", $is_open_value); //画像をvar/tmpフォルダにコピー $sessid = session_id(); t_image_clear_tmp($sessid); if (file_exists($upfile_obj["tmp_name"])) { $tmpfile = t_image_save2tmp($upfile_obj, $sessid, "c"); } $form_val = array('name' => $name, 'c_commu_category_id' => $c_commu_category_id, 'info' => $info, 'is_admit' => $is_admit, 'is_open' => $is_open, 'tmpfile' => $tmpfile, 'image_filename' => $upfile_obj['name']); $this->set("form_val", $form_val); 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'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $target_c_diary_id = $requests['target_c_diary_id']; $body = $requests['body']; // ---------- $target_diary = db_diary_get_c_diary4id($target_c_diary_id); $target_c_member_id = $target_diary['c_member_id']; if (!$target_c_member_id) { $target_c_member_id = $u; } if ($target_c_member_id == $u) { $type = 'h'; } else { $type = 'f'; $target_c_member = db_member_c_member4c_member_id($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 && !$target_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; } $sessid = session_id(); t_image_clear_tmp($sessid); $upfiles = array(1 => $_FILES['upfile_1'], $_FILES['upfile_2'], $_FILES['upfile_3']); $tmpfiles = array(1 => '', '', ''); $filesize = 0; foreach ($upfiles as $key => $upfile) { if (!empty($upfile) && $upfile['error'] !== UPLOAD_ERR_NO_FILE) { if (!($image = t_check_image($upfile))) { $_REQUEST['msg'] = '画像は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください'; openpne_forward('pc', 'page', 'fh_diary'); exit; } else { $filesize += $image['size']; $tmpfiles[$key] = t_image_save2tmp($upfile, $sessid, "dc_{$key}", $image['format']); } } } //---画像アップロードサイズチェック 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; } } $this->set('inc_navi', fetch_inc_navi($type, $target_c_member_id)); $form_val = array("target_c_diary_id" => $target_c_diary_id, "body" => $body, "upfile_1" => $_FILES['upfile_1'], "upfile_2" => $_FILES['upfile_2'], "upfile_3" => $_FILES['upfile_3'], "tmpfile_1" => $tmpfiles[1], "tmpfile_2" => $tmpfiles[2], "tmpfile_3" => $tmpfiles[3]); $this->set("form_val", $form_val); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $form_val['target_c_member_id'] = $requests['target_c_member_id']; $form_val['subject'] = $requests['subject']; $form_val['body'] = $requests['body']; $form_val['target_c_message_id'] = $requests['target_c_message_id']; $form_val['jyusin_c_message_id'] = $requests['jyusin_c_message_id']; $save = $requests['save']; // ---------- $sessid = session_id(); t_image_clear_tmp($sessid); if ($form_val['target_c_member_id'] == $u) { // 自分にメッセージは送れない handle_kengen_error(); } $upfiles = array(1 => $_FILES['upfile_1'], $_FILES['upfile_2'], $_FILES['upfile_3']); $tmpfiles = array(1 => '', '', ''); //添付ファイル $upfile_4 = $_FILES['uploadfile']; $target_member = db_member_c_member4c_member_id($form_val['target_c_member_id']); if (empty($target_member)) { handle_kengen_error(); } $filesize = 0; foreach ($upfiles as $key => $upfile) { if (!empty($upfile) && $upfile['error'] !== UPLOAD_ERR_NO_FILE) { if (!($image = t_check_image($upfile))) { $_REQUEST['msg'] = '画像は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください'; openpne_forward('pc', 'page', 'f_message_send'); exit; } else { $filesize += $image['size']; $tmpfiles[$key] = t_image_save2tmp($upfile, $sessid, "d_{$key}", $image['format']); } } } //---画像アップロードサイズチェック if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'other'); if ($result) { if ($result == 2) { $result = 3; } $_REQUEST['msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', 'f_message_send'); exit; } } if (OPENPNE_USE_FILEUPLOAD) { if (!empty($upfile_4) && $upfile_4['error'] !== UPLOAD_ERR_NO_FILE) { // ファイルサイズ制限 if ($upfile_4['size'] === 0 || $upfile_4['size'] > FILE_MAX_FILESIZE * 1024) { $err_msg[] = 'ファイルは' . FILE_MAX_FILESIZE . 'KB以内のファイルにしてください(ただし空のファイルはアップロードできません)'; } // 拡張子制限 if (!util_check_file_extention($upfile_4['name'])) { $err_msg[] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string')); } } } $form_val['upfile_1'] = $_FILES['upfile_1']; $form_val['upfile_2'] = $_FILES['upfile_2']; $form_val['upfile_3'] = $_FILES['upfile_3']; $form_val['tmpfile_1'] = $tmpfiles[1]; $form_val['tmpfile_2'] = $tmpfiles[2]; $form_val['tmpfile_3'] = $tmpfiles[3]; if (OPENPNE_USE_FILEUPLOAD) { $form_val['upfile_4'] = $upfile_4; $form_val['tmpfile_4'] = t_file_save2tmp($upfile_4, $sessid, "tc_4"); } $target_c_member_id = $form_val['target_c_member_id']; if (db_member_is_access_block($u, $target_c_member_id)) { openpne_redirect('pc', 'page_h_access_block'); } $this->set('inc_navi', fetch_inc_navi("f", $target_c_member_id)); //ターゲット情報 $this->set("target_member", $target_member); //ターゲットのid $this->set("target_c_member_id", $form_val['target_c_member_id']); $this->set("form_val", $form_val); //下書き保存 if (!empty($save)) { //下書き保存が存在しない if ($form_val['target_c_message_id'] == $form_val['jyusin_c_message_id']) { db_message_insert_message_to_is_save($form_val['target_c_member_id'], $u, $form_val['subject'], $form_val['body'], $_REQUEST['jyusin_c_message_id']); } else { //下書き保存が存在する db_message_update_message_to_is_save($form_val['target_c_message_id'], $form_val['subject'], $form_val['body']); } $p = array('msg' => 2); openpne_redirect('pc', 'page_h_reply_message', $p); } return 'success'; }
/** * アップロードされた画像をワンアクションでc_imageに登録する時に使用 * * @params array $upfile_obj * @params string $prefix * @return string 画像ファイル名 | 失敗時false */ function image_insert_c_image_direct($upfile_obj, $prefix, $c_member_id = 0) { if (!file_exists($upfile_obj['tmp_name'])) { return false; } $sessid = session_id(); t_image_clear_tmp($sessid); $tmpfile = t_image_save2tmp($upfile_obj, $sessid, $prefix); if (!$tmpfile) { t_image_clear_tmp($sessid); return false; } $image_filename = image_insert_c_image4tmp($prefix, $tmpfile, $c_member_id); t_image_clear_tmp($sessid); return $image_filename; }
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'; }