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_profile_row($user_community_id);
     // 取得期間
     $term = intval($request->ACSgetParameter('term'));
     if (!$term) {
         // システム設定: マイページ: ダイアリーRSS取得期間
         $term = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), 'DIARY_RSS_TERM');
     }
     // 最新のダイアリーRSS
     $diary_row_array = ACSDiary::get_new_diary_rss_row_array($user_community_id, $term);
     // set
     $request->setAttribute('target_user_info_row', $target_user_info_row);
     $request->setAttribute('diary_row_array', $diary_row_array);
     $request->setAttribute('term', $term);
     return View::SUCCESS;
 }
 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}");
 }
 public function execute()
 {
     $context =& $this->getContext();
     $user = $context->getUser();
     $request = $context->getRequest();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // 新着公開ダイアリー一覧を取得する
     $new_open_diary_row_array = ACSDiary::get_new_open_diary_row_array();
     // set
     $request->setAttribute('new_open_diary_row_array', $new_open_diary_row_array);
     return View::INPUT;
 }
示例#4
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;
 }
 function get_execute_privilege(&$controller, &$request, &$user)
 {
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // 本人はOK
     if ($user->hasCredential('USER_PAGE_OWNER')) {
         return true;
     }
     // 書込み本人はOK
     $diary_comment_row = ACSDiary::get_diary_comment_row($request->getParameter('diary_comment_id'));
     if ($acs_user_info_row['user_community_id'] == $diary_comment_row['user_community_id']) {
         return true;
     }
     return false;
 }
 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();
 }
 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();
     $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");
     }
     // 他ユーザのデータが見えないようチェック
     if (!$this->get_execute_privilege() && $acs_user_info_row["user_community_id"] != $user_community_id) {
         // このページへアクセスすることはできません。
         $controller->forward(SECURE_MODULE, SECURE_ACTION);
         return;
     }
     // インライン表示の場合: 1(true)
     $inline_mode = $request->ACSgetParameter('inline_mode');
     if ($inline_mode == null || $inline_mode == '') {
         $inline_mode = $request->getAttribute("inline_mode");
     }
     // 取得範囲の指定
     $get_days = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), $inline_mode ? 'NEW_INFO_TOP_TERM' : 'NEW_INFO_LIST_TERM');
     $request->setAttribute('get_days', $get_days);
     // ユーザ情報
     $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id);
     // コメントしたダイアリー一覧を取得する
     if ($inline_mode) {
         $commented_diary_row_array = ACSDiary::get_commented_diary_row_array($user_community_id, $get_days, true);
     } else {
         $commented_diary_row_array = ACSDiary::get_commented_diary_row_array($user_community_id, $get_days);
     }
     // set
     $request->setAttribute('target_user_info_row', $target_user_info_row);
     $request->setAttribute('commented_diary_row_array', $commented_diary_row_array);
     if ($inline_mode) {
         return View::INPUT;
     } else {
         return View::SUCCESS;
     }
 }
 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();
 }
 function execute()
 {
     $context = $this->getContext();
     $controller = $context->getController();
     $request = $context->getRequest();
     $user = $context->getUser();
     //削除処理を行う
     $target_community_id = $request->getParameter('id');
     $diary_id = $request->getParameter('diary_id');
     //ファイル情報テーブルのデータ削除
     $diary_obj = ACSDiary::get_diary_row($diary_id);
     if (!$diary_obj) {
         echo "日記が取得できませんでした";
     }
     $ret = ACSDiary::delete_diary($diary_id);
     if (!$ret) {
         echo "ERROR: Delete diary failed.";
     }
     //表示
     $diary_change_url = $this->getControllerPath('User', 'Diary');
     $diary_change_url .= '&id=' . $target_community_id;
     header("Location: {$diary_change_url}");
 }
