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