Beispiel #1
0
require_once R_P . 'require/forum.php';
require_once R_P . 'require/updateforum.php';
wind_forumcheck($foruminfo);
$isGM = S::inArray($windid, $manager);
//获取管理权限
$isBM = admincheck($foruminfo['forumadmin'], $foruminfo['fupadmin'], $windid);
if ($isGM || pwRights($isBM, 'delattach')) {
    $admincheck = 1;
} else {
    $admincheck = 0;
}
if ($groupid != 'guest' && ($admincheck || $attach['uid'] == $winduid)) {
    pwDelatt($attach['attachurl'], $db_ifftp);
    pwFtpClose($ftp);
    $pw_attachs->delete($aid);
    $ifupload = getattachtype($tid);
    $ifaid = $ifupload === false ? 0 : 1;
    if ($pid) {
        $pw_posts = GetPtable('N', $tid);
        //$db->update("UPDATE $pw_posts SET aid=" . S::sqlEscape($ifaid, false) . "WHERE tid=" . S::sqlEscape($tid, false) . "AND pid=" . S::sqlEscape($pid, false));
        pwQuery::update($pw_posts, 'tid=:tid AND pid=:pid', array($tid, $pid), array('aid' => $ifaid));
    } else {
        $pw_tmsgs = GetTtable($tid);
        //* $db->update("UPDATE $pw_tmsgs SET aid=" . S::sqlEscape($ifaid, false) . " WHERE tid=" . S::sqlEscape($tid, false));
        pwQuery::update($pw_tmsgs, 'tid=:tid', array($tid), array('aid' => $ifaid));
    }
    $ifupload = (int) $ifupload;
    //$db->update('UPDATE pw_threads SET ifupload=' . S::sqlEscape($ifupload) . ' WHERE tid=' . S::sqlEscape($tid));
    pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('ifupload' => $ifupload));
    if ($foruminfo['allowhtm'] && $page == 1) {
        $StaticPage = L::loadClass('StaticPage');
Beispiel #2
0
 function _del()
 {
     $this->delfile($this->attach['attachurl'], $this->attach['ifthumb']);
     $this->attachsDB->delete($this->aid);
     require_once R_P . 'require/updateforum.php';
     $ifupload = getattachtype($this->tid);
     $ifaid = $ifupload === false ? 0 : 1;
     $updateArr = array('aid' => $ifaid);
     if ($this->attach['pid']) {
         $pw_posts = GetPtable('N', $this->tid);
         $content = $this->_db->get_value("SELECT content FROM {$pw_posts} WHERE tid=" . S::sqlEscape($this->tid, false) . "AND pid=" . S::sqlEscape($this->attach['pid'], false));
         if (($content = $this->parseAttContent($content)) !== false) {
             $updateArr['content'] = $content;
             $updateThreadCache = TRUE;
         }
         //$this->_db->update("UPDATE $pw_posts SET " . S::sqlSingle($updateArr) . " WHERE tid=" . S::sqlEscape($this->tid, false) . "AND pid=" . S::sqlEscape($this->attach['pid'], false));
         pwQuery::update($pw_posts, 'tid=:tid AND pid=:pid', array($this->tid, $this->attach['pid']), $updateArr);
     } else {
         $pw_tmsgs = GetTtable($this->tid);
         $content = $this->_db->get_value("SELECT content FROM {$pw_tmsgs} WHERE tid=" . S::sqlEscape($this->tid, false));
         if (($content = $this->parseAttContent($content)) !== false) {
             $updateArr['content'] = $content;
             $updateThreadCache = TRUE;
         }
         //* $this->_db->update("UPDATE $pw_tmsgs SET " . S::sqlSingle($updateArr) . " WHERE tid=" . S::sqlEscape($this->tid, false));
         pwQuery::update($pw_tmsgs, 'tid=:tid', array($this->tid), $updateArr);
     }
     if ($this->attach['type'] == 'img') {
         $tucoolService = L::loadClass('tucool', 'forum');
         $tucoolService->updateTucoolImageNum($this->tid);
         $tucoolInfo = $tucoolService->get($this->tid);
         if ($this->attach['attachurl'] == $tucoolInfo['cover']) {
             $attachService = L::loadClass('attachs', 'forum');
             /* @var $attachService PW_Attachs */
             $coverInfo = $attachService->getLatestAttachInfoByTidType($this->tid);
             $tucoolService->setCover($this->tid, $coverInfo['attachurl'], $coverInfo['ifthumb']);
         }
     }
     if ($updateThreadCache) {
         //* $threadService = L::loadClass("threads", 'forum'); /* @var $threadService PW_Threads */
         //* $threadService->clearTmsgsByThreadId($this->tid);
         Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $this->tid));
     }
     $ifupload = (int) $ifupload;
     //$this->_db->update('UPDATE pw_threads SET ifupload=' . S::sqlEscape($ifupload) . ' WHERE tid=' . S::sqlEscape($this->tid));
     pwQuery::update('pw_threads', "tid=:tid", array($this->tid), array("ifupload" => $ifupload));
     if ($this->foruminfo['allowhtm'] && $GLOBALS['page'] == 1) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($this->tid);
     }
 }