示例#1
0
function recycle($ids)
{
    global $db, $fid;
    $delids = array();
    foreach ($ids as $key => $value) {
        if (is_numeric($value)) {
            $delids[] = $value;
        }
    }
    if ($delids) {
        $delids = pwImplode($delids);
    } else {
        Showmsg('forumcp_recycle_nodata');
    }
    $query = $db->query("SELECT r.*,t.special,t.ifshield,t.ifupload,t.ptable,t.replies,t.fid AS ckfid FROM pw_recycle r LEFT JOIN pw_threads t ON r.tid=t.tid WHERE r.tid IN ({$delids}) AND r.pid='0' AND r.fid=" . pwEscape($fid));
    $taid_a = $ttable_a = $ptable_a = array();
    $delids = $pollids = $actids = $delaids = $rewids = $ids = array();
    while (@extract($db->fetch_array($query))) {
        $ids[] = $tid;
        ($ifshield != '2' || $replies == '0' || $ckfid == '0') && ($delids[] = $tid);
        $special == 1 && ($pollids[] = $tid);
        $special == 2 && ($actids[] = $tid);
        $special == 3 && ($rewids[] = $tid);
        if ($ifshield != '2' || $replies == '0' || $ckfid == '0') {
            $ptable_a[$ptable] = 1;
            $ttable_a[GetTtable($tid)][] = $tid;
        }
        if ($ifupload) {
            $taid_a[GetTtable($tid)][] = $tid;
            if ($ifshield != '2' || $replies == '0' || $ckfid == '0') {
                $pw_posts = GetPtable($ptable);
                $query2 = $db->query("SELECT aid FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . " AND aid!=''");
                while (@extract($db->fetch_array($query2))) {
                    if (!$aid) {
                        continue;
                    }
                    $attachs = unserialize(stripslashes($aid));
                    foreach ($attachs as $key => $value) {
                        is_numeric($key) && ($delaids[] = $key);
                        pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']);
                        $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']);
                    }
                }
            }
        }
    }
    foreach ($taid_a as $pw_tmsgs => $value) {
        $value = pwImplode($value);
        $query = $db->query("SELECT aid FROM {$pw_tmsgs} WHERE tid IN({$value}) AND aid!=''");
        while (@extract($db->fetch_array($query))) {
            if (!$aid) {
                continue;
            }
            $attachs = unserialize(stripslashes($aid));
            foreach ($attachs as $key => $value) {
                is_numeric($key) && ($delaids[] = $key);
                pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']);
                $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']);
            }
        }
    }
    if ($pollids) {
        $pollids = pwImplode($pollids);
        $db->update("DELETE FROM pw_polls WHERE tid IN({$pollids})");
    }
    if ($actids) {
        $actids = pwImplode($actids);
        $db->update("DELETE FROM pw_activity WHERE tid IN({$actids})");
        $db->update("DELETE FROM pw_actmember WHERE actid IN({$actids})");
    }
    if ($rewids) {
        $rewids = pwImplode($rewids);
        $db->update("DELETE FROM pw_reward WHERE tid IN({$rewids})");
    }
    if ($delaids) {
        $pw_attachs = L::loadDB('attachs');
        $pw_attachs->delete($delaids);
    }
    $delids = pwImplode($delids);
    if ($delids) {
        # $db->update("DELETE FROM pw_threads	WHERE tid IN($delids)");
        # ThreadManager
        $threadManager = L::loadClass("threadmanager");
        $threadManager->deleteByThreadIds($fid, $delids);
    }
    foreach ($ttable_a as $pw_tmsgs => $val) {
        $val = pwImplode($val);
        $db->update("DELETE FROM {$pw_tmsgs} WHERE tid IN({$val})");
    }
    foreach ($ptable_a as $key => $val) {
        $pw_posts = GetPtable($key);
        $db->update("DELETE FROM {$pw_posts} WHERE tid IN({$delids})");
    }
    delete_tag($delids);
    if ($ids) {
        $ids = pwImplode($ids);
        $db->update("DELETE FROM pw_recycle WHERE tid IN ({$ids})");
    }
    pwFtpClose($GLOBALS['ftp']);
}
示例#2
0
 $rt = $db->get_one("SELECT COUNT(*) AS count FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . " AND ifcheck='1'");
 $count = $rt['count'] + 1;
 if ($article == 0 && !$admincheck && $count > 1) {
     Showmsg('modify_replied');
 }
 $rs = $db->get_one("SELECT replies,topped,tpcstatus FROM pw_threads WHERE tid=" . pwEscape($tid));
 $thread_tpcstatus = $rs['tpcstatus'];
 if ($rs['replies'] != $rt['count']) {
     $db->update("UPDATE pw_threads SET replies=" . pwEscape($rt['count']) . "WHERE tid=" . pwEscape($tid));
 }
 require_once R_P . 'require/credit.php';
 $creditset = $credit->creditset($creditset, $db_creditset);
 if ($atcdb['aid']) {
     require_once R_P . 'require/updateforum.php';
     delete_att($atcdb['aid']);
     pwFtpClose($ftp);
 }
 if ($article == 0) {
     $deltype = 'deltpc';
     $deltitle = substrs($subject, 28);
     if ($count == 1) {
         $db->update("DELETE FROM {$pw_tmsgs} WHERE tid=" . pwEscape($tid));
         # $db->update("DELETE FROM pw_threads WHERE tid=".pwEscape($tid));
         # ThreadManager
         $threadManager = L::loadClass("threadmanager");
         $threadManager->deleteByThreadId($fid, $tid);
         P_unlink(R_P . "{$db_htmdir}/{$fid}/" . date('ym', $postdate) . "/{$tid}.html");
     } else {
         $rt = $db->get_one("SELECT * FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . "ORDER BY postdate LIMIT 1");
         if ($count == 2) {
             $lastpost = $rt['postdate'];
示例#3
0
function delforum($fid)
{
    global $db, $db_guestdir, $db_guestthread, $db_guestread;
    $foruminfo = $db->get_one("SELECT fid,fup,forumadmin FROM pw_forums WHERE fid=" . S::sqlEscape($fid));
    //$db->update("DELETE FROM pw_forums WHERE fid=".S::sqlEscape($fid));
    pwQuery::delete('pw_forums', 'fid=:fid', array($fid));
    //* $db->update("DELETE FROM pw_forumdata WHERE fid=".S::sqlEscape($fid));
    pwQuery::delete('pw_forumdata', 'fid=:fid', array($fid));
    $db->update("DELETE FROM pw_forumsextra WHERE fid=" . S::sqlEscape($fid));
    $db->update("DELETE FROM pw_permission WHERE fid>'0' AND fid=" . S::sqlEscape($fid));
    if ($foruminfo['forumadmin']) {
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $forumadmin = explode(",", $foruminfo['forumadmin']);
        foreach ($forumadmin as $key => $value) {
            if ($value) {
                $gid = $userService->getByUserName($value);
                if ($gid['groupid'] == 5 && !ifadmin($value)) {
                    $userService->update($gid['uid'], array('groupid' => -1));
                    admincheck($gid['uid'], $value, $gid['groupid'], '', 'delete');
                }
            }
        }
    }
    if ($db_guestthread || $db_guestread) {
        require_once R_P . 'require/guestfunc.php';
        $db_guestthread && deldir(D_P . "{$db_guestdir}/T_{$fid}");
    }
    //* P_unlink(D_P."data/forums/fid_{$fid}.php");
    pwCache::deleteData(D_P . "data/forums/fid_{$fid}.php");
    require_once R_P . 'require/functions.php';
    require_once R_P . 'require/updateforum.php';
    $pw_attachs = L::loadDB('attachs', 'forum');
    $ttable_a = $ptable_a = array();
    $query = $db->query("SELECT tid,replies,ptable FROM pw_threads WHERE fid=" . S::sqlEscape($fid));
    while ($tpc = $db->fetch_array($query)) {
        $tid = $tpc['tid'];
        $ttable_a[GetTtable($tid)][] = $tid;
        $ptable_a[$tpc['ptable']] = 1;
        $db_guestread && clearguestcache($tid, $tpc['replies']);
        if ($attachdb = $pw_attachs->getByTid($tid)) {
            delete_att($attachdb);
        }
    }
    pwFtpClose($GLOBALS['ftp']);
    foreach ($ttable_a as $pw_tmsgs => $val) {
        //* $val = S::sqlImplode($val,false);
        //* $db->update("DELETE FROM $pw_tmsgs WHERE tid IN($val)");
        pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($val));
    }
    # $db->update("DELETE FROM pw_threads WHERE fid=".S::sqlEscape($fid));
    # ThreadManager
    //* $threadManager = L::loadClass("threadmanager", 'forum');
    //* $threadManager->deleteByForumId($fid);
    $threadService = L::loadclass('threads', 'forum');
    $threadService->deleteByForumId($fid);
    //* Perf::gatherInfo('changeThreadWithForumIds', array('fid'=>$fid));
    foreach ($ptable_a as $key => $val) {
        $pw_posts = GetPtable($key);
        //$db->update("DELETE FROM $pw_posts WHERE fid=".S::sqlEscape($fid));
        pwQuery::delete($pw_posts, 'fid=:fid', array($fid));
    }
    updateforum($foruminfo['fup']);
}
示例#4
0
 function delReply($replydb, $recycle = false, $delCredit = true, $recount = false, $extra = array())
 {
     global $credit, $windid, $timestamp, $onlineip, $db_creditset;
     !$credit && (require_once R_P . 'require/credit.php');
     $tids = $pids = $_tids = $_pids = $ptable_a = $recycledb = $delfids = $deltids = $deluids = $attachdb = $deltpc = array();
     foreach ($replydb as $key => $reply) {
         $tids[$reply['tid']] = 1;
         if ($reply['pid'] == 'tpc') {
             $reply['pid'] = 0;
         }
         if ($recycle) {
             $recycledb[] = array('pid' => $reply['pid'], 'tid' => $reply['tid'], 'fid' => $reply['fid'], 'deltime' => $timestamp, 'admin' => $windid);
         }
         if ($reply['pid'] > 0) {
             /*回复*/
             $isInRecycle = $reply['fid'] == 0 && $reply['tid'] == 0;
             if ($reply['aid']) {
                 $_tids[$reply['tid']] = $reply['tid'];
                 $_pids[$reply['pid']] = $reply['pid'];
             }
             if (!$isInRecycle) {
                 $deluids[$reply['authorid']]++;
                 if ($reply['ifcheck']) {
                     $delfids[$reply['fid']]['replies']++;
                     $deltids[$reply['tid']]++;
                 }
             }
             $ptable_a[$reply['ptable']] = 1;
             $pids[] = $reply['pid'];
             $creditType = 'Deleterp';
             $logType = 'delrp_descrip';
         } else {
             /* 主题 */
             $isInRecycle = $reply['fid'] == 0 && $reply['ifcheck'] == 1;
             !$isInRecycle && $deluids[$reply['authorid']]++;
             $deltpc[] = $reply['tid'];
             $creditType = 'Delete';
             $logType = 'del_descrip';
         }
         $msg_delrvrc = $msg_delmoney = 0;
         if ($delCredit && !$isInRecycle) {
             $creditset = $this->getcreditset($reply['fid']);
             $credit->addLog("topic_{$creditType}", $creditset[$creditType], array('uid' => $reply['authorid'], 'username' => $reply['author'], 'ip' => $onlineip, 'fname' => strip_tags($this->getForumInfo($reply['fid'], 'name')), 'operator' => $windid));
             $credit->sets($reply['authorid'], $creditset[$creditType], false);
             $msg_delrvrc = abs($creditset[$creditType]['rvrc']);
             $msg_delmoney = abs($creditset[$creditType]['money']);
         }
         /*操作日志 */
         $logdb[] = array('type' => 'delete', 'username1' => $reply['author'], 'username2' => $windid, 'field1' => $reply['fid'], 'field2' => '', 'field3' => '', 'descrip' => $logType, 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $reply['tid'], 'subject' => substrs($reply['subject'] ? $reply['subject'] : $reply['content'], 28), 'affect' => "{$GLOBALS[db_rvrcname]}:-{$msg_delrvrc},{$GLOBALS[db_moneyname]}:-{$msg_delmoney}", 'reason' => $extra['reason']);
     }
     if (!$tids) {
         return true;
     }
     require_once R_P . 'require/updateforum.php';
     $delpids = S::sqlImplode($pids);
     if ($recycle) {
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             //$this->db->update("UPDATE $pw_posts SET tid='0',fid='0' WHERE pid IN($delpids)");
             pwQuery::update($pw_posts, 'pid IN(:pid)', array($pids), array('tid' => '0', 'fid' => '0'));
         }
         if ($recycledb) {
             $this->db->update("REPLACE INTO pw_recycle (pid,tid,fid,deltime,admin) VALUES " . S::sqlMulti($recycledb));
         }
     } else {
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             //$this->db->update("DELETE FROM $pw_posts WHERE pid IN($delpids)");
             pwQuery::delete($pw_posts, 'pid IN(:pid)', array($pids));
         }
     }
     if ($delpids) {
         $this->resetReplayToppedFloor($replydb, '', '', $extra['tpcstatus']);
     }
     /*前台删主题,默认将其设为屏蔽*/
     if ($deltpc) {
         //$this->db->update("UPDATE pw_threads SET ifshield='2' WHERE tid IN (" . S::sqlImplode($deltpc) . ')');
         pwQuery::update('pw_threads', 'tid IN (:tid)', array($deltpc), array('ifshield' => 2));
         $pw_attachs = L::loadDB('attachs', 'forum');
         $attachdb += $pw_attachs->getByTid($deltpc, 0);
         !$recycle && delete_tag(S::sqlImplode($deltpc));
         /* 删除微博 */
         $weiboService = L::loadClass('weibo', 'sns');
         /* @var $weiboService PW_Weibo */
         $weibos = $weiboService->getWeibosByObjectIdsAndType($deltpc, 'article');
         if ($weibos) {
             $mids = array();
             foreach ($weibos as $key => $weibo) {
                 $mids[] = $weibo['mid'];
             }
             $weiboService->deleteWeibos($mids);
         }
     }
     if ($_tids) {
         $pw_attachs = L::loadDB('attachs', 'forum');
         $attachdb += $pw_attachs->getByTid($_tids, $_pids);
     }
     if ($attachdb) {
         delete_att($attachdb, !$recycle);
         require_once R_P . 'require/functions.php';
         pwFtpClose($GLOBALS['ftp']);
     }
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     foreach ($deluids as $uid => $value) {
         $userService->updateByIncrement($uid, array(), array('postnum' => -$value));
     }
     if ($deltopic = $this->delReplyTopic(array_keys($tids), $deltpc, $recount, $recycle)) {
         foreach ($deltopic as $fid => $value) {
             $delfids[$fid]['topic'] = $value;
         }
     }
     if ($delfids) {
         //* $threadlist = L::loadClass("threadlist", 'forum');
         foreach ($delfids as $fid => $value) {
             //* $threadlist->refreshThreadIdsByForumId($fid);
             Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
             updateForumCount($fid, -$value['topic'], -$value['replies']);
         }
     }
     if ($deltids && !$recount) {
         foreach ($deltids as $tid => $value) {
             //$this->db->update("UPDATE pw_threads SET replies=replies-" . S::sqlEscape($value) . " WHERE tid=" . S::sqlEscape($tid));
             $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET replies=replies-:replies WHERE tid=:tid", array('pw_threads', $value, $tid)));
         }
     }
     /*写操作日志 */
     require_once R_P . 'require/writelog.php';
     foreach ($logdb as $log) {
         writelog($log);
     }
     /*扣除积分*/
     $credit->runsql();
     return !empty($deltopic);
 }
示例#5
0
 function insertData($tid, $fid)
 {
     /*操作数据库*/
     global $timestamp;
     $this->data['tid'] = $tid;
     $this->data['fid'] = $fid;
     $pcdb = unserialize($this->data['postcate']);
     unset($this->data['postcate']);
     foreach ($pcdb as $key => $value) {
         $this->data[$key] = $value;
     }
     $pcvaluetable = GetPcatetable($this->pcid);
     $this->db->pw_update("SELECT tid FROM {$pcvaluetable} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$pcvaluetable} SET " . S::sqlSingle($this->data) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$pcvaluetable} SET " . S::sqlSingle($this->data));
     /*附件上传-淡定*/
     require_once R_P . 'require/functions.php';
     L::loadClass('pcupload', 'upload', false);
     $img = new PcUpload($tid, $this->pcid);
     PwUpload::upload($img);
     pwFtpClose($GLOBALS['ftp']);
 }
示例#6
0
 function insertData($tid, $fid)
 {
     /*操作数据库*/
     $this->data['tid'] = $tid;
     $this->data['fid'] = $fid;
     $topicdb = unserialize($this->data['topic']);
     unset($this->data['topic']);
     foreach ($topicdb as $key => $value) {
         $this->data['field' . $key] = $value;
     }
     $tablename = GetTopcitable($this->modelid);
     $this->db->pw_update("SELECT tid FROM {$tablename} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$tablename} SET " . S::sqlSingle($this->data) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$tablename} SET " . S::sqlSingle($this->data));
     /*附件上传*/
     require_once R_P . 'require/functions.php';
     L::loadClass('pcupload', 'upload', false);
     $img = new PcUpload($tid, $this->modelid);
     PwUpload::upload($img);
     pwFtpClose($GLOBALS['ftp']);
 }
示例#7
0
 function delfile($url, $ifthumb = 0)
 {
     global $db_ifftp, $ftp;
     pwDelThreadAtt($url, $db_ifftp, $ifthumb);
     pwFtpClose($ftp);
 }
示例#8
0
         }
         $anime = new GIFEncoder($frames, $gifDecoder->GIFGetDelays(), $gifDecoder->GIFGetLoop(), $gifDecoder->GIFGetDisposal(), $gifDecoder->GIFGetTransparentR(), $gifDecoder->GIFGetTransparentG(), $gifDecoder->GIFGetTransparentB(), 'bin');
         $newGifData = $anime->getAnimation();
         PwUpload::createFolder(dirname($smallFile));
         pwCache::writeover($smallFile, $newGifData);
         $s_ifthumb = 1;
     }
 } elseif (MakeThumb($middleFile, $smallFile, 48, 48)) {
     $s_ifthumb = 1;
 }
 if ($db_ifftp) {
     //PwUpload::movetoftp($normalFile, $normalDir . "{$winduid}.$ext");
     PwUpload::movetoftp($middleFile, $middleDir . $filename);
     $s_ifthumb && PwUpload::movetoftp($smallFile, $smallDir . $filename);
 }
 pwFtpClose($GLOBALS['ftp']);
 $user_a = explode('|', $winddb['icon']);
 $user_a[2] = $img_w;
 $user_a[3] = $img_h;
 $usericon = setIcon("{$udir}/{$winduid}.{$ext}", 3, $user_a);
 $userService = L::loadClass('UserService', 'user');
 /* @var $userService PW_UserService */
 $userService->update($winduid, array('icon' => $usericon));
 //* $db->update("DELETE FROM pw_datastore WHERE skey=". S::sqlEscape("UID_".$winduid). " LIMIT 1");
 //job sign
 initJob($winduid, "doUpdateAvatar");
 if ($from != 'reg') {
     refreshto('profile.php?action=modify&info_type=face', 'upload_icon_success');
 }
 $jobService = L::loadclass('job', 'job');
 $jobs = $jobService->getJobByJobName('doUpdateAvatar');
