<?php

/*
	[Discuz!] (C)2001-2006 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$RCSfile: index.inc.php,v $
	$Revision: 1.5 $
	$Date: 2006/11/08 06:34:29 $
*/


if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

require_once './include/header.inc.php';

?>
<div class="subtable bold altbg1"><a href="archiver/"><?=$_DCACHE['settings']['bbname']?></a></div><?=$headerbanner?>
<div class="simpletable" style="width: <?=TABLEWIDTH?>"><div class="subtable altbg2">
<?

$forums = $subforums = array();
$categories = array(0 => array('fid' => 0, 'name' => $_DCACHE['settings']['bbname']));

foreach($_DCACHE['forums'] as $forum) {
	if(forumperm($forum['viewperm'])) {
		if($forum['type'] == 'group') {
			$categories[] = $forum;
		} else {
			$forum['type'] == 'sub' ? $subforums[$forum['fup']][] = $forum : $forums[$forum['fup']][] = $forum;
		}
	 }
}

echo "<ul>\n";

foreach($categories as $category) {
	if(isset($forums[$category['fid']])) {
		echo "<li><b>$category[name]</b></li><ul>\n";
		foreach($forums[$category[fid]] as $forum) {
			echo "<li><a href=\"archiver/{$qm}fid-{$forum[fid]}.html\">$forum[name]</a></li>\n";
			if(isset($subforums[$forum['fid']])) {
				echo "<ul>\n";
				foreach($subforums[$forum['fid']] as $subforum) {
					echo "<li><a href=\"archiver/{$qm}fid-$subforum[fid].html\">$subforum[name]</a></li>\n";
				}
				echo "</ul>\n";
			}
		}
		echo "</ul><br>\n";
	}
}

?>
</div></div>