Admin tools

This commit is contained in:
Pablo Aragon 2023-03-09 15:14:47 +01:00
parent d0c8794361
commit 2a97b26cfe
11 changed files with 436 additions and 155 deletions

View File

@ -21,13 +21,23 @@ function extension_db_status()
$db_name = get_parameter('db_name', '');
$db_status_execute = (bool) get_parameter('db_status_execute', false);
ui_print_page_header(
ui_print_standard_header(
__('DB Schema check'),
'images/extensions.png',
false,
'db_status_tab',
true,
''
[],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Run test'),
],
]
);
if (!is_user_admin($config['id_user'])) {
@ -46,38 +56,86 @@ function extension_db_status()
__('At the moment the checks is for MySQL/MariaDB.')
);
echo "<form method='post'>";
echo "<form method='post' class='max_floating_element_size'>";
echo '<fieldset>';
echo '<legend>'.__('DB settings').'</legend>';
$table = new stdClass();
$table->data = [];
$row = [];
$row[] = __('DB User with privileges');
$row[] = html_print_input_text('db_user', $db_user, '', 50, 255, true);
$row[] = __('DB Password for this user');
$row[] = html_print_input_password('db_password', $db_password, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('DB User with privileges'),
html_print_input_text(
'db_user',
$db_user,
'',
50,
255,
true,
false,
false,
'',
'w100p mrgn_top_10px'
)
);
$row[] = html_print_label_input_block(
__('DB Password for this user'),
html_print_input_password(
'db_password',
$db_password,
'',
50,
255,
true,
false,
false,
'w100p mrgn_top_10px'
)
);
$table->data[] = $row;
$row = [];
$row[] = __('DB Hostname');
$row[] = html_print_input_text('db_host', $db_host, '', 50, 255, true);
$row[] = __('DB Name (temporal for testing)');
$row[] = html_print_input_text('db_name', $db_name, '', 50, 255, true);
$row[] = html_print_label_input_block(
__('DB Hostname'),
html_print_input_text(
'db_host',
$db_host,
'',
50,
255,
true,
false,
false,
'',
'w100p mrgn_top_10px'
)
);
$row[] = html_print_label_input_block(
__('DB Name (temporal for testing)'),
html_print_input_text(
'db_name',
$db_name,
'',
50,
255,
true,
false,
false,
'',
'w100p mrgn_top_10px'
)
);
$table->data[] = $row;
html_print_table($table);
echo '</fieldset>';
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
html_print_action_buttons(
html_print_submit_button(
__('Execute Test'),
'submit',
false,
[ 'icon' => 'cog' ],
true
),
]
)
);
html_print_input_hidden('db_status_execute', 1);

View File

