$posttableid = intval($_GET['posttableid']);
cpheader();
if (submitcheck('rbsubmit')) {
    $moderate = $_GET['moderate'];
    $moderation = array('delete' => array(), 'undelete' => array(), 'ignore' => array());
    if (is_array($moderate)) {
        foreach ($moderate as $pid => $action) {
            $moderation[$action][] = intval($pid);
        }
    }
    $postsdel = $postsundel = 0;
    if ($moderation['delete']) {
        $postsdel = recyclebinpostdelete($moderation['delete'], $posttableid);
    }
    if ($moderation['undelete']) {
        $postsundel = recyclebinpostundelete($moderation['undelete'], $posttableid);
    }
    if ($operation == 'search') {
        $cpmsg = cplang('recyclebinpost_succeed', array('postsdel' => $postsdel, 'postsundel' => $postsundel));
        ?>
<script type="text/JavaScript">alert('<?php 
        echo $cpmsg;
        ?>
');parent.$('rbsearchform').searchsubmit.click();</script>
<?php 
    } else {
        cpmsg('recyclebinpost_succeed', 'action=recyclebinpost&operation=' . $operation, 'succeed', array('postsdel' => $postsdel, 'postsundel' => $postsundel));
    }
}
$lpp = empty($_GET['lpp']) ? 20 : $_GET['lpp'];
$start = ($page - 1) * $lpp;
 if (in_array($_G['adminid'], array(1, 2, 3)) && ($op == 'delete' || $op == 'restore') && submitcheck('dosubmit')) {
     if ($ids = dimplode($_GET['moderate'])) {
         $pidarray = array();
         foreach (C::t('forum_post')->fetch_all($posttableid, $_GET['moderate'], false) as $post) {
             if ($post['fid'] != $_G['fid'] || $post['invisible'] != '-5') {
                 continue;
             }
             $pidarray[] = $post['pid'];
         }
         if ($pidarray) {
             require_once libfile('function/misc');
             if ($op == 'delete' && $_G['group']['allowclearrecycle']) {
                 recyclebinpostdelete($pidarray, $posttableid);
             }
             if ($op == 'restore') {
                 recyclebinpostundelete($pidarray, $posttableid);
             }
             if ($_GET['oldop'] == 'search') {
                 $srchupdate = true;
             }
         }
     }
     $op = dhtmlspecialchars($_GET['oldop']);
     showmessage('modcp_recyclebinpost_' . $op . '_succeed', '', array(), array('break' => 1));
 }
 if ($op == 'search' && submitcheck('searchsubmit')) {
     if ($starttime || $endtime || trim($keywords) || trim($users)) {
         $pids = array();
         foreach (C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, -5, null, null, $users ? explode(',', str_replace(' ', '', trim($users))) : null, strtotime($starttime), strtotime($endtime), null, null, 0, 1000) as $value) {
             $postlist[] = $value;
             $pids[] = $value['pid'];