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