thread_album.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: thread_album.php 28709 2012-11-08 08:53:48Z liulanbo $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. require_once libfile('function/attachment');
  12. $imglist = $albumpayaids = $attachmentlist = array();
  13. foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_G['tid'], 'tid', $_G['tid'], 'aid') as $attach) {
  14. if($attach['uid'] != $_G['forum_thread']['authorid'] && IN_MOBILE != 2) {
  15. continue;
  16. }
  17. if($attach['isimage'] && !$_G['setting']['attachimgpost']) {
  18. $attach['isimage'] = 0;
  19. }
  20. $attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
  21. if(!$attach['attachimg']) {
  22. continue;
  23. }
  24. if($attach['price'] && $_G['uid'] != $attach['uid']) {
  25. $albumpayaids[$attach['aid']] = $attach['aid'];
  26. $attach['payed'] = 0;
  27. } else {
  28. $attach['payed'] = 1;
  29. }
  30. $attachmentlist[$attach['aid']] = $attach;
  31. }
  32. if($albumpayaids) {
  33. foreach(C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid($_G['uid'], 'BAC', array_keys($albumpayaids)) as $creditlog) {
  34. $attachmentlist[$creditlog['relatedid']]['payed'] = 1;
  35. }
  36. }
  37. foreach($attachmentlist as $attach) {
  38. if($attach['payed'] == 0) {
  39. continue;
  40. }
  41. $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/';
  42. $attach['dbdateline'] = $attach['dateline'];
  43. $attach['dateline'] = dgmdate($attach['dateline'], 'u');
  44. $imglist['aid'][] = $attach['aid'];
  45. $imglist['url'][] = $attach['url'].$attach['attachment'];
  46. $apids[] = $attach['pid'];
  47. }
  48. if(empty($imglist)) {
  49. showmessage('author_not_uploadpic');
  50. }
  51. foreach($postlist as $key=>$subpost) {
  52. if($subpost['first'] == 1 || in_array($subpost['pid'], $apids)) {
  53. unset($postlist[$key]);
  54. }
  55. }
  56. ?>