コード例 #1
0
 function execute($requests)
 {
     $v = array();
     $target_c_diary_ids = $requests['target_c_diary_ids'];
     // 日記が選択されていない場合はエラー
     if (!$target_c_diary_ids) {
         admin_client_redirect('diary_list', WORD_DIARY . "が選択されていません");
     }
     $ids_ary = split(":", $target_c_diary_ids);
     $v = array();
     $diary_list = array();
     foreach ($ids_ary as $id) {
         $diary = db_diary_get_c_diary4id($id);
         if (!$diary) {
             admin_client_redirect('diary_list', '指定された' . WORD_DIARY . "は存在しません");
         }
         $diary['count_comments'] = db_diary_count_c_diary_comment4c_diary_id($id);
         $member = db_member_c_member4c_member_id($diary['c_member_id']);
         $diary['c_member'] = $member;
         array_push($diary_list, $diary);
     }
     $this->set('diary_list', $diary_list);
     $this->set('target_c_diary_ids', $target_c_diary_ids);
     $v['SNS_NAME'] = SNS_NAME;
     $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     $this->set($v);
     return 'success';
 }
コード例 #2
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     // ----------
     $c_member = db_member_c_member4c_member_id($u);
     if ($target_c_diary_id) {
         $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
         $this->set('target_c_diary', $c_diary);
         if ($c_diary['c_member_id'] != $u) {
             handle_kengen_error();
         }
     } else {
         handle_kengen_error();
     }
     if (MAIL_ADDRESS_HASHED) {
         $mail_address = 'bi' . $target_c_diary_id . '-' . t_get_user_hash($u) . "@" . MAIL_SERVER_DOMAIN;
     } else {
         $mail_address = 'bi' . $target_c_diary_id . "@" . MAIL_SERVER_DOMAIN;
     }
     $mail_address = MAIL_ADDRESS_PREFIX . $mail_address;
     $this->set('mail_address', $mail_address);
     //メンバー情報
     $this->set('member', $c_member);
     return 'success';
 }
コード例 #3
0
 function execute($requests)
 {
     $diary = db_diary_get_c_diary4id($requests['target_c_diary_id']);
     if (!$diary) {
         admin_client_redirect('diary_list', '指定された' . WORD_DIARY . 'は存在しません');
     }
     db_diary_delete_c_diary($requests['target_c_diary_id']);
     admin_client_redirect('diary_list', WORD_DIARY . 'を削除しました');
 }
コード例 #4
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     // ----------
     $this->set('inc_navi', fetch_inc_navi('h'));
     $this->set("target_c_diary", db_diary_get_c_diary4id($target_c_diary_id));
     return 'success';
 }
コード例 #5
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     // ----------
     $this->set('target_c_diary', db_diary_get_c_diary4id($target_c_diary_id));
     $this->set("target_c_diary_id", $target_c_diary_id);
     return 'success';
 }
コード例 #6
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $target_c_diary_comment_id = $requests['target_c_diary_comment_id'];
     // ----------
     // target が指定されていない
     if (!$target_c_diary_id) {
         openpne_redirect('pc', 'page_h_err_fh_diary');
     }
     // target の日記が存在しない
     if (!p_common_is_active_c_diary_id($target_c_diary_id)) {
         openpne_redirect('pc', 'page_h_err_fh_diary');
     }
     $target_diary = db_diary_get_c_diary4id($target_c_diary_id);
     // 削除するコメントがが指定されていない
     if (!$target_c_diary_comment_id) {
         $p = array('target_c_diary_id' => $target_c_diary_id);
         openpne_redirect('pc', 'page_fh_diary', $p);
     }
     // コメントIDが不正
     foreach ($target_c_diary_comment_id as $item) {
         $comment = _do_c_diary_comment4c_diary_comment_id($item);
         if ($comment['c_diary_id'] != $target_c_diary_id || $comment['c_member_id'] != $u && $target_diary['c_member_id'] != $u) {
             $p = array('target_c_diary_id' => $target_c_diary_id);
             openpne_redirect('pc', 'page_fh_diary', $p);
         }
     }
     // オブジェクトの振り分け用
     $target_c_member_id = $target_diary['c_member_id'];
     // inc_navi.tpl
     if ($target_c_member_id == $u) {
         $type = 'h';
         $is_diary_admin = true;
     } else {
         $type = 'f';
         $is_diary_admin = false;
     }
     $this->set('inc_navi', fetch_inc_navi($type, $target_c_member_id));
     $this->set('is_diary_admin', $is_diary_admin);
     $this->set('member', db_member_c_member4c_member_id($u));
     $this->set('target_member', db_member_c_member4c_member_id($target_c_member_id));
     $this->set('target_diary', $target_diary);
     //削除するコメント一覧
     $list = db_diary_get_c_diary_comment_list4id_list($target_c_diary_comment_id);
     $this->set('target_diary_comment_list', array_shift($list));
     //削除するコメントID
     $this->set('target_c_diary_comment_id', $target_c_diary_comment_id);
     return 'success';
 }
