Esempio n. 1
0
 function deletepost($param)
 {
     global $_G;
     if (!$this->_secStatus) {
         return false;
     }
     $step = $param['step'];
     $param = $param['param'];
     $ids = $param[0];
     $idType = $param[1];
     if ($_G['gp_formhash'] && $step == 'check' && $idType == 'pid') {
         require_once libfile('function/sec');
         updatePostOperate($ids, 2);
         if ($_G['gp_module'] == 'security' && $_G['gp_method'] == 'setEvilPost') {
             return true;
         }
         logDeletePost($ids, $_G['gp_reason']);
     }
     return true;
 }
Esempio n. 2
0
function recyclebinpostundelete($undeletepids, $posttableid = false)
{
    global $_G;
    $postsundel = 0;
    if (empty($undeletepids)) {
        return $postsundel;
    }
    require_once libfile('function/sec');
    updatePostOperate($undeletepids, 1);
    foreach ($undeletepids as $pid) {
        my_post_log('restore', array('pid' => $pid));
    }
    $undeletepids = dimplode($undeletepids);
    loadcache('posttableids');
    $posttableids = !empty($_G['cache']['posttableids']) ? $posttableid !== false && in_array($posttableid, $_G['cache']['posttableids']) ? array($posttableid) : $_G['cache']['posttableids'] : array('0');
    $postarray = $ruidarray = $fidarray = $tidarray = array();
    foreach ($posttableids as $ptid) {
        $query = DB::query('SELECT fid, tid, first, authorid FROM ' . DB::table(getposttable($ptid)) . " WHERE pid IN ({$undeletepids})");
        while ($post = DB::fetch($query)) {
            $postarray[] = $post;
        }
    }
    if (empty($postarray)) {
        return $postsundel;
    }
    foreach ($postarray as $key => $post) {
        if (!$post['first']) {
            $ruidarray[$post['fid']][] = $post['authorid'];
        }
        $fidarray[$post['fid']] = $post['fid'];
        $tidarray[$post['tid']] = $post['tid'];
    }
    $postsundel = updatepost(array('invisible' => '0'), "pid IN ({$undeletepids})", true, $posttableid);
    include_once libfile('function/post');
    if ($ruidarray) {
        foreach ($ruidarray as $fid => $ruids) {
            updatepostcredits('+', $ruids, 'reply', $fid);
        }
    }
    foreach ($tidarray as $tid) {
        updatethreadcount($tid, 1);
    }
    foreach ($fidarray as $fid) {
        updateforumcount($fid);
    }
    return $postsundel;
}