2008-08-04 Esteban Sánchez <estebans@artica.es>

* AUTHORS: Added myself.

        * include/functions_extensions.php: Added to repository. Implements
        extensions functions. Extensions are some kind of plugins to the
        console to add functionallity in a modular way. More work and 
        documentation is needed.

        * godmode/reporting/reporting_builder.php, include/functions.php,
        operation/agentes/networkmap.php, operation/agentes/ver_agente.php:
        Style correction.

        * include/functions_db.php: Added load_lang_file() to load the 
        languages file (useful in extensions l10n). Style correction.

        * index.php: Load extensions and call them in cases.

        * godmode/menu.php, operation/menu.php: Style correction, code 
        cleanup. Added extension menu and submenus. Use of CSS more efficient.

        * include/config_process.php: Added extensions support.

        * extensions/, extensions/hello.php: Added to repository, extensions
        dir and example.

        * include/functions.php: Style correction.

        * include/styles/op.css: Cleanup and rewritten the CSS hell it was 
        before.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@997 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2008-08-04 08:15:16 +00:00
parent 950d4a3b98
commit b764fefb8e
14 changed files with 732 additions and 502 deletions

View File

@ -2,6 +2,7 @@ Sancho Lerena <slerena@gmail.com>
Esteban Sanchez <esteban.sanchez@artica.es>
Jorge Gonzalez <jorge.gonzalez@artica.es>
Raul Mateos <raulofpandora@gmail.com>
Esteban Sanchez <estebans@artica.es>
Ramon Novoa <ramon.novoa@artica.es>
See full list of contributors on:

View File

@ -1,3 +1,34 @@
2008-08-04 Esteban Sánchez <estebans@artica.es>
* AUTHORS: Added myself.
* include/functions_extensions.php: Added to repository. Implements
extensions functions. Extensions are some kind of plugins to the
console to add functionallity in a modular way. More work and
documentation is needed.
* godmode/reporting/reporting_builder.php, include/functions.php,
operation/agentes/networkmap.php, operation/agentes/ver_agente.php:
Style correction.
* include/functions_db.php: Added load_lang_file() to load the
languages file (useful in extensions l10n). Style correction.
* index.php: Load extensions and call them in cases.
* godmode/menu.php, operation/menu.php: Style correction, code
cleanup. Added extension menu and submenus. Use of CSS more efficient.
* include/config_process.php: Added extensions support.
* extensions/, extensions/hello.php: Added to repository, extensions
dir and example.
* include/functions.php: Style correction.
* include/styles/op.css: Cleanup and rewritten the CSS hell it was
before.
2008-08-01 Manuel Arostegui <marostegui@artica.es>
* include/help/en/help_plugin_definition.php: Language corrections.
@ -161,6 +192,7 @@
* view_server.php: Fixed problem with lastupdate render. This was using
and incorrect function to render data.
>>>>>>> .r996
2008-07-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_reporting.php: Last commit forgot a semicolon. Fixed.

View File

@ -0,0 +1,16 @@
<?php
/* Remove this statement to enabled the extension */
return;
function hello_extension_main () {
/* Here you can do almost all you want! */
echo 'Hello world!';
}
/* This adds a option in the operation menu */
add_operation_menu_option ('Hello plugin!');
/* This sets the function to be called when the extension is selected in the operation menu */
add_plugin_main_function ('hello_extension_main');
?>

View File

