r2828 - fixContext(): check return value of spotEntity() (ticket:51)
[racktables] / process.php
CommitLineData
b325120a 1<?php
e673ee24 2
b6a7d936
DO
3// Include init after ophandlers, not before, so local.php can redefine things later.
4require 'inc/ophandlers.php';
e673ee24 5require 'inc/init.php';
e1ae3fb4
AD
6
7// FIXME: find a better way to handle this error
8if ($_REQUEST['op'] == 'addFile' && !isset($_FILES['file']['error'])) {
9 showError ("File upload error, it's size probably exceeds upload_max_filesize directive in php.ini");
10 die;
11}
da958e52 12fixContext();
e673ee24 13
59a83bd8 14if (!strlen ($op) or !isset ($ophandler[$pageno][$tabno][$op]))
e673ee24 15{
b0348307 16 showError ("Invalid request in operation broker: page '${pageno}', tab '${tabno}', op '${op}'", __FILE__);
e673ee24
DO
17 die();
18}
19
20// We have a chance to handle an error before starting HTTP header.
46f92ff7 21if (!isset ($delayauth[$pageno][$tabno][$op]) and !permitted())
db55cf54 22 $location = buildWideRedirectURL (oneLiner (157)); // operation not permitted
46f92ff7 23else
7056988c 24{
46f92ff7 25 $location = $ophandler[$pageno][$tabno][$op]();
59a83bd8 26 if (!strlen ($location))
7056988c
DO
27 {
28 showError ('Operation handler failed to return its status', __FILE__);
29 }
30}
e673ee24
DO
31header ("Location: " . $location);
32
33?>