コード例 #7
0
 function execute($requests)
 {
     $id_ary = split(":", $requests['target_c_diary_ids']);
     foreach ($id_ary as $id) {
         $diary = db_diary_get_c_diary4id($id);
         if (!$diary) {
             admin_client_redirect('diary_list', '指定された' . WORD_DIARY . 'は存在しません');
         }
     }
     foreach ($id_ary as $id) {
         db_diary_delete_c_diary($id);
     }
     admin_client_redirect('diary_list', WORD_DIARY . 'を削除しました');
 }
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $target_c_diary_comment_id = $requests['target_c_diary_comment_id'];
     // ----------
     $target_c_diary_comment = db_diary_get_c_diary_comment_list4id_list(array($target_c_diary_comment_id));
     $this->set('target_c_diary', db_diary_get_c_diary4id($target_c_diary_id));
     $this->set("target_c_diary_id", $target_c_diary_id);
     $this->set('target_c_diary_comment', $target_c_diary_comment[0][0]);
     $this->set("target_c_diary_comment_id", $target_c_diary_comment_id);
     return 'success';
 }
コード例 #9
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     // ----------
     //--- 権限チェック
     //日記作成者
     $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
     if ($c_diary['c_member_id'] != $u) {
         handle_kengen_error();
     }
     //---
     db_diary_delete_c_diary($target_c_diary_id);
     $p = array('target_c_member_id' => $u);
     openpne_redirect('pc', 'page_fh_diary_list', $p);
 }
コード例 #10
0
 function execute($requests)
 {
     $v = array();
     $target_c_diary_id = $requests['target_c_diary_id'];
     $v = array();
     $diary = db_diary_get_c_diary4id($target_c_diary_id);
     if (!$diary) {
         admin_client_redirect('diary_list', '指定された' . WORD_DIARY . 'は存在しません');
     }
     $diary['count_comments'] = db_diary_count_c_diary_comment4c_diary_id($target_c_diary_id);
     $member = db_member_c_member4c_member_id($diary['c_member_id']);
     $diary['c_member'] = $member;
     $this->set('diary', $diary);
     $v['SNS_NAME'] = SNS_NAME;
     $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     $this->set($v);
     return 'success';
 }
コード例 #11
0
 function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     // ----------
     //--- 権限チェック
     //日記作成者
     $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
     if ($c_diary['c_member_id'] != $u) {
         handle_kengen_error();
     }
     //---
     db_diary_delete_c_diary($target_c_diary_id);
     $p = array('target_c_member_id' => $u);
     openpne_redirect('ktai', 'page_fh_diary_list', $p);
 }
コード例 #12
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_diary_id = $requests['target_c_diary_id'];
     $del_img = $requests['del_img'];
     // ----------
     //--- 権限チェック
     //日記作成者
     $c_diary = db_diary_get_c_diary4id($c_diary_id);
     //日記を書いた人でないと消せない
     if ($c_diary['c_member_id'] != $u) {
         openpne_redirect('pc', 'page_h_home');
     }
     //---
     db_image_data_delete($c_diary['image_filename_' . $del_img], $u);
     db_diary_delete_c_diary_image($c_diary_id, $del_img);
     $p = array('target_c_diary_id' => $c_diary_id);
     openpne_redirect('pc', 'page_h_diary_edit', $p);
 }
コード例 #13
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $subject = $requests['subject'];
     $body = $requests['body'];
     $public_flag = $requests['public_flag'];
     $is_comment_input = $requests['is_comment_input'];
     // ----------
     $c_member = db_member_c_member4c_member_id($u);
     if ($target_c_diary_id) {
         $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
         if ($c_diary['c_member_id'] != $u) {
             handle_kengen_error();
         }
         // 内容の不備によるリダイレクト時は値を上書き
         if ($requests['msg']) {
             $c_diary['subject'] = $subject;
             $c_diary['body'] = $body;
             $c_diary['public_flag'] = $public_flag;
             $c_diary['is_comment_input'] = $is_comment_input;
         }
     } else {
         $c_diary['is_comment_input'] = 1;
         $c_diary['public_flag'] = $public_flag ? $public_flag : $c_member['public_flag_diary'];
         $c_diary['subject'] = $subject;
         $c_diary['body'] = $body;
     }
     $this->set('target_c_diary', $c_diary);
     if (MAIL_ADDRESS_HASHED) {
         $mail_address = "b{$u}-" . t_get_user_hash($u) . "@" . MAIL_SERVER_DOMAIN;
     } else {
         $mail_address = "blog" . "@" . MAIL_SERVER_DOMAIN;
     }
     $mail_address = MAIL_ADDRESS_PREFIX . $mail_address;
     $this->set('blog_address', $mail_address);
     //メンバー情報
     $this->set('member', $c_member);
     return 'success';
 }
コード例 #14
0
 function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $subject = $requests['subject'];
     $body = $requests['body'];
     $public_flag = util_cast_public_flag_diary($requests['public_flag']);
     $target_c_diary_id = $requests['target_c_diary_id'];
     $is_comment_input = $requests['is_comment_input'];
     // ----------
     if (is_null($subject) || $subject === '') {
         $_REQUEST['msg'] = 2;
         openpne_forward('ktai', 'page', 'h_diary_edit');
         exit;
     }
     if (is_null($body) || $body === '') {
         $_REQUEST['msg'] = 1;
         openpne_forward('ktai', 'page', 'h_diary_edit');
         exit;
     }
     if (!$target_c_diary_id) {
         // 新規作成
         $target_c_diary_id = db_diary_insert_c_diary($u, $subject, $body, $public_flag, $is_comment_input);
         if (OPENPNE_USE_POINT_RANK) {
             //日記を書いた人にポイント付与
             $point = db_action_get_point4c_action_id(4);
             db_point_add_point($u, $point);
         }
     } else {
         // 編集
         $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
         if ($c_diary['c_member_id'] != $u) {
             handle_kengen_error();
         }
         db_diary_update_c_diary($target_c_diary_id, $subject, $body, $public_flag, $is_comment_input);
     }
     $p = array('target_c_member_id' => $u);
     openpne_redirect('ktai', 'page_fh_diary_list', $p);
 }
