From 561b99fc61a981df6d82af895ec786bb0fc8f1b1 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 14 Feb 2013 15:03:07 +0000 Subject: [PATCH] 2013-02-14 Miguel de Dios * include/constants.php: added constant dir for the mibs of snmp. * include/functions_filemanager.php: cleaned source code style. * operation/snmpconsole/snmp_mib_uploader.php: fixed to avoid go upper directory to the mibs. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7654 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++++ pandora_console/include/constants.php | 3 +++ .../include/functions_filemanager.php | 18 +++++++----------- .../snmpconsole/snmp_mib_uploader.php | 7 +++++-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f9da08d77d..c92b160bc4 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-02-14 Miguel de Dios + + * include/constants.php: added constant dir for the mibs of snmp. + + * include/functions_filemanager.php: cleaned source code style. + + * operation/snmpconsole/snmp_mib_uploader.php: fixed to avoid go + upper directory to the mibs. + 2013-02-14 Miguel de Dios * include/functions_netflow.php, operation/netflow/nf_live_view.php: diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index b9666eb2eb..954c7f3466 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -229,4 +229,7 @@ define ('MODULE_SNMP', 2); define ('MODULE_PLUGIN', 4); define ('MODULE_WMI', 6); define ('MODULE_WEB', 7); + +/* SNMP CONSTANTS */ +define ('SNMP_DIR_MIBS', "attachment/mibs"); ?> diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 5afb8a9924..e833e57447 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -367,22 +367,17 @@ if ($delete_file) { * * @param string $dir The dir to deletete */ -function filemanager_delete_directory($dir) -{ - if ($handle = opendir($dir)) - { +function filemanager_delete_directory($dir) { + if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (($file != ".") && ($file != "..")) { - - if (is_dir($dir . $file)) - { - if (!rmdir($dir . $file)) - { + + if (is_dir($dir . $file)) { + if (!rmdir($dir . $file)) { filemanager_delete_directory($dir . $file . '/'); } } - else - { + else { unlink($dir . $file); } } @@ -510,6 +505,7 @@ function filemanager_file_explorer($real_directory, $relative_directory, $url, $ $prev_dir_str .= "/"; } + if (($prev_dir_str != '') && ($father != $relative_directory)) { $table->data[0][0] = html_print_image ('images/go_previous.png', true); $table->data[0][1] = ''; diff --git a/pandora_console/operation/snmpconsole/snmp_mib_uploader.php b/pandora_console/operation/snmpconsole/snmp_mib_uploader.php index 082b8eab1d..100d9944cd 100644 --- a/pandora_console/operation/snmpconsole/snmp_mib_uploader.php +++ b/pandora_console/operation/snmpconsole/snmp_mib_uploader.php @@ -34,7 +34,7 @@ if (isset($config['filemanager']['message'])) { $config['filemanager']['message'] = null; } -$directory = (string) get_parameter ('directory', "attachment/mibs"); +$directory = (string) get_parameter ('directory', SNMP_DIR_MIBS); /* Add custom directories here */ $fallback_directory = "attachment/mibs"; @@ -64,5 +64,8 @@ $real_directory = realpath ($config['homedir'] . '/' . $directory); echo '

' . __('Index of %s', $directory) . '

'; -filemanager_file_explorer($real_directory, $directory, 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_mib_uploader'); +filemanager_file_explorer($real_directory, + $directory, + 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_mib_uploader', + SNMP_DIR_MIBS); ?>