示例#11
0
 /**
  * 日記htmlコンテンツの作成
  * 
  * @param string $diary_row 日記配列
  * @param string $encoding エンコーディング
  */
 function create_diary_html($diary_row, $encoding = '')
 {
     $file_head = date("Ymd_His", ACSLib::convert_pg_date_to_timestamp($diary_row['post_date']));
     $this->diary_file_names[$file_head]++;
     if ($this->diary_file_names[$file_head] > 1) {
         $file_head .= '_' . ($this->diary_file_names[$html_file] - 1);
     }
     $html_file = $file_head . '.html';
     // 基本項目の置換
     $contents = _ACSDIARYBACKUP_DIARY_FORMAT;
     $contents = mb_ereg_replace('@SUBJECT@', htmlspecialchars($diary_row['subject']), $contents);
     $contents = mb_ereg_replace('@POST_DATE@', htmlspecialchars(ACSLib::convert_pg_date_to_str($diary_row['post_date'])), $contents);
     $contents = mb_ereg_replace('@BODY@', nl2br(htmlspecialchars($diary_row['body'])), $contents);
     $contents = mb_ereg_replace('@OPEN_LEVEL_TITLE@', htmlspecialchars(ACSMsg::get_mdmsg(__FILE__, 'M001')), $contents);
     $contents = mb_ereg_replace('@OPEN_LEVEL_NAME@', htmlspecialchars($diary_row['open_level_name']), $contents);
     // イメージファイルがある場合
     $image_file_id = $diary_row['file_id'];
     if ($image_file_id != '') {
         $file_obj = ACSFile::get_file_info_instance($image_file_id);
         // 拡張子の取得
         mb_ereg("^.*(\\.[^\\.\\/]*)", $file_obj->get_display_file_name(), $matches);
         $ext = $matches[1];
         // ファイル名の生成
         $img_from = ACS_FOLDER_DIR . $file_obj->get_server_file_name();
         $img_to = $this->img_dir . '/' . $file_head . $ext;
         $img_thumb_from = ACS_FOLDER_DIR . $file_obj->get_thumbnail_server_file_name();
         $img_thumb_to = $this->img_dir . '/thumb_' . $file_head . '.jpg';
         // URLの生成
         $img_url = $this->diary_to_img_url . '/' . $file_head . $ext;
         $img_thumb_url = $this->diary_to_img_url . '/thumb_' . $file_head . '.jpg';
         // イメージファイルの作成
         @copy($img_from, $img_to);
         @copy($img_thumb_from, $img_thumb_to);
         // リンクタグの生成
         $contents = mb_ereg_replace('@IMAGE@', '<div><a href="' . $img_url . '">' . '<img src="' . $img_thumb_url . '" border="0"></a></div><br>', $contents);
     } else {
         $contents = mb_ereg_replace('@IMAGE@', '', $contents);
     }
     // コメントの取得
     $diary_comment_row_array = ACSDiary::get_diary_comment_row_array($diary_row['diary_id']);
     // コメント部分の生成
     $comments = "";
     foreach ($diary_comment_row_array as $diary_comment_row) {
         if ($diary_comment_row['diary_comment_delete_flag'] == 'f') {
             $comment_contents = _ACSDIARYBACKUP_DIARY_COMMENT_FORMAT;
             $comment_contents = mb_ereg_replace('@POST_DATE@', htmlspecialchars(ACSLib::convert_pg_date_to_str($diary_comment_row['post_date'])), $comment_contents);
             $comment_contents = mb_ereg_replace('@COMMUNITY_NAME@', htmlspecialchars($diary_comment_row['community_name']), $comment_contents);
             $comment_contents = mb_ereg_replace('@BODY@', nl2br(htmlspecialchars($diary_comment_row['body'])), $comment_contents);
             $comments .= $comment_contents;
         }
     }
     // コメントの置換
     $contents = mb_ereg_replace('@COMMENTS@', $comments, $contents);
     // contents 自身の変換
     if ($encoding != '') {
         $contents = mb_convert_encoding($contents, $encoding);
     }
     // ファイルへの出力
     $fp = fopen($this->diary_dir . '/' . $html_file, "w");
     fputs($fp, $contents);
     fclose($fp);
     return $html_file;
 }