コード例 #15
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     $target_c_diary_comment_id = $_REQUEST['target_c_diary_comment_id'];
     foreach ($target_c_diary_comment_id as $val) {
         //--- 権限チェック
         //日記作成者 or コメント作成者
         $target_c_diary_comment = _do_c_diary_comment4c_diary_comment_id($val);
         $target_c_diary_id = $target_c_diary_comment['c_diary_id'];
         $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
         if ($c_diary['c_member_id'] != $u && $target_c_diary_comment['c_member_id'] != $u) {
             handle_kengen_error();
         }
         //---
         //コメント削除実行
         db_diary_delete_c_diary_comment($val, $u);
         //コメント記入履歴削除実行
         db_diary_delete_c_diary_comment_log($target_c_diary_comment['c_member_id'], $target_c_diary_id);
     }
     $p = array('target_c_diary_id' => $target_c_diary_id);
     openpne_redirect('pc', 'page_fh_diary', $p);
 }
コード例 #16
0
 function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_comment_id = $requests['target_c_diary_comment_id'];
     // ----------
     $c_diary_comment = _do_c_diary_comment4c_diary_comment_id($target_c_diary_comment_id);
     $target_c_member_id = $c_diary_comment['c_member_id'];
     //--- 権限チェック
     //日記作成者 or コメント作成者
     $c_diary = db_diary_get_c_diary4id($c_diary_comment['c_diary_id']);
     if ($c_diary['c_member_id'] != $u && $c_diary_comment['c_member_id'] != $u) {
         handle_kengen_error();
     }
     //---
     db_diary_delete_c_diary_comment($target_c_diary_comment_id, $u);
     //コメント記入履歴削除実行
     db_diary_delete_c_diary_comment_log($target_c_member_id, $c_diary_comment['c_diary_id']);
     $p = array('target_c_diary_id' => $c_diary['c_diary_id']);
     openpne_redirect('ktai', 'page_fh_diary', $p);
 }
コード例 #17
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $img_num = $requests['img_num'];
     // ----------
     $c_member = db_member_c_member4c_member_id($u);
     if ($target_c_diary_id) {
         $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
         $this->set('target_c_diary', $c_diary);
         if ($c_diary['c_member_id'] != $u) {
             handle_kengen_error();
         }
     } else {
         handle_kengen_error();
     }
     $target_image_filename = '';
     switch ($img_num) {
         case '1':
             $target_image_filename = $c_diary['image_filename_1'];
             break;
         case '2':
             $target_image_filename = $c_diary['image_filename_2'];
             break;
         case '3':
             $target_image_filename = $c_diary['image_filename_3'];
             break;
     }
     if (empty($target_image_filename)) {
         handle_kengen_error();
     }
     $this->set('img_num', $img_num);
     $this->set('target_image_filename', $target_image_filename);
     //メンバー情報
     $this->set('member', $c_member);
     return 'success';
 }
コード例 #18
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $img_num = $requests['img_num'];
     // ----------
     $c_member = db_member_c_member4c_member_id($u);
     if ($target_c_diary_id) {
         $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
         if ($c_diary['c_member_id'] != $u) {
             handle_kengen_error();
         }
     } else {
         handle_kengen_error();
     }
     $target_image_filename = '';
     switch ($img_num) {
         case '1':
             $target_image_filename = $c_diary['image_filename_1'];
             break;
         case '2':
             $target_image_filename = $c_diary['image_filename_2'];
             break;
         case '3':
             $target_image_filename = $c_diary['image_filename_3'];
             break;
     }
     if (empty($target_image_filename)) {
         handle_kengen_error();
     }
     db_image_data_delete($target_image_filename, $u);
     db_diary_delete_c_diary_image($target_c_diary_id, $img_num);
     $p = array('target_c_diary_id' => $target_c_diary_id);
     openpne_redirect('ktai', 'page_h_diary_edit_image', $p);
 }
