foreach ($_G['forum']['threadsorts']['types'] as $stid => $sortname) { loadcache(array('threadsort_option_' . $stid, 'threadsort_template_' . $stid)); sortthreadsortselectoption($stid); $templatearray[$stid] = $_G['cache']['threadsort_template_' . $stid]['subject']; $sortoptionarray[$stid] = $_G['cache']['threadsort_option_' . $stid]; } if (!empty($_G['forum']['threadsorts']['defaultshow']) && empty($_G['gp_sortid']) && empty($_G['gp_sortall'])) { $_G['gp_sortid'] = $_G['forum']['threadsorts']['defaultshow']; $_G['gp_filter'] = 'sortid'; $_SERVER['QUERY_STRING'] = $_SERVER['QUERY_STRING'] ? $_SERVER['QUERY_STRING'] . '&sortid=' . $_G['gp_sortid'] : 'sortid=' . $_G['gp_sortid']; $filterurladd = '&filter=sort'; } $_G['gp_sortid'] = $_G['gp_sortid'] ? $_G['gp_sortid'] : $_G['gp_searchsortid']; if (isset($_G['gp_sortid']) && $_G['forum']['threadsorts']['types'][$_G['gp_sortid']]) { $searchsortoption = $sortoptionarray[$_G['gp_sortid']]; $quicksearchlist = quicksearch($searchsortoption); $_G['forum_optionlist'] = $_G['cache']['threadsort_option_' . $_G['gp_sortid']]; $forum_optionlist = getsortedoptionlist(); } } $moderatedby = $_G['forum']['status'] != 3 ? moddisplay($_G['forum']['moderators'], 'forumdisplay') : ''; $_G['gp_highlight'] = empty($_G['gp_highlight']) ? '' : htmlspecialchars($_G['gp_highlight']); if ($_G['forum']['autoclose']) { $closedby = $_G['forum']['autoclose'] > 0 ? 'dateline' : 'lastpost'; $_G['forum']['autoclose'] = abs($_G['forum']['autoclose']) * 86400; } $subexists = 0; foreach ($_G['cache']['forums'] as $sub) { if ($sub['type'] == 'sub' && $sub['fup'] == $_G['fid'] && (!$_G['setting']['hideprivate'] || !$sub['viewperm'] || forumperm($sub['viewperm']) || strstr($sub['users'], "\t{$_G['uid']}\t"))) { if (!$sub['status']) { continue;
function getdata($style, $parameter) { global $_G; $return = ''; require_once libfile('function/category'); $sortid = isset($parameter['sortids']) ? intval($parameter['sortids']) : 0; $allsorts = $sorts = array(); $allsortstr = ''; $query = DB::query("SELECT * FROM " . DB::table('category_sort') . " ORDER BY sortid"); while ($sort = DB::fetch($query)) { $cursortid = $sort['sortid']; $allsorts[$cursortid] = $sort; $allsortstr .= $cursortid . '||' . $sort['name'] . '||'; } $allsortstr && ($allsortstr = substr($allsortstr, 0, -2)); if (!$sortid) { $sorts = $allsorts; } else { $sorts = array($sortid => array('sortid' => $sortid)); } $sortrandomid = ''; foreach ($sorts as $cursortid => $sort) { loadcache(array('category_option_' . $cursortid)); $sortoptionarray = $_G['cache']['category_option_' . $cursortid]; $quicksearchlist = quicksearch($sortoptionarray); $aids = !empty($parameter['aids']) ? $parameter['aids'] : array(); $addarea = $aids ? "AND aid IN (" . dimplode($aids) . ")" : ''; $districtsearchlist = array(); $query = DB::query("SELECT aid, type, title FROM " . DB::table('category_area') . " WHERE cid='1' {$addarea} ORDER BY displayorder"); while ($area = DB::fetch($query)) { if ($area['type'] == 'district') { $districtsearchlist[$area['aid']] = $area['title']; } } $url = $select = $input = $button = ''; if ($quicksearchlist) { $randomid = rand(1, 999); !$sortrandomid && ($sortrandomid = $randomid); $show_style = ''; if ($cursortid == 2 && !$sortid) { $show_style = ' style="display: none;" '; } $select .= '<div id="searchdiv_' . $sortrandomid . '_' . $cursortid . '" class="bbda cgs pns cl"' . $show_style . '><form method="post" autocomplete="off" name="searhsort" id="searhsort" action="house.php?mod=list&sortid=' . $cursortid . '">'; if (!$sortid && $parameter['styles'] == 'list') { if ($allsorts) { $select .= '<span class="ftid"><select id="changesort' . $sortrandomid . $cursortid . '" change="changecategorysort(\'list\', \'changesort' . $sortrandomid . $cursortid . '\', \'' . $sortrandomid . '\', \'' . $allsortstr . '\', \'' . $cursortid . '\')">'; foreach ($allsorts as $sid => $sortarray) { $selected = $sid == $cursortid ? 'selected' : ''; $select .= '<option value="' . $sid . '" ' . $selected . '>' . $sortarray['name'] . '</option>'; } $select .= '</select></span>'; $select .= '<input type="hidden" name="categorysort" value="mselect"><script type="text/javascript" reload="1">simulateSelect(\'changesort' . $sortrandomid . $cursortid . '\');</script>'; } } foreach ($quicksearchlist as $optionid => $option) { if ($option['type'] == 'select' && $option['choices'] || $option['type'] == 'range' && $option['choices']) { $select .= '<span class="ftid"><select name="searchoption[' . $optionid . '][value]" id="' . $option['identifier'] . '_' . $randomid . '"><option value="0">' . $option['title'] . lang('block/categorylist', 'categorylist_any') . '</option>'; foreach ($option['choices'] as $id => $value) { $select .= '<option value="' . $id . '">' . $value . '</option>'; } $select .= '</select></span>'; $select .= '<input type="hidden" name="searchoption[' . $optionid . '][type]" value="' . $option['type'] . '"><script type="text/javascript" reload="1">simulateSelect(\'' . $option['identifier'] . '_' . $randomid . '\');</script>'; } if ($option['type'] == 'text' && !$option['choices']) { $input .= '<input type="text" name="searchoption[' . $optionid . '][value]" size="15" id="' . $option['identifier'] . '_' . $randomid . '" class="px" value="' . $option['title'] . '" onclick="$(\'' . $option['identifier'] . '_' . $randomid . '\').value = \'\'" />'; } } $button .= '<button type="submit" class="pn" name="searchsortsubmit"><em>' . lang('block/categorylist', 'categorylist_submit') . '</em></button></form></div>'; $url .= '<dl id="dl_' . $sortrandomid . '_' . $cursortid . '" class="cgsq pbm bbda cl"' . $show_style . '>'; $url .= '<dt>' . lang('block/categorylist', 'categorylist_area') . ':</dt><dd><ul>'; foreach ($districtsearchlist as $did => $district) { $url .= '<li><a href="house.php?mod=list&filter=all&district=' . $did . '&sortid=' . $cursortid . '" target="_blank">' . $district . '</a></li>'; } $url .= '</ul></dd>'; foreach ($quicksearchlist as $optionid => $option) { if (in_array($option['type'], array('select', 'radio')) || $option['type'] == 'range' && $option['choices']) { $url .= '<dt>' . $option['title'] . ':</dt><dd><ul>'; foreach ($option['choices'] as $id => $value) { $url .= '<li><a href="house.php?mod=list&filter=all&sortid=' . $cursortid . '&' . $option['identifier'] . '=' . $id . '">' . $value . '</a></li>'; } $url .= '</ul></dd>'; } } $url .= '</dl>'; } $return .= $select . $input . $button . $url; } $show_style = ' style="display: none;" '; if (!$sortid && $parameter['styles'] == 'tab') { $show_style = ''; } $tab = '<script type="text/javascript" src="' . $_G[setting][jspath] . 'house.js?' . VERHASH . '"></script><div class="tab-title title column cl" switchtype="click"' . $show_style . '><ul class="tb cl">'; if ($allsorts) { $class = 'a'; foreach ($allsorts as $sid => $sortarray) { $tab .= '<li id="li_' . $sortrandomid . '_' . $sid . '" class="' . $class . '"><a href="javascript:;" onclick="javascript: changecategorysort(\'tab\', \'' . $sid . '\', \'' . $sortrandomid . '\', \'' . $allsortstr . '\', \'' . $sid . '\');return false;" onfocus="this.blur();">' . $sortarray['name'] . '</a></li>'; $class && ($class = ''); } } $tab .= '</ul></div>'; $return = $tab . $return; return array('html' => $return, 'data' => null); }
$forum['typemodels'] = $forum['typemodels'] ? unserialize($forum['typemodels']) : array(); $optionadd = $filterurladd = ''; $threadids = array(); if($forum['threadsorts']['defaultshow'] && $forum['threadsorts']['types'] && empty($sortid)) { $sortid = $forum['threadsorts']['defaultshow']; $filterurladd = '&filter=sort'; } if($sortid && $forum['threadsorts']['types'][$sortid]) { $sortid = intval($sortid); include_once DISCUZ_ROOT.'./forumdata/cache/threadsort_'.$sortid.'.php'; require_once DISCUZ_ROOT.'./include/forumsort.func.php'; $quicksearchlist = quicksearch(); } $moderatedby = moddisplay($forum['moderators'], 'forumdisplay'); $highlight = empty($highlight) ? '' : htmlspecialchars($highlight); if($forum['autoclose']) { $closedby = $forum['autoclose'] > 0 ? 'dateline' : 'lastpost'; $forum['autoclose'] = abs($forum['autoclose']) * 86400; } $subexists = 0; foreach($_DCACHE['forums'] as $sub) { if($sub['type'] == 'sub' && $sub['fup'] == $fid && (!$hideprivate || !$sub['viewperm'] || forumperm($sub['viewperm']) || strstr($sub['users'], "\t$discuz_uid\t"))) { if(!$sub['status']) { continue; }
if (empty($sortid)) { showmessage(lang('category/template', 'house_undefined_action')); } require_once libfile('function/category'); $showpic = intval($_G['gp_showpic']); $templatearray = $sortoptionarray = array(); loadcache(array('category_option_' . $sortid, 'category_template_' . $sortid)); $_G['gp_listtype'] = in_array($_G['gp_listtype'], array('text', 'pic')) ? $_G['gp_listtype'] : $channel['listmode']; $templatearray = $_G['gp_listtype'] == 'text' ? $_G['cache']['category_template_' . $sortid]['subjecttext'] : $_G['cache']['category_template_' . $sortid]['subject']; $vtemplatearray = $_G['cache']['category_template_' . $sortid]['visit']; $sortoptionarray = $_G['cache']['category_option_' . $sortid]; $perpage = $_G['cache']['category_template_' . $sortid]['perpage'] ? $_G['cache']['category_template_' . $sortid]['perpage'] : $_G['tpp']; if (empty($sortoptionarray)) { showmessage(lang('category/template', 'house_class_nothing')); } $quicksearchlist = quicksearch($sortoptionarray); $districtid = $_G['gp_district'] ? intval($_G['gp_district']) : ''; $streetid = $_G['gp_street'] ? intval($_G['gp_street']) : ''; $cityid = $_G['gp_city'] ? intval($_G['gp_city']) : ''; $citysearchlist = $arealist ? $arealist['city'] : ''; $districtsearchlist = $arealist && $cityid ? $arealist['district'][$cityid] : ''; $streetsearchlist = $arealist && $districtid ? $arealist['street'][$districtid] : ''; $page = $_G['page']; $start_limit = ($page - 1) * $perpage; $filteradd = $sortoptionurl = $space = ''; $sorturladdarray = $selectadd = $conditionlist = $saveconditionlist = $savedistrictlist = $savestreetlist = $_G['category_threadlist'] = array(); $catedisplayadd['order'] = ''; $filterfield = array('sortid', 'page', 'recommend', 'attachid', 'all'); $_G['gp_filter'] = isset($_G['gp_filter']) && in_array($_G['gp_filter'], $filterfield) ? $_G['gp_filter'] : 'all'; foreach ($filterfield as $v) { $catedisplayadd[$v] = '';