diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 0d9d3d96e6..fa23e439e6 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.703 +Version: 7.0NG.703-170522 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index df9e85f195..66b473e2ab 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.703" +pandora_version="7.0NG.703-170522" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index 443d52b22b..68c33feadb 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -46,6 +46,12 @@ agent_name_cmd __rand__ #Parent agent_name #parent_agent_name caprica +# By default, agent takes machine alias +#agent_alias + +# To define agent alias by specific command, define 'agent_alias_cmd'. +#agent_alias_cmd + # Agent description #description This is a demo agent for Linux diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 8e40d40be0..d8cb7e9e10 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.703'; -use constant AGENT_BUILD => '170517'; +use constant AGENT_BUILD => '170522'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -135,9 +135,10 @@ my %DefaultConf = ( 'interval' => 300, 'debug' => 0, 'agent_name' => '', - 'agent_alias' => hostname(), + 'agent_alias' => '', 'ehorus_conf' => undef, 'agent_name_cmd' => '', + 'agent_alias_cmd' => '', 'description' => '', 'group' => '', 'group_id' => undef, @@ -802,6 +803,23 @@ sub read_config (;$) { # Module, plugin and collection definitions parse_conf_modules(\@file); + + # If agent_alias_cmd is defined, agent_alias is set by command result. + if ($Conf{'agent_alias'} eq '') { + if ($Conf{'agent_alias_cmd'} ne '') { + my $result = `$Conf{'agent_alias_cmd'}`; + # Use only the first line. + my ($temp_agent_alias, $remain2) = split(/\n/, $result); + chomp ($temp_agent_alias); + + # Remove white spaces of the first and last. + $temp_agent_alias =~ s/^ *(.*?) *$/$1/; + + $Conf{'agent_alias'} = $temp_agent_alias if ($temp_agent_alias ne ''); + } else { + $Conf{'agent_alias'} = hostname(); + } + } # If agent_name_cmd is defined, agent_name is set by command result. if ($Conf{'agent_name'} eq '') { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 905b1437b1..4e3ea64cb5 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.703 -%define release 1 +%define release 170522 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 76d65892d8..a4d19700e2 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.703 -%define release 1 +%define release 170522 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 5fc9793446..954e422aca 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.703" -PI_BUILD="170517" +PI_BUILD="170522" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 425474855d..cb5dc44b9b 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170517} +{170522} ViewReadme {Yes} @@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives {No} Windows,Executable -{<%AppName%>-Setup<%Ext%>} +{<%AppName%>-<%Version%>-Setup<%Ext%>} Windows,FileDescription {<%AppName%> <%Version%> Setup} diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index a1936912f2..296f42f2ea 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -368,7 +368,7 @@ Pandora_Module::getDataOutput (Pandora_Data *data) { } if (this->has_limits) { - if (value >= this->max || value <= this->min) { + if (value > this->max || value < this->min) { pandoraLog ("The returned value was not in the interval on module %s", this->module_name.c_str ()); throw Value_Error (); @@ -1789,5 +1789,9 @@ Pandora_Module::getIntensiveMatch () { return this->intensive_match; } +bool +Pandora_Module::getAsync () { + return this->async; +} diff --git a/pandora_agents/win32/modules/pandora_module.h b/pandora_agents/win32/modules/pandora_module.h index 4303b88eec..b2606d2442 100644 --- a/pandora_agents/win32/modules/pandora_module.h +++ b/pandora_agents/win32/modules/pandora_module.h @@ -91,7 +91,7 @@ namespace Pandora_Modules { MODULE_TCPCHECK, /**< The module checks whether a tcp port is open */ MODULE_REGEXP, /**< The module searches a file for matches of a regular expression */ MODULE_PLUGIN, /**< Plugin */ - MODULE_PING, /**< Ping module */ + MODULE_PING, /**< Ping module */ MODULE_SNMPGET /**< SNMP get module */ } Module_Kind; @@ -238,6 +238,7 @@ namespace Pandora_Modules { void setTimeout (int timeout); int getTimeout (); string getSave (); + bool getAsync (); virtual string getXml (); diff --git a/pandora_agents/win32/modules/pandora_module_proc.cc b/pandora_agents/win32/modules/pandora_module_proc.cc index 91deab0efb..e8eed1f97d 100644 --- a/pandora_agents/win32/modules/pandora_module_proc.cc +++ b/pandora_agents/win32/modules/pandora_module_proc.cc @@ -52,6 +52,17 @@ Pandora_Module_Proc::Pandora_Module_Proc (string name, string process_name) this->retries = 3; this->start_delay = 5000; this->retry_delay = 2000; + this->thread = 0; +} +/** + * Destroys a Pandora_Module_Service object. + */ +Pandora_Module_Proc::~Pandora_Module_Proc () { + + // Close the thread if module is async + if (this->thread) { + TerminateThread(this->thread, 0); + } } string diff --git a/pandora_agents/win32/modules/pandora_module_proc.h b/pandora_agents/win32/modules/pandora_module_proc.h index 60615f189a..edab85cb88 100644 --- a/pandora_agents/win32/modules/pandora_module_proc.h +++ b/pandora_agents/win32/modules/pandora_module_proc.h @@ -38,6 +38,7 @@ namespace Pandora_Modules { int retry_delay; public: Pandora_Module_Proc (string name, string process_name); + ~Pandora_Module_Proc (); string getProcessName () const; string getStartCommand () const; diff --git a/pandora_agents/win32/modules/pandora_module_service.cc b/pandora_agents/win32/modules/pandora_module_service.cc index bbbe799f9e..bf82120aa8 100644 --- a/pandora_agents/win32/modules/pandora_module_service.cc +++ b/pandora_agents/win32/modules/pandora_module_service.cc @@ -49,6 +49,16 @@ Pandora_Module_Service::Pandora_Module_Service (string name, string service_name this->thread = 0; this->watchdog = false; } +/** + * Destroys a Pandora_Module_Service object. + */ +Pandora_Module_Service::~Pandora_Module_Service () { + + // Close the thread if module is async + if (this->thread) { + TerminateThread(this->thread, 0); + } +} string Pandora_Module_Service::getServiceName () const { diff --git a/pandora_agents/win32/modules/pandora_module_service.h b/pandora_agents/win32/modules/pandora_module_service.h index 6e82697985..bdec6152ed 100644 --- a/pandora_agents/win32/modules/pandora_module_service.h +++ b/pandora_agents/win32/modules/pandora_module_service.h @@ -36,6 +36,7 @@ namespace Pandora_Modules { bool watchdog; public: Pandora_Module_Service (string name, string service_name); + ~Pandora_Module_Service (); void run (); string getServiceName () const; diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 190922cdf7..5f72d28894 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.703(Build 170517)") +#define PANDORA_VERSION ("7.0NG.703(Build 170522)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/pandora_agent_conf.cc b/pandora_agents/win32/pandora_agent_conf.cc index 83675cdde6..94617243d5 100644 --- a/pandora_agents/win32/pandora_agent_conf.cc +++ b/pandora_agents/win32/pandora_agent_conf.cc @@ -228,6 +228,15 @@ Pandora::Pandora_Agent_Conf::setFile (string *all_conf){ key_values->push_back (kv); continue; } + + /*Check if is a agent_alias_cmd"*/ + pos = buffer.find("agent_alias_cmd"); + if (pos != string::npos){ + Key_Value kv; + kv.parseLineByPosition(buffer, 15); + key_values->push_back (kv); + continue; + } /*Check if is a collection*/ pos = buffer.find("file_collection"); diff --git a/pandora_agents/win32/pandora_windows_service.cc b/pandora_agents/win32/pandora_windows_service.cc index 45c2189385..cad177411a 100644 --- a/pandora_agents/win32/pandora_windows_service.cc +++ b/pandora_agents/win32/pandora_windows_service.cc @@ -76,6 +76,7 @@ Pandora_Windows_Service::setValues (const char * svc_name, this->service_description = (char *) svc_description; execution_number = 0; this->modules = NULL; + this->broker_modules = NULL; this->conf = NULL; this->interval = 60000; this->timestamp = 0; @@ -105,6 +106,10 @@ Pandora_Windows_Service::~Pandora_Windows_Service () { if (this->modules != NULL) { delete this->modules; } + + if (this->broker_modules != NULL) { + delete this->broker_modules; + } pandoraLog ("Pandora agent stopped"); } @@ -136,10 +141,10 @@ Pandora_Windows_Service::pandora_init_broker (string file_conf) { this->conf = Pandora::Pandora_Agent_Conf::getInstance (); this->conf->setFile (file_conf); - if (this->modules != NULL) { - delete this->modules; + if (this->broker_modules != NULL) { + delete this->broker_modules; } - this->modules = new Pandora_Module_List (file_conf); + this->broker_modules = new Pandora_Module_List (file_conf); pandoraDebug ("Pandora broker agent started"); } @@ -208,9 +213,14 @@ Pandora_Windows_Service::check_broker_agents(string *all_conf){ void Pandora_Windows_Service::pandora_init () { + pandora_init(true); +} + +void +Pandora_Windows_Service::pandora_init (bool reload_modules) { string conf_file, interval, debug, disable_logfile, intensive_interval, util_dir, path, env; string udp_server_enabled, udp_server_port, udp_server_addr, udp_server_auth_addr; - string agent_name, agent_name_cmd, agent_alias, pandora_agent; + string agent_name, agent_name_cmd, agent_alias, agent_alias_cmd, pandora_agent; string proxy_mode, server_ip; string *all_conf; int pos, num; @@ -224,7 +234,7 @@ Pandora_Windows_Service::pandora_init () { this->conf = Pandora::Pandora_Agent_Conf::getInstance (); this->conf->setFile (all_conf); - if (this->modules != NULL) { + if (this->modules != NULL && reload_modules) { delete this->modules; } @@ -255,9 +265,40 @@ Pandora_Windows_Service::pandora_init () { this->setSleepTime (this->intensive_interval); // Read modules - this->modules = new Pandora_Module_List (conf_file); + if (reload_modules) { + this->modules = new Pandora_Module_List (conf_file); + } delete []all_conf; - + + // Get the agent alias. + agent_alias = conf->getValue ("agent_alias"); + if (agent_alias == "") { + agent_alias_cmd = conf->getValue ("agent_alias_cmd"); + if (agent_alias_cmd != "") { + agent_alias_cmd = "cmd.exe /c \"" + agent_alias_cmd + "\""; + static string temp_agent_alias = getAgentNameFromCmdExec(agent_alias_cmd); + + // Delete new line and carriage return. + pos = temp_agent_alias.find("\n"); + if(pos != string::npos) { + temp_agent_alias.erase(pos, temp_agent_alias.size () - pos); + } + pos = temp_agent_alias.find("\r"); + if(pos != string::npos) { + temp_agent_alias.erase(pos, temp_agent_alias.size () - pos); + } + + // Remove leading and trailing white spaces. + temp_agent_alias = trim(temp_agent_alias); + if (temp_agent_alias != "") { + agent_alias = temp_agent_alias; + } + } else { + agent_alias = Pandora_Windows_Info::getSystemName (); + } + } + this->conf->setValue("agent_alias", agent_alias); + // Get the agent name. agent_name = conf->getValue ("agent_name"); if (agent_name == "") { @@ -299,13 +340,6 @@ Pandora_Windows_Service::pandora_init () { this->conf->setValue("agent_name", agent_name); } - // Get the agent alias. - agent_alias = conf->getValue ("agent_alias"); - if (agent_alias == "") { - agent_alias = Pandora_Windows_Info::getSystemName (); - this->conf->setValue("agent_alias", agent_alias); - } - pandora_agent = "PANDORA_AGENT=" + agent_name; putenv(pandora_agent.c_str()); @@ -1834,19 +1868,19 @@ Pandora_Windows_Service::pandora_run_broker (string config) { server_addr = conf->getValue ("server_ip"); - if (this->modules != NULL) { - this->modules->goFirst (); + if (this->broker_modules != NULL) { + this->broker_modules->goFirst (); - while (! this->modules->isLast ()) { + while (! this->broker_modules->isLast ()) { Pandora_Module *module; - module = this->modules->getCurrentValue (); + module = this->broker_modules->getCurrentValue (); /* Check preconditions */ if (module->evaluatePreconditions () == 0) { pandoraDebug ("Preconditions not matched for module %s", module->getName ().c_str ()); module->setNoOutput (); - this->modules->goNext (); + this->broker_modules->goNext (); continue; } @@ -1854,15 +1888,23 @@ Pandora_Windows_Service::pandora_run_broker (string config) { if (module->checkCron (module->getInterval (), atoi (conf->getValue ("interval").c_str())) == 0) { pandoraDebug ("Cron not matched for module %s", module->getName ().c_str ()); module->setNoOutput (); - this->modules->goNext (); + this->broker_modules->goNext (); continue; } + /* Check async */ + if (module->getAsync()) { + pandoraDebug ("Forbidden async module %s in broker agents", module->getName ().c_str ()); + module->setNoOutput (); + this->broker_modules->goNext (); + continue; + } + pandoraDebug ("Run %s", module->getName ().c_str ()); module->run (); if (! module->hasOutput ()) { module->setNoOutput (); - this->modules->goNext (); + this->broker_modules->goNext (); continue; } @@ -1875,7 +1917,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) { intensive_match = module->evaluateIntensiveConditions (); if (intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) { module->setNoOutput (); - this->modules->goNext (); + this->broker_modules->goNext (); continue; } module->setIntensiveMatch (intensive_match); @@ -1890,7 +1932,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) { /* At least one module has data */ data_flag = 1; - this->modules->goNext (); + this->broker_modules->goNext (); } } @@ -1898,7 +1940,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) { // Send the XML if (!server_addr.empty ()) { - this->sendXml (this->modules); + this->sendXml (this->broker_modules); } } @@ -2037,7 +2079,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) { /* Reload the original configuration */ if (num != 0) { - pandora_init (); + pandora_init (false); } /* Reset time reference if necessary */ diff --git a/pandora_agents/win32/pandora_windows_service.h b/pandora_agents/win32/pandora_windows_service.h index be9a7a4eb3..17f0130884 100644 --- a/pandora_agents/win32/pandora_windows_service.h +++ b/pandora_agents/win32/pandora_windows_service.h @@ -42,6 +42,7 @@ namespace Pandora { private: Pandora_Agent_Conf *conf; Pandora_Module_List *modules; + Pandora_Module_List *broker_modules; long execution_number; string agent_name; string alias; @@ -98,6 +99,7 @@ namespace Pandora { void pandora_run (int forced_run); void pandora_run (); void pandora_init (); + void pandora_init (bool reload_modules); long interval; long interval_sec; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 75bf082ac9..63539dd2fa 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.703(Build 170517))" + VALUE "ProductVersion", "(7.0NG.703(Build 170522))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index e0f72b3b6e..3ae6ce38b0 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,10 +1,10 @@ package: pandorafms-console -Version: 7.0NG.703 +Version: 7.0NG.703-170522 Architecture: all Priority: optional Section: admin Installed-Size: 42112 Maintainer: Artica ST Homepage: http://pandorafms.org/ -Depends: php5, php5-snmp, php5-gd, php5-mysql, php-db, php5-xmlrpc, php-gettext, php5-curl, graphviz, dbconfig-common, php5-ldap, mysql-client | virtual-mysql-client +Depends: php5.6 | php5, php5.6-snmp | php5-snmp, php5.6-gd | php5-gd, php5.6-mysql | php5-mysql, php-db, php5.6-xmlrpc | php5-xmlrpc, php-gettext, php5.6-curl | php5-curl, graphviz, dbconfig-common, php5.6-ldap | php5-ldap, mysql-client | virtual-mysql-client Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process. diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 40d4ff8e82..831bb5dd20 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.703" +pandora_version="7.0NG.703-170522" package_pear=0 package_pandora=1 diff --git a/pandora_console/general/alert_enterprise.php b/pandora_console/general/alert_enterprise.php index 441eeb9595..d5be19eebd 100644 --- a/pandora_console/general/alert_enterprise.php +++ b/pandora_console/general/alert_enterprise.php @@ -185,7 +185,7 @@ echo " "; if($open){ echo "
-About Enterprise +About Enterprise
"; } diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php index 1570ec825c..64564d300a 100644 --- a/pandora_console/general/footer.php +++ b/pandora_console/general/footer.php @@ -32,7 +32,15 @@ if (!$config["MR"]) { echo ''; -echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_version, $config["MR"])); +if($current_package == 0){ +$build_package_version = $build_version; +} +else{ +$build_package_version = $current_package; +} + + +echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_package_version, $config["MR"])); echo '
'; echo ''. __('Page generated at') . ' '. date('F j, Y h:i a'); //Always use timestamp here diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 43424f69e5..e49fdff340 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -83,12 +83,19 @@ echo '
'; echo 'pandora_console'; } echo '
'; - echo '
'; + + echo '
'; + + echo ''; echo '
'; @@ -424,7 +431,6 @@ html_print_div(array('id' => 'forced_title_layer', 'class' => 'forced_title_laye draggable: false, modal: true, width: 600, - height: 250, overlay: { opacity: 0.5, background: "black" diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 9487a5519c..8dae33a036 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -99,6 +99,7 @@ if ($agent_to_delete) { if ($enable_agent) { $result = db_process_sql_update('tagente', array('disabled' => 0), array('id_agente' => $enable_agent)); + $alias = agents_get_alias($enable_agent); if ($result) { // Update the agent from the metaconsole cache @@ -106,10 +107,10 @@ if ($enable_agent) { $values = array('disabled' => 0); enterprise_hook ('agent_update_from_cache', array($enable_agent, $values)); - db_pandora_audit("Agent management", 'Enable ' . $enable_agent); + db_pandora_audit("Agent management", 'Enable ' . $alias); } else { - db_pandora_audit("Agent management", 'Fail to enable ' . $enable_agent); + db_pandora_audit("Agent management", 'Fail to enable ' . $alias); } ui_print_result_message ($result, @@ -118,6 +119,7 @@ if ($enable_agent) { if ($disable_agent) { $result = db_process_sql_update('tagente', array('disabled' => 1), array('id_agente' => $disable_agent)); + $alias = agents_get_alias($disable_agent); if ($result) { // Update the agent from the metaconsole cache @@ -125,10 +127,10 @@ if ($disable_agent) { $values = array('disabled' => 1); enterprise_hook ('agent_update_from_cache', array($disable_agent, $values)); - db_pandora_audit("Agent management", 'Disable ' . $disable_agent); + db_pandora_audit("Agent management", 'Disable ' . $alias); } else { - db_pandora_audit("Agent management", 'Fail to disable ' . $disable_agent); + db_pandora_audit("Agent management", 'Fail to disable ' . $alias); } ui_print_result_message ($result, diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 561266d6df..fb2ed5c845 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -274,7 +274,6 @@ $table_simple->data[3][2] .= html_print_input_text ('dynamic_max', $dynamic_max, $table_simple->data[3][3] = ''.__('Dynamic Threshold Two Tailed: ').''; $table_simple->data[3][3] .= html_print_checkbox ("dynamic_two_tailed", 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy); - $table_simple->data[4][0] = __('Warning status').' ' . ui_print_help_icon ('warning_status', true); if (!modules_is_string_type($id_module_type) || $edit) { $table_simple->data[4][1] .= ''.__('Min. ').''; @@ -882,6 +881,9 @@ $(document).ready (function () { $('#dynamic_interval_select').change (function() { disabled_status(disabledBecauseInPolicy); }); + $('#dynamic_interval').change (function() { + disabled_status(disabledBecauseInPolicy); + }); disabled_two_tailed(disabledBecauseInPolicy); $('#checkbox-dynamic_two_tailed').change (function() { @@ -929,7 +931,7 @@ $(document).ready (function () { //readonly and add class input function disabled_status (disabledBecauseInPolicy) { - if($('#dynamic_interval_select').val() != 0){ + if($('#dynamic_interval_select').val() != 0 && $('#dynamic_interval').val() != 0){ $('#text-min_warning').prop('readonly', true); $('#text-min_warning').addClass('readonly'); $('#text-max_warning').prop('readonly', true); @@ -1206,18 +1208,19 @@ function validate_post_process() { //function paint graph function paint_graph_values(){ //Parse integrer - var min_w = parseInt($('#text-min_warning').val()); + var min_w = parseFloat($('#text-min_warning').val()); if(min_w == '0.00'){ min_w = 0; } - var max_w = parseInt($('#text-max_warning').val()); + var max_w = parseFloat($('#text-max_warning').val()); if(max_w == '0.00'){ max_w = 0; } - var min_c = parseInt($('#text-min_critical').val()); + var min_c = parseFloat($('#text-min_critical').val()); if(min_c =='0.00'){ min_c = 0; } - var max_c = parseInt($('#text-max_critical').val()); + var max_c = parseFloat($('#text-max_critical').val()); if(max_c =='0.00'){ max_c = 0; } var inverse_w = $('input:checkbox[name=warning_inverse]:checked').val(); if(!inverse_w){ inverse_w = 0; } var inverse_c = $('input:checkbox[name=critical_inverse]:checked').val(); if(!inverse_c){ inverse_c = 0; } + //inicialiced error var error_w = 0; var error_c = 0; @@ -1257,10 +1260,10 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er //if haven't errors if (error_w == 0 && error_c == 0){ //parse element - min_w = parseInt(min_w); - min_c = parseInt(min_c); - max_w = parseInt(max_w); - max_c = parseInt(max_c); + min_w = parseFloat(min_w); + min_c = parseFloat(min_c); + max_w = parseFloat(max_w); + max_c = parseFloat(max_c); //inicialize var var range_min = 0; diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index b1311a7846..c797b268a3 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -633,8 +633,6 @@ echo ''; if ($id_downtime > 0) { echo ""; - // Show available agents to include into downtime - echo '

' . __('Available agents') . ':

'; $filter_group = (int) get_parameter("filter_group", 0); @@ -707,7 +705,8 @@ if ($id_downtime > 0) { echo "

"; html_print_submit_button (__('Filter by group'), '', false, 'class="sub next"',false); echo ""; - + // Show available agents to include into downtime + echo '

' . __('Available agents') . ':

'; echo "
"; echo html_print_select ($agents, "id_agents[]", -1, '', _("Any"), -2, false, true, true, '', false, 'width: 180px;'); diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index ff0605390a..cda35892a4 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -129,7 +129,8 @@ if (!$delete_template) { alerts_meta_print_header (); } else { - ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true); + //~ ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true); + ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "", true); } } diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 206a0fb2b8..d2cc13a702 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -59,9 +59,12 @@ if ($a_template !== false) { alerts_meta_print_header(); } else { + //~ ui_print_page_header (__('Alerts') . + //~ ' » ' . __('Configure alert template'), "", + //~ false, "alerts_config", true); ui_print_page_header (__('Alerts') . ' » ' . __('Configure alert template'), "", - false, "alerts_config", true); + false, "", true); } } else { diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index df6c1e6f27..83b21b225b 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -337,13 +337,13 @@ $next_row++; //function paint graph function paint_graph_values(){ //Parse integrer - var min_w = parseInt($('#text-min_warning').val()); + var min_w = parseFloat($('#text-min_warning').val()); if(min_w == '0.00'){ min_w = 0; } - var max_w = parseInt($('#text-max_warning').val()); + var max_w = parseFloat($('#text-max_warning').val()); if(max_w == '0.00'){ max_w = 0; } - var min_c = parseInt($('#text-min_critical').val()); + var min_c = parseFloat($('#text-min_critical').val()); if(min_c =='0.00'){ min_c = 0; } - var max_c = parseInt($('#text-max_critical').val()); + var max_c = parseFloat($('#text-max_critical').val()); if(max_c =='0.00'){ max_c = 0; } var inverse_w = $('input:checkbox[name=warning_inverse]:checked').val(); if(!inverse_w){ inverse_w = 0; } @@ -388,10 +388,10 @@ $next_row++; //if haven't errors if (error_w == 0 && error_c == 0){ //parse element - min_w = parseInt(min_w); - min_c = parseInt(min_c); - max_w = parseInt(max_w); - max_c = parseInt(max_c); + min_w = parseFloat(min_w); + min_c = parseFloat(min_c); + max_w = parseFloat(max_w); + max_c = parseFloat(max_c); //inicialize var var range_min = 0; diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 310286ae69..a828bd4fb4 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -1497,13 +1497,11 @@ function set_static_graph_status(idElement, image, status) { set_static_graph_status(idElement, image, data); if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){ - $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); + $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); } else{ - $('#'+idElement+ ' img').css('margin-left',parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2); + $('#'+idElement+ ' img').css('margin-left', parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2); } - - } }); @@ -1849,11 +1847,9 @@ function get_image_url(img_src) { }); } -function set_color_line_status(lines, line, id_data, values) { +function set_color_line_status(lines, id_data, values) { metaconsole = $("input[name='metaconsole']").val(); - - var parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_color_line"}); @@ -1875,7 +1871,6 @@ function set_color_line_status(lines, line, id_data, values) { "node_end": id_data, "color": color }; - lines.push(line); refresh_lines(lines, 'background', true); @@ -2250,7 +2245,7 @@ function createItem(type, values, id_data) { lines.push(line); - set_color_line_status(lines, line, id_data, values); + set_color_line_status(lines, id_data, values); refresh_lines(lines, 'background', true); } @@ -2446,7 +2441,7 @@ function updateDB_visual(type, idElement , values, event, top, left) { if (typeof(values['parent']) != 'undefined' && values['parent'] > 0 ) { if (!found) { - set_color_line_status(lines, line, idElement, values); + set_color_line_status(lines, idElement, values); } } @@ -2465,6 +2460,7 @@ function updateDB_visual(type, idElement , values, event, top, left) { refresh_lines(lines, 'background', true); break; } + refresh_lines(lines, 'background', true); draw_user_lines("", 0, 0, 0 , 0, 0, true); } @@ -2601,9 +2597,19 @@ function updateDB(type, idElement , values, event) { url: get_url_ajax(), data: parameter, type: "POST", - dataType: 'text', + dataType: 'json', success: function (data) { - updateDB_visual(type, idElement , values, event, top, left); + if (data['correct']) { + if (data['new_line']) { + var line = {"id": idElement, + "node_begin": values['parent'], + "node_end": idElement, + "color": '#cccccc' }; + + lines.push(line); + } + updateDB_visual(type, idElement , values, event, top, left); + } } }); } diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index cb4958306e..85a3260494 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -756,6 +756,26 @@ $table_other->data[$row][1] .= html_print_input_hidden ('interval_to_delete', '' //---------------------------------------------------------------------- $row++; +$common_dividers = array( + ";" => ";", + "," => ",", + "|" => "|"); +$table_other->data[$row][0] = __('CSV divider'); +if ($config['csv_divider'] != ";" && $config['csv_divider'] != "," && $config['csv_divider'] != "|") { + $table_other->data[$row][1] = html_print_input_text ('csv_divider', $config['csv_divider'], "", 20, 255, true); + $table_other->data[$row][1] .= '' . + html_print_image('images/default_list.png', true, array('id' => 'select')) . + ""; +} +else { + $table_other->data[$row][1] = html_print_select ($common_dividers, 'csv_divider', $config['csv_divider'], "", '', '', true, false, false); + $table_other->data[$row][1] .= '' . + html_print_image('images/pencil.png', true, array('id' => 'pencil')) . + ""; +} +$row++; + + echo "
"; echo "" . __('Other configuration') . ""; html_print_table ($table_other); @@ -792,6 +812,27 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/'); ?> diff --git a/pandora_console/images/tip-blanco.png b/pandora_console/images/tip-blanco.png new file mode 100644 index 0000000000..6e106d4c48 Binary files /dev/null and b/pandora_console/images/tip-blanco.png differ diff --git a/pandora_console/images/tip_grey.png b/pandora_console/images/tip_grey.png new file mode 100644 index 0000000000..5257d092bd Binary files /dev/null and b/pandora_console/images/tip_grey.png differ diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 74d99febd5..2a786200ad 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -616,10 +616,20 @@ switch ($action) { } } + $item_in_db = db_get_row_filter ('tlayout_data', array ('id' => $id_element)); + + if (($item_in_db['parent_item'] == 0) && ($values['parent_item'] != 0)) { + $new_line = 1; + } + $result = db_process_sql_update('tlayout_data', $values, array('id' => $id_element)); - echo (int)$result; + $return_val = array(); + $return_val['correct'] = (int)$result; + $return_val['new_line'] = $new_line; + + echo json_encode($return_val); break; } break; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index c722a570f6..94a5a11692 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170517'; +$build_version = 'PC170522'; $pandora_version = 'v7.0NG.703'; // Do not overwrite default timezone set if defined. @@ -110,18 +110,6 @@ require_once ($ownDir . 'constants.php'); require_once ($ownDir . 'functions_db.php'); require_once ($ownDir . 'functions.php'); -db_select_engine(); -$config['dbconnection'] = db_connect(); - - -if (! defined ('EXTENSIONS_DIR')) - define ('EXTENSIONS_DIR', 'extensions'); - -if (! defined ('ENTERPRISE_DIR')) - define ('ENTERPRISE_DIR', 'enterprise'); - -require_once ($ownDir. 'functions_config.php'); - // We need a timezone BEFORE calling config_process_config. // If not we will get ugly warnings. Set Europe/Madrid by default // Later will be replaced by the good one. @@ -153,6 +141,18 @@ else{ } } +db_select_engine(); +$config['dbconnection'] = db_connect(); + + +if (! defined ('EXTENSIONS_DIR')) + define ('EXTENSIONS_DIR', 'extensions'); + +if (! defined ('ENTERPRISE_DIR')) + define ('ENTERPRISE_DIR', 'enterprise'); + +require_once ($ownDir. 'functions_config.php'); + date_default_timezone_set("Europe/Madrid"); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 3ce4eed8da..bb4d6696e8 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1990,9 +1990,32 @@ function get_os_name ($id_os) { * @return array Dashboard name of the given user. */ function get_user_dashboards ($id_user) { - $sql = "SELECT name - FROM tdashboard - WHERE id_user="."'".$id_user."'"; + if (users_is_admin($id_user)) { + $sql = "SELECT name + FROM tdashboard WHERE id_user = '" . $id_user ."' OR id_user = ''"; + } + else { + $user_can_manage_all = users_can_manage_group_all('RR'); + if ($user_can_manage_all) { + $sql = "SELECT name + FROM tdashboard WHERE id_user = '" . $id_user ."' OR id_user = ''"; + } + else { + $user_groups = users_get_groups($id_user, "RR", false); + if (empty($user_groups)) { + return false; + } + + $u_groups = array(); + foreach ($user_groups as $id => $group_name) { + $u_groups[] = $id; + } + + $sql = "SELECT name + FROM tdashboard + WHERE id_group IN (" . implode(",", $u_groups) . ") AND (id_user = '" . $id_user ."' OR id_user = '')"; + } + } return db_get_all_rows_sql ($sql); } diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index ea2aca64bd..a17b664932 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1836,6 +1836,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) { continue; $agent_name = agents_get_name($id_agent, ""); + $agent_alias = io_safe_output(agents_get_alias($id_agent)); /* Check for deletion permissions */ $id_group = agents_get_agent_group ($id_agent); @@ -1943,6 +1944,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) { if (enterprise_hook('config_agents_has_remote_configuration', array($id_agent))) { $agent_name = agents_get_name($id_agent); $agent_name = io_safe_output($agent_name); + $agent_alias = io_safe_output(agents_get_alias($id_agent)); $agent_md5 = md5 ($agent_name, false); // Agent remote configuration editor @@ -1957,7 +1959,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) { if ($error) { db_pandora_audit( "Agent management", - "Error: Deleted agent '$agent_name', the error is in the delete conf or md5."); + "Error: Deleted agent '$agent_alias', the error is in the delete conf or md5."); } } } @@ -1969,7 +1971,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) { db_process_sql ("delete from ttag_module where id_agente_modulo in (select id_agente_modulo from tagente_modulo where id_agente = ".$id_agent.")"); db_pandora_audit( "Agent management", - "Deleted agent '$agent_name'"); + "Deleted agent '$agent_alias'"); // Delete the agent from the metaconsole cache enterprise_include_once('include/functions_agents.php'); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 6fea6906b4..e400548637 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -655,7 +655,10 @@ function config_update_config () { $error_update[] = __('Custom report front') . ' - ' . __('First page'); if (!config_update_value ('custom_report_front_footer', get_parameter('custom_report_front_footer'))) - $error_update[] = __('Custom report front') . ' - ' . __('Footer'); + $error_update[] = __('Custom report front') . ' - ' . __('Footer'); + + if (!config_update_value ('csv_divider', (string) get_parameter('csv_divider', ';'))) + $error_update[] = __('CSV divider'); break; case 'net': @@ -1620,6 +1623,10 @@ function config_process_config () { config_update_value ('classic_menu', 0); } + if (!isset($config["csv_divider"])) { + config_update_value ('csv_divider', ";"); + } + if (!isset($config['command_snapshot'])) { config_update_value ('command_snapshot', 1); } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 8582655e82..01b8407aa0 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -353,9 +353,12 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i elseif ($period < SECONDS_1MONTH) { $time_format = "M \nd H\h"; } - else { + elseif ($period < SECONDS_6MONTHS) { $time_format = "M \nd H\h"; } + else { + $time_format = "M Y"; + } } else { // Set the title and time format @@ -371,9 +374,12 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i elseif ($period < SECONDS_1MONTH) { $time_format = "M d H\h"; } - else { + elseif ($period < SECONDS_6MONTHS) { $time_format = "M d H\h"; } + else { + $time_format = "M Y"; + } } $timestamp_short = date($time_format, $timestamp); @@ -1019,10 +1025,17 @@ function graphic_combined_module ($module_list, $weight_list, $period, elseif ($temp_range <= SECONDS_1MONTH) { $time_format = 'M d'; $time_format_2 = 'H\h'; - } - else { + } + elseif ($temp_range <= SECONDS_1MONTH) { $time_format = 'M d'; $time_format_2 = 'H\h'; + } + elseif ($period < SECONDS_6MONTHS) { + $time_format = 'M d'; + $time_format_2 = 'H\h'; + } + else { + $time_format = "M Y"; } // Set variables @@ -2304,10 +2317,9 @@ function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value require_once("include_graph_dependencies.php"); include_graphs_dependencies($config['homedir'].'/'); - $src = ui_get_full_url( "/include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar" . - "&width=".$width."&height=".$height."&progress=".$progress. + "&width=".$width."&homedir=".$config['homedir']."&height=".$height."&progress=".$progress. "&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str . "&title=".$title."&font=".$config['fontpath']."&value_text=". $value_text . "&colorRGB=". $colorRGB, false, false, false @@ -3802,9 +3814,12 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } elseif ($period < SECONDS_1MONTH) { $time_format = 'M d H\h'; - } + } + elseif ($period < SECONDS_6MONTHS) { + $time_format = "M d H\h"; + } else { - $time_format = 'M d H\h'; + $time_format = "M Y"; } $timestamp_short = date($time_format, $timestamp); @@ -3925,8 +3940,11 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, elseif ($period < SECONDS_1MONTH) { $time_format = 'M d H\h'; } + elseif ($period < SECONDS_6MONTHS) { + $time_format = "M d H\h"; + } else { - $time_format = 'M d H\h'; + $time_format = "M Y"; } // Flash chart @@ -4145,8 +4163,11 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit = elseif ($period < SECONDS_1MONTH) { $chart_time_format = 'M d H\h'; } + elseif ($period < SECONDS_6MONTHS) { + $chart_time_format = "M d H\h"; + } else { - $chart_time_format = 'M d H\h'; + $chart_time_format = "M Y"; } // Calculate source indexes @@ -4271,8 +4292,11 @@ function graph_netflow_total_area ($data, $period, $width, $height, $unit = '', elseif ($period < SECONDS_1MONTH) { $chart_time_format = 'M d H\h'; } - else { - $chart_time_format = 'M d H\h'; + elseif ($period < SECONDS_6MONTHS) { + $chart_time_format = "M d H\h"; + } + else { + $chart_time_format = "M Y"; } // Calculate min, max and avg values @@ -4567,8 +4591,11 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, elseif ($period < SECONDS_1MONTH) { $time_format = 'M d H\h'; } + elseif ($period < SECONDS_6MONTHS) { + $time_format = "M d H\h"; + } else { - $time_format = 'M d H\h'; + $time_format = "M Y"; } $timestamp_short = date($time_format, $timestamp); @@ -4742,8 +4769,11 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu elseif ($period < SECONDS_1MONTH) { $time_format = 'M d H\h'; } - else { - $time_format = 'M d H\h'; + elseif ($period < SECONDS_6MONTHS) { + $time_format = "M d H\h"; + } + else { + $time_format = "M Y"; } $legend = array(); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 2af6eebf8e..d94a2bfde7 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -737,7 +737,7 @@ function html_print_extended_select_for_time ($name, $selected = '', if (!is_user_admin($config['id_user'])) { unset($fields[-1]); - $returnString = html_print_select ($fields, $name, $selected,"" . $script, + $returnString = html_print_select ($fields, $name . '_select', $selected,"" . $script, $nothing, $nothing_value, true, false, false, '', false, 'font-size: xx-small;'.$select_style); if ($return) { diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 6915fd76a2..913c6a63cd 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -49,6 +49,9 @@ function menu_print_menu (&$menu) { '') . '>'; + // Use $config because a global var is required because normal + // and godmode menu are painted separately + if (!isset($config['count_main_menu'])) $config['count_main_menu'] = 0; foreach ($menu as $mainsec => $main) { $extensionInMenuParameter = (string) get_parameter ('extension_in_menu',''); @@ -369,6 +372,12 @@ function menu_print_menu (&$menu) { $sub_title = ''; } + // Added a top on inline styles + $top = menu_calculate_top($config['count_main_menu'], $count_sub, $count_sub2); + if ($top !== 0) { + $display = rtrim($display, "'"); + $display .= "top: " . $top . "px;'"; + } //Add submenu2 to submenu string $submenu_output .= "