コード例 #19
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $tmpfile_1 = $requests['tmpfile_1'];
     $tmpfile_2 = $requests['tmpfile_2'];
     $tmpfile_3 = $requests['tmpfile_3'];
     $body = $requests['body'];
     // ----------
     if (is_null($body) || $body === '') {
         $p = array('target_c_diary_id' => $target_c_diary_id, 'msg' => "コメントを入力してださい");
         openpne_redirect('pc', 'page_fh_diary', $p);
     }
     //--- 権限チェック
     $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
     $target_c_member_id = $c_diary['c_member_id'];
     $target_c_member = db_member_c_member4c_member_id($target_c_member_id);
     if ($u != $target_c_member_id) {
         // check public_flag
         if (!pne_check_diary_public_flag($target_c_diary_id, $u)) {
             openpne_redirect('pc', 'page_h_err_diary_access');
         }
         //アクセスブロック設定
         if (db_member_is_access_block($u, $target_c_member_id)) {
             openpne_redirect('pc', 'page_h_access_block');
         }
     }
     //日記コメント停止設定
     if (OPENPNE_USE_DIARY_COMMENT && !$c_diary['is_comment_input']) {
         openpne_forward('pc', 'page', 'fh_diary');
         exit;
     }
     if (!db_diary_is_writable_comment4c_diary_id($target_c_diary_id)) {
         $_REQUEST['msg'] = 'コメントが1000番に達したので、この' . WORD_DIARY . 'にはコメントできません';
         openpne_forward('pc', 'page', 'fh_diary');
         exit;
     }
     //---
     //---画像アップロードサイズチェック
     $filesize = 0;
     if ($tmpfile_1) {
         $filesize += util_image_get_c_tmp_filesize4filename("dc_{$c_diary_comment_id}_1", $tmpfile_1);
     }
     if ($tmpfile_2) {
         $filesize += util_image_get_c_tmp_filesize4filename("dc_{$c_diary_comment_id}_2", $tmpfile_2);
     }
     if ($tmpfile_3) {
         $filesize += util_image_get_c_tmp_filesize4filename("dc_{$c_diary_comment_id}_3", $tmpfile_3);
     }
     if ($filesize) {
         $result = util_image_check_add_image_upload($filesize, $u, 'diary');
         if ($result) {
             if ($result == 2) {
                 $result = 3;
             }
             $_REQUEST['msg'] = util_image_get_upload_err_msg($result);
             openpne_forward('pc', 'page', 'fh_diary');
             exit;
         }
     }
     //日記コメント書き込み
     $c_diary_comment_id = db_diary_insert_c_diary_comment($u, $target_c_diary_id, $body);
     $sessid = session_id();
     $filename_1 = image_insert_c_image4tmp("dc_{$c_diary_comment_id}_1", $tmpfile_1, $u);
     $filename_2 = image_insert_c_image4tmp("dc_{$c_diary_comment_id}_2", $tmpfile_2, $u);
     $filename_3 = image_insert_c_image4tmp("dc_{$c_diary_comment_id}_3", $tmpfile_3, $u);
     t_image_clear_tmp($sessid);
     db_diary_insert_c_diary_comment_images($c_diary_comment_id, $filename_1, $filename_2, $filename_3);
     //日記コメント記入履歴更新
     if ($u != $target_c_member_id) {
         db_diary_insert_c_diary_comment_log($u, $target_c_diary_id);
     }
     db_diary_update_c_diary_comment_log($target_c_diary_id);
     //日記コメントが書き込まれたので日記自体を未読扱いにする
     db_diary_update_c_diary_is_checked($target_c_diary_id, 0);
     // お知らせメール送信(携帯へ)
     if ($u != $target_c_member_id) {
         send_diary_comment_info_mail($c_diary_comment_id, $u);
     }
     if (OPENPNE_USE_POINT_RANK) {
         // コメント者と被コメント者が違う場合にポイント加算
         if ($u != $target_c_member_id) {
             //書いた人にポイント付与
             $point = db_action_get_point4c_action_id(3);
             db_point_add_point($u, $point);
             //書かれた人にポイント付与
             $point = db_action_get_point4c_action_id(2);
             db_point_add_point($target_c_member_id, $point);
         }
     }
     $p = array('target_c_diary_id' => $target_c_diary_id, 'comment_count' => db_diary_count_c_diary_comment4c_diary_id($target_c_diary_id));
     openpne_redirect('pc', 'page_fh_diary', $p);
 }
コード例 #20
0
ファイル: mail_send.php プロジェクト: KimuraYoichi/PukiWiki
function send_diary_comment_info_mail($c_diary_comment_id, $c_member_id)
{
    $comment = _do_c_diary_comment4c_diary_comment_id($c_diary_comment_id);
    $target_c_member_id = $comment['c_member_id_author'];
    // コメントした人=日記オーナーの場合は通知しない
    if ($target_c_member_id == $c_member_id) {
        return false;
    }
    // 日記オーナーの通知設定が無ければ通知しない
    $target_c_member_config = util_get_c_member_config($target_c_member_id);
    if (!$target_c_member_config['SEND_DIARY_COMMENT_MAIL_KTAI']) {
        return false;
    }
    $c_member = db_member_c_member4c_member_id_LIGHT($c_member_id);
    $target_c_member = db_member_c_member_secure4c_member_id($target_c_member_id);
    $c_diary_id = $comment['c_diary_id'];
    $c_diary = db_diary_get_c_diary4id($c_diary_id);
    $p = array('target_c_diary_id' => $c_diary_id);
    $url = openpne_gen_url('ktai', 'page_fh_diary', $p);
    $params = array('subject' => $c_diary['subject'], 'nickname' => $c_member['nickname'], 'body' => $comment['body'], 'url' => $url, 'image_filename1' => $comment['image_filename_1'], 'image_filename2' => $comment['image_filename_2'], 'image_filename3' => $comment['image_filename_3'], 'id' => $c_diary_comment_id);
    $ktai_address = $target_c_member['ktai_address'];
    if (MAIL_ADDRESS_HASHED) {
        $from = "bc{$c_diary_id}-" . t_get_user_hash($target_c_member_id) . '@' . MAIL_SERVER_DOMAIN;
    } else {
        $from = "bc{$c_diary_id}" . '@' . MAIL_SERVER_DOMAIN;
    }
    $from = MAIL_ADDRESS_PREFIX . $from;
    return fetch_send_mail($ktai_address, 'm_ktai_diary_comment_info', $params, true, $from);
}
コード例 #21
0
 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';
 }
コード例 #22
0
 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;
 }
