r4073 minor change in UI for recent change: VST form commit on ENTER and hints on...
[racktables] / index.php
CommitLineData
b325120a 1<?php
90a3d6d8
DY
2ob_start();
3try {
f77323f1 4require 'inc/interface.php';
e673ee24 5require 'inc/init.php';
329ec966 6prepareNavigation();
da958e52
DO
7// no ctx override is necessary
8fixContext();
750d26d2 9redirectIfNecessary();
da958e52 10if (!permitted())
da958e52 11 renderAccessDenied();
878512c6 12header ('Content-Type: text/html; charset=UTF-8');
b0348307 13// Only store the tab name after clearance is got. Any failure is unhandleable.
fa5b2764
AA
14if (isset ($_REQUEST['tab']) and ! isset ($_SESSION['RTLT'][$pageno]['dont_remember']))
15 $_SESSION['RTLT'][$pageno] = array ('tabname' => $tabno, 'time' => time());
e673ee24 16
e673ee24 17?>
e673ee24
DO
18 <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%' class=maintable>
19 <tr class=mainheader>
c4d215e8 20 <td colspan=2>
e673ee24
DO
21 <table width='100%' cellspacing=0 cellpadding=2 border=0>
22 <tr>
1db97c25 23 <td valign=top><a href='http://racktables.org/'><?php printImageHREF ('logo'); ?></a></td>
b325120a 24 <td valign=top><div class=greeting><?php printGreeting(); ?></div></td>
e673ee24
DO
25 </tr>
26 </table>
27 </td>
28 </tr>
29
30 <tr>
c4d215e8 31 <td class="menubar" colspan=2>
e673ee24
DO
32 <table border="0" width="100%" cellpadding="3" cellspacing="0">
33 <tr>
b325120a 34<?php showPathAndSearch ($pageno); ?>
e673ee24
DO
35 </tr>
36 </table>
37 </td>
38 </tr>
39
40 <tr>
b325120a 41<?php
e673ee24
DO
42 showTabs ($pageno, $tabno);
43?>
44 </tr>
45
46 <tr>
c4d215e8 47 <td colspan=2>
b325120a 48<?php
e45a78d7
DO
49if (isset ($tabhandler[$pageno][$tabno]))
50{
3bebaebd
DO
51 if (isset ($page[$pageno]['bypass']) && isset ($page[$pageno]['bypass_type']))
52 {
53 switch ($page[$pageno]['bypass_type'])
54 {
55 case 'uint':
e7fb165f 56 assertUIntArg ($page[$pageno]['bypass']);
3bebaebd 57 break;
105cea6e 58 case 'uint0':
e7fb165f 59 assertUIntArg ($page[$pageno]['bypass'], TRUE);
105cea6e 60 break;
1fbc9fd6 61 case 'inet4':
e7fb165f 62 assertIPv4Arg ($page[$pageno]['bypass']);
1fbc9fd6 63 break;
e1ae3fb4 64 case 'string':
e7fb165f 65 assertStringArg ($page[$pageno]['bypass']);
e1ae3fb4 66 break;
3bebaebd 67 default:
3a089a44 68 throw new RackTablesError ('Dispatching error for bypass parameter', RackTablesError::INTERNAL);
3bebaebd 69 }
9a289f12 70 showMessageOrError();
3a7bdcc6 71 call_user_func ($tabhandler[$pageno][$tabno], $_REQUEST[$page[$pageno]['bypass']]);
3bebaebd 72 }
e45a78d7 73 else
9a289f12
DO
74 {
75 showMessageOrError();
3a7bdcc6 76 call_user_func ($tabhandler[$pageno][$tabno]);
9a289f12 77 }
e45a78d7
DO
78}
79elseif (isset ($page[$pageno]['handler']))
9a289f12
DO
80{
81 showMessageOrError();
e673ee24 82 $page[$pageno]['handler'] ($tabno);
9a289f12 83}
e673ee24 84else
3a089a44 85 throw new RackTablesError ("Failed to find handler for page '${pageno}', tab '${tabno}'", RackTablesError::INTERNAL);
e673ee24
DO
86?>
87 </td>
88 </tr>
89 </table>
90a3d6d8 90<?php
65e557dd
AA
91 $body = ob_get_clean();
92 ob_start();
93 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
94 echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
95 echo '<head><title>' . getTitle ($pageno) . "</title>\n";
96 printPageHeaders();
97 echo "</head>\n";
98 echo "<body>\n$body</body>\n";
99 echo '</html>';
100 ob_flush();
90a3d6d8
DY
101} catch (Exception $e) {
102 ob_end_clean();
103 printException($e);
104}
65e557dd 105