$id_plugin));
$preload = io_safe_output($description);
$preload = str_replace ("\n", "
", $preload);
echo $preload;
return;
}
if ($get_list_modules_and_component_locked_plugin) {
$id_plugin = (int)get_parameter('id_plugin', 0);
$network_components = db_get_all_rows_filter(
'tnetwork_component',
array('id_plugin' => $id_plugin));
if (empty($network_components)) {
$network_components = array();
}
$modules = db_get_all_rows_filter(
'tagente_modulo',
array('delete_pending' => 0, 'id_plugin' => $id_plugin));
if (empty($modules)) {
$modules = array();
}
$table = null;
$table->width = "100%";
$table->head[0] = __('Network Components');
$table->data = array();
foreach ($network_components as $net_comp) {
$table->data[] = array($net_comp['name']);
}
if (!empty($table->data)) {
html_print_table($table);
echo "
";
}
$table = null;
$table->width = "100%";
$table->head[0] = __('Agent');
$table->head[1] = __('Module');
foreach ($modules as $mod) {
$agent_name = '' .
modules_get_agentmodule_agent_name(
$mod['id_agente_modulo']) .
'';
$table->data[] = array(
$agent_name,
$mod['nombre']
);
}
if (!empty($table->data)) {
html_print_table($table);
}
return;
}
}
require_once ($config['homedir'] . "/include/functions_filemanager.php");
check_login ();
if (! check_acl ($config['id_user'], 0, "LM")) {
db_pandora_audit("ACL Violation",
"Trying to access Plugin Management");
require ("general/noaccess.php");
return;
}
enterprise_include_once ('meta/include/functions_components_meta.php');
$view = get_parameter ("view", "");
$create = get_parameter ("create", "");
$filemanager = (bool)get_parameter("filemanager", false);
$plugin_command = get_parameter('plugin_command', '');
$tab = get_parameter('tab', '');
if ($view != "") {
$form_id = $view;
$plugin = db_get_row ("tplugin", "id", $form_id);
$form_name = $plugin["name"];
$form_description = $plugin["description"];
$form_max_timeout = $plugin ["max_timeout"];
$form_max_retries = $plugin ["max_retries"];
if (empty($plugin_command))
$form_execute = $plugin ["execute"];
else
$form_execute = $plugin_command;
$form_plugin_type = $plugin ["plugin_type"];
$macros = $plugin ["macros"];
$parameters = $plugin ["parameters"];
}
if ($create != "") {
$form_id = 0;
$form_name = "";
$form_description = "";
$form_max_timeout = 15;
$form_max_retries = 1;
$form_execute = $plugin_command;
$form_plugin_type = 0;
$form_parameters = "";
$macros = "";
$parameters = "";
}
//END LOAD VALUES
// =====================================================================
// INIT FILEMANAGER
// =====================================================================
if ($filemanager) {
$id_plugin = (int)get_parameter('id_plugin', 0);
/* Add custom directories here */
$fallback_directory = "attachment/plugin";
$directory = (string) get_parameter ('directory', $fallback_directory);
$directory = str_replace("\\", "/", $directory);
// 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;
$real_directory = realpath ($config['homedir'] . '/' . $directory);
echo '