コード例 #23
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $subject = $requests['subject'];
     $body = $requests['body'];
     $public_flag = $requests['public_flag'];
     $category = $requests['category'];
     $is_comment_input = $requests['is_comment_input'];
     // ----------
     $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
     // target が指定されていない
     // 新規作成
     if (!$target_c_diary_id) {
         openpne_redirect('pc', 'page_h_diary_add');
     }
     // target の日記が存在しない
     if (!p_common_is_active_c_diary_id($target_c_diary_id) && $target_c_diary_id != null) {
         openpne_redirect('pc', 'page_h_err_fh_diary');
     }
     //--- 権限チェック
     //日記の作成者
     if ($u != $c_diary['c_member_id']) {
         handle_kengen_error();
     }
     //登録されている写真を削除 0は削除しない 1は削除する
     if ($_REQUEST['del_img'] & 0x1 == 1) {
         $c_diary['image_filename_1'] = "";
     }
     if ($_REQUEST['del_img'] & 0x2 == 1) {
         $c_diary['image_filename_2'] = "";
     }
     if ($_REQUEST['del_img'] & 0x4 == 1) {
         $c_diary['image_filename_3'] = "";
     }
     $this->set('del_img', $_REQUEST['del_img']);
     $this->set('inc_navi', fetch_inc_navi('h'));
     //プロフィール
     $this->set("target_member", db_member_c_member4c_member_id($u));
     //カレンダー関係
     //カレンダー開始用変数
     $time = strtotime($c_diary['r_datetime']);
     $year = date('Y', $time);
     $month = date('n', $time);
     //日記一覧、カレンダー用変数
     $date_val = array('year' => $year, 'month' => $month, 'day' => null);
     $this->set("date_val", $date_val);
     //日記のカレンダー
     $calendar = db_common_diary_monthly_calendar($year, $month, $u);
     $this->set("calendar", $calendar['days']);
     $this->set("ym", $calendar['ym']);
     //各月の日記
     $this->set("date_list", p_fh_diary_list_date_list4c_member_id($u));
     if (USE_DIARY_CATEGORY) {
         //この日記のカテゴリリストを得る
         if ($category) {
             $category_list = array();
             foreach (preg_split('/\\s+/', $category) as $value) {
                 if (empty($value)) {
                     break;
                 }
                 $category_list[] = array('c_diary_category_id' => 'dummy', 'category_name' => $value);
             }
             $this->set("category", $category_list);
         } else {
             $this->set("category", db_diary_category_list4c_diary_id($target_c_diary_id));
         }
         //メンバーのカテゴリリスト
         $this->set("category_list", db_diary_category_list4c_member_id($u));
         $this->set("use_diary_category", true);
     }
     // 内容の不備によるリダイレクト時・編集修正時は値を上書き
     if ($requests['msg'] || !(is_null($subject) || is_null($body))) {
         $c_diary['subject'] = $subject;
         $c_diary['body'] = $body;
         $c_diary['public_flag'] = util_cast_public_flag_diary($public_flag);
         $c_diary['is_comment_input'] = $is_comment_input;
     }
     $this->set("diary", $c_diary);
     // inc_entry_point
     $this->set('inc_entry_point', fetch_inc_entry_point($this->getView(), 'h_diary_edit'));
     return 'success';
 }
コード例 #24
0
ファイル: fh_diary.php プロジェクト: KimuraYoichi/PukiWiki
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $body = $requests['body'];
     $page = $requests['page'];
     // ----------
     // target が指定されていない
     if (!$target_c_diary_id) {
         openpne_redirect('pc', 'page_h_err_fh_diary');
     }
     // target の日記が存在しない
     if (!p_common_is_active_c_diary_id($target_c_diary_id)) {
         openpne_redirect('pc', 'page_h_err_fh_diary');
     }
     $target_c_diary = db_diary_get_c_diary4id($target_c_diary_id);
     $target_c_member_id = $target_c_diary['c_member_id'];
     if ($target_c_member_id == $u) {
         $type = 'h';
         //日記を閲覧済みにする
         db_diary_update_c_diary_is_checked($target_c_diary_id, 1);
     } else {
         $type = 'f';
         $target_c_member = db_member_c_member4c_member_id($target_c_member_id);
         $is_friend = db_friend_is_friend($u, $target_c_member_id);
         // check public_flag
         if (!pne_check_diary_public_flag($target_c_diary_id, $u)) {
             openpne_redirect('pc', 'page_h_err_diary_access');
         }
         // アクセスブロック
         if (db_member_is_access_block($u, $target_c_member_id)) {
             openpne_redirect('pc', 'page_h_access_block');
         }
         // あしあとをつける
         db_ashiato_insert_c_ashiato($target_c_member_id, $u);
     }
     $this->set('type', $type);
     $this->set('inc_navi', fetch_inc_navi($type, $target_c_member_id));
     $this->set('member', db_member_c_member4c_member_id($u));
     $this->set('target_member', db_member_c_member4c_member_id($target_c_member_id));
     $this->set('target_diary', $target_c_diary);
     // 日記コメント
     if ($requests['page_size'] == 100) {
         $page_size = 100;
     } else {
         $page_size = 20;
     }
     if ($requests['order'] === 'asc') {
         $desc = false;
     } else {
         $desc = true;
     }
     list($c_diary_comment_list, $is_prev, $is_next, $total_num, $total_page_num) = k_p_fh_diary_c_diary_comment_list4c_diary_id($target_c_diary_id, $page_size, $page, $desc);
     if ($desc) {
         $c_diary_comment_list = array_reverse($c_diary_comment_list);
     }
     $this->set('target_diary_comment_list', $c_diary_comment_list);
     $this->set('total_num', $total_num);
     $this->set('total_page_num', $total_page_num);
     $this->set('page_size', $page_size);
     $this->set('page', $page);
     $this->set('is_writable_comment', db_diary_is_writable_comment4c_diary_id($target_c_diary_id));
     // コメント許可設定取得
     $this->set('is_comment_input', $target_c_diary['is_comment_input']);
     $start_comment = reset($c_diary_comment_list);
     $end_comment = end($c_diary_comment_list);
     $pager = array();
     $pager['start'] = (int) $start_comment['number'];
     $pager['end'] = (int) $end_comment['number'];
     if ($is_prev) {
         if ($desc) {
             $pager['page_next'] = $page - 1;
         } else {
             $pager['page_prev'] = $page - 1;
         }
     }
     if ($is_next) {
         if ($desc) {
             $pager['page_prev'] = $page + 1;
         } else {
             $pager['page_next'] = $page + 1;
         }
     }
     $this->set('pager', $pager);
     //最近の日記を取得
     $list_set = p_fh_diary_list_diary_list4c_member_id($target_c_member_id, 7, 1, $u);
     $this->set('new_diary_list', $list_set[0]);
     $this->set('c_diary_id_prev', db_diary_c_diary_id_prev4c_diary_id($target_c_member_id, $target_c_diary_id, $u));
     $this->set('c_diary_id_next', db_diary_c_diary_id_next4c_diary_id($target_c_member_id, $target_c_diary_id, $u));
     //カレンダー関係
     //カレンダー開始用変数
     $time = strtotime($target_c_diary['r_datetime']);
     $year = date('Y', $time);
     $month = date('n', $time);
     //日記一覧、カレンダー用変数
     $date_val = array('year' => $year, 'month' => $month, 'day' => null);
     $this->set('date_val', $date_val);
     //日記のカレンダー
     $calendar = db_common_diary_monthly_calendar($year, $month, $target_c_member_id, $u);
     $this->set('calendar', $calendar['days']);
     $this->set('ym', $calendar['ym']);
     //各月の日記
     $this->set('date_list', p_fh_diary_list_date_list4c_member_id($target_c_member_id));
     if (USE_DIARY_CATEGORY) {
         //カテゴリ一覧
         $this->set('category', db_diary_category_list4c_member_id($target_c_member_id));
         //この日記のカテゴリリストを得る
         $this->set('category_list', db_diary_category_list4c_diary_id($target_c_diary_id));
     }
     return 'success';
 }
