spacecp_credit.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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: spacecp_credit.php 32023 2012-10-31 08:20:37Z liulanbo $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if($_G['inajax'] && $_GET['showcredit']) {
  12. include template('common/extcredits');
  13. exit;
  14. }
  15. $perpage = 20;
  16. $page = empty($_GET['page']) ? 1 : intval($_GET['page']);
  17. if($page < 1) $page = 1;
  18. $start = ($page-1) * $perpage;
  19. ckstart($start, $perpage);
  20. checkusergroup();
  21. $operation = in_array($_GET['op'], array('base', 'buy', 'transfer', 'exchange', 'log', 'rule')) ? trim($_GET['op']) : 'base';
  22. $opactives = array($operation =>' class="a"');
  23. if(in_array($operation, array('base', 'buy', 'transfer', 'exchange', 'rule'))) {
  24. $operation = 'base';
  25. }
  26. include_once libfile('spacecp/credit_'.$operation, 'include');
  27. function makecreditlog($log, $otherinfo=array()) {
  28. global $_G;
  29. $log['dateline'] = dgmdate($log['dateline'], 'Y-m-d H:i');
  30. $log['optype'] = lang('spacecp', 'logs_credit_update_'.$log['operation']);
  31. $log['opinfo'] = '';
  32. $info = $url = '';
  33. switch($log['operation']) {
  34. case 'TRC':
  35. $log['opinfo'] = '<a href="home.php?mod=task&do=view&id='.$log['relatedid'].'" target="_blank">'.lang('home/template', 'done').(!empty($otherinfo['tasks'][$log['relatedid']]) ? ' <strong>'.$otherinfo['tasks'][$log['relatedid']].'</strong> '.lang('home/template', 'eccredit_s') : '').lang('spacecp', 'task_credit').'</a>';
  36. break;
  37. case 'RTC':
  38. $log['opinfo'] = '<a href="forum.php?mod=viewthread&tid='.$log['relatedid'].'" target="_blank">'.lang('forum/template', 'published').(!empty($otherinfo['threads'][$log['relatedid']]['subject']) ? ' <strong>'.$otherinfo['threads'][$log['relatedid']]['subject'].'</strong> '.lang('home/template', 'eccredit_s') : '').lang('spacecp', 'special_3_credit').'</a>';
  39. break;
  40. case 'RAC':
  41. $log['opinfo'] = '<a href="forum.php?mod=viewthread&tid='.$log['relatedid'].'" target="_blank">'.lang('home/template', 'security_answer').(!empty($otherinfo['threads'][$log['relatedid']]['subject']) ? ' <strong>'.$otherinfo['threads'][$log['relatedid']]['subject'].'</strong> '.lang('home/template', 'eccredit_s') : '').lang('spacecp', 'special_3_best_answer').'</a>';
  42. break;
  43. case 'MRC':
  44. $log['opinfo'] = lang('spacecp', 'magic_credit');
  45. break;
  46. case 'BMC':
  47. $log['opinfo'] = '<a href="home.php?mod=magic&action=log&operation=buylog" target="_blank">'.lang('home/template', 'magics_operation_buy').' <strong>'.(!empty($_G['cache']['magics'][$log['relatedid']]['name']) ? $_G['cache']['magics'][$log['relatedid']]['name'] : '').'</strong> '.lang('home/template', 'magic').'</a>';
  48. break;
  49. case 'BME':
  50. $log['opinfo'] = '<a href="home.php?mod=medal" target="_blank">'.lang('spacecp', 'buy_medal').'</a>';
  51. break;
  52. case 'BGC':
  53. $log['opinfo'] = lang('spacecp','magic_space_gift');
  54. break;
  55. case 'RGC':
  56. $log['opinfo'] = lang('spacecp','magic_space_re_gift');
  57. break;
  58. case 'AGC':
  59. $log['opinfo'] = lang('spacecp', 'magic_space_get_gift');
  60. break;
  61. case 'TFR':
  62. $log['opinfo'] = '<a href="home.php?mod=space&uid='.$log['relatedid'].'" target="_blank">'.lang('home/template', 'to').'<strong> '.$otherinfo['users'][$log['relatedid']].' </strong>'.lang('spacecp', 'credit_transfer').'</a>';
  63. break;
  64. case 'RCV':
  65. $log['opinfo'] = '<a href="home.php?mod=space&uid='.$log['relatedid'].'" target="_blank">'.lang('home/template', 'comefrom').'<strong> '.$otherinfo['users'][$log['relatedid']].' </strong>'.lang('spacecp', 'credit_transfer_tips').'</a>';
  66. break;
  67. case 'CEC':
  68. $log['opinfo'] = lang('spacecp', 'credit_exchange_tips_1').'<strong>'.$_G['setting']['extcredits'][$log['minid']]['title'].'</strong> '.lang('spacecp', 'credit_exchange_to').' <strong>'.$_G['setting']['extcredits'][$log['maxid']]['title'].'</strong>';
  69. break;
  70. case 'ECU':
  71. $log['opinfo'] = lang('spacecp', 'credit_exchange_center');
  72. break;
  73. case 'SAC':
  74. $log['opinfo'] = '<a href="forum.php?mod=redirect&goto=findpost&ptid='.$otherinfo['attachs'][$log['relatedid']]['tid'].'&pid='.$otherinfo['attachs'][$log['relatedid']]['pid'].'" target="_blank">'.lang('spacecp', 'attach_sell').' <strong>'.$otherinfo['attachs'][$log['relatedid']]['filename'].'</strong> '.lang('spacecp', 'attach_sell_tips').'</a>';
  75. break;
  76. case 'BAC':
  77. $log['opinfo'] = '<a href="forum.php?mod=redirect&goto=findpost&ptid='.$otherinfo['attachs'][$log['relatedid']]['tid'].'&pid='.$otherinfo['attachs'][$log['relatedid']]['pid'].'" target="_blank">'.lang('spacecp', 'attach_buy').' <strong>'.$otherinfo['attachs'][$log['relatedid']]['filename'].'</strong> '.lang('spacecp', 'attach_buy_tips').'</a>';
  78. break;
  79. case 'PRC':
  80. $tid = $otherinfo['post'][$log['relatedid']];
  81. $log['opinfo'] = '<a href="forum.php?mod=redirect&goto=findpost&pid='.$log['relatedid'].'" target="_blank">'.(!empty($otherinfo['threads'][$tid]['subject']) ? ' <strong>'.$otherinfo['threads'][$tid]['subject'].'</strong> ' : lang('home/template', 'post')).lang('spacecp', 'grade_credit').'</a>';
  82. break;
  83. case 'RSC':
  84. $tid = $otherinfo['post'][$log['relatedid']];
  85. $log['opinfo'] = '<a href="forum.php?mod=redirect&goto=findpost&pid='.$log['relatedid'].'" target="_blank">'.lang('home/template', 'credits_give').(!empty($otherinfo['threads'][$tid]['subject']) ? ' <strong>'.$otherinfo['threads'][$tid]['subject'].'</strong> '.lang('home/template', 'eccredit_s') : '').lang('spacecp', 'grade_credit2').'</a>';
  86. break;
  87. case 'STC':
  88. $log['opinfo'] = '<a href="forum.php?mod=viewthread&tid='.$log['relatedid'].'" target="_blank">'.lang('spacecp', 'attach_sell').(!empty($otherinfo['threads'][$log['relatedid']]['subject']) ? ' <strong>'.$otherinfo['threads'][$log['relatedid']]['subject'].'</strong> '.lang('home/template', 'eccredit_s') : '').lang('spacecp', 'thread_credit').'</a>';
  89. break;
  90. case 'BTC':
  91. $log['opinfo'] = '<a href="forum.php?mod=viewthread&tid='.$log['relatedid'].'" target="_blank">'.lang('spacecp', 'attach_buy').(!empty($otherinfo['threads'][$log['relatedid']]['subject']) ? ' <strong>'.$otherinfo['threads'][$log['relatedid']]['subject'].'</strong> '.lang('home/template', 'eccredit_s') : '').lang('spacecp', 'thread_credit2').'</a>';
  92. break;
  93. case 'AFD':
  94. $log['opinfo'] = lang('spacecp', 'buy_credit');
  95. break;
  96. case 'UGP':
  97. $log['opinfo'] = lang('spacecp', 'buy_usergroup');
  98. break;
  99. case 'RPC':
  100. $log['opinfo'] = lang('spacecp', 'report_credit');
  101. break;
  102. case 'ACC':
  103. $log['opinfo'] = '<a href="forum.php?mod=viewthread&tid='.$log['relatedid'].'" target="_blank">'.lang('spacecp', 'join').(!empty($otherinfo['threads'][$log['relatedid']]['subject']) ? ' <strong>'.$otherinfo['threads'][$log['relatedid']]['subject'].'</strong> '.lang('home/template', 'eccredit_s') : '').lang('spacecp', 'activity_credit').'</a>';
  104. break;
  105. case 'RCT':
  106. $log['opinfo'] = '<a href="forum.php?mod=viewthread&tid='.$log['relatedid'].'" target="_blank">'.lang('spacecp', 'thread_send').(!empty($otherinfo['threads'][$log['relatedid']]['subject']) ? ' <strong>'.$otherinfo['threads'][$log['relatedid']]['subject'].'</strong> ' : '').lang('spacecp', 'replycredit').'</a>';
  107. break;
  108. case 'RCA':
  109. $log['opinfo'] = '<a href="forum.php?mod=viewthread&tid='.$log['relatedid'].'" target="_blank">'.lang('home/template', 'reply').(!empty($otherinfo['threads'][$log['relatedid']]['subject']) ? ' <strong>'.$otherinfo['threads'][$log['relatedid']]['subject'].'</strong> '.lang('home/template', 'eccredit_s') : '').lang('spacecp', 'add_credit').'</a>';
  110. break;
  111. case 'RCB':
  112. $log['opinfo'] = '<a href="forum.php?mod=viewthread&tid='.$log['relatedid'].'" target="_blank">'.lang('spacecp', 'recovery').(!empty($otherinfo['threads'][$log['relatedid']]['subject']) ? ' <strong>'.$otherinfo['threads'][$log['relatedid']]['subject'].'</strong> ' : lang('spacecp', 'replycredit_post')).lang('spacecp', 'replycredit_thread').'</a>';
  113. break;
  114. case 'CDC':
  115. $log['opinfo'] = lang('spacecp', 'card_credit');
  116. break;
  117. case 'RKC':
  118. $log['opinfo'] = lang('spacecp', 'ranklist_top');
  119. break;
  120. case 'RPR':
  121. $log['opinfo'] = lang('spacecp', 'admincp_op_credit');
  122. break;
  123. case 'RPZ':
  124. $log['opinfo'] = lang('spacecp', 'admincp_op_credit');
  125. break;
  126. case 'FCP':
  127. $log['opinfo'] = '<a href="forum.php?mod=forumdisplay&fid='.$log['relatedid'].'" target="_blank">'.lang('spacecp', 'buy_forum').'</a>';
  128. break;
  129. case 'BGR':
  130. $log['opinfo'] = '<a href="forum.php?mod=forumdisplay&fid='.$log['relatedid'].'" target="_blank">'.lang('spacecp', 'buildgroup').'</a>';
  131. break;
  132. }
  133. return $log;
  134. }
  135. function getotherinfo($aids, $pids, $tids, $taskids, $uids) {
  136. global $_G;
  137. $otherinfo = array('attachs' => array(), 'threads' => array(), 'tasks' => array(), 'users' => array());
  138. if(!empty($aids)) {
  139. $attachs = C::t('forum_attachment')->fetch_all($aids);
  140. foreach($attachs as $value) {
  141. $value['tableid'] = intval($value['tableid']);
  142. $attachtable[$value['tableid']][] = $value['aid'];
  143. $tids[$value['tid']] = $value['tid'];
  144. }
  145. foreach($attachtable as $id => $value) {
  146. $attachs = C::t('forum_attachment_n')->fetch_all($id, $value);
  147. foreach($attachs as $value) {
  148. $otherinfo['attachs'][$value['aid']] = $value;
  149. }
  150. }
  151. }
  152. if(!empty($pids)) {
  153. foreach(C::t('forum_post')->fetch_all(0, $pids) as $value) {
  154. $tids[$value['tid']] = $value['tid'];
  155. $otherinfo['post'][$value['pid']] = $value['tid'];
  156. }
  157. }
  158. if(!empty($tids)) {
  159. foreach(C::t('forum_thread')->fetch_all_by_tid($tids) as $value) {
  160. $otherinfo['threads'][$value['tid']] = $value;
  161. }
  162. }
  163. if(!empty($taskids)) {
  164. foreach(C::t('common_task')->fetch_all($taskids) as $value) {
  165. $otherinfo['tasks'][$value['taskid']] = $value['name'];
  166. }
  167. }
  168. if(!empty($uids)) {
  169. foreach(C::t('common_member')->fetch_all($uids) as $uid => $value) {
  170. $otherinfo['users'][$uid] = $value['username'];
  171. }
  172. }
  173. return $otherinfo;
  174. }
  175. ?>