@ -132,27 +132,8 @@ function dbmgr_extension_main()
echo $warning_message;
}
echo "<form method='post' action=''>";
$table = new stdClass();
$table->id = 'db_interface';
$table->class = 'databox';
$table->width = '100%';
$table->data = [];
$table->head = [];
$table->colspan = [];
$table->rowstyle = [];
$table->colspan[0][0] = 2;
$table->colspan[1][0] = 2;
$table->rowspan[2][0] = 3;
$table->rowclass[0] = 'notify';
$table->rowclass[3] = 'pdd_5px';
$table->rowclass[3] = 'flex-content-right';
$table->rowclass[4] = 'flex-content-right';
$data[0][0] = __(
ui_print_warning_message(
__(
"This is an advanced extension to interface with %s database directly from WEB console
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
if you don't know </b>exactly</b> what are you are doing,
@ -162,17 +143,26 @@ function dbmgr_extension_main()
get_product_name(),
get_product_name(),
get_product_name()
)
);
$data[1][0] = "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
echo "<form method='post' action=''>";
$data[2][0] = html_print_textarea(
'sql',
5,
50,
html_entity_decode($sql, ENT_QUOTES),
'',
true
$table = new stdClass();
$table->id = 'db_interface';
$table->class = 'databox no_border filter-table-adv';
$table->width = '100%';
$table->data = [];
$table->colspan = [];
$table->style[0] = 'width: 30%;';
$table->style[1] = 'width: 70%;';
$table->colspan[1][0] = 2;
$data[0][0] = "<b>Some samples of usage:</b> <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
$data[0][0] = html_print_label_input_block(
__('Some samples of usage:'),
"<blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>"
);
if (is_metaconsole() === true) {
@ -191,35 +181,57 @@ function dbmgr_extension_main()
$servers = [];
}
$data[3][2] = html_print_input(
[
'name' => 'node_id',
'type' => 'select',
'fields' => $servers,
'selected' => $node_id,
'nothing' => __('This metaconsole'),
'nothing_value' => -1,
'return' => true,
'label' => _('Select query target'),
]
$data[0][1] = html_print_label_input_block(
__('Select query target'),
html_print_select(
$servers,
'node_id',
$node_id,
'',
__('This metaconsole'),
-1,
true,
false,
false,
'w40p',
false,
'width: 40%;'
)
);
}
$data[4][2] = html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
$data[1][0] = html_print_textarea(
'sql',
3,
50,
html_entity_decode($sql, ENT_QUOTES),
'placeholder="'.__('Type your query here...').'"',
true,
'w100p'
);
$execute_button = html_print_submit_button(
__('Execute SQL'),
'',
false,
[ 'icon' => 'cog' ],
true
),
]
);
$table->data = $data;
html_print_table($table);
// html_print_table($table);
html_print_action_buttons($execute_button);
ui_toggle(
html_print_table($table, true),
'<span class="subsection_header_title">'.__('SQL query').'</span>',
__('SQL query'),
'query',
false,
false,
'',
'white-box-content no_border',
'box-flat white_table_graph fixed_filter_bar'
);
echo '</form>';
// Processing SQL Code.
@ -227,10 +239,6 @@ function dbmgr_extension_main()
return;
}
echo '<br />';
echo '<hr />';
echo '<br />';
try {
if (\is_metaconsole() === true && $node_id !== -1) {
$node = new Node($node_id);

View File

@ -24,7 +24,6 @@ table.dbmanager th {
}
textarea {
min-height: 50px;
height: 50px;
width: 95%;
width: 100% !important;
max-width: 100% !important;
}

View File

@ -25,13 +25,28 @@ function extension_uploader_extensions()
return;
}
ui_print_page_header(
__('Uploader extension'),
// Header.
ui_print_standard_header(
__('Extensions'),
'images/extensions.png',
false,
'',
true,
''
[],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('Uploader extension'),
],
]
);
$upload = (bool) get_parameter('upload', 0);
@ -77,20 +92,52 @@ function extension_uploader_extensions()
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox filters filter-table-adv';
$table->size[0] = '20%';
$table->size[1] = '20%';
$table->size[2] = '60%';
$table->data = [];
$table->data[0][0] = __('Upload extension');
$table->data[0][1] = html_print_input_file('extension', true).ui_print_help_tip(__('Upload the extension as a zip file.'), true);
$table->data[0][0] = html_print_label_input_block(
__('Upload extension').ui_print_help_tip(__('Upload the extension as a zip file.'), true),
html_print_input_file(
'extension',
true,
[
'required' => true,
'accept' => '.zip',
]
)
);
if (enterprise_installed()) {
$table->data[0][2] = __('Upload enterprise extension').'&nbsp;'.html_print_checkbox('upload_enterprise', 1, false, true);
$table->data[0][1] = html_print_label_input_block(
__('Upload enterprise extension'),
html_print_checkbox(
'upload_enterprise',
1,
false,
true
)
);
} else {
$table->data[0][1] = '';
}
$table->data[0][2] = '';
echo "<form method='post' enctype='multipart/form-data'>";
html_print_table($table);
echo "<div class='right' style='width: ".$table->width."'>";
html_print_input_hidden('upload', 1);
html_print_submit_button(__('Upload'), 'submit', false, 'class="sub add"');
echo '</div>';
html_print_action_buttons(
html_print_submit_button(
__('Upload'),
'submit',
false,
['icon' => 'wand'],
true
)
);
echo '</form>';
}

View File

