- Updated session variables to use 'authorization' array instead of 'username' for user identification across multiple files. - Introduced a new function `getUserPermissions` to consolidate user permissions retrieval based on assigned roles. - Modified API calls to use the new authorization structure and updated endpoints to v2. - Enhanced language support by adding 'PL' to the list of supported languages. - Cleaned up redundant code and improved session management during user login and registration processes. - Added a new API endpoint for fetching user permissions based on user ID.
75 lines
2.6 KiB
PHP
75 lines
2.6 KiB
PHP
<?php
|
|
defined(page_security_key) or exit;
|
|
|
|
$page = 'communication_send';
|
|
//Check if allowed
|
|
if (isAllowed($page,$_SESSION['authorization']['profile'],$_SESSION['authorization']['permission'],'R') === 0){
|
|
header('location: index.php');
|
|
exit;
|
|
}
|
|
//PAGE Security
|
|
$update_allowed = isAllowed($page ,$_SESSION['authorization']['profile'],$_SESSION['authorization']['permission'],'U');
|
|
$delete_allowed = isAllowed($page ,$_SESSION['authorization']['profile'],$_SESSION['authorization']['permission'],'D');
|
|
$create_allowed = isAllowed($page ,$_SESSION['authorization']['profile'],$_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()?>
|