function multi($n, $m) { if ($m == 1) { return $n; } return $n + multi($n, $m - 1); }
function main() { global $_G; if ($_GET['onsubmit'] && check()) { foreach ($_GET[ids] as $k => $v) { $id = intval($v); if ($_GET[del][$k] == 0) { continue; } if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) { DB::delete(__CLASS__, "id=" . intval($id)); } } cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__); return false; } $size = 30; $start = ($_G['page'] - 1) * $size; $url = ''; $and = ''; if ($_GET['uid']) { $uid = intval($_GET[uid]); $and .= " AND uid =" . $uid; $url .= "&uid=" . $uid; } if ($_GET['username']) { $username = urldecode_utf8(trim($_GET[username])); $and .= " AND username ='******'"; $url .= "&username="******" AND ip ='" . $ip . "'"; $url .= "&ip=" . $ip; } if ($_GET['jf_down']) { $jf_down = intval($_GET[jf_down]); $and .= " AND org_jf >='" . $jf_down . "'"; $url .= "&jf_down=" . $jf_down; } if ($_GET['jf_up']) { $jf_up = intval($_GET[jf_up]); $and .= " AND org_jf <='" . $jf_up . "'"; $url .= "&jf_up=" . $jf_up; } if ($_GET[type] && array_key_exists($_GET[type], $_G['setting']['jf_type'])) { $type = addslashes(trim($_GET[type])); $and .= " AND type='{$type}'"; $url .= "&type=" . $type; } $sign_list = DB::fetch_all("SELECT * FROM " . DB::table(__CLASS__) . " where 1 {$and} ORDER BY id DESC LIMIT {$start},{$size}"); $count = getcount(__CLASS__, $and); $showpage = multi($count, $size, $_G[page], URL . "m=sign&a=main" . $url); foreach ($sign_list as $k => $v) { $sign_list[$k][username_url] = urlencode_utf8($v[username]); $sign_list[$k][dateline] = dgmdate($v[dateline], 'u'); } $this->add(array('count' => $count, 'sign_list' => $sign_list, 'showpage' => $showpage)); $this->show('sign/main'); }
function viewthread_sidetop_output() { global $_G, $postlist; $aid = $_G['forum_thread']['authorid']; $return = array(); $tid = $_G['tid']; if ($postlist && $aid) { foreach ($postlist as $value) { if ($value['first']) { $amu_query = DB::fetch_first("SELECT SUM(recommends),SUM(recommend_add),SUM(recommend_sub) FROM " . DB::table('forum_thread') . " WHERE authorid='{$aid}'"); $amu_recommends = $amu_query['SUM(recommends)']; $amu_recommend_add = $amu_query['SUM(recommend_add)']; $amu_recommend_sub = $amu_query['SUM(recommend_sub)']; if ($amu_recommend_add || $amu_recommend_sub) { $amu_hpl = round($amu_recommend_add * 100 / ($amu_recommend_add + $amu_recommend_sub), 1); } for ($k = 0; $k < count($this->amu_ranks, 0); $k++) { if ($amu_recommends >= $this->amu_ranks[$k][3] && ($amu_recommends <= $this->amu_ranks[$k][4] || $this->amu_ranks[$k][4] == 0)) { $return[0] = '<dl class="pil">'; if ($this->amu_ranks[$k][4] && $this->vars['showmod'] == 2) { $bilv = '|' . round($amu_recommends * 100 / ($this->amu_ranks[$k][4] + 1), 1) . '%'; $return[0] .= '<dt>' . $this->vars['txt'] . '</dt><dd id="amurecommend_add" onmouseover="showMenu({\'ctrlid\':this.id, \'pos\':\'12\'});">' . $this->amu_ranks[$k][2] . $bilv . '</dd>'; } if ($amu_hpl) { $return[0] .= '<dt>' . $this->vars['txt2'] . '</dt><dd>' . $amu_hpl . '% <span id="amuassess" onmouseover="showMenu({\'ctrlid\':this.id,\'pos\':\'43\'})"><IMG SRC="source/plugin/dsu_amuassess/images/more_' . $this->vars['icon'] . '.png"></span></dd>'; } $return[0] .= '</dl>'; } } } } } $return[0] .= '<div id="amurecommend_add_menu" class="g_up" style="display:none"><div class="crly">帮我升级就点 : <a id="recommend_add2" href="forum.php?mod=misc&action=recommend&do=add&tid=' . $tid . '" onclick="ajaxmenu(this, 3000, 1, 0, \'43\', \'recommendupdate(1)\');return false;">' . $_G['setting']['recommendthread']['addtext'] . '</a> </div><div class="mncr"></div></div>'; $ggprint = array(); $fromfid = (array) unserialize($this->vars['fromfid']); if (count($fromfid, 0) == 1 && $fromfid[0] == '') { $where = ''; } else { $fromfid = array_diff($fromfid, array(null)); $where = ' AND fid IN (' . implode(",", array_unique($fromfid)) . ')'; } if ($aid) { $num = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_thread') . " WHERE authorid = '" . $aid . "' AND recommends > 0" . $where); $page = max(1, intval($_G['gp_page'])); $start_limit = ($page - 1) * 10; $multipage = multi($num, 10, $page, "plugin.php?id=dsu_amuassess:hook&authorid=" . $aid); $sql = "SELECT * FROM " . DB::table('forum_thread') . " WHERE authorid = '" . $aid . "' AND recommends > 0" . $where . " ORDER BY recommends DESC LIMIT " . $start_limit . " , 10"; $querygg = DB::query($sql); $return[0] .= '<div id="amuassess_menu" style="display:none;width:340px;"><div class="crly bm_c"><ol class="xl xl1">'; while ($value = DB::fetch($querygg)) { $return[0] .= '<li><a href="forum.php?mod=viewthread&tid=' . $value['tid'] . '" target="_blank" style="color:#3083C7; white-space:nowrap;">' . cnsubstr($value['subject'], 30) . '</a><em style="position:absolute; width:90px; color:#B7B7B7; text-align:right; height:12px;left:240px;">' . $value['replies'] . '/' . $value['views'] . '</em></li>'; } $return[0] .= '</ol></div></div>'; } return $return; }
function block_sql($paramarr, $multicachekey = '', $returncount = 0) { global $_G, $_SGLOBAL, $_GET, $_SERVER; if (!empty($paramarr['sql'])) { require_once B_ROOT . './source/function/block_sql.func.php'; if ($returncount > 0) { return runsql($paramarr, '', 1); } list($sqlstring, $listcount) = runsql($paramarr, '', 0, $multicachekey); if (!empty($paramarr['perpage'])) { if ($listcount) { $urlarr = $_GET; foreach ($urlarr as $key => $value) { if (empty($value)) { unset($urlarr[$key]); } else { $urlarr[$key] = rawurlencode($urlarr[$key]); } } unset($urlarr['page']); $phpurl = arraytostring($urlarr, '=', '&'); $phpurl = $phpurl ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?' . $phpurl : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_GET['page'], rawurldecode($phpurl), 1); $theblockarr['listcount'] = $listcount; } } } //查詢數據 if ($listcount) { //查詢 $query = DB::query($sqlstring); while ($value = DB::fetch($query)) { if (isset($value['subjectimage'])) { $value['thumb'] = getattachurl($value['subjectimage'], 1); $value['subjectimage'] = getattachurl($value['subjectimage']); } $theblockarr[] = $value; } } return $theblockarr; }
function get_menu_foot($brandresult) { global $_G; $bid = $brandresult['bid']; $tid = $brandresult['tid']; $perpage = 5; $page = intval($_G[sr_page]); $page = max(1, intval($page)); $start = ($page - 1) * $perpage; $start = max(0, $start); require_once libfile('function/discuzcode'); $count = C::t('#sanree_brand#forum_post')->count_by_tid_post(0, $tid); if ($count > 0) { $postthread = C::t('#sanree_brand#forum_post')->fetch_all_by_tid(0, $tid, true, ' desc', ($page - 1) * $perpage, $perpage, 0, 0); foreach ($postthread as $key => $val) { $postthread[$key]['message'] = discuzcode($val['message'], 0, 0, 0, 1); $postthread[$key]['satisfaction'] = C::t('#sanree_brand#sanree_brand_voterlog')->getstar_by_tid_uid($val['authorid'], $tid) * 20; $postthread[$key]['dateline'] = dgmdate($val['dateline']); $postthread[$key]['img'] = avatar($val['authorid'], 'middle', 1); } $murl = $_G['item_detail'] == 'item' ? $is_rewrite ? getburl($brandresult) . '?t' . $extra : getburl($brandresult) . $extra : ($is_rewrite ? getdetailurl($brandresult) . '?t' . $extra : getdetailurl($brandresult) . $extra); $multi = multi($count, $perpage, $page, $murl); } $satisfaction = C::t('#sanree_brand#sanree_brand_voterlog')->getstar_by_tid_uid($_G['uid'], $tid) * 20; $seditor = array('fastpost', array('bold', 'color', 'link', 'quote', 'smilies')); $selfimg = avatar($_G['uid'], 'middle', 1); $wx_prefix = $_G['setting']['attachurl'] . 'category/'; $appVer = $_G['setting']['version']; $dzv = array('X3.2', 'X3.1'); if (in_array($appVer, $dzv)) { list($seccodecheck) = seccheck('publish'); $dzvflag = true; $sectpl = '<div class="rfm"><table><tr><th><sec>: </th><td><span id="sec<hash>" onclick="showMenu({\'ctrlid\':\'sec<hash>\',\'pos\':\'*\'})"><sec></span><br /><div id="sec<hash>_menu" class="p_pop p_opt" style="display:none"><sec></div></td></tr></table></div>'; } else { $seccodecheck = $_G['setting']['seccodestatus'] & 4 && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']); $secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']); $dzvflag = false; } include templateEx($this->_identifier . ':' . $this->_template . '/srfoot'); $GLOBALS['srfoot'] = $srfoot; }
$orderadd = "ORDER BY gender DESC"; break; case 'username': $orderadd = "ORDER BY username DESC"; break; default: $orderadd = 'ORDER BY uid'; $order = 'uid'; break; } $sql = !empty($srchmem) ? " WHERE username LIKE '" . str_replace(array('_', '%'), array('\\_', '\\%'), $srchmem) . "%'" : ''; $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}members {$sql}"); } $page = $membermaxpages && $page > $membermaxpages ? 1 : $page; $start_limit = ($page - 1) * $memberperpage; $multipage = multi($num, $memberperpage, $page, "member.php?action=list&listgid={$listgid}&srchmem=" . rawurlencode($srchmem) . "&order={$order}&type={$type}", $membermaxpages); $memberlist = array(); $query = $db->query("SELECT m.uid, m.username, m.gender, m.email, m.regdate, m.lastvisit, m.posts, m.credits,\r\n\t\tm.showemail{$birthdayadd} FROM {$tablepre}members m\r\n\t\t{$sql} {$orderadd} LIMIT {$start_limit}, {$memberperpage}"); while ($member = $db->fetch_array($query)) { $member['usernameenc'] = rawurlencode($member['username']); $member['regdate'] = gmdate($dateformat, $member['regdate'] + $timeoffset * 3600); $member['lastvisit'] = dgmdate("{$dateformat} {$timeformat}", $member['lastvisit'] + $timeoffset * 3600); $memberlist[] = $member; } include template('memberlist'); } elseif ($action == 'markread') { if ($discuz_user) { $db->query("UPDATE {$tablepre}members SET lastvisit='{$timestamp}' WHERE uid='{$discuz_uid}'"); } showmessage('mark_read_succeed', $indexname); } elseif ($action == 'regverify' && $regverify == 2 && $groupid == 8 && submitcheck('verifysubmit')) {
} if ($count) { loadcache('forums'); $tids = array(); require_once libfile('function/misc'); while ($value = DB::fetch($query)) { if (empty($value['author']) && $value['authorid'] != $_G['uid']) { $hiddennum++; continue; } $tids[$value['tid']] = $value['tid']; $list[$value['tid']] = procthread($value); } if ($tids) { $query = DB::query("SELECT * FROM " . DB::table('forum_poll') . " WHERE tid IN(" . dimplode($tids) . ")"); while ($value = DB::fetch($query)) { $value['pollpreview'] = explode("\t", trim($value['pollpreview'])); $list[$value['tid']]['poll'] = $value; } } $multi = multi($count, $perpage, $page, $theurl); } if ($_G['uid']) { $_G['gp_view'] = !$_G['gp_view'] ? 'we' : $_G['gp_view']; $navtitle = lang('core', 'title_' . $_G['gp_view'] . '_poll'); } else { $_G['gp_order'] = !$_G['gp_order'] ? 'dateline' : $_G['gp_order']; $navtitle = lang('core', 'title_' . $_G['gp_order'] . '_poll'); } $actives = array($_GET['view'] => ' class="a"'); include_once template("diy:home/space_poll");
$contents[] = $value; } if (empty($contents)) { C::t('portal_article_content')->update($aid, array('showinnernav' => '0')); } } require_once libfile('function/blog'); $content['content'] = blog_bbcode($content['content']); if (!empty($_G['setting']['makehtml']['flag']) && $article['htmlmade']) { $_caturl = $_G['cache']['portalcategory'][$cat['topid']]['domain'] ? $_G['cache']['portalcategory'][$cat['topid']]['caturl'] : ''; $viewurl = $_caturl . $article['htmldir'] . $article['htmlname'] . '{page}.' . $_G['setting']['makehtml']['extendname']; unset($_caturl); } else { $viewurl = "portal.php?mod=view&aid={$aid}"; } $multi = multi($article['contents'], 1, $page, $viewurl); $org = array(); if ($article['idtype'] == 'tid' || $content['idtype'] == 'pid') { $thread = $firstpost = array(); require_once libfile('function/discuzcode'); require_once libfile('function/forum'); $thread = get_thread_by_tid($article[id]); if (!empty($thread)) { if ($content['idtype'] == 'pid') { $firstpost = C::t('forum_post')->fetch($thread['posttableid'], $content['id']); } else { $firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($article['id']); } if ($firstpost && $firstpost['tid'] == $article['id']) { $firstpost['uid'] = $firstpost['authorid']; $firstpost['username'] = $firstpost['author'];
DB::query("UPDATE " . DB::table('common_report') . " SET opuid='{$_G['uid']}', opname='{$_G['username']}', optime='" . TIMESTAMP . "', opresult='{$opresult}' WHERE id='{$reportid}'"); } } showmessage('modcp_report_success', "{$cpscript}?mod=modcp&action=report&fid={$_G['fid']}&lpp={$lpp}"); } } $rewardlist = ''; $report_reward = unserialize($_G['setting']['report_reward']); $offset = abs(ceil(($report_reward['max'] - $report_reward['min']) / 10)); if ($report_reward['max'] > $report_reward['min']) { for ($vote = $report_reward['max']; $vote >= $report_reward['min']; $vote -= $offset) { if ($vote != 0) { $rewardlist .= $vote ? '<option value="' . $vote . '">' . ($vote > 0 ? '+' . $vote : $vote) . '</option>' : ''; } else { $rewardlist .= '<option value="0" selected>' . lang('forum/misc', 'report_noreward') . '</option>'; } } } $reportlist = array(); $lpp = empty($_G['gp_lpp']) ? 20 : intval($_G['gp_lpp']); $lpp = min(200, max(5, $lpp)); $page = max(1, intval($_G['page'])); $start = ($page - 1) * $lpp; $reportcount = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_report') . " WHERE opuid=0 AND fid='{$_G['fid']}'"); $query = DB::query("SELECT * FROM " . DB::table('common_report') . " WHERE opuid=0 AND fid='{$_G['fid']}' ORDER BY num DESC, dateline DESC LIMIT {$start}, {$lpp}"); while ($row = DB::fetch($query)) { $row['dateline'] = dgmdate($row['dateline']); $reportlist[] = $row; } $multipage = multi($reportcount, $lpp, $page, "{$cpscript}?mod=modcp&action=report&fid={$_G['fid']}&lpp={$lpp}"); }
$error = 'share_mod_range_illegal'; } if (!$error) { if ($detail) { $_G['gp_perpage'] = intval($_G['gp_perpage']) < 1 ? 20 : intval($_G['gp_perpage']); $perpage = $_G['gp_pp'] ? $_G['gp_pp'] : $_G['gp_perpage']; $query = DB::query("SELECT * FROM " . DB::table('home_share') . " s WHERE 1 {$sql} ORDER BY s.dateline DESC LIMIT " . ($page - 1) * $perpage . ",{$perpage}"); $shares = ''; require_once libfile('function/share'); while ($share = DB::fetch($query)) { $share['dateline'] = dgmdate($share['dateline']); $share = mkshare($share); $shares .= showtablerow('', '', array("<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$share['sid']}\" />", "<a href=\"home.php?mod=space&uid={$share['uid']}\" target=\"_blank\">" . $share['username'] . "</a>", $share['title_template'], $share['body_template'], $share['type'], $share['dateline']), TRUE); } $sharecount = DB::result_first("SELECT count(*) FROM " . DB::table('home_share') . " s WHERE 1 {$sql}"); $multi = multi($sharecount, $perpage, $page, ADMINSCRIPT . "?action=share"); $multi = preg_replace("/href=\"" . ADMINSCRIPT . "\\?action=share&page=(\\d+)\"/", "href=\"javascript:page(\\1)\"", $multi); $multi = str_replace("window.location='" . ADMINSCRIPT . "?action=share&page='+this.value", "page(this.value)", $multi); } else { $sharecount = 0; $query = DB::query("SELECT s.sid FROM " . DB::table('home_share') . " s WHERE 1 {$sql}"); while ($share = DB::fetch($query)) { $sids .= ',' . $share['sid']; $sharecount++; } $multi = ''; } if (!$sharecount) { $error = 'share_post_nonexistence'; } }
} $wheresql = "albumid='{$albumid}'"; $count = $albumlist[$albumid]['picnum']; } else { $wheresql = "albumid='0' AND uid='{$space['uid']}'"; } $list = array(); if ($count) { $query = DB::query("SELECT * FROM " . DB::table('home_pic') . " WHERE {$wheresql} ORDER BY dateline DESC LIMIT {$start},{$perpage}"); while ($value = DB::fetch($query)) { $value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']); $list[] = $value; } } $_G['gp_ajaxtarget'] = empty($_G['gp_ajaxtarget']) ? 'diyimages' : $_G['gp_ajaxtarget']; $multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=index&op=image&albumid={$albumid}"); } elseif ($op == 'getblock') { $blockname = getstr($_GET['blockname'], 15); $blockhtml = ''; if (check_ban_block($name, $space)) { space_merge($space, 'field_home'); $data = getuserdiydata($space); $blockhtml = getblockhtml($blockname, $data['parameters'][$blockname]); } } elseif ($op == 'edit') { $blockname = getstr($_GET['blockname'], 15); $blockdata = lang('space', 'blockdata'); if (!empty($blockdata[$blockname]) && check_ban_block($blockname, $space)) { space_merge($space, 'field_home'); $userdiy = getuserdiydata($space); $para = $userdiy['parameters'][$blockname];
} else { $tplinfo = block_getdiyurl($value['targettplname']); if ($tplinfo['url']) { $value['url'] = lang('portal/template', 'block_view_link', array('url' => $tplinfo['url'])); } else { $value['url'] = lang('portal/template', 'block_unused'); } } $value['name'] = empty($value['name']) ? '#' . $value['bid'] : trim($value['name']); $theclass = block_getclass($value['blockclass']); $value['datasrc'] = $theclass['script'][$value['script']]; $value['allowdata'] = checkperm('allowdiy') || $permission[$value['bid']]['allowdata'] ? true : false; $value['allowsetting'] = checkperm('allowdiy') || $permission[$value['bid']]['allowsetting'] ? true : false; $blocks[] = $value; } $multi = multi($count, $perpage, $page, "portal.php?mod=portalcp&ac=portalblock"); } $language = lang('portal/template'); $navtitle = $language['block_management'] . ' - ' . $language['portal_management']; include_once template("portal/portalcp_portalblock"); function getallowblock($uid) { if (empty($uid)) { return false; } $uid = max(0, intval($uid)); $query = DB::query('SELECT * FROM ' . DB::table('common_block_permission') . " WHERE uid='{$uid}'"); $permission = array(); while ($value = DB::fetch($query)) { if ($value['allowdata'] || $value['allowsetting']) { $permission[$value['bid']] = $value;
$joins[$value['uid']] = $value['uid']; } //是否邀请 $query = $_SGLOBAL['db']->query("SELECT uid FROM ".tname('mtaginvite')." WHERE tagid='$tagid' AND uid IN (".simplode($fuids).")"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $joins[$value['uid']] = $value['uid']; } realname_get(); //用户组 $groups = getfriendgroup(); $groupselect = array($_GET['group'] => ' selected'); $multi = multi($count, $perpage, $page, "cp.php?ac=mtag&op=manage&tagid=$mtag[tagid]&subop=invite&group=$_GET[group]&key=$_GET[key]"); } else { //显示 include_once(S_ROOT.'./source/function_bbcode.php'); $mtag['announcement'] = html2bbcode($mtag['announcement']); $joinperms = array($mtag['joinperm'] => ' selected'); $viewperms = array($mtag['viewperm'] => ' selected'); $threadperms = array($mtag['threadperm'] => ' selected'); $postperms = array($mtag['postperm'] => ' selected'); $closeapply = array($mtag['closeapply'] => ' checked'); } $actives = array($_GET['subop'] => ' class="active"');
showmessage('attachmenttype_update_success', $newurl); } } //GET METHOD $addclass = $viewclass = ''; if (empty($_GET['op'])) { //LIST VIEW $wheresqlarr = array(); $wheresqlstr = getwheresql($wheresqlarr); $query = $_SGLOBAL['db']->query('SELECT COUNT(*) FROM ' . tname('attachmenttypes') . ' WHERE ' . $wheresqlstr); $listcount = $_SGLOBAL['db']->result($query, 0); $multipage = ''; if ($listcount) { $plussql = 'LIMIT ' . $start . ',' . $perpage; $listarr = selecttable('attachmenttypes', array(), $wheresqlarr, $plussql); $multipage = multi($listcount, $perpage, $page, $theurl); } $viewclass = ' class="active"'; } elseif ($_GET['op'] == 'edit') { //ONE VIEW FOR UPDATE $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('attachmenttypes') . ' WHERE id=\'' . $_GET['id'] . '\''); if ($thevalue = $_SGLOBAL['db']->fetch_array($query)) { $thevalue['maxsize'] = $thevalue['maxsize'] / 1024; } } elseif ($_GET['op'] == 'add') { //ONE ADD $thevalue = array('id' => 0, 'fileext' => '', 'maxsize' => '512'); $addclass = ' class="active"'; } elseif ($_GET['op'] == 'delete') { //ONE DELETE $_GET['id'] = intval($_GET['id']);
function block_uchspace($paramarr) { global $_SGLOBAL, $_SC, $_SGET; dbconnect(2); if (empty($paramarr['sql'])) { $sql = array(); $sql['select'] = 'SELECT s.*'; $sql['from'] = 'FROM ' . tname('space', '2') . ' s'; if (!empty($paramarr['showdetail'])) { $sql['select'] = 'SELECT sf.*, s.*'; $sql['from'] .= ' LEFT JOIN ' . tname('spacefield', '2') . ' sf ON sf.uid=s.uid'; } $wherearr = array(); //where if (!empty($paramarr['uid'])) { $paramarr['uid'] = getdotstring($paramarr['uid'], 'int'); if ($paramarr['uid']) { $wherearr[] = 's.uid IN (' . $paramarr['uid'] . ')'; } } else { if (!empty($paramarr['avatar'])) { if ($paramarr['avatar'] == 1) { $wherearr[] = 's.avatar = 0'; } else { $wherearr[] = 's.avatar = 1'; } } $scopequery = getscopequery('s', 'viewnum', $paramarr); if (!empty($scopequery)) { $wherearr[] = $scopequery; } $scopequery = getscopequery('s', 'friendnum', $paramarr); if (!empty($scopequery)) { $wherearr[] = $scopequery; } } $sql['where'] = ''; if (!empty($wherearr)) { $sql['where'] = 'WHERE ' . implode(' AND ', $wherearr); } //order if (!empty($paramarr['order'])) { $sql['order'] = 'ORDER BY ' . $paramarr['order']; } //limit if (!empty($paramarr['perpage'])) { $paramarr['perpage'] = intval($paramarr['perpage']); if (empty($paramarr['perpage'])) { $paramarr['perpage'] = 20; } if (empty($_SGET['page'])) { $_SGET['page'] = 1; } $_SGET['page'] = intval($_SGET['page']); if ($_SGET['page'] < 1) { $_SGET['page'] = 1; } $start = ($_SGET['page'] - 1) * $paramarr['perpage']; $sql['limit'] = 'LIMIT ' . $start . ',' . $paramarr['perpage']; } else { if (empty($paramarr['limit'])) { $sql['limit'] = 'LIMIT 0,1'; } else { $paramarr['limit'] = getdotstring($paramarr['limit'], 'int', true, array(), 1, false); if ($paramarr['limit']) { $sql['limit'] = 'LIMIT ' . $paramarr['limit']; } else { $sql['limit'] = 'LIMIT 0,1'; } } } //query $sqlstring = implode(' ', $sql); //multi $listcount = 1; if (!empty($paramarr['perpage'])) { $listcount = $_SGLOBAL['db_uch']->result($_SGLOBAL['db_uch']->query('SELECT COUNT(*) FROM ' . tname('space', '2') . ' ' . $sql['where']), 0); if ($listcount) { $urlarr = $_SGET; unset($urlarr['page']); $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_SGET['page'], $urlarr, 0); } } } else { $uchdb = $_SGLOBAL['db_uch']; include_once S_ROOT . './function/block_sql.func.php'; list($sqlstring, $listcount) = runsql($paramarr, $uchdb); if (!empty($paramarr['perpage'])) { if ($listcount) { $urlarr = $_SGET; unset($urlarr['page']); $theblockarr['multipage'] = multi($listcount, $paramarr['perpage'], $_SGET['page'], $urlarr, 0); } } } //查询数据 if ($listcount) { //预处理 include_once S_ROOT . './uc_client/client.php'; //查询 $query = $_SGLOBAL['db_uch']->query($sqlstring); while ($value = $_SGLOBAL['db_uch']->fetch_array($query)) { //头像处理 $value['avatarflash'] = uc_avatar($_SGLOBAL['supe_uid']); $theblockarr[] = $value; } } return $theblockarr; }
showmessage('activity_cancel_success', "forum.php?mod=viewthread&tid={$_G['tid']}&do=viewapplylist" . ($_GET['from'] ? '&from=' . $_GET['from'] : ''), array(), array('showdialog' => 1, 'closetime' => true)); } } elseif ($_GET['action'] == 'getactivityapplylist') { $pp = $_G['setting']['activitypp']; $page = max(1, $_G['page']); $start = ($page - 1) * $pp; $activity = C::t('forum_activity')->fetch($_G['tid']); if (!$activity || $thread['special'] != 4) { showmessage('undefined_action'); } $query = C::t('forum_activityapply')->fetch_all_for_thread($_G['tid'], $start, $pp); foreach ($query as $activityapplies) { $activityapplies['dateline'] = dgmdate($activityapplies['dateline']); $applylist[] = $activityapplies; } $multi = multi($activity['applynumber'], $pp, $page, "forum.php?mod=misc&action=getactivityapplylist&tid={$_G['tid']}&pid={$_GET['pid']}"); include template('forum/activity_applist_more'); } elseif ($_GET['action'] == 'activityapplylist') { $isactivitymaster = $thread['authorid'] == $_G['uid'] || (in_array($_G['group']['radminid'], array(1, 2)) || $_G['group']['radminid'] == 3 && $_G['forum']['ismoderator'] && $_G['group']['alloweditactivity']); if (!$isactivitymaster) { showmessage('activity_is_not_manager'); } $activity = C::t('forum_activity')->fetch($_G['tid']); if (empty($activity) || $thread['special'] != 4) { showmessage('activity_is_not_exists'); } if (!submitcheck('applylistsubmit')) { $applylist = array(); $activity['ufield'] = $activity['ufield'] ? dunserialize($activity['ufield']) : array(); $query = C::t('forum_activityapply')->fetch_all_for_thread($_G['tid'], 0, 500, $_GET['uid'], $isactivitymaster); foreach ($query as $activityapplies) {
} if (in_array('refreshdate', $u_lists)) { $itemstr .= "<td class=\"item\">{$refreshdatestr}</td>\n"; } if (in_array('enddate', $u_lists)) { $itemstr .= "<td class=\"item\">{$enddatestr}</td>\n"; } if (in_array('storage', $u_lists)) { $itemstr .= "<td class=\"item\">{$storagestr}</td>\n"; } $itemstr .= "<td class=\"item\">{$opricestr}</td>\n"; $itemstr .= "<td class=\"item\">{$adminstr}</td>\n"; $itemstr .= "</tr>\n"; } $counts = $db->result_one("SELECT count(*) {$fromsql} {$wheresql}"); $multi = multi($counts, $mrowpp, $page, "?action=offers{$filterstr}"); echo $itemstr; tabfooter(); echo $multi; //操作区 tabheader(lang('operateitem')); $s_arr = array(); if (empty($u_operates) || in_array('readd', $u_operates)) { $s_arr['readd'] = lang('readd'); } if (empty($u_operates) || in_array('delete', $u_operates)) { $s_arr['delete'] = lang('delete'); } if ($s_arr) { $soperatestr = ''; foreach ($s_arr as $k => $v) {
} if (!empty($dateline) && $dateline != 'all') { $sqlwhere .= " AND s.dateline>'" . (TIMESTAMP - $dateline) . "'"; } if (!empty($_GET['keyword'])) { $keyword = str_replace(array('%', '_'), array('\\%', '\\_'), $_GET['keyword']); $sqlwhere .= " AND s.body_general LIKE '%{$keyword}%'"; } $modcount = C::t('common_moderate')->count_by_search_for_share($moderatestatus, $_GET['username'], $dateline && $dateline != 'all' ? TIMESTAMP - $dateline : null, $_GET['keyword']); do { $start_limit = ($pagetmp - 1) * $tpp; $sharearr = C::t('common_moderate')->fetch_all_by_search_for_share($moderatestatus, $_GET['username'], $dateline && $dateline != 'all' ? TIMESTAMP - $dateline : null, $_GET['keyword'], $start_limit, $tpp); $pagetmp = $pagetmp - 1; } while ($pagetmp > 0 && empty($sharearr)); $page = $pagetmp + 1; $multipage = multi($modcount, $tpp, $page, ADMINSCRIPT . "?action=moderate&operation=shares&filter={$filter}&dateline={$_GET['dateline']}&username={$_GET['username']}&keyword={$_GET['keyword']}&tpp={$tpp}&showcensor={$showcensor}"); echo '<p class="margintop marginbot"><a href="javascript:;" onclick="expandall();">' . cplang('moderate_all_expand') . '</a> <a href="javascript:;" onclick="foldall();">' . cplang('moderate_all_fold') . '</a></p>'; showtableheader(); $censor =& discuz_censor::instance(); $censor->highlight = '#FF0000'; require_once libfile('function/misc'); foreach ($sharearr as $share) { $short_desc = cutstr($share['body_general'], 30); $share['dateline'] = dgmdate($share['dateline']); if ($showcensor) { $censor->check($short_desc); $censor->check($share['body_general']); } $share_censor_words = $censor->words_found; if (count($share_censor_words) > 3) { $share_censor_words = array_slice($share_censor_words, 0, 3);
$f_index = 'USE INDEX(dateline)'; $actives = array('we' => ' class="active"'); } //类型 if ($_GET['type']) { $sub_actives = array('type_' . $_GET['type'] => ' class="active"'); $wheresql .= " AND type='{$_GET['type']}'"; } else { $sub_actives = array('type_all' => ' class="active"'); } $list = array(); $sid = empty($_GET['sid']) ? 0 : intval($_GET['sid']); $sharesql = $sid ? "sid='{$sid}' AND" : ''; $count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('share') . " WHERE {$sharesql} {$wheresql}"), 0); //update statistics if (empty($sharesql) && $wheresql == "uid='{$space['uid']}'" && $space['sharenum'] != $count) { updatetable('space', array('sharenum' => $count), array('uid' => $space['uid'])); } if ($count) { $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('share') . " {$f_index}\r\n\t\t\tWHERE {$sharesql} {$wheresql}\r\n\t\t\tORDER BY dateline DESC\r\n\t\t\tLIMIT {$start},{$perpage}"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['uid'], $value['username']); $value = mkshare($value); $list[] = $value; } } // pagination $multi = multi($count, $perpage, $page, $theurl . "&type={$_GET['type']}"); realname_get(); include_once template("space_share_list"); }
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}rewardlog WHERE answererid='{$discuz_uid}'"); $multipage = multi($db->result($query, 0), $tpp, $page, "memcp.php?action=creditslog&operation=incomelog"); $loglist = array(); $query = $db->query("SELECT r.*, m.uid, m.username, f.fid, f.name, t.subject, t.price FROM {$tablepre}rewardlog r\r\n\t\t\tLEFT JOIN {$tablepre}threads t ON t.tid=r.tid\r\n\t\t\tLEFT JOIN {$tablepre}forums f ON f.fid=t.fid\r\n\t\t\tLEFT JOIN {$tablepre}members m ON m.uid=r.authorid\r\n\t\t\tWHERE r.answererid='{$discuz_uid}' and r.authorid>0 ORDER BY r.dateline DESC\r\n\t\t\tLIMIT {$start_limit}, {$tpp}"); while ($log = $db->fetch_array($query)) { $log['dateline'] = dgmdate("{$dateformat} {$timeformat}", $log['dateline'] + $timeoffset * 3600); $log['price'] = abs($log['price']); $loglist[] = $log; } include template('memcp_credits_log'); } else { $operation = 'creditslog'; $page = max(1, intval($page)); $start_limit = ($page - 1) * $tpp; $query = $db->query("SELECT COUNT(*) FROM {$tablepre}creditslog WHERE uid='{$discuz_uid}'"); $multipage = multi($db->result($query, 0), $tpp, $page, "memcp.php?action=creditslog&operation=creditslog"); $loglist = array(); $query = $db->query("SELECT * FROM {$tablepre}creditslog WHERE uid='{$discuz_uid}' ORDER BY dateline DESC LIMIT {$start_limit}, {$tpp}"); while ($log = $db->fetch_array($query)) { $log['fromtoenc'] = rawurlencode($log['fromto']); $log['dateline'] = dgmdate("{$dateformat} {$timeformat}", $log['dateline'] + $timeoffset * 3600); $loglist[] = $log; } include template('memcp_credits_log'); } } elseif ($action == 'usergroups') { require_once DISCUZ_ROOT . './include/forum.func.php'; // if(!$allowmultigroups) { // showmessage('group_nopermission', NULL, 'NOPERM'); // } $switchmaingroup = $grouppublic || $grouptype == 'member' ? 1 : 0;
showsubmit('searchsubmit'); showtablefooter(); showformfooter(); showtagfooter('div'); if (submitcheck('searchsubmit')) { $security = $secStatus && $security; if ($security) { $postlistcount = C::t('#security#security_evilpost')->count_by_search($posttableid, null, $keywords, -5, $inforum, null, $authors ? explode(',', str_replace(' ', '', $authors)) : null, strtotime($pstarttime), strtotime($pendtime)); } else { $postlistcount = C::t('forum_post')->count_by_search($posttableid, null, $keywords, -5, $inforum, null, $authors ? explode(',', str_replace(' ', '', $authors)) : null, strtotime($pstarttime), strtotime($pendtime)); } showtagheader('div', 'postlist', $searchsubmit); showformheader('recyclebinpost&operation=search&frame=no', 'target="rbframe"', 'rbform'); showtableheader(cplang('recyclebinpost_result') . ' ' . $postlistcount . ' <a href="#" onclick="$(\'postlist\').style.display=\'none\';$(\'postsearch\').style.display=\'\';" class="act lightlink normal">' . cplang('research') . '</a>', 'fixpadding'); if ($postlistcount && recyclebinpostshowpostlist($inforum, $authors, $pstarttime, $pendtime, $keywords, $start_limit, $lpp)) { $multi = multi($postlistcount, $lpp, $page, ADMINSCRIPT . "?action=recyclebinpost"); $multi = preg_replace("/href=\"" . ADMINSCRIPT . "\\?action=recyclebinpost&page=(\\d+)\"/", "href=\"javascript:page(\\1)\"", $multi); $multi = str_replace("window.location='" . ADMINSCRIPT . "?action=recyclebinpost&page='+this.value", "page(this.value)", $multi); } showsubmit('rbsubmit', 'submit', '', '<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'delete\')">' . cplang('recyclebin_all_delete') . '</a> <a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'undelete\')">' . cplang('recyclebin_all_undelete') . '</a> <a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'ignore\')">' . cplang('recyclebin_all_ignore') . '</a> ', $multi); showtablefooter(); showformfooter(); echo '<iframe name="rbframe" style="display:none"></iframe>'; showtagfooter('div'); } } elseif ($operation == 'clean') { if (!submitcheck('cleanrbsubmit', 1)) { shownav('topic', 'nav_recyclebinpost'); showsubmenu('nav_recyclebinpost', array(array('recyclebinpost_list', 'recyclebinpost', 0), array('search', 'recyclebinpost&operation=search', 0), array('clean', 'recyclebinpost&operation=clean', 1))); showformheader('recyclebinpost&operation=clean'); showtableheader('recyclebinpost_clean');
$page = max(1, $_G['gp_page']); $start_limit = ($page - 1) * $perpage; $aid = intval($_G['gp_aid']); $photolist = array(); $count = DB::result_first("SELECT picnum FROM " . DB::table('home_album') . " WHERE albumid='{$aid}' AND uid='{$_G['uid']}'"); $query = DB::query("SELECT * FROM " . DB::table('home_pic') . " WHERE albumid='{$aid}' AND uid='{$_G['uid']}' ORDER BY dateline DESC LIMIT {$start_limit},{$perpage}"); while ($value = DB::fetch($query)) { $value['bigpic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote'], 0); $value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']); $value['count'] = $count; $value['url'] = (substr(strtolower($value['bigpic']), 0, 7) == 'http://' ? '' : $_G['siteurl']) . $value['bigpic']; $value['thumburl'] = (substr(strtolower($value['pic']), 0, 7) == 'http://' ? '' : $_G['siteurl']) . $value['pic']; $photolist[] = $value; } $_G['gp_ajaxtarget'] = 'albumphoto'; $multi = multi($count, $perpage, $page, "forum.php?mod=post&action=albumphoto&aid={$aid}"); include template('forum/ajax_albumlist'); exit; } elseif ($_G['forum']['simple'] & 1 || $_G['forum']['redirect']) { showmessage('forum_disablepost'); } require_once libfile('function/discuzcode'); $space = array(); space_merge($space, 'field_home'); if ($_G['gp_action'] == 'reply') { $addfeedcheck = !empty($space['privacy']['feed']['newreply']) ? 'checked="checked"' : ''; } else { $addfeedcheck = !empty($space['privacy']['feed']['newthread']) ? 'checked="checked"' : ''; } $navigation = $navtitle = $homedo = ''; if (!empty($_G['gp_cedit'])) {
echo "<tr><td class=\"txt txtleft\">"; echo lang('search_keyword') . " <input class=\"text\" name=\"keyword\" type=\"text\" value=\"{$keyword}\" size=\"10\"> "; echo strbutton('bfilter', 'filter0'); echo "</td></tr>"; tabfooter(); $pagetmp = $page; do { $query = $db->query("SELECT * {$fromsql} {$wheresql} ORDER BY ename LIMIT " . ($pagetmp - 1) * $atpp . ",{$atpp}"); $pagetmp--; } while (!$db->num_rows($query) && $pagetmp); $itemstr = ''; while ($item = $db->fetch_array($query)) { $itemstr .= "<tr class=\"txt\"><td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$item['ename']}]\" value=\"{$item['ename']}\">\n" . "<td class=\"txtL\">{$item['ename']}</td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"80\" name=\"alangsnew[{$item['ename']}][content]\" value=\"" . htmlspecialchars($item['content']) . "\"></td>\n" . "<td class=\"txtC w40\"><a href=\"?entry=alangs&action=alangdetail&ename={$item['ename']}\">" . lang('edit') . "</a></td>\n" . "</tr>\n"; } $counts = $db->result_one("SELECT count(*) {$fromsql} {$wheresql}"); $multi = multi($counts, $atpp, $page, "?entry=alangs&action=alangsedit{$filterstr}"); tabheader(lang('alang_admin') . " >><a href=\"?entry=alangs&action=alangadd\">" . lang('add_alang') . '</a>', '', '', 7); trcategory(array("<input class=\"checkbox\" type=\"checkbox\" name=\"chkall\" onclick=\"checkall(this.form, 'delete', 'chkall')\">" . lang('del'), lang('ename'), lang('remark'), lang('detail'))); echo $itemstr; tabfooter(); echo $multi; echo "<input class=\"button\" type=\"submit\" name=\"balangsedit\" value=\"" . lang('submit') . "\"></form>\n"; } else { if (!empty($delete)) { foreach ($delete as $k) { $db->query("DELETE FROM {$tblprefix}alangs WHERE ename='{$k}'"); unset($alangsnew[$k]); } } if (!empty($alangsnew)) { $tmp = ",createdate='{$timestamp}'";
$wheresql = "WHERE cu.mid={$memberid} AND cu.oid>0"; $keyword && ($wheresql .= " AND a.subject LIKE '%" . str_replace(array(' ', '*'), '%', addcslashes($keyword, '%_')) . "%'"); echo form_str($action . 'arcsedit', "?action={$action}&page={$page}"); tabheader_e(); echo "<tr><td class=\"item2\">"; echo lang('keyword') . " <input class=\"text\" name=\"keyword\" type=\"text\" value=\"{$keyword}\" style=\"vertical-align: middle;\"> "; echo strbutton('bfilter', 'filter0') . '</td></tr>'; tabfooter(); $pagetmp = $page; do { $query = $db->query("SELECT cu.*,cu.createdate AS ucreatedate,a.sid,a.createdate,a.caid,a.chid,a.customurl,a.subject AS asubject FROM {$tblprefix}purchases cu LEFT JOIN {$tblprefix}archives a ON (a.aid=cu.aid) {$wheresql} ORDER BY cu.cid DESC LIMIT " . ($pagetmp - 1) * $mrowpp . ",{$mrowpp}"); $pagetmp--; } while (!$db->num_rows($query) && $pagetmp); $itemstr = ''; $i = $pagetmp * $mrowpp; while ($item = $db->fetch_array($query)) { $i++; $item['arcurl'] = view_arcurl($item); $item['catalog'] = empty($catalogs[$item['caid']]) ? lang('nocata') : $catalogs[$item['caid']]['title']; $item['createdate'] = date("{$dateformat}", $item['ucreatedate']); $item['checkedstr'] = $item['oid'] ? 'Y' : '-'; $item['orderstr'] = $item['oid'] ? "<a href=\"?action=orders&oid={$item['oid']}\">" . lang('look') . "</a>" : '-'; $itemstr .= "<tr><td class=\"item\" width=\"30\">{$i}</td>\n" . "<td class=\"item2\"><a href=\"{$item['arcurl']}\" target=\"_blank\">" . mhtmlspecialchars($item['asubject']) . "</a></td>\n" . "<td class=\"item\" width=\"80\">{$item['catalog']}</td>\n" . "<td class=\"item\" width=\"40\">{$item['nums']}</td>\n" . "<td class=\"item\" width=\"40\">{$item['price']}</td>\n" . "<td class=\"item\" width=\"40\">{$item['orderstr']}</td>\n" . "<td class=\"item\" width=\"100\">{$item['createdate']}</td></tr>\n"; } $counts = $db->result_one("SELECT count(*) FROM {$tblprefix}purchases cu LEFT JOIN {$tblprefix}archives a ON (a.aid=cu.aid) {$wheresql}"); $multi = multi($counts, $mrowpp, $page, "?action=purchases{$filterstr}"); tabheader(lang('purchasedgoodslist'), '', '', 9); trcategory(array(lang('sn'), array(lang('goodscname'), 'left'), lang('catalog'), lang('amount'), lang('price'), lang('orders'), lang('purchasedate'))); echo $itemstr; tabfooter(); echo $multi;
function ac_index() { $q = request('q', ''); $tid = request('tid', ''); $page = request('page', ''); $q = strip_tags($q); $page = is_numeric($page) ? $page : 0; //出去空格判断长度 $key = str_replace(' ', '', $q); if ($key == '' || strlen($key) < 4 || strlen($key) > 80) { ShowMsg("关键字长度必须要4-80字节之间!", "index.php"); exit; } $ks = explode(' ', $q); $kwsql = ''; $kwsqls = array(); foreach ($ks as $k) { $k = trim($k); $k = addslashes($k); $kwsqls[] = " title LIKE '%{$k}%' "; } if (isset($kwsqls[0])) { $kwsql = join(' OR ', $kwsqls); } $row = $this->dsql->GetOne("SELECT count(*) as dd FROM `#@__ask` WHERE {$kwsql}"); $askcount = $row['dd']; if ($askcount <= 0) { ShowMsg("没有查找匹配的内容!", "-1"); exit; } //生成分页列表 $realpages = @ceil($askcount / $GLOBALS['cfg_ask_tpp']); if ($page > $realpages) { $page = $realpages; } $page = isset($page) ? max(1, intval($page)) : 1; $start_limit = ($page - 1) * $GLOBALS['cfg_ask_tpp']; $multipage = multi($askcount, $GLOBALS['cfg_ask_tpp'], $page, "?ct=search&q={$q}"); $query = "SELECT id, tid, tidname, tid2, tid2name, uid, title, reward, dateline, status, replies FROM #@__ask WHERE {$kwsql} LIMIT {$start_limit}, {$GLOBALS['cfg_ask_tpp']}"; $this->dsql->setquery($query); $this->dsql->execute(); $searchs = array(); while ($row = $this->dsql->getarray()) { $row["title"] = $this->GetRedKeyWord($q, $row["title"]); if ($GLOBALS['cfg_ask_rewrite'] == 'Y') { $row['qurl'] = $row['id'] . '.html'; } else { $row['qurl'] = '?ct=question&askaid=' . $row['id']; } $searchs[] = $row; } //当前位置 $nav = $GLOBALS['cfg_ask_position'] . " 搜索"; $toptypeinfo = "搜索 <font color='red'>" . $q . "</font> 结果"; //设定变量值 //设定变量值 $arrs = array('nav', 'searchs', 'toptypeinfo', 'multipage'); foreach ($arrs as $val) { $GLOBALS[$val] = ${$val}; } //载入模板 $this->SetTemplate('search.htm'); $this->Display(); }
if (empty($filter)) { $threadcount = $forum['threads']; } else { $query = $db->query("SELECT COUNT(*) FROM {$tablepre}threads WHERE fid='{$fid}' {$filteradd} AND displayorder>='0'"); $threadcount = $db->result($query, 0); } $thisgid = $forum['type'] == 'forum' ? $forum['fup'] : $_DCACHE['forums'][$forum['fup']]['fup']; if ($globalstick) { $stickytids = $_DCACHE['globalstick']['global']['tids'] . (empty($_DCACHE['globalstick']['categories'][$thisgid]['count']) ? '' : ',' . $_DCACHE['globalstick']['categories'][$thisgid]['tids']); $stickycount = $_DCACHE['globalstick']['global']['count'] + $_DCACHE['globalstick']['categories'][$thisgid]['count']; } else { $stickycount = $stickytids = 0; } $filterbool = !empty($filter) && in_array($filter, array('digest', 'type', 'activity', 'poll', 'trade', 'reward', 'debate', 'video')); $threadcount += $filterbool ? 0 : $stickycount; $multipage = multi($threadcount, $tpp, $page, "forumdisplay.php?fid={$fid}{$forumdisplayadd}", $threadmaxpages); $extra = rawurlencode("page={$page}{$forumdisplayadd}"); $separatepos = 0; $threadlist = array(); $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray'); $displayorderadd = !$filterbool && $stickycount ? 't.displayorder IN (0, 1)' : 't.displayorder IN (0, 1, 2, 3)'; if ($start_limit && $start_limit > $stickycount || !$stickycount || $filterbool) { $querysticky = ''; $query = $db->query("SELECT t.* FROM {$tablepre}threads t\r\n\t\tWHERE t.fid='{$fid}' {$filteradd} AND {$displayorderadd}\r\n\t\tORDER BY t.displayorder DESC, t.{$orderby} {$ascdesc}\r\n\t\tLIMIT " . ($filterbool ? $start_limit : $start_limit - $stickycount) . ", {$tpp}"); } else { $querysticky = $db->query("SELECT t.* FROM {$tablepre}threads t\r\n\t\tWHERE t.tid IN ({$stickytids}) AND t.displayorder IN (2, 3)\r\n\t\tORDER BY displayorder DESC, {$orderby} {$ascdesc}\r\n\t\tLIMIT {$start_limit}, " . ($stickycount - $start_limit < $tpp ? $stickycount - $start_limit : $tpp)); if ($tpp - $stickycount + $start_limit > 0) { $query = $db->query("SELECT t.* FROM {$tablepre}threads t\r\n\t\t\tWHERE t.fid='{$fid}' {$filteradd} AND {$displayorderadd}\r\n\t\t\tORDER BY displayorder DESC, {$orderby} {$ascdesc}\r\n\t\t\tLIMIT " . ($tpp - $stickycount + $start_limit)); } else { $query = ''; }
$fid = $inforum ? $inforum : 0; } $author = $authors != '' ? explode(' ', $authors) : ''; $admins = $admins != '' ? explode(' ', $admins) : ''; $pstarttime = $pstarttime != '' ? strtotime($pstarttime) : ''; $pendtime = $pendtime != '' ? strtotime($pendtime) : ''; $mstarttime = $mstarttime != '' ? strtotime($mstarttime) : ''; $mendtime = $mendtime != '' ? strtotime($mendtime) : ''; $security = $secStatus && $security; if ($security) { $threadcount = C::t('#security#security_evilpost')->count_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords); } else { $threadcount = C::t('forum_thread')->count_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords); } $pagetmp = $page; $multi = multi($threadcount, $_G['ppp'], $page, ADMINSCRIPT . "?action=recyclebin"); $multi = preg_replace("/href=\"" . ADMINSCRIPT . "\\?action=recyclebin&page=(\\d+)\"/", "href=\"javascript:page(\\1)\"", $multi); $multi = str_replace("window.location='" . ADMINSCRIPT . "?action=recyclebin&page='+this.value", "page(this.value)", $multi); echo '<script type="text/JavaScript">var replyreload;function attachimg() {}</script>'; showtagheader('div', 'threadlist', $searchsubmit); showformheader('recyclebin&operation=search&frame=no', 'target="rbframe"', 'rbform'); showtableheader(cplang('recyclebin_result') . ' ' . $threadcount . ' <a href="#" onclick="$(\'threadlist\').style.display=\'none\';$(\'threadsearch\').style.display=\'\';" class="act lightlink normal">' . cplang('research') . '</a>', 'fixpadding'); if ($threadcount) { if ($security) { $searchresult = C::t('#security#security_evilpost')->fetch_all_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords, ($pagetmp - 1) * $_G['ppp'], $_G['ppp']); } else { $searchresult = C::t('forum_thread')->fetch_all_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords, ($pagetmp - 1) * $_G['ppp'], $_G['ppp']); } $issettids = array(); foreach ($searchresult as $thread) { $disabledstr = '';
showformfooter(); } else { showsubtitle(array('block_name', 'block_script', 'block_style', 'block_dateline', 'block_page', 'operation')); $multipage = ''; $count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('common_block') . " b LEFT JOIN " . DB::table('common_template_block') . " tb ON tb.bid=b.bid WHERE {$wheresql}"), 0); if ($count) { $query = DB::query("SELECT b.*, tb.targettplname FROM " . DB::table('common_block') . " b LEFT JOIN " . DB::table('common_template_block') . " tb ON b.bid=tb.bid WHERE {$wheresql} {$ordersql} LIMIT {$start},{$perpage}"); while ($value = DB::fetch($query)) { if ($value['targettplname']) { $diyurl = block_getdiyurl($value['targettplname']); $diyurl = $diyurl['url']; $tplname = isset($_G['cache']['diytemplatename'][$value['targettplname']]) ? $_G['cache']['diytemplatename'][$value['targettplname']] : $value['targettplname']; $diypage[$value['bid']][$value['targettplname']] = $diyurl ? '<a href="' . $diyurl . '" target="_blank">' . $tplname . '</a>' : $tplname; } $list[$value['bid']] = $value; } if ($list) { foreach ($list as $bid => $value) { $inpage = empty($diypage[$bid]) ? cplang('block_page_unused') : implode('<br/>', $diypage[$bid]); $theclass = block_getclass($value['blockclass'], true); showtablerow('', '', array($value['name'] ? $value['name'] : cplang('block_name_null'), $theclass['script'][$value['script']], $value['styleid'] ? $theclass['style'][$value['styleid']]['name'] : lang('portalcp', 'blockstyle_diy'), !empty($value['dateline']) ? dgmdate($value['dateline']) : cplang('block_dateline_null'), $inpage, "<a href=\"portal.php?mod=portalcp&ac=block&op=block&bid={$value['bid']}&from=cp\" target=\"_blank\" onclick=\"showWindow('showblock',this.href);return false;\">" . cplang('block_setting') . "</a>  " . "<a href=\"portal.php?mod=portalcp&ac=block&op=data&bid={$value['bid']}&from=cp\" target=\"_blank\" onclick=\"showWindow('showblock',this.href);return false;\">" . cplang('block_data') . "</a>  " . $diyop . " <a href=\"" . ADMINSCRIPT . "?action=block&operation=perm&bid={$value['bid']}\">" . cplang('portalcategory_perm') . '</a>')); } } $multipage = multi($count, $perpage, $page, $mpurl); } showsubmit('', '', '', '<input type="submit" class="btn" name="clearsubmit" value="' . cplang('block_clear_unused') . '" />', $multipage); showtablefooter(); showformfooter(); } } }
if (empty($data['lastupdategroup'][$id])) { $data['lastupdategroup'][$id] = array(); } } $lastupdategroup = $data['lastupdategroup']; savecache('groupindex', $data); } $list = array(); if ($groupids) { $orderby = in_array(getgpc('orderby'), array('membernum', 'dateline', 'thread', 'activity')) ? getgpc('orderby') : 'displayorder'; $page = intval(getgpc('page')) ? intval($_GET['page']) : 1; $start = ($page - 1) * $perpage; $getcount = grouplist('', '', '', $groupids, 1, 1); if ($getcount) { $list = grouplist($orderby, '', array($start, $perpage), $groupids, 1); $multipage = multi($getcount, $perpage, $page, $url . "&orderby={$orderby}"); } } $endrows = $curtype['forumcolumns'] > 1 ? str_repeat('<td width="' . $curtype['forumcolwidth'] . '"></td>', $curtype['forumcolumns'] - count($list) % $curtype['forumcolumns']) : ''; $groupviewed_list = get_viewedgroup(); if (empty($sgid) && empty($gid)) { foreach ($first as $key => $val) { if (is_array($val['secondlist']) && !empty($val['secondlist'])) { $first[$key]['secondlist'] = array_slice($val['secondlist'], 0, 8); } } } if (!$navtitle || !empty($sgid) || !empty($gid)) { if (!$navtitle) { $navtitle = !empty($gid) ? $nav['first']['name'] : (!empty($sgid) ? $nav['second']['name'] : ''); }
if (!$index) { showmessage('search_id_invalid'); } $keyword = htmlspecialchars($index['keywords']); $keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : ''; $index['keywords'] = rawurlencode($index['keywords']); $articlelist = array(); $query = DB::query("SELECT at.*,ac.viewnum, ac.commentnum FROM " . DB::table('portal_article_title') . " at LEFT JOIN " . DB::table('portal_article_count') . " ac ON at.aid=ac.aid WHERE at.aid IN ({$index['ids']}) ORDER BY {$orderby} {$ascdesc} LIMIT {$start_limit}, {$_G['tpp']}"); while ($article = DB::fetch($query)) { $article['dateline'] = dgmdate($article['dateline']); $article['pic'] = pic_get($article['pic'], 'portal', $article['thumb'], $article['remote']); $article['title'] = bat_highlight($article['title'], $keyword); $article['summary'] = bat_highlight($article['summary'], $keyword); $articlelist[] = $article; } $multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=portal&searchid={$searchid}&orderby={$orderby}&ascdesc={$ascdesc}&searchsubmit=yes"); $url_forward = 'search.php?mod=portal&' . $_SERVER['QUERY_STRING']; include template('search/portal'); } else { !($_G['group']['exempt'] & 2) && checklowerlimit('search'); $searchstring = 'portal|title|' . addslashes($srchtxt); $searchindex = array('id' => 0, 'dateline' => '0'); $query = DB::query("SELECT searchid, dateline,\r\n\t\t\t('" . $_G['setting']['search']['portal']['searchctrl'] . "'<>'0' AND " . (empty($_G['uid']) ? "useip='{$_G['clientip']}'" : "uid='{$_G['uid']}'") . " AND {$_G['timestamp']}-dateline<'" . $_G['setting']['search']['portal']['searchctrl'] . "') AS flood,\r\n\t\t\t(searchstring='{$searchstring}' AND expiration>'{$_G['timestamp']}') AS indexvalid\r\n\t\t\tFROM " . DB::table('common_searchindex') . "\r\n\t\t\tWHERE srchmod='{$srchmod}' AND ('" . $_G['setting']['search']['portal']['searchctrl'] . "'<>'0' AND " . (empty($_G['uid']) ? "useip='{$_G['clientip']}'" : "uid='{$_G['uid']}'") . " AND {$_G['timestamp']}-dateline<" . $_G['setting']['search']['portal']['searchctrl'] . ") OR (searchstring='{$searchstring}' AND expiration>'{$_G['timestamp']}')\r\n\t\t\tORDER BY flood"); while ($index = DB::fetch($query)) { if ($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) { $searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']); break; } elseif ($_G['adminid'] != '1' && $index['flood']) { showmessage('search_ctrl', 'search.php?mod=portal', array('searchctrl' => $_G['setting']['search']['portal']['searchctrl'])); } }