/** * @param $replies * @param $order * @param $isDesc * @param $page * @return unknown_type */ function getThreadsByReplies($replies, $page) { if (!$replies) { return; } $sql = "SELECT p.tid FROM pw_postsfloor p GROUP BY p.tid ORDER BY p.tid DESC"; $query = $this->db->query($sql); while ($rt = $this->db->fetch_array($query)) { $tid[] = $rt['tid']; } if ($tid) { $w_tid = " t.tid NOT IN ( " . S::sqlImplode($tid) . " ) AND "; } $sql = "SELECT COUNT(*) AS sum FROM pw_threads t WHERE {$w_tid} t.replies > " . S::sqlEscape($replies); $rt = $this->db->get_one($sql); (!is_numeric($page) || $page < 1) && ($page = 1); $limit = S::sqlLimit(($page - 1) * $this->db_perpage, $this->db_perpage); $result['pages'] = numofpage($rt['sum'], $page, ceil($rt['sum'] / $this->db_perpage), $this->basename . "&sub=y&action=search&replies={$replies}&"); $sql = "SELECT t.tid, t.subject, t.replies, t.postdate, t.fid\n\t\t\t\tFROM pw_threads t\n\t\t\t\tWHERE {$w_tid} t.replies > " . S::sqlEscape($replies) . " {$limit}"; $query = $this->db->query($sql); while ($rt = $this->db->fetch_array($query)) { list($lastDate) = PostIndexUtility::getLastDate($rt["postdate"]); $rt["postdate"] = $lastDate; $result['data'][] = $rt; } return $result; }
function pwGetPager($count, $page, $perpage, $url) { $page = intval($page) < 1 ? 1 : intval($page); $perpage = $perpage ? $perpage : 20; $numofpage = ceil($count / $perpage); return numofpage($count, $page, $numofpage, $baseUrl); }
function execute() { $totalNum = $this->countPictures(); $pager = $lists = ""; if ($totalNum) { $this->page = $this->page > 1 ? $this->page : 1; $totalPage = ceil($totalNum / $this->perPage); $pager = numofpage($totalNum, $this->page, $totalPage, $this->jump . "&"); $lists = $this->getBackGroundLists($this->page, $this->perPage); } $bool = $totalNum ? TRUE : FALSE; return array($bool, $pager, $lists); }
/** * 111 */ function sreachPageInvokesPages($array, $page, $url, $preg = 20) { $pageInvokeDB = $this->_getPageInvokeDB(); $page = (int) $page; if ($page < 1) { $page = 1; } $total = $pageInvokeDB->searchCount($array); $numofpage = ceil($total / $preg); $numofpage < 1 && ($numofpage = 1); $page > $numofpage && ($page = $numofpage); return numofpage($total, $page, $numofpage, $url); }
pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('ifmail' => '2')); } if ($page == 1) { $read['pid'] = 'tpc'; 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);
foreach ($creditset as $key => $value) { $moneyName = $credit->cType[$key]; $unit = $credit->cUnit[$key]; $creditPops .= $value . $unit . $moneyName . ","; } $deletePhotoCredit = $creditset ? '删除照片会扣除积分:' . $creditPops . '继续吗?' : '是否确认删除?'; list($album, $cnpho) = $result; $isown = $album['ownerid'] == $winduid ? '1' : '0'; if (!$isown) { $url = $db_bbsurl . "/apps.php?q=photos&uid=" . $album['ownerid'] . "&a=album&aid=" . $aid; ObHeader($url); } $count = $album['photonum']; $pageCount = ceil($count / $perpage); $page = validatePage($page, $pageCount); $pages = numofpage($count, $page, $pageCount, "{$basename}a={$a}&aid={$aid}{$friendurl}&"); $ouserdataService = L::loadClass('Ouserdata', 'sns'); /* @var $ouserdataService PW_Ouserdata */ $myOuserData = $ouserdataService->get($album['ownerid']); $weiboPriv = false; !$myOuserData['index_privacy'] && !$myOuserData['photos_privacy'] && !$album['private'] && ($weiboPriv = true); } elseif ($a == 'view') { S::gp(array('pid')); $result = $photoService->viewPhoto($pid); if (!is_array($result)) { Showmsg($result); } // 删除积分提示 require_once R_P . 'require/credit.php'; $o_photos_creditset = unserialize($o_photos_creditset); $creditset = getCreditset($o_photos_creditset['Deletephoto'], false);
$url .= "&adminban=" . rawurlencode($adminban); } if ($starttime) { !is_numeric($starttime) && ($starttime = PwStrtoTime($starttime)); $sql .= " AND b.startdate>" . pwEscape($starttime); $url .= "&starttime={$starttime}"; } if ($endtime) { !is_numeric($endtime) && ($endtime = PwStrtoTime($endtime)); $sql .= " AND b.startdate<" . pwEscape($endtime); $url .= "&endtime={$endtime}"; } if ($count < 1) { @extract($db->get_one("SELECT COUNT(*) AS count FROM pw_banuser b {$sql}")); } $pages = numofpage($rt['sum'], $page, ceil($count / $db_perpage), "{$url}&"); $bandb = $ids = $uids1 = $uids2 = array(); $query = $db->query("SELECT b.*, m.username FROM pw_banuser b LEFT JOIN pw_members m ON b.uid=m.uid {$sql} ORDER BY b.uid DESC {$limit}"); while ($rt = $db->fetch_array($query)) { if ($rt['type'] == 1 && $timestamp - $rt['startdate'] > $rt['days'] * 86400) { $ids[] = $rt['id']; if ($rt['fid']) { $uids2[] = $rt['uid']; } else { $uids1[] = $rt['uid']; } } else { $rt['startdate'] && ($rt['date'] = get_date($rt['startdate'])); $bandb[] = $rt; } }
$rs['ifthumb'] && P_unlink("{$attachdir}/thumb/{$rs['attachurl']}"); $delnum++; $delname .= "{$rs['attachurl']}<br>"; } } $db->update("DELETE FROM pw_attachs WHERE {$sql} AND aid IN({$attachs})"); } adminmsg('attachstats_del', "{$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}&page={$page}"); } elseif ($action == 'msgList') { S::gp(array('page'), 'GP'); $messageServer = L::loadClass('message', 'message'); $attachCount = $messageServer->countAllAttachs(); $pageCount = ceil($attachCount / $db_perpage); $page = $page < 0 || empty($page) ? 1 : ($page > $pageCount ? $pageCount : $page); $attachList = $messageServer->getAllAttachs($page, $db_perpage); $pages = numofpage($attachCount, $page, $pageCount, $basename . '&action=msgList&'); include PrintEot('attachment'); exit; } elseif ($action == 'msgDel') { S::gp(array('mids'), 'GP'); !is_array($mids) && adminmsg('请选择要删除的附件'); $messageServer = L::loadClass('message', 'message'); $messageServer->deleteAttachsByMessageIds($mids); adminmsg('附件删除成功!', "{$basename}&action=msgList&"); } function attachcheck($file) { global $cache_file, $attachdir, $admin_pwd, $filename, $filesize, $ifless, $postdate1, $postdate2, $direct, $attachdir; if ($filename && strpos($file, $filename) === false) { return; }
function pwLimitPages($count, $page, $pageurl) { global $db_perpage, $db_maxpage; //require_once (R_P.'require/forum.php'); $numofpage = ceil($count / $db_perpage); $numofpage = $numofpage > $db_maxpage ? $db_maxpage : $numofpage; $page < 1 ? $page = 1 : ($page > $numofpage ? $page = $numofpage : null); $pages = numofpage($count, $page, $numofpage, $pageurl, $db_maxpage); $limit = pwLimit(($page - 1) * $db_perpage, $db_perpage); return array($pages, $limit); }
$query = $db->query($sql); while ($rt = $db->fetch_array($query)) { $rt['date'] = get_date($rt['updated_at']); $rt['operate'] = $operate[$rt['state']]; $record_list[] = $rt; } include_once PrintEot('filter'); exit; } elseif ($job == 'post') { $count = $db->get_value("SELECT COUNT(*) FROM pw_filter WHERE state>0 AND pid>0"); $page_count = ceil($count / $db_perpage); if ($page > $page_count) { $page = $page_count; } $limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage); $pages = numofpage($count, $page, $page_count, "{$basename}&action=record&job=post&"); $sql = "SELECT pf.*,pt.subject FROM pw_filter AS pf LEFT JOIN pw_threads AS pt ON pf.tid = pt.tid WHERE pf.state>0 AND pf.pid>0 ORDER BY {$sort} DESC {$limit}"; $query = $db->query($sql); while ($rt = $db->fetch_array($query)) { $rt['subject'] = substrs($rt['subject'], 33); $rt['date'] = get_date($rt['updated_at']); $rt['operate'] = $operate[$rt['state']]; $record_list[] = $rt; } include_once PrintEot('filter'); exit; } } else { adminmsg('illegal_request'); } } elseif ($action == 'show') {
$rt['savetime'] = $rt['savetime'] ? get_date($rt['savetime'], 'Y-m-d H:i') : '--'; if (strpos($rt['toname'], ',' . $windid . ',') !== false && $rt['msgtype'] == '2' || $groupid == '3' || $groupid == '4' || CkInArray($windid, $manager) || $rt['msgtype'] == '1' || $rt['uid'] == $winduid) { if ($rt['uid'] != $winduid && $groupid != '3' && $groupid != '4' && CkInArray($windid, $manager) === false) { $rt['ifuse'] = 'disabled'; } else { $rt['ifuse'] = ''; } $msgdb[] = $rt; } } } $db->free_result($query); $count = $db->get_value('SELECT COUNT(*) FROM pw_forummsg WHERE fid=' . pwEscape($fid)); if ($count > $db_perpage) { require_once R_P . 'require/forum.php'; $pages = numofpage($count, $page, ceil($count / $db_perpage), "forumcp.php?action=edit&fid={$fid}&type={$type}&"); } if ($_POST['demsg']) { InitGP(array('ids')); foreach ($ids as $key => $value) { if (is_numeric($value)) { $iids[] = $value; } } $ids = pwImplode($iids); !$ids && Showmsg('forummsg_nodata'); $db->query("DELETE FROM pw_forummsg WHERE id IN({$ids})"); refreshto("forumcp.php?action=edit&type=msg&fid={$fid}", 'operate_success'); } require_once PrintEot('forumcp'); footer();
<?php !defined('P_W') && exit('Forbidden'); !$db_iftag && Showmsg('tag_closed'); S::gp(array('tagname', 'page')); $metakeyword = strip_tags($tagname); $db_metakeyword = $metakeyword; $subject = $metakeyword . ' - '; $webPageTitle = $db_bbsname . '-' . $metakeyword; require_once R_P . 'require/header.php'; //* include_once pwCache::getPath(D_P . 'data/bbscache/forum_cache.php'); pwCache::getData(D_P . 'data/bbscache/forum_cache.php'); $rs = $db->get_one('SELECT tagid,num FROM pw_tags WHERE tagname=' . S::sqlEscape($tagname)); (!is_numeric($page) || $page < 1) && ($page = 1); $limit = S::sqlLimit(($page - 1) * $db_readperpage, $db_readperpage); $pages = numofpage($rs['num'], $page, ceil($rs['num'] / $db_readperpage), "link.php?action=tag&tagname=" . rawurlencode($tagname) . "&"); $query = $db->query('SELECT * FROM pw_tagdata tg LEFT JOIN pw_threads t USING(tid) WHERE tg.tagid=' . S::sqlEscape($rs['tagid']) . ' order by t.lastpost desc ' . $limit); $tiddb = array(); while ($rt = $db->fetch_array($query)) { if ($rt['titlefont']) { $titledetail = explode("~", $rt['titlefont']); if ($titledetail[0]) { $rt['subject'] = "<font color={$titledetail['0']}>{$rt['subject']}</font>"; } if ($titledetail[1]) { $rt['subject'] = "<b>{$rt['subject']}</b>"; } if ($titledetail[2]) { $rt['subject'] = "<i>{$rt['subject']}</i>"; } if ($titledetail[3]) {
$newtiddb[] = $value; } } if (count($newtiddb) > 0) { $db->update("DELETE FROM {$pcvaluetable} WHERE tid IN(" . pwImplode($newtiddb) . ") AND ifrecycle=0"); } is_array($threadb) && ($alltids = implode(',', $threadb)); $count = $db->get_value("SELECT COUNT(tid) as count FROM {$pcvaluetable} WHERE ifrecycle=0"); } if ($count > 0) { $page < 1 && ($page = 1); $numofpage = ceil($count / $db_perpage); if ($numofpage && $page > $numofpage) { $page = $numofpage; } $pages = numofpage($count, $page, $numofpage, "{$admin_file}?adminjob=postcate&action=postcate&pcid={$pcid}&newfield={$newfield}&step={$step}&"); if ($step != 'search') { $start = ($page - 1) * $db_perpage; $limit = pwLimit($start, $db_perpage); } $catedb = array(); $query = $db->query("SELECT pv.tid,t.fid,t.subject,t.author,t.authorid,t.postdate FROM {$pcvaluetable} pv LEFT JOIN pw_threads t ON pv.tid=t.tid WHERE 1 AND ifrecycle=0 {$sql} ORDER BY t.postdate DESC {$limit}"); while ($rt = $db->fetch_array($query)) { $rt['postdate'] = get_date($rt['postdate']); $catedb[] = $rt; } } include PrintEot('postcate'); exit; } elseif ($_POST['sendmsg'] || $action == 'sendmsg') { InitGP(array('step', 'nexto'));
$newtiddb[] = $value; } } if (count($newtiddb) > 0) { $db->update("DELETE FROM {$tablename} WHERE tid IN(" . S::sqlImplode($newtiddb) . ") AND ifrecycle=0"); } is_array($threadb) && ($alltids = implode(',', $threadb)); $count = $db->get_value("SELECT COUNT(tid) as count FROM {$tablename} WHERE ifrecycle=0"); } if ($count > 0) { $page < 1 && ($page = 1); $numofpage = ceil($count / $db_perpage); if ($numofpage && $page > $numofpage) { $page = $numofpage; } $pages = numofpage($count, $page, $numofpage, "{$admin_file}?adminjob=topiccate&action=topic&modelid={$modelid}&newfield={$newfield}&step={$step}&"); if ($step != 'search') { $start = ($page - 1) * $db_perpage; $limit = S::sqlLimit($start, $db_perpage); } $query = $db->query("SELECT tv.tid,t.fid,t.subject,t.author,t.authorid,t.postdate FROM {$tablename} tv LEFT JOIN pw_threads t ON tv.tid=t.tid WHERE 1 AND ifrecycle=0 {$sql} ORDER BY t.postdate DESC {$limit}"); while ($rt = $db->fetch_array($query)) { $rt['postdate'] = get_date($rt['postdate']); $topicdb[] = $rt; } } include PrintEot('topiccate'); exit; } elseif ($_POST['sendmsg'] || $action == 'sendmsg') { S::gp(array('step', 'nexto')); if (empty($step)) {
InitGP(array('page', 'uid'), 'GP', 2); $sqladd = 'WHERE 1'; if ($uid) { $sqladd .= " AND d.uid='{$uid}'"; } elseif ($username) { @extract($db->get_one("SELECT uid FROM pw_members WHERE username="******" AND d.uid=" . pwEscape($uid); } if ($keyword) { $sqladd .= " AND content LIKE " . pwEscape("%{$keyword}%"); } $db_perpage = 15; $page < 1 && ($page = 1); $limit = pwLimit(($page - 1) * $db_perpage, $db_perpage); $rt = $db->get_one("SELECT COUNT(*) AS n FROM pw_draft d {$sqladd}"); $pages = numofpage($rt['n'], $page, ceil($rt['n'] / $db_perpage), "{$basename}&uid={$uid}&keyword=" . rawurlencode($keyword) . "&"); $draft = array(); $query = $db->query("SELECT d.*,m.username FROM pw_draft d LEFT JOIN pw_members m USING(uid) {$sqladd} {$limit}"); while ($rt = $db->fetch_array($query)) { $draft[] = $rt; } include PrintEot('draftset'); exit; } elseif ($action == 'del') { if (!$_POST['step']) { include PrintEot('draftset'); exit; } else { if (GetGP('clear')) { $db->query("TRUNCATE TABLE pw_draft"); } else {
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)) { s::gp(array('keyword', 'page')); $sql = ''; $ids = array(); $keyword && ($sql .= " AND keyword LIKE " . s::sqlEscape("%{$keyword}%")); $count = $db->get_value("SELECT COUNT(*) FROM pw_searchadvert WHERE 1 {$sql}"); $page < 1 && ($page = 1); $limit = pwLimit(($page - 1) * $db_perpage, $db_perpage); $pages = numofpage($count, $page, ceil($count / $db_perpage), "{$basename}&action={$action}&keyword=" . rawurlencode($keyword) . '&'); $query = $db->query("SELECT * FROM pw_searchadvert WHERE 1 {$sql} ORDER BY id DESC {$limit}"); while ($rt = $db->fetch_array($query)) { $rt['keyword'] = str_replace($keyword, '<em class="s1">' . $keyword . '</em>', $rt['keyword']); $rt['endtime'] = get_date($rt['endtime'], 'Y-m-d'); $adverts[$rt['id']] = $rt; } } elseif ($job == 'add') { $advert = array('starttime' => get_date($timestamp, 'Y-m-d'), 'endtime' => get_date($timestamp + 31536000, 'Y-m-d')); $ifshow_Y = 'checked'; $advert['orderby'] = 0; $showddate = ''; } elseif ($job == 'edit') { s::gp(array('id')); $advert = $db->get_one("SELECT * FROM pw_searchadvert WHERE id=" . s::sqlEscape($id)); !$advert && adminmsg('advert_id_error');
if ($dir == 'up') { $message = $messageServer->getGroupUpMessage($userId, $rid); } else { $message = $messageServer->getGroupDownMessage($userId, $rid); } if ($message) { echo "success\t"; } else { echo "over\t"; } ajax_footer(); } $groups = $messageServer->getBlackColony($userId); if (empty($action) || in_array($action, array('all', 'self', 'other'))) { list($today, $yesterday, $tTimes, $yTimes, $mTimes) = getSubListInfo($groupsmsList); $pages = numofpage($groupsmsCount, $page, $pageCount, $url); } if ($subtype == 'groupsms') { $messageServer->resetStatistics(array($userId), 'groupsms_num'); } !defined('AJAX') && (include_once R_P . 'actions/message/ms_header.php'); require messageEot($subtype); if (defined('AJAX')) { ajax_footer(); } else { pwOutPut(); } function getMessageIconTips($value) { global $messageServer, $winduid, $groups; $_txt = $winduid == $value['create_uid'] ? '我发起的' : '我收到的';
} if ($gid) { $sql .= ' AND gid=' . S::sqlEscape($gid); $groupcache = str_replace("<option value=\"{$gid}\">", "<option value=\"{$gid}\" selected>", $groupcache); $pageurl .= "gid={$gid}&"; } else { $sql .= " AND gid>'0'"; } if ($db->server_info() > '4.1') { $count = $db->get_value("SELECT COUNT(*) as count FROM (SELECT fid,gid FROM pw_permission WHERE {$sql} GROUP BY fid,gid) as temp"); } else { $db->query("CREATE TEMPORARY TABLE temp (SELECT fid,gid FROM pw_permission WHERE {$sql} GROUP BY fid,gid)"); $count = $db->get_value("SELECT COUNT(*) AS count FROM temp"); } (!is_numeric($page) || $page < 1) && ($page = 1); $pages = numofpage($count, $page, ceil($count / $db_perpage), "{$basename}&action={$action}&{$pageurl}"); $limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage); $query = $db->query("SELECT fid,gid FROM pw_permission WHERE {$sql} GROUP BY fid,gid {$limit}"); while ($rd = $db->fetch_array($query)) { $g_d[] = $rd; } $jschk = ($fid || $gid) && $pages ? 'true' : 'false'; include PrintEot('singleright'); exit; } elseif ($action == 'setright') { //单用户权限设置 S::gp(array('uid', 'gid', 'fid'), 'GP', 2); $pwuser = S::escapeChar(S::getGP('pwuser')); $jumpurl = "{$basename}&action={$job}"; $f = $db->get_one("SELECT name,type FROM pw_forums WHERE fid=" . S::sqlEscape($fid)); empty($f) && adminmsg('undefined_action', $jumpurl);
<?php !defined('P_W') && exit('Forbidden'); S::gp(array('jobact')); if ("delete" == $jobact) { S::gp(array('stopic_ids')); if (!is_array($stopic_ids) || !count($stopic_ids)) { Showmsg('没选择要删除的专题,请您重试', $stopic_admin_url . "&job={$job}"); } if (!$stopic_service->deleteSTopics($stopic_ids)) { Showmsg('所有信息均未修改,请您重试', $stopic_admin_url . "&job={$job}"); } ObHeader($stopic_admin_url . "&job={$job}"); } else { S::gp(array('page', 'search_title', 'search_cid')); $page = intval($page); $sum = $stopic_service->countSTopic($search_title, $search_cid); $total = ceil($sum / $db_perpage); if ($page <= 0) { $page = 1; } if ($page > $total) { $page = $total; } $pages = numofpage($sum, $page, $total, $stopic_admin_url . "&job={$job}&search_title={$search_title}&search_cid={$search_cid}&"); $stopic_list = $stopic_service->findSTopicInPage($page, $db_perpage, $search_title, $search_cid); $category_list = $stopic_service->getCategorys(); } include stopic_use_layout('admin');
} elseif ($action == 'cate') { require_once R_P . 'require/credit.php'; if (empty($job)) { S::gp(array('ifshow', 'ifhire', 'keyword', 'page')); $pwSQL = ''; if (!empty($ifshow)) { $pwSQL .= $ifshow == 2 ? " AND ifshow=0 " : " AND ifshow=1 "; } if (!empty($ifhire)) { $pwSQL .= $ifhire == 2 ? " AND uid=0 " : "AND uid=1 "; } $keyword && ($pwSQL .= " AND descrip LIKE " . S::sqlEscape("%{$keyword}%")); $count = $db->get_value("SELECT COUNT(*) FROM pw_advert WHERE type=0 {$pwSQL}"); $page < 1 && ($page = 1); $limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage); $pages = numofpage($count, $page, ceil($count / $db_perpage), "{$basename}&action={$action}&ifshow={$ifshow}&ifhire={$ifhire}&keyword=" . rawurlencode($keyword) . "&"); $query = $db->query("SELECT * FROM pw_advert WHERE type=0 {$pwSQL} ORDER BY ifshow DESC,id DESC {$limit}"); while ($rt = $db->fetch_array($query)) { list($rt['name'], $rt['descrip']) = explode("~\t~", $rt['descrip']); $rt['ifhire'] = $rt['uid']; $rt['config'] = unserialize($rt['config']); $catedb[] = $rt; } } elseif ($job == 'edit') { if (empty($_POST['step'])) { S::gp(array('id')); $CreditList = ''; foreach ($credit->cType as $key => $value) { $CreditList .= "<option value=\"{$key}\">{$value}</option>"; } $cate = array();
$forumcache = str_replace("<option value=\"{$fid}\">", "<option value=\"{$fid}\" selected>", $forumcache); } $type_1 = $type_2 = ''; if ($type == 1) { $sqladd .= " AND a.type='img'"; $type_1 = "selected"; } elseif ($type == 2) { $sqladd .= " AND a.type!='img'"; $type_2 = "selected"; } if (empty($action)) { $url = "show.php?uid={$uid}&fid={$fid}&type={$type}&"; (!is_numeric($page) || $page < 1) && ($page = 1); $limit = S::sqlLimit(($page - 1) * $db_showperpage, $db_showperpage); $rt = $db->get_one("SELECT COUNT(*) AS sum FROM pw_attachs a WHERE {$sqladd}"); $pages = numofpage($rt['sum'], $page, ceil($rt['sum'] / $db_showperpage), $url); $pids = $showdb = $ttable_a = $ptable_a = $read = $repost = array(); $query = $db->query("SELECT a.aid,a.uid,a.attachurl,a.type,a.fid,a.tid,a.pid,a.name,a.needrvrc,a.descrip,a.ifthumb FROM pw_attachs a WHERE {$sqladd} ORDER BY aid DESC {$limit}"); while ($rt = $db->fetch_array($query)) { $showdb[] = $rt; if ($rt['pid']) { $pids[] = $rt['pid']; } $ttable_a[GetTtable($rt['tid'])][] = $rt['tid']; } foreach ($ttable_a as $pw_tmsgs => $value) { $value = S::sqlImplode($value); if ($value) { $query = $db->query("SELECT t.tid,t.fid,t.authorid,t.author as username,t.subject,t.ifcheck,t.ifshield,t.ptable,tm.content,tm.buy FROM pw_threads t LEFT JOIN {$pw_tmsgs} tm USING(tid) WHERE t.tid IN({$value})"); while ($rt = $db->fetch_array($query)) { $read[$rt['tid']] = $rt;
$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))) { $basename = 'javascript:history.go(-1);'; adminmsg('operate_error'); } $selid && $db->update("DELETE FROM pw_forumlog WHERE type LIKE 'cy\\_%' AND id IN({$selid})"); adminmsg('operate_success', "{$basename}&action=log"); } } elseif ($action == 'cache') { if (empty($_POST['step'])) { require_once PrintApp('admin'); } elseif ($_POST['step'] == 'updatecache') {
Showmsg('colony_cnmenber'); } if (empty($_POST['operateStep'])) { require_once R_P . 'require/showimg.php'; S::gp(array('group', 'orderby')); $group && ($tmpUrlAdd .= '&group=' . $group); $lang_no_member = array('2' => '没有普通成员', '3' => '没有未验证会员', '4' => '没有最近访客'); $order_lastpost = $order_lastvisit = ''; if ($group && $group == 4) { $visitor = $newColony->getVisitor(); $total = count($visitor); $numofpage = ceil($total / $db_perpage); $numofpage = $db_maxpage && $numofpage > $db_maxpage ? $db_maxpage : $numofpage; $page < 1 ? $page = 1 : ($page > $numofpage ? $page = $numofpage : null); $pageurl = "{$basename}a=member&group=4&"; $pages = numofpage($total, $page, $numofpage, $pageurl, $db_maxpage); $visitor = PwArraySlice($visitor, ($page - 1) * $db_perpage, $db_perpage, true); $visitorids = array_keys($visitor); if ($visitorids) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ foreach ($userService->getByUserIds($visitorids) as $rt) { $rt['lastvisit'] = $visitor[$rt['uid']]; list($rt['icon']) = showfacedesign($rt['icon'], 1); $memdb[] = $rt; } } else { $memdb = array(); } } else { S::gp(array('page'), GP, 2);
} $defaultNum = $typeNumArr[-1] ? $typeNumArr[-1] : 0; $ftypeNumTotal = $defaultNum; foreach ($ftypeData as $val) { $ftypeid[$val['ctid']] = $val['name']; $ftypeNum[$val['ctid']] = $typeNumArr[$val['ctid']] ? $typeNumArr[$val['ctid']] : 0; $ftypeNumTotal = $ftypeNumTotal + $ftypeNum[$val['ctid']]; } foreach ($ftypeid as $k => $v) { $ftypeSelection[$k] = $v; } !$ftype && ($ftype = 'all'); $count = !$type ? $collectionService->countByUid($winduid, $ftype) : $collectionService->countByUidAndType($winduid, $type, $ftype); $page > ceil($count / $db_perpage) && ($page = ceil($count / $db_perpage)); $collectionDb = $count ? !$type ? $collectionService->findByUidInPage($winduid, $page, $db_perpage, $ftype) : $collectionService->findByUidAndTypeInPage($winduid, $type, $page, $db_perpage, $ftype) : array(); $pages = numofpage($count, $page, ceil($count / $db_perpage), "{$basename}type={$type}&ftype={$ftype}&"); } elseif ($a == 'post') { $totalCollection = $collectionService->countByUid($winduid); $totalCollection >= $_G['maxfavor'] && Showmsg('已达到用户组允许的收藏上限'); PostCheck(); S::gp(array('link'), 'P', 1); $link = str_replace('=', '=', $link); !$link && Showmsg('链接地址不能为空'); !preg_match("/^https?\\:\\/\\/.{4,255}\$/i", $link) && Showmsg('mode_share_link_error'); $share['uid'] = $winduid; $share['username'] = $windid; $share['link'] = $link; $parselink = parse_url($link); if (preg_match("/(youku.com|youtube.com|sohu.com|sina.com.cn)\$/i", $parselink['host'], $hosts)) { $hash = getVideo($link, $hosts[1]); if (!empty($hash)) {
$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();
} if ($_POST['step'] == 2) { S::gp(array('delid'), 'P'); empty($delid) && adminmsg("请选择要删除的消息"); $messageServer->manageMessageWithMessageIds($delid); adminmsg('operate_success', "{$url}"); } } elseif ($action == 'msglog') { S::gp(array('smstype', 'keepunread', 'direct', 'page')); $page = intval($page) ? intval($page) : 1; $url = $basename . "&action=msglog&smstype={$smstype}&keepunread={$keepunread}&"; if (empty($_POST['step'])) { $direct = 1; empty($smstype) && adminmsg('类型不能为空'); list($searchCount, $searchList) = $messageServer->manageMessageWithCategory($smstype, $keepunread, $direct, $page, $db_perpage); $pages = numofpage($searchCount, $page, ceil($searchCount / $db_perpage), "{$url}"); if ($direct) { adminmsg('operate_success'); } else { include PrintEot('superdel'); exit; } } elseif ($_POST['step'] == 2) { S::gp(array('delid'), 'P'); empty($delid) && adminmsg("请选择要删除的消息"); $messageServer->manageMessageWithMessageIds($delid); adminmsg('operate_success', "{$url}"); } } } function _delModelTopic($modeldb)
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'); } $db->update("DELETE FROM pw_forumsell WHERE id IN({$selid})");
function getReadContent() { $readdb = array(); $pw_tmsgs = GetTtable($this->tid); $read = $this->db->get_one("SELECT t.*,tm.*,m.uid,m.username,m.oicq,m.groupid,m.memberid,m.icon AS micon ,m.hack,m.honor,m.signature,m.regdate,m.medals,m.userstatus,md.onlinetime,md.postnum,md.digests,md.rvrc,md.money,md.credit,md.currency,md.starttime,md.thisvisit,md.lastvisit,mb.* FROM pw_threads t LEFT JOIN {$pw_tmsgs} tm ON t.tid=tm.tid LEFT JOIN pw_members m ON m.uid=t.authorid LEFT JOIN pw_memberdata md ON md.uid=t.authorid {$this->tablaadd} WHERE t.tid=" . S::sqlEscape($this->tid)); if (!$read || $read['special'] || !$read['ifcheck']) { return false; } $this->fid = $read['fid']; $this->datedir = date('ym', $read['postdate']); if (file_exists(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/{$this->tid}.html")) { P_unlink(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/{$this->tid}.html"); } if (!$this->initForum($this->fid)) { return false; } if ($this->isHideContent($read['content'])) { return false; } $this->setSeosetting(&$read); $this->vars['forumtitle'] = $this->forumtitle; $this->vars['msg_guide'] = $this->guidename . "<em>></em><a href=\"read.php?tid={$this->tid}\">{$read['subject']}</a>"; $this->vars['db_metakeyword'] = $read['subject'] . str_replace(array('|', ' - '), ',', $this->forumtitle) . 'phpwind'; $this->vars['subject'] = $read['subject']; $this->vars['titletop1'] = substrs('Re:' . str_replace(' ', ' ', $read['subject']), L::config('db_titlemax') - 2); $this->vars['hits'] = $read['hits']; $this->vars['replies'] = $read['replies']; $this->vars['tid'] = $this->tid; $this->vars['fid'] = $this->fid; $this->vars['pwforum'] = $this->forum; $this->vars['postUrl'] = 'post.php?fid=' . $this->fid; $_pids = array(); $read['aid'] && ($_pids[] = 0); $count = $read['replies'] + 1; $this->vars['pages'] = numofpage($count, 1, ceil($count / $this->perpage), "{$GLOBALS['db_bbsurl']}/read.php?tid={$this->tid}&"); $read['pid'] = 'tpc'; $readdb[] = $read; if ($read['replies'] > 0) { $readnum = $this->perpage - 1; $pw_posts = GetPtable($read['ptable']); $query = $this->db->query("SELECT t.*,m.uid,m.username,m.oicq,m.groupid,m.memberid,m.icon AS micon,m.hack,m.honor,m.signature,m.regdate,m.medals,m.userstatus,md.onlinetime,md.postnum,md.digests,md.rvrc,md.money,md.credit,md.currency,md.starttime,md.thisvisit,md.lastvisit, mb.* FROM {$pw_posts} t LEFT JOIN pw_members m ON m.uid=t.authorid LEFT JOIN pw_memberdata md ON md.uid=t.authorid {$this->tablaadd} WHERE t.tid=" . S::sqlEscape($this->tid) . " AND ifcheck='1' ORDER BY postdate LIMIT 0,{$readnum}"); while ($read = $this->db->fetch_array($query)) { if ($this->isHideContent($read['content'])) { return false; } $read['aid'] && ($_pids[] = $read['pid']); $readdb[] = $read; } $this->db->free_result($query); } if ($_pids) { $this->attachShow = new attachShow(false); $this->attachShow->init($this->tid, $_pids); } $this->vars['db_menuinit'] = "'td_post' : 'menu_post','td_post1' : 'menu_post','td_hack' : 'menu_hack'"; $bandb = $this->forum->forumBan($readdb); $authorids = array($read['authorid']); $start_limit = 0; foreach ($readdb as $key => $read) { isset($bandb[$read['authorid']]) && ($read['groupid'] = 6); $authorids[] = $read['authorid']; $readdb[$key] = $this->htmread($read, $start_limit++); $this->vars['db_menuinit'] .= ",'td_read_" . $read['pid'] . "':'menu_read_" . $read['pid'] . "'"; } if (L::config('db_showcustom')) { $this->vars['customdb'] = $this->getCustomdb($authorids); } return $readdb; }
//改写通知是否已读状态 $messageServer->markMessage($winduid, $rid); $message['content'] = messageReplace($message['content']); $notReadCount = (int) $messageServer->countNoticesNotRead($winduid); } if ($smstype && in_array($action, array('info', 'next', 'previous'))) { $navtype = $messageServer->getReverseConst($smstype); $navtype = explode('_', $navtype); $nav[$navtype[1]] = 'class = current'; } if (empty($action) || in_array($action, array('unread', 'system', 'postcate', 'active', 'apps', 'comment', 'guestbook'))) { if ($action != 'unread') { $notReadCount = (int) $messageServer->countNoticesNotRead($winduid); list($today, $yesterday, $tTimes, $yTimes, $mTimes) = getSubListInfo($noticeList); } $pages = numofpage($noticeCount, $page, $pageCount, "{$normalUrl}&action={$action}&"); } elseif ($action == 'checkover') { S::gp(array('rid', 'dir'), 'GP'); if ($dir == 'previous') { $message = $messageServer->getUpNotice($winduid, $rid, $smstype); } else { $message = $messageServer->getDownNotice($winduid, $rid, $smstype); } if ($message) { echo "success\t"; } else { echo "over\t"; } ajax_footer(); } $messageServer->resetStatistics(array($winduid), 'notice_num');
S::gp(array('searchName', 'searchUsername', 'page')); $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService*/ //搜索参数 $condtion = array(); //装载搜索条件 if ($searchName) { $condtion['medal_id'] = (int) $searchName; } if ($searchUsername) { $user = $userService->getByUserName($searchUsername); $condtion['uid'] = $user ? $user['uid'] : 0; } (!is_numeric($page) || $page < 1) && ($page = 1); list($medalApply, $medalApplyCount) = $medalService->getApplyMedalUsers($condtion, $page, 20); $pages = numofpage($medalApplyCount, $page, ceil($medalApplyCount / 20), "{$basename}&action=verify&searchName=" . $searchName . "&searchUsername="******"{$basename}&action=verify"); } $result = $val == 1 ? $medalService->adoptApplyMedal($applyid) : $medalService->refuseApplyMedal($applyid); if (!$result) { adminmsg('operate_error', "{$basename}&action=verify"); } adminmsg('operate_success', "{$basename}&action=verify");