示例#12
0
 function execute()
 {
     $context = $this->getContext();
     $controller = $context->getController();
     $request = $context->getRequest();
     $user = $context->getUser();
     //mode 画面の遷移を取得する
     $move_id = $request->getParameter('move_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'));
     // ユーザー情報
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     // 対象となるUserIDを取得
     $user_community_id = $request->getParameter('id');
     /* 入力画面より */
     if ($move_id == 1) {
         //☆☆ ここからほぼ同じ
         // 画面上のフォーム情報を取得する
         $form['subject'] = $request->getParameter('subject');
         //件名:subject
         $form['body'] = $request->getParameter('body');
         //内容:body
         $form['open_level_code'] = $request->getParameter('open_level_code');
         //公開範囲コード:open_level_code
         foreach ($open_level_master_row_array as $open_level_master_row) {
             if ($open_level_master_row['open_level_code'] == $form['open_level_code']) {
                 $form['open_level_name'] = htmlspecialchars($open_level_master_row['open_level_name']);
                 //公開範囲表示名:open_level_name
             }
         }
         $form['trusted_community_flag'] = $request->getParameter('trusted_community_flag');
         //マイフレンズグループを指定した場合
         $form['trusted_community_id_array'] = $request->getParameter('trusted_community_id_array');
         //選択したグループ群
         $form['new_file'] = $request->getParameter('new_file');
         //画像:new_file
         //ファイル情報のあるなしをチェックしておく
         if (!ini_get('mbstring.encoding_translation')) {
             $form['file_name'] = mb_convert_encoding($_FILES['new_file']['name'], mb_internal_encoding(), mb_http_output());
         } else {
             $form['file_name'] = $_FILES['new_file']['name'];
         }
         if ($form['file_name'] != '') {
             /* ディレクトリ存在チェック */
             // ない場合は作成する
             $to_dir = ACS_TEMPORARY_FILE_DIR;
             if (!file_exists($to_dir)) {
                 mkdir($to_dir);
                 chmod($to_dir, 0777);
             }
             //ファイルがある場合、仮置き場所を設定する
             $_FILES['new_file']['upload_tmp_dir'] = ACS_TEMPORARY_FILE_DIR;
             //仮置きのファイル名を設定する
             $type_name = session_id();
             $upload = $_FILES['new_file']['upload_tmp_dir'];
             $upload .= $type_name;
             if (!move_uploaded_file($_FILES['new_file']['tmp_name'], $upload)) {
                 echo "Read file failed.\n";
             }
             $_FILES['new_file']['tmp_name'] = $upload;
             $form['file_obj'] = $_FILES['new_file'];
             $user->setAttribute('new_file_info', $upload);
             $user->setAttribute('new_file_obj', $_FILES['new_file']);
         }
         $form['user_community_id'] = $user_community_id;
         $user->setAttribute('new_form_obj', $form);
         //☆☆ ここまでほぼ同じ
         return View::SUCCESS;
         /* 登録確定ボタン「はい」より */
     } else {
         if ($move_id == 2) {
             $user_community_id = $request->getParameter('id');
             //☆☆ ここからほぼ同じ
             // 画面上のフォーム情報を取得する
             $form = $user->getAttribute('new_form_obj');
             $new_file_obj = $form['file_obj'];
             // ☆☆ ここまでほぼ同じ
             // DBへの書き込み等
             ACSDB::_do_query("BEGIN");
             if ($form['file_name'] != "") {
                 //ファイル情報があった場合
                 //1.ファイル情報取得(新規)
                 $file_obj = ACSFile::get_upload_file_info_instance($user->getAttribute('new_file_obj'), $user_community_id, $form['user_community_id']);
                 if ($file_obj) {
                     //form情報へ登録
                     $form['new_file'] = $file_obj;
                 } else {
                     echo "Create file failed.";
                     return;
                 }
             }
             //2.Diaryテーブル情報
             $ret = ACSDiary::set_Diary($form);
             if ($ret) {
                 ACSDB::_do_query("COMMIT");
             } else {
                 ACSDB::_do_query("ROLLBACK");
             }
             // 書き込み後、GETの処理へ
             $diary_top_page_url = $this->getControllerPath('User', 'Diary') . '&id=' . $user_community_id;
             header("Location: {$diary_top_page_url}");
         }
     }
 }
