function get_execute_privilege(&$controller, &$request, &$user)
 {
     // 公開範囲情報取得
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     $diary_file_row = ACSDiaryFile::get_diary_file_row_by_file_id($request->ACSgetParameter('id'));
     $diary_row = ACSDiary::get_diary_row($diary_file_row['diary_id']);
     if (!$diary_row) {
         return false;
     }
     $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($diary_row['community_id']);
     if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) {
         $diary_row['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($diary_row['diary_id']);
     }
     // アクセス制御判定
     $role_array = ACSAccessControl::get_user_community_role_array($acs_user_info_row, $target_user_info_row);
     $ret = ACSAccessControl::is_valid_user_for_user_community($acs_user_info_row, $role_array, $diary_row);
     return $ret;
 }
 function execute()
 {
     $context = $this->getContext();
     $controller = $context->getController();
     $request = $context->getRequest();
     $user = $context->getUser();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // get
     $target_user_info_row = $request->getAttribute('target_user_info_row');
     $diary_row_array = $request->getAttribute('diary_row_array');
     $term = $request->getAttribute('term');
     // ユーザ情報
     $target_user_info_row['top_page_url'] = $this->getControllerPath(DEFAULT_MODULE, DEFAULT_ACTION) . '&id=' . $target_user_info_row['user_community_id'];
     $target_user_info_row['image_url'] = ACSUser::get_image_url($target_user_info_row['user_community_id']);
     if ($target_user_info_row['file_id'] != '') {
         $user_file_info_row = ACSFileInfoModel::select_file_info_row($target_user_info_row['file_id']);
         $target_user_info_row['image_title'] = $user_file_info_row['display_file_name'];
     } else {
         // 写真はありません
         $target_user_info_row['image_title'] = ACSMsg::get_msg('User', 'DiaryRSSSuccessView.class.php', 'M001');
     }
     // 信頼済みコミュニティ情報
     foreach ($diary_row_array as $index => $diary_row) {
         // 友人に公開
         if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) {
             $diary_row_array[$index]['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($diary_row['diary_id']);
         }
         // ダイアリーコメントURL
         $diary_row_array[$index]['diary_comment_url'] = $this->getControllerPath('User', 'DiaryComment') . '&id=' . $target_user_info_row['community_id'] . '&diary_id=' . $diary_row['diary_id'];
         // ファイルの画像URL
         if ($diary_row['file_id'] != '') {
             $diary_row_array[$index]['file_url'] = ACSDiaryFile::get_image_url($diary_row['file_id']);
         }
     }
     // ACSDiary::print_diary_rss()で使用するパラメータをセットする
     $params = array();
     // ベースURL
     if ($acs_user_info_row['is_acs_user']) {
         $params['base_url'] = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D01'), 'SYSTEM_BASE_LOGIN_URL');
     } else {
         $params['base_url'] = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D01'), 'SYSTEM_BASE_URL');
     }
     // 自身のURL
     $params['rss_syndication_url'] = $params['base_url'] . $this->getControllerPath('User', 'DiaryRSS') . '&id=' . $target_user_info_row['user_community_id'] . '&term=' . $term;
     // <description>
     if ($acs_user_info_row['is_acs_user']) {
         if (ACSUser::is_friends($acs_user_info_row['user_community_id'], $target_user_info_row['user_community_id'])) {
             // 友人向け
             $params['description'] = $target_user_info_row['contents_row_array']['community_profile_friend']['contents_value'];
         } else {
             // ログインユーザ向け
             $params['description'] = $target_user_info_row['contents_row_array']['community_profile_login']['contents_value'];
         }
     } else {
         // 一般向け
         $params['description'] = $target_user_info_row['contents_row_array']['community_profile']['contents_value'];
     }
     //---- アクセス制御 ----//
     $role_array = ACSAccessControl::get_user_community_role_array($acs_user_info_row, $target_user_info_row);
     $diary_row_array = ACSAccessControl::get_valid_row_array_for_user_community($acs_user_info_row, $role_array, $diary_row_array);
     //----------------------//
     // RSS出力部
     ACSDiary::print_diary_rss($target_user_info_row, $diary_row_array, $params);
     // 終了
     exit;
 }
