www.gusucode.com > 迪恩育儿亲子4商城商家+手机版【整站带测试数据】源码程序 > web/source/include/thread/thread_album.php

    <?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]);
	}
}
?>