EOT;
showtagheader('div', 'postsearch', !$searchsubmit);
showformheader('recyclebinpost&operation=search', '', 'rbsearchform');
showhiddenfields(array('page' => $page));
showtableheader('recyclebinpost_search');
showsetting('recyclebinpost_search_forum', '', '', $forumselect);
showsetting('recyclebinpost_search_author', 'authors', $authors, 'text');
showsetting('recyclebinpost_search_keyword', 'keywords', $keywords, 'text');
showsetting('recyclebin_search_post_time', array('pstarttime', 'pendtime'), array($pstarttime, $pendtime), 'daterange');
showsetting('postsplit', '', '', getposttableselect());
if($secStatus){
showsetting('recyclebin_search_security_thread', 'security', $security, 'radio');
}
showsubmit('searchsubmit');
showtablefooter();
showformfooter();
showtagfooter('div');
/*search*/
if(submitcheck('searchsubmit')) {
$security = $secStatus && $security;
if($security){
$postlistcount = C::t('#security#security_evilpost')->count_by_search($posttableid, null, $keywords, -5, $inforum, null, ($authors ? explode(',', str_replace(' ', '', $authors)) : null), strtotime($pstarttime), strtotime($pendtime));
}else{
$postlistcount = C::t('forum_post')->count_by_search($posttableid, null, $keywords, -5, $inforum, null, ($authors ? explode(',', str_replace(' ', '', $authors)) : null), strtotime($pstarttime), strtotime($pendtime));
}
showtagheader('div', 'postlist', $searchsubmit);
showformheader('recyclebinpost&operation=search&frame=no', 'target="rbframe"', 'rbform');
showtableheader(cplang('recyclebinpost_result').' '.$postlistcount.' '.cplang('research').'', 'fixpadding');
if($postlistcount && recyclebinpostshowpostlist($inforum, $authors, $pstarttime, $pendtime, $keywords, $start_limit, $lpp)) {
$multi = multi($postlistcount, $lpp, $page, ADMINSCRIPT."?action=recyclebinpost");
$multi = preg_replace("/href=\"".ADMINSCRIPT."\?action=recyclebinpost&page=(\d+)\"/", "href=\"javascript:page(\\1)\"", $multi);
$multi = str_replace("window.location='".ADMINSCRIPT."?action=recyclebinpost&page='+this.value", "page(this.value)", $multi);
}
showsubmit('rbsubmit', 'submit', '', ''.cplang('recyclebin_all_delete').' '.cplang('recyclebin_all_undelete').' '.cplang('recyclebin_all_ignore').' ', $multi);
showtablefooter();
showformfooter();
echo '';
showtagfooter('div');
}
} elseif($operation == 'clean') {
if(!submitcheck('cleanrbsubmit', 1)) {
shownav('topic', 'nav_recyclebinpost');
showsubmenu('nav_recyclebinpost', array(
array('recyclebinpost_list', 'recyclebinpost', 0),
array('search', 'recyclebinpost&operation=search', 0),
array('clean', 'recyclebinpost&operation=clean', 1)
));
/*search={"nav_recyclebinpost":"action=recyclebinpost","clean":"action=recyclebinpost&operation=clean"}*/
showformheader('recyclebinpost&operation=clean');
showtableheader('recyclebinpost_clean');
showsetting('recyclebinpost_clean_days', 'days', '30', 'text');
showsubmit('cleanrbsubmit');
showtablefooter();
showformfooter();
/*search*/
} else {
$deletetids = array();
$pernum = 200;
$postsdel = intval($_GET['postsdel']);
$days = intval($_GET['days']);
$timestamp = TIMESTAMP - max(0, $days * 86400);
$postlist = array();
loadcache('posttableids');
$posttables = !empty($_G['cache']['posttableids']) ? $_G['cache']['posttableids'] : array(0);
foreach($posttables as $ptid) {
foreach(C::t('forum_post')->fetch_all_pid_by_invisible_dateline($ptid, -5, $timestamp, 0, $pernum) as $post) {
$postlist[$ptid][] = $post['pid'];
}
}
$postsundel = 0;
if($postlist) {
foreach($postlist as $ptid => $deletepids) {
$postsdel += recyclebinpostdelete($deletepids, $ptid);
}
$startlimit += $pernum;
cpmsg('recyclebinpost_clean_next', 'action=recyclebinpost&operation=clean&cleanrbsubmit=1&days='.$days.'&postsdel='.$postsdel, 'succeed', array('postsdel' => $postsdel));
} else {
cpmsg('recyclebinpost_succeed', 'action=recyclebinpost&operation=clean', 'succeed', array('postsdel' => $postsdel, 'postsundel' => $postsundel));
}
}
}
function recyclebinpostshowpostlist($fid, $authors, $starttime, $endtime, $keywords, $start_limit, $lpp) {
global $_G, $lang, $posttableid, $security;
$tids = $fids = array();
if($security){
$postlist = C::t('#security#security_evilpost')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, ($authors ? explode(',', str_replace(' ', '', $authors)): null), strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp);
}else{
$postlist = C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, ($authors ? explode(',', str_replace(' ', '', $authors)): null), strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp);
}
if(empty($postlist)) return false;
foreach($postlist as $key => $post) {
$tids[$post['tid']] = $post['tid'];
$fids[$post['fid']] = $post['fid'];
}
foreach(C::t('forum_thread')->fetch_all_by_tid($tids) as $thread) {
$thread['tsubject'] = $thread['subject'];
$threadlist[$thread['tid']] = $thread;
}
$query = C::t('forum_forum')->fetch_all_by_fid($fids);
foreach($query as $val) {
$forum = array('fid' => $val['fid'],
'forumname' => $val['name'],
'allowsmilies' => $val['allowsmilies'],
'allowhtml' => $val['allowhtml'],
'allowbbcode' => $val['allowbbcode'],
'allowimgcode' => $val['allowimgcode']
);
$forumlist[$forum['fid']] = $forum;
}
foreach($postlist as $key => $post) {
$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $forumlist[$post['fid']]['allowsmilies'], $forumlist[$post['fid']]['allowbbcode'], $forumlist[$post['fid']]['allowimgcode'], $forumlist[$post['fid']]['allowhtml']);
$post['dateline'] = dgmdate($post['dateline']);
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']).")
100) {this.resized=true; this.width=100;}\">"
: "$attach[filename] (".sizecount($attach['filesize']).")";
$post['message'] .= "
$lang[attachment]: ".attachtype(fileext($attach['filename'])."\t").$attach['url'];
}
}
showtablerow("id=\"mod_$post[pid]_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array(
"",
"$lang[author]: $post[author] $lang[time]: $post[dateline] IP: $post[useip]
"
));
showtablerow("id=\"mod_$post[pid]_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', ''.$post['message'].'
');
showtablerow("id=\"mod_$post[pid]_row3\"", 'class="threadopt threadtitle" colspan="2"', "$lang[isanonymous]: ".($post['anonymous'] ? $lang['yes'] : $lang['no'])." $lang[ishtmlon]: ".($post['htmlon'] ? $lang['yes'] : $lang['no']));
}
return true;
}
?>