r3789 rewrite relnotes array in a way to make use of PRE element
[racktables] / process.php
1 <?php
2 ob_start();
3 try {
4 // Include init after ophandlers/snmp, not before, so local.php can redefine things.
5 require 'inc/ophandlers.php';
6 // snmp.php is an exception, it is treated by a special hack
7 if (isset ($_REQUEST['op']) and $_REQUEST['op'] == 'querySNMPData')
8 include 'inc/snmp.php';
9 require 'inc/init.php';
10 assertStringArg ('op');
11 $op = $_REQUEST['op'];
12 prepareNavigation();
13 // FIXME: find a better way to handle this error
14 if ($op == 'addFile' && !isset($_FILES['file']['error']))
15 throw new Exception ('File upload error, check upload_max_filesize in php.ini', E_INTERNAL);
16 fixContext();
17
18 if (!isset ($ophandler[$pageno][$tabno][$op]) or !function_exists ($ophandler[$pageno][$tabno][$op]))
19 throw new Exception ("Invalid navigation data for '${pageno}-${tabno}-${op}'", E_INTERNAL);
20
21 // We have a chance to handle an error before starting HTTP header.
22 if (!isset ($delayauth[$pageno][$tabno][$op]) and !permitted())
23 $location = buildWideRedirectURL (oneLiner (157)); // operation not permitted
24 else
25 {
26 $location = call_user_func ($ophandler[$pageno][$tabno][$op]);
27 if (!strlen ($location))
28 throw new Exception ('Operation handler failed to return its status', E_INTERNAL);
29 }
30 header ("Location: " . $location);
31 ob_end_flush();
32 }
33 catch (Exception $e)
34 {
35 ob_end_clean();
36 if ($e->getCode() == E_DB_CONSTRAINT)
37 header ('Location: ' . buildWideRedirectURL (oneLiner (108, array ($e->getMessage()))));
38 else
39 printException($e);
40 }
41
42 ?>