r4068 mkA(): new helper function
[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
DO
16
17echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
18echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
802deced 19echo '<head><title>' . getTitle ($pageno) . "</title>\n";
d6adad3e 20printPageHeaders();
e673ee24 21?>
eea3ca5e 22</head>
e673ee24
DO
23<body>
24 <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%' class=maintable>
25 <tr class=mainheader>
c4d215e8 26 <td colspan=2>
e673ee24
DO
27 <table width='100%' cellspacing=0 cellpadding=2 border=0>
28 <tr>
1db97c25 29 <td valign=top><a href='http://racktables.org/'><?php printImageHREF ('logo'); ?></a></td>
b325120a 30 <td valign=top><div class=greeting><?php printGreeting(); ?></div></td>
e673ee24
DO
31 </tr>
32 </table>
33 </td>
34 </tr>
35
36 <tr>
c4d215e8 37 <td class="menubar" colspan=2>
e673ee24
DO
38 <table border="0" width="100%" cellpadding="3" cellspacing="0">
39 <tr>
b325120a 40<?php showPathAndSearch ($pageno); ?>
e673ee24
DO
41 </tr>
42 </table>
43 </td>
44 </tr>
45
46 <tr>
b325120a 47<?php
e673ee24
DO
48 showTabs ($pageno, $tabno);
49?>
50 </tr>
51
52 <tr>
c4d215e8 53 <td colspan=2>
b325120a 54<?php
e45a78d7
DO
55if (isset ($tabhandler[$pageno][$tabno]))
56{
3bebaebd
DO
57 if (isset ($page[$pageno]['bypass']) && isset ($page[$pageno]['bypass_type']))
58 {
59 switch ($page[$pageno]['bypass_type'])
60 {
61 case 'uint':
e7fb165f 62 assertUIntArg ($page[$pageno]['bypass']);
3bebaebd 63 break;
105cea6e 64 case 'uint0':
e7fb165f 65 assertUIntArg ($page[$pageno]['bypass'], TRUE);
105cea6e 66 break;
1fbc9fd6 67 case 'inet4':
e7fb165f 68 assertIPv4Arg ($page[$pageno]['bypass']);
1fbc9fd6 69 break;
e1ae3fb4 70 case 'string':
e7fb165f 71 assertStringArg ($page[$pageno]['bypass']);
e1ae3fb4 72 break;
3bebaebd 73 default:
3a089a44 74 throw new RackTablesError ('Dispatching error for bypass parameter', RackTablesError::INTERNAL);
3bebaebd 75 }
9a289f12 76 showMessageOrError();
3a7bdcc6 77 call_user_func ($tabhandler[$pageno][$tabno], $_REQUEST[$page[$pageno]['bypass']]);
3bebaebd 78 }
e45a78d7 79 else
9a289f12
DO
80 {
81 showMessageOrError();
3a7bdcc6 82 call_user_func ($tabhandler[$pageno][$tabno]);
9a289f12 83 }
e45a78d7
DO
84}
85elseif (isset ($page[$pageno]['handler']))
9a289f12
DO
86{
87 showMessageOrError();
e673ee24 88 $page[$pageno]['handler'] ($tabno);
9a289f12 89}
e673ee24 90else
3a089a44 91 throw new RackTablesError ("Failed to find handler for page '${pageno}', tab '${tabno}'", RackTablesError::INTERNAL);
e673ee24
DO
92?>
93 </td>
94 </tr>
95 </table>
96</body>
97</html>
90a3d6d8
DY
98<?php
99 ob_end_flush();
100} catch (Exception $e) {
101 ob_end_clean();
102 printException($e);
103}