function deleteByTids($tids) { if (!S::isArray($tids)) { return false; } return pwQuery::delete($this->_tableName, "{$this->_primaryKey} IN (:{$this->_primaryKey})", array($tids)); }
/** * 批量删除 * * @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 syncredit($arr) { if (is_array($arr)) { foreach ($arr as $uid => $setv) { $updateMemberData = array(); foreach ($setv as $cid => $value) { if (is_numeric($cid)) { $value = intval($value); /** $this->db->pw_update( "SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), "UPDATE pw_membercredit SET value=" . S::sqlEscape($value) . ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), "INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value)) ); **/ $this->db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $cid), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $value))); } elseif (in_array($cid, array('money', 'rvrc', 'credit', 'currency'))) { $cid == 'rvrc' && ($value *= 10); $updateMemberData[$cid] = intval($value); } } if ($updateMemberData) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userService->update($uid, array(), $updateMemberData); } } } return new ApiResponse(1); }
function increase($userId, $increments) { $userId = intval($userId); if ($userId <= 0 || !is_array($increments)) { return 0; } $incrementStatement = array(); foreach ($increments as $field => $offset) { $offset = intval($offset); if (!$offset) { continue; } if ($offset < 0) { $incrementStatement[] = $field . "=" . $field . $offset; } else { $incrementStatement[] = $field . "=" . $field . "+" . $offset; } } if (empty($incrementStatement)) { return 0; } //* $this->_db->update("UPDATE " . $this->_tableName . " SET " . implode(", ", $incrementStatement) . " WHERE uid=" . $this->_addSlashes($userId)); $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET " . implode(", ", $incrementStatement) . " WHERE uid=:uid", array($this->_tableName, $userId))); return $this->_db->affected_rows(); }
function deleteByIdentify($identify) { if (!$this->_check() || !$identify) { return false; } return pwQuery::delete($this->_tableName, "identify=:identify", array($identify)); }
/** * 根据标签ID批量删除 * * @param int $tagids 标签ID数组 * @return boolean */ function deleteMemberTagsByTagId($tagids) { if (!S::isArray($tagids)) { return false; } return (bool) pwQuery::delete($this->_tableName, "tagid in(:tagid)", array($tagids)); }
function reduceReplyNumByCommentid($num, $commentid) { $num = intval($num); $commentid = intval($commentid); if ($num < 1 || $commentid < 1) { return false; } return $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET replynum=replynum-" . S::sqlEscape($num) . ' WHERE commentid=:commentid', array($this->_tableName, $commentid))); }
/** * 根据链接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; }
/** * * 添加话题新鲜事关系 * @param int $topicId * @param int $mid */ function addTopicRelations($topicId, $mid) { $mid = intval($mid); $topicId = intval($topicId); if (!$mid || !$topicId) { return false; } $fields = array('topicid' => $topicId, 'mid' => $mid, 'crtime' => $GLOBALS['timestamp']); pwQuery::replace($this->_tableName, $fields); return true; }
function _insertLog($tableName, $sids, $operate) { if (!$tableName || !S::isArray($sids) || !$operate) { return false; } global $db, $timestamp; $operates = array('update' => 1, 'delete' => 2, 'insert' => 3); foreach ($sids as $sid) { pwQuery::replace($tableName, array('id' => $sid, 'sid' => $sid, 'operate' => $operates[$operate], 'modified_time' => $timestamp)); } return true; }
/** * 更新 * * @param int $commentid * @param array $fieldsData * @return boolean */ function updateReplynumByCommentid($exp = '+1', $commentid) { $commentid = intval($commentid); if ($commentid < 1 || !$exp) { return false; } $num = intval(trim($exp, '+-')); if (strpos($exp, '+') !== false) { return $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET replynum=replynum+" . S::sqlEscape($num) . ' WHERE commentid=:commentid', array($this->_tableName, $commentid))); } else { return $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET replynum=replynum-" . S::sqlEscape($num) . ' WHERE commentid=:commentid', array($this->_tableName, $commentid))); } return false; }
function insertAppevent($uid, $appevent = array(), $appid) { //插入用户的单个应用信息 //$rt = $this->db->get_one("SELECT uid FROM pw_userapp WHERE uid=".S::sqlEscape($uid)." AND appid=".S::sqlEscape($appid)); $appclient = L::loadClass('appclient'); $rt = $appclient->getUserAppByUidAndAppid($uid, $appid); if ($rt && $appevent) { $appevent = serialize($appevent); //$this->db->update("UPDATE pw_userapp SET appevent=" .S::sqlEscape($appevent). "WHERE uid=".S::sqlEscape($uid)." AND appid=".S::sqlEscape($appid)); pwQuery::update('pw_userapp', 'uid=:uid AND appid=:appid', array($uid, $appid), array('appevent' => $appevent)); return new ApiResponse(true); } return new ApiResponse(false); }
function add($username, $pwd, $email) { $this->db->update("INSERT INTO pw_members SET " . UC::sqlSingle(array('username' => $username, 'password' => $pwd, 'email' => $email, 'groupid' => 0, 'regdate' => $this->base->time))); $uid = $this->db->insert_id(); /** $this->db->update("INSERT INTO pw_memberdata SET " . $this->base->sqlSingle(array( 'uid' => $uid, 'lastvisit' => $this->base->time, 'thisvisit' => $this->base->time, 'onlineip' => $this->base->onlineip ))); **/ pwQuery::insert('pw_memberdata', array('uid' => $uid, 'lastvisit' => $this->base->time, 'thisvisit' => $this->base->time, 'onlineip' => $this->base->onlineip)); return $uid; }
function add($uid, $appid, $appname, $allowfeed, $descrip) { global $timestamp; /* $this->db->update("REPLACE INTO pw_userapp SET " . S::sqlSingle(array( 'uid' => $uid, 'appid' => $appid, 'appname' => $appname, ))); */ pwQuery::replace('pw_userapp', array('uid' => $uid, 'appid' => $appid, 'appname' => $appname)); if ($allowfeed) { $descrip = S::escapeChar($descrip); $this->db->update("INSERT INTO pw_feed SET " . S::sqlSingle(array('uid' => $uid, 'type' => 'app', 'descrip' => $descrip, 'timestamp' => $timestamp), false)); } return new ApiResponse(true); }
function update_markinfo($fid, $tid, $pid) { global $db; $perpage = 10; $pid = intval($pid); $creditnames = pwCreditNames(); $whereStr = " fid=" . S::sqlEscape($fid) . " AND tid=" . S::sqlEscape($tid) . " AND pid=" . S::sqlEscape($pid) . " AND ifhide=0 "; $count = 0; $creditCount = array(); $query = $db->query("SELECT COUNT(*) AS count,name,SUM(point) AS sum FROM pw_pinglog WHERE {$whereStr} GROUP BY name"); while ($rt = $db->fetch_array($query)) { $count += $rt['count']; if (isset($creditnames[$rt['name']])) { $creditCount[$rt['name']] += $rt['sum']; } elseif (in_array($rt['name'], $creditnames)) { $key = array_search($rt['name'], $creditnames); $creditCount[$key] += $rt['sum']; } } $markInfo = ''; if ($count) { $query = $db->query("SELECT id FROM pw_pinglog WHERE {$whereStr} ORDER BY id DESC LIMIT 0,{$perpage}"); $ids = array(); while ($rt = $db->fetch_array($query)) { $ids[] = $rt['id']; } $markInfo = $count . ":" . implode(",", $ids); if ($creditCount) { $tmp = array(); foreach ($creditCount as $key => $value) { $tmp[] = $key . '=' . $value; } $markInfo .= ':' . implode(',', $tmp); } } if ($pid == 0) { //* $db->update("UPDATE $pw_tmsgs SET ifmark=" . S::sqlEscape($markInfo) . " WHERE tid=" . S::sqlEscape($tid)); $pw_tmsgs = GetTtable($tid); pwQuery::update($pw_tmsgs, 'tid=:tid', array($tid), array('ifmark' => $markInfo)); } else { $db->update("UPDATE " . GetPtable("N", $tid) . " SET ifmark=" . S::sqlEscape($markInfo) . " WHERE pid=" . S::sqlEscape($pid)); } return $markInfo; }
function return_value($tid, $rw_a_name, $rw_a_val) { global $db, $pw_posts, $authorid, $author, $onlineip, $forum, $fid, $credit; if ($rw_a_val < 1) { return; } $p_a = $u_a = array(); $query = $db->query("SELECT pid,author,authorid FROM {$pw_posts} WHERE tid=" . S::sqlEscape($tid) . " AND ifreward='0' AND authorid!=" . S::sqlEscape($authorid) . " GROUP BY authorid ORDER BY postdate ASC LIMIT {$rw_a_val}"); while ($user = $db->fetch_array($query)) { $credit->addLog('reward_active', array($rw_a_name => 1), array('uid' => $user['authorid'], 'username' => $user['author'], 'ip' => $onlineip, 'fname' => $forum[$fid]['name'])); $p_a[] = $user['pid']; $u_a[] = $user['authorid']; $rw_a_val--; } //$p_a && $db->update("UPDATE $pw_posts SET ifreward='1' WHERE pid IN(" . S::sqlImplode($p_a) . ')'); $p_a && pwQuery::update($pw_posts, 'pid IN(:pid)', array($p_a), array('ifreward' => '1')); $u_a && $credit->setus($u_a, array($rw_a_name => 1), false); if ($rw_a_val > 0) { $credit->addLog('reward_return', array($rw_a_name => $rw_a_val), array('uid' => $authorid, 'username' => $author, 'ip' => $onlineip, 'fname' => $forum[$fid]['name'])); $credit->set($authorid, $rw_a_name, $rw_a_val, false); } }
function updatecache_i_i($fid, $aidin = null) { global $db, $db_windpost, $timestamp, $forum; require_once R_P . 'require/bbscode.php'; //* include pwCache::getPath(D_P.'data/bbscache/forum_cache.php'); extract(pwCache::getData(D_P . 'data/bbscache/forum_cache.php', false)); $sql_where = empty($aidin) ? "fid=" . S::sqlEscape($fid) : "aid IN ({$aidin})"; $F_ffid = false; $aid = $aidcache = 0; $aids = ''; $query = $db->query("SELECT aid,startdate,enddate,content FROM pw_announce WHERE {$sql_where} AND ifopen='1' AND (enddate=0 OR enddate>=" . S::sqlEscape($timestamp) . ") ORDER BY vieworder,startdate DESC"); while ($rt = $db->fetch_array($query)) { if ($rt['startdate'] <= $timestamp) { if ($F_ffid) { continue; } elseif (!$rt['enddate']) { $F_ffid = true; } } if (!$aid && $rt['startdate'] <= $timestamp && (!$rt['enddate'] || $rt['enddate'] >= $timestamp)) { $aid = $rt['aid']; if ($rt['content'] != convert($rt['content'], $db_windpost, 2)) { //* $db->update("UPDATE pw_announce SET ifconvert='1' WHERE aid=".S::sqlEscape($aid)); pwQuery::update('pw_announce', 'aid=:aid', array($aid), array('ifconvert' => 1)); } } else { $aids .= ",{$rt['aid']}"; } } if ($aids) { $aids = substr($aids, 1); $aidcache = $timestamp; } //* $db->update("UPDATE pw_forumdata SET ".S::sqlSingle(array('aid'=>$aid,'aids'=>$aids,'aidcache'=>$aidcache))."WHERE fid=".S::sqlEscape($fid)); pwQuery::update('pw_forumdata', 'fid=:fid', array($fid), array('aid' => $aid, 'aids' => $aids, 'aidcache' => $aidcache)); }
if ($foruminfo['allowhtm'] == 1) { #纯静态页面生成 $htmurl = $db_readdir . '/' . $fid . '/' . date('ym', $read['postdate']) . '/' . $read['tid'] . '.html'; if (!$foruminfo['cms'] && !$toread && file_exists(R_P . $htmurl)) { ObHeader("{$R_url}/{$htmurl}"); } } $readdb[] = $read; } $toread && ($urladd .= "&toread={$toread}"); $fpage > 1 && ($urladd .= "&fpage={$fpage}"); $pages = numofpage($count + $topped_count, $page, $numofpage, "read.php?tid={$tid}{$urladd}{$viewbbs}&"); $tpc_locked = $read['locked'] % 3 != 0 ? 1 : 0; //更新帖子点击 if ($db_hits_store == 0) { pwQuery::update('pw_threads', 'tid=:tid', array($tid), null, array(PW_EXPR => array('hits=hits+1'))); } elseif ($db_hits_store == 1) { $db->update('UPDATE pw_hits_threads SET hits=hits+1 WHERE tid=' . S::sqlEscape($tid)); } elseif ($db_hits_store == 2) { pwCache::writeover(D_P . 'data/bbscache/hits.txt', $tid . "\t", 'ab'); } //帖子浏览记录 $readlog = str_replace(",{$tid},", ',', GetCookie('readlog')); $readlog .= ($readlog ? '' : ',') . $tid . ','; $readlogCount = substr_count($readlog, ','); $readlogCount > 11 && ($readlog = preg_replace("/[\\d]+\\,/i", '', $readlog, $readlogCount - 11)); Cookie('readlog', $readlog); $favortitle = str_replace(array("'", "'", "\"", "\\"), array("‘", "\\'", "\\\"", "\\\\"), $subject); $db_bbsname_a = addslashes($db_bbsname); #模版内用到 if ($readdb[0]['cyid']) {
/** * 基础删除一条数据查询语句 * @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)); }
$aid = $attach['aid']; //获取管理权限 $isGM = S::inArray($windid, $manager); !$isGM && ($groupid = 3 && ($isGM = 1)); if ($isGM) { $admincheck = 1; } else { $admincheck = 0; } $attach['attachurl'] = "diary/" . $attach['attachurl']; if ($admincheck || $attach['uid'] == $winduid) { pwDelatt($attach['attachurl'], $db_ifftp); pwFtpClose($ftp); $diaryService = L::loadClass('Diary', 'diary'); /* @var $diaryService PW_Diary */ $diary = array(); $diary = $diaryService->get($did); $attachs = unserialize($diary['aid']); if (is_array($attachs)) { unset($attachs[$aid]); $attachs = $attachs ? serialize($attachs) : ''; //$db->update("UPDATE pw_diary SET aid=".S::sqlEscape($attachs)."WHERE did=" . S::sqlEscape($did)); pwQuery::update('pw_diary', 'did =:did', array($did), array('aid' => $attachs)); } $db->update("DELETE FROM pw_attachs WHERE aid=" . S::sqlEscape($aid)); echo 'success'; ajax_footer(); } else { Showmsg('job_attach_right'); } }
$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'); $StaticPage->update($tid); empty($j_p) && ($j_p = "read.php?tid={$tid}&ds=1"); refreshto($j_p, 'operate_success'); } else { refreshto("read.php?tid={$tid}&ds=1&page={$page}", 'operate_success'); } } else { Showmsg('job_attach_right'); }
/** * 对给定数据进行数据库积分增减操作 * * @param array $setArr 操作数据 array(1 => array('money' => ??, 'rvrc' => ??), 2 => array(), 3 => array(), ...) * @param bool $isAdd 是否实时进行数据库操作 */ function runsql($setArr = null, $isAdd = true) { global $db, $uc_server, $uc_syncredit; $setUser = isset($setArr) ? $setArr : $this->setUser; $retv = array(); if ($uc_server && $uc_syncredit) { require_once R_P . 'uc_client/uc_client.php'; $retv = uc_credit_add($setUser, $isAdd); } $cacheUids = $cacheCredits = array(); $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ foreach ($setUser as $uid => $setv) { $updateUser = $increaseUser = array(); foreach ($setv as $cid => $v) { if ($this->check($cid) && ($v != 0 || !$isAdd)) { if (isset($retv[$uid][$cid])) { if ($uc_server == 1) { continue; } $act = 'set'; $v = $retv[$uid][$cid]; } else { $act = $isAdd ? 'add' : 'set'; } if (is_numeric($cid)) { $v = intval($v); /** $db->pw_update( "SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), "UPDATE pw_membercredit SET " . ($act == 'add' ? 'value=value+' : 'value=') . S::sqlEscape($v) . ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), "INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $v)) ); **/ $db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::buildClause("UPDATE :pw_table SET " . ($act == 'add' ? 'value=value+' : 'value=') . ':value' . ' WHERE uid=:uid AND cid=:cid', array('pw_membercredit', $v, $uid, $cid)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $v))); } else { $cid == 'rvrc' && ($v *= 10); if ($act == 'add') { $increaseUser[$cid] = intval($v); } else { $updateUser[$cid] = intval($v); } } } } if ($increaseUser) { $userService->updateByIncrement($uid, array(), $increaseUser); } if ($updateUser) { $userService->update($uid, array(), $updateUser); } unset($this->getUser[$uid]); $cacheUids[] = 'UID_' . $uid; $cacheCredits[] = 'UID_CREDIT_' . $uid; } // if ($cacheUids) { // $_cache = getDatastore(); // $_cache->delete($cacheUids); // $_cache->delete($cacheCredits);/*积分*/ // } $this->writeLog(); !isset($setArr) && ($this->setUser = array()); }
$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');
$u_credit = $credit->get($rt['uid'], 'CUSTOM'); include PrintEot('usermanage'); exit; } else { S::gp(array('uid', 'creditdb'), 'P'); !is_numeric($uid) && adminmsg('operate_error'); foreach ($creditdb as $key => $value) { if (is_numeric($key) && is_numeric($value)) { /** $db->pw_update( "SELECT uid FROM pw_membercredit WHERE uid=".S::sqlEscape($uid)."AND cid=".S::sqlEscape($key), "UPDATE pw_membercredit SET value=".S::sqlEscape($value)."WHERE uid=".S::sqlEscape($uid)."AND cid=".S::sqlEscape($key), "INSERT INTO pw_membercredit SET ".S::sqlSingle(array('uid'=>$uid,'cid'=>$key,'value'=>$value)) ); **/ $db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . "AND cid=" . S::sqlEscape($key), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $key), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $key, 'value' => $value))); } } adminmsg('operate_success'); } } else { S::gp(array('page'), 'GP', 2); $page < 1 && ($page = 1); $limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage); $rt = $db->get_one("SELECT COUNT(*) AS sum FROM pw_membercredit WHERE value!=0"); $pages = numofpage($rt['sum'], $page, ceil($rt['sum'] / $db_perpage), "{$basename}&"); $query = $db->query("SELECT m.uid,m.username,mc.cid,mc.value FROM pw_membercredit mc LEFT JOIN pw_members m USING(uid) WHERE value!=0 ORDER BY cid, value DESC {$limit}"); while ($rt = $db->fetch_array($query)) { $rt['name'] = $_CREDITDB[$rt['cid']][0]; $creditdb[] = $rt; }
/** * 统计所有套餐数量 * @return int */ function countSpreads() { $total = $this->_db->get_value(pwQuery::selectClause($this->_tableName, '', array(), array(PW_EXPR => array('COUNT(*) AS total')))); return $total; }
/** * 设置是否允许热门标签 * * @param array $tagids * @return boolean */ function setHotByTagids($tagids, $ifhot) { $ifhot = intval($ifhot); if ($ifhot < 0 || !S::isArray($tagids)) { return false; } return pwQuery::update($this->_tableName, "tagid in(:tagid)", array($tagids), array('ifhot' => $ifhot)); }
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; */ }
<?php !function_exists('readover') && exit('Forbidden'); $query = $db->query("SELECT id,uid,fid FROM pw_banuser WHERE type='1' AND startdate+days*86400<" . S::sqlEscape($timestamp)); $ids = $uids1 = $uids2 = array(); while ($rt = $db->fetch_array($query)) { $ids[] = $rt['id']; if ($rt['fid']) { $uids2[] = $rt['uid']; } else { $uids1[] = $rt['uid']; } } if ($ids) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $db->update("DELETE FROM pw_banuser WHERE id IN(" . S::sqlImplode($ids) . ")"); $uids1 && $userService->updates($uids1, array('groupid' => -1)); /** $uids2 && $db->update("UPDATE pw_members m LEFT JOIN pw_banuser b ON m.uid=b.uid AND b.fid>0 SET m.userstatus=m.userstatus&(~1) WHERE b.uid is NULL AND m.uid IN(".S::sqlImplode($uids2).")"); **/ $uids2 && $db->update(pwQuery::buildClause("UPDATE :pw_table m LEFT JOIN pw_banuser b ON m.uid=b.uid AND b.fid>0 SET m.userstatus=m.userstatus&(~1) WHERE b.uid is NULL AND m.uid IN(:uid)", array('pw_members', $uids2))); }
<?php !defined('P_W') && exit('Forbidden'); InitGP(array('id'), null, 2); InitGP(array('record')); $rt = $db->get_one("SELECT tid,fid FROM pw_pinglog WHERE ifhide=0 AND id=" . S::sqlEscape($id)); if (empty($rt) || !$rt['fid']) { Showmsg('data_error'); } L::loadClass('forum', 'forum', false); $pwforum = new PwForum($rt['fid']); $isGM = CkInArray($windid, $manager); if (!$isGM && !pwRights($pwforum->isBM($windid), 'pingcp', $rt['fid'])) { Showmsg('mawhole_right'); } //$db->update("UPDATE pw_pinglog SET record=" . S::sqlEscape($record) . " WHERE id=" . S::sqlEscape($id)); pwQuery::update('pw_pinglog', 'id=:id', array($id), array('record' => $record)); echo "success"; # memcache reflesh if ($db_memcache) { //* $threads = L::loadClass('Threads', 'forum'); //* $threads->delThreads($rt['tid']); Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $rt['tid'])); } ajax_footer();