コード例 #25
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $subject = $requests['subject'];
     $body = $requests['body'];
     $public_flag = util_cast_public_flag_diary($requests['public_flag']);
     $tmpfile_1 = $requests['tmpfile_1'];
     $tmpfile_2 = $requests['tmpfile_2'];
     $tmpfile_3 = $requests['tmpfile_3'];
     $category = array_unique(preg_split('/\\s+/', $requests['category']));
     $is_comment_input = $requests['is_comment_input'];
     // ----------
     //--- 権限チェック
     //日記作成者
     $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
     if ($c_diary['c_member_id'] != $u) {
         handle_kengen_error();
     }
     //---
     $sessid = session_id();
     if (count($category) > 5) {
         $_REQUEST['msg'] = 'カテゴリは5つまでしか指定できません';
         openpne_forward('pc', 'page', 'h_diary_edit');
         exit;
     }
     foreach ($category as $value) {
         if (mb_strwidth($value) > 20) {
             $_REQUEST['msg'] = 'カテゴリはひとつにつき全角10文字(半角20文字)以内で入力してください';
             openpne_forward('pc', 'page', 'h_diary_edit');
             exit;
         }
     }
     // 画像アップロード可能サイズチェック
     $filesize = 0;
     $del_file = array();
     if ($tmpfile_1) {
         $filesize += util_image_get_c_tmp_filesize4filename("d_{$target_c_diary_id}_1", $tmpfile_1);
         if ($c_diary['image_filename_1']) {
             $del_file[] = $c_diary['image_filename_1'];
         }
     }
     if ($tmpfile_2) {
         $filesize += util_image_get_c_tmp_filesize4filename("d_{$target_c_diary_id}_2", $tmpfile_2);
         if ($c_diary['image_filename_2']) {
             $del_file[] = $c_diary['image_filename_2'];
         }
     }
     if ($tmpfile_3) {
         $filesize += util_image_get_c_tmp_filesize4filename("d_{$target_c_diary_id}_3", $tmpfile_3);
         if ($c_diary['image_filename_3']) {
             $del_file[] = $c_diary['image_filename_3'];
         }
     }
     if ($filesize) {
         $result = util_image_check_change_image_upload($filesize, $del_file, $u, 'diary');
         if ($result) {
             if ($result == 2) {
                 $result = 3;
             }
             $_REQUEST['msg'] = util_image_get_upload_err_msg($result);
             openpne_forward('pc', 'page', 'h_diary_edit');
             exit;
         }
     }
     //カテゴリ登録しなおし
     db_diary_category_delete_c_diary_category_diary($target_c_diary_id);
     $c_diary_category_list = db_diary_category_list4c_member_id($c_diary['c_member_id']);
     foreach ($category as $value) {
         if (empty($value)) {
             break;
         }
         // 同一のカテゴリ名が登録済みかどうかを確認
         $c_category_id = 0;
         foreach ($c_diary_category_list as $c_diary_category) {
             if ($c_diary_category['category_name'] == $value) {
                 $c_category_id = $c_diary_category['c_diary_category_id'];
                 break;
             }
         }
         // 未登録の場合は新規に登録する
         if (!$c_category_id) {
             $c_category_id = db_diary_category_insert_category($c_diary['c_member_id'], $value);
         }
         db_diary_category_insert_c_diary_category_diary($target_c_diary_id, $c_category_id);
     }
     $filename_1 = $filename_2 = $filename_3 = '';
     if ($tmpfile_1) {
         db_image_data_delete($c_diary['image_filename_1'], $u);
         $filename_1 = image_insert_c_image4tmp("d_{$target_c_diary_id}_1", $tmpfile_1, $u);
     }
     if ($tmpfile_2) {
         db_image_data_delete($c_diary['image_filename_2'], $u);
         $filename_2 = image_insert_c_image4tmp("d_{$target_c_diary_id}_2", $tmpfile_2, $u);
     }
     if ($tmpfile_3) {
         db_image_data_delete($c_diary['image_filename_3'], $u);
         $filename_3 = image_insert_c_image4tmp("d_{$target_c_diary_id}_3", $tmpfile_3, $u);
     }
     if (!OPENPNE_USE_DIARY_COMMENT) {
         $is_comment_input = $c_diary['is_comment_input'];
     }
     t_image_clear_tmp($sessid);
     db_diary_update_c_diary($target_c_diary_id, $subject, $body, $public_flag, $is_comment_input, $filename_1, $filename_2, $filename_3);
     $p = array('target_c_diary_id' => $target_c_diary_id);
     openpne_redirect('pc', 'page_fh_diary', $p);
 }
