r2021 + fix IPv4 address bypass arg handling
[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}
e673ee24
DO
11
12echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
13echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
14echo '<head><title>' . getTitle ($pageno, $tabno) . "</title>\n";
21fd978f 15echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
e673ee24
DO
16echo "<link rel=stylesheet type='text/css' href=pi.css />\n";
17echo "<link rel=icon href='" . getFaviconURL() . "' type='image/x-icon' />";
18echo "<style type='text/css'>\n";
19// Print style information
9c0b0016 20foreach (array ('F', 'A', 'U', 'T', 'Th', 'Tw', 'Thw') as $statecode)
e673ee24
DO
21{
22 echo "td.state_${statecode} {\n";
2a201216 23 echo "\ttext-align: center;\n";
9c0b0016 24 echo "\tbackground-color: #" . (getConfigVar ('color_' . $statecode)) . ";\n";
2a201216 25 echo "\tfont: bold 10px Verdana, sans-serif;\n";
e673ee24
DO
26 echo "}\n\n";
27}
28?>
2a201216
DY
29.validation-error {
30 border:1px solid red;
31}
32
33.validation-success {
34 border:1px solid green;
35}
e673ee24 36 </style>
a30489ac 37 <script language='javascript' type='text/javascript' src='js/live_validation.js'></script>
2a201216
DY
38 <script type="text/javascript">
39 function init() {
40 document.add_new_range.range.setAttribute('match', "^\\d\\d?\\d?\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\/\\d\\d?$");
41
42 Validate.init();
43 }
44 window.onload=init;
45 </script>
e673ee24
DO
46 </head>
47<body>
48 <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%' class=maintable>
49 <tr class=mainheader>
c4d215e8 50 <td colspan=2>
e673ee24
DO
51 <table width='100%' cellspacing=0 cellpadding=2 border=0>
52 <tr>
1db97c25 53 <td valign=top><a href='http://racktables.org/'><?php printImageHREF ('logo'); ?></a></td>
b325120a 54 <td valign=top><div class=greeting><?php printGreeting(); ?></div></td>
e673ee24
DO
55 </tr>
56 </table>
57 </td>
58 </tr>
59
60 <tr>
c4d215e8 61 <td class="menubar" colspan=2>
e673ee24
DO
62 <table border="0" width="100%" cellpadding="3" cellspacing="0">
63 <tr>
b325120a 64<?php showPathAndSearch ($pageno); ?>
e673ee24
DO
65 </tr>
66 </table>
67 </td>
68 </tr>
69
70 <tr>
b325120a 71<?php
e673ee24
DO
72 showTabs ($pageno, $tabno);
73?>
74 </tr>
75
76 <tr>
c4d215e8 77 <td colspan=2>
b325120a 78<?php
e45a78d7
DO
79if (isset ($tabhandler[$pageno][$tabno]))
80{
3bebaebd
DO
81 if (isset ($page[$pageno]['bypass']) && isset ($page[$pageno]['bypass_type']))
82 {
83 switch ($page[$pageno]['bypass_type'])
84 {
85 case 'uint':
2c6c7645 86 assertUIntArg ($page[$pageno]['bypass'], 'index');
3bebaebd 87 break;
105cea6e 88 case 'uint0':
2c6c7645 89 assertUIntArg ($page[$pageno]['bypass'], 'index', TRUE);
105cea6e 90 break;
1fbc9fd6
DO
91 case 'inet4':
92 assertIPv4Arg ($page[$pageno]['bypass'], 'index');
93 break;
3bebaebd
DO
94 default:
95 showError ("Dispatching error for bypass parameter");
96 break;
97 }
98 $tabhandler[$pageno][$tabno] ($_REQUEST[$page[$pageno]['bypass']]);
99 }
e45a78d7
DO
100 else
101 $tabhandler[$pageno][$tabno] ();
102}
103elseif (isset ($page[$pageno]['handler']))
e673ee24
DO
104 $page[$pageno]['handler'] ($tabno);
105else
b43ee65d 106 showError ("Failed to find handler for page '${pageno}', tab '${tabno}'");
e673ee24
DO
107?>
108 </td>
109 </tr>
110 </table>
111</body>
112</html>