summaryrefslogblamecommitdiff
path: root/index.php
blob: 5996fcade7529b7c26e795edbc56499252ccb330 (plain) (tree)
1
2
3
4
5
6
7
8
9

                               
                                                          
 
                   
                                     
                                                                                                     

                                                         
                                                                                                             

                                                     
                                                               
                                     
        
                                      
 
 
                               
<?php
include('./includes/head.php');
$page = strtok(strtok($_SERVER['REQUEST_URI'], '/'), '?');

if (empty($page)) {
	include('./pages/index.php');
} else if (!empty($page) && $page[0] >= '0' && $page[0] <= '9' && is_readable("./posts/$page.php")) {
	$script = file_get_contents("./posts/$page.php");
	$re = '/<code>([^\(<>\)]*)\(([0-9])\)<\/code>/m';
	$subst = '<a href="https://www.freebsd.org/cgi/man.cgi?query=$1&sektion=$2&format=ascii">$1($2)</a>';
	$script = preg_replace($re, $subst, $script);
	eval("?>$script<?php");
} else if (!empty($page) && is_readable("./pages/$page.php")) {
	include("./pages/$page.php");
} else {
	include('./includes/404.php');
}

include('./includes/foot.php');