mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Moved forms folder to includes and added some safety checks for non-admin users
This commit is contained in:
+2
-2
@@ -28,7 +28,7 @@ if (!$_SESSION['authenticated']) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['type']) == 1) {
|
if (preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['type']) == 1) {
|
||||||
if (file_exists('forms/'.$_POST['type'].'.inc.php')) {
|
if (file_exists('includes/forms/'.$_POST['type'].'.inc.php')) {
|
||||||
include_once 'forms/'.$_POST['type'].'.inc.php';
|
include_once 'includes/forms/'.$_POST['type'].'.inc.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,8 @@
|
|||||||
* the source code distribution for details.
|
* 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());
|
dbUpdate(array('value' => '2'), 'callback', '`name` = "enabled"', array());
|
||||||
+4
@@ -12,6 +12,10 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
if ($_POST['state'] == 'true') {
|
if ($_POST['state'] == 'true') {
|
||||||
$state = 1;
|
$state = 1;
|
||||||
}
|
}
|
||||||
+5
@@ -13,6 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// FUA
|
// FUA
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_numeric($_POST['config_id'])) {
|
if (!is_numeric($_POST['config_id'])) {
|
||||||
echo 'error with data';
|
echo 'error with data';
|
||||||
exit;
|
exit;
|
||||||
@@ -13,6 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// FUA
|
// FUA
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_numeric($_POST['config_id']) || empty($_POST['data'])) {
|
if (!is_numeric($_POST['config_id']) || empty($_POST['data'])) {
|
||||||
echo 'error with data';
|
echo 'error with data';
|
||||||
exit;
|
exit;
|
||||||
+5
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// FUA
|
// FUA
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
$device['device_id'] = $_POST['device_id'];
|
$device['device_id'] = $_POST['device_id'];
|
||||||
$module = 'discover_'.$_POST['discovery_module'];
|
$module = 'discover_'.$_POST['discovery_module'];
|
||||||
|
|
||||||
@@ -13,6 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// FUA
|
// FUA
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_numeric($_POST['device_id']) || !is_numeric($_POST['sensor_id']) || (empty($_POST['data']) || !isset($_POST['data']))) {
|
if (!is_numeric($_POST['device_id']) || !is_numeric($_POST['sensor_id']) || (empty($_POST['data']) || !isset($_POST['data']))) {
|
||||||
echo 'error with data';
|
echo 'error with data';
|
||||||
exit;
|
exit;
|
||||||
+4
@@ -12,6 +12,10 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_numeric($_POST['group_id'])) {
|
if (!is_numeric($_POST['group_id'])) {
|
||||||
echo 'error with data';
|
echo 'error with data';
|
||||||
exit;
|
exit;
|
||||||
+4
@@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
// FUA
|
// FUA
|
||||||
$device['device_id'] = $_POST['device_id'];
|
$device['device_id'] = $_POST['device_id'];
|
||||||
$module = 'poll_'.$_POST['poller_module'];
|
$module = 'poll_'.$_POST['poller_module'];
|
||||||
@@ -12,6 +12,15 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (is_admin() === false) {
|
||||||
|
$response = array(
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Need to be admin',
|
||||||
|
);
|
||||||
|
echo _json_encode($response);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Make this part of the API instead of a standalone function
|
// FIXME: Make this part of the API instead of a standalone function
|
||||||
if (!is_numeric($_POST['device_id'])) {
|
if (!is_numeric($_POST['device_id'])) {
|
||||||
$status = 'error';
|
$status = 'error';
|
||||||
@@ -13,6 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// FUA
|
// FUA
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
for ($x = 0; $x < count($_POST['sensor_id']); $x++) {
|
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]));
|
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]));
|
||||||
}
|
}
|
||||||
+5
@@ -13,6 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// FUA
|
// FUA
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_POST['sub_type']) && !empty($_POST['sub_type'])) {
|
if (isset($_POST['sub_type']) && !empty($_POST['sub_type'])) {
|
||||||
dbUpdate(array('sensor_custom' => 'No'), 'sensors', '`sensor_id` = ?', array($_POST['sensor_id']));
|
dbUpdate(array('sensor_custom' => 'No'), 'sensors', '`sensor_id` = ?', array($_POST['sensor_id']));
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,15 @@
|
|||||||
* the source code distribution for details.
|
* 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';
|
$status = 'error';
|
||||||
$message = 'Error updating storage information';
|
$message = 'Error updating storage information';
|
||||||
|
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
* the source code distribution for details.
|
* 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'])) {
|
if (!is_numeric($_POST['user_id']) || !isset($_POST['token'])) {
|
||||||
echo 'ERROR: error with data, please ensure a valid user and token have been specified.';
|
echo 'ERROR: error with data, please ensure a valid user and token have been specified.';
|
||||||
exit;
|
exit;
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_numeric($_POST['token_id'])) {
|
if (!is_numeric($_POST['token_id'])) {
|
||||||
echo 'error with data';
|
echo 'error with data';
|
||||||
exit;
|
exit;
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
* the source code distribution for details.
|
* the source code distribution for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(is_admin() === false) {
|
||||||
|
die('ERROR: You need to be admin');
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_numeric($_POST['token_id'])) {
|
if (!is_numeric($_POST['token_id'])) {
|
||||||
echo 'error with data';
|
echo 'error with data';
|
||||||
exit;
|
exit;
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if (is_admin() === false) {
|
||||||
|
$response = array(
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Need to be admin',
|
||||||
|
);
|
||||||
|
echo _json_encode($response);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$status = 'error';
|
$status = 'error';
|
||||||
$message = 'Error with config';
|
$message = 'Error with config';
|
||||||
|
|
||||||
Reference in New Issue
Block a user