thread_album.php
1.89 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: thread_album.php 28709 2012-11-08 08:53:48Z liulanbo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
require_once libfile('function/attachment');
$imglist = $albumpayaids = $attachmentlist = array();
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_G['tid'], 'tid', $_G['tid'], 'aid') as $attach) {
if($attach['uid'] != $_G['forum_thread']['authorid'] && IN_MOBILE != 2) {
continue;
}
if($attach['isimage'] && !$_G['setting']['attachimgpost']) {
$attach['isimage'] = 0;
}
$attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
if(!$attach['attachimg']) {
continue;
}
if($attach['price'] && $_G['uid'] != $attach['uid']) {
$albumpayaids[$attach['aid']] = $attach['aid'];
$attach['payed'] = 0;
} else {
$attach['payed'] = 1;
}
$attachmentlist[$attach['aid']] = $attach;
}
if($albumpayaids) {
foreach(C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid($_G['uid'], 'BAC', array_keys($albumpayaids)) as $creditlog) {
$attachmentlist[$creditlog['relatedid']]['payed'] = 1;
}
}
foreach($attachmentlist as $attach) {
if($attach['payed'] == 0) {
continue;
}
$attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/';
$attach['dbdateline'] = $attach['dateline'];
$attach['dateline'] = dgmdate($attach['dateline'], 'u');
$imglist['aid'][] = $attach['aid'];
$imglist['url'][] = $attach['url'].$attach['attachment'];
$apids[] = $attach['pid'];
}
if(empty($imglist)) {
showmessage('author_not_uploadpic');
}
foreach($postlist as $key=>$subpost) {
if($subpost['first'] == 1 || in_array($subpost['pid'], $apids)) {
unset($postlist[$key]);
}
}
?>