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_c_topic_write_confirm extends OpenPNE_Action |
---|
8 | { |
---|
9 | function handleError($errors) |
---|
10 | { |
---|
11 | $_REQUEST['err_msg'] = $errors; |
---|
12 | openpne_forward('pc', 'page', 'c_topic_detail', $errors); |
---|
13 | exit; |
---|
14 | } |
---|
15 | |
---|
16 | function execute($requests) |
---|
17 | { |
---|
18 | $u = $GLOBALS['AUTH']->uid(); |
---|
19 | |
---|
20 | // --- リクエスト変数 |
---|
21 | $c_commu_topic_id = $requests['target_c_commu_topic_id']; |
---|
22 | $body = $requests['body']; |
---|
23 | $button = $requests['button']; |
---|
24 | // ---------- |
---|
25 | |
---|
26 | //TODO:画像バリデータ |
---|
27 | $upfile_obj1 = $_FILES['image_filename1']; |
---|
28 | $upfile_obj2 = $_FILES['image_filename2']; |
---|
29 | $upfile_obj3 = $_FILES['image_filename3']; |
---|
30 | |
---|
31 | //エラーチェック |
---|
32 | $err_msg = array(); |
---|
33 | |
---|
34 | if (empty($upfile_obj1) && $upfile_obj1['error'] !== UPLOAD_ERR_NO_FILE) { |
---|
35 | if (!($image = t_check_image($upfile_obj1))) { |
---|
36 | $err_msg[] = '画像1は'.IMAGE_MAX_FILESIZE.'KB以内のGIF・JPEG・PNGにしてください'; |
---|
37 | } |
---|
38 | } |
---|
39 | if (empty($upfile_obj2) && $upfile_obj2['error'] !== UPLOAD_ERR_NO_FILE) { |
---|
40 | if (!($image = t_check_image($upfile_obj2))) { |
---|
41 | $err_msg[] = '画像2は'.IMAGE_MAX_FILESIZE.'KB以内のGIF・JPEG・PNGにしてください'; |
---|
42 | } |
---|
43 | } |
---|
44 | if (empty($upfile_obj3) && $upfile_obj3['error'] !== UPLOAD_ERR_NO_FILE) { |
---|
45 | if (!($image = t_check_image($upfile_obj3))) { |
---|
46 | $err_msg[] = '画像3は'.IMAGE_MAX_FILESIZE.'KB以内のGIF・JPEG・PNGにしてください'; |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | if ($err_msg) { |
---|
51 | $_REQUEST['err_msg'] = $err_msg; |
---|
52 | openpne_forward('pc', 'page', "c_topic_detail"); |
---|
53 | exit; |
---|
54 | } |
---|
55 | //----- |
---|
56 | |
---|
57 | $c_topic = c_topic_detail_c_topic4c_commu_topic_id($c_commu_topic_id); |
---|
58 | $c_commu_id = $c_topic['c_commu_id']; |
---|
59 | |
---|
60 | //--- 権限チェック |
---|
61 | if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) { |
---|
62 | handle_kengen_error(); |
---|
63 | } |
---|
64 | //--- |
---|
65 | |
---|
66 | $sessid = session_id(); |
---|
67 | t_image_clear_tmp($sessid); |
---|
68 | $tmpfile1 = t_image_save2tmp($upfile_obj1, $sessid, "tc_1"); |
---|
69 | $tmpfile2 = t_image_save2tmp($upfile_obj2, $sessid, "tc_2"); |
---|
70 | $tmpfile3 = t_image_save2tmp($upfile_obj3, $sessid, "tc_3"); |
---|
71 | |
---|
72 | $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id)); |
---|
73 | $topic_write['target_c_commu_topic_id'] = $c_commu_topic_id; |
---|
74 | $topic_write['body'] = $body; |
---|
75 | $topic_write['image_filename1_tmpfile']=$tmpfile1; |
---|
76 | $topic_write['image_filename2_tmpfile']=$tmpfile2; |
---|
77 | $topic_write['image_filename3_tmpfile']=$tmpfile3; |
---|
78 | $topic_write['image_filename1']=$upfile_obj1["name"]; |
---|
79 | $topic_write['image_filename2']=$upfile_obj2["name"]; |
---|
80 | $topic_write['image_filename3']=$upfile_obj3["name"]; |
---|
81 | $this->set('topic_write', $topic_write); |
---|
82 | return 'success'; |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | ?> |
---|