r4073 minor change in UI for recent change: VST form commit on ENTER and hints on...
[racktables] / index.php
1 <?php
2 ob_start();
3 try {
4 require 'inc/interface.php';
5 require 'inc/init.php';
6 prepareNavigation();
7 // no ctx override is necessary
8 fixContext();
9 redirectIfNecessary();
10 if (!permitted())
11 renderAccessDenied();
12 header ('Content-Type: text/html; charset=UTF-8');
13 // Only store the tab name after clearance is got. Any failure is unhandleable.
14 if (isset ($_REQUEST['tab']) and ! isset ($_SESSION['RTLT'][$pageno]['dont_remember']))
15 $_SESSION['RTLT'][$pageno] = array ('tabname' => $tabno, 'time' => time());
16
17 ?>
18 <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%' class=maintable>
19 <tr class=mainheader>
20 <td colspan=2>
21 <table width='100%' cellspacing=0 cellpadding=2 border=0>
22 <tr>
23 <td valign=top><a href='http://racktables.org/'><?php printImageHREF ('logo'); ?></a></td>
24 <td valign=top><div class=greeting><?php printGreeting(); ?></div></td>
25 </tr>
26 </table>
27 </td>
28 </tr>
29
30 <tr>
31 <td class="menubar" colspan=2>
32 <table border="0" width="100%" cellpadding="3" cellspacing="0">
33 <tr>
34 <?php showPathAndSearch ($pageno); ?>
35 </tr>
36 </table>
37 </td>
38 </tr>
39
40 <tr>
41 <?php
42 showTabs ($pageno, $tabno);
43 ?>
44 </tr>
45
46 <tr>
47 <td colspan=2>
48 <?php
49 if (isset ($tabhandler[$pageno][$tabno]))
50 {
51 if (isset ($page[$pageno]['bypass']) && isset ($page[$pageno]['bypass_type']))
52 {
53 switch ($page[$pageno]['bypass_type'])
54 {
55 case 'uint':
56 assertUIntArg ($page[$pageno]['bypass']);
57 break;
58 case 'uint0':
59 assertUIntArg ($page[$pageno]['bypass'], TRUE);
60 break;
61 case 'inet4':
62 assertIPv4Arg ($page[$pageno]['bypass']);
63 break;
64 case 'string':
65 assertStringArg ($page[$pageno]['bypass']);
66 break;
67 default:
68 throw new RackTablesError ('Dispatching error for bypass parameter', RackTablesError::INTERNAL);
69 }
70 showMessageOrError();
71 call_user_func ($tabhandler[$pageno][$tabno], $_REQUEST[$page[$pageno]['bypass']]);
72 }
73 else
74 {
75 showMessageOrError();
76 call_user_func ($tabhandler[$pageno][$tabno]);
77 }
78 }
79 elseif (isset ($page[$pageno]['handler']))
80 {
81 showMessageOrError();
82 $page[$pageno]['handler'] ($tabno);
83 }
84 else
85 throw new RackTablesError ("Failed to find handler for page '${pageno}', tab '${tabno}'", RackTablesError::INTERNAL);
86 ?>
87 </td>
88 </tr>
89 </table>
90 <?php
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();
101 } catch (Exception $e) {
102 ob_end_clean();
103 printException($e);
104 }
105