diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 8a16e8e18d..23ea7a4627 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -143,7 +143,7 @@ done # Darwin dmg installer files echo "Updating DARWIN DMG files..." -sed -i -e "/VERSION/s/=.*/=\"$VERSION\"/" "$AGENT_DARWIN_BUILDER" +sed -i -e "/VERSION/s/=\"7.0NG.*/=\"$VERSION\"/" "$AGENT_DARWIN_BUILDER" sed -i -r "s/(version=\").*(\"\s+onConclusion=)/\1$VERSION\2/g" "$AGENT_DARWIN_DISTR" sed -i -r "s/(CFBundleVersion<\/key>\s*).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST" sed -i -r "s/(CFBundleShortVersionString<\/key>\s*).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST" diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 8c24bcb56a..d45b4bafb5 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.750-201103 +Version: 7.0NG.750-201111 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 664fc368ed..0fa21bd5a0 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.750-201103" +pandora_version="7.0NG.750-201111" 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/Darwin/dmg/build_darwin_dmg.sh b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh index 325d149578..95878467ab 100644 --- a/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh +++ b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh @@ -22,7 +22,7 @@ fi # DMG package version if [ "$#" -ge 2 ]; then - VERSION="7.0NG.750" + VERSION="$2" else VERSION="7.0NG.750" fi @@ -37,7 +37,7 @@ fi BUILD_DMG="$BUILD_PATH/build" BUILD_TMP="$BUILD_PATH/buildtmp" -FULLNAME="7.0NG.749" +FULLNAME="$DMGNAME-$VERSION.dmg" echo "VERSION-"$VERSION" NAME-"$DMGNAME pushd . cd $LOCALINST diff --git a/pandora_agents/unix/Darwin/dmg/scripts/postinstall b/pandora_agents/unix/Darwin/dmg/scripts/postinstall index 2f76310fee..5b25222a37 100644 --- a/pandora_agents/unix/Darwin/dmg/scripts/postinstall +++ b/pandora_agents/unix/Darwin/dmg/scripts/postinstall @@ -26,11 +26,13 @@ else `/usr/local/share/pandora_agent/inst_utilities/print_conf.pl /usr/local/share/pandora_agent/pandora_agent.conf remote_config $REMOTECFG` # Create agent directories and files - mkdir -p /usr/local/share/pandora_agent/collections - mkdir -p /usr/local/share/pandora_agent/commands + mkdir -p /usr/local/bin/ + mkdir -p /usr/local/share/man/man1/ + mkdir -p /usr/local/share/pandora_agent/collections/ + mkdir -p /usr/local/share/pandora_agent/commands/ mkdir -p /etc/pandora/ - mkdir -p /var/spool/pandora/data_out - mkdir -p /var/log/pandora + mkdir -p /var/spool/pandora/data_out/ + mkdir -p /var/log/pandora/ mv pandora_agent.conf /etc/pandora/ touch /var/log/pandora/pandora_agent.log @@ -70,9 +72,9 @@ ln -s /usr/local/share/pandora_agent/collections /etc/pandora/collections # Copy manuals -cp -f man/man1/pandora_agent.1.gz /usr/local/share/man/man1 +cp -f man/man1/pandora_agent.1.gz /usr/local/share/man/man1/ chmod 644 /usr/local/share/man/man1/pandora_agent.1.gz -cp -f man/man1/tentacle_client.1.gz /usr/local/share/man/man1 +cp -f man/man1/tentacle_client.1.gz /usr/local/share/man/man1/ chmod 644 /usr/local/share/man/man1/tentacle_client.1.gz # Create newsyslog entry diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 3d0a47fcda..f15435c581 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.750'; -use constant AGENT_BUILD => '201103'; +use constant AGENT_BUILD => '201111'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 1e4ad58036..d3d3cfc4c8 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.750 -%define release 201103 +%define release 201111 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 057b26df2a..d8e990c2a6 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.750 -%define release 201103 +%define release 201111 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 e08e30678b..782c61cce4 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.750" -PI_BUILD="201103" +PI_BUILD="201111" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 6228d5b274..02ce38fb77 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201103} +{201111} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index d31a184151..cfdae5a3a3 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.750(Build 201103)") +#define PANDORA_VERSION ("7.0NG.750(Build 201111)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 3bdb9fe63b..b327a39ac2 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.750(Build 201103))" + VALUE "ProductVersion", "(7.0NG.750(Build 201111))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 395cdae6ad..b2eb6352d5 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.750-201103 +Version: 7.0NG.750-201111 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index b45e60e545..1f4736fe3d 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.750-201103" +pandora_version="7.0NG.750-201111" package_pear=0 package_pandora=1 diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index c4cd8482bc..59257907ad 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -114,6 +114,13 @@ foreach ($custom_fields as $field) { } } +// Connection lost alert. +ui_require_css_file('register', 'include/styles/', true); +ui_require_javascript_file('connection_check'); +$conn_title = __('Connection with server has been lost'); +$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); +ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); + // Get the custom icons. $docs_logo = ui_get_docs_logo(); $support_logo = ui_get_support_logo(); @@ -450,7 +457,12 @@ if ($login_screen == 'logout') { echo '
'; echo '
'; echo '

