コード例 #1
0
 function execute()
 {
     $context = $this->getContext();
     $controller = $context->getController();
     $request = $context->getRequest();
     $user = $context->getUser();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // 対象のdiary_idを取得
     $diary_id = $request->ACSgetParameter('diary_id');
     $diary_row = ACSDiary::get_diary_row($diary_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']);
     }
     // ユーザ情報
     $user_community_id = $diary_row['user_community_id'];
     $contents_link_url = $this->getControllerPath('User', 'DiaryComment') . "&diary_id=" . $diary_row['diary_id'];
     // 足跡登録
     $contents_type_name = ACSMsg::get_mst('contents_type_master', 'D21');
     $contents_type_arr = ACSDB::get_master_array("contents_type", "contents_type_name='" . $contents_type_name . "'");
     $form['community_id'] = $user_community_id;
     $form['visitor_community_id'] = $acs_user_info_row['user_community_id'];
     $form['contents_type_code'] = array_search($contents_type_name, $contents_type_arr);
     $form['contents_title'] = $diary_row['subject'];
     $form['contents_link_url'] = $contents_link_url;
     $form['contents_date'] = $diary_row['post_date'];
     $form['post_date'] = 'now';
     $ret = ACSUser::set_footprint($form);
     header("Location: {$contents_link_url}");
 }
コード例 #2
0
 function getDefaultView()
 {
     $context =& $this->getContext();
     $user = $context->getUser();
     $request = $context->getRequest();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // 表示対象となるユーザコミュニティIDを取得
     $user_community_id = $request->ACSgetParameter('id');
     // ユーザ情報
     $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id);
     $year = $request->ACSgetParameter('year');
     // 年
     $month = $request->ACSgetParameter('month');
     // 月
     $day = $request->ACSgetParameter('day');
     // 日
     if (checkdate($month, $day, $year)) {
         // 年月日指定
         $diary_row_array = ACSDiary::get_diary_row_array_by_year_month_day($user_community_id, $year, $month, $day);
     } elseif (checkdate($month, 1, $year)) {
         // 年月指定
         $diary_row_array = ACSDiary::get_diary_row_array_by_year_month($user_community_id, $year, $month);
         unset($day);
     } else {
         // 全てのダイアリー
         $diary_row_array = ACSDiary::get_diary_row_array($user_community_id);
         unset($year);
         unset($month);
         unset($day);
     }
     // 公開範囲を最終登録と同じもので表示しておく
     if ($diary_row_array) {
         $last_open_level_code = $diary_row_array[0]['open_level_code'];
     }
     // 信頼済みコミュニティ情報
     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']);
         }
     }
     // 公開範囲
     $open_level_master_row_array = ACSAccessControl::get_open_level_master_row_array(ACSMsg::get_mst('community_type_master', 'D10'), ACSMsg::get_mst('contents_type_master', 'D21'));
     // マイフレンズグループ
     $friends_group_row_array = ACSUser::get_friends_group_row_array($user_community_id);
     // set
     $request->setAttribute('target_user_info_row', $target_user_info_row);
     $request->setAttribute('diary_row_array', $diary_row_array);
     $request->setAttribute('open_level_master_row_array', $open_level_master_row_array);
     $request->setAttribute('friends_group_row_array', $friends_group_row_array);
     $request->setAttribute('last_open_level_code', $last_open_level_code);
     return View::INPUT;
 }
