diff --git a/html/ajax_form.php b/html/ajax_form.php index b668551dd..999a43a4d 100644 --- a/html/ajax_form.php +++ b/html/ajax_form.php @@ -28,7 +28,7 @@ if (!$_SESSION['authenticated']) { } if (preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['type']) == 1) { - if (file_exists('forms/'.$_POST['type'].'.inc.php')) { - include_once 'forms/'.$_POST['type'].'.inc.php'; + if (file_exists('includes/forms/'.$_POST['type'].'.inc.php')) { + include_once 'includes/forms/'.$_POST['type'].'.inc.php'; } } diff --git a/html/forms/ack-alert.inc.php b/html/includes/forms/ack-alert.inc.php similarity index 100% rename from html/forms/ack-alert.inc.php rename to html/includes/forms/ack-alert.inc.php diff --git a/html/forms/alert-templates.inc.php b/html/includes/forms/alert-templates.inc.php similarity index 100% rename from html/forms/alert-templates.inc.php rename to html/includes/forms/alert-templates.inc.php diff --git a/html/forms/attach-alert-template.inc.php b/html/includes/forms/attach-alert-template.inc.php similarity index 100% rename from html/forms/attach-alert-template.inc.php rename to html/includes/forms/attach-alert-template.inc.php diff --git a/html/forms/callback-clear.inc.php b/html/includes/forms/callback-clear.inc.php similarity index 88% rename from html/forms/callback-clear.inc.php rename to html/includes/forms/callback-clear.inc.php index 236c28c90..38d990639 100644 --- a/html/forms/callback-clear.inc.php +++ b/html/includes/forms/callback-clear.inc.php @@ -12,4 +12,8 @@ * the source code distribution for details. */ +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + dbUpdate(array('value' => '2'), 'callback', '`name` = "enabled"', array()); diff --git a/html/forms/callback-statistics.inc.php b/html/includes/forms/callback-statistics.inc.php similarity index 91% rename from html/forms/callback-statistics.inc.php rename to html/includes/forms/callback-statistics.inc.php index 7e934b22d..36a2c4d9d 100644 --- a/html/forms/callback-statistics.inc.php +++ b/html/includes/forms/callback-statistics.inc.php @@ -12,6 +12,10 @@ * the source code distribution for details. */ +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + if ($_POST['state'] == 'true') { $state = 1; } diff --git a/html/forms/config-item-disable.inc.php b/html/includes/forms/config-item-disable.inc.php similarity index 93% rename from html/forms/config-item-disable.inc.php rename to html/includes/forms/config-item-disable.inc.php index 73ebfa5a2..a3475049f 100644 --- a/html/forms/config-item-disable.inc.php +++ b/html/includes/forms/config-item-disable.inc.php @@ -13,6 +13,11 @@ */ // FUA + +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + if (!is_numeric($_POST['config_id'])) { echo 'error with data'; exit; diff --git a/html/forms/config-item-update.inc.php b/html/includes/forms/config-item-update.inc.php similarity index 92% rename from html/forms/config-item-update.inc.php rename to html/includes/forms/config-item-update.inc.php index bb8c12559..6f7b40e4e 100644 --- a/html/forms/config-item-update.inc.php +++ b/html/includes/forms/config-item-update.inc.php @@ -13,6 +13,11 @@ */ // FUA + +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + if (!is_numeric($_POST['config_id']) || empty($_POST['data'])) { echo 'error with data'; exit; diff --git a/html/forms/config-item.inc.php b/html/includes/forms/config-item.inc.php similarity index 100% rename from html/forms/config-item.inc.php rename to html/includes/forms/config-item.inc.php diff --git a/html/forms/create-alert-item.inc.php b/html/includes/forms/create-alert-item.inc.php similarity index 100% rename from html/forms/create-alert-item.inc.php rename to html/includes/forms/create-alert-item.inc.php diff --git a/html/forms/create-device-group.inc.php b/html/includes/forms/create-device-group.inc.php similarity index 100% rename from html/forms/create-device-group.inc.php rename to html/includes/forms/create-device-group.inc.php diff --git a/html/forms/create-map-item.inc.php b/html/includes/forms/create-map-item.inc.php similarity index 100% rename from html/forms/create-map-item.inc.php rename to html/includes/forms/create-map-item.inc.php diff --git a/html/forms/delete-alert-map.inc.php b/html/includes/forms/delete-alert-map.inc.php similarity index 100% rename from html/forms/delete-alert-map.inc.php rename to html/includes/forms/delete-alert-map.inc.php diff --git a/html/forms/delete-alert-rule.inc.php b/html/includes/forms/delete-alert-rule.inc.php similarity index 100% rename from html/forms/delete-alert-rule.inc.php rename to html/includes/forms/delete-alert-rule.inc.php diff --git a/html/forms/delete-alert-template.inc.php b/html/includes/forms/delete-alert-template.inc.php similarity index 100% rename from html/forms/delete-alert-template.inc.php rename to html/includes/forms/delete-alert-template.inc.php diff --git a/html/forms/delete-device-group.inc.php b/html/includes/forms/delete-device-group.inc.php similarity index 100% rename from html/forms/delete-device-group.inc.php rename to html/includes/forms/delete-device-group.inc.php diff --git a/html/forms/discovery-module-update.inc.php b/html/includes/forms/discovery-module-update.inc.php similarity index 90% rename from html/forms/discovery-module-update.inc.php rename to html/includes/forms/discovery-module-update.inc.php index 61a0a28b6..168afe561 100644 --- a/html/forms/discovery-module-update.inc.php +++ b/html/includes/forms/discovery-module-update.inc.php @@ -1,6 +1,11 @@ 'error', + 'message' => 'Need to be admin', + ); + echo _json_encode($response); + exit; +} + // FIXME: Make this part of the API instead of a standalone function if (!is_numeric($_POST['device_id'])) { $status = 'error'; diff --git a/html/forms/schedule-maintenance.inc.php b/html/includes/forms/schedule-maintenance.inc.php similarity index 100% rename from html/forms/schedule-maintenance.inc.php rename to html/includes/forms/schedule-maintenance.inc.php diff --git a/html/forms/sensor-alert-reset.inc.php b/html/includes/forms/sensor-alert-reset.inc.php similarity index 91% rename from html/forms/sensor-alert-reset.inc.php rename to html/includes/forms/sensor-alert-reset.inc.php index eb6b2b967..2c027e647 100644 --- a/html/forms/sensor-alert-reset.inc.php +++ b/html/includes/forms/sensor-alert-reset.inc.php @@ -13,6 +13,11 @@ */ // FUA + +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + for ($x = 0; $x < count($_POST['sensor_id']); $x++) { dbUpdate(array('sensor_limit' => $_POST['sensor_limit'][$x], 'sensor_limit_low' => $_POST['sensor_limit_low'][$x], 'sensor_alert' => $_POST['sensor_alert'][$x]), 'sensors', '`sensor_id` = ?', array($_POST['sensor_id'][$x])); } diff --git a/html/forms/sensor-alert-update.inc.php b/html/includes/forms/sensor-alert-update.inc.php similarity index 94% rename from html/forms/sensor-alert-update.inc.php rename to html/includes/forms/sensor-alert-update.inc.php index b0596db89..16c5742a6 100644 --- a/html/forms/sensor-alert-update.inc.php +++ b/html/includes/forms/sensor-alert-update.inc.php @@ -13,6 +13,11 @@ */ // FUA + +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + if (isset($_POST['sub_type']) && !empty($_POST['sub_type'])) { dbUpdate(array('sensor_custom' => 'No'), 'sensors', '`sensor_id` = ?', array($_POST['sensor_id'])); } diff --git a/html/forms/storage-update.inc.php b/html/includes/forms/storage-update.inc.php similarity index 88% rename from html/forms/storage-update.inc.php rename to html/includes/forms/storage-update.inc.php index 200a8f3d6..9c711db36 100644 --- a/html/forms/storage-update.inc.php +++ b/html/includes/forms/storage-update.inc.php @@ -12,6 +12,15 @@ * the source code distribution for details. */ +if (is_admin() === false) { + $response = array( + 'status' => 'error', + 'message' => 'Need to be admin', + ); + echo _json_encode($response); + exit; +} + $status = 'error'; $message = 'Error updating storage information'; diff --git a/html/forms/token-item-create.inc.php b/html/includes/forms/token-item-create.inc.php similarity index 94% rename from html/forms/token-item-create.inc.php rename to html/includes/forms/token-item-create.inc.php index b7c04944b..61810287a 100644 --- a/html/forms/token-item-create.inc.php +++ b/html/includes/forms/token-item-create.inc.php @@ -12,6 +12,10 @@ * the source code distribution for details. */ +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + if (!is_numeric($_POST['user_id']) || !isset($_POST['token'])) { echo 'ERROR: error with data, please ensure a valid user and token have been specified.'; exit; diff --git a/html/forms/token-item-disable.inc.php b/html/includes/forms/token-item-disable.inc.php similarity index 93% rename from html/forms/token-item-disable.inc.php rename to html/includes/forms/token-item-disable.inc.php index 987464ef1..1f962c020 100644 --- a/html/forms/token-item-disable.inc.php +++ b/html/includes/forms/token-item-disable.inc.php @@ -12,6 +12,10 @@ * the source code distribution for details. */ +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + if (!is_numeric($_POST['token_id'])) { echo 'error with data'; exit; diff --git a/html/forms/token-item-remove.inc.php b/html/includes/forms/token-item-remove.inc.php similarity index 92% rename from html/forms/token-item-remove.inc.php rename to html/includes/forms/token-item-remove.inc.php index e2f111efd..4d494672c 100644 --- a/html/forms/token-item-remove.inc.php +++ b/html/includes/forms/token-item-remove.inc.php @@ -12,6 +12,10 @@ * the source code distribution for details. */ +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + if (!is_numeric($_POST['token_id'])) { echo 'error with data'; exit; diff --git a/html/forms/update-alert-rule.inc.php b/html/includes/forms/update-alert-rule.inc.php similarity index 100% rename from html/forms/update-alert-rule.inc.php rename to html/includes/forms/update-alert-rule.inc.php diff --git a/html/forms/update-config-item.inc.php b/html/includes/forms/update-config-item.inc.php similarity index 100% rename from html/forms/update-config-item.inc.php rename to html/includes/forms/update-config-item.inc.php diff --git a/html/forms/update-dashboard-config.inc.php b/html/includes/forms/update-dashboard-config.inc.php similarity index 100% rename from html/forms/update-dashboard-config.inc.php rename to html/includes/forms/update-dashboard-config.inc.php diff --git a/html/forms/update-ports.inc.php b/html/includes/forms/update-ports.inc.php similarity index 92% rename from html/forms/update-ports.inc.php rename to html/includes/forms/update-ports.inc.php index 24754e246..5c0e327a9 100644 --- a/html/forms/update-ports.inc.php +++ b/html/includes/forms/update-ports.inc.php @@ -1,5 +1,14 @@ 'error', + 'message' => 'Need to be admin', + ); + echo _json_encode($response); + exit; +} + $status = 'error'; $message = 'Error with config';