示例#9
0
 /**
  * 删除相片
  *@param $pid int 相片ID
  *@return Array 返回相片相关信息
  */
 function delPhoto($pid)
 {
     if (intval($pid) <= 0) {
         return array();
     }
     $albumDao = $this->_getDaoFactory('CnAlbum');
     $photoDao = $this->_getDaoFactory('CnPhoto');
     $photo = $photoDao->getPhotoUnionInfoByPid($pid);
     if (empty($photo) || $photo['ownerid'] != $GLOBALS['winduid'] && !$this->isDelRight()) {
         return array();
     }
     $photoDao->delete($pid);
     $thumbPath = $this->getPhotoThumb($photo['path'], $photo['ifthumb']);
     $photoPath = $this->getPhotoThumb($photo['path'], 0);
     if (empty($photo['lastphoto']) || $thumbPath == $photo['lastphoto'] || $photoPath == $photo['lastphoto']) {
         $result = $photoDao->getPhotosInfoByAid($photo['aid'], 1, 1);
         $data['lastphoto'] = $this->getPhotoThumb($result[0]['path'], $result[0]['ifthumb']);
     }
     $data['photonum'] = intval($photo['photonum']) - 1;
     $albumDao->update($data, $photo['aid']);
     pwDelatt($photo['path'], $this->_dbifftp);
     //	if($photo['ifthumb']){
     pwDelatt($thumbPath, $this->_dbifftp);
     //		pwDelatt($path, $this->_dbifftp);
     //	}
     pwFtpClose($ftp);
     $photo['uid'] = $this->_uid;
     return $photo;
 }
