-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattachment.inc.php
31 lines (24 loc) · 994 Bytes
/
attachment.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
include('./source/plugin/iltc_open/public.php');
$result = array();
switch($_G['gp_action']){
case 'view':
if(isset($_G['gp_tid']) && isset($_G['gp_aid'])){
$tid = $_G['gp_tid'];
$aid = $_G['gp_aid'];
}else showError('Missing Parameter');
$tableid = $tid % 10;
$sql = "SELECT dateline, filename, filesize, attachment, description, isimage, thumb, picid FROM "
.DB::table('forum_attachment_'.$tableid)." WHERE aid = $aid AND tid = $tid LIMIT 1";
$query = DB::query($sql);
$result['data'] = DB::fetch($query);
if($result['data'] != false){
$result['data']['filename'] = iconv("GBK", "UTF-8", $result['data']['filename']);
$result['data']['description'] = iconv("GBK", "UTF-8", $result['data']['description']);
$result['data']['attachment'] = $_G['setting']['attachurl'].'forum/'.$result['data']['attachment'];
}else showError('No Attachment Found');
showResult($result, 'success');
break;
default:
showError('Missing Parameter');
}