2020-03-16 20:48:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2020 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// 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.
|
|
|
|
// Load global vars
|
2020-03-17 16:24:17 +01:00
|
|
|
// TESTING
|
2020-03-31 10:47:00 +02:00
|
|
|
/*
|
|
|
|
ini_set('display_errors', 1);
|
2020-03-20 15:35:30 +01:00
|
|
|
ini_set('display_startup_errors', 1);
|
2020-03-19 16:14:38 +01:00
|
|
|
error_reporting(E_ALL); */
|
2020-03-17 16:24:17 +01:00
|
|
|
// END
|
2020-03-16 20:48:38 +01:00
|
|
|
global $config;
|
2020-03-31 10:47:00 +02:00
|
|
|
/*
|
|
|
|
hd($_POST);
|
|
|
|
hd($_REQUEST); */
|
2020-03-16 20:48:38 +01:00
|
|
|
check_login();
|
|
|
|
|
|
|
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
|
|
|
db_pandora_audit(
|
|
|
|
'ACL Violation',
|
|
|
|
'Trying to access Network Profile Management'
|
|
|
|
);
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-03-19 18:24:52 +01:00
|
|
|
|
2020-03-30 17:00:48 +02:00
|
|
|
require_once $config['homedir'].'/include/class/ModuleTemplates.class.php';
|
|
|
|
$ajaxPage = ENTERPRISE_DIR.'/godmode/agentes/ModuleTemplates';
|
2020-03-16 20:48:38 +01:00
|
|
|
// Control call flow.
|
|
|
|
try {
|
|
|
|
// User access and validation is being processed on class constructor.
|
2020-03-30 17:00:48 +02:00
|
|
|
$moduleTemplates = new ModuleTemplates('');
|
2020-03-16 20:48:38 +01:00
|
|
|
} catch (Exception $e) {
|
2020-03-30 17:00:48 +02:00
|
|
|
echo '[ModuleTemplates]'.$e->getMessage();
|
2020-03-16 20:48:38 +01:00
|
|
|
/*
|
|
|
|
if (is_ajax()) {
|
|
|
|
echo json_encode(['error' => '[MiFuncionalidad]'.$e->getMessage() ]);
|
|
|
|
exit;
|
|
|
|
} else {
|
|
|
|
echo '[MiFuncionalidad]'.$e->getMessage();
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
// Stop this execution, but continue 'globally'.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// AJAX controller.
|
|
|
|
if (is_ajax()) {
|
|
|
|
$method = get_parameter('method');
|
|
|
|
/*
|
|
|
|
if (method_exists($miFuncionalidad, $method) === true) {
|
|
|
|
if ($miFuncionalidad>ajaxMethod($method) === true) {
|
|
|
|
$miFuncionalidad>{$method}();
|
|
|
|
} else {
|
|
|
|
$miFuncionalidad>error('Unavailable method.');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$miFuncionalidad->error('Method not found. ['.$method.']');
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
// Stop any execution.
|
|
|
|
exit;
|
|
|
|
} else {
|
|
|
|
// Run.
|
2020-03-30 17:00:48 +02:00
|
|
|
$moduleTemplates->run();
|
2020-03-19 18:24:52 +01:00
|
|
|
// Get the id_np.
|
2020-03-30 17:00:48 +02:00
|
|
|
$id_np = $moduleTemplates->getIdNp();
|
|
|
|
$moduleTemplates->processData();
|
|
|
|
if ($id_np === -1) {
|
2020-03-23 15:16:54 +01:00
|
|
|
// List all Module Blocks.
|
2020-03-30 17:00:48 +02:00
|
|
|
$moduleTemplates->moduleBlockList();
|
2020-03-19 16:14:38 +01:00
|
|
|
} else {
|
2020-03-19 18:24:52 +01:00
|
|
|
// Create new o update Template.
|
2020-03-30 17:00:48 +02:00
|
|
|
$moduleTemplates->moduleTemplateForm();
|
2020-03-17 16:24:17 +01:00
|
|
|
}
|
2020-03-16 20:48:38 +01:00
|
|
|
}
|
2020-03-20 15:35:30 +01:00
|
|
|
|
|
|
|
?>
|
|
|
|
<script>
|
|
|
|
$(document).ready (function () {
|
|
|
|
//Close button
|
2020-03-23 15:16:54 +01:00
|
|
|
$("[id*=checkbox-switch]").click (function () {
|
2020-03-20 15:35:30 +01:00
|
|
|
$("[id*=checkbox-block_id]").toggleClass('alpha50');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|