@ -24,8 +24,29 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
exit;
}
// Header
ui_print_page_header(__('Extensions').' &raquo; '.__('Defined extensions'), 'images/extensions.png', false, '', true, '');
// Header.
ui_print_standard_header(
__('Extensions'),
'images/extensions.png',
false,
'',
true,
[],
[
[
'link' => '',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('Extension manager'),
],
[
'link' => '',
'label' => __('Defined extensions'),
],
]
);
if (count($config['extensions']) == 0) {
$extensions = extensions_get_extension_info();
@ -132,7 +153,7 @@ if ($disabled != '') {
$extensions = extensions_get_extension_info();
$table = new StdClass;
$table->width = '98%';
$table->width = '100%';
$table->head = [];
$table->head[] = __('File');
@ -146,7 +167,7 @@ $table->head[] = __('Login Function');
$table->head[] = __('Agent operation tab');
$table->head[] = __('Agent godmode tab');
$table->head[] = __('Operation');
$table->width = '100%';
$table->class = 'info_table';
$table->align = [];
@ -254,9 +275,39 @@ foreach ($extensions as $file => $extension) {
if ($file != 'update_manager.php') {
$table->cellclass[][10] = 'table_action_buttons';
if (!$extension['enabled']) {
$data[] = '<a title="'.__('Delete').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file.'" class="mn">'.html_print_image('images/cross.disabled.png', true, ['class' => 'filter_none']).'</a>'.' <a title="'.__('Enable').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&enabled='.$file.'" class="mn">'.html_print_image('images/lightbulb_off.png', true, ['class' => 'filter_none']).'</a>';
$data[] = html_print_menu_button(
[
'href' => 'index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file,
'image' => 'images/cross.disabled.png',
'title' => __('Delete'),
'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;',
],
true
).html_print_menu_button(
[
'href' => 'index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&enabled='.$file,
'image' => 'images/lightbulb_off.png',
'title' => __('Delete'),
],
true
);
} else {
$data[] = '<a title="'.__('Delete').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file.'" class="mn">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>'.' <a title="'.__('Disable').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&disabled='.$file.'" class="mn">'.html_print_image('images/lightbulb.png', true).'</a>';
$data[] = html_print_menu_button(
[
'href' => 'index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file,
'image' => 'images/cross.png',
'title' => __('Delete'),
'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;',
],
true
).html_print_menu_button(
[
'href' => 'index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&disabled='.$file,
'image' => 'images/lightbulb.png',
'title' => __('Delete'),
],
true
);
}
} else {
$data[] = '';

View File

@ -80,7 +80,7 @@ if (empty($directory) === true) {
$real_directory = realpath($config['homedir'].'/'.$directory);
echo '<h4>'.__('Index of %s', io_safe_input($directory)).'</h4>';
echo '<h4 class="mrgn_0px">'.__('Index of %s', io_safe_input($directory)).'</h4>';
$upload_file = (bool) get_parameter('upload_file');
$create_text_file = (bool) get_parameter('create_text_file');

View File

@ -170,46 +170,118 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
$table->id = 'news';
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->class = 'databox filters';
$table->class = 'databox filters filter-table-adv';
$table->head = [];
$table->data = [];
$table->style[0] = 'font-weight: bold;';
$table->style[1] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->style[3] = 'font-weight: bold;';
$table->style[4] = 'font-weight: bold;';
$table->size[0] = '33%';
$table->size[1] = '33%';
$table->colspan[2][0] = 2;
$table->rowclass[2] = 'w100p';
$data = [];
$data[0] = __('Subject').'<br>';
$data[0] .= '<input type="text" class="text_input" name="subject" size="35" value="'.$subject.'" >';
$data[0] = html_print_label_input_block(
__('Subject'),
html_print_input_text(
'subject',
$subject,
'',
35,
255,
true
)
);
$data[1] = __('Group').'<br>';
$data[1] .= '<div class="w250px">';
$data[1] .= html_print_select_groups($config['id_user'], 'ER', users_can_manage_group_all(), 'id_group', $id_group, '', '', 0, true, false, false, '');
$data[1] .= '</div>';
$data[1] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
$config['id_user'],
'ER',
users_can_manage_group_all(),
'id_group',
$id_group,
'',
'',
0,
true,
false,
false,
'w100p',
false,
'width: 100%;'
)
);
$table->data[] = $data;
$data[2] = __('Modal screen').'<br>';
$data[2] .= html_print_checkbox_extended('modal', 1, $modal, false, '', 'class="mrgn_top_5 mrg_btt_7"', true);
$data = [];
$data[0] = html_print_label_input_block(
__('Modal screen'),
html_print_checkbox_extended(
'modal',
1,
$modal,
false,
'',
'class="w100p"',
true
)
);
$data[3] = __('Expire').'<br>';
$data[3] .= html_print_checkbox_extended('expire', 1, $expire, false, '', 'class="mrgn_top_5 mrg_btt_7"', true);
$data[4] = __('Expiration').'<br>';
$data[4] .= html_print_input_text('expire_date', $expire_date, '', 12, 10, true).' ';
$data[4] .= html_print_input_text('expire_time', $expire_time, '', 10, 7, true).' ';
$data[1] = '<div style="display: inline-flex; flex-direction: row;">'.html_print_label_input_block(
__('Expire'),
html_print_checkbox_extended(
'expire',
1,
$expire,
false,
'',
'class="w100p"',
true
),
['div_class' => 'display-grid']
);
$data[1] .= html_print_label_input_block(
__('Expiration'),
'<div>'.html_print_input_text(
'expire_date',
$expire_date,
'',
12,
10,
true
).' '.html_print_input_text(
'expire_time',
$expire_time,
'',
10,
7,
true
).'</div>',
[
'div_class' => 'display-grid mrgn_lft_20px',
'div_id' => 'news-0-4',
]
).'</div>';
$table->rowclass[] = '';
$table->data[] = $data;
$data = [];
$data[0] = __('Text').'<br>';
$data[0] .= html_print_textarea('text', 25, 15, $text, '', true);
$table->rowclass[] = '';
$table->colspan[1][0] = 5;
$data[0] = html_print_label_input_block(
__('Text'),
html_print_textarea(
'text',
25,
100,
$text,
'',
true,
'w100p'
)
);
$table->data[] = $data;
echo '<form name="ilink" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/news">';
echo '<form name="ilink" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/news" class="max_floating_element_size">';
if ($creation_mode == 1) {
echo "<input type='hidden' name='create' value='1'>";
} else {
@ -228,11 +300,25 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
echo "<table width='".$table->width."'>";
echo "<tr><td align='right'>";
if (isset($_GET['form_add'])) {
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
$submit_button = html_print_submit_button(
__('Create'),
'crtbutton',
false,
['icon' => 'wand'],
true
);
} else {
echo "<input name='crtbutton' type='submit' class='sub upd' value='".__('Update')."'>";
$submit_button = html_print_submit_button(
__('Update'),
'crtbutton',
false,
['icon' => 'wand'],
true
);
}
html_print_action_buttons($submit_button);
echo '</form></td></tr></table>';
} else {
$rows = db_get_all_rows_in_table('tnews', 'timestamp');
@ -293,11 +379,17 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
echo '</table>';
}
echo "<table width='100%'>";
echo "<tr><td align='right'>";
echo "<form method='post' action='index.php?sec=gsetup&sec2=godmode/setup/news&form_add=1'>";
echo "<input type='submit' class='sub next' name='form_add' value='".__('Add')."'>";
echo '</form></table>';
html_print_action_buttons(
html_print_submit_button(
__('Add'),
'form_add',
false,
['icon' => 'wand'],
true
)
);
echo '</form>';
}
/*

View File

@ -791,6 +791,10 @@ if ($save_filter_modal) {
$table->rowid[1] = 'save_filter_row1';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->rowclass[1] = 'flex';
$table->rowclass[2] = 'flex';
$table->rowclass[3] = 'flex';
$table->rowclass[4] = 'flex';
$data[0] = '<b>'.__('Filter name').'</b>'.$jump;
$data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
if (is_metaconsole()) {

View File

@ -239,15 +239,19 @@ class EventSound extends HTML
ui_require_css_file('discovery');
if ($tab === 'add') {
echo '<form method="post" enctype="multipart/form-data" action="index.php?sec=eventos&sec2=godmode/events/configuration_sounds&tab=add&action=create">';
echo '<form method="post" enctype="multipart/form-data" action="index.php?sec=eventos&sec2=godmode/events/configuration_sounds&tab=add&action=create"
class="max_floating_element_size">';
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox filters filter-table-adv';
$table->data = [];
$table->data[0][0] = __('Name:');
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data[0][1] = html_print_input_text(
$table->data[0][0] = html_print_label_input_block(
__('Name:'),
html_print_input_text(
'name',
'',
'',
@ -256,21 +260,32 @@ class EventSound extends HTML
true,
false,
true
)
);
$table->data[1][0] = __('WAV Sound');
$table->data[1][1] = html_print_input_file('file', true, ['required' => true]);
$table->data[0][1] = html_print_label_input_block(
__('WAV Sound'),
html_print_input_file(
'file',
true,
[
'required' => true,
'accept' => 'audio/*',
]
)
);
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_action_buttons(
html_print_submit_button(
__('Create'),
'save_sound',
false,
'class="sub wand"'
['icon' => 'wand'],
true
)
);
echo '</div>';
echo '</form>';
// Load own javascript file.
@ -305,7 +320,7 @@ class EventSound extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
'style' => 'width: 100%',
'style' => 'width: 99%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
@ -321,7 +336,7 @@ class EventSound extends HTML
[
'label' => __('Free search').ui_print_help_tip(__('Search filter by Name or Sound fields content'), true),
'type' => 'text',
'class' => 'w200px',
'class' => 'w70p',
'id' => 'filter_text',
'name' => 'filter_text',
],
@ -333,12 +348,13 @@ class EventSound extends HTML
'0' => __('No'),
'1' => __('Yes'),
],
'class' => 'w100px',
'class' => 'w100p',
'id' => 'active',
'name' => 'active',
],
],
],
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar ',
]
);
} catch (Exception $e) {
@ -350,6 +366,7 @@ class EventSound extends HTML
close_meta_frame();
}
html_print_action_buttons('');
// Load own javascript file.
echo $this->loadJS();
}

View File

@ -4773,6 +4773,10 @@ function html_print_input_file($name, $return=false, $options=false)
if (isset($options['style']) === true) {
$output .= ' style="'.$options['style'].'"';
}
if (isset($options['accept']) === true) {
$output .= ' accept="'.$options['accept'].'"';
}
}
// Close input.

View File

@ -11452,6 +11452,7 @@ form#satellite_conf_edit > fieldset.full-column {
background-repeat: no-repeat;
background-size: 24px;
background-image: url("../../images/enable.svg");
padding-right: 45px;
}
.orientation-report {