'', 'label' => __('Monitoring'), ], [ 'link' => '', 'label' => __('SMNP'), ], ] ); if (isset($config['filemanager']['message'])) { echo $config['filemanager']['message']; $config['filemanager']['message'] = null; } $directory = (string) get_parameter('directory', SNMP_DIR_MIBS); $directory = str_replace('\\', '/', $directory); // Add custom directories here $fallback_directory = 'attachment/mibs'; // A miminal security check to avoid directory traversal if (preg_match('/\.\./', $directory)) { $directory = $fallback_directory; } if (preg_match('/^\//', $directory)) { $directory = $fallback_directory; } if (preg_match('/^manager/', $directory)) { $directory = $fallback_directory; } $banned_directories['include'] = true; $banned_directories['godmode'] = true; $banned_directories['operation'] = true; $banned_directories['reporting'] = true; $banned_directories['general'] = true; $banned_directories[ENTERPRISE_DIR] = true; if (isset($banned_directories[$directory])) { $directory = $fallback_directory; } // Current directory $available_directories[$directory] = $directory; $real_directory = realpath($config['homedir'].'/'.$directory); ui_print_info_message(__('MIB files will be installed on the system. Please note that a MIB may depend on other MIB. To customize trap definitions use the SNMP trap editor.')); $upload_file_or_zip = (bool) get_parameter('upload_file_or_zip'); $create_text_file = (bool) get_parameter('create_text_file'); $default_real_directory = realpath($config['homedir'].'/'.$fallback_directory); if ($upload_file_or_zip) { upload_file($upload_file_or_zip, $default_real_directory); } if ($create_text_file) { create_text_file($default_real_directory); } filemanager_file_explorer( $real_directory, $directory, 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_mib_uploader', SNMP_DIR_MIBS, false, false, '', false, '', false );