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)
 {
     $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['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';
 }
示例#4
0
 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';
 }
示例#5
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $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);
 }
示例#10
0
function _db_is_c_topic_admin($c_commu_topic_id, $c_member_id)
{
    return db_commu_is_c_topic_admin($c_commu_topic_id, $c_member_id);
}
示例#11
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $err_msg = $requests['err_msg'];
     // ----------
     $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
     $c_commu_id = $c_topic['c_commu_id'];
     //--- 権限チェック
     if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if (!db_commu_is_c_topic_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id);
     if ($c_commu['is_topic'] == 'admin_only' && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if ($c_commu['is_topic'] == 'member' && !db_commu_is_c_commu_member($c_commu_id, $u)) {
         handle_kengen_error();
     }
     //---
     if (!$c_topic['event_flag']) {
         openpne_redirect('ktai', 'page_c_topic_edit', array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id']));
     }
     $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id));
     $this->set("year", db_commu_year4null());
     $this->set('month', p_regist_prof_c_profile_month_list4null());
     $this->set('day', p_regist_prof_c_profile_day_list4null());
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $this->set('err_msg', $err_msg);
     //編集確認画面でエラーがでたときここに戻ってくる。そのときのためにrequestから取得
     //保留
     if ($err_msg) {
         $c_topic_temp = p_c_event_add_confirm_event4request();
         $c_topic['name'] = $c_topic_temp['title'];
         $c_topic['body'] = $c_topic_temp['detail'];
         $c_topic['open_date_comment'] = $c_topic_temp['open_date_comment'];
         $c_topic['open_pref_id'] = $c_topic_temp['open_pref_id'];
         $c_topic['open_pref_comment'] = $c_topic_temp['open_pref_comment'];
         $c_topic['open_date_year'] = $c_topic_temp['open_date_year'];
         $c_topic['open_date_month'] = $c_topic_temp['open_date_month'];
         $c_topic['open_date_day'] = $c_topic_temp['open_date_day'];
         $c_topic['invite_period_year'] = $c_topic_temp['invite_period_year'];
         $c_topic['invite_period_month'] = $c_topic_temp['invite_period_month'];
         $c_topic['invite_period_day'] = $c_topic_temp['invite_period_day'];
     } else {
         $open_date_arr = explode("-", $c_topic['open_date']);
         $invite_period_arr = explode("-", $c_topic['invite_period']);
         $c_topic['open_date_year'] = $open_date_arr[0];
         $c_topic['open_date_month'] = $open_date_arr[1];
         $c_topic['open_date_day'] = $open_date_arr[2];
         $c_topic['invite_period_year'] = $invite_period_arr[0];
         $c_topic['invite_period_month'] = $invite_period_arr[1];
         $c_topic['invite_period_day'] = $invite_period_arr[2];
     }
     $this->set('event', $c_topic);
     return 'success';
 }
 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);
 }
示例#13
0
 /**
  * トピック・イベント写真変更
  */
 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;
     }
 }
