function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($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(); } //--- if (MAIL_ADDRESS_HASHED) { $mail_address = 'ti' . $c_commu_topic_id . '-' . t_get_user_hash($u) . "@" . MAIL_SERVER_DOMAIN; } else { $mail_address = 'ti' . $c_commu_topic_id . "@" . MAIL_SERVER_DOMAIN; } $mail_address = MAIL_ADDRESS_PREFIX . $mail_address; $this->set('mail_address', $mail_address); $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_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_topic_id = $requests['target_c_commu_topic_id']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); //--- 権限チェック //トピック作成者 or コミュニティ管理者 if (!db_commu_is_c_topic_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_topic_edit', $p); }
function execute($requests) { $topic = db_commu_c_topic4c_commu_topic_id($requests['target_c_commu_topic_id']); if (!$topic) { admin_client_redirect('topic_list', '指定されたトピック・イベントは存在しません'); } db_commu_delete_c_commu_topic($requests['target_c_commu_topic_id']); admin_client_redirect('topic_list', WORD_COMMUNITY . 'トピックを削除しました'); }
function execute($requests) { $id_ary = split(":", $requests['target_c_commu_topic_ids']); foreach ($id_ary as $id) { $topic = db_commu_c_topic4c_commu_topic_id($id); if (!$topic) { admin_client_redirect('topic_list', '指定されたトピック・イベントは存在しません'); } } foreach ($id_ary as $id) { db_commu_delete_c_commu_topic($id); } admin_client_redirect('topic_list', WORD_COMMUNITY . 'トピックを削除しました'); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $c_commu_topic_comment_id = $requests['target_c_commu_topic_comment_id']; // ---------- if (!$c_commu_topic_id && !$c_commu_topic_comment_id) { handle_kengen_error(); } if ($c_commu_topic_comment_id) { $c_topic_comment = db_commu_c_commu_topic_comment4c_commu_topic_comment_id($c_commu_topic_comment_id); $c_commu_id = $c_topic_comment['c_commu_id']; $filename = $c_topic_comment['filename']; } else { $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; $filename = $c_topic['filename']; } //--- 権限チェック //コミュニティ参加者 $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_bbs_view']) { handle_kengen_error(); } // ファイルアップロード機能がオフ if (!OPENPNE_USE_FILEUPLOAD) { handle_kengen_error(); } // ファイルが存在しない $file = db_file_c_file4filename($filename); if (empty($file)) { handle_kengen_error(); } // オリジナルファイル名 $original_filename = $file['original_filename']; if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { // IE の場合のみ、ファイル名を SJIS に変換し、キャッシュをさせないヘッダを出力しない $original_filename = mb_convert_encoding($original_filename, 'SJIS', 'UTF-8'); } else { send_nocache_headers(true); } $original_filename = str_replace(array("\r", "\n"), '', $original_filename); header('Content-Disposition: attachment; filename="' . $original_filename . '"'); header('Content-Length: ' . strlen($file['bin'])); header('Content-Type: application/octet-stream'); echo $file['bin']; exit; }
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['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['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($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(); } //--- $this->set('c_commu_id', $c_commu_id); $this->set('c_commu_topic', $c_topic); $this->set('c_commu_topic_id', $c_commu_topic_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']; $img_num = $requests['img_num']; // ---------- $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(); } //--- $target_image_filename = ''; switch ($img_num) { case '1': $target_image_filename = $c_topic['image_filename1']; break; case '2': $target_image_filename = $c_topic['image_filename2']; break; case '3': $target_image_filename = $c_topic['image_filename3']; break; } if (empty($target_image_filename)) { handle_kengen_error(); } $this->set('c_topic', $c_topic); $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id)); $this->set('img_num', $img_num); $this->set('target_image_filename', $target_image_filename); 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']; $img_num = $requests['img_num']; // ---------- $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(); } //--- $target_image_filename = ''; switch ($img_num) { case '1': $target_image_filename = $c_topic['image_filename1']; break; case '2': $target_image_filename = $c_topic['image_filename2']; break; case '3': $target_image_filename = $c_topic['image_filename3']; break; } if (empty($target_image_filename)) { handle_kengen_error(); } db_image_data_delete($target_image_filename, $u); db_commu_delete_c_commu_topic_comment_image($c_commu_topic_id, $img_num); $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('ktai', 'page_c_topic_edit_image', $p); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; $tail = $GLOBALS['KTAI_URL_TAIL']; // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $body = $requests['body']; $title = $requests['title']; // ---------- //--- 権限チェック //トピック作成者 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(); } //--- $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); 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('ktai', 'page_c_bbs', $p); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_commu_topic_id = $requests['target_c_commu_topic_id']; $c_commu_topic_comment_id = $requests['c_commu_topic_comment_id']; // ---------- $c_topic = db_commu_c_topic4c_commu_topic_id($target_c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; $c_commu_topic_comment = db_commu_c_commu_topic_comment4c_commu_topic_comment_id_2($c_commu_topic_comment_id); $c_commu_topic_comment['original_filename'] = db_file_original_filename4filename($c_commu_topic_comment['filename']); //--- 権限チェック $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_admin'] && $c_commu_topic_comment['c_member_id'] != $u) { handle_kengen_error(); } //--- //トピック名 $this->set("c_commu_topic_name", $c_topic['name']); $this->set('c_commu_topic_comment', $c_commu_topic_comment); $this->set("c_commu_topic_id", $target_c_commu_topic_id); $this->set("c_commu_topic_comment_id", $c_commu_topic_comment_id); return 'success'; }
function c_topic_detail_c_topic4c_commu_topic_id($c_commu_topic_id) { return db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); }
function get_main_data($input, $id) { //日記の場合 if ($input['data_type'] < 2) { $data = db_diary_get_c_diary4id($id); $ret['subject'] = $data['subject']; $ret['datetime'] = $this->conv_timestamp_to_datetime(strtotime($data['r_datetime'])); $ret['description'] = array('id' => $data['c_member_id'], 'isopen' => $data['public_flag'], 'contents' => $data['body']); //トピック・イベントの場合 } else { //トピック if ($input['data_type'] < 4) { $data = db_commu_c_topic4c_commu_topic_id($id); //イベント } else { $data = db_commu_c_topic4c_commu_topic_id_2($id); } $commu = db_commu_c_commu4c_commu_id($data['c_commu_id']); $ret['subject'] = $data['name']; $ret['datetime'] = $this->conv_timestamp_to_datetime(strtotime($data['r_datetime'])); $ret['description'] = array('id' => $data['c_member_id'], 'isopen' => $commu['public_flag'], 'community' => $commu['name'], 'contents' => $data['body']); //イベントに限り参加人数・開催日を追記 if ($input['data_type'] >= 4) { $ret['description'] += array('number' => $data['member_num'], 'opendate' => $data['open_date']); } } return $ret; }
/** * 画像リスト取得 */ function kanshi_get_image_list($updated_from, $updated_to, $offset, $limit) { $sql = " SELECT\n c_image_id as data_id,\n filename as title,\n r_datetime\n "; $sql .= " FROM c_image"; $sql .= " WHERE 1"; $params = array(); if (!empty($updated_from)) { $sql .= " AND r_datetime > ?"; $params[] = $updated_from; } if (!empty($updated_to)) { $sql .= " AND r_datetime < ?"; $params[] = $updated_to; } $sql .= " ORDER BY r_datetime"; if (!empty($offset) || !empty($limit)) { if (empty($offset)) { $offset = 0; } if (empty($limit)) { $limit = count(db_get_col($sql, $params)) - $offset; } $c_image_list = db_get_all_limit($sql, $offset, $limit, $params); } else { $c_image_list = db_get_all($sql, $params); } if (count($c_image_list) > 0) { foreach ($c_image_list as $num => $c_image) { $c_image_list[$num]['image_url'] = OPENPNE_URL . 'img.php?filename=' . $c_image['title']; $temp = explode("_", $c_image['title']); switch ($temp[0]) { case 'm': //メンバー画像 $c_image_list[$num]['creator'] = $temp[1]; $c_image_list[$num]['c_member'] = db_member_c_member4c_member_id($temp[1], true, true, 'private'); $c_image_list[$num]['refer_data_url'] = OPENPNE_URL . '&a=page_f_home&target_c_member_id=' . $temp[1]; break; case 'c': //コミュニティ画像 $id = db_commu_c_commu4c_commu_id($temp[1]); $c_image_list[$num]['creator'] = $id['c_member_id_admin']; $c_image_list[$num]['c_member'] = db_member_c_member4c_member_id($id['c_member_id_admin'], true, true, 'private'); $c_image_list[$num]['refer_watch_type_id'] = 3; $c_image_list[$num]['refer_data_id'] = $temp[1]; $c_image_list[$num]['refer_data_url'] = OPENPNE_URL . '&a=page_c_home&target_c_commu_id=' . $temp[1]; break; case 'd': //日記画像 $id = db_diary_get_c_diary4id($temp[1]); $c_image_list[$num]['creator'] = $id['c_member_id']; $c_image_list[$num]['c_member'] = db_member_c_member4c_member_id($id['c_member_id'], true, true, 'private'); $c_image_list[$num]['refer_watch_type_id'] = 1; $c_image_list[$num]['refer_data_id'] = $temp[1]; $c_image_list[$num]['refer_data_url'] = OPENPNE_URL . '&a=page_fh_diary&target_c_diary_id=' . $temp[1]; break; case 'dc': //日記コメント画像 $id = _do_c_diary_comment4c_diary_comment_id($temp[1]); $c_image_list[$num]['creator'] = $id['c_member_id']; $c_image_list[$num]['c_member'] = db_member_c_member4c_member_id($id['c_member_id'], true, true, 'private'); $c_image_list[$num]['refer_watch_type_id'] = 4; $c_image_list[$num]['refer_data_id'] = $temp[1]; $c_image_list[$num]['refer_data_url'] = OPENPNE_URL . '&a=page_fh_diary&target_c_diary_id=' . $id['c_diary_id']; break; case 't': //トピック、イベント画像 $id = db_commu_c_topic4c_commu_topic_id($temp[1]); $c_image_list[$num]['creator'] = $id['c_member_id']; $c_image_list[$num]['c_member'] = db_member_c_member4c_member_id($id['c_member_id'], true, true, 'private'); $c_image_list[$num]['refer_watch_type_id'] = 2; $c_image_list[$num]['refer_data_id'] = $temp[1]; $c_image_list[$num]['refer_data_url'] = OPENPNE_URL . '&a=page_c_topic_detail&target_c_commu_topic_id=' . $temp[1]; break; case 'tc': //トピック、イベントコメント画像 $id = db_commu_c_commu_topic_comment4c_commu_topic_comment_id_2($temp[1]); $c_image_list[$num]['creator'] = $id['c_member_id']; $c_image_list[$num]['c_member'] = db_member_c_member4c_member_id($id['c_member_id'], true, true, 'private'); $c_image_list[$num]['refer_watch_type_id'] = 5; $c_image_list[$num]['refer_data_id'] = $temp[1]; $c_image_list[$num]['param'] = '&a=page_c_topic_detail&target_c_commu_topic_id=' . $id['c_commu_topic_id']; break; } } } return $c_image_list; }
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 add_topic_image($c_commu_topic_id) { if (!($c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id))) { return false; } $c_commu_id = $c_topic['c_commu_id']; if (!db_commu_is_c_topic_admin($c_commu_topic_id, $this->c_member_id) && !db_commu_is_c_commu_admin($c_commu_id, $this->c_member_id)) { return false; } // 登録する写真番号(1-3)を決める $target_number = 0; if ($c_topic['image_filename1'] || $c_topic['image_filename2'] || $c_topic['image_filename3']) { if (!$c_topic['image_filename1']) { $target_number = 1; } elseif (!$c_topic['image_filename2']) { $target_number = 2; } elseif (!$c_topic['image_filename3']) { $target_number = 3; } else { $this->error_mail('トピック・イベント写真の登録は最大3枚までです。'); m_debug_log('mail_sns::add_topic_image() image is full'); return false; } } else { $target_number = 1; } // 写真登録 if ($images = $this->decoder->get_images()) { $image = $images[0]; $image_ext = $image['ext']; $image_data = $image['data']; $filename = 't_' . $c_commu_topic_id . '_' . $target_number . '_' . time() . '.' . $image_ext; // 画像アップロード可能サイズチェック $filesize = $image['filesize']; $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_topic_image() size over'); return false; } $c_topic['image_filename' . $target_number] = $filename; db_image_insert_c_image($filename, $image_data, $filesize, $this->c_member_id); db_commu_update_c_commu_topic_comment_images($c_topic['c_commu_topic_comment_id'], $c_topic['image_filename1'], $c_topic['image_filename2'], $c_topic['image_filename3']); return true; } else { $this->error_mail('写真が添付されていないか、ファイルサイズが大きすぎるため、登録できませんでした。'); m_debug_log('mail_sns::add_topic_image() no images'); return false; } }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $page = $requests['page']; $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']; $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); //コミュニティの存在の有無 if (!$c_commu) { openpne_redirect('pc', 'page_h_err_c_home'); } //--- 権限チェック //コミュニティ掲示板閲覧権限 if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($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_detail', $p); } $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); $c_topic['original_filename'] = db_file_original_filename4filename($c_topic['filename']); //詳細部分 $this->set('c_commu', $c_commu); $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('body', $body); $this->set('err_msg', $err_msg); $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_topic_admin', db_commu_is_c_topic_admin($c_commu_topic_id, $u)); $this->set('c_member_id', $u); $this->set('is_writable_comment', db_commu_is_writable_c_commu_topic_comment4c_commu_topic_id($c_commu_topic_id)); // 許可されている拡張子のリスト $this->set('allowed_extensions', util_get_file_allowed_extensions('string')); return 'success'; }
function p_access_analysis_target_topic_target_topic4ym_page_name($ymd, $month_flag, $page_name, $ktai_flag, $page, $page_size, $orderby = 1) { $start = ($page - 1) * $page_size; if ($orderby == 1) { $orderby_str = " order by target_c_commu_topic_id asc"; } elseif ($orderby == -1) { $orderby_str = " order by target_c_commu_topic_id desc"; } elseif ($orderby == 2) { $orderby_str = " order by count asc"; } elseif ($orderby == -2) { $orderby_str = " order by count desc"; } $where = " where ktai_flag = ? "; $params = array(intval($ktai_flag)); if ($month_flag) { if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') { $where .= " and to_char(r_datetime, 'YYYY-MM') = ? "; } else { $where .= " and left(r_datetime, 7) = ? "; } array_push($params, substr($ymd, 0, 7)); } else { if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') { $where .= " and to_char(r_datetime, 'YYYY-MM-DD') = ? "; } else { $where .= " and left(r_datetime,10) = ? "; } array_push($params, $ymd); } if ($page_name != "all") { $where .= " and page_name = ? "; array_push($params, $page_name); } $where .= ' and target_c_commu_topic_id <> 0 '; $sql = "select target_c_commu_topic_id , count(*) as count from c_access_log "; $sql .= $where . " group by target_c_commu_topic_id " . $orderby_str; if ($page_size != -1) { $list = db_get_all_limit($sql, $start, $page_size, $params); } else { $list = db_get_all($sql, $params); } $sql = "select count(*) from c_access_log "; $sql .= $where . " group by target_c_commu_topic_id "; $result = db_get_all($sql, $params); $total_num = count($result); $return = array(); $sum = 0; foreach ($list as $key => $value) { if ($value['target_c_commu_topic_id']) { if ($c_commu_topic = db_commu_c_topic4c_commu_topic_id($value['target_c_commu_topic_id'])) { $c_commu_topic['topic_name'] = $c_commu_topic['name']; $c_commu = db_commu_c_commu4c_commu_id($c_commu_topic['c_commu_id']); $c_commu_topic['commu_name'] = $c_commu['name']; $value['is_c_commu_topic_exists'] = true; $return[] = array_merge($value, $c_commu_topic); } else { $value['is_c_commu_topic_exists'] = false; $return[] = $value; } $sum += $value['count']; } } if ($total_num != 0) { $total_page_num = ceil($total_num / $page_size); if ($page >= $total_page_num) { $next = false; } else { $next = true; } if ($page <= 1) { $prev = false; } else { $prev = true; } } $start_num = ($page - 1) * $page_size + 1; $end_num = ($page - 1) * $page_size + $page_size > $total_num ? $total_num : ($page - 1) * $page_size + $page_size; return array($return, $sum, $prev, $next, $total_num, $start_num, $end_num); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $body = $requests['body']; $button = $requests['button']; // ---------- //TODO:画像バリデータ $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_detail"); exit; } //----- $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_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; } //--- $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)); $topic_write['target_c_commu_topic_id'] = $c_commu_topic_id; $topic_write['body'] = $body; $topic_write['image_filename1_tmpfile'] = $tmpfile1; $topic_write['image_filename2_tmpfile'] = $tmpfile2; $topic_write['image_filename3_tmpfile'] = $tmpfile3; $topic_write['image_filename1'] = $upfile_obj1["name"]; $topic_write['image_filename2'] = $upfile_obj2["name"]; $topic_write['image_filename3'] = $upfile_obj3["name"]; $topic_write['filename4_tmpfile'] = $tmpfile4; $topic_write['filename4_original_filename'] = $upfile_obj4["name"]; $this->set('topic_write', $topic_write); return 'success'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); // --- リクエスト変数 $c_commu_topic_id = $requests['target_c_commu_topic_id']; $body = $requests['body']; $tmpfile1 = $requests['image_filename1_tmpfile']; $tmpfile2 = $requests['image_filename2_tmpfile']; $tmpfile3 = $requests['image_filename3_tmpfile']; // ---------- // 添付ファイル if (OPENPNE_USE_FILEUPLOAD) { $filename4_tmpfile = $requests['filename4_tmpfile']; $filename4_original_filename = $requests['filename4_original_filename']; if ($filename4_tmpfile) { // 拡張子制限 if (!util_check_file_extention($filename4_original_filename)) { $_REQUEST['target_c_commu_topic_id'] = $c_commu_topic_id; $_REQUEST['err_msg'] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string')); openpne_forward('pc', 'page', "c_topic_detail"); exit; } } } //--- 権限チェック //コミュニティ参加者 $c_topic = db_commu_c_topic4c_commu_topic_id($c_commu_topic_id); $c_commu_id = $c_topic['c_commu_id']; $c_commu = db_commu_c_commu4c_commu_id($c_commu_id); switch ($c_commu['is_comment']) { case 'public': //誰でもコメント可能 break; case 'member': $status = db_common_commu_status($u, $c_commu_id); if (!$status['is_commu_member']) { handle_kengen_error(); } break; } if (!db_commu_is_writable_c_commu_topic_comment4c_commu_topic_id($c_commu_topic_id)) { $err_msg[] = 'コメントが1000番に達したので、このトピックにはコメントできません'; $_REQUEST['err_msg'] = $err_msg; openpne_forward('pc', 'page', "c_topic_detail"); exit; } //--- //---画像アップロードサイズチェック $filesize = 0; if ($tmpfile1) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_id}_1", $tmpfile1); } if ($tmpfile2) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_id}_2", $tmpfile2); } if ($tmpfile3) { $filesize += util_image_get_c_tmp_filesize4filename("tc_{$insert_id}_3", $tmpfile3); } if ($filesize) { $result = util_image_check_add_image_upload($filesize, $u, 'commu'); if ($result) { if ($result == 2) { $result = 3; } $_REQUEST['err_msg'] = util_image_get_upload_err_msg($result); openpne_forward('pc', 'page', "c_topic_detail"); exit; } } $number = db_commu_c_commu_topic_comment_number4c_commu_topic_id($c_commu_topic_id); $insert_c_commu_topic_comment = array("c_commu_id" => $c_commu_id, "c_member_id" => $u, "body" => $body, "number" => $number, "c_commu_topic_id" => $c_commu_topic_id); $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment); if ($tmpfile1) { $filename1 = image_insert_c_image4tmp("tc_{$insert_id}_1", $tmpfile1, $u); } if ($tmpfile2) { $filename2 = image_insert_c_image4tmp("tc_{$insert_id}_2", $tmpfile2, $u); } if ($tmpfile3) { $filename3 = image_insert_c_image4tmp("tc_{$insert_id}_3", $tmpfile3, $u); } if (OPENPNE_USE_FILEUPLOAD) { // 添付ファイルをDBに入れる if ($filename4_tmpfile) { $filename4 = file_insert_c_file4tmp("tc_{$insert_id}_4", $filename4_tmpfile, $filename4_original_filename); } } t_image_clear_tmp(session_id()); t_file_clear_tmp(session_id()); db_commu_update_c_commu_topic_comment_images($insert_id, $filename1, $filename2, $filename3); db_commu_update_c_commu_topic_comment_file($insert_id, $filename4); //お知らせメール送信(携帯へ) send_bbs_info_mail($insert_id, $u); //お知らせメール送信(PCへ) send_bbs_info_mail_pc($insert_id, $u); if (OPENPNE_USE_POINT_RANK) { //トピック・イベントにコメントした人にポイント付与 $point = db_action_get_point4c_action_id(11); db_point_add_point($u, $point); } $p = array('target_c_commu_topic_id' => $c_commu_topic_id); openpne_redirect('pc', 'page_c_topic_detail', $p); }