1 | <?php |
---|
2 | /** |
---|
3 | * @copyright 2005-2008 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_c_join_request_insert_c_commu_member_confirm extends OpenPNE_Action |
---|
11 | { |
---|
12 | function handleError($errors) |
---|
13 | { |
---|
14 | if (!empty($errors['target_c_commu_id'])) { |
---|
15 | |
---|
16 | } elseif (!empty($errors['body'])) { |
---|
17 | $target_c_commu_id = $this->requests['target_c_commu_id']; |
---|
18 | $tail = $GLOBALS['KTAI_URL_TAIL']; |
---|
19 | $p = array('target_c_commu_id' => $target_c_commu_id, 'msg' => 1); |
---|
20 | openpne_redirect('ktai', 'page_c_join_request', $p); |
---|
21 | } |
---|
22 | parent::handleError($errors); |
---|
23 | } |
---|
24 | |
---|
25 | function execute($requests) |
---|
26 | { |
---|
27 | $tail = $GLOBALS['KTAI_URL_TAIL']; |
---|
28 | $u = $GLOBALS['KTAI_C_MEMBER_ID']; |
---|
29 | |
---|
30 | // --- リクエスト変数 |
---|
31 | $target_c_commu_id = $requests['target_c_commu_id']; |
---|
32 | $body = $requests['body']; |
---|
33 | // ---------- |
---|
34 | |
---|
35 | $c_member_id_from = $u; |
---|
36 | $c_commu = db_commu_c_commu4c_commu_id($target_c_commu_id); |
---|
37 | |
---|
38 | //--- 権限チェック |
---|
39 | //コミュニティメンバーでない and 参加承認中でない |
---|
40 | |
---|
41 | $status = db_common_commu_status($u, $target_c_commu_id); |
---|
42 | if ($status['is_commu_member'] || |
---|
43 | $status['is_commu_member_confirm']) { |
---|
44 | handle_kengen_error(); |
---|
45 | } |
---|
46 | //--- |
---|
47 | |
---|
48 | db_commu_insert_c_commu_member_confirm($target_c_commu_id, $c_member_id_from, $body); |
---|
49 | |
---|
50 | list($subject, $body_disp) = create_message_commu_join_request($u, $body, $target_c_commu_id); |
---|
51 | db_message_send_message_syoudaku($u, $c_commu['c_member_id_admin'], $subject, $body_disp); |
---|
52 | if ($c_commu['c_member_id_sub_admin']) { |
---|
53 | db_message_send_message_syoudaku($u, $c_commu['c_member_id_sub_admin'], $subject, $body_disp); |
---|
54 | } |
---|
55 | |
---|
56 | $p = array('target_c_commu_id' => $target_c_commu_id); |
---|
57 | openpne_redirect('ktai', 'page_c_home', $p); |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | ?> |
---|