示例#13
0
 /**
 * BBSを検索するためのwhere句の1部を作成
 *
 * @param $form 条件
    [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		//すべてのCommunityを選択
 * @return str_array($like_sql , $err_str , $str_count)
 */
 static function set_bbs_where_list($form, $flag)
 {
     $str_array = array();
     $str_array['like_sql'] = "";
     //成功時の戻り値
     $str_array['err_str'] = "";
     //失敗時の戻り値
     $str_array['str_count'] = 1;
     //成功時のキーワード数
     // 検索キーワードの取得(注意!バイト単位で処理)
     $search_text = $form['q_text'];
     //formから検索文字列を取得
     //〜〜〜〜〜〜〜〜〜〜〜〜〜〜配列として利用(Likeの作成)〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
     if ($search_text != '') {
         $search_args = ACSLib::get_query_array_array($search_text);
         //検索文字列配列に変換
     }
     if (count($search_args) > 0) {
         //検索文字列が存在する場合
         $search_args = ACSLib::escape_sql_array($search_args);
         //キーワードwhere句の追記
         //次のいずれかは必須
         $str_like = '';
         //件名を選択している場合
         if ($form['search_title']) {
             $str_title = " bbs.subject";
             $str_like_array = ACSDiary::create_sql_where_field($search_args, $str_title, $flag);
             $str_like = " (" . $str_like_array['str_like'] . ") ";
             $str_array['str_count'] = $str_like_array['str_count'];
         }
         //本文を選択している場合
         if ($form['search_all']) {
             $str_body = " bbs.body";
             if ($str_like != "") {
                 $str_like = $str_like . " OR ";
                 //件名と共に選択している場合
             }
             $where_sql_array = ACSDiary::create_sql_where_field($search_args, $str_body, $flag);
             $where_sql = " (" . $where_sql_array['str_like'] . ") ";
             $str_like = $str_like . $where_sql;
             $str_array['str_count'] = $where_sql_array['str_count'];
         }
         //キーワードwhere句の追記終了
         if ($str_like == "") {
             //キーワードがあるのに、対象がない場合
             $str_array['err_str'] = ACSMsg::get_mdmsg(__FILE__, 'M005');
         } else {
             $str_array['like_sql'] = $str_array['like_sql'] . $str_array['like_sql'] . " AND (" . $str_like . ") ";
         }
     }
     //〜〜〜〜〜〜〜〜〜〜〜〜〜〜特定日記検索〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
     //必ずAND
     if (!$form['search_all_about']) {
         //すべての	Communityを選択していない場合
         $str_array['like_sql'] = $str_array['like_sql'] . " AND bbs.community_id  = " . $form['community_id'];
     }
     // エラーメッセージが配列になってしまう暫定対処
     return $str_array;
 }
 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;
 }
 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;
 }
 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;
 }
