Merge remote-tracking branch 'refs/remotes/origin/ent-3431-discovery-host-devices' into ent-3431-discovery-host-devices

Former-commit-id: 8210f6bb9abb2c666b6cf4e914d87bb92e8b0690
This commit is contained in:
fbsanchez 2019-02-14 10:58:26 +01:00
commit 6ff357595d
3 changed files with 43 additions and 49 deletions

View File

@ -1,6 +1,18 @@
<?php <?php
global $config; global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Server Management'
);
include 'general/noaccess.php';
exit;
}
ui_print_page_header(__('Discover'), 'wizards/hostDevices.png', false, '', true); ui_print_page_header(__('Discover'), 'wizards/hostDevices.png', false, '', true);

View File

@ -105,7 +105,10 @@ class HostDevices extends Wizard
$mode = get_parameter('mode', null); $mode = get_parameter('mode', null);
if ($mode === null) { if ($mode === null) {
echo '<a href="'.$this->url.'&mode=importcsv" alt="importcsv">Importar csv</a>'; if (extensions_is_enabled_extension('csv_import')) {
echo '<a href="'.$this->url.'&mode=importcsv" alt="importcsv">Importar csv</a>';
}
echo '<a href="'.$this->url.'&mode=netscan" alt="netscan">Escanear red</a>'; echo '<a href="'.$this->url.'&mode=netscan" alt="netscan">Escanear red</a>';
return; return;
} }
@ -151,50 +154,27 @@ class HostDevices extends Wizard
public function runCSV() public function runCSV()
{ {
global $config; global $config;
echo 'formulario csv'; if (!check_acl($config['id_user'], 0, 'AW')
if (isset($this->page) === false || $this->page === 0) { ) {
$this->page = 0; db_pandora_audit(
'ACL Violation',
$test = get_parameter('test', null); 'Trying to access db status'
);
// Check user answers. include 'general/noaccess.php';
if ($test !== null) {
// $this->process_page_0($respuestas_usuario)
$this->page++;
header(
'Location: '.$this->url.'&page='.$this->page
);
} else {
// Mostrar pagina 0.
echo 'Aqui vamos a empezar a construir el formulario.';
?>
<form action="#" method="POST">
<input name='test' type="text"/>
</form>
<?php
}
} else if ($this->page == 1) {
// Code...
$this->page++;
return; return;
header('Location: index.php?class=HostDevices&page='.$this->page);
} else if ($this->page == 2) {
// Code...
$this->page++;
header('Location: index.php?class=HostDevices&page='.$this->page);
} else if ($this->page == 3) {
// Code...
$this->page++;
header('Location: /XXX/discovery/index.php?class=HostDevices&page='.$this->page);
} }
// Page 4, last. if (!extensions_is_enabled_extension('csv_import')) {
return [ ui_print_error_message(
'result' => $this->result, [
'id' => $this->id, 'message' => __('Extension CSV Import is not enabled.'),
'msg' => $this->msg, 'no_close' => true,
]; ]
);
return;
}
include_once $config['homedir'].'/enterprise/extensions/csv_import/main.php';
} }
@ -708,7 +688,7 @@ class HostDevices extends Wizard
echo '</form>'; echo '</form>';
ui_require_javascript_file('pandora_modules'); ui_require_javascript_file('pandora_modules');
$a = ` $javascript = `
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {
@ -853,12 +833,13 @@ class HostDevices extends Wizard
} }
</script>`; </script>`;
echo $a; echo $javascript;
return [
'result' => $this->result, return [
'id' => $this->id, 'result' => $this->result,
'msg' => $this->msg, 'id' => $this->id,
]; 'msg' => $this->msg,
];
} }

View File

@ -178,7 +178,8 @@ function extensions_get_extensions($enterprise=false, $rel_path='')
function extensions_is_enabled_extension($name) function extensions_is_enabled_extension($name)
{ {
global $config; global $config;
return isset($config['extensions'][$name]); return isset($config['extensions'][$name])
|| isset($config['extensions'][$name.'.php']);
} }