docwrapper.php3 1.11 KB
Newer Older
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2 3 4 5 6
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
7 8 9 10 11
require("defs.php3");

#
# Standard Testbed Header
#
12 13 14
if (!$printable) {
    PAGEHEADER("Emulab Documentation");
}
15 16 17 18 19 20 21 22

#
# Need to sanity check the path! For now, just make sure the path
# does not start with a dot or a slash.
#
$first = substr($docname, 0, 1);
if (strcmp($first, ".") == 0 ||
    strcmp($first, "/") == 0) {
23
    USERERROR("Invalid document name: $docname!", 1);
24 25 26 27 28
}
#
# Nothing that looks like a ../ is allowed anywhere in the name
#
if (strstr($docname, "../")) {
29
    USERERROR("Invalid document name: $docname!", 1);
30 31
}

32 33 34 35 36 37 38 39 40 41 42
if ($printable) {
    #
    # Need to spit out some header stuff.
    #
    echo "<html>
          <head>
  	  <link rel='stylesheet' href='tbstyle-plain.css' type='text/css'>
          </head>
          <body>\n";
}
else {
43
	echo "<b><a href=$REQUEST_URI&printable=1>
Leigh Stoller's avatar
Leigh Stoller committed
44
                 Printable version of this document</a></b><br>\n";
45
}
46

47 48 49 50 51
readfile("$docname");

#
# Standard Testbed Footer
# 
52 53 54 55 56
if ($printable) {
    echo "</body>
          </html>\n";
}
else {
57 58
    PAGEFOOTER();
}
59 60
?>