2006-07-20 00:01:47 +02:00
|
|
|
<?php
|
2019-08-06 14:52:43 +02:00
|
|
|
/**
|
|
|
|
* SNMP Console.
|
|
|
|
*
|
|
|
|
* @category SNMP
|
|
|
|
* @package Pandora FMS
|
|
|
|
* @subpackage Community
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
2022-11-14 17:43:35 +01:00
|
|
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
2019-08-06 14:52:43 +02:00
|
|
|
* 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.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
2006-07-20 00:01:47 +02:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// Begin.
|
2010-03-02 20:25:51 +01:00
|
|
|
global $config;
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
require_once $config['homedir'].'/include/class/SnmpConsole.class.php';
|
2020-09-18 15:07:31 +02:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
$ajaxPage = $config['homedir'].'/operation/snmpconsole/snmp_view';
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// Control call flow.
|
|
|
|
try {
|
|
|
|
// User access and validation is being processed on class constructor.
|
|
|
|
$controller = new SnmpConsole($ajaxPage);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
if ((bool) is_ajax() === true) {
|
|
|
|
echo json_encode(['error' => '[SnmpConsole]'.$e->getMessage() ]);
|
|
|
|
exit;
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
2022-11-14 17:43:35 +01:00
|
|
|
echo '[SnmpConsole]'.$e->getMessage();
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// Stop this execution, but continue 'globally'.
|
2019-01-30 16:18:44 +01:00
|
|
|
return;
|
2014-09-23 18:05:44 +02:00
|
|
|
}
|
2008-10-22 17:05:15 +02:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// AJAX controller.
|
|
|
|
if ((bool) is_ajax() === true) {
|
|
|
|
$method = get_parameter('method');
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
if (method_exists($controller, $method) === true) {
|
|
|
|
if ($controller->ajaxMethod($method) === true) {
|
|
|
|
$controller->{$method}();
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
2022-11-14 17:43:35 +01:00
|
|
|
$controller->error('Unavailable method.');
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2022-11-14 17:43:35 +01:00
|
|
|
} else {
|
|
|
|
$controller->error('Method not found. ['.$method.']');
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2014-06-10 17:21:58 +02:00
|
|
|
|
2022-11-14 17:43:35 +01:00
|
|
|
// Stop any execution.
|
|
|
|
exit;
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
2022-11-14 17:43:35 +01:00
|
|
|
// Run.
|
|
|
|
$controller->run();
|
2008-11-20 22:26:59 +01:00
|
|
|
}
|