コード例 #26
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $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_edit');
                 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_edit');
         exit;
     }
     foreach ($category_list as $value) {
         if (mb_strwidth($value) > 20) {
             $_REQUEST['msg'] = 'カテゴリはひとつにつき全角10文字(半角20文字)以内で入力してください';
             openpne_forward('pc', 'page', 'h_diary_edit');
             exit;
         }
     }
     // 画像アップロード可能サイズチェック
     $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
     $del_file = array();
     if ($_FILES['upfile_1']) {
         if ($c_diary['image_filename_1']) {
             $del_file[] = $c_diary['image_filename_1'];
         }
     }
     if ($_FILES['upfile_2']) {
         if ($c_diary['image_filename_2']) {
             $del_file[] = $c_diary['image_filename_2'];
         }
     }
     if ($_FILES['upfile_3']) {
         if ($c_diary['image_filename_3']) {
             $del_file[] = $c_diary['image_filename_3'];
         }
     }
     if ($filesize) {
         $result = util_image_check_change_image_upload($filesize, $del_file, $u, 'diary');
         if ($result) {
             if ($result == 2) {
                 $result = 3;
             }
             $_REQUEST['msg'] = util_image_get_upload_err_msg($result);
             openpne_forward('pc', 'page', 'h_diary_edit');
             exit;
         }
     }
     $this->set('inc_navi', fetch_inc_navi("h"));
     //プロフィール
     $this->set("member", db_member_c_member4c_member_id($u));
     $form_val = array("target_c_diary_id" => $target_c_diary_id, "del_img" => $_REQUEST['del_img'], "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';
 }
コード例 #27
0
ファイル: fh_diary.php プロジェクト: KimuraYoichi/PukiWiki
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_diary_id = $requests['target_c_diary_id'];
     $target_response_comment_id = $requests['target_response_comment_id'];
     $page = $requests['page'];
     // ----------
     $c_diary = db_diary_get_c_diary4id($target_c_diary_id);
     $target_c_member = k_p_fh_diary_c_member4c_diary_id($target_c_diary_id);
     $target_c_member_id = $target_c_member['c_member_id'];
     if ($u != $target_c_member_id) {
         // check public_flag
         if (!pne_check_diary_public_flag($target_c_diary_id, $u)) {
             openpne_redirect('ktai', 'page_h_err_diary_access');
         }
         //アクセスブロック設定
         if (db_member_is_access_block($u, $target_c_member_id)) {
             openpne_redirect('ktai', 'page_h_access_block');
         }
     }
     //管理画面HTML
     $this->set('c_siteadmin', p_common_c_siteadmin4target_pagename('k_fh_diary'));
     //日記の作者情報
     $this->set('target_diary_writer', $target_c_member);
     //日記
     $this->set('target_c_diary', $c_diary);
     $this->set('c_diary_id_prev', db_diary_c_diary_id_prev4c_diary_id($target_c_member_id, $target_c_diary_id, $u));
     $this->set('c_diary_id_next', db_diary_c_diary_id_next4c_diary_id($target_c_member_id, $target_c_diary_id, $u));
     //自分で日記を見たとき
     if ($c_diary['c_member_id'] == $u) {
         //日記を閲覧済みにする
         db_diary_update_c_diary_is_checked($target_c_diary_id, 1);
         $this->set('type', 'h');
     }
     //コメント
     $page_size = 5;
     if ($requests['order'] === 'asc') {
         $desc = false;
     } else {
         $desc = true;
     }
     list($c_diary_comment_list, $is_prev, $is_next, $total_num, $total_page_num) = k_p_fh_diary_c_diary_comment_list4c_diary_id($target_c_diary_id, $page_size, $page, $desc);
     if ($desc) {
         $c_diary_comment_list = array_reverse($c_diary_comment_list);
     }
     if ($target_response_comment_id) {
         $target_comment = _do_c_diary_comment4c_diary_comment_id($target_response_comment_id);
         $response_set = db_member_c_member4c_member_id_LIGHT($target_comment['c_member_id']);
         $this->set('response_comment_format', '>>' . $target_comment['number'] . ' ' . $response_set['nickname'] . "さん\n");
     }
     $this->set('c_diary_comment', $c_diary_comment_list);
     $this->set('total_num', $total_num);
     $this->set('total_page_num', $total_page_num);
     $this->set('page_size', $page_size);
     $this->set('page', $page);
     $this->set('is_writable_comment', db_diary_is_writable_comment4c_diary_id($target_c_diary_id));
     // コメント許可設定取得
     $this->set('is_comment_input', $c_diary['is_comment_input']);
     $start_comment = reset($c_diary_comment_list);
     $end_comment = end($c_diary_comment_list);
     $pager = array();
     $pager['start'] = (int) $start_comment['number'];
     $pager['end'] = (int) $end_comment['number'];
     if ($is_prev) {
         if ($desc) {
             $pager['page_next'] = $page - 1;
         } else {
             $pager['page_prev'] = $page - 1;
         }
     }
     if ($is_next) {
         if ($desc) {
             $pager['page_prev'] = $page + 1;
         } else {
             $pager['page_next'] = $page + 1;
         }
     }
     $this->set('pager', $pager);
     // f or h
     $this->set('INC_NAVI_type', k_p_fh_common_get_type($target_c_member['c_member_id'], $u));
     if (MAIL_ADDRESS_HASHED) {
         $mail_address = "bc{$target_c_diary_id}-" . t_get_user_hash($u) . '@' . MAIL_SERVER_DOMAIN;
     } else {
         $mail_address = "bc{$target_c_diary_id}" . '@' . MAIL_SERVER_DOMAIN;
     }
     $mail_address = MAIL_ADDRESS_PREFIX . $mail_address;
     $this->set('mail_address', $mail_address);
     //あしあとをつける
     db_ashiato_insert_c_ashiato($target_c_member_id, $u);
     return 'success';
 }
