diff --git a/pandora_console/extensions/api_checker.php b/pandora_console/extensions/api_checker.php index 2ffc5ef6c8..9b08815349 100755 --- a/pandora_console/extensions/api_checker.php +++ b/pandora_console/extensions/api_checker.php @@ -195,140 +195,183 @@ function extension_api_checker() ); } - ui_print_page_header( - __('API checker'), + // Header. + ui_print_standard_header( + __('Extensions'), 'images/extensions.png', false, '', true, - '' + [], + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Extension manager'), + ], + [ + 'link' => '', + 'label' => __('API checker'), + ], + ] ); $table = new stdClass(); + $table->width = '100%'; + $table->class = 'databox filters filter-table-adv'; + $table->size[0] = '50%'; + $table->size[1] = '50%'; $table->data = []; $row = []; - $row[] = __('IP'); - $row[] = html_print_input_text('ip', $ip, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('IP'), + html_print_input_text('ip', $ip, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('%s Console URL', get_product_name()), + html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true) + ); $table->data[] = $row; $row = []; - $row[] = __('%s Console URL', get_product_name()); - $row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true), + html_print_input_text('token', $token, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('API Pass'), + html_print_input_password('apipass', $apipass, '', 50, 255, true) + ); $table->data[] = $row; $row = []; - $row[] = __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true); - $row[] = html_print_input_text('token', $token, '', 50, 255, true); - $table->data[] = $row; + $row[] = html_print_label_input_block( + __('User'), + html_print_input_text('user', $user, '', 50, 255, true) + ); - $row = []; - $row[] = __('API Pass'); - $row[] = html_print_input_password('apipass', $apipass, '', 50, 255, true); - $table->data[] = $row; - - $row = []; - $row[] = __('User'); - $row[] = html_print_input_text('user', $user, '', 50, 255, true); - $table->data[] = $row; - - $row = []; - $row[] = __('Password'); - $row[] = html_print_input_password('password', $password, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('Password'), + html_print_input_password('password', $password, '', 50, 255, true) + ); $table->data[] = $row; $table2 = new stdClass(); + $table2->width = '100%'; + $table2->class = 'databox filters filter-table-adv'; + $table2->size[0] = '50%'; + $table2->size[1] = '50%'; $table2->data = []; $row = []; - $row[] = __('Action (get or set)'); - $row[] = html_print_input_text('op', $op, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('Action (get or set)'), + html_print_input_text('op', $op, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('Operation'), + html_print_input_text('op2', $op2, '', 50, 255, true) + ); $table2->data[] = $row; $row = []; - $row[] = __('Operation'); - $row[] = html_print_input_text('op2', $op2, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('ID'), + html_print_input_text('id', $id, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('ID 2'), + html_print_input_text('id2', $id2, '', 50, 255, true) + ); $table2->data[] = $row; $row = []; - $row[] = __('ID'); - $row[] = html_print_input_text('id', $id, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('Return Type'), + html_print_input_text('return_type', $return_type, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('Other'), + html_print_input_text('other', $other, '', 50, 255, true) + ); $table2->data[] = $row; $row = []; - $row[] = __('ID 2'); - $row[] = html_print_input_text('id2', $id2, '', 50, 255, true); - $table2->data[] = $row; - - $row = []; - $row[] = __('Return Type'); - $row[] = html_print_input_text('return_type', $return_type, '', 50, 255, true); - $table2->data[] = $row; - - $row = []; - $row[] = __('Other'); - $row[] = html_print_input_text('other', $other, '', 50, 255, true); - $table2->data[] = $row; - - $row = []; - $row[] = __('Other Mode'); - $row[] = html_print_input_text('other_mode', $other_mode, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('Other Mode'), + html_print_input_text('other_mode', $other_mode, '', 50, 255, true) + ); $table2->data[] = $row; $table3 = new stdClass(); + $table3->width = '100%'; + $table3->class = 'databox filters filter-table-adv'; + $table3->size[0] = '50%'; + $table3->size[1] = '50%'; $table3->data = []; $row = []; - $row[] = __('Raw URL'); - $row[] = html_print_input_text('url', $url, '', 50, 2048, true); + $row[] = html_print_label_input_block( + __('Raw URL'), + html_print_input_text('url', $url, '', 50, 2048, true) + ); $table3->data[] = $row; - echo "
"; - echo '
'; + echo ""; + echo '
'; echo ''.__('Credentials').''; html_print_table($table); echo '
'; - echo '
'; + echo '
'; echo ''.__('Call parameters').' '.ui_print_help_tip(__('Action: get Operation: module_last_value id: 63'), true).''; html_print_table($table2); echo '
'; echo "
"; echo '
'; - echo '
'; + echo '
'; echo ''.__('Custom URL').''; html_print_table($table3); echo '
'; html_print_input_hidden('api_execute', 1); - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Call'), - 'submit', - false, - [ 'icon' => 'next' ], - true - ), - ] + html_print_action_buttons( + html_print_submit_button( + __('Call'), + 'submit', + false, + [ 'icon' => 'next' ], + true + ) ); echo ''; if ($api_execute === true) { - echo '
'; + echo '
'; echo ''.__('Result').''; - echo __('URL').'
'; - html_print_input_password('url', $return_call_api['url'], '', 150, 255, false, true); - echo " "; - html_print_image('images/input_zoom.png'); - echo ''; + echo html_print_label_input_block( + __('URL'), + html_print_input_password('url', $return_call_api['url'], '', 150, 255, true, true, false, 'mrgn_top_10px'), + ['label_class' => 'font-title-font'] + ); echo '
'; - echo __('Result').'
'; - html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"'); + echo html_print_label_input_block( + __('Result'), + html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"', true, 'w100p mrgn_top_10px'), + ['label_class' => 'font-title-font'] + ); echo '
'; } ?> diff --git a/pandora_console/extensions/files_repo.php b/pandora_console/extensions/files_repo.php index c319954748..0313af90b2 100644 --- a/pandora_console/extensions/files_repo.php +++ b/pandora_console/extensions/files_repo.php @@ -126,8 +126,30 @@ function pandora_files_repo_godmode() 'godmode' => $godmode, 'operation' => $operation, ]; + // Header. - ui_print_page_header(__('Files repository manager'), 'images/extensions.png', false, '', true, $onheader); + ui_print_standard_header( + __('Extensions'), + 'images/extensions.png', + false, + '', + true, + $onheader, + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Extension manager'), + ], + [ + 'link' => '', + 'label' => __('Files repository manager'), + ], + ] + ); $full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/'; include_once $full_extensions_dir.'files_repo/functions_files_repo.php'; diff --git a/pandora_console/extensions/files_repo/files_repo_form.php b/pandora_console/extensions/files_repo/files_repo_form.php index a78606c271..d96357e87b 100644 --- a/pandora_console/extensions/files_repo/files_repo_form.php +++ b/pandora_console/extensions/files_repo/files_repo_form.php @@ -32,17 +32,15 @@ if (isset($file_id) && $file_id > 0) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; -$table->style = []; -$table->style[0] = 'font-weight: bold;'; -$table->style[2] = 'text-align: center;'; -$table->colspan = []; +$table->class = 'databox filters filter-table-adv'; +$table->size[0] = '50%'; +$table->size[1] = '50%'; $table->data = []; -// GROUPS +// GROUPS. $groups = groups_get_all(); -// Add the All group to the beginning to be always the first -// Use this instead array_unshift to keep the array keys +// Add the All group to the beginning to be always the first. +// Use this instead array_unshift to keep the array keys. $groups = ([0 => __('All')] + $groups); $groups_selected = []; foreach ($groups as $id => $name) { @@ -52,66 +50,110 @@ foreach ($groups as $id => $name) { } $row = []; -$row[0] = __('Groups'); -$row[1] = '
'.html_print_select_groups( - // Id_user. - false, - // Privilege. - 'AR', - // ReturnAllGroup. - true, - // Name. - 'groups[]', - // Selected. - $groups_selected, - // Script. - '', - // Nothing. - '', - // Nothing_value. - 0, - // Return. - true, - // Multiple. - true -).'
'; -$table->data[] = $row; -$table->colspan[][1] = 3; +$row[0] = html_print_label_input_block( + __('Groups'), + html_print_select_groups( + // Id_user. + false, + // Privilege. + 'AR', + // ReturnAllGroup. + true, + // Name. + 'groups[]', + // Selected. + $groups_selected, + // Script. + '', + // Nothing. + '', + // Nothing_value. + 0, + // Return. + true, + // Multiple. + true + ) +); -// DESCRIPTION -$row = []; -$row[0] = __('Description'); -$row[0] .= ui_print_help_tip(__('Only 200 characters are permitted'), true); -$row[1] = html_print_textarea('description', 3, 20, $file['description'], 'class="file_repo_description"', true); +// DESCRIPTION. +$row[1] = html_print_label_input_block( + __('Description').ui_print_help_tip(__('Only 200 characters are permitted'), true), + html_print_textarea( + 'description', + 4, + 20, + $file['description'], + 'class="file_repo_description" style="min-height: 60px; max-height: 60px;"', + true + ) +); $table->data[] = $row; -$table->colspan[][1] = 3; -// FILE and SUBMIT BUTTON +// FILE and SUBMIT BUTTON. $row = []; -// Public checkbox +// Public checkbox. $checkbox = html_print_checkbox('public', 1, (bool) !empty($file['hash']), true); $style = 'class="inline padding-2-10"'; $row[0] = __('File'); if ($file_id > 0) { - $row[1] = $file['name']; - $row[2] = "
".__('Public link')." $checkbox
"; - $row[3] = html_print_submit_button(__('Update'), 'submit', false, 'class="sub upd"', true); - $row[3] .= html_print_input_hidden('update_file', 1, true); - $row[3] .= html_print_input_hidden('file_id', $file_id, true); + $submit_button = html_print_submit_button( + __('Update'), + 'submit', + false, + ['icon' => 'wand'], + true + ); + + $row[0] = html_print_label_input_block( + __('File'), + $file['name'] + ); + + $row[1] = html_print_label_input_block( + __('Public link'), + $checkbox.html_print_input_hidden( + 'file_id', + $file_id, + true + ) + ); } else { - $row[1] = html_print_input_file('upfile', true); - $row[2] = "
".__('Public link')." $checkbox
"; - $row[3] = html_print_submit_button(__('Add'), 'submit', false, 'class="sub add"', true); - $row[3] .= html_print_input_hidden('add_file', 1, true); + $submit_button = html_print_submit_button( + __('Add'), + 'submit', + false, + ['icon' => 'wand'], + true + ); + + $row[0] = html_print_label_input_block( + __('File'), + html_print_input_file( + 'upfile', + true + ) + ); + + $row[1] = html_print_label_input_block( + __('Public link'), + $checkbox.html_print_input_hidden( + 'add_file', + 1, + true + ) + ); } + + $table->data[] = $row; -$table->colspan[][1] = 1; $url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo'); echo "
"; html_print_table($table); +html_print_action_buttons($submit_button); echo '
'; ?> diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 21b817b978..28dcaa0814 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -11,11 +11,12 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -function view_logfile($file_name) +function view_logfile($file_name, $toggle=false) { global $config; $memory_limit = ini_get('memory_limit'); + $code = ''; if (strstr($memory_limit, 'M') !== false) { $memory_limit = str_replace('M', '', $memory_limit); @@ -31,21 +32,37 @@ function view_logfile($file_name) $file_size = filesize($file_name); if ($memory_limit < $file_size) { - echo "

