'', 'thread' => '', 'membernum' => '', 'dateline' => '', 'activity' => ''); if(!empty($_GET['orderby'])) { $selectorder[$_GET['orderby']] = 'selected'; } else { $selectorder['default'] = 'selected'; } $first = &$_G['cache']['grouptype']['first']; $second = &$_G['cache']['grouptype']['second']; require_once libfile('function/group'); $url = $_G['basescript'].'.php'; if($gid) { if(!empty($first[$gid])) { $curtype = $first[$gid]; if($curtype['secondlist']) { foreach($curtype['secondlist'] as $fid) { $typelist[$fid] = $second[$fid]; } $groupids = $first[$gid]['secondlist']; } $groupids[] = $gid; $url .= '?gid='.$gid; $fup = $gid; } else { $gid = 0; } } elseif($sgid) { if(!empty($second[$sgid])) { $curtype = $second[$sgid]; $fup = $curtype['fup']; $groupids = array($sgid); $url .= '?sgid='.$sgid; } else { $sgid = 0; } } if(empty($curtype)) { if($_G['uid'] && empty($_G['mod'])) { $usergroups = getuserprofile('groups'); if(!empty($usergroups)) { dheader('Location:group.php?mod=my'); exit; } } $curtype = array(); } else { $nav = get_groupnav($curtype); $groupnav = $nav['nav']; $_G['grouptypeid'] = $curtype['fid']; $perpage = 10; if($curtype['forumcolumns'] > 1) { $curtype['forumcolwidth'] = (floor(100 / $curtype['forumcolumns']) - 0.1).'%'; $perpage = $curtype['forumcolumns'] * 10; } } $seodata = array('first' => $nav['first']['name'], 'second' => $nav['second']['name']); list($navtitle, $metadescription, $metakeywords) = get_seosetting('group', $seodata); $_G['cache']['groupindex'] = ''; $data = $randgrouplist = $randgroupdata = $grouptop = $newgrouplist = array(); $topgrouplist = $_G['cache']['groupindex']['topgrouplist']; $lastupdategroup = $_G['cache']['groupindex']['lastupdategroup']; $todayposts = intval($_G['cache']['groupindex']['todayposts']); $groupnum = intval($_G['cache']['groupindex']['groupnum']); $cachetimeupdate = TIMESTAMP - intval($_G['cache']['groupindex']['updateline']); if(empty($_G['cache']['groupindex']) || $cachetimeupdate > 3600 || empty($lastupdategroup)) { $data['randgroupdata'] = $randgroupdata = grouplist('lastupdate', array('ff.membernum', 'ff.icon'), 80); $data['topgrouplist'] = $topgrouplist = grouplist('activity', array('f.commoncredits', 'ff.membernum', 'ff.icon'), 10); $data['updateline'] = TIMESTAMP; $groupdata = C::t('forum_forum')->fetch_group_counter(); $data['todayposts'] = $todayposts = $groupdata['todayposts']; $data['groupnum'] = $groupnum = $groupdata['groupnum']; foreach($first as $id => $toptype) { if(empty($toptype['secondlist'])) $toptype['secondlist'][] = $id; $query = C::t('forum_forum')->fetch_all_sub_group_by_fup($toptype['secondlist']); foreach($query as $row) { $data['lastupdategroup'][$id][] = $row; } 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; $page = $page > 65535 ? 1 : $page; $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('