r2276 added support for file attachments (re: ticket 56)
[racktables] / process.php
1 <?php
2
3 require 'inc/init.php';
4
5 // FIXME: find a better way to handle this error
6 if ($_REQUEST['op'] == 'addFile' && !isset($_FILES['file']['error'])) {
7 showError ("File upload error, it's size probably exceeds upload_max_filesize directive in php.ini");
8 die;
9 }
10 fixContext();
11
12 if (empty ($op) or !isset ($ophandler[$pageno][$tabno][$op]))
13 {
14 showError ("Invalid request in operation broker: page '${pageno}', tab '${tabno}', op '${op}'", __FILE__);
15 die();
16 }
17
18 // We have a chance to handle an error before starting HTTP header.
19 if (!isset ($delayauth[$pageno][$tabno][$op]) and !permitted())
20 {
21 $errlog = array
22 (
23 'v' => 2,
24 'm' => array (0 => array ('c' => 157)) // operation not permitted
25 );
26 $location = buildWideRedirectURL ($errlog);
27 }
28 else
29 {
30 $location = $ophandler[$pageno][$tabno][$op]();
31 if (empty ($location))
32 {
33 showError ('Operation handler failed to return its status', __FILE__);
34 }
35 }
36 header ("Location: " . $location);
37
38 ?>