diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index db12f40e34..70d096ccec 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -191,6 +191,14 @@ //add or update the database if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: devices.php'); + exit; + } + //check for all required data $msg = ''; //if (strlen($device_mac_address) == 0) { $msg .= $text['message-required'].$text['label-extension']."
\n"; } @@ -521,6 +529,10 @@ } } +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //show the header require_once "resources/header.php"; @@ -1585,6 +1597,7 @@ if ($action == "update") { echo " \n"; } + echo " \n"; echo "
"; echo " \n"; echo " \n"; diff --git a/app/devices/device_key_edit.php b/app/devices/device_key_edit.php index 8daf02f6e3..aa3ed3f2ae 100644 --- a/app/devices/device_key_edit.php +++ b/app/devices/device_key_edit.php @@ -71,6 +71,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $device_key_uuid = $_POST["device_key_uuid"]; } + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: devices.php'); + exit; + } + //check for all required data //if (strlen($device_key_id) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_id']."
\n"; } //if (strlen($device_key_category) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_category']."
\n"; } @@ -154,6 +162,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql, $parameters, $row); } +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //show the header require_once "resources/header.php"; @@ -361,6 +373,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { echo " \n"; } + echo " \n"; echo "
"; echo " \n"; echo " \n"; diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index 63ad312e7d..c10245475d 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -82,6 +82,14 @@ } } + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: devices.php'); + exit; + } + //check for all required data $msg = ''; if (strlen($device_profile_name) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_name']."
\n"; } @@ -290,6 +298,10 @@ $device_profile_uuid = null; } +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //show the header require_once "resources/header.php"; @@ -686,8 +698,9 @@ echo " \n"; echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo " "; echo ""; diff --git a/app/devices/device_setting_edit.php b/app/devices/device_setting_edit.php index 7e667016ec..7f7c0b8a54 100644 --- a/app/devices/device_setting_edit.php +++ b/app/devices/device_setting_edit.php @@ -67,6 +67,16 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update" && permission_exists('device_setting_edit')) { $device_setting_uuid = $_POST["device_setting_uuid"]; } + + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: devices.php'); + exit; + } + + //check for all required data if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -137,6 +147,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql, $parameters, $row); } +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //show the header require_once "resources/header.php"; if ($action == "update") { @@ -258,6 +272,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { echo " \n"; } + echo " \n"; echo "
"; echo " \n"; echo " \n"; diff --git a/app/devices/device_vendor_edit.php b/app/devices/device_vendor_edit.php index f101813149..7163b5ca2b 100644 --- a/app/devices/device_vendor_edit.php +++ b/app/devices/device_vendor_edit.php @@ -66,6 +66,14 @@ $device_vendor_uuid = $_POST["device_vendor_uuid"]; } + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: devices.php'); + exit; + } + //check for all required data $msg = ''; if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."
\n"; } @@ -129,6 +137,10 @@ unset($sql, $parameters, $row); } +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //show the header require_once "resources/header.php"; @@ -192,9 +204,10 @@ echo " \n"; echo " \n"; if ($action == "update") { - echo " \n"; + echo " \n"; } - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo " "; echo ""; diff --git a/app/devices/device_vendor_function_edit.php b/app/devices/device_vendor_function_edit.php index f6d52743a6..ae7813513e 100644 --- a/app/devices/device_vendor_function_edit.php +++ b/app/devices/device_vendor_function_edit.php @@ -100,6 +100,14 @@ $device_vendor_function_uuid = $_POST["device_vendor_function_uuid"]; } + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: devices.php'); + exit; + } + //check for all required data $msg = ''; //if (strlen($label) == 0) { $msg .= $text['message-required']." ".$text['label-label']."
\n"; } @@ -250,6 +258,10 @@ $groups = $database->select($sql, $parameters, 'all'); unset($sql, $parameters, $sql_where, $index); +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //show the header require_once "resources/header.php"; @@ -372,11 +384,12 @@ echo "\n"; echo " \n"; echo " \n"; - echo " \n"; + echo " \n"; if ($action == "update") { - echo " \n"; + echo " \n"; } - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo " "; echo "";