@ -16,275 +16,302 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
if (comprueba_login() == 0){
$id_user = $_SESSION["id_usuario"];
if ( (give_acl($id_user, 0, "LM")==1) OR (give_acl($id_user, 0, "AW")==1 ) OR (give_acl($id_user, 0, "PM")==1) OR (give_acl($id_user, 0, "DM")==1) OR (give_acl($id_user, 0, "UM")==1 )){
if (comprueba_login ()) {
return;
}
if ((! give_acl ($config['id_user'], 0, "LM")) && (! give_acl ($config['id_user'], 0, "AW")) && (! give_acl ($config['id_user'], 0, "PM")) && (! give_acl ($config['id_user'], 0, "DM")) && (! give_acl ($config['id_user'], 0, "UM"))) {
return;
}
?>
<div class="tit bg3">:: <?php echo lang_string ("godmode_header") ?> ::</div>
<div class="menug" id="god">
<?PHP
if ((give_acl($id_user, 0, "AW")==1)){
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/agentes/modificar_agente" || $_GET["sec2"] == "godmode/agentes/configurar_agente")){
echo '<div id="god1s">';
}
else
echo '<div id="god1">';
echo '<ul class="mn"><li><a href="index.php?sec=gagente&amp;sec2=godmode/agentes/modificar_agente" class="mn">'.lang_string ("manage_agents").'</a></li></ul></div>';
if (isset($_GET["sec"]) && $_GET["sec"] == "gagente"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/agentes/manage_config"){
echo "<div class='arrowgs'>";
}
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/agentes/manage_config' class='mn'>".lang_string ("manage_config")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/agentes/manage_config_remote"){
echo "<div class='arrowgs'>";
}
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/agentes/manage_config_remote' class='mn'>".lang_string ("Duplicate config")."</a></li></ul></div>";
// Manage groups
if ((give_acl($id_user, 0, "PM")==1)){
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/groups/group_list" || $_GET["sec2"] == "godmode/groups/configure_group")){
echo "<div class='arrowgs'>";
}
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/groups/group_list' class='mn'>".lang_string ("manage_groups")."</a></li></ul></div>";
}
// Planned downtimes
if ((give_acl($id_user, 0, "AW")==1)){
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/agentes/planned_downtime" || $_GET["sec2"] == "godmode/agentes/planned_downtime")){
echo "<div class='arrowgs'>";
}
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gagente&sec2=godmode/agentes/planned_downtime' class='mn'>".lang_string ("Scheduled downtime")."</a></li></ul></div>";
}
}
}
if ((give_acl($id_user, 0, "PM")==1)){
if (isset($_GET["sec"]) && ($_GET["sec"] == "gmodules"))
echo '<div id="god_module_sel">';
else
echo '<div id="god_module">';
echo '<ul class="mn"><li><a href="index.php?sec=gmodules&sec2=godmode/modules/module_list" class="mn">'.lang_string ("manage_modules").'</a></li></ul></div>';
if (isset($_GET["sec"]) && $_GET["sec"] == "gmodules"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/modules/manage_nc_groups" || $_GET["sec2"] == "godmode/modules/manage_nc_groups_form")
echo "<div class='arrowgs'>";
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups' class='mn'>".lang_string ("nc_groups")."</a></li></ul></div>";
}
if (isset($_GET["sec"]) && $_GET["sec"] == "gmodules"){
if (isset($_GET["sec2"]) && ( $_GET["sec2"] == "godmode/modules/manage_network_components" || $_GET["sec2"] == "godmode/modules/manage_network_components_form") )
echo "<div class='arrowgs'>";
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_components' class='mn'>".lang_string ("network_components")."</a></li></ul></div>";
}
// Network Profiles
if (isset($_GET["sec"]) && $_GET["sec"] == "gmodules"){
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/modules/manage_network_templates" || $_GET["sec2"] == "godmode/modules/manage_network_templates_form" ))
echo "<div class='arrowgs'>";
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates' class='mn'>".lang_string ("network_templates")."</a></li></ul></div>";
}
}
if ((give_acl($id_user, 0, "LM")==1)){
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/alerts/modify_alert" || $_GET["sec2"] == "godmode/alerts/configure_alert")){
echo '<div id="god2s">';
}
else
echo '<div id="god2">';
echo '<ul class="mn"><li><a href="index.php?sec=galertas&amp;sec2=godmode/alerts/modify_alert" class="mn">'.lang_string ("manage_alerts").'</a></li></ul></div>';
}
if ((give_acl($id_user, 0, "UM")==1)){
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/users/user_list" || $_GET["sec2"] == "godmode/users/configure_user")){
echo '<div id="god3s">';
}
else echo '<div id="god3">';
echo '<ul class="mn"><li><a href="index.php?sec=gusuarios&amp;sec2=godmode/users/user_list" class="mn">'.lang_string ("manage_users").'</a></li></ul></div>';
}
// Reporting
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ((give_acl($id_user, 0, "PM")==1)){
echo '<div id="god51">';
echo '<ul class="mn"><li><a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder" class="mn">'. lang_string ("manage_reporting").'</a></li></ul></div>';
// Custom report builder
if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/reporting_builder"){
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=greporting&sec2=godmode/reporting/reporting_builder' class='mn'>".lang_string ("report_builder")."</a></li></ul></div>";
}
// Custom graph builder
if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/graph_builder"){
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=greporting&sec2=godmode/reporting/graph_builder' class='mn'>".lang_string ("graph_builder")."</a></li></ul></div>";
}
// Custom map builder
if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/map_builder"){
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=greporting&sec2=godmode/reporting/map_builder' class='mn'>".lang_string ("map_builder")."</a></li></ul></div>";
}
}
// Manage profiles
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ( (give_acl($id_user, 0, "PM")==1)){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/profiles/profile_list"){
echo '<div id="god4s">';
}
else echo '<div id="god4">';
echo '<ul class="mn"><li><a href="index.php?sec=gperfiles&amp;sec2=godmode/profiles/profile_list" class="mn">'.lang_string ("manage_profiles").'</a></li></ul></div>';
// SERVERS
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/servers/modificar_server"){
echo '<div id="god5s">';
} else
echo '<div id="god5">';
echo '<ul class="mn"><li><a href="index.php?sec=gservers&amp;sec2=godmode/servers/modificar_server" class="mn">'.lang_string ("manage_servers").'</a></li></ul></div>';
if (isset($_GET["sec"]) && $_GET["sec"] == "gservers"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/servers/manage_recontask"|| $_GET["sec2"] == "godmode/servers/manage_recontask_form"){
echo "<div class='arrowgs'>";
} else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gservers&sec2=godmode/servers/manage_recontask' class='mn'>".lang_string ("manage_recontask")."</a></li></ul></div>";
}
if (isset($_GET["sec"]) && $_GET["sec"] == "gservers"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/servers/plugin"){
echo "<div class='arrowgs'>";
}
else echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gservers&sec2=godmode/servers/plugin' class='mn'>".lang_string("Manage plugins")."</a></li></ul></div>";
}
// AUDIT
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/admin_access_logs"){
echo '<div id="god6s">';
}
else echo '<div id="god6">';
echo '<ul class="mn"><li><a href="index.php?sec=glog&amp;sec2=godmode/admin_access_logs" class="mn">'.lang_string ("system_audit").'</a></li></ul></div>';
// Main SETUP
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/setup/setup"){
echo '<div id="god7s">';
}
else echo '<div id="god7">';
echo '<ul class="mn"><li><a href="index.php?sec=gsetup&amp;sec2=godmode/setup/setup" class="mn">'.lang_string ("setup_screen").'</a></li></ul></div>';
if (isset($_GET["sec"]) && $_GET["sec"] == "gsetup"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/setup/links"){
echo "<div class='arrowgs'>";
}
else echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gsetup&amp;sec2=godmode/setup/links' class='mn'>".lang_string ("setup_links")."</a></li></ul></div>";
}
if (isset($_GET["sec"]) && $_GET["sec"] == "gsetup"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/setup/news"){
echo "<div class='arrowgs'>";
}
else echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gsetup&amp;sec2=godmode/setup/news' class='mn'>".lang_string ("site_news")."</a></li></ul></div>";
}
}
if ((give_acl($id_user, 0, "DM")==1)){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_main"){
echo '<div id="god8s">';
} else
echo '<div id="god8">';
echo '<ul class="mn">';
if (isset($_GET["sec"]) && $_GET["sec"] == "gdbman" &&
isset($_GET["sec2"]) && $_GET["sec2"] != "godmode/db/db_main"){
echo '<li>';
} else {
echo '<li class="bb0">';
}
echo '<a href="index.php?sec=gdbman&amp;sec2=godmode/db/db_main" class="mn">'.lang_string ("db_maintenance").'</a></li></ul></div>';
if (isset($_GET["sec"]) && $_GET["sec"] == "gdbman"){
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/db/db_info" || $_GET["sec2"] == "godmode/db/db_info_data")){
echo "<div class='arrowgs'>";
} else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_info' class='mn'>".lang_string ("db_info")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_purge"){
echo "<div class='arrowgs'>";
} else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_purge' class='mn'>".lang_string ("db_purge")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_refine"){
echo "<div class='arrowgs'>";
} else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_refine' class='mn'>".lang_string ("db_refine")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_audit"){
echo "<div class='arrowgs'>";
} else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_audit' class='mn'>".lang_string ("db_audit")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_event"){
echo "<div id='arrowgls'>";
} else
echo "<div id='arrowgl'>";
echo "<ul class='mn'><li class='bb0'><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_event' class='mn'>".lang_string ("db_event")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_sanity"){
echo "<div id='arrowgls'>";
} else
echo "<div id='arrowgl'>";
echo "<ul class='mn'><li class='bb0'><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity' class='mn'>".lang_string ("Database sanity")."</a></li></ul></div>";
}
}
?>
</div>
<?php
} // end verify access to this menu
if (give_acl ($config['id_user'], 0, "AW")) {
if ($sec2 == "godmode/agentes/modificar_agente" || $sec2 == "godmode/agentes/configurar_agente") {
echo '<div id="god1s">';
}
else
echo '<div id="god1">';
echo '<ul class="mn"><li><a href="index.php?sec=gagente&amp;sec2=godmode/agentes/modificar_agente" class="mn">'.lang_string ("manage_agents").'</a></li></ul></div>';
if ($sec == "gagente") {
if ($sec2 == "godmode/agentes/manage_config") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/agentes/manage_config' class='mn'>".lang_string ("manage_config")."</a></li></ul></div>";
if ($sec2 == "godmode/agentes/manage_config_remote") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/agentes/manage_config_remote' class='mn'>".lang_string ("Duplicate config")."</a></li></ul></div>";
// Manage groups
if (give_acl($config['id_user'], 0, "PM")) {
if ($sec2 == "godmode/groups/group_list" || $sec2 == "godmode/groups/configure_group") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/groups/group_list' class='mn'>".lang_string ("manage_groups")."</a></li></ul></div>";
}
// Planned downtimes
if ((give_acl($config['id_user'], 0, "AW")==1)){
if ($sec2 == "godmode/agentes/planned_downtime" || $sec2 == "godmode/agentes/planned_downtime") {
echo "<div class='arrowgs'>";
}
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gagente&sec2=godmode/agentes/planned_downtime' class='mn'>".lang_string ("Scheduled downtime")."</a></li></ul></div>";
}
}
}
if ((give_acl($config['id_user'], 0, "PM")==1)){
if ($sec == "gmodules")
echo '<div id="god_module_sel">';
else
echo '<div id="god_module">';
echo '<ul class="mn"><li><a href="index.php?sec=gmodules&sec2=godmode/modules/module_list" class="mn">'.lang_string ("manage_modules").'</a></li></ul></div>';
if ($sec == "gmodules") {
if ($sec2 == "godmode/modules/manage_nc_groups" || $sec2 == "godmode/modules/manage_nc_groups_form")
echo "<div class='arrowgs'>";
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups' class='mn'>".lang_string ("nc_groups")."</a></li></ul></div>";
}
if ($sec == "gmodules") {
if ($sec2 == "godmode/modules/manage_network_components" || $sec2 == "godmode/modules/manage_network_components_form")
echo "<div class='arrowgs'>";
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_components' class='mn'>".lang_string ("network_components")."</a></li></ul></div>";
}
// Network Profiles
if ($sec == "gmodules") {
if ($sec2 == "godmode/modules/manage_network_templates" || $sec2 == "godmode/modules/manage_network_templates_form")
echo "<div class='arrowgs'>";
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates' class='mn'>".lang_string ("network_templates")."</a></li></ul></div>";
}
}
if (give_acl ($config['id_user'], 0, "LM")) {
if ($sec2 == "godmode/alerts/modify_alert" || $sec2 == "godmode/alerts/configure_alert") {
echo '<div id="god2s">';
}
else
echo '<div id="god2">';
echo '<ul class="mn"><li><a href="index.php?sec=galertas&amp;sec2=godmode/alerts/modify_alert" class="mn">'.lang_string ("manage_alerts").'</a></li></ul></div>';
}
if (give_acl ($config['id_user'], 0, "UM")) {
if ($sec2 == "godmode/users/user_list" || $sec2 == "godmode/users/configure_user") {
echo '<div id="god3s">';
}
else echo '<div id="god3">';
echo '<ul class="mn"><li><a href="index.php?sec=gusuarios&amp;sec2=godmode/users/user_list" class="mn">'.lang_string ("manage_users").'</a></li></ul></div>';
}
// Reporting
if (give_acl ($config['id_user'], 0, "PM")) {
echo '<div id="god51">';
echo '<ul class="mn"><li><a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder" class="mn">'. lang_string ("manage_reporting").'</a></li></ul></div>';
// Custom report builder
if ($sec == "greporting") {
if ($sec2 == "godmode/reporting/reporting_builder") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=greporting&sec2=godmode/reporting/reporting_builder' class='mn'>".lang_string ("report_builder")."</a></li></ul></div>";
}
// Custom graph builder
if ($sec == "greporting") {
if ($sec2 == "godmode/reporting/graph_builder"){
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=greporting&sec2=godmode/reporting/graph_builder' class='mn'>".lang_string ("graph_builder")."</a></li></ul></div>";
}
// Custom map builder
if ($sec == "greporting") {
if ($sec2 == "godmode/reporting/map_builder") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=greporting&sec2=godmode/reporting/map_builder' class='mn'>".lang_string ("map_builder")."</a></li></ul></div>";
}
}
// Manage profiles
if (give_acl ($config['id_user'], 0, "PM")) {
if ($sec2 == "godmode/profiles/profile_list") {
echo '<div id="god4s">';
}
else echo '<div id="god4">';
echo '<ul class="mn"><li><a href="index.php?sec=gperfiles&amp;sec2=godmode/profiles/profile_list" class="mn">'.lang_string ("manage_profiles").'</a></li></ul></div>';
// SERVERS
if ($sec2 == "godmode/servers/modificar_server"){
echo '<div id="god5s">';
} else
echo '<div id="god5">';
echo '<ul class="mn"><li><a href="index.php?sec=gservers&amp;sec2=godmode/servers/modificar_server" class="mn">'.lang_string ("manage_servers").'</a></li></ul></div>';
if ($sec == "gservers") {
if ($sec2 == "godmode/servers/manage_recontask"|| $sec2 == "godmode/servers/manage_recontask_form") {
echo "<div class='arrowgs'>";
} else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gservers&sec2=godmode/servers/manage_recontask' class='mn'>".lang_string ("manage_recontask")."</a></li></ul></div>";
}
if ($sec == "gservers") {
if ($sec2 == "godmode/servers/plugin") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=gservers&sec2=godmode/servers/plugin' class='mn'>".lang_string("Manage plugins")."</a></li></ul></div>";
}
// AUDIT
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ($sec2 == "godmode/admin_access_logs") {
echo '<div id="god6s">';
}
else echo '<div id="god6">';
echo '<ul class="mn"><li><a href="index.php?sec=glog&amp;sec2=godmode/admin_access_logs" class="mn">'.lang_string ("system_audit").'</a></li></ul></div>';
// Main SETUP
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ($sec2 == "godmode/setup/setup") {
echo '<div id="god7s">';
}
else echo '<div id="god7">';
echo '<ul class="mn"><li><a href="index.php?sec=gsetup&amp;sec2=godmode/setup/setup" class="mn">'.lang_string ("setup_screen").'</a></li></ul></div>';
if ($sec == "gsetup") {
if ($sec2 == "godmode/setup/links") {
echo "<div class='arrowgs'>";
}
else echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gsetup&amp;sec2=godmode/setup/links' class='mn'>".lang_string ("setup_links")."</a></li></ul></div>";
}
if ($sec == "gsetup"){
if ($sec2 == "godmode/setup/news") {
echo "<div class='arrowgs'>";
}
else echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gsetup&amp;sec2=godmode/setup/news' class='mn'>".lang_string ("site_news")."</a></li></ul></div>";
}
}
if (give_acl ($config['id_user'], 0, "DM")) {
if ($sec2 == "godmode/db/db_main") {
echo '<div id="god8s">';
} else
echo '<div id="god8">';
echo '<ul class="mn">';
if ($sec == "gdbman" && $sec2 != "godmode/db/db_main") {
echo '<li>';
} else {
echo '<li class="bb0">';
}
echo '<a href="index.php?sec=gdbman&amp;sec2=godmode/db/db_main" class="mn">'.lang_string ("db_maintenance").'</a></li></ul></div>';
if ($sec == "gdbman") {
if ($sec2 == "godmode/db/db_info" || $sec2 == "godmode/db/db_info_data") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_info' class='mn'>".lang_string ("db_info")."</a></li></ul></div>";
if ($sec2 == "godmode/db/db_purge") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_purge' class='mn'>".lang_string ("db_purge")."</a></li></ul></div>";
if ($sec2 == "godmode/db/db_refine") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_refine' class='mn'>".lang_string ("db_refine")."</a></li></ul></div>";
if ($sec2 == "godmode/db/db_audit") {
echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_audit' class='mn'>".lang_string ("db_audit")."</a></li></ul></div>";
if ($sec2 == "godmode/db/db_event") {
echo "<div id='arrowgls'>";
} else {
echo "<div id='arrowgl'>";
}
echo "<ul class='mn'><li class='bb0'><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_event' class='mn'>".lang_string ("db_event")."</a></li></ul></div>";
if ($sec2 == "godmode/db/db_sanity") {
echo "<div id='arrowgls'>";
} else {
echo "<div id='arrowgl'>";
}
echo "<ul class='mn'><li class='bb0'><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity' class='mn'>".lang_string ("Database sanity")."</a></li></ul></div>";
}
}
if (sizeof ($config['extensions'])) {
if ($sec == "gextensions") {
$selected = ' menu-selected';
} else {
$selected = '';
}
echo '<div id="op-extensions" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li><a href="index.php?sec=gextensions&sec2=godmode/extensions" class="mn">';
echo lang_string ('Extensions');
echo '</a></li></ul>';
echo "</div>";
if ($selected != '') {
foreach ($config['extensions'] as $extension) {
if ($extension['godmode_menu'] == '')
continue;
$menu = $extension['godmode_menu'];
if (! give_acl ($config['id_user'], 0, $menu['acl']))
continue;
if ($sec2 == $menu['sec2']) {
echo '<div class="operation-submenu submenu-selected">';
} else {
echo '<div class="operation-submenu">';
}
echo '<ul class="mn"><li>';
echo '<a href="index.php?sec=gextensions&sec2='.$menu['sec2'].'" class="mn">'.$menu['name'];
echo '</a></li></ul></div>';
}
}
}
echo '</div>';
?>

View File

@ -21,9 +21,8 @@
$id_user=$_SESSION["id_usuario"];
global $REMOTE_ADDR;
if ((give_acl($id_user, 0, "AW") != 1) && (dame_admin ($id_user) != 1)) {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
if (give_acl ($id_user, 0, "AW") != 1 && dame_admin ($id_user) != 1) {
audit_db ($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
include ("general/noaccess.php");
exit;
}
@ -133,7 +132,7 @@ if ($add_content) {
$id_agent_module ? $id_agent_module : "NULL",
$order, $type, $period * 3600);
if ($result = mysql_query($sql)) {
echo "<h3 class=suc>".lang_string ('create_reporting_ok')."</h3>";
echo '<h3 class="suc">'.lang_string ('create_reporting_ok').'</h3>';
$id_agent = 0;
$id_agent_module = 0;
$report_id_group = 0;
@ -144,7 +143,7 @@ if ($add_content) {
$sla_min = 0;
$sla_limit = 0;
} else {
echo "<h3 class=error>".lang_string ('create_reporting_no')."</h3>";
echo '<h3 class="error">'.lang_string ('create_reporting_no')."</h3>";
/* Do not unset so the values are kept in the form */
}
}

View File

@ -17,9 +17,9 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//Pandora Version
if (!isset($build_version))
if (!isset ($build_version))
$build_version = "PC080610";
if (!isset($pandora_version))
if (!isset ($pandora_version))
$pandora_version = "v2.0-dev";
// This is directory where placed "/attachment" directory, to upload files stores.
@ -38,8 +38,7 @@ $config["style"] = "pandora";
$config["sla_period"] = 604800;
// Read remaining config tokens from DB
if (! mysql_connect($config["dbhost"],$config["dbuser"],$config["dbpass"])){
if (! mysql_connect ($config["dbhost"], $config["dbuser"], $config["dbpass"])) {
//Non-persistent connection. If you want persistent conn change it to mysql_pconnect()
exit ('<html><head><title>Pandora FMS Error</title>
<link rel="stylesheet" href="./include/styles/pandora.css" type="text/css">
@ -81,72 +80,28 @@ if (sizeof ($configs) == 0) {
</div>
</div></body></html>');
}
foreach ($configs as $c) {
switch ($c["token"]) {
case "language_code":
$config["language"] = $c["value"];
break;
case "block_size":
$config["block_size"] = $c["value"];
break;
case "days_purge":
$config["days_purge"] = $c["value"];
break;
case "days_compact":
$config["days_compact"] = $c["value"];
break;
case "graph_res":
$config["graph_res"] = $c["value"];
break;
case "step_compact":
$config["step_compact"] = $c["value"];
break;
case "style":
$config["style"] = $c["value"];
break;
case "show_unknown":
$config["show_unknown"] = $c["value"];
break;
case "show_lastalerts":
$config["show_lastalerts"] = $c["value"];
break;
case "remote_config":
$config["remote_config"] = $c["value"];
break;
case "graph_color1":
$config["graph_color1"] = $c["value"];
break;
case "graph_color2":
$config["graph_color2"] = $c["value"];
break;
case "graph_color3":
$config["graph_color3"] = $c["value"];
break;
case "sla_period":
$config["sla_period"] = $c["value"];
break;
default:
$config[$c["token"]] = $c["value"];
}
}
if ($config["language"] == 'ast_es') {
$help_code = 'ast';
} else {
$help_code = substr ($config["language"], 0, 2);
}
if (! defined ('EXTENSIONS_DIR'))
define ('EXTENSIONS_DIR', 'extensions');
require_once ('functions_extensions.php');
$config['extensions'] = get_extensions ();
?>

View File

@ -61,7 +61,7 @@ function safe_input ($value) {
* @param mesg Message to be displayed
*/
function pandora_debug ($var, $msg) {
echo "[Pandora DEBUG (".$var."]: (".$msg.")<br />";
echo "[Pandora DEBUG (".$var."): (".$msg.")<br />";
}
/**
@ -879,7 +879,7 @@ function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0) {
// Description
echo "<td class='".$tdcolor."'>".$data["descripcion"]."</td>";
// Extended info
// Extended info
echo "<td class='".$tdcolor."'>";
// Has recovery notify activated ?
@ -1168,9 +1168,10 @@ function return_priority ($priority) {
* @param string Text string to be stripped of magic_quotes protection
*/
function unsafe_string ($string){
if (get_magic_quotes_gpc() == 1)
$string = stripslashes ($string);
function unsafe_string ($string) {
if (get_magic_quotes_gpc () == 1)
$string = stripslashes ($string);
return $string;
}
?>

View File

@ -1218,7 +1218,8 @@ function give_agent_id_from_module_id ($id_agent_module) {
return (int) get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
}
$sql_cache=array('saved' => 0);
$sql_cache = array ('saved' => 0);
/**
* Get the first value of the first row of a table in the database.
*
@ -1226,17 +1227,20 @@ $sql_cache=array('saved' => 0);
* @param table Table to retrieve the data
* @param field_search Field to filter elements
* @param condition Condition the field must have
*
* @return
*
* @return Value of first column of the first row. False if there were no row.
*/
function get_db_value ($field, $table, $field_search=1, $condition=1){
function get_db_value ($field, $table, $field_search = 1, $condition = 1) {
if (is_int ($condition)) {
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %d LIMIT 1", $field, $table, $field_search, $condition);
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %d LIMIT 1",
$field, $table, $field_search, $condition);
} else if (is_float ($condition) || is_double ($condition)) {
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %f LIMIT 1", $field, $table, $field_search, $condition);
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %f LIMIT 1",
$field, $table, $field_search, $condition);
} else {
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = '%s' LIMIT 1", $field, $table, $field_search, $condition);
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = '%s' LIMIT 1",
$field, $table, $field_search, $condition);
}
$result = get_db_all_rows_sql ($sql);
@ -1256,11 +1260,11 @@ function get_db_value ($field, $table, $field_search=1, $condition=1){
function get_db_row_sql ($sql) {
$sql .= " LIMIT 1";
$result = get_db_all_rows_sql ($sql);
if($result === false)
return false;
return $result[0];
return $result[0];
}
/**
@ -1305,7 +1309,7 @@ function get_db_sql ($sql, $field = 0) {
if($result === false)
return false;
return $result[0][$field];
return $result[0][$field];
}
/**
@ -1713,6 +1717,17 @@ function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0)
return (float) $sum;
}
/**
* Loads a language file.
*
* Check existance of file.
*
* @param file Filename of language definitions to load.
*/
function load_lang_file ($file) {
if (file_exists ($file))
require_once ($config["homedir"]."/include/languages/language_".$config["language"].".php");
}
/**
* Get a translated string.
*
@ -1724,9 +1739,11 @@ function lang_string ($string) {
global $config;
global $lang_label;
if(!is_array ($lang_label)) {
require_once ($config["homedir"]."/include/languages/language_".$config["language"].".php");
} //Only includes the file once (the first function call) and since $lang_label is global, it will propagate
if (!is_array ($lang_label)) {
/* Only includes the file once (the first function call)
and since $lang_label is global, it will propagate */
load_lang_file ($config["homedir"]."/include/languages/language_".$config["language"].".php");
}
if (isset ($lang_label[$string]))
return $lang_label[$string];
@ -1781,8 +1798,7 @@ function show_alert_row_mini ($id_combined_alert) {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr>";
echo "<tr>";
if ($row2["disable"] == 1) {
$tdcolor = "datos3";
}

View File

@ -0,0 +1,124 @@
<?php
$extension_file = '';
function extension_main_function ($filename) {
global $config;
$extension = &$config['extensions'][$filename];
if ($extension['main_function'] != '') {
$params = array ();
call_user_func_array ($extension['main_function'], $params);
}
}
function extension_godmode_function ($filename) {
global $config;
$extension = &$config['extensions'][$filename];
if ($extension['godmode_function'] != '') {
$params = array ();
call_user_func_array ($extension['godmode_function'], $params);
}
}
function is_extension ($page) {
global $config;
$filename = basename ($page);
return isset ($config['extensions'][$filename]);
}
function get_extensions () {
$handle = @opendir (EXTENSIONS_DIR);
if (! $handle) {
return;
}
$file = readdir ($handle);
$extensions = array ();
$ignores = array ('.', '..');
while ($file !== false) {
if (in_array ($file, $ignores)) {
$file = readdir ($handle);
continue;
}
$filepath = realpath (EXTENSIONS_DIR."/".$file);
if (! is_readable ($filepath) || is_dir ($filepath) || ! preg_match ("/.*\.php$/", $filepath)) {
$file = readdir ($handle);
continue;
}
$extension['file'] = $file;
$extension['operation_menu'] = '';
$extension['godmode_menu'] = '';
$extension['main_function'] = '';
$extension['godmode_function'] = '';
$extension['login_function'] = '';
$extensions[$file] = $extension;
$file = readdir ($handle);
}
return $extensions;
}
function load_extensions ($extensions) {
global $config;
global $extension_file;
foreach ($extensions as $extension) {
$extension_file = $extension['file'];
include_once (realpath (EXTENSIONS_DIR."/".$extension_file));
}
}
function add_operation_menu_option ($name) {
global $config;
global $extension_file;
/* $config['extension_file'] is set in load_extensions(), since that function must
be called before any function the extension call, we are sure it will
be set. */
$option_menu['name'] = substr ($name, 0, 15);
$option_menu['sec2'] = EXTENSIONS_DIR.'/'.substr ($extension_file, 0, -4);
$extension = &$config['extensions'][$extension_file];
$extension['operation_menu'] = $option_menu;
}
function add_godmode_menu_option ($name, $acl) {
global $config;
global $extension_file;
/* $config['extension_file'] is set in load_extensions(), since that function must
be called before any function the extension call, we are sure it will
be set. */
$option_menu['acl'] = $acl;
$option_menu['name'] = substr ($name, 0, 15);
$option_menu['sec2'] = EXTENSIONS_DIR.'/'.substr ($extension_file, 0, -4);
$extension = &$config['extensions'][$extension_file];
$extension['godmode_menu'] = $option_menu;
}
function add_extension_main_function ($function_name) {
global $config;
global $extension_file;
$extension = &$config['extensions'][$extension_file];
$extension['main_function'] = $function_name;
}
function add_extension_godmode_function ($function_name) {
global $config;
global $extension_file;
$extension = &$config['extensions'][$extension_file];
$extension['godmode_function'] = $function_name;
}
function add_login_action_function ($function_name) {
global $config;
global $extension_file;
$extension = &$config['extensions'][$extension_file];
$extension['login_function'] = $function_name;
}
?>

View File

@ -1,77 +1,83 @@
#op a {
#menu-operation {
border-top: 0px;
}
#menu-operation a {
display: block;
color: #000;
text-decoration: none;
}
#op li {
#menu-operation li {
left: 0px;
width: 100%;
border-bottom: 1px solid #d4d4d4;
border-top: 1px solid #eee;
}
div.menuop {
.menu-operation {
background-color: #e6e9cd;
border: 1px solid #dadbdb;
width: 155px;
margin-bottom: 5px;
}
#op1 li, #op2 li, #op3 li, #op4 li, #op5 li, #op6 li, #op7 li, #op8 li, #op9 li,
#op1s li, #op2s li, #op3s li, #op4s li, #op5s li, #op6s li, #op7s li, #op8s li, #op9s li {
.operation-menu li {
padding: 0px 0px 0px 28px;
left: 0px;
width: 100%;
border-bottom: 1px solid #d4d4d4;
border-top: 1px solid #eee;
}
div#op1>ul, div#op2>ul, div#op3>ul, div#op4>ul, div#op5>ul, div#op6>ul, div#op7>ul,
div#op8>ul, div#op9>ul, div#op1s>ul, div#op2s>ul, div#op3s>ul, div#op4s>ul, div#op5s>ul, div#op6s>ul,
div#op7s>ul, div#op8s>ul, div#op9s>ul {
.operation-menu ul {
width: 127px;
}
#op1 li , #op1 li:hover, #op1s li {
#op1 li {
background: url(../../images/bricks.png) no-repeat 4px 3px;
}
#op2 li, #op2 li:hover, #op2s li {
#op2 li {
background: url(../../images/server_database.png) no-repeat 4px 3px;
}
#op3 li, #op3 li:hover, #op3s li {
#op3 li {
background: url(../../images/book_edit.png) no-repeat 4px 3px;
}
#op4 li, #op4 li:hover, #op4s li {
#op4 li {
background: url(../../images/lightning_go.png) no-repeat 4px 3px;
}
/* users */
#op5 li, #op5 li:hover, #op5s li {
#op5 li {
background: url(../../images/group.png) no-repeat 4px 4px;
}
#op6 li, #op6 li:hover, #op6s li {
#op6 li {
background: url(../../images/computer_error.png) no-repeat 4px 4px;
}
/* trap console */
#op7 li, #op7 li:hover, #op7s li {
#op7 li {
background: url(../../images/email.png) no-repeat 4px 4px;
}
#op8 li, #op8 li:hover, #op8s li {
#op8 li {
background: url(../../images/reporting.png) no-repeat 4px 4px;
}
#op9 li, #op9 li:hover, #op9s li {
#op9 li {
background: url(../../images/monitor.png) no-repeat 4px 3px;
}
div.arrow>ul, div.arrows>ul, div#arrowl>ul, div#arrowls>ul {
#op-extensions li {
background: url(../../images/extensions.png) no-repeat 4px 3px;
}
.operation-submenu>ul {
width: 75%;
}
.arrow li, .arrow li:hover, .arrows li, #arrowl li, #arrowl li:hover, #arrowls li {
.operation-submenu li {
background: url(../../images/arrow.png) no-repeat 2px 4px;
margin-left: 26px;
padding: 0px 0px 0px 14px;
padding: 0px 0px 0px 14px;
}
#op a:hover ,
#op1 li:hover, #op1s li , #op2 li:hover, #op2s li , #op3 li:hover, #op3s li ,
#op4 li:hover, #op4s li , #op5 li:hover, #op5s li , #op6 li:hover, #op6s li ,
#op7 li:hover, #op7s li , #op8 li:hover, #op8s li, #op9 li:hover, #op9s li,
.arrow li:hover, .arrows li, #arrowl li:hover, #arrowls li
{
background-color: #d4ddc6;
.menu-selected, #menu-operation li:hover, .submenu-selected li, .operation-submenu li:hover {
background-color: #d4ddc6 !important;
}
#op li.bb0, #arrowls li.bb0, #op8 li.bb0 {
#menu-operation li.bb0, #arrowls li.bb0, #op8 li.bb0 {
border-bottom: 0px;
}
#op {
border-top: 0px;
}

