<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
global $imgurl;
$jumplist = boardjumplist($boardid);
?>
<div class="mainbox">
	<div class="page_right">
	<ul>
		<table width="96%">
		<tr>
			<td colspan="2"><a href="indivgroup_new.php"><img src="<?=$imgurl?>newgroup.gif" alt="" /></a></td>
		</tr>
		</table><br />
	</ul>
	<ul class="border">
		<div class="nav_topic">
		<h1 class="font14"><?=$lang['tpl.str45']?></h1><br />
			<ul>
<?
if(!empty($Forum_group['tophots'])){
	if(is_array($Forum_group['tophots'])){
		$ForumGroupArr= $Forum_group['tophots'];
		foreach($ForumGroupArr as $k => $arrdb){
			$_titlelength = $objenc->StrLength($arrdb['groupname']);
			if ( $_titlelength > 13){
				$arrdb['groupname'] = $objenc->SubString(strip_tags($arrdb['groupname']), 0, 13).'...';
			}
?>
			<li><em>(<?=$arrdb['postnum']?>)</em><a href="indivgroup_index.php?groupid=<?=$arrdb['groupid']?>"><?=$arrdb['groupname']?></a></li>
<?
		}
	}
}
?>
			</ul>
		</div>
	</ul>
	</div>
	<div class="page_left border">
		<h3 class="titlebig">
		<?=$lang['tpl.str40']?>
		</h3>
<?
if(!empty($Forum_group['topnew'])){
	if(is_array($Forum_group['topnew'])){
		$arrdb= $Forum_group['topnew'];
		for($i=1;$i<=count($arrdb);$i++){
			$_titlelength = $objenc->StrLength($arrdb[$i]['groupname']);
			if ( $_titlelength > 10){
				$arrdb[$i]['groupname'] = $objenc->SubString(strip_tags($arrdb[$i]['groupname']), 0, 10).'...';
			}
			$_infolength = $objenc->StrLength($arrdb[$i]['groupinfo']);
			if ( $_infolength > 20){
				$arrdb[$i]['groupinfo'] = $objenc->SubString(strip_tags($arrdb[$i]['groupinfo']), 0, 20).'...';
			}
			if($i%2 == 1){
?>
				<table style="margin-left:15px;">
					<tr>
<?
			}
?>
						<td style="padding:0px 10px 10px 0px;"><img src="<?=$arrdb[$i]['grouppic']?>" width="60" alt="" /></td>
						<td width="50%" valign="top">
						<b><a href="indivgroup_index.php?groupid=<?=$arrdb[$i]['groupid']?>" class="newlink"><?=$arrdb[$i]['groupname']?></a></b><br />
						<?=$arrdb[$i]['groupinfo']?><br />
						<span><?=$lang['tpl.str41']?><em><?=$arrdb[$i]['appdate']?></em><?=$lang['tpl.str42']?><em><a href="indivgroup_member.php?groupid=<?=$arrdb[$i]['groupid']?>"><u><?=$arrdb[$i]['usernum']?></u></a></em></span></td>
<?
			if($i%2 == 0){
?>
					</tr>
					</table>
<?
			}
			if($i > 5){
				break;
			}
		}
			if($i > 1){
				if($i%2 == 0){
?>
						<td width="50%" colspan="2">&nbsp;</td>
<?
				}
?>
					</tr>
					</table>
<?
			}
	}
}
?>	
<br />
	</div>
	<div style="height:10px; line-height:10px;"></div>
	<div class="page_left border">
		<h3 class="titlebig">
		<?=$lang['tpl.str46']?>
		</h3>
			<table width="98%" class="heightd tableborder" style="border:0px;" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td style="border-top:0px;"><?=$lang['tpl.str47']?></td>
				<td style="border-top:0px;"><?=$lang['tpl.str47']?></td>
				<td style="border-top:0px;"><?=$lang['tpl.str48']?></td>
				<td style="border-top:0px;"><?=$lang['tpl.str49']?> | <?=$lang['tpl.str50']?></td>
			</tr>
