Files
assetmgt/communication_send.php
“VeLiTi” 18469fe958 Refactor authorization checks to use 'permissions' instead of 'profile' in multiple files
- Updated authorization checks in product management, product attributes, configurations, software, and user management files to use 'permissions' for consistency.
- Ensured that all relevant pages correctly check user permissions for read, update, delete, and create actions.
- Adjusted session variable references to align with the new permissions structure across various modules.
2026-01-20 15:00:00 +01:00

75 lines
2.6 KiB
PHP

<?php
defined(page_security_key) or exit;
$page = 'communication_send';
//Check if allowed
if (isAllowed($page,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'R') === 0){
header('location: index.php');
exit;
}
//PAGE Security
$update_allowed = isAllowed($page ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'U');
$delete_allowed = isAllowed($page ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'D');
$create_allowed = isAllowed($page ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'C');
$url = 'index.php?page=communications';
if ($update_allowed === 1){
if (isset($_POST['submit'])) {
//GET ALL POST DATA
$data = json_encode($_POST, JSON_UNESCAPED_UNICODE);
//Secure data
$payload = generate_payload($data);
//API call
$responses = ioServer('/v1/application/firmwareCommunication', $payload);
if ($responses === 'NOK'){
} else {
header('Location: index.php?page=communications&success_msg=4');
exit;
}
}
}
template_header('Communication', 'communication', 'manage');
$view ='
<form action="" method="post">
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
<h2 class="responsive-width-100">'.$communication_send_firmware_h2.'</h2>
<a href="index.php?page=communications" class="btn alt mar-right-2">←</a>
';
if ($update_allowed === 1){
$view .= '<input type="submit" name="submit" value="Save" onclick="return confirm(\'Are you sure you want to send firmware messages?\')" class="btn">';
}
$view .= '</div>';
$view .= '<div class="tabs">
<a href="#" class="active">'.$tab1 .'</a>
</div>
';
//Define Service and partner enabled
$view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100">
<label for="target">'.$communication_target.'</label>
<select id="target" name="target">
<option value="1" >'.$general_soldto .'</option>
<option value="2" >'.$general_shipto .'</option>
<option value="0" >'.$communication_target_both .'</option>
</select>
<label for="hw_version">'.$communication_hw_scope.'</label>
<input id="hw_version" type="text" name="hw_version" placeholder="'.$communication_hw_scope.'" value="" required">
';
$view .= '</div>
</div>';
$view .= '</form>';
//Output
echo $view;
template_footer()?>