View File

@ -65,6 +65,7 @@ require_once ("include/languages/language_".$config["language"].".php");
require_once ("include/functions.php");
require_once ("include/functions_db.php");
//We should require this or you might end up with some empty strings
load_extensions ($config['extensions']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@ -72,10 +73,10 @@ require_once ("include/functions_db.php");
<head>
<?php
// Pure mode (without menu, header and footer).
$config["pure"] = get_parameter("pure",0);
$config["pure"] = get_parameter ("pure", 0);
// Auto Refresh page
$intervalo = get_parameter ("refr",0);
$intervalo = get_parameter ("refr", 0);
if ($intervalo > 0){
// Agent selection filters and refresh
$query = 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '') . '://' . $_SERVER['SERVER_NAME'];
@ -193,18 +194,18 @@ if (isset ($_GET["bye"])) {
session_unregister ("id_usuario");
exit;
}
$pagina = "";
$page = "";
if (isset ($_GET["sec2"])){
$sec2 = get_parameter_get ('sec2');
$sec2 = parameter_extra_clean ($sec2);
$pagina = $sec2;
$page = $sec2;
} else
$sec2 = "";
if (isset ($_GET["sec"])){
$sec = get_parameter_get ('sec');
$sec = parameter_extra_clean ($sec);
$pagina = $sec2;
$page = $sec2;
} else {
$sec = "";
}
@ -214,7 +215,7 @@ if (isset ($_GET["sec"])){
session_write_close();
// Header
if ($config["pure"] == 0){
if ($config["pure"] == 0) {
echo '<div id="container">';
echo '<div id="head">';
require ("general/header.php");
@ -233,12 +234,21 @@ if ($config["pure"] == 0){
}
// Page loader / selector
if ($pagina != ""){
if (file_exists ($pagina.".php")) {
require ($pagina.".php");
if ($page != "") {
$page .= '.php';
if (file_exists ($page)) {
if (! is_extension ($page)) {
require ($page);
} else {
if ($sec[0] == 'g') {
extension_godmode_function (basename ($page));
} else {
extension_main_function (basename ($page));
}
}
} else {
echo "<br><b class='error'>".lang_string("Sorry! I can't find the page!")."</b>";
}
}
} else
require ("general/logon_ok.php"); //default

View File

@ -75,8 +75,8 @@ function create_edge ($head, $tail) {
// Returns a node definition
function create_node ($agent, $simple = 0, $font_size = 10) {
$sql = sprintf ('SELECT COUNT(tagente_modulo.id_agente) FROM tagente_estado,
tagente_modulo
$sql = sprintf ('SELECT COUNT(tagente_modulo.id_agente)
FROM tagente_estado, tagente_modulo
WHERE tagente_modulo.id_agente = %d
AND tagente_modulo.id_tipo_modulo in (2, 6, 9, 18, 21, 100)
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo

View File

@ -66,7 +66,7 @@ if (defined ('AJAX')) {
AND disabled = 0
AND id_tipo_modulo in (2, 6, 9, 18, 21, 100)', $id_agent);
$total_modules = get_db_sql ($sql);
if ($bad_modules === false)
$size_bad_modules = 0;
else
@ -88,7 +88,15 @@ if (defined ('AJAX')) {
}
// Alerts (if present)
$sql = sprintf ('SELECT COUNT(talerta_agente_modulo.id_aam) FROM talerta_agente_modulo, tagente_modulo, tagente WHERE tagente.id_agente = %d AND tagente.disabled = 0 AND tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.times_fired > 0 ', $id_agent);
$sql = sprintf ('SELECT COUNT(talerta_agente_modulo.id_aam)
FROM talerta_agente_modulo, tagente_modulo, tagente
WHERE tagente.id_agente = %d
AND tagente.disabled = 0
AND tagente.id_agente = tagente_modulo.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo
AND talerta_agente_modulo.times_fired > 0 ',
$id_agent);
$alert_modules = get_db_sql ($sql);
if ($alert_modules > 0){
$sql = sprintf ('SELECT tagente_modulo.nombre, talerta_agente_modulo.last_fired FROM talerta_agente_modulo, tagente_modulo, tagente WHERE tagente.id_agente = %d AND tagente.disabled = 0 AND tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.times_fired > 0 ', $id_agent);

View File

@ -21,135 +21,138 @@
?>
<?php
if (! isset($_SESSION["id_usuario"])) {
if (! isset ($_SESSION["id_usuario"])) {
return;
}
}
?>
<div class="tit bg">:: <?php echo lang_string ("operation_header") ?> ::</div>
<div class="menuop" id="op">
<div class="tit bg">:: <?= lang_string ('operation_header'); ?> ::</div>
<div class="menu-operation" id="menu-operation">
<?php
$sec = get_parameter ('sec');
$sec2 = get_parameter ('sec2');
// Agent read, Server read
if (give_acl($_SESSION["id_usuario"], 0, "AR")) {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/tactical") {
echo '<div id="op1s">';
if (give_acl ($_SESSION["id_usuario"], 0, "AR")) {
if ($sec2 == "operation/agentes/tactical") {
$selected = ' menu-selected';
} else {
echo '<div id="op1">';
$selected = '';
}
echo '<div id="op1" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li><a href="index.php?sec=estado&amp;sec2=operation/agentes/tactical&amp;refr=60" class="mn">'.lang_string ("view_agents").'</a></li></ul></div>';
if (isset($_GET["sec"]) && $_GET["sec"] == "estado"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/tactical"){
echo "<div class='arrows'>";
if ($sec == "estado") {
if ($sec2 == "operation/agentes/tactical") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/tactical&refr=60' class='mn'>".lang_string ("tactical_view")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/estado_grupo"){
echo "<div class='arrows'>";
if ($sec2 == "operation/agentes/estado_grupo") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/estado_grupo&refr=60' class='mn'>".lang_string ("group_view_menu")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/networkmap"){
echo "<div class='arrows'>";
if ($sec2 == "operation/agentes/networkmap") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/networkmap' class='mn'>".lang_string("Network Map")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "operation/agentes/estado_agente" || $_GET["sec2"] == "operation/agentes/ver_agente" || $_GET["sec2"] == "operation/agentes/datos_agente")) {
echo "<div class='arrows'>";
if (($sec2 == "operation/agentes/estado_agente" || $sec2 == "operation/agentes/ver_agente" || $sec2 == "operation/agentes/datos_agente")) {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60' class='mn'>".lang_string ("agent_detail")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/estado_alertas"){
echo "<div class='arrows'>";
if ($sec2 == "operation/agentes/estado_alertas"){
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/estado_alertas&amp;refr=60' class='mn'>".lang_string ("alert_detail")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/status_monitor") {
echo "<div class='arrows'>";
if ($sec2 == "operation/agentes/status_monitor") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60' class='mn'>".lang_string ("detailed_monitoragent_state")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/exportdata") {
echo "<div class='arrows'>";
if ($sec2 == "operation/agentes/exportdata") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/exportdata' class='mn'>".lang_string ("export_data")."</a></li></ul></div>";
}
// Visual console
if ( isset($_GET["sec2"]) && $_GET["sec2"] == "operation/visual_console/index") {
echo '<div id="op9s">';
if ( $sec2 == "operation/visual_console/index") {
$selected = ' menu-selected';
} else {
echo '<div id="op9">';
$selected = '';
}
echo '<div id="op9" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li>';
echo '<a href="index.php?sec=visualc&sec2=operation/visual_console/index" class="mn">'.lang_string ("visual_console").'</a></li></ul></div>';
if ( isset($_GET["sec"]) && $_GET["sec"] == "visualc") {
if ($sec == "visualc") {
$sql="SELECT * FROM tlayout ORDER BY name";
if($res=mysql_query($sql))
while ($row = mysql_fetch_array($res)){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/visual_console/render_view") {
if (isset($_GET["id"]) && $_GET["id"] == $row["id"])
echo "<div class='arrows'>";
else
echo "<div class='arrow'>";
} else {
echo "<div class='arrow'>";
$id = get_parameter ('id');
if ($res = mysql_query ($sql))
while ($layout = mysql_fetch_array ($res)) {
if ($sec2 == "operation/visual_console/render_view" && $id == $layout["id"]) {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=visualc&sec2=operation/visual_console/render_view&id=".$layout["id"]."' class='mn'>". substr ($layout["name"], 0, 15). "</a></li></ul></div>";
}
echo "<ul class='mn'><li><a href='index.php?sec=visualc&sec2=operation/visual_console/render_view&id=".$row["id"]."' class='mn'>". substr($row["name"],0,15). "</a></li></ul></div>";
}
}
// Server view
if ( isset($_GET["sec"]) && $_GET["sec"] == "estado_server") {
echo '<div id="op2s">';
if ( $sec == "estado_server") {
$selected = ' menu-selected';
} else {
echo '<div id="op2">';
$selected = '';
}
echo '<div id="op2" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li>';
echo '<a href="index.php?sec=estado_server&amp;sec2=operation/servers/view_server&amp;refr=60" class="mn">'.lang_string ("view_servers").'</a></li></ul></div>';
}
// Check access for incident
if (give_acl($_SESSION["id_usuario"], 0, "IR")==1) {
if(isset($_GET["sec2"]) && ($_GET["sec2"] == "operation/incidents/incident" || $_GET["sec2"] == "operation/incidents/incident_detail"|| $_GET["sec2"] == "operation/incidents/incident_note")) {
echo '<div id="op3s">';
if (give_acl ($_SESSION["id_usuario"], 0, "IR") == 1) {
if (($sec2 == "operation/incidents/incident" || $sec2 == "operation/incidents/incident_detail"|| $sec2 == "operation/incidents/incident_note")) {
$selected = ' menu-selected';
} else {
echo '<div id="op3">';
$selected = '';
}
echo '<div id="op3" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li><a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident" class="mn">'.lang_string ("manage_incidents").'</a></li></ul></div>';
if (isset($_GET["sec"]) && $_GET["sec"] == "incidencias"){
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/incidents/incident_search") {
echo "<div class='arrows'>";
if ($sec == "incidencias"){
if($sec2 == "operation/incidents/incident_search") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=incidencias&amp;sec2=operation/incidents/incident_search' class='mn'>".lang_string ("search_incident")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/incidents/incident_statistics") {
echo "<div class='arrows'>";
if ($sec2 == "operation/incidents/incident_statistics") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=incidencias&amp;sec2=operation/incidents/incident_statistics' class='mn'>".lang_string ("statistics")."</a></li></ul></div>";
}
@ -157,21 +160,21 @@ if (give_acl($_SESSION["id_usuario"], 0, "IR")==1) {
// Rest of options, all with AR privilege
if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) {
if (give_acl ($_SESSION["id_usuario"], 0, "AR")) {
// Events
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/events/events") {
echo '<div id="op4s">';
if($sec2 == "operation/events/events") {
$selected = ' menu-selected';
} else {
echo '<div id="op4">';
$selected = '';
}
echo '<div id="op4" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li><a href="index.php?sec=eventos&amp;sec2=operation/events/events" class="mn">'.lang_string ("view_events").'</a></li></ul></div>';
// Event statistics submenu
if (isset($_GET["sec"]) && $_GET["sec"] == "eventos"){
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/events/event_statistics") {
echo "<div class='arrows'>";
if ($sec == "eventos"){
if($sec2 == "operation/events/event_statistics") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=eventos&amp;sec2=operation/events/event_statistics' class='mn'>".lang_string ("statistics")."</a></li></ul></div>";
}
@ -198,81 +201,85 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) {
}
// Users
if(isset($_GET["sec2"]) && ($_GET["sec2"] == "operation/users/user" || $_GET["sec2"] == "operation/users/user_edit" )) {
echo '<div id="op5s">';
if(($sec2 == "operation/users/user" || $sec2 == "operation/users/user_edit" )) {
$selected = ' menu-selected';
} else {
echo '<div id="op5">';
$selected = '';
}
echo '<div id="op5" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li><a href="index.php?sec=usuarios&amp;sec2=operation/users/user" class="mn">'.lang_string ("view_users").'</a></li></ul></div>';
// User edit (submenu)
if (isset($_GET["sec"]) && $_GET["sec"] == "usuarios") {
if ($sec == "usuarios") {
if(isset($_GET["ver"]) && $_GET["ver"] == $_SESSION["id_usuario"]) {
echo "<div class='arrows'>";
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=usuarios&amp;sec2=operation/users/user_edit&amp;ver=".$_SESSION["id_usuario"]."' class='mn'>".lang_string ("index_myuser")."</a></li></ul></div>";
// User statistics require UM
if (give_acl($_SESSION["id_usuario"], 0, "UM")==1) {
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/users/user_statistics") {
echo "<div class='arrows'>";
if($sec2 == "operation/users/user_statistics") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=usuarios&amp;sec2=operation/users/user_statistics' class='mn'>".lang_string ("statistics")."</a></li></ul></div>";
}
}
// SNMP console
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/snmpconsole/snmp_view") {
echo '<div id="op6s">';
if($sec2 == "operation/snmpconsole/snmp_view") {
$selected = ' menu-selected';
} else {
echo '<div id="op6">';
$selected = '';
}
echo '<div id="op6" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li><a href="index.php?sec=snmpconsole&amp;sec2=operation/snmpconsole/snmp_view&amp;refr=30" class="mn">'.lang_string ("SNMP_console").'</a></li></ul></div>';
if ((give_acl($_SESSION["id_usuario"], 0, "AW")==1)){
// SNMP Console alert (submenu)
if (isset($_GET["sec"]) && $_GET["sec"] == "snmpconsole"){
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/snmpconsole/snmp_alert") {
echo "<div class='arrows'>";
if ($sec == "snmpconsole"){
if($sec2 == "operation/snmpconsole/snmp_alert") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=snmpconsole&amp;sec2=operation/snmpconsole/snmp_alert' class='mn'>".lang_string ("snmp_console_alert")."</a></li></ul></div>";
}
}
// Messages
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/messages/message" && !isset($_GET["nuevo_g"])) {
echo '<div id="op7s">';
if($sec2 == "operation/messages/message" && !isset($_GET["nuevo_g"])) {
$selected = ' menu-selected';
} else {
echo '<div id="op7">';
$selected = '';
}
echo '<div id="op7" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li><a href="index.php?sec=messages&amp;sec2=operation/messages/message" class="mn">'. lang_string ("messages").'</a></li></ul></div>';
// New message (submenu)
if (isset($_GET["sec"]) && $_GET["sec"] == "messages"){
if(isset($_GET["sec2"]) && isset($_GET["nuevo_g"])) {
echo "<div class='arrows'>";
if ($sec == "messages"){
if(isset($_GET["nuevo_g"])) {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=messages&amp;sec2=operation/messages/message&amp;nuevo_g' class='mn'>".lang_string ("messages_g")."</a></li></ul></div>";
}
// Reporting
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/reporting/reporting"){
echo '<div id="op8s">';
if ($sec2 == "operation/reporting/reporting") {
$selected = ' menu-selected';
} else {
echo '<div id="op8">';
$selected = '';
}
echo '<div id="op8" class="operation-menu'.$selected.'">';
echo '<ul class="mn">';
if (isset($_GET["sec"]) && $_GET["sec"] == "reporting" &&
isset($_GET["sec2"]) && $_GET["sec2"] != "operation/reporting/reporting"){
if ($sec == "reporting" &&
$sec2 != "operation/reporting/reporting") {
echo '<li>';
} else {
echo '<li class="bb0">';
@ -281,27 +288,55 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) {
lang_string ("reporting").'</a></li></ul></div>';
// Custom reporting
if (isset($_GET["sec"]) && $_GET["sec"] == "reporting"){
if (isset($_GET["sec2"]) && $_GET["sec2"] ==
"operation/reporting/custom_reporting" || $_GET["sec2"] ==
"operation/reporting/reporting_viewer"){
echo "<div class='arrows'>";
if ($sec == "reporting"){
if ($sec2 ==
"operation/reporting/custom_reporting" || $sec2 ==
"operation/reporting/reporting_viewer") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=reporting&sec2=operation/reporting/custom_reporting' class='mn'>".lang_string ("custom_reporting")."</a></li></ul></div>";
}
// Custom graph viewer
if (isset($_GET["sec"]) && $_GET["sec"] == "reporting"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/reporting/graph_viewer"){
echo "<div class='arrows'>";
if ($sec == "reporting") {
if ($sec2 == "operation/reporting/graph_viewer") {
echo "<div class='operation-submenu submenu-selected'>";
} else {
echo "<div class='arrow'>";
echo "<div class='operation-submenu'>";
}
echo "<ul class='mn'><li class='bb0'><a href='index.php?sec=reporting&sec2=operation/reporting/graph_viewer' class='mn'>".lang_string ("custom_graphs")."</a></li></ul></div>";
}
// Extensions menu additions
if (sizeof ($config['extensions'])) {
if ($sec == "extensions") {
$selected = ' menu-selected';
} else {
$selected = '';
}
echo '<div id="op-extensions" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li><a href="index.php?sec=extensions&sec2=operation/extensions" class="mn">';
echo lang_string ('Extensions');
echo '</a></li></ul>';
echo "</div>";
if ($selected != '') {
foreach ($config['extensions'] as $extension) {
if ($extension['operation_menu'] == '')
continue;
$menu = $extension['operation_menu'];
if ($sec2 == $menu['sec2']) {
echo '<div class="operation-submenu submenu-selected">';
} else {
echo '<div class="operation-submenu">';
}
echo '<ul class="mn"><li>';
echo '<a href="index.php?sec=extensions&sec2='.$menu['sec2'].'" class="mn">'.$menu['name'];
echo '</a></li></ul></div>';
}
}
}
}
?>