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> Esteban Sanchez <esteban.sanchez@artica.es>
Jorge Gonzalez <jorge.gonzalez@artica.es> Jorge Gonzalez <jorge.gonzalez@artica.es>
Raul Mateos <raulofpandora@gmail.com> Raul Mateos <raulofpandora@gmail.com>
Esteban Sanchez <estebans@artica.es>
Ramon Novoa <ramon.novoa@artica.es> Ramon Novoa <ramon.novoa@artica.es>
See full list of contributors on: 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> 2008-08-01 Manuel Arostegui <marostegui@artica.es>
* include/help/en/help_plugin_definition.php: Language corrections. * include/help/en/help_plugin_definition.php: Language corrections.
@ -161,6 +192,7 @@
* view_server.php: Fixed problem with lastupdate render. This was using * view_server.php: Fixed problem with lastupdate render. This was using
and incorrect function to render data. and incorrect function to render data.
>>>>>>> .r996
2008-07-21 Evi Vanoost <vanooste@rcbi.rochester.edu> 2008-07-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_reporting.php: Last commit forgot a semicolon. Fixed. * 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,87 +16,89 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
if (comprueba_login() == 0){ if (comprueba_login ()) {
$id_user = $_SESSION["id_usuario"]; return;
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 ((! 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="tit bg3">:: <?php echo lang_string ("godmode_header") ?> ::</div>
<div class="menug" id="god"> <div class="menug" id="god">
<?PHP <?php
if ((give_acl($id_user, 0, "AW")==1)){ if (give_acl ($config['id_user'], 0, "AW")) {
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/agentes/modificar_agente" || $_GET["sec2"] == "godmode/agentes/configurar_agente")){ if ($sec2 == "godmode/agentes/modificar_agente" || $sec2 == "godmode/agentes/configurar_agente") {
echo '<div id="god1s">'; echo '<div id="god1s">';
} }
else else
echo '<div id="god1">'; 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>'; 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 ($sec == "gagente") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/agentes/manage_config"){ if ($sec2 == "godmode/agentes/manage_config") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} } else {
else
echo "<div class='arrowg'>"; 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>"; 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"){ if ($sec2 == "godmode/agentes/manage_config_remote") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} } else {
else
echo "<div class='arrowg'>"; 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>"; 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 // Manage groups
if ((give_acl($id_user, 0, "PM")==1)){ if (give_acl($config['id_user'], 0, "PM")) {
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/groups/group_list" || $_GET["sec2"] == "godmode/groups/configure_group")){ if ($sec2 == "godmode/groups/group_list" || $sec2 == "godmode/groups/configure_group") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} } else {
else
echo "<div class='arrowg'>"; 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>"; 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 // Planned downtimes
if ((give_acl($id_user, 0, "AW")==1)){ if ((give_acl($config['id_user'], 0, "AW")==1)){
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/agentes/planned_downtime" || $_GET["sec2"] == "godmode/agentes/planned_downtime")){ if ($sec2 == "godmode/agentes/planned_downtime" || $sec2 == "godmode/agentes/planned_downtime") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} }
else else
echo "<div class='arrowg'>"; 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>"; 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 ((give_acl($config['id_user'], 0, "PM")==1)){
if (isset($_GET["sec"]) && ($_GET["sec"] == "gmodules")) if ($sec == "gmodules")
echo '<div id="god_module_sel">'; echo '<div id="god_module_sel">';
else else
echo '<div id="god_module">'; 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>'; 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 ($sec == "gmodules") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/modules/manage_nc_groups" || $_GET["sec2"] == "godmode/modules/manage_nc_groups_form") if ($sec2 == "godmode/modules/manage_nc_groups" || $sec2 == "godmode/modules/manage_nc_groups_form")
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
else else
echo "<div class='arrowg'>"; 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>"; 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 ($sec == "gmodules") {
if (isset($_GET["sec2"]) && ( $_GET["sec2"] == "godmode/modules/manage_network_components" || $_GET["sec2"] == "godmode/modules/manage_network_components_form") ) if ($sec2 == "godmode/modules/manage_network_components" || $sec2 == "godmode/modules/manage_network_components_form")
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
else else
echo "<div class='arrowg'>"; 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>"; 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 // Network Profiles
if (isset($_GET["sec"]) && $_GET["sec"] == "gmodules"){ if ($sec == "gmodules") {
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/modules/manage_network_templates" || $_GET["sec2"] == "godmode/modules/manage_network_templates_form" )) if ($sec2 == "godmode/modules/manage_network_templates" || $sec2 == "godmode/modules/manage_network_templates_form")
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
else else
echo "<div class='arrowg'>"; echo "<div class='arrowg'>";
@ -104,33 +106,32 @@ if (comprueba_login() == 0){
} }
} }
if ((give_acl($id_user, 0, "LM")==1)){ if (give_acl ($config['id_user'], 0, "LM")) {
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/alerts/modify_alert" || $_GET["sec2"] == "godmode/alerts/configure_alert")){ if ($sec2 == "godmode/alerts/modify_alert" || $sec2 == "godmode/alerts/configure_alert") {
echo '<div id="god2s">'; echo '<div id="god2s">';
} }
else else
echo '<div id="god2">'; 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>'; 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")){ if (give_acl ($config['id_user'], 0, "UM")) {
if ($sec2 == "godmode/users/user_list" || $sec2 == "godmode/users/configure_user") {
echo '<div id="god3s">'; echo '<div id="god3s">';
} }
else echo '<div id="god3">'; 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>'; 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)){
// Reporting
if (give_acl ($config['id_user'], 0, "PM")) {
echo '<div id="god51">'; 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>'; 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 // Custom report builder
if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){ if ($sec == "greporting") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/reporting_builder"){ if ($sec2 == "godmode/reporting/reporting_builder") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else { } else {
echo "<div class='arrowg'>"; echo "<div class='arrowg'>";
@ -139,8 +140,8 @@ if (comprueba_login() == 0){
} }
// Custom graph builder // Custom graph builder
if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){ if ($sec == "greporting") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/graph_builder"){ if ($sec2 == "godmode/reporting/graph_builder"){
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else { } else {
echo "<div class='arrowg'>"; echo "<div class='arrowg'>";
@ -149,8 +150,8 @@ if (comprueba_login() == 0){
} }
// Custom map builder // Custom map builder
if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){ if ($sec == "greporting") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/map_builder"){ if ($sec2 == "godmode/reporting/map_builder") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else { } else {
echo "<div class='arrowg'>"; echo "<div class='arrowg'>";
@ -160,45 +161,42 @@ if (comprueba_login() == 0){
} }
// Manage profiles // Manage profiles
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ( (give_acl($id_user, 0, "PM")==1)){ if (give_acl ($config['id_user'], 0, "PM")) {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/profiles/profile_list"){ if ($sec2 == "godmode/profiles/profile_list") {
echo '<div id="god4s">'; echo '<div id="god4s">';
} }
else echo '<div id="god4">'; 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>'; 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 // SERVERS
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ($sec2 == "godmode/servers/modificar_server"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/servers/modificar_server"){
echo '<div id="god5s">'; echo '<div id="god5s">';
} else } else
echo '<div id="god5">'; 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>'; 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 ($sec == "gservers") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/servers/manage_recontask"|| $_GET["sec2"] == "godmode/servers/manage_recontask_form"){ if ($sec2 == "godmode/servers/manage_recontask"|| $sec2 == "godmode/servers/manage_recontask_form") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else } else
echo "<div class='arrowg'>"; 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>"; 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 (isset($_GET["sec"]) && $_GET["sec"] == "gservers"){ if ($sec2 == "godmode/servers/plugin") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/servers/plugin"){
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else {
echo "<div class='arrowg'>";
} }
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>"; 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 // AUDIT
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/admin_access_logs"){ if ($sec2 == "godmode/admin_access_logs") {
echo '<div id="god6s">'; echo '<div id="god6s">';
} }
else echo '<div id="god6">'; else echo '<div id="god6">';
@ -206,85 +204,114 @@ if (comprueba_login() == 0){
// Main SETUP // Main SETUP
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/setup/setup"){ if ($sec2 == "godmode/setup/setup") {
echo '<div id="god7s">'; echo '<div id="god7s">';
} }
else echo '<div id="god7">'; 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>'; 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 ($sec == "gsetup") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/setup/links"){ if ($sec2 == "godmode/setup/links") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} }
else echo "<div class='arrowg'>"; 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>"; 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 ($sec == "gsetup"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/setup/news"){ if ($sec2 == "godmode/setup/news") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} }
else echo "<div class='arrowg'>"; 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>"; 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 (give_acl ($config['id_user'], 0, "DM")) {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_main"){ if ($sec2 == "godmode/db/db_main") {
echo '<div id="god8s">'; echo '<div id="god8s">';
} else } else
echo '<div id="god8">'; echo '<div id="god8">';
echo '<ul class="mn">'; echo '<ul class="mn">';
if (isset($_GET["sec"]) && $_GET["sec"] == "gdbman" && if ($sec == "gdbman" && $sec2 != "godmode/db/db_main") {
isset($_GET["sec2"]) && $_GET["sec2"] != "godmode/db/db_main"){
echo '<li>'; echo '<li>';
} else { } else {
echo '<li class="bb0">'; 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>'; 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 ($sec == "gdbman") {
if ($sec2 == "godmode/db/db_info" || $sec2 == "godmode/db/db_info_data") {
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/db/db_info" || $_GET["sec2"] == "godmode/db/db_info_data")){
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else } else {
echo "<div class='arrowg'>"; 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>"; 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"){ if ($sec2 == "godmode/db/db_purge") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else } else {
echo "<div class='arrowg'>"; 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>"; 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"){ if ($sec2 == "godmode/db/db_refine") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else } else {
echo "<div class='arrowg'>"; 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>"; 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"){ if ($sec2 == "godmode/db/db_audit") {
echo "<div class='arrowgs'>"; echo "<div class='arrowgs'>";
} else } else {
echo "<div class='arrowg'>"; 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>"; 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"){ if ($sec2 == "godmode/db/db_event") {
echo "<div id='arrowgls'>"; echo "<div id='arrowgls'>";
} else } else {
echo "<div id='arrowgl'>"; 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>"; 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"){ if ($sec2 == "godmode/db/db_sanity") {
echo "<div id='arrowgls'>"; echo "<div id='arrowgls'>";
} else } else {
echo "<div id='arrowgl'>"; 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>"; 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> if (sizeof ($config['extensions'])) {
<?php if ($sec == "gextensions") {
} // end verify access to this menu $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,8 +21,7 @@
$id_user=$_SESSION["id_usuario"]; $id_user=$_SESSION["id_usuario"];
global $REMOTE_ADDR; global $REMOTE_ADDR;
if (give_acl ($id_user, 0, "AW") != 1 && dame_admin ($id_user) != 1) {
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"); audit_db ($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
include ("general/noaccess.php"); include ("general/noaccess.php");
exit; exit;
@ -133,7 +132,7 @@ if ($add_content) {
$id_agent_module ? $id_agent_module : "NULL", $id_agent_module ? $id_agent_module : "NULL",
$order, $type, $period * 3600); $order, $type, $period * 3600);
if ($result = mysql_query($sql)) { 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 = 0;
$id_agent_module = 0; $id_agent_module = 0;
$report_id_group = 0; $report_id_group = 0;
@ -144,7 +143,7 @@ if ($add_content) {
$sla_min = 0; $sla_min = 0;
$sla_limit = 0; $sla_limit = 0;
} else { } 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 */ /* Do not unset so the values are kept in the form */
} }
} }