コード例 #28
0
ファイル: sns.php プロジェクト: KimuraYoichi/PukiWiki
 /**
  * 日記写真変更
  */
 function add_diary_image($c_diary_id)
 {
     if (!($c_diary = db_diary_get_c_diary4id($c_diary_id))) {
         return false;
     }
     if ($c_diary['c_member_id'] != $this->c_member_id) {
         return false;
     }
     // 登録する写真番号(1-3)を決める
     $target_number = 0;
     if ($c_diary['image_filename_1'] || $c_diary['image_filename_2'] || $c_diary['image_filename_3']) {
         if (!$c_diary['image_filename_1']) {
             $target_number = 1;
         } elseif (!$c_diary['image_filename_2']) {
             $target_number = 2;
         } elseif (!$c_diary['image_filename_3']) {
             $target_number = 3;
         } else {
             $this->error_mail(WORD_DIARY . '写真の登録は最大3枚までです。');
             m_debug_log('mail_sns::add_diary_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 = 'd_' . $c_diary_id . '_' . $target_number . '_' . time() . '.' . $image_ext;
         // 画像アップロード可能サイズチェック
         $filesize = $image['filesize'];
         $result = util_image_check_add_image_upload($filesize, $this->c_member_id, 'diary');
         if ($result) {
             $msg = util_image_get_upload_err_msg($result);
             $this->error_mail($msg);
             m_debug_log('mail_sns::add_diary_image() size over');
             return false;
         }
         db_image_insert_c_image($filename, $image_data, $filesize, $this->c_member_id);
         db_diary_update_c_diary_image_filename($c_diary_id, $filename, $target_number);
         return true;
     } else {
         $this->error_mail('写真が添付されていないか、ファイルサイズが大きすぎるため、登録できませんでした。');
         m_debug_log('mail_sns::add_diary_image() no images');
         return false;
     }
 }
コード例 #29
0
ファイル: diary.php プロジェクト: KimuraYoichi/PukiWiki
/**
 * 日記コメント追加
 *
 * @param  int    $c_member_id
 * @param  int    $c_diary_id
 * @param  string $body
 * @return int    insert_id
 */
function db_diary_insert_c_diary_comment($c_member_id, $c_diary_id, $body)
{
    //function cache削除
    $c_diary = db_diary_get_c_diary4id($c_diary_id);
    cache_drop_c_diary($c_member_id, $c_diary['c_member_id']);
    pne_cache_drop('p_h_home_c_diary_my_comment_list4c_member_id', $c_member_id, 5);
    // 本文中に書いてあるURLがSNS内でありセッションパラメータを含んでいた場合は削除
    $body = db_ktai_delete_url_session_parameter($body);
    $data = array('c_member_id' => intval($c_member_id), 'c_diary_id' => intval($c_diary_id), 'body' => $body, 'r_datetime' => db_now(), 'image_filename_1' => '', 'image_filename_2' => '', 'image_filename_3' => '', 'number' => db_diary_get_max_c_diary_comment_number4diary($c_diary_id) + 1);
    return db_insert('c_diary_comment', $data);
}
コード例 #30
0
ファイル: util.php プロジェクト: KimuraYoichi/PukiWiki
/**
 * Check c_diary.public_flag
 *
 * @param int $c_diary_id
 * @param int $c_member_id
 * @return bool allowed or not
 */
function pne_check_diary_public_flag($c_diary_id, $c_member_id)
{
    $c_diary = db_diary_get_c_diary4id($c_diary_id);
    if ($c_diary['c_member_id'] == $c_member_id) {
        return true;
    }
    switch ($c_diary['public_flag']) {
        case 'public':
            $allowed = true;
            break;
        case 'friend':
            $allowed = db_friend_is_friend($c_diary['c_member_id'], $c_member_id);
            break;
        case 'private':
        default:
            $allowed = false;
            break;
    }
    return $allowed;
}