1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2007 OpenPNE Project |
---|
4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
5 | */ |
---|
6 | |
---|
7 | class pc_page_fh_diary extends OpenPNE_Action |
---|
8 | { |
---|
9 | function execute($requests) |
---|
10 | { |
---|
11 | $u = $GLOBALS['AUTH']->uid(); |
---|
12 | |
---|
13 | // --- リクエスト変数 |
---|
14 | $target_c_diary_id = $requests['target_c_diary_id']; |
---|
15 | $body = $requests['body']; |
---|
16 | // ---------- |
---|
17 | |
---|
18 | // target が指定されていない |
---|
19 | if (!$target_c_diary_id) { |
---|
20 | openpne_redirect('pc', 'page_h_err_fh_diary'); |
---|
21 | } |
---|
22 | // target の日記が存在しない |
---|
23 | if (!p_common_is_active_c_diary_id($target_c_diary_id)) { |
---|
24 | openpne_redirect('pc', 'page_h_err_fh_diary'); |
---|
25 | } |
---|
26 | |
---|
27 | |
---|
28 | $target_c_diary = db_diary_get_c_diary4id($target_c_diary_id); |
---|
29 | $target_c_member_id = $target_c_diary['c_member_id']; |
---|
30 | |
---|
31 | if ($target_c_member_id == $u) { |
---|
32 | $type = 'h'; |
---|
33 | |
---|
34 | //日記を閲覧済みにする |
---|
35 | db_diary_update_c_diary_is_checked($target_c_diary_id, 1); |
---|
36 | |
---|
37 | } else { |
---|
38 | $type = 'f'; |
---|
39 | $target_c_member = db_member_c_member4c_member_id($target_c_member_id); |
---|
40 | $is_friend = db_friend_is_friend($u, $target_c_member_id); |
---|
41 | |
---|
42 | // check public_flag |
---|
43 | if (!pne_check_diary_public_flag($target_c_diary_id, $u)) { |
---|
44 | openpne_redirect('pc', 'page_h_err_diary_access'); |
---|
45 | } |
---|
46 | // アクセスブロック |
---|
47 | if (db_member_is_access_block($u, $target_c_member_id)) { |
---|
48 | openpne_redirect('pc', 'page_h_access_block'); |
---|
49 | } |
---|
50 | |
---|
51 | // あしあとをつける |
---|
52 | db_ashiato_insert_c_ashiato($target_c_member_id, $u); |
---|
53 | } |
---|
54 | $this->set("type", $type); |
---|
55 | |
---|
56 | $this->set('inc_navi', fetch_inc_navi($type, $target_c_member_id)); |
---|
57 | |
---|
58 | $this->set("member", db_member_c_member4c_member_id($u)); |
---|
59 | |
---|
60 | $this->set("target_member", db_member_c_member4c_member_id($target_c_member_id)); |
---|
61 | $this->set("target_diary", $target_c_diary); |
---|
62 | $this->set("target_diary_comment_list", db_diary_get_c_diary_comment_list4c_diary_id($target_c_diary_id)); |
---|
63 | |
---|
64 | $this->set("body", $body); |
---|
65 | |
---|
66 | //最近の日記を取得 |
---|
67 | $list_set = p_fh_diary_list_diary_list4c_member_id($target_c_member_id, 7, 1, $u); |
---|
68 | $this->set("new_diary_list", $list_set[0]); |
---|
69 | |
---|
70 | //カレンダー関係 |
---|
71 | //カレンダー開始用変数 |
---|
72 | $time = strtotime($target_c_diary['r_datetime']); |
---|
73 | $year = date('Y', $time); |
---|
74 | $month= date('n', $time); |
---|
75 | //日記一覧、カレンダー用変数 |
---|
76 | $date_val = array( |
---|
77 | 'year' => $year, |
---|
78 | 'month' => $month, |
---|
79 | 'day' => null, |
---|
80 | ); |
---|
81 | $this->set("date_val", $date_val); |
---|
82 | |
---|
83 | //日記のカレンダー |
---|
84 | $calendar = db_common_diary_monthly_calendar($year, $month, $target_c_member_id, $u); |
---|
85 | |
---|
86 | $this->set("calendar", $calendar['days']); |
---|
87 | $this->set("ym", $calendar['ym']); |
---|
88 | |
---|
89 | //各月の日記 |
---|
90 | $this->set("date_list", p_fh_diary_list_date_list4c_member_id($target_c_member_id)); |
---|
91 | |
---|
92 | if (USE_DIARY_CATEGORY) { |
---|
93 | //カテゴリ一覧 |
---|
94 | $this->set('category', db_diary_category_list4c_member_id($target_c_member_id)); |
---|
95 | |
---|
96 | //この日記のカテゴリリストを得る |
---|
97 | $this->set("category_list", db_diary_category_list4c_diary_id($target_c_diary_id)); |
---|
98 | } |
---|
99 | |
---|
100 | return 'success'; |
---|
101 | } |
---|
102 | } |
---|
103 | |
---|
104 | ?> |
---|