View File

@ -39,7 +39,6 @@ $config["sla_period"] = 604800;
// Read remaining config tokens from DB // 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() //Non-persistent connection. If you want persistent conn change it to mysql_pconnect()
exit ('<html><head><title>Pandora FMS Error</title> exit ('<html><head><title>Pandora FMS Error</title>
<link rel="stylesheet" href="./include/styles/pandora.css" type="text/css"> <link rel="stylesheet" href="./include/styles/pandora.css" type="text/css">
@ -81,72 +80,28 @@ if (sizeof ($configs) == 0) {
</div> </div>
</div></body></html>'); </div></body></html>');
} }
foreach ($configs as $c) { foreach ($configs as $c) {
switch ($c["token"]) { switch ($c["token"]) {
case "language_code": case "language_code":
$config["language"] = $c["value"]; $config["language"] = $c["value"];
break; break;
case "block_size": default:
$config["block_size"] = $c["value"]; $config[$c["token"]] = $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;
} }
} }
if ($config["language"] == 'ast_es') { if ($config["language"] == 'ast_es') {
$help_code = 'ast'; $help_code = 'ast';
} else { } else {
$help_code = substr ($config["language"], 0, 2); $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 * @param mesg Message to be displayed
*/ */
function pandora_debug ($var, $msg) { function pandora_debug ($var, $msg) {
echo "[Pandora DEBUG (".$var."]: (".$msg.")<br />"; echo "[Pandora DEBUG (".$var."): (".$msg.")<br />";
} }
/** /**
@ -1173,4 +1173,5 @@ function unsafe_string ($string){
$string = stripslashes ($string); $string = stripslashes ($string);
return $string; return $string;
} }
?> ?>

View File

@ -1219,6 +1219,7 @@ function give_agent_id_from_module_id ($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. * Get the first value of the first row of a table in the database.
* *
@ -1227,16 +1228,19 @@ $sql_cache=array('saved' => 0);
* @param field_search Field to filter elements * @param field_search Field to filter elements
* @param condition Condition the field must have * @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)) { 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)) { } 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 { } 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); $result = get_db_all_rows_sql ($sql);
@ -1713,6 +1717,17 @@ function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0)
return (float) $sum; 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. * Get a translated string.
* *
@ -1725,8 +1740,10 @@ function lang_string ($string) {
global $lang_label; global $lang_label;
if (!is_array ($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)
} //Only includes the file once (the first function call) and since $lang_label is global, it will propagate 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])) if (isset ($lang_label[$string]))
return $lang_label[$string]; return $lang_label[$string];
@ -1781,7 +1798,6 @@ function show_alert_row_mini ($id_combined_alert) {
$tdcolor = "datos2"; $tdcolor = "datos2";
$color = 1; $color = 1;
} }
echo "<tr>"; echo "<tr>";
if ($row2["disable"] == 1) { if ($row2["disable"] == 1) {
$tdcolor = "datos3"; $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; display: block;
color: #000; color: #000;
text-decoration: none; text-decoration: none;
} }
#op li {
#menu-operation li {
left: 0px; left: 0px;
width: 100%; width: 100%;
border-bottom: 1px solid #d4d4d4; border-bottom: 1px solid #d4d4d4;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
div.menuop {
.menu-operation {
background-color: #e6e9cd; 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; 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, .operation-menu ul {
div#op7s>ul, div#op8s>ul, div#op9s>ul {
width: 127px; width: 127px;
} }
#op1 li , #op1 li:hover, #op1s li { #op1 li {
background: url(../../images/bricks.png) no-repeat 4px 3px; 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; 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; 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; background: url(../../images/lightning_go.png) no-repeat 4px 3px;
} }
/* users */ /* users */
#op5 li, #op5 li:hover, #op5s li { #op5 li {
background: url(../../images/group.png) no-repeat 4px 4px; 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; background: url(../../images/computer_error.png) no-repeat 4px 4px;
} }
/* trap console */ /* trap console */
#op7 li, #op7 li:hover, #op7s li { #op7 li {
background: url(../../images/email.png) no-repeat 4px 4px; 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; 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; 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%; 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; background: url(../../images/arrow.png) no-repeat 2px 4px;
margin-left: 26px; 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 , .menu-selected, #menu-operation li:hover, .submenu-selected li, .operation-submenu li:hover {
#op4 li:hover, #op4s li , #op5 li:hover, #op5s li , #op6 li:hover, #op6s li , background-color: #d4ddc6 !important;
#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;
} }
#op li.bb0, #arrowls li.bb0, #op8 li.bb0 {
#menu-operation li.bb0, #arrowls li.bb0, #op8 li.bb0 {
border-bottom: 0px; 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.php");
require_once ("include/functions_db.php"); require_once ("include/functions_db.php");
//We should require this or you might end up with some empty strings //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"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@ -193,18 +194,18 @@ if (isset ($_GET["bye"])) {
session_unregister ("id_usuario"); session_unregister ("id_usuario");
exit; exit;
} }
$pagina = ""; $page = "";
if (isset ($_GET["sec2"])){ if (isset ($_GET["sec2"])){
$sec2 = get_parameter_get ('sec2'); $sec2 = get_parameter_get ('sec2');
$sec2 = parameter_extra_clean ($sec2); $sec2 = parameter_extra_clean ($sec2);
$pagina = $sec2; $page = $sec2;
} else } else
$sec2 = ""; $sec2 = "";
if (isset ($_GET["sec"])){ if (isset ($_GET["sec"])){
$sec = get_parameter_get ('sec'); $sec = get_parameter_get ('sec');
$sec = parameter_extra_clean ($sec); $sec = parameter_extra_clean ($sec);
$pagina = $sec2; $page = $sec2;
} else { } else {
$sec = ""; $sec = "";
} }
@ -233,9 +234,18 @@ if ($config["pure"] == 0){
} }
// Page loader / selector // Page loader / selector
if ($pagina != ""){ if ($page != "") {
if (file_exists ($pagina.".php")) { $page .= '.php';
require ($pagina.".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 { } else {
echo "<br><b class='error'>".lang_string("Sorry! I can't find the page!")."</b>"; echo "<br><b class='error'>".lang_string("Sorry! I can't find the page!")."</b>";
} }

View File

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

View File

@ -88,7 +88,15 @@ if (defined ('AJAX')) {
} }
// Alerts (if present) // 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); $alert_modules = get_db_sql ($sql);
if ($alert_modules > 0){ 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); $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

@ -24,106 +24,108 @@
if (! isset ($_SESSION["id_usuario"])) { if (! isset ($_SESSION["id_usuario"])) {
return; 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 <?php
$sec = get_parameter ('sec');
$sec2 = get_parameter ('sec2');
// Agent read, Server read // Agent read, Server read
if (give_acl ($_SESSION["id_usuario"], 0, "AR")) { if (give_acl ($_SESSION["id_usuario"], 0, "AR")) {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/tactical") { if ($sec2 == "operation/agentes/tactical") {
echo '<div id="op1s">'; $selected = ' menu-selected';
} else { } 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>'; 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 ($sec == "estado") {
if ($sec2 == "operation/agentes/tactical") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/tactical"){ echo "<div class='operation-submenu submenu-selected'>";
echo "<div class='arrows'>";
} else { } 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>"; 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"){ if ($sec2 == "operation/agentes/estado_grupo") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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"){ if ($sec2 == "operation/agentes/networkmap") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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")) { if (($sec2 == "operation/agentes/estado_agente" || $sec2 == "operation/agentes/ver_agente" || $sec2 == "operation/agentes/datos_agente")) {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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"){ if ($sec2 == "operation/agentes/estado_alertas"){
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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") { if ($sec2 == "operation/agentes/status_monitor") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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") { if ($sec2 == "operation/agentes/exportdata") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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 // Visual console
if ( isset($_GET["sec2"]) && $_GET["sec2"] == "operation/visual_console/index") { if ( $sec2 == "operation/visual_console/index") {
echo '<div id="op9s">'; $selected = ' menu-selected';
} else { } else {
echo '<div id="op9">'; $selected = '';
} }
echo '<div id="op9" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li>'; 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>'; 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"; $sql="SELECT * FROM tlayout ORDER BY name";
$id = get_parameter ('id');
if ($res = mysql_query ($sql)) if ($res = mysql_query ($sql))
while ($row = mysql_fetch_array($res)){ while ($layout = mysql_fetch_array ($res)) {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/visual_console/render_view") { if ($sec2 == "operation/visual_console/render_view" && $id == $layout["id"]) {
if (isset($_GET["id"]) && $_GET["id"] == $row["id"]) echo "<div class='operation-submenu submenu-selected'>";
echo "<div class='arrows'>";
else
echo "<div class='arrow'>";
} else { } else {
echo "<div class='arrow'>"; echo "<div class='operation-submenu'>";
} }
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>"; 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>";
} }
} }
// Server view // Server view
if ( isset($_GET["sec"]) && $_GET["sec"] == "estado_server") { if ( $sec == "estado_server") {
echo '<div id="op2s">'; $selected = ' menu-selected';
} else { } else {
echo '<div id="op2">'; $selected = '';
} }
echo '<div id="op2" class="operation-menu'.$selected.'">';
echo '<ul class="mn"><li>'; 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>'; 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>';
} }
@ -131,25 +133,26 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")) {
// Check access for incident // Check access for incident
if (give_acl ($_SESSION["id_usuario"], 0, "IR") == 1) { 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")) { if (($sec2 == "operation/incidents/incident" || $sec2 == "operation/incidents/incident_detail"|| $sec2 == "operation/incidents/incident_note")) {
echo '<div id="op3s">'; $selected = ' menu-selected';
} else { } 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>'; 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 ($sec == "incidencias"){
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/incidents/incident_search") { if($sec2 == "operation/incidents/incident_search") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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") { if ($sec2 == "operation/incidents/incident_statistics") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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 // 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 // Events
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/events/events") { if($sec2 == "operation/events/events") {
echo '<div id="op4s">'; $selected = ' menu-selected';
} else { } 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>'; 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 // Event statistics submenu
if (isset($_GET["sec"]) && $_GET["sec"] == "eventos"){ if ($sec == "eventos"){
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/events/event_statistics") { if($sec2 == "operation/events/event_statistics") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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 // Users
if(isset($_GET["sec2"]) && ($_GET["sec2"] == "operation/users/user" || $_GET["sec2"] == "operation/users/user_edit" )) { if(($sec2 == "operation/users/user" || $sec2 == "operation/users/user_edit" )) {
echo '<div id="op5s">'; $selected = ' menu-selected';
} else { } 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>'; 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) // User edit (submenu)
if (isset($_GET["sec"]) && $_GET["sec"] == "usuarios") { if ($sec == "usuarios") {
if(isset($_GET["ver"]) && $_GET["ver"] == $_SESSION["id_usuario"]) { if(isset($_GET["ver"]) && $_GET["ver"] == $_SESSION["id_usuario"]) {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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 // User statistics require UM
if (give_acl($_SESSION["id_usuario"], 0, "UM")==1) { if (give_acl($_SESSION["id_usuario"], 0, "UM")==1) {
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/users/user_statistics") { if($sec2 == "operation/users/user_statistics") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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 // SNMP console
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/snmpconsole/snmp_view") { if($sec2 == "operation/snmpconsole/snmp_view") {
echo '<div id="op6s">'; $selected = ' menu-selected';
} else { } 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>'; 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)){ if ((give_acl($_SESSION["id_usuario"], 0, "AW")==1)){
// SNMP Console alert (submenu) // SNMP Console alert (submenu)
if (isset($_GET["sec"]) && $_GET["sec"] == "snmpconsole"){ if ($sec == "snmpconsole"){
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/snmpconsole/snmp_alert") { if($sec2 == "operation/snmpconsole/snmp_alert") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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 // Messages
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/messages/message" && !isset($_GET["nuevo_g"])) { if($sec2 == "operation/messages/message" && !isset($_GET["nuevo_g"])) {
echo '<div id="op7s">'; $selected = ' menu-selected';
} else { } 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>'; 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) // New message (submenu)
if (isset($_GET["sec"]) && $_GET["sec"] == "messages"){ if ($sec == "messages"){
if(isset($_GET["sec2"]) && isset($_GET["nuevo_g"])) { if(isset($_GET["nuevo_g"])) {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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 // Reporting
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/reporting/reporting"){ if ($sec2 == "operation/reporting/reporting") {
echo '<div id="op8s">'; $selected = ' menu-selected';
} else { } else {
echo '<div id="op8">'; $selected = '';
} }
echo '<div id="op8" class="operation-menu'.$selected.'">';
echo '<ul class="mn">'; echo '<ul class="mn">';
if (isset($_GET["sec"]) && $_GET["sec"] == "reporting" && if ($sec == "reporting" &&
isset($_GET["sec2"]) && $_GET["sec2"] != "operation/reporting/reporting"){ $sec2 != "operation/reporting/reporting") {
echo '<li>'; echo '<li>';
} else { } else {
echo '<li class="bb0">'; echo '<li class="bb0">';
@ -281,27 +288,55 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) {
lang_string ("reporting").'</a></li></ul></div>'; lang_string ("reporting").'</a></li></ul></div>';
// Custom reporting // Custom reporting
if (isset($_GET["sec"]) && $_GET["sec"] == "reporting"){ if ($sec == "reporting"){
if (isset($_GET["sec2"]) && $_GET["sec2"] == if ($sec2 ==
"operation/reporting/custom_reporting" || $_GET["sec2"] == "operation/reporting/custom_reporting" || $sec2 ==
"operation/reporting/reporting_viewer") { "operation/reporting/reporting_viewer") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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 // Custom graph viewer
if (isset($_GET["sec"]) && $_GET["sec"] == "reporting"){ if ($sec == "reporting") {
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/reporting/graph_viewer"){ if ($sec2 == "operation/reporting/graph_viewer") {
echo "<div class='arrows'>"; echo "<div class='operation-submenu submenu-selected'>";
} else { } 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>"; 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>';
}
}
}
} }
?> ?>