'.__('Logged out').'

'; - echo '

'.__('Your session has ended. Please close your browser window to close this %s session.', get_product_name()).'

'; + if (empty($config['logout_msg']) === true) { + echo '

'.__('Your session has ended. Please close your browser window to close this %s session.', get_product_name()).'

'; + } else { + echo '

'.__($config['logout_msg']).'

'; + } + echo '
'; echo '
'; html_print_submit_button('Ok', 'hide-login-logout', false); diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index e7097b994e..8c10adc32b 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -148,7 +148,8 @@ if ($initial && users_is_admin()) { config_wiz_modal( false, true, - (($registration === true) ? 'show_registration_wizard()' : null) + (($registration === true) ? 'show_registration_wizard()' : null), + true ); } @@ -159,7 +160,8 @@ if (!$config['disabled_newsletter']) { false, // Launch only if not being launch from 'initial'. !$initial, - (($show_newsletter === true) ? 'force_run_newsletter()' : null) + (($show_newsletter === false) ? 'force_run_newsletter()' : null), + true ); } else { if ($show_newsletter) { @@ -167,7 +169,8 @@ if (!$config['disabled_newsletter']) { newsletter_wiz_modal( false, // Launch only if not being call from 'registration'. - !$registration && !$initial + !$registration && !$initial, + true ); } } diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index e6d384e5e4..b6a7213ef8 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1340,115 +1340,117 @@ $(document).ready (function () { var type_name_selected = type_names[type_selected]; var element = document.getElementById("module_type_help"); var language = "" ; - element.onclick = function (event) { - if(type_name_selected == 'async_data' || - type_name_selected == 'async_proc' || - type_name_selected == 'async_string' || - type_name_selected == 'generic_proc'|| - type_name_selected == 'generic_data' || - type_name_selected == 'generic_data_inc' || - type_name_selected == 'generic_data_inc_abs'|| - type_name_selected == 'generic_data_string' || - type_name_selected == 'keep_alive' - ){ - if (language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules', - '_blank', - 'width=800,height=600' - ); - } - - - } - if(type_name_selected == 'remote_icmp' || - type_name_selected == 'remote_icmp_proc' - ){ - if(language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring', - '_blank', - 'width=800,height=600' - ); - } - - - } - if(type_name_selected == 'remote_snmp_string' || - type_name_selected == 'remote_snmp_proc' || - type_name_selected == 'remote_snmp_inc' || - type_name_selected == 'remote_snmp' - ){ - if(language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP', - '_blank', - 'width=800,height=600' - ); - } - - - } - if(type_name_selected == 'remote_tcp_string' || - type_name_selected == 'remote_tcp_proc' || - type_name_selected == 'remote_tcp_inc' || - type_name_selected == 'remote_tcp' - ){ - if(language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP', - '_blank', - 'width=800,height=600' - ); + if (typeof element !== 'undefined' && element !== null) { + element.onclick = function (event) { + if(type_name_selected == 'async_data' || + type_name_selected == 'async_proc' || + type_name_selected == 'async_string' || + type_name_selected == 'generic_proc'|| + type_name_selected == 'generic_data' || + type_name_selected == 'generic_data_inc' || + type_name_selected == 'generic_data_inc_abs'|| + type_name_selected == 'generic_data_string' || + type_name_selected == 'keep_alive' + ){ + if (language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos', + '_blank', + 'width=800,height=600' + ); } else{ window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring', - '_blank', - 'width=800,height=600' - ); - } - } - if(type_name_selected == 'web_data' || - type_name_selected == 'web_proc' || - type_name_selected == 'web_content_data' || - type_name_selected == 'web_content_string' - ){ - if(language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules', - '_blank', - 'width=800,height=600' - ); + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules', + '_blank', + 'width=800,height=600' + ); } + + + } + if(type_name_selected == 'remote_icmp' || + type_name_selected == 'remote_icmp_proc' + ){ + if(language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring', + '_blank', + 'width=800,height=600' + ); + } + + + } + if(type_name_selected == 'remote_snmp_string' || + type_name_selected == 'remote_snmp_proc' || + type_name_selected == 'remote_snmp_inc' || + type_name_selected == 'remote_snmp' + ){ + if(language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP', + '_blank', + 'width=800,height=600' + ); + } + + + } + if(type_name_selected == 'remote_tcp_string' || + type_name_selected == 'remote_tcp_proc' || + type_name_selected == 'remote_tcp_inc' || + type_name_selected == 'remote_tcp' + ){ + if(language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring', + '_blank', + 'width=800,height=600' + ); + } + } + if(type_name_selected == 'web_data' || + type_name_selected == 'web_proc' || + type_name_selected == 'web_content_data' || + type_name_selected == 'web_content_string' + ){ + if(language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules', + '_blank', + 'width=800,height=600' + ); + } + } } } 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 35c5648db2..d42e93c949 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -386,121 +386,124 @@ $next_row++; console.log(type_name_selected); var element = document.getElementById("module_type_help"); var language = "" ; - element.onclick = function (event) { - if(type_name_selected == 'async_data' || - type_name_selected == 'async_proc' || - type_name_selected == 'async_string' || - type_name_selected == 'generic_proc'|| - type_name_selected == 'generic_data' || - type_name_selected == 'generic_data_inc' || - type_name_selected == 'generic_data_inc_abs'|| - type_name_selected == 'generic_data_string' || - type_name_selected == 'keep_alive' - ){ - if (language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules', - '_blank', - 'width=800,height=600' - ); - } - - + + if (typeof element !== 'undefined' && element !== null) { + element.onclick = function (event) { + if(type_name_selected == 'async_data' || + type_name_selected == 'async_proc' || + type_name_selected == 'async_string' || + type_name_selected == 'generic_proc'|| + type_name_selected == 'generic_data' || + type_name_selected == 'generic_data_inc' || + type_name_selected == 'generic_data_inc_abs'|| + type_name_selected == 'generic_data_string' || + type_name_selected == 'keep_alive' + ){ + if (language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules', + '_blank', + 'width=800,height=600' + ); + } + + + } + if(type_name_selected == 'remote_icmp' || + type_name_selected == 'remote_icmp_proc' + ){ + if(language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring', + '_blank', + 'width=800,height=600' + ); + } + + + } + if(type_name_selected == 'remote_snmp_string' || + type_name_selected == 'remote_snmp_proc' || + type_name_selected == 'remote_snmp_inc' || + type_name_selected == 'remote_snmp' + ){ + if(language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP', + '_blank', + 'width=800,height=600' + ); + } + + + } + if(type_name_selected == 'remote_tcp_string' || + type_name_selected == 'remote_tcp_proc' || + type_name_selected == 'remote_tcp_inc' || + type_name_selected == 'remote_tcp' + ){ + if(language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring', + '_blank', + 'width=800,height=600' + ); + } + + + } + if(type_name_selected == 'web_data' || + type_name_selected == 'web_proc' || + type_name_selected == 'web_content_data' || + type_name_selected == 'web_content_string' + ){ + if(language == 'es'){ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web', + '_blank', + 'width=800,height=600' + ); + } + else{ + window.open( + 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules', + '_blank', + 'width=800,height=600' + ); + } + + + } + } } - if(type_name_selected == 'remote_icmp' || - type_name_selected == 'remote_icmp_proc' - ){ - if(language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring', - '_blank', - 'width=800,height=600' - ); - } - - - } - if(type_name_selected == 'remote_snmp_string' || - type_name_selected == 'remote_snmp_proc' || - type_name_selected == 'remote_snmp_inc' || - type_name_selected == 'remote_snmp' - ){ - if(language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP', - '_blank', - 'width=800,height=600' - ); - } - - - } - if(type_name_selected == 'remote_tcp_string' || - type_name_selected == 'remote_tcp_proc' || - type_name_selected == 'remote_tcp_inc' || - type_name_selected == 'remote_tcp' - ){ - if(language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring', - '_blank', - 'width=800,height=600' - ); - } - - - } - if(type_name_selected == 'web_data' || - type_name_selected == 'web_proc' || - type_name_selected == 'web_content_data' || - type_name_selected == 'web_content_string' - ){ - if(language == 'es'){ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web', - '_blank', - 'width=800,height=600' - ); - } - else{ - window.open( - 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules', - '_blank', - 'width=800,height=600' - ); - } - - - } - } if (type_name_selected.match(/_string$/) == null) { // Numeric types diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php index 668ef26f0c..fd6f8d7a02 100644 --- a/pandora_console/godmode/servers/servers.build_table.php +++ b/pandora_console/godmode/servers/servers.build_table.php @@ -91,8 +91,20 @@ foreach ($servers as $server) { // Status $data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true); - if (($server['status'] == 0) || (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2)) { - $data[1] = ui_print_status_image(STATUS_SERVER_DOWN, '', true); + if ($server['status'] == -1) { + $data[1] = ui_print_status_image( + STATUS_SERVER_CRASH, + __('Server has crashed.'), + true + ); + } else if (($server['status'] == 0) + || (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2) + ) { + $data[1] = ui_print_status_image( + STATUS_SERVER_DOWN, + __('Server is stopped.'), + true + ); } // Type diff --git a/pandora_console/godmode/update_manager/update_manager.offline.php b/pandora_console/godmode/update_manager/update_manager.offline.php index 8fb4447772..37e9eed8e8 100644 --- a/pandora_console/godmode/update_manager/update_manager.offline.php +++ b/pandora_console/godmode/update_manager/update_manager.offline.php @@ -44,6 +44,13 @@ if (! check_acl($config['id_user'], 0, 'PM') return; } +if (update_manager_verify_license_expired()) { + ui_print_error_message( + __('The license has expired. Please contact Artica at info@artica.es') + ); + return; +} + $baseurl = ui_get_full_url(false, false, false, false); $current_package = db_get_value( diff --git a/pandora_console/godmode/update_manager/update_manager.online.php b/pandora_console/godmode/update_manager/update_manager.online.php index a1524d5518..6ac5c61f9b 100644 --- a/pandora_console/godmode/update_manager/update_manager.online.php +++ b/pandora_console/godmode/update_manager/update_manager.online.php @@ -94,6 +94,13 @@ if ($upload_max_filesize < $PHPupload_max_filesize_min) { $php_settings_fine++; } +if (update_manager_verify_license_expired()) { + ui_print_error_message( + __('The license has expired. Please contact Artica at info@artica.es') + ); + return; +} + // Verify registry. if (update_manager_verify_registration() === false) { ui_require_css_file('register'); diff --git a/pandora_console/images/status_sets/default/server_crash.png b/pandora_console/images/status_sets/default/server_crash.png new file mode 100644 index 0000000000..5bee46f76c Binary files /dev/null and b/pandora_console/images/status_sets/default/server_crash.png differ diff --git a/pandora_console/images/status_sets/default/server_crash_ball.png b/pandora_console/images/status_sets/default/server_crash_ball.png new file mode 100644 index 0000000000..fea84fee55 Binary files /dev/null and b/pandora_console/images/status_sets/default/server_crash_ball.png differ diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index dc0906a36c..638282d381 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -239,8 +239,7 @@ function process_user_login_remote($login, $pass, $api=false) // Unknown authentication method default: - $config['auth_error'] = 'User not found in database - or incorrect password'; + $config['auth_error'] = 'User not found in database or incorrect password'; return false; break; } diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 602e73e968..7ff6335385 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC201103'; +$build_version = 'PC201111'; $pandora_version = 'v7.0NG.750'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index d1d099c8f7..f04b008403 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -310,7 +310,7 @@ define('STATUS_ALERT_DISABLED', 'alert_disabled.png'); // For servers. define('STATUS_SERVER_OK', 'server_ok.png'); define('STATUS_SERVER_DOWN', 'server_down.png'); - +define('STATUS_SERVER_CRASH', 'server_crash.png'); // Status images (ball). @@ -336,6 +336,7 @@ define('STATUS_ALERT_DISABLED_BALL', 'alert_disabled_ball.png'); // For servers. define('STATUS_SERVER_OK_BALL', 'server_ok_ball.png'); define('STATUS_SERVER_DOWN_BALL', 'server_down_ball.png'); +define('STATUS_SERVER_CRASH_BALL', 'server_crash_ball.png'); diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 9a5ea93f92..e28c255f9c 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2494,6 +2494,8 @@ function modules_get_color_status($status, $force_module=false) case STATUS_AGENT_CRITICAL: case STATUS_MODULE_CRITICAL_BALL: case STATUS_AGENT_CRITICAL_BALL: + case STATUS_SERVER_CRASH: + case STATUS_SERVER_CRASH_BALL: return COL_CRITICAL; case AGENT_MODULE_STATUS_WARNING: diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index ab6079fb36..65e6facc93 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2762,6 +2762,7 @@ function get_shape_status_set($type) // Small squares. case STATUS_SERVER_OK: case STATUS_SERVER_DOWN: + case STATUS_SERVER_CRASH: $return = ['class' => 'status_small_squares']; break; @@ -2773,6 +2774,9 @@ function get_shape_status_set($type) case STATUS_AGENT_OK_BALL: case STATUS_AGENT_NO_DATA_BALL: case STATUS_AGENT_NO_MONITORS_BALL: + case STATUS_SERVER_OK_BALL: + case STATUS_SERVER_DOWN_BALL: + case STATUS_SERVER_CRASH_BALL: $return = ['class' => 'status_balls']; break; diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index 2b3dcbc093..6156e5e174 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -73,6 +73,24 @@ function update_manager_verify_trial() } +/** + * Check if the trial license is not expired. + * + * @return boolean true if the trial license is expired, false otherwise. + */ +function update_manager_verify_license_expired() +{ + global $config; + + $current_date = date('Ymd'); + if (isset($config['license_expiry_date']) && $current_date >= $config['license_expiry_date']) { + return true; + } + + return false; +} + + /** * Parses responses from configuration wizard. * @@ -454,13 +472,20 @@ function registration_wiz_process() function registration_wiz_modal( $return=false, $launch=true, - $callback=false + $callback=false, + $return_message=false ) { global $config; $output = ''; // Do not show the wizard for trial licenses. if (update_manager_verify_trial()) { + ui_print_info_message('Your license is trial. Please contact Artica at info@artica.es for a valid license', '', $return_message); + return ''; + } + + if (update_manager_verify_license_expired()) { + ui_print_error_message('The license has expired. Please contact Artica at info@artica.es', '', $return_message); return ''; } diff --git a/pandora_console/include/javascript/connection_check.js b/pandora_console/include/javascript/connection_check.js new file mode 100644 index 0000000000..5ea72d2184 --- /dev/null +++ b/pandora_console/include/javascript/connection_check.js @@ -0,0 +1,170 @@ +/** + * ------------------------------------- + * Connection Check + * -------------------------------------- + */ + +checkConnection(1); + +/** + * Performs connection tests every minutes and add connection listeners + * @param {integer} time in minutes + */ + +function checkConnection(minutes) { + var cicle = minutes * 60 * 1000; + var checkConnection = setInterval(handleConnection, cicle); + + // Connection listeters. + window.addEventListener("online", handleConnection); + window.addEventListener("offline", handleConnection); +} + +/** + * Handle connection status test. + * + * Test conectivity with server and shows modal message. + */ +function handleConnection() { + var connected; + var msg = "online"; + + if (navigator.onLine) { + isReachable(getServerUrl()) + .then(function(online) { + if (online) { + // handle online status + connected = true; + showConnectionMessage(connected, msg); + } else { + connected = false; + msg = "No connectivity with server"; + showConnectionMessage(connected, msg); + } + }) + .catch(function(err) { + connected = false; + msg = err; + showConnectionMessage(connected, msg); + }); + } else { + // handle offline status + connected = false; + msg = "Connection offline"; + showConnectionMessage(connected, msg); + } +} + +/** + * Test server reachibilty and get response. + * + * @param {String} url + * + * Return {promise} + */ +function isReachable(url) { + /** + * Note: fetch() still "succeeds" for 404s on subdirectories, + * which is ok when only testing for domain reachability. + * + * Example: + * https://google.com/noexist does not throw + * https://noexist.com/noexist does throw + */ + return fetch(url, { method: "HEAD", mode: "no-cors" }) + .then(function(resp) { + return resp && (resp.ok || resp.type === "opaque"); + }) + .catch(function(error) { + console.warn("[conn test failure]:", error); + }); +} + +/** + * Gets server origin url + */ +function getServerUrl() { + var server_url; + + server_url = window.location.origin; + + return server_url; +} + +/** + * Shows or hide connection infoMessage. + * + * @param {bool} conn + * @param {string} msg + */ +function showConnectionMessage(conn = true, msg = "") { + var data = {}; + if (conn) { + $("div#message_dialog_connection") + .closest(".ui-dialog-content") + .dialog("close"); + } else { + data.title = "Connection with server has been lost"; + data.text = "Connection status: " + msg; + + infoMessage(data, "message_dialog_connection"); + } +} + +function infoMessage(data, idMsg) { + var title = data.title; + var err_messge = data.text; + + if (idMsg == null) { + idMsg = uniqId(); + } + + if ($("#" + idMsg).length === 0) { + $("body").append('
'); + $("#" + idMsg).empty(); + } + + $("#err_msg").empty(); + $("#err_msg").html("\n\n" + err_messge); + + $("#" + idMsg) + .dialog({ + height: 250, + width: 528, + opacity: 1, + modal: true, + position: { + my: "center", + at: "center", + of: window, + collision: "fit" + }, + title: data.title, + buttons: [ + { + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", + text: "Retry", + click: function(e) { + handleConnection(); + } + }, + { + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-cancel", + text: "Close", + click: function() { + $(this).dialog("close"); + } + } + ], + + open: function(event, ui) { + $(".ui-widget-overlay").addClass("error-modal-opened"); + }, + close: function(event, ui) { + $(".ui-widget-overlay").removeClass("error-modal-opened"); + } + }) + .show(); +} diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index e7f007a425..04a8f5336e 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1930,120 +1930,3 @@ function ajaxRequest(id, settings) { } }); } - -/** - * ------------------------------------- - * Connection Check - * -------------------------------------- - */ - -checkConnection(1); - -/** - * Performs connection tests every minutes and add connection listeners - * @param {integer} time in minutes - */ - -function checkConnection(minutes) { - var cicle = minutes * 60 * 1000; - var checkConnection = setInterval(handleConnection, cicle); - - // Connection listeters. - window.addEventListener("online", handleConnection); - window.addEventListener("offline", handleConnection); -} - -/** - * Handle connection status test. - * - * Test conectivity with server and shows modal message. - */ -function handleConnection() { - var connected; - var msg = "online"; - - if (navigator.onLine) { - isReachable(getServerUrl()) - .then(function(online) { - if (online) { - // handle online status - connected = true; - showConnectionMessage(connected, msg); - } else { - connected = false; - msg = "No connectivity with server"; - showConnectionMessage(connected, msg); - } - }) - .catch(function(err) { - connected = false; - msg = err; - showConnectionMessage(connected, msg); - }); - } else { - // handle offline status - connected = false; - msg = "Connection offline"; - showConnectionMessage(connected, msg); - } -} - -/** - * Test server reachibilty and get response. - * - * @param {String} url - * - * Return {promise} - */ -function isReachable(url) { - /** - * Note: fetch() still "succeeds" for 404s on subdirectories, - * which is ok when only testing for domain reachability. - * - * Example: - * https://google.com/noexist does not throw - * https://noexist.com/noexist does throw - */ - return fetch(url, { method: "HEAD", mode: "no-cors" }) - .then(function(resp) { - return resp && (resp.ok || resp.type === "opaque"); - }) - .catch(function(error) { - console.warn("[conn test failure]:", error); - }); -} - -/** - * Gets server origin url - */ -function getServerUrl() { - var server_url; - - try { - server_url = get_php_value("homeurl"); - } catch (SyntaxError) { - console.warn("Pandora homeurl cannot be found."); - server_url = $("#hidden-homeurl").val(); - } - return server_url; -} - -/** - * Shows or hide connection infoMessage. - * - * @param {bool} conn - * @param {string} msg - */ -function showConnectionMessage(conn = true, msg = "") { - var data = {}; - if (conn) { - $("div#message_dialog_connection") - .closest(".ui-dialog-content") - .dialog("close"); - } else { - data.title = "Connection with server has been lost"; - data.text = "Connection status: " + msg; - - infoMessage(data, "message_dialog_connection"); - } -} diff --git a/pandora_console/include/javascript/pandora_ui.js b/pandora_console/include/javascript/pandora_ui.js index 502b8815a0..9ae5d956d8 100644 --- a/pandora_console/include/javascript/pandora_ui.js +++ b/pandora_console/include/javascript/pandora_ui.js @@ -494,61 +494,3 @@ function generalShowMsg(data, idMsg) { ] }); } - -function infoMessage(data, idMsg) { - var title = data.title; - var err_messge = data.text; - - if (idMsg == null) { - idMsg = uniqId(); - } - - if ($("#" + idMsg).length === 0) { - $("body").append('
'); - $("#" + idMsg).empty(); - } - - $("#err_msg").empty(); - $("#err_msg").html("\n\n" + err_messge); - - $("#" + idMsg) - .dialog({ - height: 250, - width: 528, - opacity: 1, - modal: true, - position: { - my: "center", - at: "center", - of: window, - collision: "fit" - }, - title: data.title, - buttons: [ - { - class: - "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", - text: "Retry", - click: function(e) { - handleConnection(); - } - }, - { - class: - "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-cancel", - text: "Close", - click: function() { - $(this).dialog("close"); - } - } - ], - - open: function(event, ui) { - $(".ui-widget-overlay").addClass("error-modal-opened"); - }, - close: function(event, ui) { - $(".ui-widget-overlay").removeClass("error-modal-opened"); - } - }) - .show(); -} diff --git a/pandora_console/include/load_session.php b/pandora_console/include/load_session.php index 3575310141..b557edd5d3 100644 --- a/pandora_console/include/load_session.php +++ b/pandora_console/include/load_session.php @@ -64,14 +64,23 @@ function pandora_session_close() function pandora_session_read($session_id) { $session_id = addslashes($session_id); - $session_data = db_get_value( - 'data', - 'tsessions_php', - 'id_session', - $session_id + + // Do not use SQL cache here. + $session_data = db_get_all_rows_sql( + sprintf( + 'SELECT data + FROM `tsessions_php` WHERE id_session="%s"', + $session_id + ), + false, + false ); - if (!empty($session_data)) { + if (is_array($session_data) === true) { + $session_data = $session_data[0]['data']; + } + + if (empty($session_data) === false) { return $session_data; } else { return ''; @@ -90,7 +99,6 @@ function pandora_session_read($session_id) function pandora_session_write($session_id, $data) { $session_id = addslashes($session_id); - if (is_ajax()) { // Avoid session upadte while processing ajax responses - notifications. if (get_parameter('check_new_notifications', false)) { @@ -101,18 +109,22 @@ function pandora_session_write($session_id, $data) $values = []; $values['last_active'] = time(); - if (!empty($data)) { + if (empty($data) === false) { $values['data'] = addslashes($data); } - $session_exists = (bool) db_get_value( - 'COUNT(id_session)', - 'tsessions_php', - 'id_session', - $session_id + // Do not use SQL cache here. + $session_exists = db_get_all_rows_sql( + sprintf( + 'SELECT id_session + FROM `tsessions_php` WHERE id_session="%s"', + $session_id + ), + false, + false ); - if (!$session_exists) { + if ($session_exists === false) { $values['id_session'] = $session_id; $retval_write = db_process_sql_insert('tsessions_php', $values); } else { @@ -198,11 +210,69 @@ function pandora_session_gc($max_lifetime=300) } -$result_handler = session_set_save_handler( - 'pandora_session_open', - 'pandora_session_close', - 'pandora_session_read', - 'pandora_session_write', - 'pandora_session_destroy', - 'pandora_session_gc' -); +/** + * Enables custom session handlers. + * + * @return boolean Context changed or not. + */ +function enable_session_handlers() +{ + global $config; + + if ($config['_using_pandora_sessionhandlers'] !== true) { + if (session_status() !== PHP_SESSION_NONE) { + // Close previous version. + session_write_close(); + } + + $sesion_handler = session_set_save_handler( + 'pandora_session_open', + 'pandora_session_close', + 'pandora_session_read', + 'pandora_session_write', + 'pandora_session_destroy', + 'pandora_session_gc' + ); + + session_start(); + + // Restore previous session. + $config['_using_pandora_sessionhandlers'] = true; + return $sesion_handler; + } + + return false; +} + + +/** + * Disables custom session handlers. + * + * @param string|null $id_session Force swap to target session. + * + * @return void + */ +function disable_session_handlers($id_session=null) +{ + global $config; + + if (session_status() !== PHP_SESSION_NONE) { + // Close previous version. + session_write_close(); + } + + $ss = new SessionHandler(); + session_set_save_handler($ss, true); + + if ($id_session !== null) { + session_id($id_session); + } + + session_start(); + + $config['_using_pandora_sessionhandlers'] = false; +} + + +// Always enable session handler. +$result_handler = enable_session_handlers(); diff --git a/pandora_console/index.php b/pandora_console/index.php index 599e013c12..1d72a5a5af 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -222,7 +222,7 @@ echo ''."\n"; ob_start('ui_process_page_head'); // Enterprise main. -enterprise_include('index.php'); +enterprise_include_once('index.php'); echo '