示例#10
0
 function delReply($replydb, $recount = true, $recycle = false)
 {
     $tids = $pids = $_tids = $_pids = $ptable_a = $recycledb = $delfids = $deltids = $deluids = $attachdb = $deltpc = array();
     foreach ($replydb as $key => $reply) {
         $tids[$reply['tid']] = 1;
         if ($reply['pid'] == 'tpc') {
             $reply['pid'] = 0;
         }
         if ($recycle) {
             $recycledb[] = array('pid' => $reply['pid'], 'tid' => $reply['tid'], 'fid' => $reply['fid'], 'deltime' => $GLOBALS['timestamp'], 'admin' => $GLOBALS['windid']);
         }
         if ($reply['pid'] > 0) {
             if ($reply['aid']) {
                 $_tids[$reply['tid']] = $reply['tid'];
                 $_pids[$reply['pid']] = $reply['pid'];
             }
             if ($reply['fid'] > 0) {
                 $deluids[$reply['authorid']]++;
                 if ($reply['ifcheck']) {
                     $delfids[$reply['fid']]['replies']++;
                     $deltids[$reply['tid']]++;
                 }
             }
             $ptable_a[$reply['ptable']] = 1;
             $pids[] = $reply['pid'];
         } else {
             $reply['fid'] > 0 && $reply['ifcheck'] && $deluids[$reply['authorid']]++;
             $deltpc[] = $reply['tid'];
         }
     }
     if (!$tids) {
         return true;
     }
     require_once R_P . 'require/updateforum.php';
     $delpids = pwImplode($pids);
     if ($recycle) {
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             $this->db->update("UPDATE {$pw_posts} SET tid='0',fid='0' WHERE pid IN({$delpids})");
         }
         if ($recycledb) {
             $this->db->update("REPLACE INTO pw_recycle (pid,tid,fid,deltime,admin) VALUES " . pwSqlMulti($recycledb));
         }
     } else {
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             $this->db->update("DELETE FROM {$pw_posts} WHERE pid IN({$delpids})");
         }
     }
     if ($delpids) {
         $this->resetReplayToppedFloor($replydb);
     }
     if ($deltpc) {
         $this->db->update("UPDATE pw_threads SET ifshield='2' WHERE tid IN (" . pwImplode($deltpc) . ')');
         $pw_attachs = L::loadDB('attachs');
         $attachdb += $pw_attachs->getByTid($deltpc, 0);
         !$recycle && delete_tag(pwImplode($deltpc));
     }
     if ($_tids) {
         $pw_attachs = L::loadDB('attachs');
         $attachdb += $pw_attachs->getByTid($_tids, $_pids);
     }
     if ($attachdb) {
         delete_att($attachdb, !$recycle);
         pwFtpClose($GLOBALS['ftp']);
     }
     foreach ($deluids as $uid => $value) {
         $this->db->update("UPDATE pw_memberdata SET postnum=postnum-" . pwEscape($value) . " WHERE uid=" . pwEscape($uid));
     }
     if ($deltopic = $this->delReplyTopic(array_keys($tids), $deltpc, $recount, $recycle)) {
         foreach ($deltopic as $fid => $value) {
             $delfids[$fid]['topic'] = $value;
         }
     }
     if ($delfids) {
         $threadlist = L::loadClass("threadlist");
         foreach ($delfids as $fid => $value) {
             $threadlist->refreshThreadIdsByForumId($fid);
             updateForumCount($fid, -$value['topic'], -$value['replies']);
         }
     }
     if ($deltids && !$recount) {
         foreach ($deltids as $tid => $value) {
             $this->db->update("UPDATE pw_threads SET replies=replies-" . pwEscape($value) . " WHERE tid=" . pwEscape($tid));
         }
     }
     return !empty($deltopic);
 }
