moderate_share.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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: moderate_share.php 27434 2012-01-31 08:57:34Z chenmengshu $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  9. exit('Access Denied');
  10. }
  11. if(!submitcheck('modsubmit') && !$_GET['fast']) {
  12. shownav('topic', $lang['moderate_shares']);
  13. showsubmenu('nav_moderate_posts', $submenu);
  14. $select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
  15. $tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
  16. $tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
  17. $start_limit = ($page - 1) * $ppp;
  18. $dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
  19. $dateline_options = '';
  20. foreach(array('all', '604800', '2592000', '7776000') as $v) {
  21. $selected = '';
  22. if($dateline == $v) {
  23. $selected = "selected='selected'";
  24. }
  25. $dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
  26. }
  27. $share_status = 1;
  28. if($_GET['filter'] == 'ignore') {
  29. $share_status = 2;
  30. }
  31. showformheader("moderate&operation=shares");
  32. showtableheader('search');
  33. showtablerow('', array('width="60"', 'width="160"', 'width="60"'),
  34. array(
  35. cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"$_GET[username]\" />",
  36. cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"$_GET[keyword]\" />",
  37. )
  38. );
  39. showtablerow('', array('width="60"', 'width="160"', 'width="60"'),
  40. array(
  41. "$lang[perpage]",
  42. "<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> $lang[moderate_showcensor]</label>",
  43. "$lang[moderate_bound]",
  44. "<select name=\"filter\">$filteroptions</select>
  45. <select name=\"dateline\">$dateline_options</select>
  46. <input class=\"btn\" type=\"submit\" value=\"$lang[search]\" />"
  47. )
  48. );
  49. showtablefooter();
  50. $pagetmp = $page;
  51. $sqlwhere = '';
  52. if(!empty($_GET['username'])) {
  53. $sqlwhere .= " AND s.username='{$_GET['username']}'";
  54. }
  55. if(!empty($dateline) && $dateline != 'all') {
  56. $sqlwhere .= " AND s.dateline>'".(TIMESTAMP - $dateline)."'";
  57. }
  58. if(!empty($_GET['keyword'])) {
  59. $keyword = str_replace(array('%', '_'), array('\%', '\_'), $_GET['keyword']);
  60. $sqlwhere .= " AND s.body_general LIKE '%$keyword%'";
  61. }
  62. $modcount = C::t('common_moderate')->count_by_search_for_share($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword']);
  63. do {
  64. $start_limit = ($pagetmp - 1) * $tpp;
  65. $sharearr = C::t('common_moderate')->fetch_all_by_search_for_share($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword'], $start_limit, $tpp);
  66. $pagetmp = $pagetmp - 1;
  67. } while($pagetmp > 0 && empty($sharearr));
  68. $page = $pagetmp + 1;
  69. $multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=shares&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp=$tpp&showcensor=$showcensor");
  70. echo '<p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> <a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p>';
  71. showtableheader();
  72. $censor = & discuz_censor::instance();
  73. $censor->highlight = '#FF0000';
  74. require_once libfile('function/misc');
  75. foreach($sharearr as $share) {
  76. $short_desc = cutstr($share['body_general'], 30);
  77. $share['dateline'] = dgmdate($share['dateline']);
  78. if($showcensor) {
  79. $censor->check($short_desc);
  80. $censor->check($share['body_general']);
  81. }
  82. $share_censor_words = $censor->words_found;
  83. if(count($share_censor_words) > 3) {
  84. $share_censor_words = array_slice($share_censor_words, 0, 3);
  85. }
  86. $share['censorwords'] = implode(', ', $share_censor_words);
  87. $share['modkey'] = modauthkey($share['itemid']);
  88. if(count($share_censor_words)) {
  89. $share_censor_text = "<span style=\"color: red;\">({$share['censorwords']})</span>";
  90. } else {
  91. $share_censor_text = '';
  92. }
  93. $shareurl = '';
  94. switch($share['type']) {
  95. case 'thread':
  96. $shareurl = "forum.php?mod=viewthread&tid=$share[itemid]&modthreadkey=$share[modkey]";
  97. $sharetitle = lang('admincp', 'share_type_thread');
  98. break;
  99. case 'pic':
  100. $shareurl = "home.php?mod=space&uid=$share[fromuid]&do=album&picid=$share[itemid]&modpickey=$share[modkey]";
  101. $sharetitle = lang('admincp', 'share_type_pic');
  102. break;
  103. case 'space':
  104. $shareurl = "home.php?mod=space&uid=$share[itemid]";
  105. $sharetitle = lang('admincp', 'share_type_space');
  106. break;
  107. case 'blog':
  108. $shareurl = "home.php?mod=space&uid=$share[fromuid]&do=blog&id=$share[itemid]&modblogkey=$share[modkey]";
  109. $sharetitle = lang('admincp', 'share_type_blog');
  110. break;
  111. case 'album':
  112. $shareurl = "home.php?mod=space&uid=$share[fromuid]&do=album&id=$share[itemid]&modalbumkey=$share[modkey]";
  113. $sharetitle = lang('admincp', 'share_type_album');
  114. break;
  115. case 'article':
  116. $shareurl = "portal.php?mod=view&aid=$share[itemid]&modarticlekey=$share[modkey]";
  117. $sharetitle = lang('admincp', 'share_type_article');
  118. break;
  119. }
  120. showtagheader('tbody', '', true, 'hover');
  121. showtablerow("id=\"mod_$share[sid]_row1\"", array("id=\"mod_$share[sid]_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"', 'width="55"'), array(
  122. "<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[$share[sid]]\" id=\"mod_$share[sid]_1\" value=\"validate\" onclick=\"mod_setbg($share[sid], 'validate');\"><label for=\"mod_$share[sid]_1\">$lang[validate]</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[$share[sid]]\" id=\"mod_$share[sid]_2\" value=\"delete\" onclick=\"mod_setbg($share[sid], 'delete');\"><label for=\"mod_$share[sid]_2\">$lang[delete]</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[$share[sid]]\" id=\"mod_$doing[doid]_3\" value=\"ignore\" onclick=\"mod_setbg($share[sid], 'ignore');\"><label for=\"mod_$share[sid]_3\">$lang[ignore]</label></li></ul>",
  123. "<h3><a href=\"javascript:;\" onclick=\"display_toggle({$share[sid]});\">$short_desc $share_censor_text</a></h3>",
  124. $sharetitle,
  125. "<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid=$share[uid]&submit=yes\">$share[username]</a></p> <p>$share[dateline]</p>",
  126. "<a target=\"_blank\" href=\"$shareurl\">$lang[view]</a>",
  127. ));
  128. showtablerow("id=\"mod_$share[sid]_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:100px; word-break: break-all;">'.$share['body_general'].'</div>');
  129. showtablerow("id=\"mod_$share[sid]_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=shares&fast=1&sid=$share[sid]&moderate[$share[sid]]=validate&page=$page&frame=no\" target=\"fasthandle\">$lang[validate]</a> | <a href=\"?action=moderate&operation=shares&fast=1&sid=$share[sid]&moderate[$share[sid]]=delete&page=$page&frame=no\" target=\"fasthandle\">$lang[delete]</a> | <a href=\"?action=moderate&operation=shares&fast=1&sid=$share[sid]&moderate[$share[sid]]=ignore&page=$page&frame=no\" target=\"fasthandle\">$lang[ignore]</a>");
  130. showtagfooter('tbody');
  131. }
  132. showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="mod_setbg_all(\'validate\')">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'delete\')">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="mod_setbg_all(\'ignore\')">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="mod_cancel_all();">'.cplang('moderate_all_cancel').'</a>', $multipage, false);
  133. showtablefooter();
  134. showformfooter();
  135. } else {
  136. $moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
  137. $validates = $deletes = $ignores = 0;
  138. if(is_array($moderate)) {
  139. foreach($moderate as $sid => $act) {
  140. $moderation[$act][] = $sid;
  141. }
  142. }
  143. if(!empty($moderation['validate'])) {
  144. require_once libfile('function/feed');
  145. $validates = C::t('home_share')->update($moderation['validate'], array('status' => 0));
  146. foreach(C::t('home_share')->fetch_all($moderation['validate']) as $share) {
  147. switch($share['type']) {
  148. case 'thread':
  149. $feed_hash_data = 'tid' . $share['itemid'];
  150. $share['title_template'] = lang('spacecp', 'share_thread');
  151. break;
  152. case 'space':
  153. $feed_hash_data = 'uid' . $share['itemid'];
  154. $share['title_template'] = lang('spacecp', 'share_space');
  155. break;
  156. case 'blog':
  157. $feed_hash_data = 'blogid' . $share['itemid'];
  158. $share['title_template'] = lang('spacecp', 'share_blog');
  159. break;
  160. case 'album':
  161. $feed_hash_data = 'albumid' . $share['itemid'];
  162. $share['title_template'] = lang('spacecp', 'share_album');
  163. break;
  164. case 'pic':
  165. $feed_hash_data = 'picid' . $share['itemid'];
  166. $share['title_template'] = lang('spacecp', 'share_image');
  167. break;
  168. case 'article':
  169. $feed_hash_data = 'articleid' . $share['itemid'];
  170. $share['title_template'] = lang('spacecp', 'share_article');
  171. break;
  172. case 'link':
  173. $feed_hash_data = '';
  174. break;
  175. }
  176. feed_add('share',
  177. '{actor} '.$share['title_template'],
  178. array('hash_data' => $feed_hash_data),
  179. $share['body_template'],
  180. dunserialize($share['body_data']),
  181. $share['body_general'],
  182. array($share['image']),
  183. array($share['image_link']),
  184. '',
  185. '',
  186. '',
  187. 0,
  188. 0,
  189. '',
  190. $share['uid'],
  191. $share['username']
  192. );
  193. }
  194. updatemoderate('sid', $moderation['validate'], 2);
  195. }
  196. if(!empty($moderation['delete'])) {
  197. require libfile('function/delete');
  198. $shares = deleteshares($moderation['delete']);
  199. $deletes = count($shares);
  200. updatemoderate('sid', $moderation['delete'], 2);
  201. }
  202. if($ignore_sids = dimplode($moderation['ignore'])) {
  203. $ignores = C::t('home_share')->update($moderation['ignore'], array('status' => 2));
  204. updatemoderate('sid', $moderation['ignore'], 1);
  205. }
  206. if($_GET['fast']) {
  207. echo callback_js($_GET['sid']);
  208. exit;
  209. } else {
  210. cpmsg('moderate_shares_succeed', "action=moderate&operation=shares&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
  211. }
  212. }
  213. ?>