<?php

$doc_ind1 ='<h3><a
href="?chap=1&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#1">1 What is DTC?</a></h3>
<h4><a href="?chap=1&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#1.1">1.1 What does DTC do?</a></h4>
<h4><a href="?chap=1&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#1.2">1.2 Who should read this document?</a></h4>
<h4><a href="?chap=1&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#1.3">1.3 What are DTC good features?</a></h4>
<h4><a href="?chap=1&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#1.4">1.4 Technologies used by DTC</a></h4>
<h4><a href="?chap=1&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#1.5">1.5 DTC\'s possibilities</a></h4>
<h4><a href="?chap=1&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#1.6">1.6 How does it works</a></h4>
';
$doc_ind2 = '<h3><a href="#2?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2">2. Installation</a></h3>
<h4><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.1">2.1 Before installing</a></h4>
<h4><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.2">2.2 Configurating daemons before installing</a></h4>
<h5><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.2.1">2.2.1 Mysql</a></h5>
<h5><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.2.2">2.2.2 Apache</a></h5>
<h4><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.3">2.3 Installation under debian</a></h4>
<h4><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.4">2.4 Installation under redhat</a></h4>
<h4><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.5">2.5 Installation under BSD/GENTOO</a></h4>
<h4><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.6">2.6 Manuelle installation</a></h4>
<h4><a href="?chap=2&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#2.7">2.7 Post-Installation (protection via .htaccess)</a></h4>
';
$doc_ind3 = '<h3><a href="#3?chap=3&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#3">3. Configuration of DTC</a></h3>
<h4><a href="?chap=3&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#3.1">3.1 Access to configuration panel</a></h4>
<h4><a href="?chap=3&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#3.2">3.2 General configuration</a></h4>
<h4><a href="?chap=3&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#3.3">3.3 Configuration of the bind zone files</a></h4>
<h4><a href="?chap=3&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#3.4">3.4 Configuration of paths</a></h4>
';
$doc_ind4 = '<h3><a href="?chap=4&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#4">4. Using the DTC root panel</a></h3>
<h4><a href="?chap=4&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#4.1">4.1 General description</a></h4>
<h5><a href="?chap=4&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#4.1.1">4.1.1 How it works</a></h5>
<h5><a href="?chap=4&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#4.1.2">4.1.2 The web interface</a></h5>
<h4><a href="?chap=4&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#4.2">4.2 User management</a></h4>
<h5><a href="?chap=4&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#4.2.1">4.1.1 Adding a virtual admin</a></h5>
<h5><a href="?chap=4&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#4.2.2">4.2.2 Managing you client domains</a></h5>
<h4><a href="?chap=4&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#4.3">4.3 Generating daemon files</a></h4>
';
$doc_ind5 = '<h3><a href="?chap=5&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#5">5 Credit and Licence</a></h3>
<h4><a href="?chap=5&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#5.1">5.1 Licence</a></h4>
<h4><a href="?chap=5&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#5.2">5.2 Credits</a></h4>
<h4><a href="?chap=5&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'"#5.3>5.3 Greets</a></h4>
<h4><a href="?chap=5&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'#5.4">5.4 Contact</a></h4>
';
$doc_index= $doc_ind1.$doc_ind2.$doc_ind3.$doc_ind4.$doc_ind5;
$out .= '<link rel="STYLESHEET" type="text/css" href="rubs/softwares/dtc/doc.css">';
include("page_top.php");
$chap = $_REQUEST["chap"];

function read_content_file($fname){
	$fp = fopen($fname,"r");
	$out = fread($fp,filesize($fname));
	fclose($fp);
	return $out;
}

if($chap == "1" || $chap == "2" || $chap == "3" || $chap == "4" || $chap == "5"){
	$nav .= '<table width="100%" height="1"><tr>';
	$prev = $chap - 1;
	$next = $chap + 1;
	$nav .= '<td width="33%">';
	if($chap > 1)
		$nav .=  '<a href="?chap='. $prev
		.'&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'">Prev</a>';
	$nav .=  '</td><td width="33%">';
	$nav .=  '<div align="center"><a href="?chap=0&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'">Home</a>';
	$nav .=  '</div></td><td width="33%" align="right"><div align="right">';
	if($chap < 5)
		$nav .=  '<a href="?chap='. $next
		.'&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'">Next</a>';
	$nav .=  '</div></td></tr></table>';

	$out .= $nav;
	$ze_ind = "doc_ind".$chap;
	$out .= $$ze_ind;

	$fname = "rubs/softwares/dtc/".$chap.".html";
	$out .= read_content_file($fname);
}else if($chap == "all"){
	$out .= $doc_index;
	$out .= read_content_file("rubs/softwares/dtc/1.html");
	$out .= read_content_file("rubs/softwares/dtc/2.html");
	$out .= read_content_file("rubs/softwares/dtc/3.html");
	$out .= read_content_file("rubs/softwares/dtc/4.html");
	$out .= read_content_file("rubs/softwares/dtc/5.html");
}else{
	$out .= '<a href="?chap=all&rub='.$_REQUEST["rub"].'&sousrub='.$_REQUEST["sousrub"].'">All this doc in one unic big html page</a><br>';
	$out .= $doc_index;
}

echo $out;

?>
