ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 2063


Ignore:
Timestamp:
Mar 12, 2007, 2:45:34 PM (13 years ago)
Author:
takanashi
Message:

コミュニティトピックへのファイルアップロード機能(途中版)

Location:
OpenPNE/branches/takanashi/fileupload/webapp
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/takanashi/fileupload/webapp/lib/controller.php

    r1856 r2063  
    139139    list($result, $requests) = $validator->common_validate($files);
    140140    $action_obj->requests = $requests;
    141 
    142141    if ($result === false) {
    143142        $errors = $validator->getErrors();
  • OpenPNE/branches/takanashi/fileupload/webapp/lib/db/commu.php

    r2040 r2063  
    802802
    803803    $hint = db_mysql_hint('USE INDEX (r_datetime_c_commu_id)');
    804     $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, cct.name AS c_commu_topic_name, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
    805         ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
    806         ' GROUP BY cctc.c_commu_topic_id'.
    807         ' ORDER BY r_datetime DESC';
     804    $sql = 'SELECT c_commu_id, c_commu_topic_id, name AS c_commu_topic_name, r_datetime, c_member_id'.
     805        ' FROM c_commu_topic'. $hint . ' WHERE c_commu_id IN (' . $ids . ') ORDER BY r_datetime DESC';
    808806    $c_commu_topic_list = db_get_all_limit($sql, 0, $limit);
    809807
     
    841839
    842840    $hint = db_mysql_hint('USE INDEX (r_datetime_c_commu_id)');
    843     $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, cct.name AS c_commu_topic_name, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
    844         ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
    845         ' GROUP BY cctc.c_commu_topic_id'.
    846         ' ORDER BY r_datetime DESC';
     841    $sql = 'SELECT c_commu_id, c_commu_topic_id, name AS c_commu_topic_name, r_datetime, c_member_id'.
     842        ' FROM c_commu_topic'. $hint . ' WHERE c_commu_id IN (' . $ids . ') ORDER BY r_datetime DESC';
    847843    $c_commu_topic_list = db_get_all_limit($sql, ($page-1)*$limit, $limit);
    848844
     
    14901486
    14911487    $hint = db_mysql_hint('USE INDEX (r_datetime_c_commu_id)');
    1492     $sql = 'SELECT cct.c_commu_topic_id, cct.c_commu_id, cct.name AS c_commu_topic_name, MAX(cctc.r_datetime) as r_datetime, cct.c_member_id'.
    1493         ' FROM c_commu_topic as cct, c_commu_topic_comment as cctc'. $hint . ' WHERE cct.c_commu_id IN (' . $ids . ') AND cctc.c_commu_topic_id = cct.c_commu_topic_id'.
    1494         ' GROUP BY cctc.c_commu_topic_id'.
    1495         ' ORDER BY r_datetime DESC';
     1488    $sql = 'SELECT c_commu_id, c_commu_topic_id, name AS c_commu_topic_name, r_datetime, c_member_id'.
     1489        ' FROM c_commu_topic'. $hint . ' WHERE c_commu_id IN (' . $ids . ') ORDER BY r_datetime DESC';
    14961490    $c_commu_topic_list = db_get_all_page($sql, $page, $page_size);
    14971491
     
    24872481        'image_filename2'  => strval($comment['image_filename2']),
    24882482        'image_filename3'  => strval($comment['image_filename3']),
     2483        'filename4'  => strval($comment['filename4']),
    24892484        'r_datetime'       => db_now(),
    24902485        'r_date'           => db_now(),
  • OpenPNE/branches/takanashi/fileupload/webapp/lib/util.inc.php

    r1856 r2063  
    1414require_once dirname(__FILE__) . '/util/emoji.php';
    1515require_once dirname(__FILE__) . '/util/cache.php';
     16require_once dirname(__FILE__) . '/util/upload.php';
    1617
    1718?>
  • OpenPNE/branches/takanashi/fileupload/webapp/modules/pc/do/c_topic_add_insert_c_commu_topic.php

    r1856 r2063  
    1717        $image_filename3_tmpfile = $requests['image_filename3_tmpfile'];
    1818        $body = $requests['body'];
     19
     20        //---添付ファイル
     21        $filename4_tmpfile = $requests['filename4_tmpfile'];
     22error_log("pc_do_c_topic_add_insert_c_commu_topic filename:".$filename4_tmpfile);
     23error_log("requests:".print_r($requests,1));
    1924
    2025        //---権限チェック
     
    3843        //---
    3944
    40 
    4145        $insert_c_commu_topic = array(
    4246            "name"        => $title,
     
    4549            "event_flag"  => 0
    4650        );
     51
    4752        $c_commu_topic_id = db_commu_insert_c_commu_topic($insert_c_commu_topic);
    4853
     
    5661            $filename3 = image_insert_c_image4tmp("t_{$c_commu_topic_id}_3", $image_filename3_tmpfile);
    5762        }
     63
     64        // 添付ファイルをDBに入れる
     65        if ($filename4_tmpfile) {
     66            $filename4 = file_insert_c_file4tmp("t_{$c_commu_topic_id}_4", $filename4_tmpfile);
     67        }
     68error_log("==>c_commu_topic_comment");
     69error_log("filename4_tmpfile ".$filename4_tmpfile);
     70error_log("filename4 ".$filename4);
     71
     72        //テンポラリファイルを削除(画像と同時)
    5873        t_image_clear_tmp(session_id());
    5974
     
    6782            "image_filename2"  => !empty($filename2) ? $filename2 : '',
    6883            "image_filename3"  => !empty($filename3) ? $filename3 : '',
     84            "filename4"  => !empty($filename4) ? $filename4 : '',
    6985        );
    7086        $insert_id = db_commu_insert_c_commu_topic_comment_3($insert_c_commu_topic_comment);
     
    7692
    7793        $p = array('target_c_commu_topic_id' => $c_commu_topic_id);
     94
    7895        openpne_redirect('pc', 'page_c_topic_detail', $p);
    7996    }
  • OpenPNE/branches/takanashi/fileupload/webapp/modules/pc/page/c_topic_add_confirm.php

    r1856 r2063  
    3838            exit;
    3939        }
    40         //---
    4140
    42         //TODO:画像バリデータ
     41        //画像ファイル
    4342        $upfile_obj1 = $_FILES['image_filename1'];
    4443        $upfile_obj2 = $_FILES['image_filename2'];
    4544        $upfile_obj3 = $_FILES['image_filename3'];
     45
     46        //添付ファイル
     47        $upfile_obj4 = $_FILES['uploadfile'];
     48error_log("attached ".print_r($upfile_obj4,1));
    4649
    4750        $err_msg = array();
     
    6366        }
    6467
     68        if ($upfile_obj4['error'] !== UPLOAD_ERR_NO_FILE) {
     69            // UPLOADファイルの拡張子のチェック
     70/*
     71            if (!($image = t_check_filename($upfile_obj3))) {
     72                $err_msg[] = 'アップロードするファイルの拡張子が不正です';
     73            }
     74*/
     75        }
     76
    6577        if ($err_msg) {
    6678            $_REQUEST['err_msg'] = $err_msg;
     
    6880            exit;
    6981        }
     82        $sessid = session_id();
     83       
    7084        //-----
     85        // 一次ファイルをvar/tmpにコピー
     86        $tmpfile4 = t_file_save2tmp($upfile_obj4, $sessid, "t_4");
    7187
     88        //-----
    7289        //画像をvar/tmpフォルダにコピー
    73         $sessid = session_id();
    7490        t_image_clear_tmp($sessid);
    7591        $tmpfile1 = t_image_save2tmp($upfile_obj1, $sessid, "t_1");
     
    88104            'image_filename2'         => $upfile_obj2["name"],
    89105            'image_filename3'         => $upfile_obj3["name"],
     106             // 添付ファイル
     107            'filename4_tmpfile' => $tmpfile4,
     108            'filename4'         => $upfile_obj4["name"],
    90109        );
    91 
     110       
    92111        $this->set('c_topic', $c_topic);
    93112        return 'success';
  • OpenPNE/branches/takanashi/fileupload/webapp/modules/pc/templates/c_topic_add.tpl

    r1818 r2063  
    2929<tr>
    3030<td style="width:36px;" class="bg_06"><img src="({t_img_url_skin filename=content_header_1})" style="width:30px;height:20px;" class="dummy"></td>
    31 <td style="width:598px;padding:2px 0px;" class="bg_06"><span class="b_b c_00">[({$c_commu.name})] 新規トピック作成</span></td>
     31<td style="width:598px;padding:2px 0px;" class="bg_06"><span class="b_b c_00">[({$c_commu.name})] 新規トピック作成とアップロード</span></td>
    3232</tr>
    3333</table>
     
    168168</tr>
    169169({*********})
     170
     171<tr>
     172<td style="height:1px;" class="bg_01" colspan="5"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     173</tr>
     174({*********})
     175<tr>
     176<td class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     177<td class="bg_05" align="left" valign="middle">
     178
     179<div class="padding_s">
     180
     181ファイル
     182
     183</div>
     184
     185</td>
     186<td class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     187<td class="bg_02" align="left" valign="middle">
     188<div class="padding_s">
     189
     190<input type="file" name="uploadfile" size="40">
     191
     192</div>
     193</td>
     194<td class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     195</tr>
     196({*********})
     197
    170198<tr>
    171199<td style="height:1px;" class="bg_01" colspan="5"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
  • OpenPNE/branches/takanashi/fileupload/webapp/modules/pc/templates/c_topic_add_confirm.tpl

    r1081 r2063  
    163163<td style="width:1px;" class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
    164164</tr>
     165
     166({*********})
     167<tr>
     168<td style="width:574px;height:1px;" class="bg_01" colspan="5"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     169</tr>
     170({*********})
     171<tr>
     172<td style="width:1px;" class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     173<td style="width:150px;" class="bg_05" align="left" valign="middle">
     174
     175<div class="padding_s">
     176
     177添付ファイル
     178
     179</div>
     180
     181</td>
     182<td style="width:1px;" class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     183<td style="width:421px;" class="bg_02" align="left" valign="middle">
     184<div class="padding_s">
     185
     186({$c_topic.filename4})
     187
     188</div>
     189</td>
     190<td style="width:1px;" class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     191</tr>
     192
     193
    165194({*********})
    166195<tr>
  • OpenPNE/branches/takanashi/fileupload/webapp/modules/pc/templates/c_topic_detail.tpl

    r1818 r2063  
    4444<tr>
    4545<td style="width:1px;" class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
    46 <td style="width:110px;" class="bg_03" align="center" valign="middle" rowspan="5">
     46<td style="width:110px;" class="bg_03" align="center" valign="middle" rowspan="7">
    4747
    4848<div class="padding_s">
     
    108108</tr>
    109109({*********})
     110<tr>
     111<td style="width:634px;height:1px;" class="bg_01" colspan="5"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     112</tr>
     113
     114
     115<tr>
     116<td style="width:1px;" class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     117<td style="width:1px;" class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     118<td style="width:531px;height:50px;" class="bg_02" align="left" valign="middle">
     119
     120({if $c_topic.filename4})
     121<div class="padding_s">
     122<span class="padding_s">
     123<a href="({t_file_url filename=$c_topic.filename4})" target="_blank">
     124({$c_topic.filename4})
     125</a>
     126</span>
     127</div>
     128({/if})
     129
     130</td>
     131<td style="width:1px;" class="bg_01" align="center"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
     132</tr>
     133
    110134<tr>
    111135<td style="width:634px;height:1px;" class="bg_01" colspan="5"><img src="./skin/dummy.gif" style="width:1px;height:1px;" class="dummy"></td>
  • OpenPNE/branches/takanashi/fileupload/webapp/modules/pc/validate/do/c_topic_add_insert_c_commu_topic.ini

    r2 r2063  
    1919[image_filename3_tmpfile]
    2020type = "string"
     21
     22[filename4_tmpfile]
     23type = "string"
Note: See TracChangeset for help on using the changeset viewer.