function getAllFriend($uid, $offset, $limit) { list($uid, $offset, $limit) = array(intval($uid), intval($offset), intval($limit)); if ($uid < 1) { return $this->buildResponse(Friend_INVALID_PARAMS); } $uids = array(); $count = $GLOBALS['db']->get_value("SELECT COUNT(*) as count FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid)); if ($count < 1) { return $this->buildResponse(0, array()); } $sqlLimit = $offset > 0 ? ' AND friendid > ' . S::sqlLimit($offset) : ''; $query = $GLOBALS['db']->query("SELECT friendid FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid) . $sqlLimit . " ORDER BY friendid ASC LIMIT " . intval($limit)); while ($rt = $GLOBALS['db']->fetch_array($query)) { $uids[] = $rt['friendid']; } if (!S::isArray($uids)) { return $this->buildResponse(0, array()); } $userService = L::loadClass('UserService', 'user'); $userInfos = $userService->getByUserIds($uids); require_once R_P . 'require/showimg.php'; $result = array(); foreach ($userInfos as $userInfo) { $tmpIcon = showfacedesign($userInfo['icon'], 1, 's'); $result[] = array('uid' => $userInfo['uid'], 'icon' => $tmpIcon[0], 'username' => $userInfo['username']); } return $this->buildResponse(0, array('friends' => $result, 'count' => $count)); }
/** * * 获取最新置顶分类信息 * @param array $modelid 分类信息id * @param string $fid 版块id * @param int $num 调用个数 * @return array */ function toppedClassifyTopic($modelid, $fid, $num) { $posts = array(); $sqlWhere = $this->_buildCondition($modelid, $fid); $sqlWhere .= ' AND topped != 0'; $query = $this->_db->query('SELECT tid,fid,modelid,author,authorid,subject,postdate,anonymous FROM ' . $this->_tableName . $sqlWhere . ' AND ifshield != 1 AND locked != 2 ORDER BY lastpost DESC' . S::sqlLimit(0, $num)); $posts = $this->_cookData($query); return $posts; }
function _getFirstPostNoCache($postTable, $tid, $limit, $offset) { $readdb = array(); $limit = S::sqlLimit($limit, $offset); $query = $GLOBALS['db']->query("SELECT t.* FROM {$postTable} t WHERE t.tid=" . S::sqlEscape($tid) . " AND t.ifcheck='1' ORDER BY t.postdate ASC {$limit}"); while ($read = $GLOBALS['db']->fetch_array($query)) { $readdb[] = $read; } return $readdb; }
function getThreadsByLastPost($startTime, $endTime, $page, $perpage) { list($startTime, $endTime, $page, $perpage) = array(intval($startTime), intval($endTime), intval($page), intval($perpage)); if ($startTime < 1 || $endTime < 1 || $startTime > $endTime || $page < 1 || $perpage < 1) { return array(); } $offset = ($page - 1) * $perpage; $query = $GLOBALS['db']->query("SELECT t.*,f.name as forumname FROM pw_threads t LEFT JOIN pw_forums f USING(fid) WHERE t.fid != 0 AND t.ifcheck = 1 AND t.lastpost >= " . S::sqlEscape($startTime) . " AND lastpost <= " . S::sqlEscape($endTime) . S::sqlLimit($offset, $perpage)); return $this->getThreadDataWithTmsgs($query); }
function getEffectInvokePushDatas($invokepieceid, $num = 10) { global $timestamp; $temp = array(); $query = $this->_db->query("SELECT * FROM " . $this->_tableName . " WHERE invokepieceid=" . S::sqlEscape($invokepieceid) . " AND ifverify=0 AND starttime<=" . S::sqlEscape($timestamp) . " ORDER BY vieworder DESC,starttime DESC " . S::sqlLimit(0, $num)); while ($rt = $this->_db->fetch_array($query)) { $temp[$rt['id']] = $this->_initData($rt); } return $temp; }
function getCertificateInfo($start, $limit, $state) { if ($state) { $where = 'WHERE state=' . S::sqlEscape($state); } else { $where = 'WHERE state>0'; } $query = $this->_db->query("SELECT * FROM {$this->_tableName} {$where} ORDER BY id DESC" . S::sqlLimit($start, $limit)); return $this->_getAllResultFromQuery($query, 'uid'); }
/** * 分页取得所有字段信息 * @param int $start 起始位置 * @param int $num 数量 * @return array */ function getAllFieldsWithPages($start, $num) { $fields = array(); $start = (int) $start; $num = (int) $num; if ($start < 0 || $num < 1) { return $fields; } $query = $this->_db->query('SELECT * FROM ' . $this->_tableName . ' ORDER BY vieworder ASC' . S::sqlLimit($start, $num)); return $this->_getAllResultFromQuery($query, $this->_primaryKey); }
function searchPageInvokes($array, $page, $prePage = 20) { $page = (int) $page - 1 < 0 ? 0 : (int) $page - 1; $temp = array(); $_sql = "SELECT p.*,i.title,i.name FROM " . $this->_tableName . " p LEFT JOIN " . $this->_joinTable . " i ON p.invokename=i.name" . $this->_getSearchSql($array, 1) . ' ORDER by p.state ASC, p.id ASC ' . S::sqlLimit($page * $prePage, $prePage); $query = $this->_db->query($_sql); while ($rt = $this->_db->fetch_array($query)) { $rt = $this->_unserializeData($rt); $temp[] = $rt; } return $temp; }
function getAll($condition = array(), $page, $prePage = 20) { $page = (int) $page; $page = $page - 1; $page <= 0 && ($page = 0); $_sql = $this->_cookSql($condition); $query = $this->_db->query("SELECT * FROM " . $this->_tableName . " " . $_sql . " ORDER BY apply_id DESC " . S::sqlLimit($page * $prePage, $prePage)); $temp = array(); while ($rt = $this->_db->fetch_array($query)) { $temp[] = $rt; } return $temp; }
function getColonyList($where, $nums = null, $start = 0) { $sql = $this->_sqlCompound($where); $limit = ''; if ($nums) { $limit = S::sqlLimit($start, $nums); } $array = array(); $query = $this->_db->query("SELECT * FROM pw_colonys WHERE 1" . $sql . $limit); while ($rt = $this->_db->fetch_array($query)) { $array[$rt['id']] = $rt; } return $array; }
function findAll($array, $page, $perPage = 20) { $_sql_add = $this->_getSearchSQL($array); if ($perPage) { $limit = S::sqlLimit(($page - 1) * $perPage, $perPage); } $_sql = "SELECT * FROM " . $this->_tableName . " WHERE 1 {$_sql_add} " . $limit; $temp = array(); $query = $this->_db->query($_sql); while ($rt = $this->_db->fetch_array($query)) { $temp[] = $this->_unserializeData($rt); } return $temp; }
function getSortByTypeAndClassId($type, $classID, $num) { $_sqlAdd = $this->_getClassidAdd($classID); $white = array('tnum', 'pnum', 'members', 'todaypost', 'createtime', 'credit'); if (!$type || !in_array($type, $white)) { $type = 'tnum'; } $_sql_type = $type == 'credit' ? 'credit' : 'c.' . $type; $_sql_credit = $this->_getCreditAdd($type); $_sql = "SELECT c.id,c.styleid,c.cname,c.tnum,c.pnum,c.members,c.todaypost,c.createtime,c.cnimg,c.descrip,s.cname as stylename {$_sql_credit} FROM " . $this->_tableName . " c LEFT JOIN pw_cnstyles s ON c.styleid=s.id WHERE 1 {$_sqlAdd} ORDER BY {$_sql_type} DESC " . S::sqlLimit(0, $num); $temp = array(); $query = $this->_db->query($_sql); while ($rt = $this->_db->fetch_array($query)) { $temp[$rt['id']] = $rt; } return $temp; }
function getAppUsers($appid, $uid, $num, $start = 0) { if ($num == 'all') { $num = 500; } elseif (!is_numeric($num) || $num < 1) { $num = 20; } elseif ($num > 500) { $num = 500; } (!is_numeric($start) || $start < 0) && ($start = 0); $users = $appusers = array(); $query = $this->db->query("SELECT friendid FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid) . S::sqlLimit($start, $num)); while ($rt = $this->db->fetch_array($query)) { $users[] = $rt['friendid']; } $query = $this->db->query("SELECT uid FROM pw_userapp WHERE uid IN (" . S::sqlImplode($users) . ") AND appid=" . S::sqlEscape($appid)); while ($rt = $this->db->fetch_array($query)) { $appusers[] = $rt['uid']; } return new ApiResponse($appusers); }
function get($appid, $uid, $num, $start = 0) { if ($num == 'all') { $num = 500; } elseif (!is_numeric($num) || $num < 1) { $num = 20; } elseif ($num > 500) { $num = 500; } (!is_numeric($start) || $start < 0) && ($start = 0); $users = array(); $query = $this->db->query("SELECT friendid FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid) . S::sqlLimit($start, $num)); $appclient = L::loadClass('appclient'); while ($rt = $this->db->fetch_array($query)) { //$app = $this->db->get_one("SELECT * FROM pw_userapp WHERE uid=".S::sqlEscape($rt['friendid'])." AND appid=".S::sqlEscape($appid)); $app = $appclient->getUserAppByUidAndAppid($rt['friendid'], $appid); if (empty($app)) { $users[] = $rt['friendid']; } } return new ApiResponse($users); }
function _getDataForSort($type, $groupId, $num) { global $db; $_sql_order = $type == 'newarticle' ? 'a.tid' : 'a.lastpost'; $groupId = (int) $groupId; $_sqlAddArray = array(); if ($groupId) { $_sqlAddArray[] = 'a.cyid=' . S::sqlEscape($groupId); } if ($type == 'newreplye') { $_sqlAddArray[] = 't.replies>0'; } $_sqlAddArray[] = '!(t.fid=0 AND t.ifcheck=1)'; $_sqlAddArray[] = 'cy.ifopen=1'; $_sqlAdd = $_sqlAddArray ? ' WHERE ' . implode(' AND ', $_sqlAddArray) : ' '; $_sql = "SELECT t.tid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastposter,a.cyid,a.lastpost,cy.cname FROM pw_argument a LEFT JOIN pw_threads t ON a.tid=t.tid LEFT JOIN pw_colonys cy ON a.cyid=cy.id {$_sqlAdd} ORDER BY {$_sql_order} DESC" . S::sqlLimit(0, $num); $query = $db->query($_sql); $temp = array(); while ($rt = $db->fetch_array($query)) { $temp[] = $this->_cookData($rt); } return $temp; }
/* @var $userService PW_UserService */ $userdb = $userService->getByUserName($username); if (!$userdb) { $errorname = $username; adminmsg('user_not_exists'); } $uid = $userdb['uid']; } if ($uid) { $sql .= " AND fs.uid=" . S::sqlEscape($uid); } if ($fid) { $sql .= " AND fs.fid=" . S::sqlEscape($fid); } $page < 1 && ($page = 1); $limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage); $rt = $db->get_one("SELECT COUNT(*) AS sum FROM pw_forumsell fs {$sql}"); $pages = numofpage($rt['sum'], $page, ceil($rt['sum'] / $db_perpage), "{$basename}&uid={$uid}&fid={$fid}&"); $buydb = array(); $query = $db->query("SELECT fs.*,m.username,m.uid FROM pw_forumsell fs LEFT JOIN pw_members m USING(uid) {$sql} ORDER BY fs.overdate DESC {$limit}"); while ($rt = $db->fetch_array($query)) { $rt['buydate'] = get_date($rt['buydate']); $rt['overtime'] = get_date($rt['overdate']); $buydb[] = $rt; } include PrintEot('forumsell'); exit; } elseif ($_POST['action'] == 'del') { S::gp(array('selid')); if (!($selid = checkselid($selid))) { adminmsg('operate_error');
function getWeibosByType($type, $start, $limit) { $sql = 'SELECT * FROM ' . $this->_tableName . ' WHERE type=' . S::sqlEscape($type) . ' ORDER BY objectid DESC ' . S::sqlLimit($start, $limit); $query = $this->_db->query($sql); return $this->_getAllResultFromQuery($query); }
$postCate = new postCate($data); list(, $isviewright) = $postCate->getViewright($pcid, $tid); $memberdb = array(); $count = $sum = $paysum = 0; $query = $db->query("SELECT ifpay,nums FROM pw_pcmember WHERE tid=" . S::sqlEscape($tid)); while ($rt = $db->fetch_array($query)) { $count++; if ($rt['ifpay']) { $paysum += $rt['nums']; } $sum += $rt['nums']; } $page < 1 && ($page = 1); $numofpage = ceil($count / $db_perpage); if ($numofpage && $page > $numofpage) { $page = $numofpage; } $start = ($page - 1) * $db_perpage; $limit = S::sqlLimit($start, $db_perpage); $pages = numofpage($count, $page, $numofpage, "pw_ajax.php?action={$action}&tid={$tid}&jointype={$jointype}&payway={$payway}&", null, 'ajaxview'); $i = $pcid = 0; $query = $db->query("SELECT pcmid,uid,pcid,username,nums,totalcash,phone,mobile,address,extra,ifpay,jointime FROM pw_pcmember WHERE tid=" . S::sqlEscape($tid) . " ORDER BY (uid=" . S::sqlEscape($winduid) . ") DESC,ifpay ASC,pcmid DESC {$limit}"); while ($rt = $db->fetch_array($query)) { if ($i == 0) { $pcid = $rt['pcid']; } $i++; $memberdb[] = $rt; } require_once PrintEot('ajax'); ajax_footer();
function threadrelated($relatedcon) { global $db, $db_iftag, $db_threadrelated, $forumset, $fid, $read, $tid, $db_modes, $db_dopen, $db_phopen, $db_share_open, $db_groups_open, $groupid, $timestamp; $relatedb = array(); if (in_array($relatedcon, array('allpost', 'alldigest', 'allhits', 'allreply', 'forumpost', 'forumdigest', 'forumhits', 'forumreply'))) { //require_once(R_P.'require/element.class.php'); //$element = new Element($forumset['relatednums']); $element = L::loadClass('element'); $element->setDefaultNum($forumset['relatednums']); switch ($relatedcon) { case 'allpost': $relatedb = $element->newSubject(); break; case 'alldigest': $relatedb = $element->digestSubject(); break; case 'allhits': $relatedb = $element->hitSort(); break; case 'allreply': $relatedb = $element->replySort(); break; case 'forumpost': $relatedb = $element->newSubject($fid); break; case 'forumdigest': $relatedb = $element->digestSubject($fid); break; case 'forumhits': $relatedb = $element->hitSort($fid); break; case 'forumreply': $relatedb = $element->replySort($fid); break; } } elseif ($relatedcon == 'oinfo') { //继续改进 if ($db_modes['o']['ifopen']) { require_once "require/app_core.php"; $addwhere = ''; if (!$db_dopen) { $addwhere .= " AND type!='diary'"; } if (!$db_phopen) { $addwhere .= " AND type!='photo'"; } if (!$db_share_open) { $addwhere .= " AND type!='share'"; } if (!$db_groups_open) { $addwhere .= " AND type!='colony'"; } $query = $db->query("SELECT type,descrip FROM pw_feed WHERE uid=" . S::sqlEscape($read['authorid']) . $addwhere . " ORDER BY timestamp DESC " . S::sqlLimit(0, $forumset['relatednums'])); while ($rt = $db->fetch_array($query)) { $rt['title'] = parseFeedRead($rt['descrip']); $rt['url'] = USER_URL . "{$read['authorid']}"; unset($rt['type']); $relatedb[] = $rt; } } } elseif (in_array($relatedcon, array('pictags', 'hottags'))) { $tagid = $tagdbs = array(); $endtime = $timestamp - 30 * 24 * 3600; $sql = 'WHERE t.ifcheck=1 AND t.tid !=' . S::sqlEscape($tid) . ' AND t.postdate >=' . S::sqlEscape($endtime); $fidout = array('0'); $query = $db->query("SELECT fid,allowvisit,password FROM pw_forums WHERE type<>'category'"); while ($rt = $db->fetch_array($query)) { $allowvisit = !$rt['allowvisit'] || $rt['allowvisit'] != str_replace(",{$groupid},", '', $rt['allowvisit']) ? true : false; if ($rt['password'] || !$allowvisit) { $fidout[] = $rt['fid']; } } $fidout = S::sqlImplode($fidout); $fidout && ($sql .= " AND fid NOT IN ({$fidout})"); if ($db_iftag) { if ($read['tags'] && $relatedcon == 'pictags') { list($tagdb, $tpc_tag) = explode("\t", $read['tags']); $tagdbs = explode(' ', $tagdb); } elseif ($relatedcon == 'hottags') { //* @include_once (D_P.'data/bbscache/tagdb.php'); extract(pwCache::getData(D_P . "data/bbscache/tagdb.php", false)); $j = 0; foreach ($tagdb as $key => $val) { $j++; if ($j > 5) { break; } $tagdbs[] = $key; } unset($tagdb); } if ($tagdbs) { $query = $db->query("SELECT tagid FROM pw_tags WHERE tagname IN(" . S::sqlImplode($tagdbs) . ')'); while ($rt = $db->fetch_array($query)) { $tagid[] = $rt['tagid']; } } if ($tagid) { $query = $db->query("SELECT t.tid,t.subject FROM pw_tagdata tg LEFT JOIN pw_threads t USING(tid) {$sql} AND tg.tagid IN(" . S::sqlImplode($tagid) . ") GROUP BY tid ORDER BY postdate DESC " . S::sqlLimit(0, $forumset['relatednums'])); while ($rt = $db->fetch_array($query)) { $rt['title'] = $rt['subject']; $rt['url'] = "read.php?tid=" . $rt['tid']; unset($rt['subject']); unset($rt['tid']); $relatedb[] = $rt; } } } } elseif (in_array($relatedcon, array('ownpost', 'owndigest', 'ownhits', 'ownreply'))) { $endtime = $timestamp - 15 * 24 * 3600; $sql = "WHERE ifcheck=1 AND tid !=" . S::sqlEscape($tid) . "AND postdate >=" . S::sqlEscape($endtime) . " AND authorid=" . S::sqlEscape($read['authorid']) . " AND fid>0 "; $orderby = ''; switch ($relatedcon) { case 'ownpost': $orderby .= " ORDER BY postdate DESC"; break; case 'owndigest': $sql .= " AND digest>0"; $orderby .= " ORDER BY postdate DESC"; break; case 'ownhits': $orderby .= " ORDER BY hits DESC"; break; case 'ownreply': $orderby .= " ORDER BY replies DESC"; break; } $query = $db->query("SELECT tid,subject FROM pw_threads FORCE INDEX(" . getForceIndex('idx_postdate') . ") {$sql} {$orderby}" . S::sqlLimit(0, $forumset['relatednums'])); while ($rt = $db->fetch_array($query)) { $rt['title'] = $rt['subject']; $rt['url'] = "read.php?tid=" . $rt['tid']; unset($rt['subject']); unset($rt['tid']); $relatedb[] = $rt; } } return $relatedb; }
/** * 获得新增粉丝用户排行 * return array */ function getTopFansUser($time, $num) { if (!$time || !$num) { return array(); } $query = $this->_db->query("SELECT friendid,count(friendid) as counts FROM " . $this->_tableName . ' WHERE joindate > ' . S::sqlEscape($time) . ' GROUP BY friendid ORDER BY counts DESC' . S::sqlLimit($num)); return array_keys($this->_getAllResultFromQuery($query, 'friendid')); }
/** * SQL查询中,构造LIMIT语句 * * @param int $start 开始记录位置 * @param int $num 读取记录数目 * @return string SQL语句 */ function _Limit($start, $num = false) { return S::sqlLimit($start, $num); }
$uploadtime = PwStrtoTime($postdate1); is_numeric($uploadtime) && ($sql .= " AND uploadtime>" . S::sqlEscape($uploadtime)); } if ($postdate2) { $uploadtime = PwStrtoTime($postdate2); is_numeric($uploadtime) && ($sql .= " AND uploadtime<" . S::sqlEscape($uploadtime)); } if (S::inArray($orderway, array('uploadtime', 'size', 'needrvrc', 'name', 'hits'))) { $order = "ORDER BY {$orderway}"; $asc == 'DESC' && ($order .= ' ' . $asc); } else { $order = ''; } $pernum = is_numeric($pernum) ? $pernum : 20; $page < 1 && ($page = 1); $limit = S::sqlLimit(($page - 1) * $pernum, $pernum); $rt = $db->get_one("SELECT COUNT(*) AS count FROM pw_attachs WHERE {$sql}"); $sum = $rt['count']; $numofpage = ceil($sum / $pernum); $pages = numofpage($sum, $page, $numofpage, "{$basename}&fid={$fid}&uid={$uid}&filename=" . rawurlencode($filename) . "&hits={$hits}&ifmore={$ifmore}&filesize={$filesize}&ifless={$ifless}&orderway={$orderway}&asc={$asc}&postdate1={$postdate1}&postdate2={$postdate2}&pernum={$pernum}&"); $attachdb = $thread = array(); $query = $db->query("SELECT * FROM pw_attachs WHERE {$sql} {$order} {$limit}"); $searchHits = $hits; $searchFid = $fid; $searchUid = $uid; while (@extract($db->fetch_array($query))) { if ($_POST['direct']) { if (file_exists("{$attachdir}/{$attachurl}")) { P_unlink("{$attachdir}/{$attachurl}"); $ifthumb && P_unlink("{$attachdir}/thumb/{$attachurl}"); }
#正常分页 $readnum = $db_readperpage - 1; $start_limit = 0; if (perf::checkMemcache() && !$fieldadd && !$tablaadd && !$sqladd && $orderby == 'DESC' && !$rewardtype) { $_cacheService = Perf::gatherCache('pw_posts'); $tmpReaddb = $_cacheService->getFirstPostsByTid($pw_posts, $tid, $start_limit, $db_readperpage - $topped_page_num); foreach ($tmpReaddb as $key => $value) { $robPostIds[] = $value['pid']; $_uids[$value['authorid']] = 'UID_' . $read['authorid']; $value['aid'] && ($_pids[$value['pid']] = $value['pid']); $value['istop'] = strpos($value['remindinfo'], getLangInfo('bbscode', 'read_topped_tag')) !== false ? 'top' : ''; $tmpReaddb[$key] = $value; } $readdb = array_merge((array) $readdb, (array) $tmpReaddb); } else { $limit = S::sqlLimit($start_limit, $db_readperpage - $topped_page_num); $query = $db->query("SELECT t.* FROM {$pw_posts} t {$tablaadd} WHERE t.tid=" . S::sqlEscape($tid) . " AND t.ifcheck='1' ORDER BY t.postdate DESC {$limit}"); while ($read = $db->fetch_array($query)) { $_uids[$read['authorid']] = 'UID_' . $read['authorid']; $read['aid'] && ($_pids[$read['pid']] = $read['pid']); $read['istop'] = strpos($read['remindinfo'], getLangInfo('bbscode', 'read_topped_tag')) !== false ? 'top' : ''; $readdb[] = $read; } } } $db->free_result($query); $pageinverse && ($readdb = array_reverse($readdb)); } //读取用户信息 if ($_uids) { $_userIds = array_keys($_uids);
/** * 热门标签top100 * * @param int $num * @return array */ function getTagsByNum($num) { $num = intval($num); if ($num < 0) { return array(); } $query = $this->_db->query("SELECT tagid,tagname,num FROM " . $this->_tableName . " WHERE ifhot = 1 ORDER BY num DESC " . S::sqlLimit($num)); return $this->_getAllResultFromQuery($query); }
/** * 获取数据 * @param $table * @param $start * @param $num */ function _selectData($table, $start, $num) { list($start, $num) = array(intval($start), intval($num)); $sqlLimit = S::sqlLimit($start, $num); $query = $this->db->query('SELECT * FROM ' . S::sqlMetadata($table) . $sqlLimit); $fieldNum = $this->db->num_fields($query); return array($query, $fieldNum); }
/** * 根据条件获取用户信息 * @param int uid * @param int $start * @param int $limit * @return array */ function getKmdUsersWithCondition($uid, $start, $limit) { list($uid, $start, $limit) = array(intval($uid), intval($start), intval($limit)); $sql = $uid ? " AND km.uid={$uid}" : ''; $query = $this->_db->query("SELECT km.* FROM {$this->_tableName} km WHERE 1 {$sql} " . S::sqlLimit($start, $limit)); return $this->_getAllResultFromQuery($query, 'uid'); }
if (S::isArray($db_operate_log)) { foreach ($db_operate_log as $v) { $operate_log[$v] = 'CHECKED'; } } $search_type_expand = array(); if (S::isArray($db_search_type)) { foreach ($db_search_type as $key => $v) { $search_type_expand[$key] = 'CHECKED'; } } $db_hotwordsconfig = $db_hotwordsconfig ? unserialize($db_hotwordsconfig) : array(); ifcheck($db_hotwordsconfig['openautoinvoke'], 'openautoinvoke'); $_wheresql = $db_hotwordsconfig['openautoinvoke'] == 1 ? '' : " AND fromtype = 'custom'"; $filterService = L::loadClass('FilterUtil', 'filter'); $query = $db->query(" SELECT * FROM pw_searchhotwords WHERE 1 {$_wheresql} ORDER BY vieworder ASC, id DESC " . S::sqlLimit($db_hotwordsconfig['shownum'])); while ($rt = $db->fetch_array($query)) { if (($GLOBALS['banword'] = $filterService->comprise($rt['keyword'])) !== false) { continue; } $searchHotwords[] = $rt; } // if (!$db_dopen) {/*日志应用关闭*/ // $search_type_disabled['diary'] = "disabled"; // if ($search_type_expand['diary']) $search_type_expand['diary'] = ""; // } // if (!$db_groups_open){/*群组应用关闭*/ // $search_type_disabled['group'] = "disabled"; // if ($search_type_expand['group']) $search_type_expand['group'] = ""; // } } else {
/** * * 获取活动,按点击排行 * @param array $modelid 活动id * @param string $fid 版块id * @param int $num 调用个数 * @return array */ function clickActivityTopic($modelid, $fid, $num) { $posts = array(); $sqlWhere = $this->_buildCondition($modelid, $fid); $_sql = "SELECT dv.tid,dv.fid,dv.actmid,dv.starttime,dv.endtime,dv.picture1,t.author,t.authorid,t.subject,t.postdate,t.anonymous FROM {$this->_tableName} dv LEFT JOIN pw_threads t USING(tid){$sqlWhere} AND t.ifshield != 1 AND t.locked != 2 ORDER BY t.hits DESC" . S::sqlLimit(0, $num); $query = $this->_db->query($_sql); $posts = $this->_cookData($query); return $posts; }
} $nums = is_numeric($nums) ? $nums : 20; if ($sphinx && $keyword && $db_sphinx['isopen'] == 1 && strpos($keyword, '*') === false) { $forumIds = $fid > 0 ? array($fid) : array(); $sphinxServer = L::loadclass('searcher', 'search'); $result = $sphinxServer->manageThreads($keyword, 3, $authorarray, $pstart, $pend, $forumIds, $page, $nums); if ($result === false) { adminmsg('search_keyword_empty'); } $count = $result[0]; $query = $db->query("SELECT fid,pid,tid,author,authorid,content,postdate,userip FROM {$pw_posts} WHERE pid in (" . $result[1] . ") ORDER BY postdate DESC "); } else { $rt = $db->get_one("SELECT COUNT(*) AS sum FROM {$pw_posts} WHERE {$sql}"); $count = $rt['sum']; $page < 1 && ($page = 1); $limit = S::sqlLimit(($page - 1) * $nums, $nums); $sql .= ' ORDER BY postdate DESC '; $sql .= $_POST['direct'] ? " LIMIT {$nums}" : $limit; $query = $db->query("SELECT fid,pid,tid,author,authorid,content,postdate,userip FROM {$pw_posts} {$forceIndex} WHERE {$sql}"); } //$pages = numofpage_t($count,$page,ceil($count/$nums),"$admin_file?adminjob=superdel&admintype=article&action=$action&fid=$fid&tid=$tid&pstart=$pstart&pend=$pend&author=".rawurlencode($author)."&keyword=".rawurlencode($keyword)."&userip=$userip&tcounts=$tcounts&counts=$counts&nums=$nums&ptable=$ptable&sphinx=$sphinx&"); $pages = pagerforjs($count, $page, ceil($count / $nums), "onclick=\"manageclass.superdel(this,'del_rpl_form','')\""); $delid = $postdb = array(); while ($post = $db->fetch_array($query)) { if ($_POST['direct']) { $delid[$post['pid']] = $post['fid'] . '_' . $post['tid']; } else { $post['delid'] = $post['fid'] . '_' . $post['tid']; $post['forumname'] = $forum[$post['fid']]['name']; $post['postdate'] = get_date($post['postdate']); $post['content'] = substrs($post['content'], 30);
} adminmsg('operate_success', "{$basename}&action=colony"); } elseif ($action == 'log') { if ($_POST['step'] != 'del') { require_once GetLang('logtype'); S::gp(array('keyword', 'page')); $db_perpage = 20; $logdb = array(); $pages = $sqladd = $addpages = ''; if ($keyword) { $sqladd = " AND descrip LIKE " . S::sqlEscape("%{$keyword}%"); $addpages = "&keyword=" . rawurlencode($keyword); } (int) $page < 1 && ($page = 1); $id = ($page - 1) * $db_perpage; $query = $db->query("SELECT id,type,field2,field3,username1,timestamp,descrip FROM pw_forumlog WHERE type LIKE 'cy\\_%' {$sqladd}" . S::sqlLimit($id, $db_perpage)); while ($rt = $db->fetch_array($query)) { $rt['timestamp'] = get_date($rt['timestamp']); $rt['descrip'] = str_replace(array('[b]', '[/b]'), array('<b>', '</b>'), $rt['descrip']); $logdb[] = $rt; } $db->free_result($query); $count = $db->get_value("SELECT COUNT(*) FROM pw_forumlog WHERE type LIKE 'cy\\_%' {$sqladd}"); if ($count > $db_perpage) { require_once R_P . 'require/forum.php'; $pages = numofpage($count, $page, ceil($count / $db_perpage), "{$basename}&action=log{$addpages}&"); } require_once PrintApp('admin'); } else { S::gp(array('selid'), 'P', 1); if (!($selid = checkselid($selid))) {