示例#11
0
 function uploadPicture($invokePieceId)
 {
     L::loadClass('pushupload', 'upload', false);
     $img = new PushUpload($invokePieceId);
     PwUpload::upload($img);
     pwFtpClose($ftp);
     return $img->getImagePath();
 }
示例#12
0
 /**
  * 操作数据库
  * @param int $tid 帖子id
  * @param int $fid 版块id
  */
 function insertData($tid, $fid)
 {
     /*操作数据库*/
     global $action, $atc_title;
     $this->data['default'] = $this->data['act']['0'];
     $this->data['default']['tid'] = $tid;
     $this->data['default']['fid'] = $fid;
     $this->data['default']['actmid'] = $this->actmid;
     $this->data['user'] = array();
     !S::isArray($this->data['act']['1']) && ($this->data['act']['1'] = array());
     foreach ($this->data['act']['1'] as $key => $value) {
         if ($value) {
             $this->data['user'][$key] = $value;
         }
     }
     $this->data['user']['tid'] = $tid;
     $this->data['user']['fid'] = $fid;
     unset($this->data['act']);
     $defaultValueTableName = getActivityValueTableNameByActmid();
     $userDefinedValueTableName = getActivityValueTableNameByActmid($this->actmid, 1, 1);
     $this->db->pw_update("SELECT tid FROM {$defaultValueTableName} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$defaultValueTableName} SET " . S::sqlSingle($this->data['default']) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$defaultValueTableName} SET " . S::sqlSingle($this->data['default']));
     $this->db->pw_update("SELECT tid FROM {$userDefinedValueTableName} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$userDefinedValueTableName} SET " . S::sqlSingle($this->data['user']) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$userDefinedValueTableName} SET " . S::sqlSingle($this->data['user']));
     $subject = $this->db->get_value('SELECT subject FROM pw_threads WHERE tid=' . S::sqlEscape($tid));
     if ($subject) {
         $this->db->update('UPDATE pw_activitypaylog SET subject=' . S::sqlEscape($subject) . ' WHERE tid=' . S::sqlEscape($tid));
     }
     /*选择支付宝+没有绑定支付宝+没有通过支付宝实名认证 or 创建AA活动号*/
     if ($this->data['default']['paymethod'] == 1) {
         $tradeinfo = $this->db->get_one("SELECT tradeinfo FROM pw_memberinfo WHERE uid=" . S::sqlEscape($this->winduid));
         $tradeinfo = unserialize($tradeinfo['tradeinfo']);
         $alipay = $tradeinfo['alipay'];
         $isBinded = $tradeinfo['isbinded'];
         $isCertified = $tradeinfo['iscertified'];
         if (!$alipay || $isBinded != 'T' || $isCertified != 'T') {
             //选择支付宝+没有绑定支付宝+没有通过支付宝实名认证
             $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=0 WHERE tid=" . S::sqlEscape($tid));
         } elseif ($alipay && $isBinded == 'T' && $isCertified == 'T') {
             //绑定支付宝+通过支付宝实名认证
             $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=1 WHERE tid=" . S::sqlEscape($tid));
             require_once R_P . 'lib/activity/alipay_push.php';
             $alipayPush = new AlipayPush();
             if ($action == 'new') {
                 $alipayPush->create_aa_payment($tid, $this->winduid, $this->actmid, $atc_title);
                 //创建AA活动号
             } elseif ($action == 'modify') {
                 $alipayPush->modify_aa_payment($tid, $this->actmid, $atc_title);
                 //修改AA活动号
             }
         }
     }
     /*选择支付宝+没有绑定支付宝+没有通过支付宝实名认证 or 创建AA活动号*/
     /*附件上传*/
     L::loadClass('activityupload', 'upload', false);
     $img = new ActivityUpload($tid, $this->actmid);
     PwUpload::upload($img);
     require_once R_P . 'require/functions.php';
     pwFtpClose($GLOBALS['ftp']);
 }
示例#13
0
 function updateAtt()
 {
     if ($this->delattach) {
         require_once R_P . 'require/updateforum.php';
         delete_att($this->delattach);
         pwFtpClose($GLOBALS['ftp']);
     }
     if ($this->alterattach) {
         $pw_attachs = L::loadDB('attachs');
         foreach ($this->alterattach as $aid => $v) {
             $pw_attachs->updateById($aid, array('needrvrc' => $v['needrvrc'], 'descrip' => $v['desc'], 'special' => $v['special'], 'ctype' => $v['ctype']));
         }
     }
     if (is_object($this->att) && ($aids = $this->att->getAids())) {
         $pw_attachs = L::loadDB('attachs');
         $pw_attachs->updateById($aids, array('tid' => $this->tid, 'pid' => $this->pid));
     }
 }