1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2006 OpenPNE Project |
---|
4 | * @license http://www.php.net/license/3_01.txt PHP License 3.01 |
---|
5 | */ |
---|
6 | |
---|
7 | /** |
---|
8 | * 日記を書く |
---|
9 | */ |
---|
10 | class ktai_do_h_diary_edit_insert_c_diary extends OpenPNE_Action |
---|
11 | { |
---|
12 | function execute($requests) |
---|
13 | { |
---|
14 | $tail = $GLOBALS['KTAI_URL_TAIL']; |
---|
15 | $u = $GLOBALS['KTAI_C_MEMBER_ID']; |
---|
16 | |
---|
17 | // --- リクエスト変数 |
---|
18 | $subject = $requests['subject']; |
---|
19 | $body = $requests['body']; |
---|
20 | $public_flag = $requests['public_flag']; |
---|
21 | $target_c_diary_id = $requests['target_c_diary_id']; |
---|
22 | // ---------- |
---|
23 | |
---|
24 | if (is_null($subject) || $subject === '') { |
---|
25 | $p = array('target_c_diary_id' => $target_c_diary_id, 'msg' => 2); |
---|
26 | openpne_redirect('ktai', 'page_h_diary_edit', $p); |
---|
27 | } |
---|
28 | |
---|
29 | if (is_null($body) || $body === '') { |
---|
30 | $p = array('target_c_diary_id' => $target_c_diary_id, 'msg' => 1); |
---|
31 | openpne_redirect('ktai', 'page_h_diary_edit', $p); |
---|
32 | } |
---|
33 | |
---|
34 | if (!$target_c_diary_id) { |
---|
35 | $update_c_diary_id = db_diary_insert_c_diary($u, $subject, $body, $public_flag); |
---|
36 | } else { |
---|
37 | $update_c_diary_id = $target_c_diary_id; |
---|
38 | |
---|
39 | $c_diary = db_diary_get_c_diary4id($target_c_diary_id); |
---|
40 | if ($c_diary['c_member_id'] != $u) { |
---|
41 | handle_kengen_error(); |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | /* |
---|
46 | * 携帯はWEBでは画像UPLOADなし |
---|
47 | */ |
---|
48 | db_diary_update_c_diary($update_c_diary_id, $subject, $body, $public_flag); |
---|
49 | |
---|
50 | $p = array('target_c_member_id' => $u); |
---|
51 | openpne_redirect('ktai', 'page_fh_diary_list', $p); |
---|
52 | } |
---|
53 | } |
---|
54 | |
---|
55 | ?> |
---|