r3016 - update initial values in AttributeMap accordingly
[racktables] / process.php
CommitLineData
b325120a 1<?php
90a3d6d8
DY
2ob_start();
3try {
b6a7d936
DO
4// Include init after ophandlers, not before, so local.php can redefine things later.
5require 'inc/ophandlers.php';
e673ee24 6require 'inc/init.php';
e1ae3fb4
AD
7
8// FIXME: find a better way to handle this error
9if ($_REQUEST['op'] == 'addFile' && !isset($_FILES['file']['error'])) {
10 showError ("File upload error, it's size probably exceeds upload_max_filesize directive in php.ini");
11 die;
12}
da958e52 13fixContext();
e673ee24 14
59a83bd8 15if (!strlen ($op) or !isset ($ophandler[$pageno][$tabno][$op]))
e673ee24 16{
b0348307 17 showError ("Invalid request in operation broker: page '${pageno}', tab '${tabno}', op '${op}'", __FILE__);
e673ee24
DO
18 die();
19}
20
56a797ef
DO
21// This is the only exception at the moment, so its handling is hardcoded.
22if ($op == 'querySNMPData')
23 include 'inc/snmp.php';
24
e673ee24 25// We have a chance to handle an error before starting HTTP header.
46f92ff7 26if (!isset ($delayauth[$pageno][$tabno][$op]) and !permitted())
db55cf54 27 $location = buildWideRedirectURL (oneLiner (157)); // operation not permitted
46f92ff7 28else
7056988c 29{
46f92ff7 30 $location = $ophandler[$pageno][$tabno][$op]();
59a83bd8 31 if (!strlen ($location))
7056988c
DO
32 {
33 showError ('Operation handler failed to return its status', __FILE__);
34 }
35}
e673ee24 36header ("Location: " . $location);
90a3d6d8
DY
37ob_end_flush();
38}
39catch (Exception $e)
40{
41 ob_end_clean();
42 printException($e);
43}
44?>
e673ee24
DO
45
46?>