/** * 根据uid批量删除记录 * @param array $uids * @return bool */ function deletePayLogsByUids($uids) { if (!S::isArray($uids)) { return false; } return pwQuery::delete($this->_tableName, "uid IN (:uid)", array($uids)); }
/** * 批量删除标签 * * @param array $tagids * @return boolean */ function deleteTagsByTagIds($tagids) { if (!S::isArray($tagids)) { return false; } return pwQuery::delete($this->_tableName, "tagid in(:tagid)", array($tagids)); }
/** * 批量删除 * * @param array $areaids 地区IDs * @return boolean */ function deleteByAreaIds($areaids) { if (!S::isArray($areaids)) { return false; } return (bool) pwQuery::delete($this->_tableName, "{$this->_primaryKey} in(:{$this->_primaryKey})", array($areaids)); }
function deleteByIdentify($identify) { if (!$this->_check() || !$identify) { return false; } return pwQuery::delete($this->_tableName, "identify=:identify", array($identify)); }
/** * 批量删除用户信息 * @param array $uids * @return bool */ function deleteKmdUserByUids($uids) { if (!S::isArray($uids)) { return false; } return pwQuery::delete($this->_tableName, "{$this->_primaryKey} IN (:{$this->_primaryKey})", array($uids)); }
/** * 根据套餐id批量删除信息 * @param array $sids * @return bool */ function deleteSpreadBySids($sids) { if (!S::isArray($sids)) { return false; } return pwQuery::delete($this->_tableName, "{$this->_primaryKey} IN (:{$this->_primaryKey})", array($sids)); }
/** * 根据链接ID删除数据 * * @param int $sid 链接ID * @return int 删除行数 */ function deleteBySid($sid) { $sid = intval($sid); if ($sid < 1) { return null; } pwQuery::delete($this->_tableName, "sid=:sid", array($sid)); return $this->_db->affected_rows(); }
/** * * 删除用户关注的话题 * @param int $topicId * @param int $userid * @return boolean */ function deleteAttentionedTopic($topicId, $userid) { $userid = intval($userid); $topicId = intval($topicId); if (!$userid || !$topicId) { return false; } pwQuery::delete($this->_tableName, "userid=:userid and topicid=:topicid", array($userid, $topicId)); return true; }
$db->update("UPDATE pw_cnclass SET cnsum='0'"); $query = $db->query("SELECT classid,COUNT(*) AS sum FROM pw_colonys WHERE classid>0 GROUP BY classid"); while ($rt = $db->fetch_array($query)) { $db->update("UPDATE pw_cnclass SET cnsum=" . S::sqlEscape($rt['sum']) . ' WHERE fid=' . S::sqlEscape($rt['classid'])); } $j_url = "{$basename}&action=cache"; adminmsg('operate_success', $j_url); } elseif ($_POST['step'] == 'delcolony') { $query = $db->query("SELECT id,cnimg FROM pw_colonys WHERE classid<1"); while ($rt = $db->fetch_array($query, MYSQL_NUM)) { Delcnimg($rt[1]); $db->update("UPDATE pw_cmembers a LEFT JOIN pw_ouserdata o ON a.uid=o.uid SET o.groupnum=o.groupnum-1 WHERE a.colonyid=" . S::sqlEscape($rt[0], false) . ' AND o.groupnum>0'); $db->update("DELETE FROM pw_argument WHERE cyid=" . S::sqlEscape($rt[0], false)); $db->update("DELETE FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($rt[0], false)); //* $db->update("DELETE FROM pw_colonys WHERE id=" . S::sqlEscape($rt[0],false)); pwQuery::delete('pw_colonys', 'id=:id', array($rt[0])); } pwFtpClose($ftp); adminmsg('operate_success', "{$basename}&action=cache"); } } elseif ($action == 'level') { require_once A_P . 'action/admin_level.php'; } elseif ($action == 'style') { S::gp(array('job')); require_once R_P . 'apps/groups/lib/groupstyle.class.php'; $groupStyle = new GroupStyle(); $allStyles = $allStylesOfOpen = array(); $allStyles = $groupStyle->getAllStyles(); $openStyles = $groupStyle->getOpenStyles(); $firstGradeStyleIds = $groupStyle->getFirstGradeStyleIds(); $secondGradeStyles = $groupStyle->getGradeStylesByUpid($firstGradeStyleIds);
'post' => $post, 'reply' => $reply )) ); **/ $db->pw_update("SELECT * FROM pw_singleright WHERE uid=" . S::sqlEscape($uid), pwQuery::updateClause('pw_singleright', 'uid =:uid', array($uid), array('visit' => $visit, 'post' => $post, 'reply' => $reply)), pwQuery::insertClause('pw_singleright', array('uid' => $uid, 'visit' => $visit, 'post' => $post, 'reply' => $reply))); adminmsg('operate_success'); } } elseif ($_POST['job'] == 'del') { S::gp(array('selid'), 'P'); $tmpSelid = $selid; if (!($selid = checkselid($selid))) { adminmsg('operate_error'); } //* $db->update("DELETE FROM pw_singleright WHERE uid IN($selid)"); pwQuery::delete('pw_singleright', 'uid IN (:uid)', array($tmpSelid)); adminmsg('operate_success'); } } elseif ($action == 'user') { //* include_once pwCache::getPath(D_P.'data/bbscache/level.php'); //* include_once pwCache::getPath(D_P.'data/bbscache/forumcache.php'); pwCache::getData(D_P . 'data/bbscache/level.php'); pwCache::getData(D_P . 'data/bbscache/forumcache.php'); S::gp(array('page', 'uid', 'fid', 'gid'), GP, 2); $username = S::escapeChar(S::getGP('username')); $groupcache = $pageurl = ''; $u_d = array(); list($hidefid, $hideforum) = GetHiddenForum(); $forumcache = "<option></option>" . $forumcache . $hideforum; $groupcache = "<option></option>"; $query = $db->query("SELECT gid,grouptitle FROM pw_usergroups WHERE gptype IN('system','special')");
function delDiaryByUids($uids) { if (!$uids) { return false; } /** $uids = is_array($uids) ? $this->_getImplodeString($uids) : $this->_addSlashes($uids); return $this->_db->update("DELETE FROM ".$this->_tableName. " WHERE uid IN( " .$uids. " )"); **/ $uids = is_array($uids) ? $uids : array($uids); return pwQuery::delete('pw_diary', 'uid IN(:uid)', array($uids)); }
function recountTopic($read, $ifdel, $recycle) { global $db_anonymousname, $timestamp; $ret = 0; $tid = $read['tid']; $pw_posts = GetPtable($read['ptable']); $replies = $this->db->get_value("SELECT COUNT(*) AS replies FROM {$pw_posts} WHERE tid='{$tid}' AND ifcheck='1'"); if (!$replies) { $read['anonymous'] && ($read['author'] = $db_anonymousname); if ($ifdel) { if ($recycle) { //$this->db->update("UPDATE pw_threads SET fid='0',ifshield='0' WHERE tid='$tid'"); pwQuery::update('pw_threads', 'tid = :tid', array($tid), array('fid' => 0, 'ifshield' => 0)); } else { //* $threadManager = L::loadClass("threadmanager", 'forum'); //* $threadManager->deleteByThreadId($read['fid'], $tid); $threadService = L::loadclass('threads', 'forum'); $threadService->deleteByThreadId($tid); Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $read['fid'])); $pw_tmsgs = GetTtable($tid); //* $this->db->update("DELETE FROM $pw_tmsgs WHERE tid='$tid'"); pwQuery::delete($pw_tmsgs, 'tid=:tid', array($tid)); } $ret = 1; } else { $pwSQL = array('replies' => 0, 'lastposter' => $read['author']); !($read['lastpost'] > $timestamp || $read['locked'] > 2) && ($pwSQL['lastpost'] = $read['postdate']); //$this->db->update("UPDATE pw_threads SET " . S::sqlSingle($pwSQL) . " WHERE tid=" . S::sqlEscape($tid)); pwQuery::update('pw_threads', 'tid = :tid', array($tid), $pwSQL); } } else { $pt = $this->db->get_one("SELECT postdate,author,anonymous FROM {$pw_posts} WHERE tid='{$tid}' ORDER BY postdate DESC LIMIT 1"); $pt['anonymous'] && ($pt['author'] = $db_anonymousname); $pwSQL = array('replies' => $replies, 'lastposter' => $pt['author']); !($read['lastpost'] > $timestamp || $read['locked'] > 2) && ($pwSQL['lastpost'] = $pt['postdate']); //$this->db->update("UPDATE pw_threads SET " . S::sqlSingle($pwSQL) . " WHERE tid=" . S::sqlEscape($tid)); pwQuery::update('pw_threads', 'tid = :tid', array($tid), $pwSQL); } return $ret; }
/** * 根据工作经历id删除一条工作经历 * @param int careerId 工作经历id * @return bool */ function deleteCareer($careerId) { if (!$careerId) { return false; } return pwQuery::delete($this->_tableName, 'careerid=:careerid', array($careerId)); }
S::gp(array('selid'), 'P', 1); if (is_array($selid)) { foreach ($selid as $value) { if (is_numeric($value)) { $selids[] = $value; } } $selids = S::sqlImplode($selids); } !$selids && adminmsg('operate_error', "{$basename}&action=cp"); $selids = strpos($selids, ',') !== false ? "IN ({$selids})" : "= {$selids}"; $uids = $dids = array(); $query = $db->query("SELECT uid,dtid,did FROM pw_diary WHERE did {$selids}"); while ($rt = $db->fetch_array($query)) { //$db->update("DELETE FROM pw_diary WHERE did=".S::sqlEscape($rt['did'])); pwQuery::delete('pw_diary', 'did=:did', array($rt['did'])); $db->update("UPDATE pw_diarytype SET num=num-1 WHERE dtid=" . S::sqlEscape($rt['dtid'])); if ($affected_rows = delAppAction('diary', $rt['did'])) { countPosts("-{$affected_rows}"); } $uids[] = $rt['uid']; $dids[] = $rt['did']; } $uids = array_unique($uids); updateUserAppNum($uids, 'diary', 'recount'); //删除日志时,删除微博 $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $weiboArr = $weiboService->getWeibosByObjectIdsAndType($dids, 'diary'); foreach ($weiboArr as $weibo) { $mids[] = $weibo['mid'];
function delete($uid, $behavior) { return pwQuery::delete($this->_tableName, "uid=:uid AND behavior=:behavior", array($uid, $behavior)); }
} if ($db->get_value("SELECT COUNT(*) as sum FROM pw_cnalbum WHERE atype=1 AND ownerid=" . S::sqlEscape($cyid)) > 0) { Showmsg('colony_del_photo'); } if ($colony['cnimg']) { require_once R_P . 'require/functions.php'; pwDelatt("cn_img/{$colony['cnimg']}", $db_ifftp); pwFtpClose($ftp); } $query = $db->query("SELECT uid FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid) . " AND ifadmin != '-1'"); while ($rt = $db->fetch_array($query)) { $cMembers[] = $rt['uid']; } updateUserAppNum($cMembers, 'group', 'minus'); $db->update("DELETE FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid)); //* $db->update("DELETE FROM pw_colonys WHERE id=" . S::sqlEscape($cyid)); pwQuery::delete('pw_colonys', 'id=:id', array($cyid)); $db->update("UPDATE pw_cnclass SET cnsum=cnsum-1 WHERE fid=" . S::sqlEscape($colony['classid']) . " AND cnsum>0"); $db->update("DELETE FROM pw_argument WHERE cyid=" . S::sqlEscape($cyid)); refreshto("apps.php?q=groups", '解散群组成功!'); } } else { Showmsg('undefined_action'); } function threadSetCheckOwnerPassword($ownerId, $inputPassword) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userData = $userService->get($ownerId); return md5($inputPassword) == $userData['password']; }
function deleteWeibosByMid($mids) { if (empty($mids)) { return false; } $mids = is_array($mids) ? $mids : array($mids); return pwQuery::delete($this->_tableName, 'mid IN (:mid)', array($mids)); /* $sql = 'DELETE FROM '.$this->_tableName.' WHERE mid IN (' . S::sqlImplode($mids) . ') '; $this->_db->query($sql); return true; */ }
/** * 根据公司id删除记录 * @param int $companyId 工作公司id * @return bool */ function deleteCompany($companyId) { if (!$companyId) { return false; } return pwQuery::delete($this->_tableName, 'companyid=:companyid', array($companyId)); }
/** * 取消评分 * @param $tid * @param $pids * @param $params */ function deletePing($params = array()) { global $groupid, $windid, $winduid, $credit, $onlineip, $timestamp, $gp_gptype; //* $threadService = L::loadClass("threads", 'forum'); require_once R_P . 'require/credit.php'; foreach ($this->postData as $pid => $atc) { $rpid = $pid == 'tpc' ? '0' : $pid; // delete pinglog $pingdata = $this->db->get_one('SELECT * FROM pw_pinglog WHERE tid=' . S::sqlEscape($this->tid) . ' AND pid=' . S::sqlEscape($rpid) . ' AND pinger=' . S::sqlEscape($windid) . ' ORDER BY pingdate DESC LIMIT 1'); //$this->db->update('DELETE FROM pw_pinglog WHERE id=' . S::sqlEscape($pingdata['id'])); pwQuery::delete('pw_pinglog', 'id=:id', array($pingdata['id'])); $this->update_markinfo($this->tid, $rpid); //* $threadService->clearTmsgsByThreadId($this->tid); Perf::gatherInfo('changeTmsgWithThreadIds', array('tid' => $this->tid)); $addpoint = $pingdata['point']; if (!($cid = $credit->getCreditTypeByName($pingdata['name']))) { continue; } $cName = $credit->cType[$cid]; $addpoint = $addpoint > 0 ? -$addpoint : abs($addpoint); !$atc['subject'] && ($atc['subject'] = substrs(strip_tags(convert($atc['content'])), 35)); $credit->addLog('credit_delping', array($cid => $addpoint), array('uid' => $atc['authorid'], 'username' => $atc['author'], 'ip' => $onlineip, 'operator' => $windid, 'tid' => $this->tid, 'subject' => $atc['subject'], 'reason' => $params['atc_content'])); $credit->set($atc['authorid'], $cid, $addpoint); if (!is_numeric($pid)) { //* $this->db->update('UPDATE pw_threads SET ifmark=ifmark+'.S::sqlEscape($addpoint).' WHERE tid='.S::sqlEscape($tid)); $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET ifmark=ifmark+:ifmark WHERE tid=:tid", array('pw_threads', $addpoint, $this->tid))); } if ($params['ifmsg'] && !$atc['anonymous'] && $atc['author'] != $windid) { //发消息 $title = getLangInfo('writemsg', 'delping_title', array('sender' => $windid, 'receiver' => $atc['author'])); $content = getLangInfo('writemsg', 'delping_content', array('manager' => $windid, 'fid' => $atc['fid'], 'tid' => $this->tid, 'pid' => $pid, 'subject' => $atc['subject'], 'postdate' => get_date($atc['postdate']), 'forum' => strip_tags($this->forum->foruminfo['name']), 'affect' => "{$cName}:{$addpoint}", 'admindate' => get_date($timestamp), 'reason' => stripslashes($params['atc_content']), 'sender' => $windid, 'receiver' => $atc['author'])); $this->sendMessage($atc['author'], $title, $content); } if ($gp_gptype == 'system') { require_once R_P . 'require/writelog.php'; $log = array('type' => 'credit', 'username1' => $atc['author'], 'username2' => $windid, 'field1' => $atc['fid'], 'field2' => '', 'field3' => '', 'descrip' => 'creditdel_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $this->tid, 'forum' => strip_tags($this->forum->foruminfo['name']), 'subject' => $atc['subject'], 'affect' => "{$name}:{$addpoint}", 'reason' => $params['atc_content']); writelog($log); } $pingLog[$pid] = $pingdata['id']; } $credit->runsql(); defined('AJAX') && ($GLOBALS['pingLog'] = $pingLog); //GLOBAL if ($this->forum->foruminfo['allowhtm'] && $_REQUEST['page'] == 1) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } return true; }
/** * 根据话题id删除话题 * @param int|array $topicids 话题ID * @return bool */ function deleteTopicById($topicIds) { !is_array($topicIds) && ($topicIds = array()); if (!$topicIds) { return false; } return pwQuery::delete($this->_tableName, 'topicid IN (:topicid)', array($topicIds)); }
} $pw_attachs->updateByTid($fromdb['tid'], array('tid' => $totid)); if ($ifmsg) { $msgdb[] = array('toUser' => $fromdb['author'], 'title' => getLangInfo('writemsg', 'unite_title', array('manager' => $windid)), 'content' => getLangInfo('writemsg', 'unite_content', array('manager' => $windid, 'fid' => $fid, 'tid' => $totid, 'subject' => $todb['subject'], 'postdate' => get_date($todb['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content)))); } $log = array('type' => 'unite', 'username1' => $fromdb['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => '', 'field3' => '', 'descrip' => 'unite_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $totid, 'subject' => substrs($todb['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content)); writelog($log); $istucool && $tucoolService->delete($fromdb['tid']); //更新评分 $oldPid = $fromdb['pid'] == 'tpc' ? 0 : $fromdb['pid']; //$db->update(pwQuery::buildClause('UPDATE :pw_table SET tid=:tid1,pid=:pid WHERE tid=:tid AND pid=0', array('pw_pinglog', $totid, $pid, $fromdb['tid']))); //$db->update(pwQuery::buildClause('UPDATE :pw_table SET tid=:tid1 WHERE tid=:tid AND pid>0', array('pw_pinglog', $totid, $fromdb['tid']))); pwQuery::update('pw_pinglog', 'tid=:tid', array($fromdb['tid']), array('tid' => $totid, 'pid' => $pid)); //pwQuery::update('pw_pinglog', 'tid=:tid AND pid>0', array($fromdb['tid']), array('tid'=>$totid)); //更新elements pwQuery::delete('pw_elements', 'id=:id AND type IN (:type)', array($fromdb['tid'], array('newpic', 'hitsort', 'hitsortday', 'hitsortweek', 'replysort', 'replysortday', 'replysortweek'))); } //$db->update("UPDATE pw_threads SET replies=replies+" . S::sqlEscape($replies, false) . " WHERE tid=" . S::sqlEscape($totid)); $db->update(pwQuery::buildClause('UPDATE :pw_table SET replies=replies+:replies WHERE tid=:tid', array('pw_threads', $replies, $totid))); $pw_tmsgs = GetTtable($totid); //* $db->update("UPDATE $pw_tmsgs SET remindinfo=" . S::sqlEscape($remindinfo, false) . " WHERE tid=" . S::sqlEscape($totid)); pwQuery::update($pw_tmsgs, 'tid=:tid', array($totid), array('remindinfo' => $remindinfo)); updateforum($fid); $weiboService = L::loadClass('weibo', 'sns'); $fromColonyIds && $weiboService->deleteWeibosByObjectIdsAndType($fromColonyIds, 'group_article'); $fromArticleIds && $weiboService->deleteWeibosByObjectIdsAndType($fromArticleIds, 'article'); $tousername = $db->get_value("SELECT author FROM pw_threads WHERE tid=" . S::sqlEscape($totid)); M::sendNotice(array($tousername), array('title' => getLangInfo('writemsg', 'unite_title'), 'content' => getLangInfo('writemsg', 'unite_content', array('manager' => $windid, 'fid' => $fid, 'tid' => $totid, 'subject' => $todb['subject'], 'postdate' => get_date($todb['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content))))); if ($ifmsg) { sendMawholeMessages($msgdb); }
/** * 根据学校ID删除多条数据 * @param int schoolIds 学校id * @return bool */ function deleteSchools($schoolIds) { if (!S::isArray($schoolIds)) { return false; } return pwQuery::delete($this->_tableName, 'schoolid IN (:schoolid)', array($schoolIds)); }
$tempKeywords[] = array('keyword' => $value, 'vieworder' => intval($new_view['vieworder'][$key]), 'fromtype' => 'custom', 'posttime' => $timestamp); } if ($tempKeywords) { $db->update("INSERT INTO pw_searchhotwords(keyword,vieworder,fromtype,posttime) VALUES " . S::sqlMulti($tempKeywords)); } $hotwordsconfig['shownum'] = abs(intval($hotwordsconfig['shownum'])); $hotwordsconfig['invokeperiod'] = abs(intval($hotwordsconfig['invokeperiod'])); $autoInvoke = array('isOpne' => $hotwordsconfig['openautoinvoke'], 'period' => $hotwordsconfig['invokeperiod']); L::loadClass('hotwordssearcher', 'search/userdefine'); $hotwordsServer = new PW_HotwordsSearcher(); $hotwordsServer->update($autoInvoke, $hotwordsconfig['shownum']); if (!$hotwordsconfig['shownum']) { setConfig('db_hotwords', ''); } if (!$hotwordsconfig['invokeperiod']) { pwQuery::delete('pw_searchhotwords', 'fromtype=:id', array('auto')); } $config['hotwordsconfig'] = $hotwordsconfig ? serialize($hotwordsconfig) : ''; setConfig('db_opensch', $config['opensch']); setConfig('db_openbuildattachs', $config['openbuildattachs']); setConfig('db_maxresult', $config['maxresult']); setConfig('db_schwait', $config['schwait']); setConfig('db_hotwordsconfig', $config['hotwordsconfig']); setConfig('db_filterids', $config['filterids']); setConfig('db_operate_log', $config['operate_log']); setConfigSearchTypeExpand($config['search_type_expand']); updatecache_c(); adminmsg("operate_success"); } } elseif ($action == 'cp') { if (empty($job)) {
$toUsers = $newColony->checkMembers($selid); break; case 'del': $query = $db->query("SELECT username,ifadmin FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid) . ' AND uid IN(' . S::sqlImplode($selid) . ")"); while ($rt = $db->fetch_array($query)) { if ($rt['username'] == $colony['admin']) { Showmsg('colony_delfail'); } if ($groupid != 3 && $rt['ifadmin'] == '1' && $colony['admin'] != $windid) { Showmsg('colony_manager'); } $rt['ifadmin'] != -1 && $trueMemberCount++; $toUsers[] = $rt['username']; } //* $db->update("DELETE FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid) . " AND uid IN(" . S::sqlImplode($selid) . ")"); pwQuery::delete('pw_cmembers', 'colonyid=:colonyid AND uid IN (:uid)', array($cyid, $selid)); $newColony->updateInfoCount(array('members' => -$trueMemberCount)); $colony['members'] -= $trueMemberCount; updateGroupLevel($colony['id'], $colony); break; default: Showmsg('undefined_action'); } if ($toUsers) { M::sendNotice($toUsers, array('title' => getLangInfo('writemsg', 'o_' . $operateStep . '_title', array('cname' => S::escapeChar($colony['cname']))), 'content' => getLangInfo('writemsg', 'o_' . $operateStep . '_content', array('cname' => S::escapeChar($colony['cname']), 'curl' => "{$db_bbsurl}/{$basename}cyid={$cyid}")))); } refreshto("{$basename}", 'operate_success'); } } elseif ($a == 'fanoutmsg') { define('AJAX', 1); !$ifadmin && Showmsg('undefined_action');
/** * 根据教育经历id删除多条教育经历 * @param int educationIds 教育经历id * @return bool */ function deleteEducations($educationIds) { if (!S::isArray($educationIds)) { return false; } return pwQuery::delete($this->_tableName, 'educationid IN (:educationid)', array($educationIds)); }
function delColonyById($id) { //* $this->_db->update("DELETE FROM pw_colonys WHERE id=" . S::sqlEscape($id)); pwQuery::delete('pw_colonys', 'id=:id', array($id)); }
while ($commentResults = $db->fetch_array($commentQuery)) { $commentIds[] = $commentResults['cid']; } $db->update("DELETE FROM pw_comment WHERE uid IN (" . S::sqlImplode($userIds) . ")"); S::isArray($commentIds) && $db->update('DELETE FROM pw_weibo_cmrelations WHERE cid IN (' . S::sqlImplode($commentIds) . ')'); $db->update("DELETE FROM pw_weibo_comment WHERE uid IN (" . S::sqlImplode($userIds) . ")"); $db->update("UPDATE pw_weibo_content SET replies=0 WHERE uid IN(" . S::sqlImplode($userIds) . ")"); } if ($item & 256) { //评分 $userService = L::loadClass('userservice', 'user'); /* @var $userService PW_Userservice */ $userNames = $userService->getUserNamesByUserIds($userIds); if ($userNames) { //$db->update("DELETE FROM pw_pinglog WHERE pinger IN (".S::sqlImplode($userNames).")"); pwQuery::delete('pw_pinglog', 'pinger IN (:pinger)', array($userNames)); } //收藏 $collectionService = L::loadClass('collection', 'collection'); /* @var $collectionService PW_Collection */ $collectionService->deleteByUids($userIds); //朋友 $friendService = L::loadClass('friend', 'friend'); /* @var $friendService PW_Friend */ $friendService->delFriendByUids($userIds); //关注 $db->update("DELETE FROM pw_attention WHERE uid IN (" . S::sqlImplode($userIds) . ")"); } $userCache = L::loadClass('userCache', 'user'); $userCache->delete($userIds); adminmsg('operate_success', "{$basename}&action={$action}&groupid={$groupid}&schname=" . rawurlencode($schname) . "&schuid={$schuid}&schemail={$schemail}&postnum={$postnum}&onlinetime={$onlinetime}®date={$regdate}&schlastvisit={$schlastvisit}&orderway={$orderway}&asc={$asc}&lines={$lines}&page={$page}&skipcheck=1");
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']); }
/** * 基础删除一条数据查询语句 * @param $id * @return unknown_type */ function _delete($id) { if (!$this->_check() || $id < 1) { return false; } //* $this->_db->update("DELETE FROM " . $this->_tableName . " WHERE " . $this->_primaryKey . "=" . $this->_addSlashes($id) . " LIMIT 1"); return pwQuery::delete($this->_tableName, "{$this->_primaryKey}=:{$this->_primaryKey}", array($id)); }
function recycle($ids) { global $db, $fid; $delids = array(); foreach ($ids as $key => $value) { if (is_numeric($value)) { $delids[] = $value; } } if ($delids) { $delids = S::sqlImplode($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=" . S::sqlEscape($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=" . S::sqlEscape($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 = S::sqlImplode($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 = S::sqlImplode($pollids); $db->update("DELETE FROM pw_polls WHERE tid IN({$pollids})"); } if ($actids) { $actids = S::sqlImplode($actids); $db->update("DELETE FROM pw_activity WHERE tid IN({$actids})"); $db->update("DELETE FROM pw_actmember WHERE actid IN({$actids})"); } if ($rewids) { $rewids = S::sqlImplode($rewids); $db->update("DELETE FROM pw_reward WHERE tid IN({$rewids})"); } if ($delaids) { $pw_attachs = L::loadDB('attachs', 'forum'); $pw_attachs->delete($delaids); } //$delids = S::sqlImplode($delids); if ($delids) { # $db->update("DELETE FROM pw_threads WHERE tid IN($delids)"); # ThreadManager //* $threadManager = L::loadClass("threadmanager", 'forum'); //* $threadManager->deleteByThreadIds($fid,$delids); $threadService = L::loadclass('threads', 'forum'); $threadService->deleteByThreadIds($delids); Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid)); } foreach ($ttable_a as $pw_tmsgs => $val) { //* $val = S::sqlImplode($val); //* $db->update("DELETE FROM $pw_tmsgs WHERE tid IN($val)"); pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($val)); } foreach ($ptable_a as $key => $val) { $pw_posts = GetPtable($key); //$db->update("DELETE FROM $pw_posts WHERE tid IN($delids)"); pwQuery::delete($pw_posts, 'tid IN(:tid)', array($delids)); } delete_tag(S::sqlImplode($delids)); if ($ids) { $ids = S::sqlImplode($ids); $db->update("DELETE FROM pw_recycle WHERE tid IN ({$ids})"); } pwFtpClose($GLOBALS['ftp']); }