示例#17
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 (empty($user_community_id)) {
         $user_community_id = $acs_user_info_row['user_community_id'];
     }
     // 表示対象のユーザが存在しない場合は、エラーを表示
     if (!ACSUser::get_user_info_row_by_user_community_id($user_community_id)) {
         // 未ログインの時はPublic/Indexに遷移
         header("Location: ./index.php?module=Public&action=Index");
         //			return View::ERROR;
     }
     // 自身のページか
     if ($acs_user_info_row['user_community_id'] == $user_community_id) {
         $is_self_page = 1;
     } else {
         $is_self_page = 0;
     }
     // プロフィール
     $target_user_info_row = ACSUser::get_user_profile_row($user_community_id);
     // マイフレンズ
     $friends_row_array = ACSUser::get_simple_friends_row_array($user_community_id);
     // マイコミュニティ
     $community_row_array = ACSUser::get_community_row_array($user_community_id);
     // 最終ログイン
     // ログイン済みの場合
     if ($acs_user_info_row['is_login_user']) {
         $last_login_row = ACSCommunity::get_contents_row($user_community_id, ACSMsg::get_mst('contents_type_master', 'D52'));
     }
     // マイページデザインを取得する
     $selection_css_row = ACSCommunity::get_contents_row($user_community_id, ACSMsg::get_mst('contents_type_master', 'D53'));
     $selection_css = $selection_css_row['contents_value'] == '' ? ACS_DEFAULT_SELECTION_CSS_FILE : $selection_css_row['contents_value'];
     $waiting_for_join_community_row_array_array = array();
     $waiting_for_parent_community_link_row_array_array = array();
     $waiting_for_sub_community_link_row_array_array = array();
     foreach ($community_row_array as $index => $community_row) {
         $community_row_array[$index]['contents_row_array']['self'] = ACSCommunity::get_contents_row($community_row['community_id'], ACSMsg::get_mst('contents_type_master', 'D00'));
         $community_row_array[$index]['is_community_admin'] = ACSCommunity::is_community_admin($acs_user_info_row['user_community_id'], $community_row['community_id']);
         $community_row_array[$index]['is_community_member'] = ACSCommunity::is_community_member($acs_user_info_row['user_community_id'], $community_row['community_id']);
         if ($is_self_page) {
             // 待機: コミュニティ参加 承認待ち (自分のマイコミュニティ)
             if ($community_row['is_community_admin'] && ($waiting_row_array = ACSWaiting::get_waiting_row_array($community_row['community_id'], ACSMsg::get_mst('waiting_type_master', 'D20'), ACSMsg::get_mst('waiting_status_master', 'D10')))) {
                 $waiting_for_join_community_row_array['waiting_row_array'] = $waiting_row_array;
                 $waiting_for_join_community_row_array['community_row'] = $community_row;
                 array_push($waiting_for_join_community_row_array_array, $waiting_for_join_community_row_array);
             }
             // 待機: 親コミュニティ追加 承認待ち
             if ($community_row['is_community_admin'] && ($waiting_row_array = ACSWaiting::get_waiting_row_array($community_row['community_id'], ACSMsg::get_mst('waiting_type_master', 'D40'), ACSMsg::get_mst('waiting_status_master', 'D10')))) {
                 $waiting_for_parent_community_link_row_array['waiting_row_array'] = $waiting_row_array;
                 $waiting_for_parent_community_link_row_array['community_row'] = $community_row;
                 array_push($waiting_for_parent_community_link_row_array_array, $waiting_for_parent_community_link_row_array);
             }
             // 待機: サブコミュニティ追加 承認待ち
             if ($community_row['is_community_admin'] && ($waiting_row_array = ACSWaiting::get_waiting_row_array($community_row['community_id'], ACSMsg::get_mst('waiting_type_master', 'D50'), ACSMsg::get_mst('waiting_status_master', 'D10')))) {
                 $waiting_for_sub_community_link_row_array['waiting_row_array'] = $waiting_row_array;
                 $waiting_for_sub_community_link_row_array['community_row'] = $community_row;
                 array_push($waiting_for_sub_community_link_row_array_array, $waiting_for_sub_community_link_row_array);
             }
         }
     }
     if ($is_self_page) {
         // 待機: マイフレンズ追加 承認待ち
         $waiting_for_add_friends_row_array = ACSWaiting::get_waiting_row_array($user_community_id, ACSMsg::get_mst('waiting_type_master', 'D10'), ACSMsg::get_mst('waiting_status_master', 'D10'));
         // 待機: コミュニティ招待 承認待ち
         $waiting_for_invite_to_community_row_array = ACSWaiting::get_waiting_row_array($user_community_id, ACSMsg::get_mst('waiting_type_master', 'D30'), ACSMsg::get_mst('waiting_status_master', 'D10'));
         // マイダイアリーの新着コメント
         $new_comment_diary_row_array = ACSDiary::get_new_comment_diary_row_array($user_community_id);
         // 新着メッセージ
         $new_message_row_array = ACSMessage::get_new_message_row_array($user_community_id);
         // システムからのお知らせ
         $system_announce_row_array = ACSSystemAnnounce::get_valid_system_announce_row_array();
     }
     // set
     $request->setAttribute('user_community_id', $user_community_id);
     $request->setAttribute('target_user_info_row', $target_user_info_row);
     $request->setAttribute('is_self_page', $is_self_page);
     $request->setAttribute('friends_row_array', $friends_row_array);
     $request->setAttribute('community_row_array', $community_row_array);
     $request->setAttribute('waiting_for_add_friends_row_array', $waiting_for_add_friends_row_array);
     $request->setAttribute('waiting_for_join_community_row_array_array', $waiting_for_join_community_row_array_array);
     $request->setAttribute('waiting_for_parent_community_link_row_array_array', $waiting_for_parent_community_link_row_array_array);
     $request->setAttribute('waiting_for_sub_community_link_row_array_array', $waiting_for_sub_community_link_row_array_array);
     $request->setAttribute('waiting_for_invite_to_community_row_array', $waiting_for_invite_to_community_row_array);
     $request->setAttribute('new_comment_diary_row_array', $new_comment_diary_row_array);
     $request->setAttribute('system_announce_row_array', $system_announce_row_array);
     $request->setAttribute('last_login', $last_login_row['contents_value']);
     $request->setAttribute('selection_css', $selection_css);
     $request->setAttribute('new_message_row_array', $new_message_row_array);
     return View::SUCCESS;
 }