Admin tools
This commit is contained in:
parent
cbc05f7ea0
commit
d3ed5a93fc
|
@ -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 "<form method='post'>";
|
||||
echo '<fieldset>';
|
||||
echo "<form method='post' class='max_floating_element_size'>";
|
||||
echo '<fieldset class="mrgn_btn_10px">';
|
||||
echo '<legend>'.__('Credentials').'</legend>';
|
||||
html_print_table($table);
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<fieldset class="mrgn_btn_10px">';
|
||||
echo '<legend>'.__('Call parameters').' '.ui_print_help_tip(__('Action: get Operation: module_last_value id: 63'), true).'</legend>';
|
||||
html_print_table($table2);
|
||||
echo '</fieldset>';
|
||||
echo "<div class='right'>";
|
||||
echo '</div>';
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<fieldset class="mrgn_btn_10px">';
|
||||
echo '<legend>'.__('Custom URL').'</legend>';
|
||||
html_print_table($table3);
|
||||
echo '</fieldset>';
|
||||
|
||||
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 '</form>';
|
||||
|
||||
if ($api_execute === true) {
|
||||
echo '<fieldset>';
|
||||
echo '<fieldset class="mrgn_0px mrgn_btn_10px pdd_15px" style="max-width: 1122px;">';
|
||||
echo '<legend>'.__('Result').'</legend>';
|
||||
echo __('URL').'<br />';
|
||||
html_print_input_password('url', $return_call_api['url'], '', 150, 255, false, true);
|
||||
echo " <a id='show_icon' title='".__('Show URL')."' href='javascript: show_url();'>";
|
||||
html_print_image('images/input_zoom.png');
|
||||
echo '</a>';
|
||||
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 '<br />';
|
||||
echo __('Result').'<br />';
|
||||
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 '</fieldset>';
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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] = '<div class="w290px">'.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
|
||||
).'</div>';
|
||||
$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] = "<div $style>".__('Public link')." $checkbox</div>";
|
||||
$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] = "<div $style>".__('Public link')." $checkbox</div>";
|
||||
$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 "<form method='post' action='$url' enctype='multipart/form-data'>";
|
||||
html_print_table($table);
|
||||
html_print_action_buttons($submit_button);
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
|
|
@ -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 "<h2>$file_name (".__('File is too large than PHP memory allocated in the system.').')</h2>';
|
||||
echo '<h2>'.__('The preview file is imposible.').'</h2>';
|
||||
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
|
||||
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
|
||||
} 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 "<h2>$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).' </h2>';
|
||||
echo "<textarea class='pandora_logs' name='$file_name'>";
|
||||
echo '... ';
|
||||
echo $data;
|
||||
echo '</textarea><br><br>';
|
||||
$code .= "<h2>$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).' </h2>';
|
||||
$code .= "<textarea class='pandora_logs' name='$file_name'>";
|
||||
$code .= '... ';
|
||||
$code .= $data;
|
||||
$code .= '</textarea><br><br>';
|
||||
} else {
|
||||
$data = file_get_contents($file_name);
|
||||
echo "<h2>$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).' </h2>';
|
||||
echo "<textarea class='pandora_logs' name='$file_name'>";
|
||||
echo $data;
|
||||
echo '</textarea><br><br>';
|
||||
$code .= "<h2>$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).' </h2>';
|
||||
$code .= "<textarea class='pandora_logs' name='$file_name'>";
|
||||
$code .= $data;
|
||||
$code .= '</textarea><br><br></pre>';
|
||||
}
|
||||
|
||||
if ($toggle === true) {
|
||||
ui_toggle(
|
||||
$code,
|
||||
'<span class="subsection_header_title">'.$file_name.'</span>',
|
||||
$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 '<p>'.__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'</p>';
|
||||
|
||||
echo '<p>'.__('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').'</p>';
|
||||
ui_print_info_message(
|
||||
__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'<br>
|
||||
'.__('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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8466,7 +8466,7 @@ div.graph div.legend table {
|
|||
}
|
||||
|
||||
.pandora_logs {
|
||||
width: 98%;
|
||||
width: 100%;
|
||||
float: right;
|
||||
height: 200px;
|
||||
margin-bottom: 20px;
|
||||
|
|
Loading…
Reference in New Issue