Example #3
0
 /**
  * ダイアリーを削除する
  *
  * @param $diary_id ダイアリーID
  * @return 成功(true) / 失敗(false)
  */
 static function delete_diary($diary_id)
 {
     // BEGIN
     // diary コメントの取得
     $sub_row_array = ACSDiary::get_diary_comment_row_array($diary_id);
     $diary_comment_id_array = array();
     if (count($sub_row_array) > 0) {
         foreach ($sub_row_array as $index => $sub_row) {
             array_push($diary_comment_id_array, $sub_row['diary_comment_id']);
         }
         //コメントの削除
         $ret = ACSDiary::delete_diary_comment($diary_comment_id_array);
         if (!$ret) {
             return false;
         }
     }
     //日記が持っているファイル情報の削除
     $diary_row = ACSDiary::get_diary_row($diary_id);
     $file_id = $diary_row['file_id'];
     if ($file_id != '') {
         $ret = ACSDiaryFile::delete_diary_file($file_id, $diary_id);
         if (!$ret) {
             echo "ERROR: Delete attached file information failed.";
             return false;
         }
     }
     //日記の削除(削除フラグ扱い)
     $sql = "UPDATE diary";
     $sql .= " SET diary_delete_flag = 't'";
     $sql .= " WHERE diary.diary_id = {$diary_id}";
     $ret = ACSDB::_do_query($sql);
     if (!$ret) {
         echo "ERROR: Delete parent article failed.";
         return false;
     }
     // COMMIT
     return true;
 }
 function execute()
 {
     $context = $this->getContext();
     $controller = $context->getController();
     $request = $context->getRequest();
     $user = $context->getUser();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // get
     $target_user_info_row = $request->getAttribute('target_user_info_row');
     $diary_row = $request->getAttribute('diary_row');
     $diary_comment_row_array = $request->getAttribute('diary_comment_row_array');
     $footprint_info = $request->getAttribute('footprint_info');
     // 信頼済みコミュニティ(マイフレンズグループ)が定義されているか
     if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) {
         if (count($diary_row['trusted_community_row_array']) && $diary_row['trusted_community_row_array'][0]['community_type_name'] == ACSMsg::get_mst('community_type_master', 'D20')) {
             $diary_row['trusted_community_flag'] = 0;
         } else {
             $diary_row['trusted_community_flag'] = 1;
         }
     }
     // 加工
     // トップページURL
     $link_page_url['top_page_url'] = $this->getControllerPath(DEFAULT_MODULE, 'Diary') . '&id=' . $diary_row['user_community_id'];
     //他人の日記を閲覧している場合のトップページURL
     $link_page_url['else_user_diary_url'] = $this->getControllerPath(DEFAULT_MODULE, 'Index') . '&id=' . $target_user_info_row['community_id'];
     // トップページURL
     $diary_row['top_page_url'] = $link_page_url['top_page_url'];
     //他人の日記を閲覧している場合のダイアリートップページURL
     $diary_row['else_user_diary_url'] = $this->getControllerPath(DEFAULT_MODULE, 'Diary') . '&id=' . $target_user_info_row['community_id'];
     // 画像URL
     $diary_row['image_url'] = ACSUser::get_image_url($diary_row['community_id'], 'thumb');
     // 投稿日時
     $diary_row['post_date'] = ACSLib::convert_pg_date_to_str($diary_row['post_date']);
     //ファイルの画像URL
     $diary_row[$index]['file_url'] = "";
     if ($diary_row['file_id'] != "") {
         $diary_row['file_url'] = ACSDiaryFile::get_image_url($diary_row['file_id'], 'thumb');
         //投稿内表示用
         $diary_row['file_url_alink'] = ACSDiaryFile::get_image_url($diary_row['file_id'], '');
         //ポップアップ用
     }
     //コメント
     foreach ($diary_comment_row_array as $comment_index => $diary_comment_row) {
         // トップページURL
         $diary_comment_row_array[$comment_index]['top_page_url'] = $this->getControllerPath(DEFAULT_MODULE, DEFAULT_ACTION) . '&id=' . $diary_comment_row['user_community_id'];
         // 画像URL
         $diary_comment_row_array[$comment_index]['image_url'] = ACSUser::get_image_url($diary_comment_row['community_id'], 'thumb');
         // 投稿日時
         $diary_comment_row_array[$comment_index]['post_date'] = ACSLib::convert_pg_date_to_str($diary_comment_row['post_date']);
         // 削除画面URL
         $diary_comment_row_array[$comment_index]['diary_delete_url'] = $this->getControllerPath('User', 'DeleteDiaryComment') . '&id=' . $target_user_info_row['user_community_id'] . '&diary_id=' . $diary_row['diary_id'] . '&diary_comment_id=' . $diary_comment_row['diary_comment_id'];
         $diary_comment_row_array[$comment_index]['self_id'] = false;
         //自分が投稿したcommentかを判定する
         if ($diary_comment_row['user_community_id'] == $acs_user_info_row['user_community_id']) {
             $diary_comment_row_array[$comment_index]['self_id'] = true;
         }
     }
     // 本人のページかどうか
     if ($target_user_info_row['user_community_id'] == $acs_user_info_row['user_community_id']) {
         $is_self_page = 1;
     } else {
         $is_self_page = 0;
     }
     // 足跡登録URL(自画面) //
     $footprint_url = "";
     if ($is_self_page == 0 && $acs_user_info_row['is_login_user']) {
         $footprint_url = $this->getControllerPath('User', 'FootprintDiaryComment') . '&diary_id=' . $diary_row['diary_id'];
     }
     // 確認画面の表示用
     $action_url = $this->getControllerPath('User', 'DiaryCommentPre') . '&id=' . $target_user_info_row['community_id'] . '&diary_id=' . $diary_row['diary_id'] . '&move_id=1';
     // ページング設定
     $display_count = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), 'NEW_INFO_LIST_DISPLAY_MAX_COUNT');
     $paging_info = $this->getPagingInfo($controller, $request, $diary_comment_row_array, $display_count);
     // set
     $this->setAttribute('acs_user_info_row', $acs_user_info_row);
     $this->setAttribute('target_user_info_row', $target_user_info_row);
     $this->setAttribute('diary_row', $diary_row);
     $this->setAttribute('diary_comment_row_array', $diary_comment_row_array);
     $this->setAttribute('paging_info', $paging_info);
     $this->setAttribute('is_self_page', $is_self_page);
     $this->setAttribute('action_url', $action_url);
     $this->setAttribute('link_page_url', $link_page_url);
     $this->setAttribute('footprint_url', $footprint_url);
     $this->setAttribute('footprint_info', $footprint_info);
     //$this->setAttribute('footprint_community_id', $footprint_community_id);
     // テンプレート
     $this->setScreenId("0001");
     $this->setTemplate('DiaryComment.tpl.php');
     // 確認画面からキャンセルボタンで戻ってきたときのみの処理
     if ($request->getParameter('move_id') == 3) {
         // 元のフォーム情報を取得する
         $form = $user->getAttribute('new_form_obj');
         //件名:subject 内容:body
         // 対象となるダイアリーIDを取得する
         $diary_id = $request->ACSgetParameter('diary_id');
         $this->setAttribute('form', $form);
         $this->setAttribute('move_id', $request->getParameter('move_id'));
     }
     return parent::execute();
 }
 function execute()
 {
     $context =& $this->getContext();
     $user = $context->getUser();
     $request = $context->getRequest();
     $controller = $context->getController();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // get
     $target_user_info_row = $request->getAttribute('target_user_info_row');
     $diary_row_array = $request->getAttribute('diary_row_array');
     $diary_comment_row_array = $request->getAttribute('diary_comment_row_array');
     $open_level_master_row_array = $request->getAttribute('open_level_master_row_array');
     $friends_group_row_array = $request->getAttribute('friends_group_row_array');
     $last_open_level_code = $request->getAttribute('last_open_level_code');
     // トップページURL
     $link_page_url['top_page_url'] = $this->getControllerPath(DEFAULT_MODULE, 'Diary') . '&id=' . $acs_user_info_row['user_community_id'];
     // 他人の日記を閲覧している場合のトップページURL
     $link_page_url['else_user_diary_url'] = $this->getControllerPath(DEFAULT_MODULE, 'Index') . '&id=' . $target_user_info_row['community_id'];
     // 検索画面URL
     $link_page_url['search_diary_url'] = $this->getControllerPath(DEFAULT_MODULE, 'SearchDiary') . '&id=' . $target_user_info_row['community_id'];
     // ダイアリーRSS URL
     $term = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), 'DIARY_RSS_TERM');
     $link_page_url['diary_rss_url'] = $this->getControllerPath(DEFAULT_MODULE, 'DiaryRSS') . '&id=' . $target_user_info_row['community_id'] . "&term={$term}";
     // 加工
     foreach ($diary_row_array as $index => $diary_row) {
         // 画像URL
         $diary_row_array[$index]['image_url'] = ACSUser::get_image_url($diary_row['community_id'], 'thumb');
         // 投稿日時
         $diary_row_array[$index]['post_date'] = ACSLib::convert_pg_date_to_str($diary_row['post_date']);
         // 投稿日時 (省略系: M/D)
         $diary_row_array[$index]['short_post_date'] = gmdate("n/j", strtotime($diary_row['post_date']) + 9 * 60 * 60);
         // コメントページURL
         $diary_row_array[$index]['diary_comment_url'] = $this->getControllerPath(DEFAULT_MODULE, 'DiaryComment') . '&id=' . $target_user_info_row['community_id'] . '&diary_id=' . $diary_row['diary_id'];
         // 信頼済みコミュニティ(マイフレンズグループ)が定義されているか
         if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) {
             if (count($diary_row['trusted_community_row_array']) && $diary_row['trusted_community_row_array'][0]['community_type_name'] == ACSMsg::get_mst('community_type_master', 'D20')) {
                 $diary_row_array[$index]['trusted_community_flag'] = 0;
             } else {
                 $diary_row_array[$index]['trusted_community_flag'] = 1;
             }
         }
         // 削除画面URL
         $diary_row_array[$index]['diary_delete_url'] = $this->getControllerPath(DEFAULT_MODULE, 'DeleteDiary') . '&id=' . $target_user_info_row['user_community_id'] . '&diary_id=' . $diary_row['diary_id'];
         // ファイルの画像URL
         $diary_row_array[$index]['file_url'] = "";
         if ($diary_row['file_id'] != "") {
             $diary_row_array[$index]['file_url'] = ACSDiaryFile::get_image_url($diary_row['file_id'], 'thumb');
             //投稿内表示用
             $diary_row_array[$index]['file_url_alink'] = ACSDiaryFile::get_image_url($diary_row['file_id'], '');
             //ポップアップ用
         }
     }
     // 本人のページかどうか
     if ($target_user_info_row['user_community_id'] == $acs_user_info_row['user_community_id']) {
         $is_self_page = 1;
     } else {
         $is_self_page = 0;
     }
     // 書き込みボタンで確認画面を表示
     $action_url = $this->getControllerPath(DEFAULT_MODULE, 'DiaryPre') . '&id=' . $target_user_info_row['user_community_id'] . "&move_id=1";
     //---- アクセス制御 ----//
     $role_array = ACSAccessControl::get_user_community_role_array($acs_user_info_row, $target_user_info_row);
     $diary_row_array = ACSAccessControl::get_valid_row_array_for_user_community($acs_user_info_row, $role_array, $diary_row_array);
     //----------------------//
     // ページング設定
     $display_count = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), 'NEW_INFO_LIST_DISPLAY_MAX_COUNT');
     $paging_info = $this->getPagingInfo($controller, $request, $diary_row_array, $display_count);
     // set
     $this->setAttribute('target_user_info_row', $target_user_info_row);
     $this->setAttribute('diary_row_array', $diary_row_array);
     $this->setAttribute('paging_info', $paging_info);
     $this->setAttribute('is_self_page', $is_self_page);
     $this->setAttribute('action_url', $action_url);
     $this->setAttribute('link_page_url', $link_page_url);
     $this->setAttribute('open_level_master_row_array', $open_level_master_row_array);
     $this->setAttribute('friends_group_row_array', $friends_group_row_array);
     $this->setAttribute('last_open_level_code', $last_open_level_code);
     // インライン表示(カレンダー) 初期値は当月
     //		$this->setAttribute('new_calendar_action_chain', $request->getAttribute('new_calendar_action_chain_html'));
     /*----------------------------------------------*/
     // 初期表示時
     // 現在のレンダーモードを取得
     $renderMode = $controller->getRenderMode();
     //レンダーモードを上書き (画面出力をオフにしてる)
     $controller->setRenderMode(View::RENDER_VAR);
     $this->inlineFlg = true;
     // フォワード側で判断する
     $request->setAttribute("inline_mode", "1");
     // 新着コミュニティ
     $controller->forward("User", "DiaryCalendar");
     $this->setAttribute("DiaryCalendar", $request->getAttribute("DiaryCalendar"));
     // レンダーモードを元に戻す
     $controller->setRenderMode($renderMode);
     $this->inlineFlg = false;
     /*----------------------------------------------*/
     // テンプレート
     $this->setScreenId("0001");
     $this->setTemplate('Diary.tpl.php');
     // 確認画面からキャンセルボタンで戻ってきたときのみの処理
     if ($request->getParameter('move_id') == 3) {
         //ユーザ入力情報
         $form = $user->getAttribute('new_form_obj');
         $this->setAttribute('form', $form);
         $this->setAttribute('move_id', $request->getParameter('move_id'));
     }
     return parent::execute();
 }