PageRenderTime 44ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/source/include/thread/thread_pay.php

https://github.com/kuaileshike/upload
PHP | 53 lines | 40 code | 7 blank | 6 comment | 12 complexity | 11eeb1e2e11c556c26763efa9de43295 MD5 | raw file
  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_pay.php 25889 2011-11-24 09:52:20Z monkey $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if(!isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]])) {
  12. showmessage('credits_transaction_disabled');
  13. }
  14. $extcredit = 'extcredits'.$_G['setting']['creditstransextra'][1];
  15. $payment = C::t('common_credit_log')->count_stc_by_relatedid($_G['tid'], $_G['setting']['creditstransextra'][1]);
  16. $thread['payers'] = $payment['payers'];
  17. $thread['netprice'] = !$_G['setting']['maxincperthread'] || ($_G['setting']['maxincperthread'] && $payment['income'] < $_G['setting']['maxincperthread']) ? floor($thread['price'] * (1 - $_G['setting']['creditstax'])) : 0;
  18. $thread['creditstax'] = sprintf('%1.2f', $_G['setting']['creditstax'] * 100).'%';
  19. $thread['endtime'] = $_G['setting']['maxchargespan'] ? dgmdate($_G['forum_thread']['dateline'] + $_G['setting']['maxchargespan'] * 3600, 'u') : 0;
  20. $thread['price'] = $_G['forum_thread']['price'];
  21. $firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']);
  22. if($firstpost) {
  23. $member = getuserbyuid($firstpost['authorid']);
  24. $firstpost['groupid'] = $member['groupid'];
  25. }
  26. $pid = $firstpost['pid'];
  27. $freemessage = array();
  28. $freemessage[$pid]['message'] = '';
  29. if(preg_match_all("/\[free\](.+?)\[\/free\]/is", $firstpost['message'], $matches)) {
  30. foreach($matches[1] AS $match) {
  31. $freemessage[$pid]['message'] .= discuzcode($match, $firstpost['smileyoff'], $firstpost['bbcodeoff'], sprintf('%00b', $firstpost['htmlon']), $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'] ? -$firstpost['groupid'] : 0, $_G['forum']['allowimgcode'], $_G['forum']['allowhtml'], ($_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0), 0, $post['authorid'], $_G['forum']['allowmediacode'], $pid).'<br />';
  32. }
  33. }
  34. $attachtags = array();
  35. if($_G['group']['allowgetattach'] || $_G['group']['allowgetimage']) {
  36. if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $freemessage[$pid]['message'], $matchaids)) {
  37. $attachtags[$pid] = $matchaids[1];
  38. }
  39. }
  40. if($attachtags) {
  41. require_once libfile('function/attachment');
  42. parseattach($pid, $attachtags, $freemessage);
  43. }
  44. $thread['freemessage'] = $freemessage[$pid]['message'];
  45. unset($freemessage);
  46. ?>