示例#14
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $err_msg = $requests['err_msg'];
     // ----------
     $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
     $c_commu_id = $c_topic['c_commu_id'];
     //--- 権限チェック
     if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if (!db_commu_is_c_topic_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id);
     if ($c_commu['is_topic'] == 'admin_only' && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if ($c_commu['is_topic'] == 'member' && !db_commu_is_c_commu_member($c_commu_id, $u)) {
         handle_kengen_error();
     }
     //---
     if (!$c_topic['event_flag']) {
         $p = array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id']);
         openpne_redirect('pc', 'page_c_topic_edit', $p);
     }
     if (!empty($c_topic['filename'])) {
         $c_topic['original_filename'] = db_file_original_filename4filename($c_topic['filename']);
     }
     $this->set('inc_navi', fetch_inc_navi("c", $c_commu_id));
     $this->set("year", db_commu_year4null());
     $this->set('month', p_regist_prof_c_profile_month_list4null());
     $this->set('day', p_regist_prof_c_profile_day_list4null());
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $this->set('err_msg', $err_msg);
     //編集確認画面でエラーがでたときここに戻ってくる。そのときのためにrequestから取得
     //保留
     if ($err_msg) {
         $c_topic_temp = p_c_event_add_confirm_event4request();
         $c_topic['name'] = $c_topic_temp['title'];
         $c_topic['body'] = $c_topic_temp['detail'];
         $c_topic['open_date_comment'] = $c_topic_temp['open_date_comment'];
         $c_topic['open_pref_id'] = $c_topic_temp['open_pref_id'];
         $c_topic['open_pref_comment'] = $c_topic_temp['open_pref_comment'];
         $c_topic['open_date_year'] = $c_topic_temp['open_date_year'];
         $c_topic['open_date_month'] = $c_topic_temp['open_date_month'];
         $c_topic['open_date_day'] = $c_topic_temp['open_date_day'];
         $c_topic['invite_period_year'] = $c_topic_temp['invite_period_year'];
         $c_topic['invite_period_month'] = $c_topic_temp['invite_period_month'];
         $c_topic['invite_period_day'] = $c_topic_temp['invite_period_day'];
     } else {
         $open_date_arr = explode("-", $c_topic['open_date']);
         $invite_period_arr = explode("-", $c_topic['invite_period']);
         $c_topic['open_date_year'] = $open_date_arr[0];
         $c_topic['open_date_month'] = $open_date_arr[1];
         $c_topic['open_date_day'] = $open_date_arr[2];
         $c_topic['invite_period_year'] = $invite_period_arr[0];
         $c_topic['invite_period_month'] = $invite_period_arr[1];
         $c_topic['invite_period_day'] = $invite_period_arr[2];
     }
     $this->set('event', $c_topic);
     // 許可されている拡張子のリスト
     $this->set('allowed_extensions', util_get_file_allowed_extensions('string'));
     return 'success';
 }
示例#15
0
 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';
 }
示例#16
0
function db_commu_c_topic_list4target_c_commu_id($c_commu_id, $c_member_id, $page = 1, $page_size = 10, $event_flag = 0, $topic_with_event = 0)
{
    $sql = " SELECT cct.c_commu_topic_id, max(cct.u_datetime) as newest_write_datetime " . " FROM c_commu_topic as cct, c_commu_topic_comment as cctc " . " WHERE cct.c_commu_topic_id = cctc.c_commu_topic_id ";
    if ($topic_with_event) {
        $sql .= " AND cct.event_flag = {$event_flag}";
    }
    $sql .= " AND cct.c_commu_id = ?" . " GROUP BY cct.c_commu_topic_id " . " ORDER BY newest_write_datetime DESC";
    $params = array(intval($c_commu_id));
    $lst = db_get_all_page($sql, $page, $page_size, $params);
    foreach ($lst as $key => $value) {
        $sql = "SELECT cct.c_commu_topic_id, cct.name, cct.u_datetime, cctc.body , cctc.image_filename1, cctc.image_filename2, image_filename3" . " FROM c_commu_topic as cct, c_commu_topic_comment as cctc" . " WHERE cct.c_commu_topic_id = cctc.c_commu_topic_id" . " AND cctc.number = 0" . " AND cct.c_commu_topic_id = ?";
        $params = array(intval($value['c_commu_topic_id']));
        $lst[$key] = db_get_row($sql, $params);
    }
    foreach ($lst as $key => $value) {
        $lst[$key]['is_c_event_member'] = db_commu_is_c_event_member($value['c_commu_topic_id'], $c_member_id);
        $lst[$key]['is_c_topic_admin'] = db_commu_is_c_topic_admin($value['c_commu_topic_id'], $c_member_id);
        $lst[$key]['write_num'] = db_commu_get_max_c_commu_topic_comment_number4c_topic_id($value['c_commu_topic_id']);
    }
    $sql = 'SELECT COUNT(*) FROM c_commu_topic WHERE c_commu_id = ?';
    if ($topic_with_event) {
        $sql .= " AND event_flag = {$event_flag}";
    }
    $params = array(intval($c_commu_id));
    $total_num = db_get_one($sql, $params);
    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($lst, $prev, $next, $total_num, $start_num, $end_num);
}