First commit

This commit is contained in:
2025-06-18 10:24:27 +08:00
commit ebc39cd5dd
3873 changed files with 412712 additions and 0 deletions

View File

View File

@@ -0,0 +1,157 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_article.php 25764 2011-11-22 03:39:57Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_articles']);
showsubmenu('nav_moderate_articles', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$cat_select = '<option value="">'.$lang['all'].'</option>';
loadcache('portalcategory');
foreach($_G['cache']['portalcategory'] as $cat) {
$selected = '';
if($cat['catid'] == $_GET['catid']) {
$selected = 'selected="selected"';
}
$cat_select .= "<option value=\"{$cat['catid']}\" $selected>{$cat['catname']}</option>";
}
$article_status = 1;
if($_GET['filter'] == 'ignore') {
$article_status = 2;
}
showformheader("moderate&operation=articles");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_article_category'), "<select name=\"catid\">$cat_select</select>",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$sqlwhere = "";
$modcount = C::t('common_moderate')->fetch_all_for_article($moderatestatus, $_GET['catid'], $_GET['username'], $dateline, 1);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$query = C::t('common_moderate')->fetch_all_for_article($moderatestatus, $_GET['catid'], $_GET['username'], $dateline, 0, $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && count($query) == 0);
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=articles&filter=$filter&catid={$_GET['catid']}&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($query as $article) {
$article['dateline'] = dgmdate($article['dateline']);
if($showcensor) {
$censor->check($article['title']);
$censor->check($article['summary']);
}
$article_censor_words = $censor->words_found;
if(count($article_censor_words) > 3) {
$article_censor_words = array_slice($article_censor_words, 0, 3);
}
$article['censorwords'] = implode(', ', $article_censor_words);
$article['modarticlekey'] = modauthkey($article['aid']);
if(count($article_censor_words)) {
$article_censor_text = "<span style=\"color: red;\">({$article['censorwords']})</span>";
} else {
$article_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$article['aid']}_row1\"", array("id=\"mod_{$article['aid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$article['aid']}]\" id=\"mod_{$article['aid']}_1\" value=\"validate\" onclick=\"mod_setbg({$article['aid']}, 'validate');\"><label for=\"mod_{$article['aid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$article['aid']}]\" id=\"mod_{$article['aid']}_2\" value=\"delete\" onclick=\"mod_setbg({$article['aid']}, 'delete');\"><label for=\"mod_{$article['aid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$article['aid']}]\" id=\"mod_{$article['aid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$article['aid']}, 'ignore');\"><label for=\"mod_{$article['aid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$article['aid']});\">{$article['title']} $article_censor_text</a></h3>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$article['uid']}&submit=yes\">{$article['username']}</a></p> <p>{$article['dateline']}</p>",
"<a target=\"_blank\" href=\"portal.php?mod=view&aid={$article['aid']}&modarticlekey={$article['modarticlekey']}\">{$lang['view']}</a>&nbsp;<a href=\"portal.php?mod=portalcp&ac=article&op=edit&aid={$article['aid']}&modarticlekey={$article['modarticlekey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$article['aid']}_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;">'.$article['summary'].'</div>');
showtablerow("id=\"mod_{$article['aid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=articles&fast=1&aid={$article['aid']}&moderate[{$article['aid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=articles&fast=1&aid={$article['aid']}&moderate[{$article['aid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=articles&fast=1&aid={$article['aid']}&moderate[{$article['aid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
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);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $aid => $act) {
$moderation[$act][] = $aid;
}
}
if($validate_aids = dimplode($moderation['validate'])) {
$validates = C::t('portal_article_title')->update($moderation['validate'], array('status' => '0'));
updatemoderate('aid', $moderation['validate'], 2);
}
if(!empty($moderation['delete'])) {
require_once libfile('function/delete');
$articles = deletearticle($moderation['delete']);
$deletes = count($articles);
updatemoderate('aid', $moderation['delete'], 2);
}
if($ignore_aids = dimplode($moderation['ignore'])) {
$ignores = C::t('portal_article_title')->update($moderation['ignore'], array('status' => '2'));
updatemoderate('aid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['aid']);
exit;
} else {
cpmsg('moderate_articles_succeed', "action=moderate&operation=articles&page=$page&filter=$filter&catid={$_GET['catid']}&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&idtype={$_GET['idtype']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,157 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_blog.php 31710 2012-09-24 07:24:52Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
require_once libfile('function/discuzcode');
shownav('topic', $lang['moderate_blogs']);
showsubmenu('nav_moderate_blogs', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$blog_status = 1;
if($_GET['filter'] == 'ignore') {
$blog_status = 2;
}
showformheader("moderate&operation=blogs");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_title_keyword'), "<input size=\"15\" name=\"title\" type=\"text\" value=\"{$_GET['title']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->count_by_search_for_blog($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$blogarr = C::t('common_moderate')->fetch_all_by_search_for_blog($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($blogarr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=blogs&filter=$filter&modfid=$modfid&ppp=$tpp&showcensor=$showcensor&dateline=$dateline");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($blogarr as $blog) {
$blog['dateline'] = dgmdate($blog['dateline']);
$blog['subject'] = $blog['subject'] ? '<b>'.$blog['subject'].'</b>' : '<i>'.$lang['nosubject'].'</i>';
if($showcensor) {
$censor->check($blog['subject']);
$censor->check($blog['message']);
}
$blog_censor_words = $censor->words_found;
if(count($blog_censor_words) > 3) {
$blog_censor_words = array_slice($blog_censor_words, 0, 3);
}
$blog['censorwords'] = implode(', ', $blog_censor_words);
$blog['modblogkey'] = modauthkey($blog['blogid']);
$blog['postip'] = $blog['postip'] . '-' . convertip($blog['postip']);
if(count($blog_censor_words)) {
$blog_censor_text = "<span style=\"color: red;\">({$blog['censorwords']})</span>";
} else {
$blog_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$blog['blogid']}_row1\"", array("id=\"mod_{$blog['blogid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_1\" value=\"validate\" onclick=\"mod_setbg({$blog['blogid']}, 'validate');\"><label for=\"mod_{$blog['blogid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_2\" value=\"delete\" onclick=\"mod_setbg({$blog['blogid']}, 'delete');\"><label for=\"mod_{$blog['blogid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$blog['blogid']}]\" id=\"mod_{$blog['blogid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$blog['blogid']}, 'ignore');\"><label for=\"mod_{$blog['blogid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle('{$blog['blogid']}');\">{$blog['subject']}</a> $blog_censor_text</h3><p>{$blog['postip']}</p>",
$blog['classname'],
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$blog['uid']}&submit=yes\">{$blog['username']}</a></p> <p>{$blog['dateline']}</p>",
"<a href=\"home.php?mod=space&uid={$blog['uid']}&do=blog&id={$blog['blogid']}&modblogkey={$blog['modblogkey']}\" target=\"_blank\">{$lang['view']}</a>&nbsp;<a href=\"home.php?mod=spacecp&ac=blog&blogid={$blog['blogid']}&modblogkey={$blog['modblogkey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$blog['blogid']}_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;">'.$blog['message'].'</div>');
showtablerow("id=\"mod_{$blog['blogid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=blogs&fast=1&blogid={$blog['blogid']}&moderate[{$blog['blogid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
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);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $blogid => $act) {
$moderate[$act][] = $blogid;
}
}
if($moderate['validate']) {
$validates = C::t('home_blog')->update($moderate['validate'], array('status' => '0'));
$query_t = C::t('home_blog')->count_uid_by_blogid($moderate['validate']);
foreach($query_t as $blog_user) {
$credit_times = $blog_user['count'];
updatecreditbyaction('publishblog', $blog_user['uid'], array('blogs' => 1), '', $credit_times);
}
updatemoderate('blogid', $moderate['validate'], 2);
}
if($moderate['delete']) {
require_once libfile('function/delete');
$delete_blogs = deleteblogs($moderate['delete']);
$deletes = count($delete_blogs);
updatemoderate('blogid', $moderate['delete'], 2);
}
if($moderate['ignore']) {
$ignores = C::t('home_blog')->update($moderate['ignore'], array('status' => '2'));
updatemoderate('blogid', $moderate['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['blogid']);
exit;
} else {
cpmsg('moderate_blogs_succeed', "action=moderate&operation=blogs&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,191 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_comment.php 31996 2012-10-30 06:15:14Z liulanbo $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_comments']);
showsubmenu('nav_moderate_comments', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$idtype_select = '<option value="">'.$lang['all'].'</option>';
foreach(array('uid', 'blogid', 'picid', 'sid') as $v) {
$selected = '';
if($_GET['idtype'] == $v) {
$selected = 'selected="selected"';
}
$idtype_select .= "<option value=\"$v\" $selected>".$lang["comment_$v"]."</option>";
}
$comment_status = 1;
if($_GET['filter'] == 'ignore') {
$comment_status = 2;
}
showformheader("moderate&operation=comments");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"idtype\">$idtype_select</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->count_by_search_for_commnet($_GET['idtype'], $moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$commentarr = C::t('common_moderate')->fetch_all_by_search_for_comment($_GET['idtype'], $moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($commentarr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=comments&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&idtype={$_GET['idtype']}&ppp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($commentarr as $comment) {
$comment['dateline'] = dgmdate($comment['dateline']);
$short_desc = cutstr($comment['message'], 75);
if($showcensor) {
$censor->check($short_desc);
$censor->check($comment['message']);
}
$comment_censor_words = $censor->words_found;
if(count($comment_censor_words) > 3) {
$comment_censor_words = array_slice($comment_censor_words, 0, 3);
}
$comment['censorwords'] = implode(', ', $comment_censor_words);
$comment['ip'] = $comment['ip'] . ' - ' . convertip($comment['ip']);
$comment['modkey'] = modauthkey($comment['id']);
$comment['modcommentkey'] = modauthkey($comment['cid']);
if($showcensor) {
if(count($comment_censor_words)) {
$comment_censor_text = "<span style=\"color: red;\">({$comment['censorwords']})</span>";
} else {
$comment_censor_text = lang('admincp', 'no_censor_word');
}
}
$viewurl = '';
$commenttype = '';
$editurl = "home.php?mod=spacecp&ac=comment&op=edit&cid={$comment['cid']}&modcommentkey={$comment['modcommentkey']}";
switch($comment['idtype']) {
case 'uid':
$commenttype = lang('admincp', 'comment_uid');
$viewurl = "home.php?mod=space&uid={$comment['uid']}&do=wall#comment_anchor_{$comment['cid']}";
break;
case 'blogid':
$commenttype = lang('admincp', 'comment_blogid');
$viewurl = "home.php?mod=space&uid={$comment['uid']}&do=blog&id={$comment['id']}&modblogkey={$comment['modkey']}#comment_anchor_{$comment['cid']}";
break;
case 'picid':
$commenttype = lang('admincp', 'comment_picid');
$viewurl = "home.php?mod=space&uid={$comment['uid']}&do=album&picid={$comment['id']}&modpickey={$comment['modkey']}#comment_anchor_{$comment['cid']}";
break;
case 'sid':
$commenttype = lang('admincp', 'comment_sid');
$viewurl = "home.php?mod=space&uid={$comment['uid']}&do=share&id={$comment['id']}#comment_anchor_{$comment['cid']}";
break;
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$comment['cid']}_row1\"", array("id=\"mod_{$comment['cid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$comment['cid']}]\" id=\"mod_{$comment['cid']}_1\" value=\"validate\" onclick=\"mod_setbg({$comment['cid']}, 'validate');\"><label for=\"mod_{$comment['cid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$comment['cid']}]\" id=\"mod_{$comment['cid']}_2\" value=\"delete\" onclick=\"mod_setbg({$comment['cid']}, 'delete');\"><label for=\"mod_{$comment['cid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$comment['cid']}]\" id=\"mod_{$comment['cid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$comment['cid']}, 'ignore');\"><label for=\"mod_{$comment['cid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$comment['cid']});\"> $short_desc $comment_censor_text</a></h3><p>{$comment['ip']}</p>",
$commenttype.'<input name="idtypes['.$comment['cid'].']}" type="hidden" value="'.$comment['idtype'].'">',
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$comment['authorid']}&submit=yes\">{$comment['author']}</a></p> <p>{$comment['dateline']}</p>",
"<a target=\"_blank\" href=\"$viewurl\">{$lang['view']}</a>&nbsp;<a href=\"$editurl\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$comment['cid']}_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;">'.$comment['message'].'</div>');
showtablerow("id=\"mod_{$comment['cid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=comments&fast=1&cid={$comment['cid']}&moderate[{$comment['cid']}]=validate&idtypes[{$comment['cid']}]={$comment['idtype']}&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=comments&fast=1&cid={$comment['cid']}&moderate[{$comment['cid']}]=delete&idtypes[{$comment['cid']}]={$comment['idtype']}&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=comments&fast=1&cid={$comment['cid']}&moderate[{$comment['cid']}]=ignore&idtypes[{$comment['cid']}]={$comment['idtype']}&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
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);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
$moderatedata = array();
if(is_array($moderate)) {
foreach($moderate as $cid => $act) {
$moderation[$act][] = $cid;
$moderatedata[$act][$_GET['idtypes'][$cid]][] = $cid;
}
}
foreach($moderatedata as $act => $typeids) {
foreach($typeids as $idtype => $ids) {
$op = $act == 'ignore' ? 1 : 2;
updatemoderate($idtype.'_cid', $ids, $op);
}
}
if($moderation['validate']) {
$validates = C::t('home_comment')->update_comment($moderation['validate'], array('status' => '0'));
}
if(!empty($moderation['delete'])) {
require_once libfile('function/delete');
$comments = deletecomments($moderation['delete']);
$deletes = count($comments);
}
if($moderation['ignore']) {
$ignores = C::t('home_comment')->update_comment($moderation['ignore'], array('status' => '2'));
}
if($_GET['fast']) {
echo callback_js($_GET['cid']);
exit;
} else {
cpmsg('moderate_comments_succeed', "action=moderate&operation=comments&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&idtype={$_GET['idtype']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,169 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_doing.php 28057 2012-02-21 22:19:33Z zhengqingpeng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_doings']);
showsubmenu('nav_moderate_doings', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$doing_status = 1;
if($_GET['filter'] == 'ignore') {
$doing_status = 2;
}
showformheader("moderate&operation=doings");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->count_by_search_for_doing($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$doingarr = C::t('common_moderate')->fetch_all_by_search_for_doing($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($doingarr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=doings&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($doingarr as $doing) {
$doing['dateline'] = dgmdate($doing['dateline']);
$short_desc = cutstr($doing['message'], 75);
if($showcensor) {
$censor->check($short_desc);
$censor->check($doing['message']);
}
$doing_censor_words = $censor->words_found;
if(count($post_censor_words) > 3) {
$doing_censor_words = array_slice($doing_censor_words, 0, 3);
}
$doing['censorwords'] = implode(', ', $doing_censor_words);
$doing['ip'] = $doing['ip'] . '-' . convertip($doing['ip']);
if(count($doing_censor_words)) {
$doing_censor_text = "<span style=\"color: red;\">({$doing['censorwords']})</span>";
} else {
$doing_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$doing['doid']}_row1\"", array("id=\"mod_{$doing['doid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$doing['doid']}]\" id=\"mod_{$doing['doid']}_1\" value=\"validate\" onclick=\"mod_setbg({$doing['doid']}, 'validate');\"><label for=\"mod_{$doing['doid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$doing['doid']}]\" id=\"mod_{$doing['doid']}_2\" value=\"delete\" onclick=\"mod_setbg({$doing['doid']}, 'delete');\"><label for=\"mod_{$doing['doid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$doing['doid']}]\" id=\"mod_{$doing['doid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$doing['doid']}, 'ignore');\"><label for=\"mod_{$doing['doid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$doing['doid']});\">$short_desc $doing_censor_text</a></h3><p>{$doing['ip']}</p>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$doing['uid']}&submit=yes\">{$doing['username']}</a></p> <p>{$doing['dateline']}</p>",
));
showtablerow("id=\"mod_{$doing['doid']}_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;">'.$doing['message'].'</div>');
showtablerow("id=\"mod_{$doing['doid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=doings&fast=1&doid={$doing['doid']}&moderate[{$doing['doid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=doings&fast=1&doid={$doing['doid']}&moderate[{$doing['doid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=doings&fast=1&doid={$doing['doid']}&moderate[{$doing['doid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
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);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $doid => $act) {
$moderation[$act][] = $doid;
}
}
if($moderation['validate']) {
C::t('home_doing')->update($moderation['validate'], array('status' => '0'));
$query_t = C::t('home_doing')->fetch_all($moderation['validate']);
if(helper_access::check_module('feed')) {
foreach ($query_t as $doing) {
$feedarr = array(
'icon' => 'doing',
'uid' => $doing['uid'],
'username' => $doing['username'],
'dateline' => $doing['dateline'],
'title_template' => lang('feed', 'feed_doing_title'),
'title_data' => serialize(array('message'=>$doing['message'])),
'body_template' => '',
'body_data' => '',
'id' => $doing['doid'],
'idtype' => 'doid'
);
$validates += C::t('home_feed')->insert($feedarr);
}
}
updatemoderate('doid', $moderation['validate'], 2);
}
if(!empty($moderation['delete'])) {
require_once libfile('function/delete');
$doings = deletedoings($moderation['delete']);
$deletes = count($doings);
updatemoderate('doid', $moderation['delete'], 2);
}
if($moderation['ignore']) {
$ignores = C::t('home_doing')->update($moderation['ignore'], array('status' => '2'));
updatemoderate('doid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['doid']);
exit;
} else {
cpmsg('moderate_doings_succeed', "action=moderate&operation=doings&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));
}
}
?>

View File

@@ -0,0 +1,321 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_member.php 33688 2013-08-02 03:00:15Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$do = empty($do) ? 'mod' : $do;
if($do == 'mod') {
if(!submitcheck('modsubmit')) {
$count = C::t('common_member_validate')->fetch_all_status_by_count();
$sendemail = isset($_GET['sendemail']) ? $_GET['sendemail'] : 0;
$checksendemail = $sendemail ? 'checked' : '';
$start_limit = ($page - 1) * $_G['setting']['memberperpage'];
$validatenum = C::t('common_member_validate')->count_by_status(0);
$members = '';
if($validatenum) {
$multipage = multi($validatenum, $_G['setting']['memberperpage'], $page, ADMINSCRIPT.'?action=moderate&operation=members&sendemail='.$sendemail);
$vuids = array();
loadcache('fields_register');
require_once libfile('function/profile');
loadcache('usergroups');
$allvalidate = C::t('common_member_validate')->fetch_all_invalidate($start_limit, $_G['setting']['memberperpage']);
$uids = array_keys($allvalidate);
$allmember = C::t('common_member')->fetch_all($uids, false, 0);
$allmemberstatus = C::t('common_member_status')->fetch_all($uids, false, 0);
$allmemberprofile = C::t('common_member_profile')->fetch_all($uids, false, 0);
foreach($allvalidate as $uid => $member) {
$member = array_merge((array)$member, (array)$allmember[$uid], (array)$allmemberstatus[$uid], (array)$allmemberprofile[$uid]);
if($member['groupid'] != 8 && !in_array($member['freeze'], array(-1, 2))) {
$vuids[$uid] = $uid;
continue;
}
$fields = !empty($member['field']) ? dunserialize($member['field']) : array();
$str = '';
foreach($_G['cache']['fields_register'] as $field) {
if(!$field['available'] || in_array($field['fieldid'], array('uid', 'constellation', 'zodiac', 'birthmonth', 'birthyear', 'birthcountry', 'birthprovince', 'birthdist', 'birthcommunity', 'residecountry', 'resideprovince', 'residedist', 'residecommunity'))) {
continue;
}
$member[$field['fieldid']] = !empty($member[$field['fieldid']]) ? $member[$field['fieldid']] : $fields[$field['fieldid']];
if($member[$field['fieldid']]) {
$fieldstr = profile_show($field['fieldid'], $member);
$str .= $field['title'].':'.$fieldstr."<br/>";
}
}
$str = !empty($str) ? '<br/>'.$str : '';
$member['regdate'] = dgmdate($member['regdate']);
$member['submitdate'] = dgmdate($member['submitdate']);
$member['moddate'] = $member['moddate'] ? dgmdate($member['moddate']) : $lang['none'];
$member['admin'] = $member['admin'] ? "<a href=\"home.php?mod=space&username=".rawurlencode($member['admin'])."\" target=\"_blank\">{$member['admin']}</a>" : $lang['none'];
$members .= "<tr class=\"hover\" id=\"mod_uid_{$member['uid']}\"><td class=\"rowform\" style=\"width:80px;\"><ul class=\"nofloat\"><li><input id=\"mod_uid_{$member['uid']}_1\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"invalidate\" onclick=\"set_bg('invalidate', {$member['uid']});\"><label for=\"mod_uid_{$member['uid']}_1\">{$lang['invalidate']}</label></li><li><input id=\"mod_uid_{$member['uid']}_2\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"validate\" onclick=\"set_bg('validate', {$member['uid']});\"><label for=\"mod_uid_{$member['uid']}_2\">{$lang['validate']}</label></li>\n".
"<li>".($member['groupid'] == 8 ? "<input id=\"mod_uid_{$member['uid']}_3\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"delete\" onclick=\"set_bg('delete', {$member['uid']});\"><label for=\"mod_uid_{$member['uid']}_3\">{$lang['delete']}</label>" : "<input disabled class=\"radio\" type=\"radio\" />{$lang['delete']}")."</li><li><input id=\"mod_uid_{$member['uid']}_4\" class=\"radio\" type=\"radio\" name=\"modtype[{$member['uid']}]\" value=\"ignore\" onclick=\"set_bg('ignore', {$member['uid']});\"><label for=\"mod_uid_{$member['uid']}_4\">{$lang['ignore']}</label></li></ul></td><td><b><a href=\"home.php?mod=space&uid={$member['uid']}\" target=\"_blank\">{$member['username']}</a></b>\n".$_G['cache']['usergroups'][$member['groupid']]['grouptitle'].
"<br />{$lang['members_edit_regdate']}: {$member['regdate']}<br />{$lang['members_edit_regip']}: {$member['regip']} ".convertip($member['regip'])."<br />{$lang['members_edit_lastip']}: {$member['lastip']} ".convertip($member['lastip'])."<br />Email: {$member['email']}$str</td>\n".
"<td align=\"center\"><textarea rows=\"4\" name=\"userremark[{$member['uid']}]\" style=\"width: 95%; word-break: break-all\">{$member['message']}</textarea></td>\n".
"<td>{$lang['moderate_members_submit_times']}: {$member['submittimes']}<br />{$lang['moderate_members_submit_time']}: {$member['submitdate']}<br />{$lang['moderate_members_admin']}: {$member['admin']}<br />\n".
"{$lang['moderate_members_mod_time']}: {$member['moddate']}</td><td><textarea rows=\"4\" id=\"remark[{$member['uid']}]\" name=\"remark[{$member['uid']}]\" style=\"width: 95%; word-break: break-all\">{$member['remark']}</textarea></td></tr>\n";
}
if(!empty($vuids)) {
C::t('common_member_validate')->delete($vuids);
}
}
shownav('user', 'nav_modmembers');
showsubmenu('nav_moderate_users', array(
array('nav_moderate_users_mod', 'moderate&operation=members&do=mod', 1),
array('clean', 'moderate&operation=members&do=del', 0)
));
showtips('moderate_members_tips');
$moderate_members_bad_reason = cplang('moderate_members_bad_reason');
$moderate_members_succeed = cplang('moderate_members_succeed');
echo <<<EOT
<script type="text/javascript">
function set_bg(operation, uid) {
if(operation == 'invalidate') {
$('mod_uid_' + uid).className = "mod_invalidate";
$('remark[' + uid + ']').value = '$moderate_members_bad_reason';
} else if(operation == 'validate') {
$('mod_uid_' + uid).className = "mod_validate";
$('remark[' + uid + ']').value = '$moderate_members_succeed';
} else if(operation == 'ignore') {
$('mod_uid_' + uid).className = "mod_ignore";
$('remark[' + uid + ']').value = '';
} else if(operation == 'delete') {
$('mod_uid_' + uid).className = "mod_delete";
$('remark[' + uid + ']').value = '';
}
$('chk_apply_all').disabled = true;
$('chk_apply_all').checked = false;
}
function set_bg_all(operation) {
var trs = $('cpform').getElementsByTagName('TR');
for(var i in trs) {
if(trs[i].id && trs[i].id.substr(0, 8) == 'mod_uid_') {
uid = trs[i].id.substr(8);
if(operation == 'invalidate') {
trs[i].className = 'mod_invalidate';
$('remark[' + uid + ']').value = '$moderate_members_bad_reason';
} else if(operation == 'validate') {
trs[i].className = 'mod_validate';
$('remark[' + uid + ']').value = '$moderate_members_succeed';
} else if(operation == 'ignore') {
trs[i].className = 'mod_ignore';
$('remark[' + uid + ']').value = '';
} else if(operation == 'delete') {
trs[i].className = 'mod_delete';
$('remark[' + uid + ']').value = '';
}else if(operation == 'cancel') {
trs[i].className = '';
$('remark[' + uid + ']').value = '';
}
}
}
if(operation != 'cancel') {
$('chk_apply_all').disabled = false;
$('chk_apply_all').value = operation;
} else {
$('chk_apply_all').disabled = true;
$('chk_apply_all').checked = false;
}
}
function cancelallcheck() {
var form = $('cpform');
var checkall = 'chkall';
for(var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if(e.type == 'radio') {
e.checked = '';
}
}
}
</script>
EOT;
showformheader('moderate&operation=members&do=mod');
showtableheader('moderate_members', 'fixpadding');
showsubtitle(array('operation', 'members_edit_info', 'moderate_members_message', 'moderate_members_info', 'moderate_members_remark'));
echo $members;
showsubmit('modsubmit', 'submit', '', '<a href="#all" onclick="checkAll(\'option\', $(\'cpform\'), \'invalidate\');set_bg_all(\'invalidate\');">'.cplang('moderate_all_invalidate').'</a> &nbsp;<a href="#all" onclick="checkAll(\'option\', $(\'cpform\'), \'validate\');set_bg_all(\'validate\');">'.cplang('moderate_all_validate').'</a> &nbsp;<a href="#all" onclick="checkAll(\'option\', $(\'cpform\'), \'delete\');set_bg_all(\'delete\');">'.cplang('moderate_all_delete').'</a> &nbsp;<a href="#all" onclick="checkAll(\'option\', $(\'cpform\'), \'ignore\');set_bg_all(\'ignore\');">'.cplang('moderate_all_ignore').'</a> &nbsp;<a href="#all" onclick="cancelallcheck();set_bg_all(\'cancel\');">'.cplang('moderate_all_cancel').'</a><input class="checkbox" type="checkbox" name="apply_all" id="chk_apply_all" value="1" disabled="disabled" />'.cplang('moderate_apply_all').' &nbsp;<input class="checkbox" type="checkbox" name="sendemail" id="sendemail" value="1" '.$checksendemail.' /><label for="sendemail"> '.cplang('moderate_members_email').'</label>', $multipage);
showtablefooter();
showformfooter();
} else {
$moderation = array('invalidate' => array(), 'validate' => array(), 'delete' => array(), 'ignore' => array());
$uids = array();
$uidsql = '';
if(!$_GET['apply_all']) {
if(is_array($_GET['modtype'])) {
foreach($_GET['modtype'] as $uid => $act) {
$uid = intval($uid);
$uids[$uid] = $uid;
$moderation[$act][$uid] = $uid;
}
$uidsql = 'v.uid IN ('.dimplode($uids).') AND';
}
}
$members = array();
$allmembervalidate = $uids ? C::t('common_member_validate')->fetch_all($uids) : C::t('common_member_validate')->range();
foreach(C::t('common_member')->fetch_all(array_keys($allmembervalidate), false, 0) as $uid => $member) {
if($member['groupid'] == 8 || $member['freeze'] == 2 || $member['freeze'] == -1) {
$members[$uid] = $member;
}
}
$alluids = array_keys($members);
if($_GET['apply_all']) {
$moderation[$_GET['apply_all']] = array_merge($alluids, $moderation[$_GET['apply_all']]);
}
if(!empty($members)) {
$numdeleted = $numinvalidated = $numvalidated = 0;
if(!empty($moderation['delete']) && is_array($moderation['delete'])) {
$deluids = array_intersect($moderation['delete'], $alluids);
$numdeleted = count($deluids);
C::t('common_member')->delete_no_validate($deluids);
loaducenter();
uc_user_delete($deluids);
} else {
$moderation['delete'] = array();
}
if(!empty($moderation['validate']) && is_array($moderation['validate'])) {
$validateuids = array_intersect($moderation['validate'], $alluids);
C::t('common_member')->update($validateuids, array('adminid' => 0, 'groupid' => $_G['setting']['newusergroupid'], 'freeze' => 0));
$numvalidated = count($validateuids);
C::t('common_member_validate')->delete($validateuids);
} else {
$moderation['validate'] = array();
}
if(!empty($moderation['invalidate']) && is_array($moderation['invalidate'])) {
$invalidateuids = array_intersect($moderation['invalidate'], $alluids);
$numinvalidated = count($invalidateuids);
foreach($invalidateuids as $uid) {
C::t('common_member_validate')->update($uid, array('moddate' => $_G['timestamp'], 'admin' => $_G['username'], 'status' => '1', 'remark' => dhtmlspecialchars($_GET['remark'][$uid])));
}
} else {
$moderation['invalidate'] = array();
}
foreach(array('validate', 'invalidate') as $o) {
foreach($moderation[$o] as $uid) {
if($_GET['remark'][$uid]) {
switch($o) {
case 'validate':
notification_add($uid, 'mod_member', 'member_moderate_validate', array('remark' => $_GET['remark'][$uid]));
break;
case 'invalidate':
notification_add($uid, 'mod_member', 'member_moderate_invalidate', array('remark' => $_GET['remark'][$uid]));
break;
}
} else {
switch($o) {
case 'validate':
notification_add($uid, 'mod_member', 'member_moderate_validate_no_remark');
break;
case 'invalidate':
notification_add($uid, 'mod_member', 'member_moderate_invalidate_no_remark');
break;
}
}
}
}
if($_GET['sendemail']) {
if(!function_exists('sendmail')) {
include libfile('function/mail');
}
foreach(array('delete', 'validate', 'invalidate') as $o) {
foreach($moderation[$o] as $uid) {
if(isset($members[$uid])) {
$member = $members[$uid];
$member['regdate'] = dgmdate($member['regdate']);
$member['submitdate'] = dgmdate($member['submitdate']);
$member['moddate'] = dgmdate(TIMESTAMP);
$member['operation'] = $o;
$member['remark'] = $_GET['remark'][$uid] ? dhtmlspecialchars($_GET['remark'][$uid]) : $lang['none'];
$moderate_member_message = array(
'tpl' => 'moderate_member',
'var' => array(
'username' => $member['username'],
'bbname' => $_G['setting']['bbname'],
'regdate' => $member['regdate'],
'submitdate' => $member['submitdate'],
'submittimes' => $allmembervalidate[$uid]['submittimes'],
'message' => $allmembervalidate[$uid]['message'],
'modresult' => lang('email', 'moderate_member_'.$member['operation']),
'moddate' => $member['moddate'],
'adminusername' => $_G['member']['username'],
'remark' => $member['remark'],
'siteurl' => $_G['siteurl'],
)
);
if(!sendmail("{$member['username']} <{$member['email']}>", $moderate_member_message)) {
runlog('sendmail', "{$member['email']} sendmail failed.");
}
}
}
}
}
}
cpmsg('moderate_members_op_succeed', "action=moderate&operation=members&page=$page", 'succeed', array('numvalidated' => $numvalidated, 'numinvalidated' => $numinvalidated, 'numdeleted' => $numdeleted));
}
} elseif($do == 'del') {
if(!submitcheck('prunesubmit', 1)) {
shownav('user', 'nav_modmembers');
showsubmenu('nav_moderate_users', array(
array('nav_moderate_users_mod', 'moderate&operation=members&do=mod', 0),
array('clean', 'moderate&operation=members&do=del', 1)
));
showtips('moderate_members_tips');
showformheader('moderate&operation=members&do=del');
showtableheader('moderate_members_prune');
showsetting('moderate_members_prune_submitmore', 'submitmore', '5', 'text');
showsetting('moderate_members_prune_regbefore', 'regbefore', '30', 'text');
showsetting('moderate_members_prune_modbefore', 'modbefore', '15', 'text');
showsetting('moderate_members_prune_regip', 'regip', '', 'text');
showsubmit('prunesubmit');
showtablefooter();
showformfooter();
} else {
$uids = C::t('common_member_validate')->fetch_all_validate_uid($_GET['submitmore'], $_GET['regbefore'], $_GET['modbefore'], $_GET['regip']);
if((!$membernum = count($uids))) {
cpmsg('members_search_noresults', '', 'error');
} elseif(!$_GET['confirmed']) {
cpmsg('members_delete_confirm', "action=moderate&operation=members&do=del&submitmore=".rawurlencode($_GET['submitmore'])."&regbefore=".rawurlencode($_GET['regbefore'])."&modbefore=".rawurlencode($_GET['modbefore'])."&regip=".rawurlencode($_GET['regip'])."&prunesubmit=yes", 'form', array('membernum' => $membernum));
} else {
$numdeleted = C::t('common_member')->delete_no_validate(array_keys($uids));
cpmsg('members_delete_succeed', '', 'succeed', array('numdeleted' => $numdeleted));
}
}
}
?>

View File

@@ -0,0 +1,158 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_picture.php 25728 2011-11-21 03:52:01Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_pictures']);
showsubmenu('nav_moderate_pictures', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $tpp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$pic_status = 1;
if($_GET['filter'] == 'ignore') {
$pic_status = 2;
}
showformheader("moderate&operation=pictures");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_title_keyword'), "<input size=\"15\" name=\"title\" type=\"text\" value=\"{$_GET['title']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->count_by_search_for_pic($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$picarr = C::t('common_moderate')->fetch_all_by_search_for_pic($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($picarr));
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=pictures&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&tpp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
require_once libfile('function/home');
foreach($picarr as $pic) {
$pic['dateline'] = dgmdate($pic['dateline']);
$pic['title'] = $pic['title'] ? '<b>'.$pic['title'].'</b>' : '<i>'.$lang['nosubject'].'</i>';
if($showcensor) {
$censor->check($pic['title']);
}
$pic_censor_words = $censor->words_found;
if(count($pic_censor_words) > 3) {
$pic_censor_words = array_slice($pic_censor_words, 0, 3);
}
$pic['censorwords'] = implode(', ', $pic_censor_words);
$pic['modpickey'] = modauthkey($pic['picid']);
$pic['postip'] = $pic['postip'] . '-' . convertip($pic['postip']);
$pic['url'] = pic_get($pic['filepath'], 'album', $pic['thumb'], $pic['remote']);
if(count($pic_censor_words)) {
$pic_censor_text = "<span style=\"color: red;\">({$pic['censorwords']})</span>";
} else {
$pic_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$pic['picid']}_row1\"", array("id=\"mod_{$pic['picid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$pic['picid']}]\" id=\"mod_{$pic['picid']}_1\" value=\"validate\" onclick=\"mod_setbg({$pic['picid']}, 'validate');\"><label for=\"mod_{$pic['picid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$pic['picid']}]\" id=\"mod_{$pic['picid']}_2\" value=\"delete\" onclick=\"mod_setbg({$pic['picid']}, 'delete');\"><label for=\"mod_{$pic['picid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$pic['picid']}]\" id=\"mod_{$pic['picid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$pic['picid']}, 'ignore');\"><label for=\"mod_{$pic['picid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle('{$pic['picid']}');\">{$pic['title']}</a> $pic_censor_text</h3><p>{$pic['postip']}</p>",
"<a target=\"_blank\" href=\"home.php?mod=space&uid={$pic['uid']}&do=album&id={$pic['albumid']}\">{$pic['albumname']}</a>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$pic['uid']}&submit=yes\">{$pic['username']}</a></p> <p>{$pic['dateline']}</p>",
"<a target=\"_blank\" href=\"home.php?mod=space&uid={$pic['uid']}&do=album&picid={$pic['picid']}&modpickey={$pic['modpickey']}\">{$lang['view']}</a>",
));
showtablerow("id=\"mod_{$pic['picid']}_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;"><img src="'.$pic['url'].'" /></div>');
showtablerow("id=\"mod_{$pic['picid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=pictures&fast=1&picid={$pic['picid']}&moderate[{$pic['picid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=pictures&fast=1&picid={$pic['picid']}&moderate[{$pic['picid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=pictures&fast=1&picid={$pic['picid']}&moderate[{$pic['picid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
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);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $picid => $act) {
$moderation[$act][] = $picid;
}
}
if($moderation['validate']) {
$validates = C::t('home_pic')->update($moderation['validate'], array('status' => '0'));
$albumincrease = array();
foreach(C::t('home_pic')->fetch_all($moderation['validate']) as $pics) {
$albumincrease[$pics['albumid']]++;
}
foreach($albumincrease as $albumid=>$albuminc) {
C::t('home_album')->update_num_by_albumid($albumid, $albuminc);
}
updatemoderate('picid', $moderation['validate'], 2);
}
if(!empty($moderation['delete'])) {
require_once libfile('function/delete');
$pics = deletepics($moderation['delete']);
$deletes = count($pics);
updatemoderate('picid', $moderation['delete'], 2);
}
if($moderation['ignore']) {
$ignores = C::t('home_pic')->update($moderation['ignore'], array('status' => '2'));
updatemoderate('picid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['picid']);
exit;
} else {
cpmsg('moderate_pictures_succeed', "action=moderate&operation=pictures&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,188 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_portalcomment.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
$idtype = $tablename = $mod = '';
if($operation == 'articlecomments') {
$idtype = 'aid';
$tablename = 'portal_article_title';
$mod = 'view';
} else {
$idtype = 'topicid';
$tablename = 'portal_topic';
$mod = 'topic';
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
if($operation == 'articlecomments') {
shownav('topic', $lang['moderate_articlecomments']);
showsubmenu('nav_moderate_articlecomments', $submenu);
} else {
shownav('topic', $lang['moderate_topiccomments']);
showsubmenu('nav_moderate_topiccomments', $submenu);
}
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$cat_select = '';
if($operation == 'articlecomments') {
$cat_select = '<option value="">'.$lang['all'].'</option>';
loadcache('portalcategory');
foreach($_G['cache']['portalcategory'] as $cat) {
$selected = '';
if($cat['catid'] == $_GET['catid']) {
$selected = 'selected="selected"';
}
$cat_select .= "<option value=\"{$cat['catid']}\" $selected>{$cat['catname']}</option>";
}
$cat_select = "<select name=\"catid\">$cat_select</select>";
}
$articlecomment_status = 1;
if($_GET['filter'] == 'ignore') {
$articlecomment_status = 2;
}
showformheader("moderate&operation=$operation");
showboxheader('search');
showtableheader();
if($operation == 'articlecomments') {
showtablerow('', array('width="100"', 'width="200"', 'width="100"', 'width="200"', 'width="60"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_article_category'), $cat_select,
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
} else {
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
}
showtablerow('', $operation == 'articlecomments' ?
array('width="100"', 'width="200"', 'width="100"', 'colspan="3"') :
array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$modcount = C::t('common_moderate')->fetch_all_for_portalcomment($idtype, $tablename, $moderatestatus, $_GET['catid'], $_GET['username'], $dateline, 1, $_GET['keyword']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$query = C::t('common_moderate')->fetch_all_for_portalcomment($idtype, $tablename, $moderatestatus, $_GET['catid'], $_GET['username'], $dateline, 0, $_GET['keyword'], $start_limit, $tpp);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && count($query) == 0);
$page = $pagetmp + 1;
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=$operation&filter=$filter&modfid=$modfid&ppp=$tpp&showcensor=$showcensor");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($query as $articlecomment) {
$articlecomment['dateline'] = dgmdate($articlecomment['dateline']);
if($showcensor) {
$censor->check($articlecomment['title']);
$censor->check($articlecomment['message']);
}
$articlecomment_censor_words = $censor->words_found;
if(count($articlecomment_censor_words) > 3) {
$articlecomment_censor_words = array_slice($articlecomment_censor_words, 0, 3);
}
$articlecomment['censorwords'] = implode(', ', $articlecomment_censor_words);
$articlecomment['modarticlekey'] = modauthkey($articlecomment['aid']);
$articlecomment['modarticlecommentkey'] = modauthkey($articlecomment['cid']);
if(count($articlecomment_censor_words)) {
$articlecomment_censor_text = "<span style=\"color: red;\">({$articlecomment['censorwords']})</span>";
} else {
$articlecomment_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$articlecomment['cid']}_row1\"", array("id=\"mod_{$articlecomment['cid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$articlecomment['cid']}]\" id=\"mod_{$articlecomment['cid']}_1\" value=\"validate\" onclick=\"mod_setbg({$articlecomment['cid']}, 'validate');\"><label for=\"mod_{$articlecomment['cid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$articlecomment['cid']}]\" id=\"mod_{$articlecomment['cid']}_2\" value=\"delete\" onclick=\"mod_setbg({$articlecomment['cid']}, 'delete');\"><label for=\"mod_{$articlecomment['cid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$articlecomment['cid']}]\" id=\"mod_{$articlecomment['cid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$articlecomment['cid']}, 'ignore');\"><label for=\"mod_{$articlecomment['cid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$articlecomment['cid']});\">{$articlecomment['title']} $articlecomment_censor_text</a></h3>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$articlecomment['uid']}&submit=yes\">{$articlecomment['username']}</a></p> <p>{$articlecomment['dateline']}</p>",
"<a target=\"_blank\" href=\"portal.php?mod=$mod&$idtype={$articlecomment['id']}&modarticlekey={$articlecomment['modarticlekey']}#comment_anchor_{$articlecomment['cid']}\">{$lang['view']}</a>&nbsp;<a href=\"portal.php?mod=portalcp&ac=comment&op=edit&cid={$articlecomment['cid']}&modarticlecommentkey={$articlecomment['modarticlecommentkey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$articlecomment['cid']}_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;">'.$articlecomment['message'].'</div>');
showtablerow("id=\"mod_{$articlecomment['cid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=$operation&fast=1&cid={$articlecomment['cid']}&moderate[{$articlecomment['cid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=$operation&fast=1&cid={$articlecomment['cid']}&moderate[{$articlecomment['cid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=$operation&fast=1&cid={$articlecomment['cid']}&moderate[{$articlecomment['cid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>");
showtagfooter('tbody');
}
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);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $cid => $act) {
$moderation[$act][] = $cid;
}
}
if($moderation['validate']) {
$validates = C::t('portal_comment')->update($moderation['validate'], array('status' => '0'));
updatemoderate($idtype.'_cid', $moderation['validate'], 2);
}
if($moderation['delete']) {
$validates = C::t('portal_comment')->delete($moderation['delete']);
updatemoderate($idtype.'_cid', $moderation['delete'], 2);
}
if($moderation['ignore']) {
$validates = C::t('portal_comment')->update($ignore_cids, array('status' => '2'));
updatemoderate($idtype.'_cid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['cid']);
exit;
} else {
cpmsg('moderate_'.$operation.'_succeed', "action=moderate&operation=$operation&page=$page&filter=$filter&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&catid={$_GET['catid']}&tpp={$_GET['tpp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,396 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_reply.php 32501 2013-01-29 09:51:00Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
loadcache('posttableids');
$posttable = (is_array($_G['cache']['posttableids']) ? in_array($_GET['posttableid'], $_G['cache']['posttableids']) : 0) ? $_GET['posttableid'] : 0;
if(!submitcheck('modsubmit') && !$_GET['fast']) {
require_once libfile('function/discuzcode');
$select[$_GET['ppp']] = $_GET['ppp'] ? "selected='selected'" : '';
$ppp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$ppp = !empty($_GET['ppp']) ? $_GET['ppp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$posttableselect = getposttableselect_admin();
shownav('topic', $lang['moderate_replies']);
showsubmenu('nav_moderate_posts', $submenu);
showformheader("moderate&operation=replies");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"', $posttableselect ? 'width="160"' : '', $posttableselect ? 'width="60"' : ''),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"title\" type=\"text\" value=\"{$_GET['title']}\" />",
$posttableselect ? cplang('postsplit_select') : '',
$posttableselect
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"', 'colspan="3"'),
array(
"{$lang['perpage']}",
"<select name=\"ppp\">$ppp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"modfid\">$forumoptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$fidadd = array();
$sqlwhere = '';
if(!empty($_GET['username'])) {
$sqlwhere .= " AND p.author='{$_GET['username']}'";
}
if(!empty($dateline) && $dateline != 'all') {
$sqlwhere .= " AND p.dateline>'".(TIMESTAMP - $dateline)."'";
}
if(!empty($_GET['title'])) {
$sqlwhere .= " AND t.subject LIKE '%{$_GET['title']}%'";
}
if($modfid > 0) {
$fidadd['fids'] = $modfid;
}
$modcount = C::t('common_moderate')->count_by_search_for_post(getposttable($posttable), $moderatestatus, 0, ($modfid > 0 ? $modfid : 0), $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title']);
$start_limit = ($page - 1) * $ppp;
$postarr = C::t('common_moderate')->fetch_all_by_search_for_post(getposttable($posttable), $moderatestatus, 0, ($modfid > 0 ? $modfid : 0), $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['title'], $start_limit, $ppp);
if($postarr) {
$_tids = $_fids = array();
foreach($postarr as $_post) {
$_fids[$_post['fid']] = $_post['fid'];
$_tids[$_post['tid']] = $_post['tid'];
}
$_forums = C::t('forum_forum')->fetch_all($_fids);
$_threads = C::t('forum_thread')->fetch_all($_tids);
}
$checklength = C::t('common_moderate')->fetch_all_by_idtype('pid', $moderatestatus, null);
if($modcount != $checklength && !$srcdate && !$modfid && !$_GET['username'] && !$_GET['title'] && !$posttable) {
moderateswipe('pid', array_keys($checklength));
}
$multipage = multi($modcount, $ppp, $page, ADMINSCRIPT."?action=moderate&operation=replies&filter=$filter&modfid=$modfid&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&ppp=$ppp&showcensor=$showcensor&posttableid=$posttable");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($postarr as &$post) {
$_forum = $_forums[$post['fid']];
$_arr = array(
'forumname' => $_forum['name'],
'allowsmilies' => $_forum['allowsmilies'],
'allowhtml' => $_forum['allowhtml'],
'allowbbcode' => $_forum['allowbbcode'],
'allowimgcode' => $_forum['allowimgcode'],
);
$post = array_merge($post, $_arr);
if(getstatus($post['status'], 5)) {
$post['authorid'] = 0;
$post['author'] = cplang('moderate_t_comment');
}
$post['dateline'] = dgmdate($post['dateline']);
$post['tsubject'] = $_threads[$post['tid']]['subject'];
$post['subject'] = $post['subject'] ? '<b>'.$post['subject'].'</b>' : '';
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $post['allowsmilies'], $post['allowbbcode'], $post['allowimgcode'], $post['allowhtml']);
if($showcensor) {
$censor->check($post['subject']);
$censor->check($post['message']);
}
$post_censor_words = $censor->words_found;
if(count($post_censor_words) > 3) {
$post_censor_words = array_slice($post_censor_words, 0, 3);
}
$post['censorwords'] = implode(', ', $post_censor_words);
$post['modthreadkey'] = modauthkey($post['tid']);
$post['useip'] = $post['useip'] . '-' . convertip($post['useip']);
if($post['attachment']) {
require_once libfile('function/attachment');
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$post['tid'], 'pid', $post['pid']) as $attach) {
$_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
$attach['url'] = $attach['isimage']
? " {$attach['filename']} (".sizecount($attach['filesize']).")<br /><br /><img src=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">"
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
$post['message'] .= "<br /><br />{$lang['attachment']}: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
if(count($post_censor_words)) {
$post_censor_text = "<span style=\"color: red;\">({$post['censorwords']})</span>";
} else {
$post_censor_text = '';
}
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$post['pid']}_row1\"", array("id=\"mod_{$post['pid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="55"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"validate\" onclick=\"mod_setbg({$post['pid']}, 'validate');document.getElementById('deloptions_{$post['pid']}').style.display='none';\"><label for=\"mod_{$post['pid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"delete\" onclick=\"mod_setbg({$post['pid']}, 'delete');document.getElementById('deloptions_{$post['pid']}').style.display='inline';\"><label for=\"mod_{$post['pid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$post['pid']}, 'ignore');document.getElementById('deloptions_{$post['pid']}').style.display='none';\"><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>",
$post['subject'] ? "<h3>{$post['tsubject']} &rsaquo; <a href=\"javascript:;\" onclick=\"display_toggle('{$post['pid']}');\">{$post['subject']}</a> $post_censor_text</h3><p>{$post['useip']}</p>" : "<h3> <a href=\"javascript:;\" onclick=\"display_toggle('{$post['pid']}');\">{$post['tsubject']} &rsaquo;</a> $post_censor_text</h3><p>{$post['useip']}</p>",
"<a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\">{$post['forumname']}</a>",
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$post['authorid']}&submit=yes\">{$post['author']}</a></p> <p>{$post['dateline']}</p>",
"<a target=\"_blank\" href=\"forum.php?mod=redirect&goto=findpost&ptid={$post['tid']}&pid={$post['pid']}\">{$lang['view']}</a>&nbsp;<a href=\"forum.php?mod=viewthread&tid={$post['tid']}&modthreadkey={$post['modthreadkey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$post['pid']}_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;">'.$post['message'].'</div>');
showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=validate&page=$page&posttableid=$posttable&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=delete&page=$page&posttableid=$posttable&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=replies&fast=1&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}&moderate[{$post['pid']}]=ignore&page=$page&posttableid=$posttable&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a>&nbsp;&nbsp;|&nbsp;&nbsp; ".$lang['moderate_reasonpm']."&nbsp; <input type=\"text\" class=\"txt\" name=\"pm_{$post['pid']}\" id=\"pm_{$post['pid']}\" style=\"margin: 0px;\"> &nbsp; <select style=\"margin: 0px;\" onchange=\"$('pm_{$post['pid']}').value=this.value\">$modreasonoptions</select>&nbsp;<p id=\"deloptions_{$post['pid']}\" style=\"display: none\"><label for=\"userban_{$post['pid']}\"><input type=\"checkbox\" name=\"banuser_{$post['pid']}\" id=\"userban_{$post['pid']}\" class=\"pc\" />".$lang['banuser']."</label><label for=\"userdelpost_{$post['pid']}\"><input type=\"checkbox\" name=\"userdelpost_{$post['pid']}\" id=\"userdelpost_{$post['pid']}\" class=\"pc\" />".$lang['userdelpost']."</label><label for=\"crimerecord_{$post['pid']}\"><input type=\"checkbox\" name=\"crimerecord_{$post['pid']}\" id=\"crimerecord_{$post['pid']}\" class=\"pc\" />".$lang['crimerecord']."</label></p>");
showtagfooter('tbody');
}
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> &nbsp;<label><input class="checkbox" type="checkbox" name="apply_all" id="chk_apply_all" value="1" disabled="disabled" />'.cplang('moderate_apply_all').'</label>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$pmlist = array();
$validates = $ignores = $deletes = 0;
if(is_array($moderate)) {
foreach($moderate as $pid => $act) {
$moderation[$act][] = intval($pid);
}
}
if($_GET['apply_all']) {
$apply_all_action = $_GET['apply_all'];
$first = '0';
if($filter == 'ignore') {
$invisible = '-3';
} else {
$invisible = '-2';
}
if($modfid > 0) {
$modfid = $modfid;
}
if(!empty($_GET['dateline']) && $_GET['dateline'] != 'all') {
$starttime = $_GET['dateline'];
}
if(!empty($_GET['username'])) {
$author = $_GET['username'];
}
if(!empty($_GET['title'])) {
$title = str_replace(array('_', '%'), array('\_', '\%'), $_GET['title']);
$keywords = $title;
}
foreach(C::t('forum_post')->fetch_all_by_search($posttable, null, $keywords, $invisible, $modfid, null, $author, $starttime, null, null, $first) as $post) {
switch($apply_all_action) {
case 'validate':
$moderation['validate'][] = $post['pid'];
break;
case 'delete':
$moderation['delete'][] = $post['pid'];
break;
case 'ignore':
$moderation['ignore'][] = $post['pid'];
break;
}
}
}
require_once libfile('function/post');
if($ignorepids = dimplode($moderation['ignore'])) {
$ignores = C::t('forum_post')->update_post($posttable, $moderation['ignore'], array('invisible' => -3), false, false, 0, -2, $fidadd['fids']);
updatemoderate('pid', $moderation['ignore'], 1);
}
if($deletepids = dimplode($moderation['delete'])) {
$pids = $recyclebinpids = array();
foreach(C::t('forum_post')->fetch_all_post($posttable, $moderation['delete']) as $post) {
if($post['invisible'] != $displayorder || $post['first'] != 0 || ($fidadd['fids'] && $post['fid'] != $fidadd['fids'])) {
continue;
}
if($recyclebins[$post['fid']]) {
$recyclebinpids[] = $post['pid'];
} else {
$pids[] = $post['pid'];
}
$pm = 'pm_'.$post['pid'];
if($post['authorid'] && $post['authorid'] != $_G['uid']) {
$pmlist[] = array(
'action' => $_GET[''.$pm] ? 'modreplies_delete_reason' : 'modreplies_delete',
'notevar' => array('pid' => $post['pid'], 'post' => dhtmlspecialchars(messagecutstr($post['message'], 30)), 'reason' => dhtmlspecialchars($_GET[''.$pm]), 'modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : '')),
'authorid' => $post['authorid'],
);
}
if($_GET['crimerecord'.$post['pid']]) {
require_once libfile('function/member');
crime('recordaction', $post['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => dhtmlspecialchars($_GET[$pm]), 'tid' => $post['tid'], 'pid' => $post['pid'])));
}
if($_GET['banuser_'.$post['pid']] || $_GET['userdelpost_'.$post['pid']]) {
$members = C::t('common_member')->fetch_all((array)$post['authorid']);
$banuins = array();
foreach($members as $member) {
if(($_G['cache']['usergroups'][$member['groupid']]['type'] == 'system' &&
in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $_G['cache']['usergroups'][$member['groupid']]['type'] == 'special') {
continue;
}
$banuins[$member['uid']] = $member['uid'];
}
if($banuins) {
if($_GET['banuser_'.$post['pid']]) {
C::t('common_member')->update($banuins, array('groupid' => 4));
}
if($_GET['userdelpost_'.$post['pid']]) {
require_once libfile('function/delete');
deletememberpost($banuins);
}
}
}
}
require_once libfile('function/delete');
if($recyclebinpids) {
deletepost($recyclebinpids, 'pid', false, $posttable, true);
}
if($pids) {
$deletes = deletepost($pids, 'pid', false, $posttable);
}
$deletes += count($recyclebinpids);
updatemodworks('DLP', count($moderation['delete']));
updatemoderate('pid', $moderation['delete'], 2);
}
if($validatepids = dimplode($moderation['validate'])) {
$forums = $threads = $attachments = $pidarray = $authoridarray = array();
$tids = $postlist = array();
foreach(C::t('forum_post')->fetch_all_post($posttable, $moderation['validate']) as $post) {
if($post['first'] != 0) {
continue;
}
$tids[$post['tid']] = $post['tid'];
$postlist[] = $post;
}
$threadlist = C::t('forum_thread')->fetch_all($tids);
$firsttime_validatepost = array();
$uids = array();
foreach($postlist as $post) {
$post['lastpost'] = $threadlist[$post['tid']]['lastpost'];
$pidarray[] = $post['pid'];
if(getstatus($post['status'], 3) == 0) {
$post['subject'] = $threadlist[$post['tid']]['subject'];
$firsttime_validatepost[] = $post;
$uids[] = $post['authorid'];
updatepostcredits('+', $post['authorid'], 'reply', $post['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$post['tid'], 'pid', $post['pid']);
updatecreditbyaction('postattach', $post['authorid'], array(), '', $attachcount, 1, $post['fid']);
}
$forums[] = $post['fid'];
$threads[$post['tid']]['replies']++;
if($post['dateline'] > $post['lastpost']) {
$threads[$post['tid']]['lastpost'] = array($post['dateline']);
$threads[$post['tid']]['lastposter'] = array($post['anonymous'] && $post['dateline'] != $post['lastpost'] ? '' : $post['author']);
}
if($threads[$post['tid']]['attachadd'] || $post['attachment']) {
$threads[$post['tid']]['attachment'] = array(1);
}
$pm = 'pm_'.$post['pid'];
if($post['authorid'] && $post['authorid'] != $_G['uid']) {
$pmlist[] = array(
'action' => 'modreplies_validate',
'notevar' => array('pid' => $post['pid'], 'tid' => $post['tid'], 'post' => dhtmlspecialchars(messagecutstr($post['message'], 30)), 'reason' => dhtmlspecialchars($_GET[''.$pm]), 'modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : ''), 'from_id' => 0, 'from_idtype' => 'modreplies'),
'authorid' => $post['authorid'],
);
}
}
unset($postlist, $tids, $threadlist);
if($firsttime_validatepost) {
require_once libfile('function/post');
require_once libfile('function/feed');
$forumsinfo = C::t('forum_forum')->fetch_all_info_by_fids($forums);
$users = array();
foreach ($uids as $uid) {
$space = array('uid'=>$uid);
space_merge($space, 'field_home');
$users[$uid] = $space;
}
foreach ($firsttime_validatepost as $post) {
if($forumsinfo[$post['fid']] && $forumsinfo[$post['fid']]['allowfeed'] && $users[$post['authorid']]['privacy']['feed']['newreply'] && !$post['anonymous']) {
$feed = array(
'icon' => 'post',
'title_template' => 'feed_reply_title',
'title_data' => array(),
'images' => array()
);
$post_url = "forum.php?mod=redirect&goto=findpost&pid=".$post['pid']."&ptid=".$post['tid'];
$feed['title_data'] = array(
'subject' => "<a href=\"$post_url\">".$post['subject']."</a>",
'author' => "<a href=\"home.php?mod=space&uid=".$post['authorid']."\">".$post['author']."</a>"
);
$feed['title_data']['hash_data'] = 'tid'.$post['tid'];
$feed['id'] = $post['pid'];
$feed['idtype'] = 'pid';
feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype'],$post['authorid'], $post['author']);
}
}
}
foreach($threads as $tid => $thread) {
C::t('forum_thread')->increase($tid, $thread);
}
foreach(array_unique($forums) as $fid) {
updateforumcount($fid);
}
if(!empty($pidarray)) {
C::t('forum_post')->update_post($posttable, $pidarray, array('status' => 4), false, false, null, -2, null, 0);
$validates = C::t('forum_post')->update_post($posttable, $pidarray, array('invisible' => 0));
updatemodworks('MOD', $validates);
updatemoderate('pid', $pidarray, 2);
} else {
require_once libfile('function/forum');
updatemodworks('MOD', 1);
}
}
if($pmlist) {
foreach($pmlist as $pm) {
notification_add($pm['authorid'], 'system', $pm['action'], $pm['notevar'], 1);
}
}
if($_GET['fast']) {
echo callback_js($_GET['pid']);
exit;
} else {
cpmsg('moderate_replies_succeed', "action=moderate&operation=replies&page=$page&filter=$filter&modfid=$modfid&posttableid=$posttable&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&ppp={$_GET['ppp']}&showcensor=$showcensor", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
}
}
?>

View File

@@ -0,0 +1,240 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_share.php 27434 2012-01-31 08:57:34Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
shownav('topic', $lang['moderate_shares']);
showsubmenu('nav_moderate_shares', $submenu);
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $ppp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
$share_status = 1;
if($_GET['filter'] == 'ignore') {
$share_status = 2;
}
showformheader("moderate&operation=shares");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_content_keyword'), "<input size=\"15\" name=\"keyword\" type=\"text\" value=\"{$_GET['keyword']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$pagetmp = $page;
$sqlwhere = '';
if(!empty($_GET['username'])) {
$sqlwhere .= " AND s.username='{$_GET['username']}'";
}
if(!empty($dateline) && $dateline != 'all') {
$sqlwhere .= " AND s.dateline>'".(TIMESTAMP - $dateline)."'";
}
if(!empty($_GET['keyword'])) {
$keyword = str_replace(array('%', '_'), array('\%', '\_'), $_GET['keyword']);
$sqlwhere .= " AND s.body_general LIKE '%$keyword%'";
}
$modcount = C::t('common_moderate')->count_by_search_for_share($moderatestatus, $_GET['username'], (($dateline && $dateline != 'all') ? (TIMESTAMP - $dateline) : null), $_GET['keyword']);
do {
$start_limit = ($pagetmp - 1) * $tpp;
$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);
$pagetmp = $pagetmp - 1;
} while($pagetmp > 0 && empty($sharearr));
$page = $pagetmp + 1;
$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");
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
require_once libfile('function/misc');
foreach($sharearr as $share) {
$short_desc = cutstr($share['body_general'], 30);
$share['dateline'] = dgmdate($share['dateline']);
if($showcensor) {
$censor->check($short_desc);
$censor->check($share['body_general']);
}
$share_censor_words = $censor->words_found;
if(count($share_censor_words) > 3) {
$share_censor_words = array_slice($share_censor_words, 0, 3);
}
$share['censorwords'] = implode(', ', $share_censor_words);
$share['modkey'] = modauthkey($share['itemid']);
if(count($share_censor_words)) {
$share_censor_text = "<span style=\"color: red;\">({$share['censorwords']})</span>";
} else {
$share_censor_text = '';
}
$shareurl = '';
switch($share['type']) {
case 'thread':
$shareurl = "forum.php?mod=viewthread&tid={$share['itemid']}&modthreadkey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_thread');
break;
case 'pic':
$shareurl = "home.php?mod=space&uid={$share['fromuid']}&do=album&picid={$share['itemid']}&modpickey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_pic');
break;
case 'space':
$shareurl = "home.php?mod=space&uid={$share['itemid']}";
$sharetitle = lang('admincp', 'share_type_space');
break;
case 'blog':
$shareurl = "home.php?mod=space&uid={$share['fromuid']}&do=blog&id={$share['itemid']}&modblogkey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_blog');
break;
case 'album':
$shareurl = "home.php?mod=space&uid={$share['fromuid']}&do=album&id={$share['itemid']}&modalbumkey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_album');
break;
case 'article':
$shareurl = "portal.php?mod=view&aid={$share['itemid']}&modarticlekey={$share['modkey']}";
$sharetitle = lang('admincp', 'share_type_article');
break;
}
showtagheader('tbody', '', true, 'hover');
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(
"<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>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle({$share['sid']});\">$short_desc $share_censor_text</a></h3>",
$sharetitle,
"<p><a target=\"_blank\" href=\"".ADMINSCRIPT."?action=members&operation=search&uid={$share['uid']}&submit=yes\">{$share['username']}</a></p> <p>{$share['dateline']}</p>",
"<a target=\"_blank\" href=\"$shareurl\">{$lang['view']}</a>",
));
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>');
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>");
showtagfooter('tbody');
}
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);
showtablefooter();
showformfooter();
} else {
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
$validates = $deletes = $ignores = 0;
if(is_array($moderate)) {
foreach($moderate as $sid => $act) {
$moderation[$act][] = $sid;
}
}
if(!empty($moderation['validate'])) {
require_once libfile('function/feed');
$validates = C::t('home_share')->update($moderation['validate'], array('status' => 0));
foreach(C::t('home_share')->fetch_all($moderation['validate']) as $share) {
switch($share['type']) {
case 'thread':
$feed_hash_data = 'tid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_thread');
break;
case 'space':
$feed_hash_data = 'uid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_space');
break;
case 'blog':
$feed_hash_data = 'blogid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_blog');
break;
case 'album':
$feed_hash_data = 'albumid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_album');
break;
case 'pic':
$feed_hash_data = 'picid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_image');
break;
case 'article':
$feed_hash_data = 'articleid' . $share['itemid'];
$share['title_template'] = lang('spacecp', 'share_article');
break;
case 'link':
$feed_hash_data = '';
break;
}
feed_add('share',
'{actor} '.$share['title_template'],
array('hash_data' => $feed_hash_data),
$share['body_template'],
dunserialize($share['body_data']),
$share['body_general'],
array($share['image']),
array($share['image_link']),
'',
'',
'',
0,
0,
'',
$share['uid'],
$share['username']
);
}
updatemoderate('sid', $moderation['validate'], 2);
}
if(!empty($moderation['delete'])) {
require libfile('function/delete');
$shares = deleteshares($moderation['delete']);
$deletes = count($shares);
updatemoderate('sid', $moderation['delete'], 2);
}
if($ignore_sids = dimplode($moderation['ignore'])) {
$ignores = C::t('home_share')->update($moderation['ignore'], array('status' => 2));
updatemoderate('sid', $moderation['ignore'], 1);
}
if($_GET['fast']) {
echo callback_js($_GET['sid']);
exit;
} else {
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));
}
}
?>

View File

@@ -0,0 +1,381 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: moderate_thread.php 32501 2013-01-29 09:51:00Z chenmengshu $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
if(!submitcheck('modsubmit') && !$_GET['fast']) {
require_once libfile('function/discuzcode');
$select[$_GET['tpp']] = $_GET['tpp'] ? "selected='selected'" : '';
$tpp_options = "<option value='20' $select[20]>20</option><option value='50' $select[50]>50</option><option value='100' $select[100]>100</option>";
$tpp = !empty($_GET['tpp']) ? $_GET['tpp'] : '20';
$start_limit = ($page - 1) * $tpp;
$dateline = $_GET['dateline'] ? $_GET['dateline'] : '604800';
$dateline_options = '';
foreach(array('all', '604800', '2592000', '7776000') as $v) {
$selected = '';
if($dateline == $v) {
$selected = "selected='selected'";
}
$dateline_options .= "<option value=\"$v\" $selected>".cplang("dateline_$v");
}
shownav('topic', $lang['moderate_threads']);
showsubmenu('nav_moderate_threads', $submenu);
showformheader("moderate&operation=threads");
showboxheader('search');
showtableheader();
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
cplang('username'), "<input size=\"15\" name=\"username\" type=\"text\" value=\"{$_GET['username']}\" />",
cplang('moderate_title_keyword'), "<input size=\"15\" name=\"title\" type=\"text\" value=\"{$_GET['title']}\" />",
)
);
showtablerow('', array('width="100"', 'width="200"', 'width="100"'),
array(
"{$lang['perpage']}",
"<select name=\"tpp\">$tpp_options</select><label><input name=\"showcensor\" type=\"checkbox\" class=\"checkbox\" value=\"yes\" ".($showcensor ? ' checked="checked"' : '')."/> {$lang['moderate_showcensor']}</label>",
"{$lang['moderate_bound']}",
"<select name=\"filter\">$filteroptions</select>
<select name=\"modfid\">$forumoptions</select>
<select name=\"dateline\">$dateline_options</select>
<input class=\"btn\" type=\"submit\" value=\"{$lang['search']}\" />"
)
);
showtablefooter();
showboxfooter();
$title = '';
if(!empty($_GET['title'])) {
$title = str_replace(array('_', '%'), array('\_', '\%'), $_GET['title']);
}
if(!empty($dateline) && $dateline != 'all') {
$srcdate = TIMESTAMP - $dateline;
}
$fids = $modfid && $modfid != -1 ? $modfid : 0;
$isgroup = $modfid == -1 ? 1 : -1;
$modcount = 0;
$moderates = C::t('common_moderate')->fetch_all_by_idtype('tid', $moderatestatus, $srcdate);
if(!empty($moderates)) {
$modcount = C::t('forum_thread')->count_by_tid_fid(array_keys($moderates), $fids, $isgroup, $_GET['username'], $title);
}
if($modcount != count($moderates) && !$srcdate && !$fids && !$_GET['username'] && !$title) {
moderateswipe('tid', array_keys($moderates));
}
$start_limit = ($page - 1) * $tpp;
if($modcount) {
$threadlist = C::t('forum_thread')->fetch_all_by_tid_fid(array_keys($moderates), $fids, $isgroup, $_GET['username'], $title, $start_limit, $tpp);
$tids = C::t('forum_thread')->get_posttableid();
if($tids) {
foreach($tids as $posttableid => $tid) {
foreach(C::t('forum_post')->fetch_all_by_tid($posttableid, $tid, true, '', 0, 0, 1) as $post) {
$threadlist[$post['tid']] = array_merge($threadlist[$post['tid']], $post);
}
}
}
$multipage = multi($modcount, $tpp, $page, ADMINSCRIPT."?action=moderate&operation=threads&filter=$filter&modfid=$modfid&dateline={$_GET['dateline']}&username={$_GET['username']}&title={$_GET['title']}&tpp=$tpp&showcensor=$showcensor");
}
showtableheader('', 'nobottom');
echo '<tr><td><p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">'.cplang('moderate_all_expand').'</a> &nbsp;<a href="javascript:;" onclick="foldall();">'.cplang('moderate_all_fold').'</a></p></td></tr>';
showtablefooter();
showtableheader();
loadcache('forums');
require_once libfile('function/misc');
foreach($threadlist as $thread) {
if($thread['displayorder'] >= 0) {
updatemoderate('tid', $thread['tid'], 2);
continue;
}
$threadsortinfo = '';
$thread['useip'] = $thread['useip'] . '-' . convertip($thread['useip']);
if($thread['authorid'] && $thread['author']) {
$thread['author'] = "<a href=\"?action=members&operation=search&uid={$thread['authorid']}&submit=yes\" target=\"_blank\">{$thread['author']}</a>";
} elseif($thread['authorid'] && !$thread['author']) {
$thread['author'] = "<a href=\"?action=members&operation=search&uid={$thread['authorid']}&submit=yes\" target=\"_blank\">{$lang['anonymous']}</a>";
} else {
$thread['author'] = $lang['guest'];
}
$thread['dateline'] = dgmdate($thread['dateline']);
$thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff']);
$censor = & discuz_censor::instance();
$censor->highlight = '#FF0000';
if($showcensor) {
$censor->check($thread['subject']);
$censor->check($thread['message']);
}
$thread['modthreadkey'] = modauthkey($thread['tid']);
$censor_words = $censor->words_found;
if(count($censor_words) > 3) {
$censor_words = array_slice($censor_words, 0, 3);
}
$thread['censorwords'] = implode(', ', $censor_words);
if($thread['attachment']) {
require_once libfile('function/attachment');
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$thread['tid'], 'tid', $thread['tid']) as $attach) {
$_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
$attach['url'] = $attach['isimage']
? " {$attach['filename']} (".sizecount($attach['filesize']).")<br /><br /><img src=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" onload=\"if(this.width > 400) {this.resized=true; this.width=400;}\">"
: "<a href=\"".$_G['setting']['attachurl']."forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (".sizecount($attach['filesize']).")";
$thread['message'] .= "<br /><br />{$lang['attachment']}: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
if($thread['sortid']) {
require_once libfile('function/threadsort');
$threadsortshow = threadsortshow($thread['sortid'], $thread['tid']);
foreach($threadsortshow['optionlist'] as $option) {
$threadsortinfo .= $option['title'].' '.$option['value']."<br />";
}
}
if(count($censor_words)) {
$thread_censor_text = "<span style=\"color: red;\">({$thread['censorwords']})</span>";
} else {
$thread_censor_text = '';
}
$forumname = $_G['cache']['forums'][$thread['fid']]['name'];
showtagheader('tbody', '', true, 'hover');
showtablerow("id=\"mod_{$thread['tid']}_row1\"", array("id=\"mod_{$thread['tid']}_row1_op\" rowspan=\"3\" class=\"rowform threadopt\" style=\"width:80px;\"", '', 'width="120"', 'width="120"', 'width="70"'), array(
"<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_1\" value=\"validate\" onclick=\"mod_setbg({$thread['tid']}, 'validate');document.getElementById('deloptions_{$thread['tid']}').style.display='none';\"><label for=\"mod_{$thread['tid']}_1\">{$lang['validate']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_2\" value=\"delete\" onclick=\"mod_setbg({$thread['tid']}, 'delete');document.getElementById('deloptions_{$thread['tid']}').style.display='inline';\"><label for=\"mod_{$thread['tid']}_2\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_3\" value=\"ignore\" onclick=\"mod_setbg({$thread['tid']}, 'ignore');document.getElementById('deloptions_{$thread['tid']}').style.display='none';\"><label for=\"mod_{$thread['tid']}_3\">{$lang['ignore']}</label></li></ul>",
"<h3><a href=\"javascript:;\" onclick=\"display_toggle('{$thread['tid']}');\">{$thread['subject']}</a> $thread_censor_text</h3><p>{$thread['useip']}</p>",
"<a target=\"_blank\" href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}\">$forumname</a>",
"<p>{$thread['author']}</p> <p>{$thread['dateline']}</p>",
"<a target=\"_blank\" href=\"forum.php?mod=viewthread&tid={$thread['tid']}&modthreadkey={$thread['modthreadkey']}\">{$lang['view']}</a>&nbsp;<a href=\"forum.php?mod=post&action=edit&fid={$thread['fid']}&tid={$thread['tid']}&pid={$thread['pid']}&modthreadkey={$thread['modthreadkey']}\" target=\"_blank\">{$lang['edit']}</a>",
));
showtablerow("id=\"mod_{$thread['tid']}_row2\"", 'colspan="4" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">'.$thread['message'].'<br /><br />'.$threadsortinfo.'</div>');
showtablerow("id=\"mod_{$thread['tid']}_row3\"", 'class="threadopt threadtitle" colspan="4"', "<a href=\"?action=moderate&operation=threads&fast=1&fid={$thread['fid']}&tid={$thread['tid']}&moderate[{$thread['tid']}]=validate&page=$page&frame=no\" target=\"fasthandle\">{$lang['validate']}</a> | <a href=\"?action=moderate&operation=threads&fast=1&fid={$thread['fid']}&tid={$thread['tid']}&moderate[{$thread['tid']}]=delete&page=$page&frame=no\" target=\"fasthandle\">{$lang['delete']}</a> | <a href=\"?action=moderate&operation=threads&fast=1&fid={$thread['fid']}&tid={$thread['tid']}&moderate[{$thread['tid']}]=ignore&page=$page&frame=no\" target=\"fasthandle\">{$lang['ignore']}</a> | <a href=\"forum.php?mod=post&action=edit&fid={$thread['fid']}&tid={$thread['tid']}&pid={$thread['pid']}&page=1&modthreadkey={$thread['modthreadkey']}\" target=\"_blank\">".$lang['moderate_edit_thread']."</a> &nbsp;&nbsp;|&nbsp;&nbsp; ".$lang['moderate_reasonpm']."&nbsp; <input type=\"text\" class=\"txt\" name=\"pm_{$thread['tid']}\" id=\"pm_{$thread['tid']}\" style=\"margin: 0px;\"> &nbsp; <select style=\"margin: 0px;\" onchange=\"$('pm_{$thread['tid']}').value=this.value\">$modreasonoptions</select>&nbsp;<p id=\"deloptions_{$thread['tid']}\" style=\"display: none\"><label for=\"userban_{$thread['tid']}\"><input type=\"checkbox\" name=\"banuser_{$thread['tid']}\" id=\"userban_{$thread['tid']}\" class=\"pc\" />".$lang['banuser']."</label><label for=\"userdelpost_{$thread['tid']}\"><input type=\"checkbox\" name=\"userdelpost_{$thread['tid']}\" id=\"userdelpost_{$thread['tid']}\" class=\"pc\" />".$lang['userdelpost']."</label><label for=\"crimerecord_{$thread['tid']}\"><input type=\"checkbox\" name=\"crimerecord_{$thread['tid']}\" id=\"crimerecord_{$thread['tid']}\" class=\"pc\" />".$lang['crimerecord']."</label></p>");
showtagfooter('tbody');
}
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> &nbsp;<label><input class="checkbox" type="checkbox" name="apply_all" id="chk_apply_all" value="1" disabled="disabled" />'.cplang('moderate_apply_all').'</label>', $multipage, false);
showtablefooter();
showformfooter();
} else {
$validates = $ignores = $recycles = $deletes = 0;
$validatedthreads = $pmlist = array();
$moderation = array('validate' => array(), 'delete' => array(), 'ignore' => array());
if(is_array($moderate)) {
foreach($moderate as $tid => $act) {
$moderation[$act][] = intval($tid);
}
}
if($_GET['apply_all']) {
$apply_all_action = $_GET['apply_all'];
$author = $dateline = $isgroup = $displayorder = null;
if($filter == 'ignore') {
$displayorder = -3;
} else {
$displayorder = -2;
}
if($modfid == -1) {
$isgroup = 1;
}
if(!empty($_GET['dateline']) && $_GET['dateline'] != 'all') {
$dateline = $_GET['dateline'];
}
foreach(C::t('forum_thread')->fetch_all_moderate($modfid, $displayorder, $isgroup, $dateline, $_GET['username'], $_GET['title']) as $thread) {
switch($apply_all_action) {
case 'validate':
$moderation['validate'][] = $thread['tid'];
break;
case 'delete':
$moderation['delete'][] = $thread['tid'];
break;
case 'ignore':
$moderation['ignore'][] = $thread['tid'];
break;
}
}
}
if($moderation['ignore']) {
$ignores = C::t('forum_thread')->update_displayorder_by_tid_displayorder($moderation['ignore'], -2, -3);
updatemoderate('tid', $moderation['ignore'], 1);
}
if($moderation['delete']) {
$deletetids = array();
$recyclebintids = array();
$deleteauthorids = array();
foreach(C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['delete'], $displayorder, '>=', $fidadd['fids']) as $thread) {
if($recyclebins[$thread['fid']]) {
$recyclebintids[] = $thread['tid'];
} else {
$deletetids[] = $thread['tid'];
}
$pm = 'pm_'.$thread['tid'];
if($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
$pmlist[] = array(
'action' => $_GET[$pm] ? 'modthreads_delete_reason' : 'modthreads_delete',
'notevar' => array('threadsubject' => $thread['subject'], 'reason' => $_GET[$pm], 'modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : '')),
'authorid' => $thread['authorid'],
);
}
if($_GET['crimerecord_'.$thread['tid']]) {
require_once libfile('function/member');
crime('recordaction', $thread['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => dhtmlspecialchars($_GET[$pm]), 'tid' => $thread['tid'], 'pid' => $thread['pid'])));
}
if($_GET['banuser_'.$thread['tid']] || $_GET['userdelpost_'.$thread['tid']]) {
$members = C::t('common_member')->fetch_all((array)$thread['authorid']);
$banuins = array();
foreach($members as $member) {
if(($_G['cache']['usergroups'][$member['groupid']]['type'] == 'system' &&
in_array($member['groupid'], array(1, 2, 3, 6, 7, 8))) || $_G['cache']['usergroups'][$member['groupid']]['type'] == 'special') {
continue;
}
$banuins[$member['uid']] = $member['uid'];
}
if($banuins) {
if($_GET['banuser_'.$thread['tid']]) {
C::t('common_member')->update($banuins, array('groupid' => 4));
}
if($_GET['userdelpost_'.$thread['tid']]) {
require_once libfile('function/delete');
deletememberpost($banuins);
}
}
}
}
require_once libfile('function/delete');
if($recyclebintids) {
$recycles = deletethread($recyclebintids, false, false, true);
updatemodworks('MOD', $recycles);
updatemodlog(implode(',', $recyclebintids), 'DEL');
}
$deletes = deletethread($deletetids);
updatemoderate('tid', $moderation['delete'], 2);
}
if($moderation['validate']) {
require_once libfile('function/forum');
$forums = array();
$tids = $authoridarray = $moderatedthread = array();
$firsttime_validatethread = array();
$uids = array();
foreach(C::t('forum_thread')->fetch_all_by_tid_fid($moderation['validate'], $fidadd['fids']) as $thread) {
if($thread['displayorder'] != -2 && $thread['displayorder']!= -3) {
continue;
}
$poststatus = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
$thread['anonymous'] = $poststatus['anonymous'];
$thread['message'] = $poststatus['message'];
$poststatus = $poststatus['status'];
$tids[] = $thread['tid'];
if(getstatus($poststatus, 3) == 0) {
$firsttime_validatethread[] = $thread;
$uids[] = $thread['authorid'];
updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$thread['tid'], 'tid', $thread['tid']);
updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
}
$forums[] = $thread['fid'];
$validatedthreads[] = $thread;
$pm = 'pm_'.$thread['tid'];
if($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
$pmlist[] = array(
'action' => 'modthreads_validate',
'notevar' => array('tid' => $thread['tid'], 'threadsubject' => $thread['subject'], 'reason' => dhtmlspecialchars($_GET[''.$pm]), 'modusername' => ($_G['setting']['moduser_public'] ? $_G['username'] : ''), 'from_id' => 0, 'from_idtype' => 'modthreads'),
'authorid' => $thread['authorid'],
);
}
}
if($firsttime_validatethread) {
require_once libfile('function/post');
require_once libfile('function/feed');
$forumsinfo = C::t('forum_forum')->fetch_all_info_by_fids($forums);
$users = array();
foreach ($uids as $uid) {
$space = array('uid'=>$uid);
space_merge($space, 'field_home');
$users[$uid] = $space;
}
foreach ($firsttime_validatethread as $thread) {
if($forumsinfo[$thread['fid']] && $forumsinfo[$thread['fid']]['allowfeed'] && $users[$thread['authorid']]['privacy']['feed']['newthread'] && !$thread['anonymous']) {
$feed = array(
'icon' => 'thread',
'title_template' => 'feed_thread_title',
'title_data' => array(),
'body_template' => 'feed_thread_message',
'body_data' => array(),
'title_data' => array(),
'images' => array()
);
$message = !$thread['price'] && !$thread['readperm'] ? $thread['message'] : '';
$message = messagesafeclear($message);
$feed['body_data'] = array(
'subject' => "<a href=\"forum.php?mod=viewthread&tid={$thread['tid']}\">{$thread['subject']}</a>",
'message' => messagecutstr($message, 150)
);
$feed['title_data']['hash_data'] = 'tid'.$thread['tid'];
$feed['id'] = $thread['tid'];
$feed['idtype'] = 'tid';
feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype'],$thread['authorid'], $thread['author']);
}
}
}
if($tids) {
$tidstr = dimplode($tids);
C::t('forum_post')->update_by_tid(0, $tids, array('status' => 4), false, false, null, -2, 0);
loadcache('posttableids');
$posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
foreach($posttableids as $id) {
C::t('forum_post')->update_by_tid($id, $tids, array('invisible' => '0'), false, false, 1);
}
$validates = C::t('forum_thread')->update($tids, array('displayorder' => 0, 'moderated' => 1));
foreach(array_unique($forums) as $fid) {
updateforumcount($fid);
}
updatemodworks('MOD', $validates);
updatemodlog($tidstr, 'MOD');
updatemoderate('tid', $tids, 2);
}
}
if($pmlist) {
foreach($pmlist as $pm) {
notification_add($pm['authorid'], 'system', $pm['action'], $pm['notevar'], 1);
}
}
if($_GET['fast']) {
echo callback_js($_GET['tid']);
exit;
} else {
cpmsg('moderate_threads_succeed', "action=moderate&operation=threads&page=$page&filter=$filter&modfid=$modfid&username={$_GET['username']}&title={$_GET['title']}&tpp={$_GET['tpp']}&showcensor=$showcensor&dateline={$_GET['dateline']}", 'succeed', array('validates' => $validates, 'ignores' => $ignores, 'recycles' => $recycles, 'deletes' => $deletes));
}
}
?>