$file_name (".__('File is too large than PHP memory allocated in the system.').')

'; - echo '

'.__('The preview file is imposible.').'

'; + $code .= '

'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')

'; + $code .= '

'.__('The preview file is imposible.').'

'; } else if ($file_size > ($config['max_log_size'] * 1000)) { $data = file_get_contents($file_name, false, null, ($file_size - ($config['max_log_size'] * 1000))); - echo "

$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).'

'; - echo "

'; + $code .= "

$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).'

'; + $code .= "

'; } else { $data = file_get_contents($file_name); - echo "

$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).'

'; - echo "

'; + $code .= "

$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).'

'; + $code .= "

'; + } + + if ($toggle === true) { + ui_toggle( + $code, + ''.$file_name.'', + $file_name, + 'a', + false, + false, + '', + 'white-box-content no_border', + 'filter-datatable-main box-flat white_table_graph' + ); + } else { + echo $code; } } } @@ -64,21 +81,45 @@ function pandoralogs_extension_main() return; } - ui_print_page_header(__('System logfile viewer'), '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' => __('System logfile viewer'), + ], + ] + ); - echo '

'.__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'

'; - - echo '

'.__('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), '.($config['max_log_size'] * 1000).'B at the moment').'

'; + ui_print_info_message( + __('Use this tool to view your %s logfiles directly on the console', get_product_name()).'
+ '.__('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), '.($config['max_log_size'] * 1000).'B at the moment') + ); $logs_directory = (!empty($config['server_log_dir'])) ? io_safe_output($config['server_log_dir']) : '/var/log/pandora'; // Do not attempt to show console log if disabled. if ($config['console_log_enabled']) { - view_logfile($config['homedir'].'/log/console.log'); + view_logfile($config['homedir'].'/log/console.log', true); } - view_logfile($logs_directory.'/pandora_server.log'); - view_logfile($logs_directory.'/pandora_server.error'); + view_logfile($logs_directory.'/pandora_server.log', true); + view_logfile($logs_directory.'/pandora_server.error', true); + } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index ba40b854cd..2db4a529c0 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -8466,7 +8466,7 @@ div.graph div.legend table { } .pandora_logs { - width: 98%; + width: 100%; float: right; height: 200px; margin-bottom: 20px;