r4278 add unset() back
[racktables] / wwwroot / index.php
CommitLineData
b325120a 1<?php
90a3d6d8
DY
2ob_start();
3try {
e673ee24 4require 'inc/init.php';
36ef72d9
DO
5if (array_key_exists ('module', $_REQUEST))
6{
7 switch ($_REQUEST['module'])
8 {
9 case 'tsuri':
10 genericAssertion ('uri', 'string');
11 proxyStaticURI ($_REQUEST['uri']);
12 break;
13 default:
14 throw new InvalidRequestArgException ('module', $_REQUEST['module']);
15 }
16 exit;
17}
18
19require 'inc/interface.php';
329ec966 20prepareNavigation();
da958e52
DO
21// no ctx override is necessary
22fixContext();
750d26d2 23redirectIfNecessary();
da958e52 24if (!permitted())
da958e52 25 renderAccessDenied();
878512c6 26header ('Content-Type: text/html; charset=UTF-8');
b0348307 27// Only store the tab name after clearance is got. Any failure is unhandleable.
fa5b2764
AA
28if (isset ($_REQUEST['tab']) and ! isset ($_SESSION['RTLT'][$pageno]['dont_remember']))
29 $_SESSION['RTLT'][$pageno] = array ('tabname' => $tabno, 'time' => time());
e673ee24 30
1d4d254b
AA
31// call the main handler - page or tab handler.
32// catch exception and show its error message instead of page/tab content
33try {
e45a78d7 34if (isset ($tabhandler[$pageno][$tabno]))
08408472 35 call_user_func ($tabhandler[$pageno][$tabno], getBypassValue());
e45a78d7 36elseif (isset ($page[$pageno]['handler']))
e673ee24
DO
37 $page[$pageno]['handler'] ($tabno);
38else
1d4d254b 39 showError ("Failed to find handler for page '${pageno}', tab '${tabno}'");
08408472 40$content = ob_get_clean();
1d4d254b
AA
41} catch (Exception $e) {
42 ob_clean();
43 $content = '';
44 showError ("Unhandled exception: " . $e->getMessage());
45}
46
08408472 47ob_start();
e673ee24 48?>
08408472
AA
49<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
50<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
51<head><title><?php echo getTitle ($pageno); ?></title>
52<?php printPageHeaders(); ?>
53</head>
54<body>
55<table border=0 cellpadding=0 cellspacing=0 width="100%" height="100%" class="maintable">
56 <tr class="mainheader"><td>
57 <table width="100%" cellspacing="0" cellpadding="2" border="0">
58 <tr>
59 <td valign=top><a href="http://racktables.org/"><?php printImageHREF ('logo'); ?></a></td>
60 <td valign=top><div class=greeting><?php printGreeting(); ?></div></td>
61 </tr>
62 </table>
63 </td></tr>
64 <tr><td class="menubar">
65 <table border="0" width="100%" cellpadding="3" cellspacing="0">
66 <tr><?php showPathAndSearch ($pageno); ?></tr>
67 </table>
68 </td></tr>
69 <tr><td><?php showTabs ($pageno, $tabno); ?></td></tr>
1d4d254b 70 <tr><td><?php showMessageOrError(); ?></td></tr>
08408472
AA
71 <tr><td><?php echo $content; ?></td></tr>
72</table>
73</body>
74</html>
e410ebfc 75<?php
65e557dd 76 ob_flush();
90a3d6d8
DY
77} catch (Exception $e) {
78 ob_end_clean();
79 printException($e);
80}
1d4d254b 81clearMessages(); // prevent message appearing in foreign tab
e410ebfc 82?>