コード例 #3
0
 function execute()
 {
     $context =& $this->getContext();
     $user = $context->getUser();
     $request = $context->getRequest();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // get
     $target_user_info_row = $request->getAttribute('target_user_info_row');
     $new_diary_row_array = $request->getAttribute('new_diary_row_array');
     // 加工
     foreach ($new_diary_row_array as $index => $new_diary_row) {
         $new_diary_row_array[$index]['diary_comment_url'] = $this->getControllerPath(DEFAULT_MODULE, 'DiaryComment') . '&id=' . $new_diary_row['community_id'] . '&diary_id=' . $new_diary_row['diary_id'];
         $new_diary_row_array[$index]['is_unread'] = ACSLib::get_boolean($new_diary_row['is_unread']);
     }
     // 新着日記一覧URL
     $new_diary_url = $this->getControllerPath(DEFAULT_MODULE, 'NewDiary') . '&id=' . $target_user_info_row['user_community_id'];
     // 表示件数制御
     $display_count = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), 'NEW_INFO_TOP_DISPLAY_MAX_COUNT');
     //---- アクセス制御 ----//
     $_new_diary_row_array = array();
     foreach ($new_diary_row_array as $index => $new_diary_row) {
         if (count($_new_diary_row_array) >= $display_count) {
             break;
         }
         // diary_trusted_community
         if ($new_diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) {
             $new_diary_row_array[$index]['trusted_community_row_array'] = $new_diary_row['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($new_diary_row['diary_id']);
         }
         $diary_target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($new_diary_row['community_id']);
         $role_array = ACSAccessControl::get_user_community_role_array($acs_user_info_row, $diary_target_user_info_row);
         $new_diary_row = ACSAccessControl::get_valid_row_for_user_community($acs_user_info_row, $role_array, $new_diary_row);
         if ($new_diary_row) {
             array_push($_new_diary_row_array, $new_diary_row);
         }
     }
     $new_diary_row_array = $_new_diary_row_array;
     //----------------------//
     // set
     $this->setAttribute('target_user_info_row', $target_user_info_row);
     $this->setAttribute('new_diary_row_array', $new_diary_row_array);
     $this->setAttribute('new_diary_url', $new_diary_url);
     $this->setAttribute('get_days', $request->getAttribute('get_days'));
     // テンプレート
     $this->setTemplate('NewDiary.tpl.php');
     $context->getController()->setRenderMode(View::RENDER_VAR);
     $request->setAttribute("NewDiary", $this->render());
     return parent::execute();
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 function execute()
 {
     $context =& $this->getContext();
     $user = $context->getUser();
     $request = $context->getRequest();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // get
     $target_user_info_row = $request->getAttribute('target_user_info_row');
     $new_diary_row_array = $request->getAttribute('new_diary_row_array');
     // 加工
     foreach ($new_diary_row_array as $index => $new_diary_row) {
         $new_diary_row_array[$index]['diary_comment_url'] = $this->getControllerPath(DEFAULT_MODULE, 'DiaryComment') . '&id=' . $new_diary_row['community_id'] . '&diary_id=' . $new_diary_row['diary_id'];
         $new_diary_row_array[$index]['is_unread'] = ACSLib::get_boolean($new_diary_row['is_unread']);
     }
     //---- アクセス制御 ----//
     foreach ($new_diary_row_array as $index => $new_diary_row) {
         // diary_trusted_community
         if ($new_diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) {
             $new_diary_row_array[$index]['trusted_community_row_array'] = $new_diary_row['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($new_diary_row['diary_id']);
         }
         // 簡易処理:
         $diary_target_user_info_row['user_community_id'] = $new_diary_row['community_id'];
         $role_array = ACSAccessControl::get_user_community_role_array($acs_user_info_row, $diary_target_user_info_row);
         $new_diary_row = ACSAccessControl::get_valid_row_for_user_community($acs_user_info_row, $role_array, $new_diary_row);
         if (!$new_diary_row) {
             unset($new_diary_row_array[$index]);
         }
     }
     //----------------------//
     // ページング設定
     $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, $new_diary_row_array, $display_count);
     // set
     $this->setAttribute('target_user_info_row', $target_user_info_row);
     $this->setAttribute('new_diary_row_array', $new_diary_row_array);
     $this->setAttribute('paging_info', $paging_info);
     $this->setAttribute('get_days', $request->getAttribute('get_days'));
     // テンプレート
     $this->setScreenId("0001");
     $this->setTemplate('NewDiary.tpl.php');
     return parent::execute();
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 function execute()
 {
     $context = $this->getContext();
     $controller = $context->getController();
     $request = $context->getRequest();
     $user = $context->getUser();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // 表示対象となるユーザコミュニティIDを取得
     $user_community_id = $request->ACSgetParameter('id');
     // ユーザ情報
     $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id);
     //mode 画面の遷移を取得する
     $move_id = $request->getParameter('move_id');
     // 画面上のフォーム情報を取得する
     if ($move_id == 1) {
         $form = $request->getParameters('search_form_default');
     } else {
         if ($move_id == 2) {
             $form = $request->getParameters('search_form_new');
         }
     }
     // formの情報に従い検索を行う
     if ($move_id > 0) {
         $err_str = "";
         /*	Array
         			    [id] => 1000
         			    [move_id] => 2
         			    [q_text] => 検索条件				//条件(※必須)
         			    [search_title] => title_in_serch	//件名を選択
         			    [search_all] => subject_in_serch	//本文を選択
         			    [open_level_code] => 00				//公開範囲(00は選択なし)(※必須)
         			    [search_all_about] => all_in_serch	//すべての日記を選択
         			*/
         // ------------ 検索情報の取得(注意!バイト単位で処理)
         for ($i = 1; $i < 3; $i++) {
             $str_where_create[$i] = ACSDiary::set_diary_where_list($form, $i);
             if ($str_where_create[$i]['err_str']) {
                 $err_str = $str_where_create[$i]['err_str'];
                 //where句の一部が作成できないオペレータミス
                 if ($err_str != '') {
                     break;
                 }
             } else {
                 $str_where[$i] = $str_where_create[$i]['like_sql'];
             }
         }
         //公開範囲は別指定
         $str_open_level_code = '00';
         if ($form['open_level_code'] != '00') {
             //公開範囲を選択している場合
             $str_open_level_code = $form['open_level_code'];
         }
         // ------------
         // db検索処理 and or 2回行う
         if (!$err_str) {
             $diary_row_array_result = ACSDiary::get_diary_where_array($str_where[1], $str_open_level_code, array());
             //複合条件のサマリ
             //and完全一致を省いた日記からor部分一致を検索する
             if ($str_where_create[1]['str_count'] == 2 || $str_where_create[2]['str_count'] == 2) {
                 $str_where_create['not_id'] = array();
                 foreach ($diary_row_array_result as $index => $diary_row) {
                     array_push($str_where_create['not_id'], $diary_row['diary_id']);
                 }
                 $diary_row_array_not = ACSDiary::get_diary_where_array($str_where[2], $str_open_level_code, $str_where_create['not_id']);
                 foreach ($diary_row_array_not as $index => $diary_row) {
                     array_push($diary_row_array_result, $diary_row);
                 }
             }
             if (!$diary_row_array_result) {
                 //$err_str = "該当する情報がありません";
                 $err_str = ACSMsg::get_msg('User', 'SearchResultDiaryAction.class.php', 'M001');
             } else {
                 // 信頼済みコミュニティ情報
                 foreach ($diary_row_array_result as $index => $diary_row) {
                     if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) {
                         $diary_row_array_result[$index]['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($diary_row['diary_id']);
                     }
                 }
             }
         }
         $request->setAttribute('diary_row_array_result', $diary_row_array_result);
         $request->setAttribute('err_str', $err_str);
         $request->setAttribute('form_pre', $form);
     }
     // 公開範囲
     $open_level_master_row_array = ACSAccessControl::get_open_level_master_row_array(ACSMsg::get_mst('community_type_master', 'D10'), ACSMsg::get_mst('contents_type_master', 'D21'));
     // マイフレンズグループ
     $friends_group_row_array = ACSUser::get_friends_group_row_array($user_community_id);
     // set
     $user->setAttribute('acs_user_info_row', $acs_user_info_row);
     $request->setAttribute('target_user_info_row', $target_user_info_row);
     $request->setAttribute('diary_row_array', $diary_row_array);
     $request->setAttribute('open_level_master_row_array', $open_level_master_row_array);
     $request->setAttribute('friends_group_row_array', $friends_group_row_array);
     return View::SUCCESS;
 }
コード例 #8
0
 function execute()
 {
     $context =& $this->getContext();
     $user = $context->getUser();
     $request = $context->getRequest();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // 対象となるユーザコミュニティIDを取得
     $user_community_id = $request->ACSgetParameter('id');
     if ($user_community_id == null || $user_community_id == '') {
         $user_community_id = $request->getAttribute("id");
     }
     // ユーザ情報
     $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id);
     $top_page_url = $this->getControllerPath("User", 'Diary') . '&id=' . $user_community_id;
     $year = $request->ACSgetParameter('year');
     // 年
     $month = $request->ACSgetParameter('month');
     // 月
     if (!checkdate($month, 1, $year)) {
         $date_array = getdate();
         // 現在の日付情報
         $year = $date_array["year"];
         $month = $date_array["mon"];
     }
     //表示月($year/$month)に該当するデータを検索に行く
     $diary_row_array = ACSDiary::get_diary_row_array_by_year_month($user_community_id, $year, $month);
     // 信頼済みコミュニティ情報の追加
     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']);
         }
     }
     //---- アクセス制御 ----//
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     foreach ($diary_row_array as $index => $diary_row) {
         // 信頼済みコミュニティ(マイフレンズグループ)が定義されているか
         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;
             }
         }
     }
     $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);
     //----------------------//
     // クラスを初期化
     // calendar(開始曜日, 当月以外の日付を表示するかどうか) の形で指定します。
     // ※開始曜日(0-日曜 から 6-土曜)、当月以外の日付を表示(0-No, 1-Yes)
     $calendar_obj = new calendar(0, 0);
     // 表示月以外の日付を表示しないことで共通させる
     // リンクを設定
     $calendar_obj->clear_link();
     if ($diary_row_array) {
         // リンクのある間、繰り返し
         foreach ($diary_row_array as $index => $diary_row) {
             if ($diary_row) {
                 $link_date = substr($diary_row['post_date'], 8, 2);
                 if (substr($link_date, 0, 1) == '0') {
                     $link_date = substr($link_date, 1, 1);
                 }
                 $calendar_obj->set_link($link_date, $top_page_url . "&year={$year}&month={$month}&day={$link_date}", ACSMsg::get_msg('User', 'DiaryCalendarAction.class.php', 'M001'));
             }
         }
     }
     // 指定月のカレンダー描画
     // show_calendar(年, 月, 日) の形で指定します。
     // ※日は省略可能です。指定するとその日が太字で表示されます。
     $calendar_obj->set_str_url($top_page_url);
     $new_calendar_html = $calendar_obj->show_calendar($year, $month);
     // 年と月を指定してカレンダーを表示
     $request->setAttribute('new_calendar_html', $new_calendar_html);
     return View::INPUT;
 }