<?
$t = 0;
foreach( $_topics as $key=>$topic ){
	$topic['lastpost']=explode('$',$topic['lastpost']);
	$topic['lastpost'][2] = gmdate('Y-m-d', $topic['lastpost'][2]+getUserTimeZoneOffset());
	(-1 == $topic['isvote']) AND ($topic['title'] = '['.$lang['list.tpl.str70'].']&nbsp;'.$topic['title']);
	$datedifftime = 0;
	if ( intval($board_settings[64]) > 0 ){
		if ( intval($board_settings[63]) == 0 ){
			$datedifftime = dateDiff('M',$topic['lastpost'][2],$nowtimes);
		}else{
			$datedifftime = dateDiff('M',$topic['dateandtime'],$nowtimes);
		}
		if ( $datedifftime > intval($board_settings[64]) ){
			$datedifftime = 0;
		}
	}
	$dispfile = 'indivgroup_dispbbs.php';
?>
			<tr>
				<td class="list1" style="background:none">
					<a href="<?=$dispfile?>?groupid=<?=$topic['groupid']?>&amp;groupboardid=<?=$topic['boardid']?>&amp;id=<?=$topic['topicid']?>&amp;page=<?=$page?>" target="_blank"><img src="<?=$imgurl?>icon/folder.gif" alt="" /></a>
				</td>
				<td class="list2">
<?
	$topic['lastpost'][3] = preg_replace( '/<([^<>]*?)>/i' ,'' ,$topic['lastpost'][3]);
	$topic['dateandtime'] = gmdate("Y-m-d H:i:s",$topic['dateandtime']+getUserTimeZoneOffset());
	$html_locktopic = htmlspecialchars($topic['locktopic']);
	$html_postusername = htmlspecialchars($topic['postusername']);
	$html_lastpost = htmlspecialchars($topic['lastpost'][3]);
?>
<a href="<?=$dispfile?>?groupid=<?=$topic['groupid']?>&amp;groupboardid=<?=$topic['boardid']?>&amp;id=<?=$topic['topicid']?>&amp;page=<?=$page?>" title="<?=$lang['list.tpl.str71']?><?=$html_locktopic?><?=$lang['list.tpl.str72']?>&#xA;<?=$lang['list.tpl.str31']?><?=$html_postusername?>&#xA;<?=$lang['list.tpl.str32']?><?=$topic['dateandtime']?>&#xA;<?=$lang['list.tpl.str33']?><?=$html_lastpost?> " <?=$topic['topicmode']?>><?=$topic['title']?></a>
<?
if ($topic['isvote'] != -1 AND ($topic['child'] + 1) > $board_settings[61]){
	$pagelinks = '';
	if ($board_settings[61] < 1) {
		$board_settings[61] = 20;
	}
	$topicpages = ceil(($topic['child'] + 1) / $board_settings[61]);
	for ($i = 1; $i <= $topicpages; $i++) {
		$pagelinks .= "<a href=\"".$dispfile."?groupid=".$topic['groupid']."&amp;groupboardid=".$topic['boardid']."&id=".$topic['topicid']."&page=".$page."&star=".$i."\">".$i."</a> ";
		if($i == 6) {
			$i = $topicpages + 1;
		}
	}
	if($topicpages > 6) {
		$pagelinks .= " .. <a href=\"".$dispfile."?groupid=".$topic['groupid']."&amp;groupboardid=".$topic['boardid']."&id=".$topic['topicid']."&page=".$page."&star=".$topicpages."\">".$topicpages."</a> ";
	}
?>
	<small>( <b><?=$pagelinks?></b> )</small>
<?
}
?>
				</td>
				<td class="list4"><a href="dispuser.php?id={$topic['postuserid']}" target="_blank"><?=$topic['postusername']?></a></td>
				<td class="list4"><a href="dispuser.php?id={$topic['lastpost'][5]}" target="_blank"><?=$topic['lastpost'][0]?></a><br><em><?=$topic['lastpost'][2]?></em></td>
			</tr>
<?
}
?>
			</table><br />
	</div>
	<div style="clear:both"></div>
</div>