PageRenderTime 44ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/Quản lý website tin tức PHP/discuznews/source/admincp/admincp_report.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 193 lines | 181 code | 6 blank | 6 comment | 41 complexity | 97ee12519bec8c3066422a12872bef3e 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: admincp_report.php 29236 2012-03-30 05:34:47Z chenmengshu $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  9. exit('Access Denied');
  10. }
  11. cpheader();
  12. $operation = $operation ? $operation : 'newreport';
  13. if(submitcheck('delsubmit')) {
  14. if(!empty($_GET['reportids'])) {
  15. C::t('common_report')->delete($_GET['reportids']);
  16. }
  17. }
  18. if(submitcheck('resolvesubmit')) {
  19. if(!empty($_GET['reportids'])) {
  20. $curcredits = $_G['setting']['creditstransextra'][8] ? $_G['setting']['creditstransextra'][8] : $_G['setting']['creditstrans'];
  21. foreach($_GET['reportids'] as $id) {
  22. $creditchange = '';
  23. $opresult = !empty($_GET['creditsvalue'][$id])? $curcredits."\t".intval($_GET['creditsvalue'][$id]) : 'ignore';
  24. $uid = $_GET['reportuids'][$id];
  25. $msg = !empty($_GET['msg'][$id]) ? '<br />'.dhtmlspecialchars($_GET['msg'][$id]) : '';
  26. if(!empty($_GET['creditsvalue'][$id])) {
  27. $credittag = $_GET['creditsvalue'][$id] > 0 ? '+' : '';
  28. $creditchange = '<br />'.cplang('report_your').$_G['setting']['extcredits'][$curcredits]['title'].'&nbsp;'.$credittag.$_GET['creditsvalue'][$id];
  29. updatemembercount($uid, array($curcredits => $_GET['creditsvalue'][$id]), true, 'RPC', $id);
  30. }
  31. if($uid != $_G['uid'] && ($creditchange || $msg)) {
  32. notification_add($uid, 'report', 'report_change_credits', array('creditchange' => $creditchange, 'msg' => $msg), 1);
  33. }
  34. C::t('common_report')->update($id, array('opuid' => $_G['uid'], 'opname' => $_G['username'], 'optime' => TIMESTAMP, 'opresult' => $opresult));
  35. }
  36. cpmsg('report_resolve_succeed', 'action=report', 'succeed');
  37. }
  38. }
  39. if(submitcheck('receivesubmit') && $admincp->isfounder) {
  40. $supmoderator = $_GET['supmoderator'];
  41. $adminuser = $_GET['adminuser'];
  42. C::t('common_setting')->update('report_receive', array('adminuser' => $adminuser, 'supmoderator' => $supmoderator));
  43. updatecache('setting');
  44. cpmsg('report_receive_succeed', 'action=report&operation=receiveuser', 'succeed');
  45. }
  46. shownav('topic', 'nav_report');
  47. $lpp = empty($_GET['lpp']) ? 20 : $_GET['lpp'];
  48. $start = ($page - 1) * $lpp;
  49. if($operation == 'newreport') {
  50. showsubmenu('nav_report', array(
  51. array('report_newreport', 'report', 1),
  52. array('report_resolved', 'report&operation=resolved', 0),
  53. array('report_receiveuser', 'report&operation=receiveuser', 0)
  54. ));
  55. showtips('report_tips');
  56. showformheader('report&operation=newreport');
  57. showtableheader();
  58. $curcredits = $_G['setting']['creditstransextra'][8] ? $_G['setting']['creditstransextra'][8] : $_G['setting']['creditstrans'];
  59. $report_reward = dunserialize($_G['setting']['report_reward']);
  60. $offset = abs(ceil(($report_reward['max'] - $report_reward['min']) / 10));
  61. if($report_reward['max'] > $report_reward['min']) {
  62. for($vote = $report_reward['max']; $vote >= $report_reward['min']; $vote -= $offset) {
  63. if($vote != 0) {
  64. $rewardlist .= $vote ? '<option value="'.$vote.'">'.($vote > 0 ? '+'.$vote : $vote).'</option>' : '';
  65. } else {
  66. $rewardlist .= '<option value="0" selected>'.cplang('report_newreport_no_operate').'</option>';
  67. }
  68. }
  69. }
  70. showsubtitle(array('', 'report_detail', 'report_user', ($report_reward['max'] != $report_reward['min'] ? 'operation' : '')));
  71. $reportcount = C::t('common_report')->fetch_count();
  72. $query = C::t('common_report')->fetch_all($start, $lpp);
  73. foreach($query as $row) {
  74. showtablerow('', array('class="td25"', 'class="td28"', '', ''), array(
  75. '<input type="checkbox" class="checkbox" name="reportids[]" value="'.$row['id'].'" />',
  76. '<b>'.cplang('report_newreport_url').'</b><a href="'.$row['url'].'" target="_blank">'.$row['url'].'</a><br \><b>'.cplang('report_newreport_time').'</b>'.dgmdate($row['dateline']).'<br><b>'.cplang('report_newreport_message').'</b><br>'.$row['message'],
  77. '<a href="home.php?mod=space&uid='.$row['uid'].'">'.$row['username'].'</a><input type="hidden" name="reportuids['.$row['id'].']" value="'.$row['uid'].'">',
  78. ($report_reward['max'] != $report_reward['min'] ? $_G['setting']['extcredits'][$curcredits]['title'].':&nbsp;<select name="creditsvalue['.$row['id'].']">'.$rewardlist.'</select><br /><br />'.cplang('report_note').':&nbsp;<input type="text" name="msg['.$row['id'].']" value="">' : '')
  79. ));
  80. }
  81. $multipage = multi($reportcount, $lpp, $page, ADMINSCRIPT."?action=report&lpp=$lpp", 0, 3);
  82. showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'reportids\')" /><label for="chkall">'.cplang('select_all').'</label>&nbsp;&nbsp;<input type="submit" class="btn" name="delsubmit" value="'.$lang['delete'].'" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="btn" name="resolvesubmit" value="'.cplang('report_newreport_resolve').'" />', $multipage);
  83. showtablefooter();
  84. showformfooter();
  85. } elseif($operation == 'resolved') {
  86. showsubmenu('nav_report', array(
  87. array('report_newreport', 'report', 0),
  88. array('report_resolved', 'report&operation=resolved', 1),
  89. array('report_receiveuser', 'report&operation=receiveuser', 0)
  90. ));
  91. showformheader('report&operation=resolved');
  92. showtableheader();
  93. showsubtitle(array('', 'report_detail', 'report_optuser', 'report_opttime'));
  94. $reportcount = C::t('common_report')->fetch_count(1);
  95. $query = C::t('common_report')->fetch_all($start, $lpp, 1);
  96. foreach($query as $row) {
  97. if($row['opresult'] == 'ignore') {
  98. $opresult = cplang('report_newreport_no_operate');
  99. } else {
  100. $row['opresult'] = explode("\t", $row['opresult']);
  101. if($row['opresult'][1] > 0) {
  102. $row[opresult][1] = '+'.$row[opresult][1];
  103. }
  104. $opresult = $_G['setting']['extcredits'][$row[opresult][0]]['title'].'&nbsp;'.$row[opresult][1];
  105. }
  106. showtablerow('', array('class="td25"', 'class="td28"', '', '', 'class="td26"'), array(
  107. '<input type="checkbox" class="checkbox" name="reportids[]" value="'.$row['id'].'" />',
  108. '<b>'.cplang('report_newreport_url').'</b><a href="'.$row['url'].'" target="_blank">'.$row['url'].'</a><br><b>'.cplang('report_newreport_time').'</b>'.dgmdate($row['dateline']).'<br><b>'.cplang('report_newreport_message').'</b>: '.$row['message'].'<br \><b>'.cplang('report_resolved_result').'</b>'.$opresult,
  109. $row['opname'],
  110. date('y-m-d H:i', $row['optime'])
  111. ));
  112. }
  113. $multipage = multi($reportcount, $lpp, $page, ADMINSCRIPT."?action=report&operation=resolved&lpp=$lpp", 0, 3);
  114. showsubmit('', '', '', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'reportids\')" /><label for="chkall">'.cplang('del').'</label>&nbsp;&nbsp;<input type="submit" class="btn" name="delsubmit" value="'.$lang['delete'].'" />', $multipage);
  115. showtablefooter();
  116. showformfooter();
  117. } elseif($operation == 'receiveuser') {
  118. showsubmenu('nav_report', array(
  119. array('report_newreport', 'report', 0),
  120. array('report_resolved', 'report&operation=resolved', 0),
  121. array('report_receiveuser', 'report&operation=receiveuser', 1)
  122. ));
  123. if(!$admincp->isfounder) {
  124. cpmsg('report_need_founder');
  125. }
  126. $report_receive = dunserialize($_G['setting']['report_receive']);
  127. showformheader('report&operation=receiveuser');
  128. showtips('report_receive_tips');
  129. $users = array();
  130. $founders = $_G['config']['admincp']['founder'] !== '' ? explode(',', str_replace(' ', '', addslashes($_G['config']['admincp']['founder']))) : array();
  131. if($founders) {
  132. $founderexists = true;
  133. $fuid = $fuser = array();
  134. foreach($founders as $founder) {
  135. if(is_numeric($founder)) {
  136. $fuid[] = $founder;
  137. } else {
  138. $fuser[] = $founder;
  139. }
  140. }
  141. if($fuid) {
  142. $users = C::t('common_member')->fetch_all($fuid);
  143. }
  144. if($fuser) {
  145. $users = $users + C::t('common_member')->fetch_all_by_username($fuser);
  146. }
  147. }
  148. $query = C::t('common_admincp_member')->fetch_all_uid_by_gid_perm(0, 'report');
  149. foreach ($query as $user) {
  150. if(empty($users[$user['uid']])) {
  151. $newuids[] = $user['uid'];
  152. }
  153. }
  154. if($newuids) {
  155. $users = $users + C::t('common_member')->fetch_all($newuids);
  156. }
  157. $supmoderator = array();
  158. foreach(C::t('common_member')->fetch_all_by_adminid(2) as $uid => $row) {
  159. if(empty($users[$uid])) {
  160. $supmoderator[$uid] = $row['username'];
  161. }
  162. }
  163. showtableheader('<input type="checkbox" name="chkall_admin" id="chkall_admin" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'adminuser\', \'chkall_admin\')" />'.cplang('usergroups_system_1'));
  164. foreach($users as $uid => $member) {
  165. $username = trim($member['username']);
  166. if(empty($username) || empty($uid)) continue;
  167. $checked = in_array($uid, $report_receive['adminuser']) ? 'checked' : '';
  168. showtablerow('style="height:20px;width:50px;"', array('class="td25"'), array(
  169. "<input class=\"checkbox\" type=\"checkbox\" name=\"adminuser[]\" value=\"$uid\" $checked>",
  170. "<a href=\"home.php?mod=space&uid=$uid\" target=\"_blank\">$username</a>"
  171. ));
  172. }
  173. showtablefooter();
  174. showtableheader('<input type="checkbox" name="chkall_sup" id="chkall_sup" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'supmoderator\', \'chkall_sup\')" />'.cplang('usergroups_system_2'));
  175. foreach($supmoderator as $uid => $username) {
  176. $username = trim($username);
  177. if(empty($username) || empty($uid)) continue;
  178. $checked = in_array($uid, $report_receive['supmoderator']) ? 'checked' : '';
  179. showtablerow('style="height:20px;width:50px;"', array('class="td25"'), array(
  180. "<input class=\"checkbox\" type=\"checkbox\" name=\"supmoderator[]\" value=\"$uid]\" $checked>",
  181. "<a href=\"home.php?mod=space&uid=$uid\" target=\"_blank\">$username</a>"
  182. ));
  183. }
  184. showsubmit('', '', '', '<input type="submit" class="btn" name="receivesubmit" value="'.$lang['submit'].'" />');
  185. showtablefooter();
  186. showformfooter();
  187. }