Improve code

This commit is contained in:
Jose Gonzalez 2023-02-06 23:10:28 +01:00
parent ac144de6d6
commit dfdcb688d4
9 changed files with 310 additions and 272 deletions

View File

@ -39,12 +39,13 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
}
enterprise_include_once('meta/include/functions_users_meta.php');
$tab = get_parameter('tab', 'profile');
$pure = get_parameter('pure', 0);
// Get parameters.
$tab = get_parameter('tab', 'profile');
$pure = get_parameter('pure', 0);
$new_profile = (bool) get_parameter('new_profile');
$id_profile = (int) get_parameter('id');
// Header.
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
$buttons = [
'user' => [
'active' => false,
@ -72,13 +73,29 @@ if (!is_metaconsole()) {
$buttons[$tab]['active'] = true;
ui_print_page_header(
__('User management').' » '.__('Profiles defined on %s', get_product_name()),
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
ui_print_standard_header(
__('Edit profile %s', $profile['name']),
'images/gm_users.png',
false,
'configure_profiles_tab',
true,
$buttons
$buttons,
[
[
'link' => '',
'label' => __('Profiles'),
],
[
'link' => '',
'label' => __('Manage users'),
],
[
'link' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/profile_list&tab=profile'),
'label' => __('User Profile management'),
],
]
);
$sec2 = 'gusuarios';
} else {
@ -86,10 +103,6 @@ if (!is_metaconsole()) {
$sec2 = 'advanced';
}
$new_profile = (bool) get_parameter('new_profile');
$id_profile = (int) get_parameter('id');
// Edit profile.
if ($id_profile || $new_profile) {
if ($new_profile) {

View File

@ -54,71 +54,27 @@ if ($enterprise_include === true) {
enterprise_include_once('meta/include/functions_users_meta.php');
}
if (is_metaconsole() === false) {
date_default_timezone_set('UTC');
include 'include/javascript/timezonepicker/includes/parser.inc';
// Read in options for map builder.
$bases = [
'gray' => 'Gray',
'blue-marble' => 'Blue marble',
'night-electric' => 'Night Electric',
'living' => 'Living Earth',
];
$local_file = 'include/javascript/timezonepicker/images/gray-400.png';
// Dimensions must always be exact since the imagemap does not scale.
$array_size = getimagesize($local_file);
$map_width = $array_size[0];
$map_height = $array_size[1];
$timezones = timezone_picker_parse_files(
$map_width,
$map_height,
'include/javascript/timezonepicker/tz_world.txt',
'include/javascript/timezonepicker/tz_islands.txt'
);
foreach ($timezones as $timezone_name => $tz) {
if ($timezone_name == 'America/Montreal') {
$timezone_name = 'America/Toronto';
} else if ($timezone_name == 'Asia/Chongqing') {
$timezone_name = 'Asia/Shanghai';
}
$area_data_timezone_polys .= '';
foreach ($tz['polys'] as $coords) {
$area_data_timezone_polys .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="poly" coords="'.implode(',', $coords).'" />';
}
$area_data_timezone_rects .= '';
foreach ($tz['rects'] as $coords) {
$area_data_timezone_rects .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="rect" coords="'.implode(',', $coords).'" />';
}
}
}
// This defines the working user. Beware with this, old code get confusses
// and operates with current logged user (dangerous).
$id = get_parameter('id', get_parameter('id_user', ''));
// Check if we are the same user for edit or we have a proper profile for edit users.
if ($id !== $config['id_user']) {
if ((bool) check_acl($config['id_user'], 0, 'UM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access User Management'
);
include 'general/noaccess.php';
return;
}
}
// ID given as parameter.
$pure = get_parameter('pure', 0);
$user_info = get_user_info($id);
$is_err = false;
if ((bool) check_acl($config['id_user'], 0, 'UM') === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access User Management'
);
include 'general/noaccess.php';
return;
}
if (is_ajax() === true) {
$delete_profile = (bool) get_parameter('delete_profile');
$get_user_profile = (bool) get_parameter('get_user_profile');
@ -270,7 +226,7 @@ enterprise_hook('open_meta_frame');
$tab = get_parameter('tab', 'user');
// Save autorefresh list.
$autorefresh_list = get_parameter_post('autorefresh_list');
$autorefresh_list = (array) get_parameter_post('autorefresh_list');
$autorefresh_white_list = (($autorefresh_list[0] === '') || ($autorefresh_list[0] === '0')) ? '' : json_encode($autorefresh_list);
// Header.
@ -338,6 +294,7 @@ if ((bool) $config['user_can_update_info'] === true) {
$view_mode = true;
}
$delete_profile = (is_ajax() === true) ? (bool) get_parameter('delete_profile') : false;
$new_user = (bool) get_parameter('new_user');
$create_user = (bool) get_parameter('create_user');
$add_profile = (bool) get_parameter('add_profile');
@ -564,6 +521,7 @@ if ($create_user === true) {
$info
);
HD('patatas', true);
ui_print_result_message(
$result,
__('Successfully created'),
@ -1002,7 +960,7 @@ if ($add_profile && empty($json_profile)) {
);
}
if ($values) {
if (isset($values) === true && empty($values) === false) {
$user_info = $values;
}
@ -1530,7 +1488,7 @@ $default_event_filter .= html_print_select(
false
).'</div>';
if ($config['ehorus_user_level_conf']) {
if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) {
$ehorus = '<div class="label_select_simple"><p class="edit_user_labels">'.__('eHorus user access enabled').'</p>';
$ehorus .= html_print_checkbox_switch(
'ehorus_user_level_enabled',
@ -1562,7 +1520,7 @@ if ($config['ehorus_user_level_conf']) {
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $id);
if ($config['double_auth_enabled'] && check_acl($config['id_user'], 0, 'PM')) {
if (isset($config['double_auth_enabled']) === true && (bool) ($config['double_auth_enabled']) === true && check_acl($config['id_user'], 0, 'PM')) {
$double_authentication = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Double authentication').'</p>';
if (($config['2FA_all_users'] == '' && !$double_auth_enabled)
|| ($config['double_auth_enabled'] == '' && $double_auth_enabled)
@ -1678,14 +1636,10 @@ if (is_metaconsole() === true) {
).'</div>';
}
echo '<div class="max_floating_element_size mrgn_20px">';
echo '<form id="user_profile_form" name="user_profile_form" method="post" autocomplete="off" action="#">';
require_once 'user_management.php';
if (!$id) {
$user_id_update_view = $user_id;
$user_id_create = '';
@ -1696,138 +1650,138 @@ if (!$id) {
if (is_metaconsole() === true) {
$access_or_pagination = $meta_access;
if ($id != '' && !$is_err) {
$div_user_info = '<div class="edit_user_info_left">'.$avatar.$user_id_create.'</div>
<div class="edit_user_info_right">'.$user_id_update_view.$full_name.$new_pass.$new_pass_confirm.$own_pass_confirm.$global_profile.'</div>';
} else {
$div_user_info = '<div class="edit_user_info_left">'.$avatar.'</div>
<div class="edit_user_info_right">'.$user_id_create.$user_id_update_view.$full_name.$new_pass.$new_pass_confirm.$global_profile.'</div>';
}
echo '<div id="user_form">
<div class="user_edit_first_row">
<div class="edit_user_info white_box">'.$div_user_info.'</div>
<div class="edit_user_autorefresh white_box"><p class="bolder">Extra info</p>'.$email.$phone.$not_login.$local_user.$session_time.'</div>
</div>
<div class="user_edit_second_row white_box">
<div class="edit_user_options">'.$language.$access_or_pagination.$skin.$default_event_filter.$double_authentication.'</div>
<div class="edit_user_timezone">'.$timezone;
echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_access_node;
$autorefresh_show = '<p class="edit_user_labels">'._('Autorefresh').ui_print_help_tip(
__('This will activate autorefresh in selected pages'),
true
).'</p>';
$select_out = html_print_select(
$autorefresh_list_out,
'autorefresh_list_out[]',
'',
'',
'',
'',
true,
true,
true,
'',
false,
'width:100%'
);
$arrows = ' ';
$select_in = html_print_select(
$autorefresh_list,
'autorefresh_list[]',
'',
'',
'',
'',
true,
true,
true,
'',
false,
'width:100%'
);
$table_ichanges = '<div class="autorefresh_select">
<div class="autorefresh_select_list_out">
<p class="autorefresh_select_text">'.__('Full list of pages').': </p>
<div>'.$select_out.'</div>
</div>
<div class="autorefresh_select_arrows" style="display:grid">
<a href="javascript:">'.html_print_image(
'images/darrowright_green.png',
true,
[
'id' => 'right_autorefreshlist',
'alt' => __('Push selected pages into autorefresh list'),
'title' => __('Push selected pages into autorefresh list'),
]
).'</a>
<a href="javascript:">'.html_print_image(
'images/darrowleft_green.png',
true,
[
'id' => 'left_autorefreshlist',
'alt' => __('Pop selected pages out of autorefresh list'),
'title' => __('Pop selected pages out of autorefresh list'),
]
).'</a>
</div>
<div class="autorefresh_select_list">
<p class="autorefresh_select_text">'.__('List of pages with autorefresh').': </p>
<div>'.$select_in.'</div>
</div>
</div>';
$autorefresh_show .= $table_ichanges;
// Time autorefresh.
$times = get_refresh_time_array();
$time_autorefresh = '<div class="label_select"><p class="edit_user_labels">'.__('Time autorefresh');
$time_autorefresh .= ui_print_help_tip(
__('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'),
true
).'</p>';
$time_autorefresh .= html_print_select(
$times,
'time_autorefresh',
$user_info['time_autorefresh'],
'',
'',
'',
true,
false,
false
).'</div>';
echo '</div>
</div>
<div class="edit_user_autorefresh white_box">'.$autorefresh_show.$time_autorefresh.'</div>
<div class="user_edit_third_row white_box">
<div class="edit_user_comments">'.$comments.'</div>
</div>';
if (empty($ehorus) === false) {
html_print_div(
[
'class' => 'user_edit_third_row white_box',
'content' => $ehorus,
],
true
);
}
} else {
$access_or_pagination = $size_pagination;
}
if ($id != '' && !$is_err) {
$div_user_info = '<div class="edit_user_info_left">'.$avatar.$user_id_create.'</div>
<div class="edit_user_info_right">'.$user_id_update_view.$full_name.$new_pass.$new_pass_confirm.$own_pass_confirm.$global_profile.'</div>';
} else {
$div_user_info = '<div class="edit_user_info_left">'.$avatar.'</div>
<div class="edit_user_info_right">'.$user_id_create.$user_id_update_view.$full_name.$new_pass.$new_pass_confirm.$global_profile.'</div>';
}
echo '<div id="user_form">
<div class="user_edit_first_row">
<div class="edit_user_info white_box">'.$div_user_info.'</div>
<div class="edit_user_autorefresh white_box"><p class="bolder">Extra info</p>'.$email.$phone.$not_login.$local_user.$session_time.'</div>
</div>
<div class="user_edit_second_row white_box">
<div class="edit_user_options">'.$language.$access_or_pagination.$skin.$default_event_filter.$double_authentication.'</div>
<div class="edit_user_timezone">'.$timezone;
if (is_metaconsole() === false) {
echo '<div id="timezone-picker">
<img id="timezone-image" src="'.$local_file.'" width="'.$map_width.'" height="'.$map_height.'" usemap="#timezone-map" />
<img class="timezone-pin" src="include/javascript/timezonepicker/images/pin.png" class="pdd_t_4px" />
<map name="timezone-map" id="timezone-map">'.$area_data_timezone_polys.$area_data_timezone_rects.'</map>
</div>';
} else {
echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_access_node;
}
$autorefresh_show = '<p class="edit_user_labels">'._('Autorefresh').ui_print_help_tip(
__('This will activate autorefresh in selected pages'),
true
).'</p>';
$select_out = html_print_select(
$autorefresh_list_out,
'autorefresh_list_out[]',
'',
'',
'',
'',
true,
true,
true,
'',
false,
'width:100%'
);
$arrows = ' ';
$select_in = html_print_select(
$autorefresh_list,
'autorefresh_list[]',
'',
'',
'',
'',
true,
true,
true,
'',
false,
'width:100%'
);
$table_ichanges = '<div class="autorefresh_select">
<div class="autorefresh_select_list_out">
<p class="autorefresh_select_text">'.__('Full list of pages').': </p>
<div>'.$select_out.'</div>
</div>
<div class="autorefresh_select_arrows" style="display:grid">
<a href="javascript:">'.html_print_image(
'images/darrowright_green.png',
true,
[
'id' => 'right_autorefreshlist',
'alt' => __('Push selected pages into autorefresh list'),
'title' => __('Push selected pages into autorefresh list'),
]
).'</a>
<a href="javascript:">'.html_print_image(
'images/darrowleft_green.png',
true,
[
'id' => 'left_autorefreshlist',
'alt' => __('Pop selected pages out of autorefresh list'),
'title' => __('Pop selected pages out of autorefresh list'),
]
).'</a>
</div>
<div class="autorefresh_select_list">
<p class="autorefresh_select_text">'.__('List of pages with autorefresh').': </p>
<div>'.$select_in.'</div>
</div>
</div>';
$autorefresh_show .= $table_ichanges;
// Time autorefresh.
$times = get_refresh_time_array();
$time_autorefresh = '<div class="label_select"><p class="edit_user_labels">'.__('Time autorefresh');
$time_autorefresh .= ui_print_help_tip(
__('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'),
true
).'</p>';
$time_autorefresh .= html_print_select(
$times,
'time_autorefresh',
$user_info['time_autorefresh'],
'',
'',
'',
true,
false,
false
).'</div>';
echo '</div>
</div>
<div class="edit_user_autorefresh white_box">'.$autorefresh_show.$time_autorefresh.'</div>
<div class="user_edit_third_row white_box">
<div class="edit_user_comments">'.$comments.'</div>
</div>';
if (!empty($ehorus)) {
echo '<div class="user_edit_third_row white_box">'.$ehorus.'</div>';
// WIP: Only for node.
include_once 'user_management.php';
}
echo '</div>';
if ($config['admin_can_add_user']) {
if ((bool) $config['admin_can_add_user'] === true) {
html_print_csrf_hidden();
html_print_input_hidden((($new_user === true) ? 'create_user' : 'update_user'), 1);
}
@ -1837,8 +1791,8 @@ if ($new_user === true) {
html_print_input_hidden('json_profile', $json_profile);
}
echo '</form>';
echo '</div>';
$actionButtons = [];
@ -1873,10 +1827,11 @@ $actionButtons[] = html_print_go_back_button(
html_print_action_buttons(implode('', $actionButtons), ['type' => 'form_action']);
echo '</div>';
enterprise_hook('close_meta_frame');
// This is an image generated for JS.
$delete_image = html_print_input_image(
'del',
'images/cross.png',
@ -1889,7 +1844,7 @@ $delete_image = html_print_input_image(
]
);
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
?>
<style>
@ -1925,6 +1880,49 @@ if (!is_metaconsole()) {
var json_profile = $('#hidden-json_profile');
/* <![CDATA[ */
$(document).ready (function () {
// Set up the picker to update target timezone and country select lists.
$('#timezone-image').timezonePicker({
target: '#timezone1',
});
// Optionally an auto-detect button to trigger JavaScript geolocation.
$('#timezone-detect').click(function() {
$('#timezone-image').timezonePicker('detectLocation');
});
$("#right_autorefreshlist").click (function () {
jQuery.each($("select[name='autorefresh_list_out[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();
if (imodule_name != <?php echo "'".__('None')."'"; ?>) {
id_imodule = $(value).attr('value');
$("select[name='autorefresh_list[]']").append($("<option></option>").val(id_imodule).html('<i>' + imodule_name + '</i>'));
$("#autorefresh_list_out").find("option[value='" + id_imodule + "']").remove();
$("#autorefresh_list").find("option[value='']").remove();
$("#autorefresh_list").find("option[value='0']").remove();
if($("#autorefresh_list_out option").length == 0) {
$("select[name='autorefresh_list_out[]']").append($("<option></option>").val('').html('<i><?php echo __('None'); ?></i>'));
}
}
});
});
$("#left_autorefreshlist").click (function () {
jQuery.each($("select[name='autorefresh_list[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();
if (imodule_name != <?php echo "'".__('None')."'"; ?>) {
id_imodule = $(value).attr('value');
$("#autorefresh_list").find("option[value='" + id_imodule + "']").remove();
$("#autorefresh_list_out").find("option[value='']").remove();
$("select[name='autorefresh_list_out[]']").append($("<option><option>").val(id_imodule).html('<i>' + imodule_name + '</i>'));
$("#autorefresh_list_out option").last().remove();
if($("#autorefresh_list option").length == 0) {
$("select[name='autorefresh_list[]']").append($("<option></option>").val('').html('<i><?php echo __('None'); ?></i>'));
}
}
});
});
$("input#checkbox-double_auth").change(function (e) {
e.preventDefault();
if (this.checked) {

View File

@ -49,12 +49,12 @@ $homeScreenValues = [
// Custom Home Screen controls.
$customHomeScreenAddition = [];
// Home screen. Dashboard.
$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true);
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
// Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true, false);
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true, false);
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenDataField = '';
foreach ($customHomeScreenAddition as $key => $customField) {
@ -96,6 +96,10 @@ if (is_metaconsole() === false) {
'include/javascript/timezonepicker/tz_islands.txt'
);
// Initial definition of vars.
$area_data_timezone_polys = '';
$area_data_timezone_rects = '';
foreach ($timezones as $timezone_name => $tz) {
if ($timezone_name === 'America/Montreal') {
$timezone_name = 'America/Toronto';
@ -103,12 +107,10 @@ if (is_metaconsole() === false) {
$timezone_name = 'Asia/Shanghai';
}
$area_data_timezone_polys .= '';
foreach ($tz['polys'] as $coords) {
$area_data_timezone_polys .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="poly" coords="'.implode(',', $coords).'" />';
}
$area_data_timezone_rects .= '';
foreach ($tz['rects'] as $coords) {
$area_data_timezone_rects .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="rect" coords="'.implode(',', $coords).'" />';
}
@ -234,7 +236,7 @@ $userManagementTable->data['fields_phone'][0] = html_print_input_text_extended(
// Password management.
$passwordManageTable = new stdClass();
$passwordManageTable->class = 'w100p';
$passwordManageTable->class = 'table_section full_section';
$passwordManageTable->id = 'password_manage';
$passwordManageTable->style = [];
$passwordManageTable->rowclass = [];
@ -252,7 +254,7 @@ $passwordManageTable->data['fields_newpassword'][0] = html_print_input_text_exte
$view_mode,
'',
[
'class' => 'input',
'class' => 'input w100p',
'placeholder' => __('Password'),
],
true,
@ -271,7 +273,7 @@ $passwordManageTable->data['fields_repeatpassword'][0] = html_print_input_text_e
$view_mode,
'',
[
'class' => 'input',
'class' => 'input w100p',
'placeholder' => __('Password confirmation'),
],
true,
@ -291,7 +293,7 @@ if ($new_user === false) {
$view_mode,
'',
[
'class' => 'input',
'class' => 'input w100p',
'placeholder' => __('Own password confirmation'),
],
true,
@ -300,7 +302,7 @@ if ($new_user === false) {
}
// $userManagementTable->rowclass['captions_passwordManage'] = 'full_section pdd_t_10px';
$userManagementTable->rowclass['passwordManage_table'] = 'table_section full_section';
// $userManagementTable->rowclass['passwordManage_table'] = 'table_section full_section';
// $userManagementTable->data['captions_passwordManage'][0] = __('Password management');
$userManagementTable->data['passwordManage_table'] = html_print_table($passwordManageTable, true);
@ -381,6 +383,7 @@ $autorefreshControlsContent[] = html_print_anchor(
true,
[
'id' => 'right_autorefreshlist',
'style' => 'width: 24px; margin: 10px 10px 0;',
'alt' => __('Push selected pages into autorefresh list'),
'title' => __('Push selected pages into autorefresh list'),
]
@ -397,6 +400,7 @@ $autorefreshControlsContent[] = html_print_anchor(
true,
[
'id' => 'left_autorefreshlist',
'style' => 'width: 24px; margin: 10px 10px 0;',
'alt' => __('Pop selected pages out of autorefresh list'),
'title' => __('Pop selected pages out of autorefresh list'),
]
@ -443,7 +447,7 @@ $autorefreshTable = html_print_div(
$userManagementTable->rowclass['captions_autorefreshList'] = 'field_half_width';
$userManagementTable->rowclass['fields_autorefreshList'] = 'field_half_width';
// $userManagementTable->cellclass['fields_autorefreshList'][0] = 'field_half_width';
$userManagementTable->cellstyle['fields_autorefreshList'][0] = 'width: 100%';
$userManagementTable->data['captions_autorefreshList'] = __('Autorefresh pages');
$userManagementTable->data['fields_autorefreshList'] = $autorefreshTable;
@ -530,10 +534,9 @@ $homeScreenTable->data = [];
// Home screen.
$homeScreenTable->data['captions_homescreen'][0] = __('Home screen');
$homeScreenTable->colspan['captions_homescreen'] = 2;
$homeScreenTable->colspan['captions_homescreen'][0] = 2;
$homeScreenTable->rowclass['captions_homescreen'] = 'field_half_width';
$homeScreenTable->rowclass['fields_homescreen'] = 'field_half_width';
$homeScreenTable->rowclass['fields_homescreen'] = 'w540px';
$homeScreenTable->rowclass['fields_homescreen'] = 'field_half_width flex';
$homeScreenTable->data['fields_homescreen'][0] = html_print_select(
$homeScreenValues,
'section',
@ -545,9 +548,15 @@ $homeScreenTable->data['fields_homescreen'][0] = html_print_select(
false,
false
);
$homeScreenTable->data['fields_homescreen'][1] = $customHomeScreenDataField;
$homeScreenTable->data['fields_homescreen'][1] = html_print_div(
[
'class' => 'w100p',
'content' => $customHomeScreenDataField,
],
true
);
$userManagementTable->rowclass['homescreen_table'] = 'table_section';
$userManagementTable->rowclass['homescreen_table'] = 'w100p';
$userManagementTable->data['homescreen_table'] = html_print_table($homeScreenTable, true);
// Timezone.
@ -585,11 +594,8 @@ $userManagementTable->data['title_additionalSettings'][1] = html_print_subtitle_
$userManagementTable->rowclass['captions_addSettings'] = 'field_half_width';
$userManagementTable->rowclass['fields_addSettings'] = 'field_half_width';
$userManagementTable->cellstyle['fields_addSettings'][1] = 'flex-wrap: wrap';
$userManagementTable->cellstyle['captions_addSettings'][1] = 'width: 35%';
$userManagementTable->cellstyle['captions_addSettings'][2] = 'width: 15%';
$userManagementTable->cellstyle['fields_addSettings'][1] = 'width: 35%';
$userManagementTable->cellstyle['fields_addSettings'][2] = 'width: 15%';
$userManagementTable->cellstyle['fields_addSettings'][0] = 'align-self: baseline';
$userManagementTable->cellstyle['fields_addSettings'][1] = 'width: 50%;flex-direction: column;align-items: flex-start;';
$userManagementTable->data['captions_addSettings'][0] = __('Comments');
$userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
'comments',
@ -597,7 +603,8 @@ $userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
65,
$user_info['comments'],
($view_mode ? 'readonly="readonly"' : ''),
true
true,
''
);
$userManagementTable->data['captions_addSettings'][1] = __('Login allowed IP list');
@ -620,10 +627,10 @@ $userManagementTable->data['fields_addSettings'][1] = html_print_div(
true
);
$userManagementTable->data['captions_addSettings'][2] = __('Allow all IPs');
$userManagementTable->data['fields_addSettings'][2] = html_print_div(
$allowAllIpsContent = [];
$allowAllIpsContent[] = '<span>'.__('Allow all IPs').'</span>';
$allowAllIpsContent[] = html_print_div(
[
'class' => 'margin-top-10',
'content' => html_print_checkbox_switch(
'allowed_ip_active',
0,
@ -634,6 +641,14 @@ $userManagementTable->data['fields_addSettings'][2] = html_print_div(
true
);
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
[
'class' => 'margin-top-10',
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
'content' => implode('', $allowAllIpsContent),
],
true
);
$userManagementTable->rowclass['captions_loginErrorUser'] = 'field_half_width';
$userManagementTable->rowclass['fields_loginErrorUser'] = 'field_half_width';

View File

@ -4955,7 +4955,7 @@ function events_page_general_acknowledged($event_id)
global $config;
$Acknowledged = '';
$event = db_get_row('tevento', 'id_evento', $event_id);
hd($event['ack_utimestamp'], true);
if ($event !== false && $event['estado'] == 1) {
$user_ack = db_get_value(
'fullname',

View File

@ -3130,19 +3130,19 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $
}
}
// If metaconsole is activated and image doesn't exists try to search on normal console
if (is_metaconsole()) {
// If metaconsole is activated and image doesn't exists try to search on normal console.
if (is_metaconsole() === true) {
if (false === @file_get_contents($src, 0, null, 0, 1)) {
$src = '../../'.$src;
}
}
// path to image
// Path to image.
$src = ui_get_full_url($src);
$output = '<input id="image-'.$name.$idcounter.'" src="'.$src.'" style="'.$style.'" name="'.$name.'" type="image"';
// Valid attributes (invalid attributes get skipped)
// Valid attributes (invalid attributes get skipped).
$attrs = [
'alt',
'accesskey',
@ -3950,7 +3950,7 @@ function html_print_table(&$table, $return=false)
}
$output .= '</tbody></table>'."\n";
hd($output, true);
if ($return) {
return $output;
}
@ -6445,7 +6445,7 @@ function html_print_go_back_button(string $url, array $options=[], bool $return=
],
true
),
'style' => ($options['style'] ?? 'z-index: 100'),
'style' => ($options['style'] ?? 'z-index: 10001'),
],
$return
);

View File

@ -191,24 +191,20 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
$table->id = 'table_profiles';
$table->width = '100%';
$table->class = 'info_table';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$table->head_colspan[0] = 0;
$table->width = '100%';
$table->class = 'databox_tactical data';
$table->title = $title;
} else {
echo '<div id="edit_user_profiles" class="white_box">';
echo '<h4><p class="edit_user_labels">'.$title.'</p></h4>';
echo '<p class="subsection_header_title padding-lft-10">'.$title.'</p>';
}
$table->data = [];
$table->head = [];
$table->align = [];
$table->style = [];
if (!defined('METACONSOLE')) {
$table->style['name'] = 'font-weight: bold';
$table->style['group'] = 'font-weight: bold';
}
$table->head['name'] = __('Profile name');
$table->head['group'] = __('Group');
@ -217,6 +213,9 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
$table->head['actions'] = __('Action');
$table->align['actions'] = 'center';
$table->headstyle['hierarchy'] = 'text-align: center';
$table->headstyle['actions'] = 'text-align: center';
if (users_is_admin()) {
$result = db_get_all_rows_filter(
'tusuario_perfil',
@ -262,7 +261,8 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
}
}
foreach ($result as $profile) {
$lastKey = 0;
foreach ($result as $key => $profile) {
if ($profile['id_grupo'] == -1) {
continue;
}
@ -272,16 +272,16 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
$data['name'] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.profile_get_name($profile['id_perfil']).'</a>';
$data['group'] = ui_print_group_icon($profile['id_grupo'], true);
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
$data['group'] .= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$profile['id_grupo'].'&pure='.$pure.'">';
}
$data['group'] .= '&nbsp;'.ui_print_truncate_text(groups_get_name($profile['id_grupo'], true), GENERIC_SIZE_TEXT);
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
$data['group'] .= '</a>';
}
if (empty($profile['tags'])) {
if (empty($profile['tags']) === true) {
$data['tags'] = '';
} else {
if (is_array($profile['tags']) === false) {
@ -299,7 +299,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
if ($create_user) {
$data['actions'] .= html_print_input_image(
'del',
'images/cross.png',
'images/delete.svg',
1,
'',
true,
@ -310,7 +310,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
);
} else {
$data['actions'] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data['actions'] .= html_print_input_image('del', 'images/cross.png', 1, ['class' => 'invert_filter'], true);
$data['actions'] .= html_print_input_image('del', 'images/delete.svg', 1, 'width:40px; height: 28px', true);
$data['actions'] .= html_print_input_hidden('delete_profile', 1, true);
$data['actions'] .= html_print_input_hidden('id_user_profile', $profile['id_up'], true);
$data['actions'] .= html_print_input_hidden('id_user', $id, true);
@ -318,13 +318,23 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
}
array_push($table->data, $data);
$lastKey++;
}
if (is_metaconsole() === false) {
$table->style['last_name'] = 'vertical-align: top';
$table->style['last_group'] = 'vertical-align: top';
$table->style['hierarchy'] = 'text-align:center;';
$table->style['last_hierarchy'] = 'text-align:center;vertical-align: top';
$table->style['actions'] = 'text-align:center;vertical-align: top';
$table->style['last_actions'] = 'text-align:center;vertical-align: top';
}
$data = [];
$data['name'] = '<form method="post">';
$data['last_name'] = '<form method="post">';
if (check_acl($config['id_user'], 0, 'PM')) {
$data['name'] .= html_print_select(
$data['last_name'] .= html_print_select(
profile_get_profiles(),
'assign_profile',
0,
@ -336,7 +346,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
false
);
} else {
$data['name'] .= html_print_select(
$data['last_name'] .= html_print_select(
profile_get_profiles(
[
'pandora_management' => '<> 1',
@ -355,7 +365,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
);
}
$data['group'] = html_print_select_groups(
$data['last_group'] = html_print_select_groups(
$config['id_user'],
'UM',
users_can_manage_group_all('UM'),
@ -370,18 +380,19 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
);
$tags = tags_get_all_tags();
$data['tags'] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true);
$data['last_tags'] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true, true, 'w100p');
$data['hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true);
$data['last_hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true);
$data['actions'] = html_print_input_image('add', 'images/add.png', 1, '', true);
$data['actions'] .= html_print_input_hidden('id', $id, true);
$data['actions'] .= html_print_input_hidden('add_profile', 1, true);
$data['actions'] .= '</form>';
$data['last_actions'] = html_print_input_image('add', 'images/validate.svg', 1, 'width: 40px; height: 28px', true);
$data['last_actions'] .= html_print_input_hidden('id', $id, true);
$data['last_actions'] .= html_print_input_hidden('add_profile', 1, true);
$data['last_actions'] .= '</form>';
array_push($table->data, $data);
html_print_table($table, $return);
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
echo '</div>';
}

View File

@ -11921,7 +11921,7 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru
'graph' => progress_bar($data['monitor_health'], $width, $height, $data['monitor_health'].'% '.__('of monitors up'), 0),
];
$return['module_sanity'] = [
'title' => __('Module sanityY'),
'title' => __('Module sanity'),
'graph' => progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0),
];
$return['alert_level'] = [

View File

@ -3584,7 +3584,6 @@ function ui_print_datatable(array $parameters)
}
foreach ($names as $column) {
hd($column, true);
if (is_array($column)) {
$table .= '<th id="'.$column['id'].'" class="'.$column['class'].'" ';
if (isset($column['title']) === true) {
@ -3594,7 +3593,6 @@ function ui_print_datatable(array $parameters)
$table .= ' style="'.$column['style'].'">'.__($column['text']);
$table .= $column['extra'];
$table .= '</th>';
hd($table, true);
} else {
$table .= '<th>'.__($column).'</th>';
}

View File

@ -866,6 +866,9 @@ select:-internal-list-box {
justify-content: flex-start;
}
.flex-baseline {
align-self: baseline;
}
.flex {
display: flex;
}
@ -1367,7 +1370,7 @@ div#head {
min-width: 882px;
background-color: #fff;
color: #000;
z-index: 11;
z-index: 1111;
}
.fixed_header {
@ -1720,7 +1723,7 @@ div.title_line {
#menu_tab_frame_view_bc {
position: sticky;
top: 59px;
z-index: 10;
z-index: 10000;
display: flex;
align-items: flex-end;
justify-content: space-between;
@ -2517,7 +2520,7 @@ div#pandora_logo_header {
#header_table_inner {
height: 60px;
min-width: 790px;
/*width: 100%;*/
z-index: 10000;
display: flex;
align-items: center;
justify-content: space-between;
@ -9989,7 +9992,7 @@ button.submitButton {
border-radius: 8px;
padding: 0 10px;
cursor: pointer;
z-index: 1;
z-index: 10001;
}
button.buttonButton.mini,
@ -10751,7 +10754,7 @@ tr.bring_next_field {
top: -8px;
border: 1px solid #e5e9ed;
background-color: #fff;
z-index: 0;
z-index: 10000;
}
.fixed_action_buttons_size > .action_buttons_background_mask {