r3177 - maintenance->trunk sync of changeset:3137
[racktables] / index.php
1 <?php
2 ob_start();
3 try {
4 require 'inc/interface.php';
5 require 'inc/init.php';
6 // no ctx override is necessary
7 redirectIfNecessary();
8 fixContext();
9 if (!permitted())
10 renderAccessDenied();
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 printStyle();
21 ?>
22 <script language='javascript' type='text/javascript' src='js/racktables.js'></script>
23 <script language='javascript' type='text/javascript' src='js/jquery-1.3.1.min.js'></script>
24 <script language='javascript' type='text/javascript' src='js/live_validation.js'></script>
25 <script language='javascript' type='text/javascript' src='js/codepress/codepress.js'></script>
26 </head>
27 <body>
28 <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%' class=maintable>
29 <tr class=mainheader>
30 <td colspan=2>
31 <table width='100%' cellspacing=0 cellpadding=2 border=0>
32 <tr>
33 <td valign=top><a href='http://racktables.org/'><?php printImageHREF ('logo'); ?></a></td>
34 <td valign=top><div class=greeting><?php printGreeting(); ?></div></td>
35 </tr>
36 </table>
37 </td>
38 </tr>
39
40 <tr>
41 <td class="menubar" colspan=2>
42 <table border="0" width="100%" cellpadding="3" cellspacing="0">
43 <tr>
44 <?php showPathAndSearch ($pageno); ?>
45 </tr>
46 </table>
47 </td>
48 </tr>
49
50 <tr>
51 <?php
52 showTabs ($pageno, $tabno);
53 ?>
54 </tr>
55
56 <tr>
57 <td colspan=2>
58 <?php
59 if (isset ($tabhandler[$pageno][$tabno]))
60 {
61 if (isset ($page[$pageno]['bypass']) && isset ($page[$pageno]['bypass_type']))
62 {
63 switch ($page[$pageno]['bypass_type'])
64 {
65 case 'uint':
66 assertUIntArg ($page[$pageno]['bypass'], 'index');
67 break;
68 case 'uint0':
69 assertUIntArg ($page[$pageno]['bypass'], 'index', TRUE);
70 break;
71 case 'inet4':
72 assertIPv4Arg ($page[$pageno]['bypass'], 'index');
73 break;
74 case 'string':
75 assertStringArg ($page[$pageno]['bypass'], 'index');
76 break;
77 default:
78 showError ('Dispatching error for bypass parameter', __FILE__);
79 break;
80 }
81 showMessageOrError();
82 $tabhandler[$pageno][$tabno] ($_REQUEST[$page[$pageno]['bypass']]);
83 }
84 else
85 {
86 showMessageOrError();
87 $tabhandler[$pageno][$tabno] ();
88 }
89 }
90 elseif (isset ($page[$pageno]['handler']))
91 {
92 showMessageOrError();
93 $page[$pageno]['handler'] ($tabno);
94 }
95 else
96 showError ("Failed to find handler for page '${pageno}', tab '${tabno}'", __FILE__);
97 ?>
98 </td>
99 </tr>
100 </table>
101 </body>
102 </html>
103 <?php
104 ob_end_flush();
105 } catch (Exception $e) {
106 ob_end_clean();
107 printException($e);
108 }