diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -22,7 +22,6 @@ $request = $_SERVER['REQUEST_URI']; if (preg_match ( '/\.\./', $request ) || /* don't go up the filesystem */ preg_match ( '/[\'\"]/', $request )|| /* string terminators */ preg_match ( '/\\\0/', $request ) ) /* null bytes */ - { header('HTTP/1.0 500 Internal Error'); echo "<h1>Error</h1>"; @@ -30,10 +29,14 @@ if (preg_match ( '/\.\./', $request ) || /* don't go up the filesystem */ } $contentpath = $_SERVER['DOCUMENT_ROOT'] . '/webpages/' . $request; +$webpage = true; /* if nothing exists in webpages directory, try root */ if ( ! is_dir($contentpath) && ! is_file($contentpath.'.php') ) +{ $contentpath = $_SERVER['DOCUMENT_ROOT'] . $request; + $webpage = false; +} if ( is_dir($contentpath) == TRUE ) $contentpath .= 'index.php'; @@ -47,16 +50,14 @@ if ( ! is_file($contentpath) ) exit (0); } -include($_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"); - -include($contentpath); - -xhtml_header($title); - -print($body); - -include($_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"); +if($webpage) +{ + include($_SERVER['DOCUMENT_ROOT'] . "/includes/render-webpage.php"); -page_footer($contentpath); + /* todo: base the function to use on content negotiation */ + render_xhtml($contentpath); +} +else + include($contentpath); ?> |