r2623 move user-modifiable files to a separate dir (closes: 39)
[racktables] / index.php
CommitLineData
b325120a 1<?php
e673ee24
DO
2
3require 'inc/init.php';
da958e52
DO
4// no ctx override is necessary
5fixContext();
6if (!permitted())
7{
8 renderAccessDenied();
9 die;
10}
b0348307 11// Only store the tab name after clearance is got. Any failure is unhandleable.
3b34b607 12$_SESSION['RTLT'][$pageno] = $tabno;
e673ee24
DO
13
14echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
15echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
16echo '<head><title>' . getTitle ($pageno, $tabno) . "</title>\n";
21fd978f 17echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
e673ee24
DO
18echo "<link rel=stylesheet type='text/css' href=pi.css />\n";
19echo "<link rel=icon href='" . getFaviconURL() . "' type='image/x-icon' />";
20echo "<style type='text/css'>\n";
21// Print style information
9c0b0016 22foreach (array ('F', 'A', 'U', 'T', 'Th', 'Tw', 'Thw') as $statecode)
e673ee24
DO
23{
24 echo "td.state_${statecode} {\n";
2a201216 25 echo "\ttext-align: center;\n";
9c0b0016 26 echo "\tbackground-color: #" . (getConfigVar ('color_' . $statecode)) . ";\n";
2a201216 27 echo "\tfont: bold 10px Verdana, sans-serif;\n";
e673ee24
DO
28 echo "}\n\n";
29}
30?>
31 </style>
57c69e9c 32 <script language='javascript' type='text/javascript' src='js/racktables.js'></script>
11048491 33 <script language='javascript' type='text/javascript' src='js/jquery-1.3.1.min.js'></script>
a30489ac 34 <script language='javascript' type='text/javascript' src='js/live_validation.js'></script>
54592771 35 <script language='javascript' type='text/javascript' src='js/codepress/codepress.js'></script>
e673ee24
DO
36 </head>
37<body>
38 <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%' class=maintable>
39 <tr class=mainheader>
c4d215e8 40 <td colspan=2>
e673ee24
DO
41 <table width='100%' cellspacing=0 cellpadding=2 border=0>
42 <tr>
1db97c25 43 <td valign=top><a href='http://racktables.org/'><?php printImageHREF ('logo'); ?></a></td>
b325120a 44 <td valign=top><div class=greeting><?php printGreeting(); ?></div></td>
e673ee24
DO
45 </tr>
46 </table>
47 </td>
48 </tr>
49
50 <tr>
c4d215e8 51 <td class="menubar" colspan=2>
e673ee24
DO
52 <table border="0" width="100%" cellpadding="3" cellspacing="0">
53 <tr>
b325120a 54<?php showPathAndSearch ($pageno); ?>
e673ee24
DO
55 </tr>
56 </table>
57 </td>
58 </tr>
59
60 <tr>
b325120a 61<?php
e673ee24
DO
62 showTabs ($pageno, $tabno);
63?>
64 </tr>
65
66 <tr>
c4d215e8 67 <td colspan=2>
b325120a 68<?php
e45a78d7
DO
69if (isset ($tabhandler[$pageno][$tabno]))
70{
3bebaebd
DO
71 if (isset ($page[$pageno]['bypass']) && isset ($page[$pageno]['bypass_type']))
72 {
73 switch ($page[$pageno]['bypass_type'])
74 {
75 case 'uint':
2c6c7645 76 assertUIntArg ($page[$pageno]['bypass'], 'index');
3bebaebd 77 break;
105cea6e 78 case 'uint0':
2c6c7645 79 assertUIntArg ($page[$pageno]['bypass'], 'index', TRUE);
105cea6e 80 break;
1fbc9fd6
DO
81 case 'inet4':
82 assertIPv4Arg ($page[$pageno]['bypass'], 'index');
83 break;
e1ae3fb4
AD
84 case 'string':
85 assertStringArg ($page[$pageno]['bypass'], 'index');
86 break;
3bebaebd 87 default:
b0348307 88 showError ('Dispatching error for bypass parameter', __FILE__);
3bebaebd
DO
89 break;
90 }
91 $tabhandler[$pageno][$tabno] ($_REQUEST[$page[$pageno]['bypass']]);
92 }
e45a78d7
DO
93 else
94 $tabhandler[$pageno][$tabno] ();
95}
96elseif (isset ($page[$pageno]['handler']))
e673ee24
DO
97 $page[$pageno]['handler'] ($tabno);
98else
b0348307 99 showError ("Failed to find handler for page '${pageno}', tab '${tabno}'", __FILE__);
e673ee24
DO
100?>
101 </td>
102 </tr>
103 </table>
104</body>
105</html>