diff --git a/.gitignore b/.gitignore index 3de8a8ebac..261b3d161e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,11 @@ -pandora_console/attachment/agents +.vstags +MYMETA.json +MYMETA.yml +.vscode +.vscode* +.vstags +**/blib +**/PandoraFMS-Enterprise/Makefile +**/PandoraFMS-Enterprise/pm_to_blib +**/pandora_console/attachment/cache +**/pandora_console/attachment/agents diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh new file mode 100644 index 0000000000..aa858eec3a --- /dev/null +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -0,0 +1,585 @@ +#!/bin/bash + +# define variables +PANDORA_CONSOLE=/var/www/html/pandora_console +CONSOLE_PATH=/var/www/html/pandora_console +PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf +PANDORA_SERVER_BIN=/usr/bin/pandora_server +PANDORA_HA_BIN=/usr/bin/pandora_ha +PANDORA_TABLES_MIN=160 +DBHOST=127.0.0.1 +DBNAME=pandora +DBUSER=pandora +DBPASS=pandora +DBPORT=3306 +S_VERSION='2021012801' +LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" + +# Ansi color code variables +red="\e[0;91m" +green="\e[0;92m" +bold="\e[1m" +cyan="\e[0;36m" +reset="\e[0m" + +# Functions + +execute_cmd () { + local cmd="$1" + local msg="$2" + + echo -e "${cyan}$msg...${reset}" + $cmd &>> $LOGFILE + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + [ "$3" ] && echo "$3" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf $HOME/pandora_deploy_tmp &>> $LOGFILE + exit 1 + else + echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}" + return 0 + fi +} + +check_cmd_status () { + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + [ "$1" ] && echo "$1" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE + exit 1 + else + echo -e "${green}OK${reset}" + return 0 + fi +} + +check_pre_pandora () { + export MYSQL_PWD=$DBPASS + + echo -en "${cyan}Checking environment ... ${reset}" + rpm -qa | grep pandora &>> /dev/null && local fail=true + [ -d "$CONSOLE_PATH" ] && local fail=true + [ -f /usr/bin/pandora_server ] && local fail=true + echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true + + [ ! $fail ] + check_cmd_status 'Error there is a current Pandora FMS installation on this node, please remove it to execute a clean install' +} + +check_repo_connection () { + execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection" + execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo" + execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo" +} + +check_root_permissions () { + echo -en "${cyan}Checking root account... ${reset}" + if [ "$(whoami)" != "root" ]; then + echo -e "${red}Fail${reset}" + echo "Please use a root account or sudo for installing PandoraFMS" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 + + else + echo -e "${green}OK${reset}" + fi +} + +## Main +echo "Starting PandoraFMS Community deployment ver. $S_VERSION" + +# Centos Version +if [ ! "$(grep -i centos /etc/redhat-release)" ]; then + printf "${red}Error this is not a Centos Base system, this installer is compatible with Centos systems only${reset}\n" + exit 1 +fi + +execute_cmd "grep -i centos /etc/redhat-release" "Checking Centos" 'Error This is not a Centos Base system' + +echo -en "${cyan}Check Centos Version...${reset}" +[ $(sed -nr 's/VERSION_ID+=\s*"([0-9])"$/\1/p' /etc/os-release) -eq '7' ] +check_cmd_status 'Error OS version, Centos 7 is expected' + +# initialice logfile +execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE" +echo "Community installer version: $S_VERSION" >> $LOGFILE + +# Pre checks +# Root permisions +check_root_permissions + +# Pre installed pandora +check_pre_pandora + +# Connectivity +check_repo_connection + +# Systemd +execute_cmd "systemctl status" "Cheking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8' + +# Check memomry greather or equal to 2G +execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)' + +# Check disk size at least 10 Gb free space +execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)' + +# Execute tools check +execute_cmd "awk --version" 'Checking needed tools: awk' +execute_cmd "grep --version" 'Checking needed tools: grep' +execute_cmd "sed --version" 'Checking needed tools: sed' +execute_cmd "yum --version" 'Checking needed tools: yum' + +# Creating working directory +rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE +mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE +execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp" + +#Installing wget +execute_cmd "yum install -y wget" "Installing wget" + +#Installing extra repositiries +extra_repos=" \ +tar \ +yum-utils \ +https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ +http://rpms.remirepo.net/enterprise/remi-release-7.rpm \ +https://repo.percona.com/yum/percona-release-latest.noarch.rpm" + +execute_cmd "yum install -y $extra_repos" "Installing extra repositories" +execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP" + +# Install percona Database +[ -f /etc/resolv.conf ] && rm -rf /etc/my.cnf +execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server" + +# Console dependencies +console_dependencies=" \ + php \ + postfix \ + php-mcrypt \ + php-cli \ + php-gd \ + php-curl \ + php-session \ + php-mysqlnd \ + php-ldap \ + php-zip \ + php-zlib \ + php-fileinfo \ + php-gettext \ + php-snmp \ + php-mbstring \ + php-pecl-zip \ + php-xmlrpc \ + libxslt \ + wget \ + php-xml \ + httpd \ + mod_php \ + atk \ + avahi-libs \ + cairo \ + cups-libs \ + fribidi \ + gd \ + gdk-pixbuf2 \ + ghostscript \ + graphite2 \ + graphviz \ + gtk2 \ + harfbuzz \ + hicolor-icon-theme \ + hwdata \ + jasper-libs \ + lcms2 \ + libICE \ + libSM \ + libXaw \ + libXcomposite \ + libXcursor \ + libXdamage \ + libXext \ + libXfixes \ + libXft \ + libXi \ + libXinerama \ + libXmu \ + libXrandr \ + libXrender \ + libXt \ + libXxf86vm \ + libcroco \ + libdrm \ + libfontenc \ + libglvnd \ + libglvnd-egl \ + libglvnd-glx \ + libpciaccess \ + librsvg2 \ + libthai \ + libtool-ltdl \ + libwayland-client \ + libwayland-server \ + libxshmfence \ + mesa-libEGL \ + mesa-libGL \ + mesa-libgbm \ + mesa-libglapi \ + pango \ + pixman \ + xorg-x11-fonts-75dpi \ + xorg-x11-fonts-misc \ + poppler-data \ + php-yaml \ + http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" +execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies" + +# Server dependencies +server_dependencies=" \ + perl \ + vim \ + fping \ + perl-IO-Compress \ + nmap \ + sudo \ + perl-Time-HiRes \ + nfdump \ + net-snmp-utils \ + http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm" +execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" + +# SDK VMware perl dependencies +vmware_dependencies=" \ + http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \ + perl-JSON \ + perl-Archive-Zip \ + openssl-devel \ + perl-Crypt-CBC \ + perl-Digest-SHA \ + http://firefly.artica.es/centos7/perl-Crypt-OpenSSL-AES-0.02-1.el7.x86_64.rpm" +execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies" + +# Instant client Oracle +oracle_dependencier=" \ + https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \ + https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm" +execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant client" + +# Disabling SELINUX and firewalld +setenforce 0 +sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config +systemctl disable firewalld --now &>> $LOGFILE + + +#Configuring Database +execute_cmd "systemctl start mysqld" "Starting database engine" +export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev) +echo """ + SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!'); + UNINSTALL PLUGIN validate_password; + SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora'); + """ | mysql --connect-expired-password -uroot + +export MYSQL_PWD=$DBPASS +echo -en "${cyan}Creating Pandora FMS database...${reset}" +echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST +check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.' + +echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST + +#Generating my.cnf +POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") +cat > /etc/my.cnf << EO_CONFIG_F +[mysqld] +datadir=/var/lib/mysql +socket=/var/lib/mysql/mysql.sock +user=mysql +character-set-server=utf8 +skip-character-set-client-handshake +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 +# Mysql optimizations for Pandora FMS +# Please check the documentation in http://pandorafms.com for better results + +max_allowed_packet = 64M +innodb_buffer_pool_size = $POOL_SIZE +innodb_lock_wait_timeout = 90 +innodb_file_per_table +innodb_flush_log_at_trx_commit = 0 +innodb_flush_method = O_DIRECT +innodb_log_file_size = 64M +innodb_log_buffer_size = 16M +innodb_io_capacity = 100 +thread_cache_size = 8 +thread_stack = 256K +max_connections = 100 + +key_buffer_size=4M +read_buffer_size=128K +read_rnd_buffer_size=128K +sort_buffer_size=128K +join_buffer_size=4M + +query_cache_type = 1 +query_cache_size = 64M +query_cache_min_res_unit = 2k +query_cache_limit = 256K + +sql_mode="" + +[mysqld_safe] +log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid + +EO_CONFIG_F + +execute_cmd "systemctl restart mysqld" "Configuring database engine" + +# Downloading Pandora Packages +execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community" +execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community" +execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community" + +# Install Pandora +execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" + +# Copy gotty utility +execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' +tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE +execute_cmd "mv gotty /usr/bin/" 'Installing gotty util' + +# Enable Services +execute_cmd "systemctl enable mysqld --now" "Enabling Database service" +execute_cmd "systemctl enable httpd --now" "Enabling HTTPD service" + +# Populate Database +echo -en "${cyan}Loading pandoradb.sql to $DBNAME database...${reset}" +mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql &>> $LOGFILE +check_cmd_status 'Error Loading database schema' + +echo -en "${cyan}Loading pandoradb_data.sql to $DBNAME database...${reset}" +mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql &>> $LOGFILE +check_cmd_status 'Error Loading database schema data' + +# Configure console +cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F + /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +EO_CONFIG_F + +# Add ws proxy options to apache. +cat >> /etc/httpd/conf.modules.d/00-proxy.conf << 'EO_HTTPD_MOD' +LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so + +EO_HTTPD_MOD + +cat >> /etc/httpd/conf.d/wstunnel.conf << 'EO_HTTPD_WSTUNNEL' +ProxyRequests Off + + Require all granted + + +ProxyPass /ws ws://127.0.0.1:8080 +ProxyPassReverse /ws ws://127.0.0.1:8080 + +EO_HTTPD_WSTUNNEL + +# Temporal quitar htaccess +sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess +sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess + +# Fixing console permissions +chmod 600 $CONSOLE_PATH/include/config.php +chown apache. $CONSOLE_PATH/include/config.php +mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done + +# Prepare php.ini +sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini +sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini +sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini +sed -i -e "s/^memory_limit.*/memory_limit = 500M/g" /etc/php.ini + +cat > /var/www/html/index.html << EOF_INDEX + +EOF_INDEX + +execute_cmd "systemctl restart httpd" "Restarting httpd after configuration" + +# prepare snmptrapd +cat > /etc/snmp/snmptrapd.conf << EOF +authCommunity log public +disableAuthorization yes +EOF + +# Prepare Server conf +sed -i -e "s/^dbhost.*/dbhost $DBHOST/g" $PANDORA_SERVER_CONF +sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF +sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF +sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF +sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF + +# Set Oracle environment for pandora_server +cat > /etc/pandora/pandora_server.env << 'EOF_ENV' +#!/bin/bash +VERSION=19.8 +export PATH=$PATH:$HOME/bin:/usr/lib/oracle/$VERSION/client64/bin +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib +export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64 +EOF_ENV + +# Kernel optimization +cat >> /etc/sysctl.conf < /etc/logrotate.d/pandora_server < /etc/logrotate.d/pandora_agent <> $LOGFILE + +# Configure websocket to be started at start. +systemctl enable pandora_websocket_engine &>> $LOGFILE + +# Enable pandora ha service +systemctl enable pandora_server --now &>> $LOGFILE +execute_cmd "systemctl start pandora_server" "Starting Pandora FMS Server" + +# starting tentacle server +systemctl enable tentacle_serverd &>> $LOGFILE +execute_cmd "service tentacle_serverd start" "Starting Tentacle Server" + +# Enabling condole cron +execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron" +echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab +## Enabling agent +systemctl enable pandora_agent_daemon &>> $LOGFILE +execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent" + +#SSH banner +[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) + +cat > /etc/issue.net << EOF_banner + +Welcome to Pandora FMS appliance on CentOS +------------------------------------------ +Go to Public http://$ipplublic/pandora_console$to to login web console +$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}') + +You can find more information at http://pandorafms.com + +EOF_banner + +rm -f /etc/issue +ln -s /etc/issue.net /etc/issue + +echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config + +# Remove temporary files +execute_cmd "echo done" "Pandora FMS Community installed" +cd +execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files" + +# Print nice finish message +GREEN='\033[01;32m' +NONE='\033[0m' +printf " -> Go to Public ${green}http://"$ipplublic"/pandora_console${reset} to manage this server" +ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n -> Go to Local "g"http://"$1"/pandora_console"n" to manage this server \n -> Use this credentials to login in the console "g"[ User: admin / Password: pandora ]"n" \n"}' \ No newline at end of file diff --git a/extras/docker/centos8/base/Dockerfile b/extras/docker/centos8/base/Dockerfile index 285f2f7ef8..a35aea2937 100644 --- a/extras/docker/centos8/base/Dockerfile +++ b/extras/docker/centos8/base/Dockerfile @@ -9,7 +9,7 @@ RUN dnf install -y --setopt=tsflags=nodocs \ http://rpms.remirepo.net/enterprise/remi-release-8.rpm RUN dnf module reset -y php && dnf module install -y php:remi-7.3 -RUN dnf config-manager --set-enabled PowerTools +RUN dnf config-manager --set-enabled powertools # Install console RUN dnf install -y --setopt=tsflags=nodocs \ @@ -88,7 +88,7 @@ RUN dnf install -y --setopt=tsflags=nodocs \ xorg-x11-fonts-75dpi \ xorg-x11-fonts-misc \ poppler-data \ - php-yaml; yum clean all + php-yaml RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/ # not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts @@ -242,16 +242,31 @@ RUN dnf install -y --setopt=tsflags=nodocs \ perl-DBD-MySQL \ perl-DBI \ initscripts \ + vim \ + fping \ + perl-IO-Compress \ + perl-Time-HiRes \ + perl-Math-Complex \ + libnsl \ + mysql \ + java \ + net-snmp-utils \ net-tools \ nmap-ncat \ nmap \ net-snmp-utils \ sudo \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ - http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm + http://firefly.artica.es/centos8/wmi-1.3.14-4.el7.art.x86_64.rpm +# install utils +RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs +# SDK VMware perl dependencies +RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm +# Instant client Oracle +RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm -RUN dnf install -y supervisor crontabs mysql http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs +RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs EXPOSE 80 443 41121 162/udp diff --git a/extras/docker/centos8/build_image_el8.sh b/extras/docker/centos8/build_image_el8.sh index 00c50f6ff2..d4abd11eb8 100755 --- a/extras/docker/centos8/build_image_el8.sh +++ b/extras/docker/centos8/build_image_el8.sh @@ -64,6 +64,7 @@ wget $oconsoleurl wget $oserverurl if [ "$BASEBUILD" == 1 ] ; then + docker pull centos:8 # Open Base image echo "building Base el8 image" cd $DOCKER_PATH/base @@ -71,9 +72,12 @@ if [ "$BASEBUILD" == 1 ] ; then echo "Taging Open stack el8 latest image before upload" docker tag $OBASE_IMAGE:$VERSION $OBASE_IMAGE:latest echo -e ">>>> \n" +else + docker pull pandorafms/pandorafms-open-base-el8 fi if [ "$DBBUILD" == 1 ] ; then + docker pull percona:5.7 # Percona image echo "building Percona image" cd $OPEN/extras/docker/percona diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index 8fac8ed119..3df511bc34 100644 --- a/pandora_agents/pc/AIX/pandora_agent.conf +++ b/pandora_agents/pc/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, AIX version +# Version 7.0NG.752, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index ce24564c69..67e18c61ce 100644 --- a/pandora_agents/pc/FreeBSD/pandora_agent.conf +++ b/pandora_agents/pc/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, FreeBSD Version +# Version 7.0NG.752, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf index 29a679bf67..73e4aa4cbd 100644 --- a/pandora_agents/pc/HP-UX/pandora_agent.conf +++ b/pandora_agents/pc/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, HP-UX Version +# Version 7.0NG.752, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index 8b2745b7e5..251de4f671 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, GNU/Linux +# Version 7.0NG.752, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf index 0f416b06f1..4dcd110dc4 100644 --- a/pandora_agents/pc/NT4/pandora_agent.conf +++ b/pandora_agents/pc/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, GNU/Linux +# Version 7.0NG.752, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/SunOS/pandora_agent.conf b/pandora_agents/pc/SunOS/pandora_agent.conf index 2563b1ef70..5f86dd5a56 100644 --- a/pandora_agents/pc/SunOS/pandora_agent.conf +++ b/pandora_agents/pc/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, Solaris Version +# Version 7.0NG.752, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index ccbc35f345..60d0bbde2c 100644 --- a/pandora_agents/pc/Win32/pandora_agent.conf +++ b/pandora_agents/pc/Win32/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2021 Artica Soluciones Tecnologicas -# Version 7.0NG.751 +# Version 7.0NG.752 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software # Foundation; either version 2 of the Licence or any later version diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 0deb3bdec9..5bc9d9ba56 100644 --- a/pandora_agents/shellscript/aix/pandora_agent.conf +++ b/pandora_agents/shellscript/aix/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.751, AIX version +# Version 7.0NG.752, AIX version # General Parameters # ================== diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf index 8597edec29..4183cef424 100644 --- a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf +++ b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.751 +# Version 7.0NG.752 # FreeBSD/IPSO version # Licenced under GPL licence, 2003-2007 Sancho Lerena diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf index a54b49bac9..38030783ac 100644 --- a/pandora_agents/shellscript/hp-ux/pandora_agent.conf +++ b/pandora_agents/shellscript/hp-ux/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.751, HPUX Version +# Version 7.0NG.752, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index 1d67fd1a96..bbf8fffcb6 100644 --- a/pandora_agents/shellscript/linux/pandora_agent.conf +++ b/pandora_agents/shellscript/linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751 +# Version 7.0NG.752 # Licensed under GPL license v2, # (c) 2003-2021 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf index 1d48a99f7c..e4e21da030 100644 --- a/pandora_agents/shellscript/mac_osx/pandora_agent.conf +++ b/pandora_agents/shellscript/mac_osx/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751 +# Version 7.0NG.752 # Licensed under GPL license v2, # (c) 2003-2021 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf index e1646612b2..f957a45b87 100644 --- a/pandora_agents/shellscript/openWRT/pandora_agent.conf +++ b/pandora_agents/shellscript/openWRT/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751 +# Version 7.0NG.752 # Licensed under GPL license v2, # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf index cccad45b4d..be2f3b22f3 100644 --- a/pandora_agents/shellscript/solaris/pandora_agent.conf +++ b/pandora_agents/shellscript/solaris/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.751, Solaris version +# Version 7.0NG.752, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index 97c294f10d..1584ce4dc2 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.751, AIX version +# Version 7.0NG.752, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 46ae44ff08..53f6c71331 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.751-210108 +Version: 7.0NG.752-210311 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 757a26d4b6..c7ac46ab2a 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.751-210108" +pandora_version="7.0NG.752-210311" 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 48054e04c3..f21b4f0896 100644 --- a/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh +++ b/pandora_agents/unix/Darwin/dmg/build_darwin_dmg.sh @@ -24,7 +24,7 @@ fi if [ "$#" -ge 2 ]; then VERSION="$2" else - VERSION="7.0NG.751" + VERSION="7.0NG.752" fi # Path for the generated DMG file diff --git a/pandora_agents/unix/Darwin/dmg/extras/distribution.xml b/pandora_agents/unix/Darwin/dmg/extras/distribution.xml index 0296ba0eb3..14e4b9ff7a 100644 --- a/pandora_agents/unix/Darwin/dmg/extras/distribution.xml +++ b/pandora_agents/unix/Darwin/dmg/extras/distribution.xml @@ -19,11 +19,11 @@ - pandorafms_src.pdk + pandorafms_src.pdk - pandorafms_uninstall.pdk + pandorafms_uninstall.pdk - + - + \ No newline at end of file diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 4fa89805ce..73f22f8151 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -90,7 +90,7 @@ $table->data[0][1] = html_print_select( $table->data[0][1] .= ' '.__('Latest value').': '; $table->data[0][1] .= ' '; $table->data[0][1] .= ' '; -$table->data[0][1] .= html_print_image('images/spinner.png', true).''; +$table->data[0][1] .= html_print_image('images/spinner.gif', true).''; $table->data[1][0] = __('Actions'); @@ -124,8 +124,8 @@ $table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true); $table->data[1][1] .= ''; if (check_acl($config['id_user'], 0, 'LM')) { $table->data[1][1] .= ''; - $table->data[1][1] .= html_print_image('images/add.png', true); - $table->data[1][1] .= ''.__('Create Action').''; + $table->data[1][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']); + $table->data[1][1] .= ''.__('Create Action').''; $table->data[1][1] .= ''; } @@ -157,8 +157,8 @@ if ($own_info['is_admin']) { $table->data[2][1] .= ' '.html_print_image('images/zoom.png', true, ['class' => 'img_help']).''; if (check_acl($config['id_user'], 0, 'LM')) { $table->data[2][1] .= ''; - $table->data[2][1] .= html_print_image('images/add.png', true); - $table->data[2][1] .= ''.__('Create Template').''; + $table->data[2][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']); + $table->data[2][1] .= ''.__('Create Template').''; $table->data[2][1] .= ''; } @@ -190,7 +190,7 @@ if ($own_info['is_admin']) { if (!isset($step)) { if ($id_cluster) { - echo ""; + echo ""; } html_print_submit_button(__('Add alert'), 'add', false, 'class="sub wand"'); diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 8dde93e85f..6c6e6f66b3 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -50,9 +50,9 @@ if ($id_agente) { // Table for filter controls $form_filter = ''; $form_filter .= ""; -$form_filter .= ''; +$form_filter .= ''; $form_filter .= ''; -$form_filter .= "".__('Template name').''; +$form_filter .= "".__('Template name').''; $form_filter .= html_print_input_text('template_name', $templateName, '', 12, 255, true); $form_filter .= ''; $temp = agents_get_agents(); @@ -65,7 +65,7 @@ if ($temp) { } } -$form_filter .= "".__('Agents').''; +$form_filter .= "".__('Agents').''; $params = []; $params['return'] = true; @@ -80,7 +80,7 @@ $form_filter .= ui_print_agent_autocomplete_input($params); $form_filter .= ''; -$form_filter .= "".__('Module name').''; +$form_filter .= "".__('Module name').''; $form_filter .= html_print_input_text('module_name', $moduleName, '', 12, 255, true); $form_filter .= ''; $form_filter .= ''; @@ -111,30 +111,34 @@ if (is_array($temp)) { } } -$form_filter .= "".__('Actions').''; +$form_filter .= "".__('Actions').''; $form_filter .= html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true); $form_filter .= ''; -$form_filter .= "".__('Field content').''; +$form_filter .= "".__('Field content').''; $form_filter .= html_print_input_text('field_content', $fieldContent, '', 12, 255, true); $form_filter .= ''; -$form_filter .= "".__('Priority').''; +$form_filter .= "".__('Priority').''; $form_filter .= html_print_select(get_priorities(), 'priority', $priority, '', __('All'), -1, true); -$form_filter .= ""; +$form_filter .= ""; $form_filter .= ''; $form_filter .= ''; -$form_filter .= "".__('Enabled / Disabled').''; +$form_filter .= "".__('Status').''; $ed_list = []; -$ed_list[0] = __('Enabled'); -$ed_list[1] = __('Disabled'); -$form_filter .= html_print_select($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true); -$form_filter .= "".__('Standby').''; +$alert_status_filter = []; +$alert_status_filter['all_enabled'] = __('All (Enabled)'); +$alert_status_filter['all'] = __('All'); +$alert_status_filter['fired'] = __('Fired'); +$alert_status_filter['notfired'] = __('Not fired'); +$alert_status_filter['disabled'] = __('Disabled'); +$form_filter .= html_print_select($alert_status_filter, 'status_alert', $status_alert, '', '', '', true); +$form_filter .= "".__('Standby').''; $sb_list = []; $sb_list[1] = __('Standby on'); $sb_list[0] = __('Standby off'); $form_filter .= html_print_select($sb_list, 'standby', $standby, '', __('All'), -1, true); $form_filter .= ''; -$form_filter .= "".__('Group').''; +$form_filter .= "".__('Group').''; $own_info = get_user_info($config['id_user']); if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) { $return_all_group = false; @@ -144,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_ $form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false); $form_filter .= ''; + if (defined('METACONSOLE')) { $form_filter .= ''; $form_filter .= ""; @@ -153,7 +158,7 @@ if (defined('METACONSOLE')) { $form_filter .= ''; } else { $form_filter .= ''; - $form_filter .= ""; + $form_filter .= ""; $form_filter .= html_print_submit_button(__('Update'), '', false, 'class="sub upd"', true); $form_filter .= ''; } @@ -174,8 +179,15 @@ $simple_alerts = []; $total = 0; $where = ''; - if ($searchFlag) { + if ($status_alert === 'fired') { + $where .= ' AND talert_template_modules.times_fired > 0'; + } + + if ($status_alert === 'notfired') { + $where .= ' AND talert_template_modules.times_fired = 0'; + } + if ($priority != -1 && $priority != '') { $where .= ' AND id_alert_template IN (SELECT id FROM talert_templates WHERE priority = '.$priority.')'; } @@ -206,8 +218,12 @@ if ($searchFlag) { $where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))'; } - if ($enabledisable != -1 && $enabledisable != '') { - $where .= ' AND talert_template_modules.disabled ='.$enabledisable; + if ($status_alert === 'disabled') { + $where .= ' AND talert_template_modules.disabled = 1'; + } + + if ($status_alert === 'all_enabled') { + $where .= ' AND talert_template_modules.disabled = 0'; } if ($standby != -1 && $standby != '') { @@ -385,7 +401,7 @@ switch ($sortField) { break; } -$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group; +$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert; $sort_params = '&sort_field='.$sortField.'&sort='.$sort; if ($id_agente) { @@ -512,7 +528,7 @@ foreach ($simple_alerts as $alert) { $data[0] = ''; if ($alert['disabled']) { - $data[0] .= ''; + $data[0] .= ''; } $alias = db_get_value('alias', 'tagente', 'id_agente', $id_agent); @@ -563,7 +579,14 @@ foreach ($simple_alerts as $alert) { ); $data[2] .= ' '; - $data[2] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help action_button_img']); + $data[2] .= html_print_image( + 'images/zoom.png', + true, + [ + 'id' => 'template-details-'.$alert['id_alert_template'], + 'class' => 'img_help action_button_img invert_filter', + ] + ); $data[2] .= ' '; if (check_acl($config['id_user'], $template_group, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) { @@ -572,7 +595,7 @@ foreach ($simple_alerts as $alert) { $actions = alerts_get_alert_agent_module_actions($alert['id']); - $data[3] = ""; + $data[3] = ""; // Get and show default actions for this alert $default_action = db_get_sql( 'SELECT id_alert_action @@ -587,12 +610,12 @@ foreach ($simple_alerts as $alert) { } foreach ($actions as $action_id => $action) { - $data[3] .= ''; + $data[3] .= ''; $data[3] .= ''; - $data[3] .= ''; - $data[3] .= ''; + $data[3] .= ''; + $data[3] .= ''; if ($alert['disabled']) { - $data[3] .= ''; + $data[3] .= ''; } else { $data[3] .= ''; } @@ -626,12 +649,11 @@ foreach ($simple_alerts as $alert) { $data[3] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true); // Is possible manage actions if have LW permissions in the agent group of the alert module if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { - // ~ $data[2] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= html_print_input_image( 'delete', 'images/cross.png', @@ -640,7 +662,7 @@ foreach ($simple_alerts as $alert) { true, [ 'title' => __('Delete action'), - 'class' => 'action_button_img', + 'class' => 'action_button_img invert_filter', ] ); $data[3] .= html_print_input_hidden('delete_action', 1, true); @@ -655,7 +677,7 @@ foreach ($simple_alerts as $alert) { true, [ 'title' => __('Update action'), - 'class' => 'action_button_img', + 'class' => 'action_button_img invert_filter', 'onclick' => 'show_display_update_action(\''.$action['id'].'\',\''.$alert['id'].'\',\''.$alert['id_agent_module'].'\',\''.$action_id.'\',\''.$alert['id_agent_module'].'\')', ] ); @@ -666,7 +688,7 @@ foreach ($simple_alerts as $alert) { $data[3] .= ''; } - $data[3] .= ''; + $data[3] .= ''; $data[3] .= ''; $data[3] .= ''; // Is possible manage actions if have LW permissions in the agent group of the alert module @@ -684,15 +706,15 @@ foreach ($simple_alerts as $alert) { $actions = alerts_get_alert_actions_filter(true, 'id_group IN ('.$filter_groups.')'); } - $data[3] .= ''; + $data[3] .= ''; $data[3] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= html_print_input_hidden('add_action', 1, true); $data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true); if (! $id_agente) { $data[3] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= __('Agent'); $data[3] .= ''; $data[3] .= ''; @@ -702,7 +724,7 @@ foreach ($simple_alerts as $alert) { } $data[3] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= __('Module'); $data[3] .= ''; $data[3] .= ''; @@ -710,7 +732,7 @@ foreach ($simple_alerts as $alert) { $data[3] .= ''; $data[3] .= ''; $data[3] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= __('Action'); $data[3] .= ''; $data[3] .= ''; @@ -718,7 +740,7 @@ foreach ($simple_alerts as $alert) { $data[3] .= ''; $data[3] .= ''; $data[3] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= __('Number of alerts match from'); $data[3] .= ''; $data[3] .= ''; @@ -742,7 +764,7 @@ foreach ($simple_alerts as $alert) { $data[3] .= ''; $data[3] .= ''; $data[3] .= ''; - $data[3] .= ''; + $data[3] .= ''; $data[3] .= __('Threshold'); $data[3] .= ''; $data[3] .= ''; @@ -766,7 +788,13 @@ foreach ($simple_alerts as $alert) { $data[3] .= ''; $data[3] .= ''; $data[3] .= ''; - $data[3] .= html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true); + $data[3] .= html_print_submit_button( + __('Add'), + 'addbutton', + false, + ['class' => 'sub next right'], + true + ); $data[3] .= ''; $data[3] .= ''; } @@ -775,12 +803,24 @@ foreach ($simple_alerts as $alert) { 1 => 'action_buttons', 4 => 'action_buttons', ]; - $data[4] = ''; + $data[4] = ''; if ($alert['disabled']) { - $data[4] .= html_print_input_image('enable', 'images/lightbulb_off.png', 1, 'padding:0px', true); + $data[4] .= html_print_input_image( + 'enable', + 'images/lightbulb_off.png', + 1, + 'padding:0px', + true + ); $data[4] .= html_print_input_hidden('enable_alert', 1, true); } else { - $data[4] .= html_print_input_image('disable', 'images/lightbulb.png', 1, 'padding:0px;', true); + $data[4] .= html_print_input_image( + 'disable', + 'images/lightbulb.png', + 1, + 'padding:0px;', + true + ); $data[4] .= html_print_input_hidden('disable_alert', 1, true); } @@ -789,12 +829,26 @@ foreach ($simple_alerts as $alert) { // To manage alert is necessary LW permissions in the agent group if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { - $data[4] .= ''; + $data[4] .= ''; if (!$alert['standby']) { - $data[4] .= html_print_input_image('standby_off', 'images/bell.png', 1, 'padding:0px;', true); + $data[4] .= html_print_input_image( + 'standby_off', + 'images/bell.png', + 1, + 'padding:0px;', + true, + ['class' => 'invert_filter'] + ); $data[4] .= html_print_input_hidden('standbyon_alert', 1, true); } else { - $data[4] .= html_print_input_image('standby_on', 'images/bell_pause.png', 1, 'padding:0px;', true); + $data[4] .= html_print_input_image( + 'standby_on', + 'images/bell_pause.png', + 1, + 'padding:0px;', + true, + ['class' => 'invert_filter'] + ); $data[4] .= html_print_input_hidden('standbyoff_alert', 1, true); } @@ -809,7 +863,7 @@ foreach ($simple_alerts as $alert) { if ($policyInfo === false) { $data[1] .= ''; } else { - $img = 'images/policies.png'; + $img = 'images/policies_mc.png'; $data[1] .= ' '.html_print_image($img, true, ['title' => $policyInfo['name']]).''; } @@ -818,7 +872,7 @@ foreach ($simple_alerts as $alert) { // To manage alert is necessary LW permissions in the agent group if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { - $data[4] .= ''; + $data[4] .= ''; $is_cluster = (bool) get_parameter('id_cluster'); if (!$is_cluster) { if ($alert['disabled']) { @@ -829,20 +883,20 @@ foreach ($simple_alerts as $alert) { ); } else { $data[4] .= ''; - $data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action')]); + $data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']); $data[4] .= ''; } } - $data[4] .= html_print_input_image('delete', 'images/cross.png', 1, '', true, ['title' => __('Delete')]); + $data[4] .= html_print_input_image('delete', 'images/cross.png', 1, '', true, ['title' => __('Delete'), 'class' => 'invert_filter']); $data[4] .= html_print_input_hidden('delete_alert', 1, true); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[4] .= ''; if ($is_cluster) { - $data[4] .= ''; + $data[4] .= ''; - $data[4] .= html_print_input_image('update', 'images/builder.png', 1, '', true, ['title' => __('Update')]); + $data[4] .= html_print_input_image('update', 'images/builder.png', 1, '', true, ['title' => __('Update'), 'class' => 'invert_filter']); $data[4] .= html_print_input_hidden('upd_alert', 1, true); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); @@ -851,8 +905,8 @@ foreach ($simple_alerts as $alert) { } if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) { - $data[4] .= ''; - $data[4] .= html_print_input_image('view_alert', 'images/eye.png', 1, '', true, ['title' => __('View alert advanced details')]); + $data[4] .= ''; + $data[4] .= html_print_input_image('view_alert', 'images/operation.png', 1, '', true, ['title' => __('View alert advanced details'), 'class' => 'invert_filter']); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[4] .= ''; } @@ -927,37 +981,109 @@ if (! $id_agente) { $("input[name=disable]").attr ("title", "") .hover (function () { - $(this).attr ("src", ); + $(this).attr ("src", + + ); }, function () { - $(this).attr ("src", ); + $(this).attr ("src", + 'invert_filter'], + true + ).'"'; + ?> + ); } ); $("input[name=enable]").attr ("title", "") .hover (function () { - $(this).attr ("src", ); + $(this).attr ("src", + 'invert_filter'], + true + ).'"'; + ?> + ); }, function () { - $(this).attr ("src", ); + $(this).attr ("src", + + ); } ); $("input[name=standby_on]").attr ("title", "") .hover (function () { - $(this).attr ("src", ); + $(this).attr ("src", + 'invert_filter'], + true + ).'"'; + ?> + ); }, function () { - $(this).attr ("src", ); + $(this).attr ("src", + 'invert_filter'], + true + ).'"'; + ?> + ); } ); $("input[name=standby_off]").attr ("title", "") .hover (function () { - $(this).attr ("src", ); + $(this).attr ("src", + 'invert_filter'], + true + ).'"'; + ?> + ); }, function () { - $(this).attr ("src", ); + $(this).attr ("src", + 'invert_filter'], + true + ).'"'; + ?> + ); } ); diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index c94c0f7025..36db141b02 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -65,6 +65,7 @@ $searchType = get_parameter('search_type', ''); $priority = get_parameter('priority', ''); $searchFlag = get_parameter('search', 0); $enabledisable = get_parameter('enabledisable', ''); +$status_alert = get_parameter('status_alert', ''); $standby = get_parameter('standby', ''); $pure = get_parameter('pure', 0); $ag_group = get_parameter('ag_group', 0); @@ -433,11 +434,11 @@ if ($id_agente) { $buttons = [ 'list' => [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List alerts')]).'', + 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List alerts'), 'class' => 'invert_filter']).'', ], 'builder' => [ 'active' => false, - 'text' => ''.html_print_image('images/pen.png', true, ['title' => __('Builder alert')]).'', + 'text' => ''.html_print_image('images/pencil.png', true, ['title' => __('Builder alert'), 'class' => 'invert_filter']).'', ], ]; diff --git a/pandora_console/godmode/alerts/alert_special_days.php b/pandora_console/godmode/alerts/alert_special_days.php index 9f0dbffd4a..7a29f7758b 100644 --- a/pandora_console/godmode/alerts/alert_special_days.php +++ b/pandora_console/godmode/alerts/alert_special_days.php @@ -270,8 +270,8 @@ if ($delete_special_day) { } -echo ""; +echo ""; echo ""; echo ''; echo __('iCalendar(.ics) file').' '; @@ -329,12 +329,12 @@ if ($display_range) { $html .= '"><< '; } - $html .= '['.$display_range.']'; + $html .= '['.$display_range.']'; $html .= ' >>'; } else { - $html .= '['.__('Default').'] '; + $html .= '['.__('Default').'] '; $html .= '<< '; @@ -472,7 +472,7 @@ for ($month = 1; $month <= 12; $month++) { if ($special_days != '') { foreach ($special_days as $special_day) { - $cal_table->data[$cal_line][$week] .= 'data[$cal_line][$week] .= '>'.html_print_image('images/wrench_orange.png', true).' '; + $cal_table->data[$cal_line][$week] .= '>'.html_print_image( + 'images/config.png', + true, + ['class' => 'invert_filter'] + ).' '; $cal_table->data[$cal_line][$week] .= 'data[$cal_line][$week] .= '>'.html_print_image('images/cross.png', true).''; + $cal_table->data[$cal_line][$week] .= '>'.html_print_image( + 'images/cross.png', + true, + ['class' => 'invert_filter'] + ).''; ; } @@ -542,7 +550,11 @@ for ($month = 1; $month <= 12; $month++) { $cal_table->data[$cal_line][$week] .= 'data[$cal_line][$week] .= '>'.html_print_image('images/plus.png', true).''; + $cal_table->data[$cal_line][$week] .= '>'.html_print_image( + 'images/add.png', + true, + ['class' => 'invert_filter'] + ).''; if ($week == 6) { $cal_line++; diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index cc762068ae..6763e7f6e5 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -401,16 +401,20 @@ foreach ($templates as $template) { $data = []; - $data[0] = ''.$template['name'].''; + if (check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')) { + $data[0] = ''.$template['name'].''; + } else { + $data[0] = $template['name']; + } $data[1] = ui_print_group_icon($template['id_group'], true); $data[3] = alerts_get_alert_templates_type_name($template['type']); if (is_central_policies_on_node() === false - && check_acl($config['id_user'], $template['id_group'], 'LM') + && check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM') ) { $table->cellclass[][4] = 'action_buttons'; - $data[4] = ''; + $data[4] = ''; $data[4] .= html_print_input_hidden('duplicate_template', 1, true); $data[4] .= html_print_input_hidden('source_id', $template['id'], true); $data[4] .= html_print_input_image( @@ -423,7 +427,7 @@ foreach ($templates as $template) { ); $data[4] .= ' '; - $data[4] .= ''; + $data[4] .= ''; $data[4] .= html_print_input_hidden('delete_template', 1, true); $data[4] .= html_print_input_hidden('id', $template['id'], true); $data[4] .= html_print_input_image( diff --git a/pandora_console/godmode/alerts/alert_view.php b/pandora_console/godmode/alerts/alert_view.php index e9ee2e4bea..d6bbaa5d32 100644 --- a/pandora_console/godmode/alerts/alert_view.php +++ b/pandora_console/godmode/alerts/alert_view.php @@ -58,11 +58,11 @@ $table_details->style[0] = 'font-weight: bold;'; $data = []; $data[0] = __('List alerts'); -$data[1] = ''.__('List alerts').''; +$data[1] = ''.__('List alerts').''; $table_details->data[] = $data; $data[0] = __('Agent'); -$data[1] = ''.$agent_alias.''; +$data[1] = ''.$agent_alias.''; $table_details->data[] = $data; $data[0] = __('Module'); @@ -89,13 +89,17 @@ if ($alert['times_fired'] > 0) { } $data[0] = __('Status'); -$data[1] = ''.ui_print_status_image($status, $title, true).''.$title; +$data[1] = ''.ui_print_status_image( + $status, + $title, + true +).''.$title; $table_details->data[] = $data; $priorities = get_priorities(); $data[0] = __('Priority'); -$data[1] = ' '.$priorities[$template['priority']]; +$data[1] = ' '.$priorities[$template['priority']]; $table_details->data[] = $data; $data[0] = __('Stand by'); @@ -107,7 +111,7 @@ if (enterprise_installed() && $alert['id_policy_alerts'] != 0) { if ($policyInfo === false) { $policy = __('N/A'); } else { - $img = 'images/policies.png'; + $img = 'images/policies_mc.png'; $policy = ''.html_print_image($img, true, ['title' => $policyInfo['name']]).''; } @@ -343,7 +347,7 @@ $table->head = []; $table->data = []; $table->styleTable = 'text-align: center;'; -echo ''; +echo ''; $table->head[0] = __('Actions'); $table->style[0] = 'font-weight: bold; text-align: left;'; @@ -418,7 +422,7 @@ $modes = []; $modes['firing'] = __('Firing'); $modes['recovering'] = __('Recovering'); -$table->data[1][1] = ''.__('Mode').''.html_print_select($modes, 'modes', 'firing', '', '', 0, true, false, false).''; +$table->data[1][1] = ''.__('Mode').''.html_print_select($modes, 'modes', 'firing', '', '', 0, true, false, false).''; html_print_table($table); unset($table); @@ -463,7 +467,10 @@ foreach ($actions as $kaction => $action) { $data[0] = ''.$data[0].''; } - $data[0] .= '('.sprintf(__('Field %s'), ($kdesc + 1)).')'; + $data[0] .= '('.sprintf( + __('Field %s'), + ($kdesc + 1) + ).')'; $data[1] = $template[$field]; $data[2] = $action[$field]; $data[3] = $firing_fields[$kaction]['value'][$field] = empty($action[$field]) ? $template[$field] : $action[$field]; @@ -494,20 +501,20 @@ foreach ($actions as $kaction => $action) { $firing_fields[$kaction]['command_preview'] = $command_preview; } -echo ''; +echo ''; html_print_table($table); unset($table); foreach ($actions as $kaction => $action) { - echo ''; + echo ''; ui_print_info_message(['title' => __('Command preview'), 'message' => $firing_fields[$kaction]['command_preview'], 'no_close' => true]); echo ''; } echo ''; // Firing table -echo ''; +echo ''; if ($template['recovery_notify'] == 0) { ui_print_info_message(['title' => __('Disabled'), 'message' => __('The alert recovering is disabled on this template.'), 'no_close' => true]); } else { @@ -541,7 +548,10 @@ if ($template['recovery_notify'] == 0) { $data[0] = ''.$data[0].''; } - $data[0] .= '('.sprintf(__('Field %s'), $fieldn).')'; + $data[0] .= '('.sprintf( + __('Field %s'), + $fieldn + ).')'; $data[1] = $firing_fields[$kaction]['value'][$field]; $data[2] = $template[$field.'_recovery']; $data[3] = $firing_fields[$kaction][$field.'_recovery']; diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 67a2837955..18454c86da 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -101,6 +101,15 @@ if ($id) { $group = $action['id_group']; $action_threshold = $action['action_threshold']; + + if (!check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access Alert Management' + ); + include 'general/noaccess.php'; + exit; + } } // Hidden div with help hint to fill with javascript. @@ -168,10 +177,16 @@ $table->data[1][0] = __('Group'); $own_info = get_user_info($config['id_user']); +$return_all_group = false; + +if (users_can_manage_group_all('LW') === true) { + $return_all_group = true; +} + $table->data[1][1] = ''.html_print_select_groups( false, 'LW', - true, + $return_all_group, 'group', $group, '', @@ -219,7 +234,7 @@ if ($is_central_policies_on_node === false $table->data[2][1] .= ''; } -$table->data[2][1] .= ''; +$table->data[2][1] .= ''; $table->colspan[2][1] = 2; $table->data[3][0] = __('Threshold'); diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php index f5596a58eb..88da3e5abf 100644 --- a/pandora_console/godmode/alerts/configure_alert_command.php +++ b/pandora_console/godmode/alerts/configure_alert_command.php @@ -21,7 +21,7 @@ check_login(); enterprise_hook('open_meta_frame'); -if (! check_acl($config['id_user'], 0, 'LM')) { +if (! check_acl($config['id_user'], 0, 'PM')) { db_pandora_audit( 'ACL Violation', 'Trying to access Alert Management' @@ -48,15 +48,18 @@ if (is_metaconsole() === true) { ); } - -if ($update_command) { - $id = (int) get_parameter('id'); +if ($id > 0) { $alert = alerts_get_alert_command($id); - if ($alert['internal']) { + + if ($alert['internal'] || !check_acl_restricted_all($config['id_user'], $alert['id_group'], 'PM')) { db_pandora_audit('ACL Violation', 'Trying to access Alert Management'); include 'general/noaccess.php'; exit; } +} + +if ($update_command) { + $alert = alerts_get_alert_command($id); $name = (string) get_parameter('name'); $command = (string) get_parameter('command'); @@ -216,12 +219,18 @@ $table->data['command'][1] = html_print_textarea( $is_central_policies_on_node ); +$return_all_group = false; + +if (users_can_manage_group_all('LM') === true) { + $return_all_group = true; +} + $table->colspan['group'][1] = 3; $table->data['group'][0] = __('Group'); $table->data['group'][1] = ''.html_print_select_groups( false, 'LM', - true, + $return_all_group, 'id_group', $id_group, false, diff --git a/pandora_console/godmode/alerts/configure_alert_special_days.php b/pandora_console/godmode/alerts/configure_alert_special_days.php index 3941cab2b7..14d85afc1d 100644 --- a/pandora_console/godmode/alerts/configure_alert_special_days.php +++ b/pandora_console/godmode/alerts/configure_alert_special_days.php @@ -12,7 +12,7 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// Load global vars +// Load global vars. global $config; require_once 'include/functions_alerts.php'; @@ -51,8 +51,14 @@ if ($date == '') { $date = date('Y-m-d', get_system_time()); } -// Header -ui_print_page_header(__('Alerts').' » '.__('Configure special day'), 'images/gm_alerts.png', false, '', true); +// Header. +ui_print_page_header( + __('Alerts').' » '.__('Configure special day'), + 'images/gm_alerts.png', + false, + '', + true +); $table = new stdClass(); $table->width = '100%'; @@ -64,19 +70,44 @@ $table->size = []; $table->size[0] = '20%'; $table->data = []; $table->data[0][0] = __('Date'); -$table->data[0][1] = html_print_input_text('date', $date, '', 10, 10, true); -$table->data[0][1] .= html_print_image('images/calendar_view_day.png', true, ['alt' => 'calendar', 'onclick' => "scwShow(scwID('text-date'),this);"]); +$table->data[0][1] = html_print_input_text( + 'date', + $date, + '', + 10, + 10, + true +); +$table->data[0][1] .= html_print_image( + 'images/calendar_view_day.png', + true, + [ + 'alt' => 'calendar', + 'onclick' => "scwShow(scwID('text-date'),this);", + 'class' => 'invert_filter', + ] +); $table->data[1][0] = __('Group'); $groups = users_get_groups(); $own_info = get_user_info($config['id_user']); -// Only display group "All" if user is administrator or has "LM" privileges +// Only display group "All" if user is administrator or has "LM" privileges. if (users_can_manage_group_all('LM')) { $display_all_group = true; } else { $display_all_group = false; } -$table->data[1][1] = html_print_select_groups(false, 'LW', $display_all_group, 'id_group', $id_group, '', '', 0, true); +$table->data[1][1] = html_print_select_groups( + false, + 'LW', + $display_all_group, + 'id_group', + $id_group, + '', + '', + 0, + true +); $table->data[2][0] = __('Same day of the week'); $days = []; @@ -87,10 +118,27 @@ $days['thursday'] = __('Thursday'); $days['friday'] = __('Friday'); $days['saturday'] = __('Saturday'); $days['sunday'] = __('Sunday'); -$table->data[2][1] = html_print_select($days, 'same_day', $same_day, '', '', 0, true, false, false); +$table->data[2][1] = html_print_select( + $days, + 'same_day', + $same_day, + '', + '', + 0, + true, + false, + false +); $table->data[3][0] = __('Description'); -$table->data[3][1] = html_print_textarea('description', 10, 30, $description, '', true); +$table->data[3][1] = html_print_textarea( + 'description', + 10, + 30, + $description, + '', + true +); echo ''; html_print_table($table); diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 4d4966878c..cbfa4f0d8d 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -55,6 +55,15 @@ if (defined('METACONSOLE')) { if ($a_template !== false) { // If user tries to duplicate/edit a template with group=ALL if ($a_template['id_group'] == 0) { + if (users_can_manage_group_all('LM') === false) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access Alert Management' + ); + include 'general/noaccess.php'; + exit; + } + // Header if (defined('METACONSOLE')) { alerts_meta_print_header(); @@ -826,7 +835,7 @@ if ($step == 2) { '', $is_central_policies_on_node ); - $table->data[6][1] .= ''; + $table->data[6][1] .= ''; $table->data[6][1] .= ' '.html_print_checkbox('matches_value', 1, $matches, true); $table->data[6][1] .= html_print_label( __('Trigger when matches the value'), @@ -950,7 +959,7 @@ if ($step == 2) { // TinyMCE. // triggering fields. // Basic. - $table->data['field'.$i][1] = ''; + $table->data['field'.$i][1] = ''; $table->data['field'.$i][1] .= __('Basic').' '; $table->data['field'.$i][1] .= html_print_radio_button_extended( 'editor_type_value_'.$i, @@ -983,7 +992,7 @@ if ($step == 2) { 1, 1, isset($fields[$i]) ? $fields[$i] : '', - 'style="min-height:40px;" class="fields"', + 'class="fields" min-height-40px', true, '', $is_central_policies_on_node @@ -991,7 +1000,7 @@ if ($step == 2) { // Recovery. // Basic. - $table->data['field'.$i][2] = ''; + $table->data['field'.$i][2] = ''; $table->data['field'.$i][2] .= __('Basic').' '; $table->data['field'.$i][2] .= html_print_radio_button_extended( 'editor_type_recovery_value_'.$i, @@ -1024,7 +1033,7 @@ if ($step == 2) { 1, 1, isset($fields_recovery[$i]) ? $fields_recovery[$i] : '', - 'style="min-height:40px" class="fields"', + 'class="fields min-height-40px"', true, '', $is_central_policies_on_node @@ -1091,18 +1100,18 @@ if ($step == 2) { $table->data[0][1] .= ' '.__('Group'); $groups = users_get_groups(); $own_info = get_user_info($config['id_user']); - // Only display group "All" if user is administrator or has "PM" privileges. - if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { - $display_all_group = true; - } else { - $display_all_group = false; + + $return_all_group = false; + + if (users_can_manage_group_all('LM') === true) { + $return_all_group = true; } $table->data[0][1] .= ' '; $table->data[0][1] .= ''.html_print_select_groups( false, 'AR', - $display_all_group, + $return_all_group, 'id_group', $id_group, '', @@ -1422,7 +1431,11 @@ if ($step == 2) { case "unknown": $("#template-value, #template-max, span#matches_value, #template-min").hide (); $("#template-example").show (); - + + if ($("#text-min_alerts").val() > 0 ) { + unknown = ; + } + /* Show example */ $("span#example").empty ().append (unknown); break; diff --git a/pandora_console/godmode/category/category.php b/pandora_console/godmode/category/category.php index b504ad0020..7285e402f6 100755 --- a/pandora_console/godmode/category/category.php +++ b/pandora_console/godmode/category/category.php @@ -38,14 +38,28 @@ if (defined('METACONSOLE')) { $buttons = [ 'list' => [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List categories')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('List categories'), + 'class' => 'invert_filter', + ] + ).'', ], ]; } else { $buttons = [ 'list' => [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List categories')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('List categories'), + 'class' => 'invert_filter', + ] + ).'', ], ]; } @@ -125,13 +139,29 @@ if (!empty($result)) { if (defined('METACONSOLE')) { $data[0] = "".$category['name'].''; - $data[1] = "".html_print_image('images/config.png', true, ['title' => 'Edit']).' '; - $data[1] .= ''.html_print_image('images/cross.png', true, ['title' => 'Delete']).''; + $data[1] = "".html_print_image( + 'images/config.png', + true, + ['title' => 'Edit'] + ).' '; + $data[1] .= ''.html_print_image( + 'images/cross.png', + true, + ['title' => 'Delete'] + ).''; } else { $data[0] = "".$category['name'].''; $table->cellclass[][1] = 'action_buttons'; - $data[1] = "".html_print_image('images/config.png', true, ['title' => 'Edit']).''; - $data[1] .= ''.html_print_image('images/cross.png', true, ['title' => 'Delete']).''; + $data[1] = "".html_print_image( + 'images/config.png', + true, + ['title' => 'Edit'] + ).''; + $data[1] .= ''.html_print_image( + 'images/cross.png', + true, + ['title' => 'Delete'] + ).''; } array_push($table->data, $data); @@ -145,7 +175,7 @@ if (!empty($result)) { } // Form to add new categories or search categories -echo ""; +echo ""; if (defined('METACONSOLE')) { echo ''; } else { diff --git a/pandora_console/godmode/category/edit_category.php b/pandora_console/godmode/category/edit_category.php index 0df7f7fafc..6278fb6dae 100755 --- a/pandora_console/godmode/category/edit_category.php +++ b/pandora_console/godmode/category/edit_category.php @@ -37,14 +37,28 @@ if (defined('METACONSOLE')) { $buttons = [ 'list' => [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List categories')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('List categories'), + 'class' => 'invert_filter', + ] + ).'', ], ]; } else { $buttons = [ 'list' => [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List categories')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('List categories'), + 'class' => 'invert_filter', + ] + ).'', ], ]; } @@ -120,9 +134,9 @@ else { echo ''; if (!defined('METACONSOLE')) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } echo ""; @@ -146,7 +160,7 @@ if (defined('METACONSOLE')) { } echo ''; - echo ""; + echo ""; html_print_label(__('Name'), 'name'); echo ''; diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index 781345fed7..5bf137f1ea 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -198,7 +198,7 @@ $(document).ready (function () { if(selected_fields_total === current_fields_size){ display_confirm_dialog( - "'.__('There must be at least one custom field. Timestamp will be set by default').''; ?>", + "'.__('There must be at least one custom field. Timestamp will be set by default').''; ?>", "", "", function () { diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index dfc1946b78..43f2162719 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -40,7 +40,15 @@ $strict_user = db_get_value( ); if ($id) { - $permission = events_check_event_filter_group($id); + $restrict_all_group = false; + + if (!users_can_manage_group_all('EW') === true + && !users_can_manage_group_all('EM') === true + ) { + $restrict_all_group = true; + } + + $permission = events_check_event_filter_group($id, $restrict_all_group); if (!$permission) { // User doesn't have permissions to see this filter include 'general/noaccess.php'; @@ -205,12 +213,16 @@ if ($update) { } if ($create) { - $id = db_process_sql_insert('tevent_filter', $values); + if (!empty($values['id_name'])) { + $id = db_process_sql_insert('tevent_filter', $values); - if ($id === false) { - ui_print_error_message('Error creating filter'); + if ($id === false) { + ui_print_error_message('Error creating filter'); + } else { + ui_print_success_message('Filter created successfully'); + } } else { - ui_print_success_message('Filter created successfully'); + ui_print_error_message('Filter name must not be empty'); } } @@ -272,12 +284,18 @@ $table->data[1][1] = ''.html_print_select_groups( $strict_user ).''; +$return_all_group = false; + +if (users_can_manage_group_all('AR') === true) { + $return_all_group = true; +} + $table->data[2][0] = ''.__('Group').''; $display_all_group = (users_is_admin() || users_can_manage_group_all('AR')); $table->data[2][1] = ''.html_print_select_groups( $config['id_user'], 'AR', - $display_all_group, + $return_all_group, 'id_group', $id_group, '', diff --git a/pandora_console/godmode/events/event_filter.php b/pandora_console/godmode/events/event_filter.php index 39f9c32d86..07e87284ee 100644 --- a/pandora_console/godmode/events/event_filter.php +++ b/pandora_console/godmode/events/event_filter.php @@ -29,12 +29,27 @@ if (!$event_w && !$event_m) { return; } + + $delete = (bool) get_parameter('delete', 0); $multiple_delete = (bool) get_parameter('multiple_delete', 0); if ($delete) { $id = (int) get_parameter('id'); + $filter_group = (int) db_get_value('id_group', 'tevent_filter', 'id_filter', $id); + + if (!check_acl_restricted_all($config['id_user'], $filter_group, 'EW') + && !check_acl_restricted_all($config['id_user'], $filter_group, 'EM') + ) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access events filter editor' + ); + include 'general/noaccess.php'; + return; + } + $id_filter = db_get_value('id_filter', 'tevent_filter', 'id_filter', $id); if ($id_filter === false) { @@ -151,13 +166,34 @@ foreach ($filters as $filter) { $data = []; $data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true); - $data[1] = ''.$filter['id_name'].''; + + if (!check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EW') + && !check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EM') + ) { + $data[1] = $filter['id_name']; + } else { + $data[1] = ''.$filter['id_name'].''; + } + $data[2] = ui_print_group_icon($filter['id_group_filter'], true); $data[3] = events_get_event_types($filter['event_type']); $data[4] = events_get_status($filter['status']); $data[5] = events_get_severity_types($filter['severity']); - $table->cellclass[][6] = 'action_buttons'; - $data[6] = "".html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; + $data[6] = ''; + + if (check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EW') + || check_acl_restricted_all($config['id_user'], $filter['id_group'], 'EM') + ) { + $table->cellclass[][6] = 'action_buttons'; + $data[6] = "".html_print_image( + 'images/cross.png', + true, + [ + 'title' => __('Delete'), + 'class' => 'invert_filter', + ] + ).''; + } array_push($table->data, $data); } @@ -167,9 +203,9 @@ if (isset($data)) { html_print_input_hidden('multiple_delete', 1); html_print_table($table); if (!is_metaconsole()) { - echo ""; + echo ""; } else { - echo ""; + echo ""; } html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); @@ -180,9 +216,9 @@ if (isset($data)) { } if (!defined('METACONSOLE')) { - echo ""; + echo ""; } else { - echo ""; + echo ""; } echo ''; diff --git a/pandora_console/godmode/events/event_responses.editor.php b/pandora_console/godmode/events/event_responses.editor.php index b5388c345b..bc57f85b40 100644 --- a/pandora_console/godmode/events/event_responses.editor.php +++ b/pandora_console/godmode/events/event_responses.editor.php @@ -39,6 +39,16 @@ $event_response_id = get_parameter('id_response', 0); if ($event_response_id > 0) { $event_response = db_get_row('tevent_response', 'id', $event_response_id); + + // ACL check for event response edition. + if (!check_acl_restricted_all($config['id_user'], $event_response['id_group'], 'PM')) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access Group Management' + ); + include 'general/noaccess.php'; + return; + } } else { $event_response = []; $event_response['name'] = ''; @@ -84,8 +94,14 @@ $data[1] = html_print_input_text( ); $data[1] .= html_print_input_hidden('id_response', $event_response['id'], true); +$return_all_group = false; + +if (users_can_manage_group_all('PM') === true) { + $return_all_group = true; +} + $data[2] = __('Group'); -$data[3] = html_print_select_groups(false, 'PM', true, 'id_group', $event_response['id_group'], '', '', '', true); +$data[3] = html_print_select_groups(false, 'PM', $return_all_group, 'id_group', $event_response['id_group'], '', '', '', true); $table->data[0] = $data; $data = []; @@ -143,13 +159,13 @@ $data[3] = html_print_select($types, 'type', $event_response['type'], '', '', '' $table->data[3] = $data; $data = []; -$data[0] = ''.__('Command').''.__('URL').''.ui_print_help_icon('response_macros', true); +$data[0] = ''.__('Command').''.__('URL').''.ui_print_help_icon('response_macros', true); $data[1] = html_print_textarea( 'target', 3, 1, $event_response['target'], - 'style="min-height:initial;"', + 'class="mh_initial"', true ); @@ -171,23 +187,23 @@ if (enterprise_installed()) { } } -$data[2] = ''.__('Server to execute command').''; -$data[3] = ''.html_print_select($servers_to_exec, 'server_to_exec', $event_response['server_to_exec'], '', '', '', true).''; +$data[2] = ''.__('Server to execute command').''; +$data[3] = ''.html_print_select($servers_to_exec, 'server_to_exec', $event_response['server_to_exec'], '', '', '', true).''; $table->data[4] = $data; $data = []; -$data[0] = ''.__('Command timeout (s)'); -$data[1] = ''.html_print_input_text('command_timeout', $event_response['command_timeout'], '', 4, 5, true); +$data[0] = ''.__('Command timeout (s)'); +$data[1] = ''.html_print_input_text('command_timeout', $event_response['command_timeout'], '', 4, 5, true); $table->data[5] = $data; if ($event_response_id == 0) { echo ''; html_print_table($table); if (!defined('METACONSOLE')) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } html_print_submit_button(__('Create'), 'create_response_button', false, ['class' => 'sub next']); @@ -197,9 +213,9 @@ if ($event_response_id == 0) { echo ''; html_print_table($table); if (!defined('METACONSOLE')) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } html_print_submit_button(__('Update'), 'update_response_button', false, ['class' => 'sub next']); diff --git a/pandora_console/godmode/events/event_responses.list.php b/pandora_console/godmode/events/event_responses.list.php index 88ea2b424b..579317c534 100644 --- a/pandora_console/godmode/events/event_responses.list.php +++ b/pandora_console/godmode/events/event_responses.list.php @@ -55,21 +55,44 @@ $table->head[3] = __('Actions'); $table->data = []; foreach ($event_responses as $response) { + if (!check_acl_restricted_all($config['id_user'], $response['id_group'], 'PM')) { + continue; + } + $data = []; $data[0] = ''.$response['name'].''; $data[1] = $response['description']; $data[2] = ui_print_group_icon($response['id_group'], true); $table->cellclass[][3] = 'action_buttons'; - $data[3] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; - $data[3] .= ''.html_print_image('images/pencil.png', true, ['title' => __('Edit')]).''; + $data[3] = ''.html_print_image( + 'images/cross.png', + true, + [ + 'title' => __('Delete'), + 'class' => 'invert_filter', + ] + ).''; + $data[3] .= ''.html_print_image( + 'images/pencil.png', + true, + [ + 'title' => __('Edit'), + 'class' => 'invert_filter', + ] + ).''; $table->data[] = $data; } html_print_table($table); -echo ''; +echo ''; echo ''; -html_print_submit_button(__('Create response'), 'create_response_button', false, ['class' => 'sub next']); +html_print_submit_button( + __('Create response'), + 'create_response_button', + false, + ['class' => 'sub next'] +); echo ''; echo ''; diff --git a/pandora_console/godmode/events/events.php b/pandora_console/godmode/events/events.php index f214025d7c..f32c07ec43 100644 --- a/pandora_console/godmode/events/events.php +++ b/pandora_console/godmode/events/events.php @@ -34,25 +34,53 @@ $section = (string) get_parameter('section', 'filter'); if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM')) { $buttons['view'] = [ 'active' => false, - 'text' => ''.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).'', + 'text' => ''.html_print_image( + 'images/events_list.png', + true, + [ + 'title' => __('Event list'), + 'class' => 'invert_filter', + ] + ).'', 'operation' => true, ]; $buttons['filter'] = [ 'active' => false, - 'text' => ''.html_print_image('images/filter_mc.png', true, ['title' => __('Filter list')]).'', + 'text' => ''.html_print_image( + 'images/filter_mc.png', + true, + [ + 'title' => __('Filter list'), + 'class' => 'invert_filter', + ] + ).'', ]; } if (check_acl($config['id_user'], 0, 'PM')) { $buttons['responses'] = [ 'active' => false, - 'text' => ''.html_print_image('images/event_responses.png', true, ['title' => __('Event responses')]).'', + 'text' => ''.html_print_image( + 'images/event_responses.png', + true, + [ + 'title' => __('Event responses'), + 'class' => 'invert_filter', + ] + ).'', ]; $buttons['fields'] = [ 'active' => false, - 'text' => ''.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'', + 'text' => ''.html_print_image( + 'images/custom_columns.png', + true, + [ + 'title' => __('Custom fields'), + 'class' => 'invert_filter', + ] + ).'', ]; } diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index eea6c6818f..6a46795322 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -13,6 +13,8 @@ // GNU General Public License for more details. check_login(); +global $config; + if (! check_acl($config['id_user'], 0, 'PM')) { db_pandora_audit( 'ACL Violation', @@ -144,11 +146,6 @@ $table->head[] = __('Login Function'); $table->head[] = __('Agent operation tab'); $table->head[] = __('Agent godmode tab'); $table->head[] = __('Operation'); -/* - $table->width = array(); - $table->width[] = '30%'; - $table->width[] = '30%'; -*/ $table->width = '100%'; $table->class = 'info_table'; @@ -174,7 +171,7 @@ foreach ($extensions as $file => $extension) { if (!$extension['enabled']) { $on = html_print_image('images/dot_green.disabled.png', true); $off = html_print_image('images/dot_red.disabled.png', true); - $data[] = ''.$file.''; + $data[] = ''.$file.''; // Get version of this extensions if ($config['extensions'][$file]['operation_menu']) { @@ -259,7 +256,7 @@ foreach ($extensions as $file => $extension) { if (!$extension['enabled']) { $data[] = ''.html_print_image('images/cross.disabled.png', true).''.' '.html_print_image('images/lightbulb_off.png', true).''; } else { - $data[] = ''.html_print_image('images/cross.png', true).''.' '.html_print_image('images/lightbulb.png', true).''; + $data[] = ''.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).''.' '.html_print_image('images/lightbulb.png', true).''; } } else { $data[] = ''; diff --git a/pandora_console/godmode/gis_maps/configure_gis_map.php b/pandora_console/godmode/gis_maps/configure_gis_map.php index 3a09a31f73..ecd8959a0c 100644 --- a/pandora_console/godmode/gis_maps/configure_gis_map.php +++ b/pandora_console/godmode/gis_maps/configure_gis_map.php @@ -30,6 +30,14 @@ require_once 'include/functions_gis.php'; $idMap = (int) get_parameter('map_id', 0); $action = get_parameter('action', 'new_map'); +$gis_map_group = db_get_value('group_id', 'tgis_map', 'id_tgis_map', $idMap); + +if ($idMap > 0 && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW') && !check_acl_restricted_all($config['id_user'], $gis_map_group, 'MW')) { + db_pandora_audit('ACL Violation', 'Trying to access map builder'); + include 'general/noaccess.php'; + return; +} + $sec2 = get_parameter_get('sec2'); $sec2 = safe_url_extraclean($sec2); @@ -259,7 +267,10 @@ $buttons['gis_maps_list'] = [ 'text' => ''.html_print_image( 'images/list.png', true, - ['title' => __('GIS Maps list')] + [ + 'title' => __('GIS Maps list'), + 'class' => 'invert_filter', + ] ).'', ]; if ($idMap) { @@ -268,7 +279,10 @@ if ($idMap) { 'text' => ''.html_print_image( 'images/op_gis.png', true, - ['title' => __('View GIS')] + [ + 'title' => __('View GIS'), + 'class' => 'invert_filter', + ] ).'', ]; } @@ -440,27 +454,54 @@ foreach ($listConnectionTemp as $connectionTemp) { } $table->data[1][0] = __('Add Map connection').$iconError; -$table->data[1][1] = " +$table->data[1][1] = " - + ".html_print_select($listConnection, 'map_connection', '', '', '', '0', true)." - - ".html_print_image('images/add.png', true)." + + ".html_print_image( + 'images/add.png', + true, + ['class' => 'invert_filter'] +)." ".gis_add_conection_maps_in_form($map_connection_list).' '; $own_info = get_user_info($config['id_user']); -if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'MM')) { - $display_all_group = true; -} else { - $display_all_group = false; + +$return_all_group = false; + +if (users_can_manage_group_all('MM') === true) { + $return_all_group = true; } $table->data[2][0] = __('Group'); -$table->data[2][1] = html_print_select_groups(false, 'IW', $display_all_group, 'map_group_id', $map_group_id, '', '', '', true); +$table->data[2][1] = html_print_select_groups( + false, + 'IW', + $return_all_group, + 'map_group_id', + $map_group_id, + '', + '', + '', + true, + false, + true, + '', + false, + false, + false, + false, + 'id_grupo', + false, + false, + false, + '250px' +); $table->data[3][0] = __('Default zoom'); $table->data[3][1] = html_print_input_text('map_zoom_level', $map_zoom_level, '', 2, 4, true).html_print_input_hidden('map_levels_zoom', $map_levels_zoom, true); @@ -495,10 +536,10 @@ $table->valign[1] = 'top'; $table->data = []; $table->data[0][0] = ''.__('List of layers').''; -$table->data[0][1] = ''.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add"', true).''; +$table->data[0][1] = ''.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add"', true).''; $table->data[1][0] = ''; -$table->data[1][1] = ' +$table->data[1][1] = ' '.__('Layer name').': @@ -622,7 +663,18 @@ echo ''; - '']); ?> + + '', + 'class' => 'invert_filter', + ] + ); + ?> + @@ -920,7 +972,15 @@ function getAgentRow (layerId, agentId, agentAlias) { var $deleteCol = $(""); var $agentAlias = $("" + agentAlias + ""); - var $removeBtn = $(''); + var $removeBtn = $(' + 'invert_filter'] + ); + ?> + '); $removeBtn.click(function (event) { var $layerRow = $("tr#layer_row_" + layerId); @@ -976,7 +1036,7 @@ function getGroupRow (layerId, groupId, groupName, agentId, agentAlias) { + "" + agentAlias + "" + ")" + ""); - var $removeBtn = $(''); + var $removeBtn = $(' 'invert_filter']); ?>'); $removeBtn.click(function (event) { var $layerRow = $("tr#layer_row_" + layerId); @@ -1054,8 +1114,8 @@ function getLayerRow (layerId, layerData) { var $layerName = $("" + layerData.name + ""); var $sortUpBtn = $(""); var $sortDownBtn = $(""); - var $editBtn = $(''); - var $removeBtn = $(''); + var $editBtn = $(' 'invert_filter']); ?>'); + var $removeBtn = $(' 'invert_filter']); ?>'); $sortUpBtn.click(moveLayerRowUpOnClick); $sortDownBtn.click(moveLayerRowDownOnClick); diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 019a981578..7b9b43ed41 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -66,7 +66,7 @@ if ($id_group) { ui_print_error_message(__('There was a problem loading group')); echo ''; echo ''; - echo ' '; + echo ' '; echo ''; echo ''; include 'general/footer.php'; @@ -210,11 +210,11 @@ $table->data[$i][1] = html_print_input_text('description', $description, '', 60, $i++; $table->data[$i][0] = __('Contact').ui_print_help_tip(__('Contact information accessible through the _groupcontact_ macro'), true); -$table->data[$i][1] = html_print_textarea('contact', 4, 40, $contact, "style='min-height: 0px;'", true); +$table->data[$i][1] = html_print_textarea('contact', 4, 40, $contact, "class='min-height-0px'", true); $i++; $table->data[$i][0] = __('Other').ui_print_help_tip(__('Information accessible through the _group_other_ macro'), true); -$table->data[$i][1] = html_print_textarea('other', 4, 40, $other, "style='min-height: 0px;'", true); +$table->data[$i][1] = html_print_textarea('other', 4, 40, $other, "class='min-height-0px'", true); $i++; $isFunctionSkins = enterprise_include_once('include/functions_skins.php'); diff --git a/pandora_console/godmode/groups/configure_modu_group.php b/pandora_console/godmode/groups/configure_modu_group.php index 71503a6e74..95beb0d39d 100644 --- a/pandora_console/godmode/groups/configure_modu_group.php +++ b/pandora_console/godmode/groups/configure_modu_group.php @@ -46,7 +46,7 @@ if ($id_group) { ui_print_error_message(__('There was a problem loading group')); echo ''; echo ''; - echo ' '; + echo ' '; echo ''; echo ''; include 'general/footer.php'; diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index ad6eb27adf..f1a0cd607e 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -251,7 +251,16 @@ if (is_ajax()) { $tab = (string) get_parameter('tab', 'groups'); -if ($tab != 'credbox' && ! check_acl($config['id_user'], 0, 'PM')) { +if ($tab != 'credbox' && ! check_acl( + $config['id_user'], + 0, + 'PM' +) && ! check_acl( + $config['id_user'], + 0, + 'AW' +) +) { db_pandora_audit( 'ACL Violation', 'Trying to access Group Management' @@ -282,6 +291,7 @@ $buttons['tree'] = [ true, [ 'title' => __('Tree Group view'), + 'class' => 'invert_filter', ] ).'', ]; @@ -293,6 +303,7 @@ $buttons['groups'] = [ true, [ 'title' => __('Group view'), + 'class' => 'invert_filter', ] ).'', ]; @@ -304,6 +315,7 @@ $buttons['credbox'] = [ true, [ 'title' => __('Credential Store'), + 'class' => 'invert_filter', ] ).'', ]; @@ -670,7 +682,7 @@ if ($tab == 'tree') { } $form = ""; - $form .= ""; + $form .= ""; $form .= ''.__('Search').' '; $form .= html_print_input_text('search', $search, '', 100, 100, true); $form .= ''; @@ -835,7 +847,7 @@ if ($tab == 'tree') { if (check_acl($config['id_user'], 0, 'PM')) { echo ''; - echo ''; + echo ''; html_print_submit_button(__('Create group'), 'crt', false, 'class="sub next"'); echo ''; echo ''; diff --git a/pandora_console/godmode/massive/massive_add_action_alerts.php b/pandora_console/godmode/massive/massive_add_action_alerts.php index 4107c193ec..f9a02c8545 100755 --- a/pandora_console/godmode/massive/massive_add_action_alerts.php +++ b/pandora_console/godmode/massive/massive_add_action_alerts.php @@ -1,17 +1,32 @@ data[1][0] .= ''; $table->data[1][1] = html_print_select([], 'id_agents[]', 0, false, __('Any'), '', true, true); $table->data[2][0] = __('Alert templates'); -$table->data[2][0] .= ''; -$table->data[2][0] .= html_print_image('images/spinner.png', true); -$table->data[2][0] .= ''; $table->data[2][1] = html_print_select([], 'id_alert_templates[]', '', '', '', '', true, true, true, '', $alert_templates == 0); $table->data[2][2] = __('When select agents'); $table->data[2][2] .= ''; @@ -251,36 +263,20 @@ $agents_with_templates_json = json_encode($agents_with_templates_json); echo ""; -echo ''; -html_print_input_hidden('add', 1); -html_print_submit_button(__('Add'), 'go', false, 'class="sub add"'); -echo ''; +attachActionButton('add', 'create', $table->width); + echo ''; echo ' '; +ui_require_javascript_file('massive_operations'); ui_require_jquery_file('form'); ui_require_jquery_file('pandora.controls'); ?> - - "+value+""; }); $("#id_alert_templates").append (options); - $("#template_loading").hide (); + hideSpinner(); $select_template.enable (); }, "json" diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 95ab1948fe..f180488451 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -382,6 +382,7 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, ' $sub['tools/diagnostics']['text'] = __('Diagnostic info'); $sub['tools/diagnostics']['id'] = 'Diagnostic info'; enterprise_hook('omnishell'); + enterprise_hook('ipam_submenu'); $sub['godmode/setup/news']['text'] = __('Site news'); $sub['godmode/setup/news']['id'] = 'Site news'; diff --git a/pandora_console/godmode/module_library/module_library_view.php b/pandora_console/godmode/module_library/module_library_view.php index 439aa5719e..f69c7779fb 100644 --- a/pandora_console/godmode/module_library/module_library_view.php +++ b/pandora_console/godmode/module_library/module_library_view.php @@ -42,18 +42,18 @@ if (! check_acl($config['id_user'], 0, 'AR')) { if (check_acl($config['id_user'], 0, 'PM') && enterprise_installed()) { $buttons['setup'] = [ 'active' => false, - 'text' => ''.html_print_image('images/gm_setup.png', true, ['title' => __('Setup')]).'', + 'text' => ''.html_print_image('images/gm_setup.png', true, ['title' => __('Setup'), 'class' => 'invert_filter']).'', ]; } $buttons['categories'] = [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Categories')]).'', + 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Categories'), 'class' => 'invert_filter']).'', ]; $buttons['view'] = [ 'active' => false, - 'text' => ''.html_print_image('images/operation.png', true, ['title' => __('View')]).'', + 'text' => ''.html_print_image('images/eye_show.png', true, ['title' => __('View'), 'class' => 'invert_filter']).'', ]; @@ -126,7 +126,7 @@ switch ($tab) { echo ''; echo ' - '.__('View all categories').' + '.__('View all categories').' '; echo ''; echo $sidebar_library; diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php index 0b0d7afea5..6ee07af31c 100644 --- a/pandora_console/godmode/modules/manage_nc_groups.php +++ b/pandora_console/godmode/modules/manage_nc_groups.php @@ -264,7 +264,7 @@ foreach ($groups as $group) { $table->cellclass[][1] = 'action_buttons'; if (is_management_allowed() === true) { $data[1] = "".html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; + href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; } array_push($table->data, $data); @@ -279,7 +279,7 @@ if (isset($data)) { html_print_input_hidden('multiple_delete', 1); html_print_table($table); if (is_management_allowed() === true) { - echo ""; + echo ""; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo ''; } @@ -291,7 +291,7 @@ if (isset($data)) { if (is_management_allowed() === true) { echo ''; - echo ''; + echo ''; html_print_input_hidden('new', 1); html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"'); echo ''; diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 01107de845..2594d4c023 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -64,19 +64,6 @@ if (defined('METACONSOLE')) { $help_header = 'network_component_tab'; } - ui_print_page_header( - __('Remote components'), - '', - false, - $help_header, - true, - '', - false, - 'modulemodal', - GENERIC_SIZE_TEXT, - '', - __('Configuration').' / '.__('Templates').' / '.__('Remote components') - ); $sec = 'gmodules'; } @@ -824,9 +811,12 @@ foreach ($components as $component) { switch ($component['id_modulo']) { case MODULE_NETWORK: $data[1] .= html_print_image( - 'images/network.png', + 'images/op_network.png', true, - ['title' => __('Network module')] + [ + 'title' => __('Network module'), + 'class' => 'invert_filter', + ] ); break; @@ -834,7 +824,10 @@ foreach ($components as $component) { $data[1] .= html_print_image( 'images/wmi.png', true, - ['title' => __('WMI module')] + [ + 'title' => __('WMI module'), + 'class' => 'invert_filter', + ] ); break; @@ -842,7 +835,10 @@ foreach ($components as $component) { $data[1] .= html_print_image( 'images/plugin.png', true, - ['title' => __('Plug-in module')] + [ + 'title' => __('Plug-in module'), + 'class' => 'invert_filter', + ] ); break; @@ -850,7 +846,10 @@ foreach ($components as $component) { $data[1] .= html_print_image( 'images/wand.png', true, - ['title' => __('Wizard module')] + [ + 'title' => __('Wizard module'), + 'class' => 'invert_filter', + ] ); break; @@ -860,13 +859,29 @@ foreach ($components as $component) { } $data[2] = ui_print_moduletype_icon($component['type'], true); - $data[3] = "".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').''; + $data[3] = "".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').''; $data[4] = network_components_get_group_name($component['id_group']); $data[5] = $component['max'].' / '.$component['min']; $table->cellclass[][6] = 'action_buttons'; - $data[6] = ''.html_print_image('images/copy.png', true, ['alt' => __('Duplicate'), 'title' => __('Duplicate')]).''; - $data[6] .= ''.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).''; + $data[6] = ''.html_print_image( + 'images/copy.png', + true, + [ + 'alt' => __('Duplicate'), + 'title' => __('Duplicate'), + 'class' => 'invert_filter', + ] + ).''; + $data[6] .= ''.html_print_image( + 'images/cross.png', + true, + [ + 'alt' => __('Delete'), + 'title' => __('Delete'), + 'class' => 'invert_filter', + ] + ).''; array_push($table->data, $data); } @@ -885,7 +900,7 @@ if (isset($data)) { true, 'pagination-bottom' ); - echo ""; + echo ""; html_print_submit_button( __('Delete'), 'delete_btn', @@ -904,7 +919,7 @@ if (isset($data)) { } echo ''; -echo ''; +echo ''; html_print_input_hidden('new_component', 1); html_print_select( [ @@ -924,7 +939,7 @@ html_print_submit_button( __('Create'), 'crt', false, - 'class="sub next" style="margin-left: 5px;"' + 'class="sub next mrgn_lft_5px"' ); echo ''; echo ''; 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 fc274b9085..dde4b784d6 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -48,7 +48,9 @@ if (enterprise_installed()) { 'basic' => __('Basic'), 'advanced' => __('Advanced'), ]; - $table->data[0][3] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false).' '.ui_print_help_icon('meta_access', true); + // TODO review help tips on meta. + $table->data[0][3] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false).' '; + // .ui_print_help_icon('meta_access', true) } else { $table->data[0][2] = ''; $table->data[0][3] = html_print_input_hidden('wizard_level', $wizard_level, true); @@ -139,7 +141,14 @@ $table->data[2][3] = html_print_extended_select_for_time('module_interval', $mod $table->data[3][0] = __('Dynamic Interval'); $table->data[3][1] = html_print_extended_select_for_time('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px', false); -$table->data[3][1] .= ''.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).''; +$table->data[3][1] .= ''.html_print_image( + 'images/cog.png', + true, + [ + 'title' => __('Advanced options Dynamic Threshold'), + 'class' => 'invert_filter', + ] +).''; $table->data[3][2] = ''.__('Dynamic Min. ').''; $table->data[3][2] .= html_print_input_text('dynamic_min', $dynamic_min, '', 10, 255, true); @@ -351,10 +360,8 @@ $table->data[$next_row][1] .= html_print_select_from_sql( 'width: 200px', '5' ); -$table->data[$next_row][2] = html_print_image('images/darrowright.png', true, ['id' => 'right', 'title' => __('Add tags to module')]); -// html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module'))); -$table->data[$next_row][2] .= ''.html_print_image('images/darrowleft.png', true, ['id' => 'left', 'title' => __('Delete tags to module')]); -// html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module'))); +$table->data[$next_row][2] = html_print_image('images/darrowright.png', true, ['id' => 'right', 'title' => __('Add tags to module'), 'class' => 'invert_filter']); +$table->data[$next_row][2] .= ''.html_print_image('images/darrowleft.png', true, ['id' => 'left', 'title' => __('Delete tags to module'), 'class' => 'invert_filter']); $table->data[$next_row][3] = ''.__('Tags selected').''; $table->data[$next_row][3] .= html_print_select_from_sql( "SELECT name AS name1, name AS name2 diff --git a/pandora_console/godmode/modules/manage_network_components_form_wizard.php b/pandora_console/godmode/modules/manage_network_components_form_wizard.php index 0cc411e514..4ee77bafb5 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_wizard.php +++ b/pandora_console/godmode/modules/manage_network_components_form_wizard.php @@ -59,7 +59,7 @@ function generateExtraFields($extra_fields, $protocol) } $data = []; - $data[0] = ''.$extraFieldText.''; + $data[0] = ''.$extraFieldText.''; $data[1] = html_print_input_text_extended( 'extra_field_'.$protocol.'_'.$idField, $field, @@ -88,6 +88,7 @@ function generateExtraFields($extra_fields, $protocol) [ 'title' => __('Add a macro oid'), 'onclick' => 'manageComponentFields(\'add\', \'oid-list-'.$rowId.'\');', + 'class' => 'invert_filter', ] ), ], @@ -106,6 +107,7 @@ function generateExtraFields($extra_fields, $protocol) 'title' => __('Remove last macro oid'), 'onclick' => 'manageComponentFields(\'del\', \'oid-list-'.$rowId.'\');', 'style' => 'margin-left: 1em;', + 'class' => 'invert_filter', ] ), ], @@ -615,7 +617,7 @@ $table->style[0] = 'font-weight: bold;'; push_table_row($data, 'title-query-filters-wmiRow'); $data = []; -$data[0] = ''.__('Scan').''; +$data[0] = ''.__('Scan').''; $data[1] = html_print_input_text_extended( 'query_filter_scan', $query_filter['scan'], @@ -633,7 +635,7 @@ push_table_row($data, 'query-filter-scan-wmiRow'); if ($execution_type == EXECUTION_TYPE_NETWORK) { $data = []; - $data[0] = ''.__('Execution').''; + $data[0] = ''.__('Execution').''; $data[1] = html_print_input_text_extended( 'query_filter_execution', $query_filter['execution'], diff --git a/pandora_console/godmode/modules/manage_network_templates.php b/pandora_console/godmode/modules/manage_network_templates.php index 044c065c9c..9305bd6de1 100644 --- a/pandora_console/godmode/modules/manage_network_templates.php +++ b/pandora_console/godmode/modules/manage_network_templates.php @@ -233,7 +233,7 @@ $table->head[0] = html_print_checkbox('all_delete', 0, false, true, false); ; $table->head[1] = __('Name'); $table->head[2] = __('Description'); -$table->head[3] = ''.__('Action').''; +$table->head[3] = ''.__('Action').''; $table->size = []; $table->size[0] = '20px'; $table->size[2] = '65%'; @@ -256,7 +256,10 @@ foreach ($result as $row) { $row['id_np'], '', true, - ['onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;'] + [ + 'onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;', + 'class' => 'invert_filter', + ] ); $data[3] .= html_print_input_image( 'export_profile', @@ -264,10 +267,13 @@ foreach ($result as $row) { $row['id_np'], '', true, - ['title' => 'Export to CSV'] + [ + 'title' => 'Export to CSV', + 'class' => 'invert_filter', + ] ); - $data[3] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; - $data[3] .= ''.html_print_image('images/csv.png', true, ['title' => __('Export to CSV')]).''; + $data[3] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; + $data[3] .= ''.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).''; array_push($table->data, $data); } @@ -278,7 +284,7 @@ if (!empty($table->data)) { ui_pagination($count_network_templates, false, $offset); html_print_table($table); ui_pagination($count_network_templates, false, $offset, 0, false, 'offset', true, 'pagination-bottom'); - echo ""; + echo ""; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo ''; echo ''; @@ -287,7 +293,7 @@ if (!empty($table->data)) { } echo ''; -echo ''; +echo ''; html_print_submit_button(__('Create'), 'crt', '', 'class="sub next"'); echo ''; diff --git a/pandora_console/godmode/modules/manage_network_templates_form.php b/pandora_console/godmode/modules/manage_network_templates_form.php index 6f34209672..795e3c8c9b 100644 --- a/pandora_console/godmode/modules/manage_network_templates_form.php +++ b/pandora_console/godmode/modules/manage_network_templates_form.php @@ -161,7 +161,7 @@ echo ''.''.__('Description').''.''; echo ''; html_print_textarea('description', 2, 60, $description); echo ''; -echo ''; +echo ''; if ($id_np > 0) { html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"'); } else { @@ -245,7 +245,7 @@ if ($id_np > 0) { unset($table); - echo "".__('Add modules').''; + echo "".__('Add modules').''; unset($table); @@ -266,7 +266,7 @@ if ($id_np > 0) { $filter .= ''; $group_filter = ''; - $group_filter .= ''; + $group_filter .= ''; $result = db_get_all_rows_in_table('tnetwork_component_group', 'name'); if ($result === false) { $result = []; @@ -288,7 +288,7 @@ if ($id_np > 0) { $groups_compound[$row['id_sg']] .= $row['name']; } - $group_filter .= html_print_select($groups_compound, 'ncgroup', $ncgroup, 'javascript:this.form.submit();', __('Group').' - '.__('All'), -1, true, false, true, '" style="width:350px'); + $group_filter .= html_print_select($groups_compound, 'ncgroup', $ncgroup, 'javascript:this.form.submit();', __('Group').' - '.__('All'), -1, true, false, true, '" class="w350px'); $group_filter .= ''; @@ -320,7 +320,7 @@ if ($id_np > 0) { } $components_select = ''; - $components_select .= html_print_select($components, 'components[]', $id_nc, '', '', -1, true, true, false, '" style="width:350px'); + $components_select .= html_print_select($components, 'components[]', $id_nc, '', '', -1, true, true, false, '" clas="w350px'); $table->data[0][0] = __('Filter'); $table->data[0][1] = $filter; diff --git a/pandora_console/godmode/modules/module_list.php b/pandora_console/godmode/modules/module_list.php index 02c0d9def8..864ebe32c2 100644 --- a/pandora_console/godmode/modules/module_list.php +++ b/pandora_console/godmode/modules/module_list.php @@ -77,7 +77,7 @@ foreach ($rows as $row) { echo " - ".html_print_image('images/'.$row['icon'], true, ['border' => '0'])." + ".html_print_image('images/'.$row['icon'], true, ['border' => '0', 'class' => 'invert_filter'])." ".$row['id_tipo']." diff --git a/pandora_console/godmode/netflow/nf_edit.php b/pandora_console/godmode/netflow/nf_edit.php index 2222c91d1a..51d999ef42 100644 --- a/pandora_console/godmode/netflow/nf_edit.php +++ b/pandora_console/godmode/netflow/nf_edit.php @@ -68,6 +68,19 @@ $multiple_delete = (bool) get_parameter('multiple_delete', 0); $id = (int) get_parameter('id'); $name = (string) get_parameter('name'); +if ($id > 0) { + $filter_group = db_get_value('id_group', 'tnetflow_filter', 'id_sg', $id); + + if (!check_acl_restricted_all($config['id_user'], $filter_group, 'AW')) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access events filter editor' + ); + include 'general/noaccess.php'; + return; + } +} + if ($delete) { $id_filter = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $id); $result = db_process_sql_delete( @@ -164,12 +177,24 @@ $total_filters = $total_filters[0]['total']; foreach ($filters as $filter) { $data = []; - $data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true); - $data[1] = ''.$filter['id_name'].''; + $data[0] = ''; + + if (check_acl_restricted_all($config['id_user'], $filter['id_group'], 'AW')) { + $data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true); + $data[1] = ''.$filter['id_name'].''; + } else { + $data[1] = $filter['id_name']; + } + + $data[2] = ui_print_group_icon($filter['id_group'], true, 'groups_small', '', !defined('METACONSOLE')); - $table->cellclass[][3] = 'action_buttons'; - $data[3] = "".html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; + $data[3] = ''; + + if (check_acl_restricted_all($config['id_user'], $filter['id_group'], 'AW')) { + $table->cellclass[][3] = 'action_buttons'; + $data[3] = "".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; + } array_push($table->data, $data); } @@ -178,7 +203,7 @@ if (isset($data)) { echo ""; html_print_input_hidden('multiple_delete', 1); html_print_table($table); - echo ""; + echo ""; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo ''; @@ -188,7 +213,7 @@ if (isset($data)) { } echo ''; -echo ""; +echo ""; html_print_submit_button(__('Create filter'), 'crt', false, 'class="sub wand"'); echo ''; echo ''; diff --git a/pandora_console/godmode/netflow/nf_edit_form.php b/pandora_console/godmode/netflow/nf_edit_form.php index f9c607c894..96bc06b87a 100644 --- a/pandora_console/godmode/netflow/nf_edit_form.php +++ b/pandora_console/godmode/netflow/nf_edit_form.php @@ -212,7 +212,17 @@ $table->data[1][1] = html_print_select_groups( -1, true, false, - false + false, + '', + false, + false, + false, + false, + 'id_grupo', + false, + false, + false, + '250px' ); if ($advanced_filter != '') { @@ -222,8 +232,8 @@ if ($advanced_filter != '') { } $table->data[2][0] = ''.__('Filter:').''; -$table->data[2][1] = __('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true); -$table->data[2][1] .= __('Advanced').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true); +$table->data[2][1] = __('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'class="mrgn_right_40px"', true); +$table->data[2][1] .= __('Advanced').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'class="mrgn_right_40px"', true); $table->data[3][0] = __('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:25.46.157.214,160.253.135.249'), true); $table->data[3][1] = html_print_input_text('ip_dst', $ip_dst, false, 40, 80, true); diff --git a/pandora_console/godmode/netflow/nf_item_list.php b/pandora_console/godmode/netflow/nf_item_list.php index 00f6818857..558cbb339c 100644 --- a/pandora_console/godmode/netflow/nf_item_list.php +++ b/pandora_console/godmode/netflow/nf_item_list.php @@ -43,7 +43,14 @@ $buttons['edit_report']['text'] = ' '; + $data[0] = ' '; } else if (($item['id_rc'] == $first_item) && ($item['id_rc'] != $last_item)) { - $data[0] = ' '; + $data[0] = ' '; $data[0] .= ''.html_print_image('images/down.png', true, ['title' => __('Move to down')]).''; } else if (($item['id_rc'] == $last_item) && ($item['id_rc'] != $first_item)) { $data[0] = ''.html_print_image('images/up.png', true, ['title' => __('Move to up')]).''; @@ -262,7 +269,7 @@ foreach ($reports_item as $item) { } $data[5] = "".html_print_image('images/cross.png', true, ['title' => __('Delete')]).''.html_print_checkbox_extended('delete_multiple[]', $item['id_rc'], false, false, '', 'class="check_delete"', true); + href='".$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_item_list&delete=1&id_rc='.$item['id_rc'].'&id='.$id."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''.html_print_checkbox_extended('delete_multiple[]', $item['id_rc'], false, false, '', 'class="check_delete"', true); array_push($table->data, $data); } @@ -271,7 +278,7 @@ if (isset($data)) { echo ''; html_print_input_hidden('multiple_delete', 1); html_print_table($table); - echo ""; + echo ""; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo ''; echo ''; @@ -280,7 +287,7 @@ if (isset($data)) { } echo ''; -echo ""; +echo ""; html_print_submit_button(__('Create item'), 'crt', false, 'class="sub wand"'); echo ''; echo ''; diff --git a/pandora_console/godmode/reporting/create_container.php b/pandora_console/godmode/reporting/create_container.php index 37bf559c06..e22a755678 100644 --- a/pandora_console/godmode/reporting/create_container.php +++ b/pandora_console/godmode/reporting/create_container.php @@ -181,7 +181,14 @@ if ($delete_item) { $buttons['graph_container'] = [ 'active' => false, - 'text' => ''.html_print_image('images/graph-container.png', true, ['title' => __('Graph container')]).'', + 'text' => ''.html_print_image( + 'images/graph-container.png', + true, + [ + 'title' => __('Graph container'), + 'class' => 'invert_filter', + ] + ).'', ]; // Header. @@ -213,11 +220,11 @@ if ($edit_container) { } echo ''; -echo "".__('Name').''; +echo "".__('Name').''; if ($id_container === '1') { - echo "".__('Group').''; +echo "".__('Group').''; echo ''; echo html_print_input( [ @@ -320,10 +327,10 @@ echo ''; if ($edit_container) { if ($id_container !== '1') { - echo ""; + echo ""; } } else { - echo ""; + echo ""; } echo ''; @@ -352,8 +359,8 @@ if ($edit_container) { $type_graphs[1] = __('Line'); $single_table = ""; - $single_table .= ""; - $single_table .= ""; + $single_table .= ""; + $single_table .= ""; $single_table .= __('Time lapse'); $single_table .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), true); $single_table .= ''; @@ -375,8 +382,8 @@ if ($edit_container) { $single_table .= ''; $single_table .= ''; - $single_table .= ""; - $single_table .= ""; + $single_table .= ""; + $single_table .= ""; $single_table .= __('Agent'); $single_table .= ''; $single_table .= ''; @@ -398,15 +405,15 @@ if ($edit_container) { $single_table .= ''; $single_table .= ''; - $single_table .= ""; - $single_table .= ""; + $single_table .= ""; + $single_table .= ""; $single_table .= __('Module'); $single_table .= ''; $single_table .= ''; if ($idAgent) { $single_table .= html_print_select_from_sql($sql_modules, 'id_agent_module', $idAgentModule, '', '', '0', true); } else { - $single_table .= ""; + $single_table .= ""; $single_table .= ""; $single_table .= __('Select an Agent first'); $single_table .= ''; @@ -771,4 +778,4 @@ echo html_print_input_hidden('id_agent', 0); }); }); - \ No newline at end of file + diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index 05e9d549a6..1d9b891b79 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -235,7 +235,7 @@ if ($count_module_array > 0) { echo ''; echo ""; - html_print_input_text('label', $label_array[$a], '', 20, 30, false, false); + html_print_input_text('label', $label_array[$a], '', 30, 80, false, false); html_print_submit_button('Ok', 'btn', false, '', false); echo ''; @@ -253,7 +253,7 @@ if ($count_module_array > 0) { echo ''; echo ''; echo ""; - echo "".html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; + echo "".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; echo ''; @@ -326,7 +326,7 @@ echo ''; // Configuration form. -echo ''.__('None').''; +echo ''.__('None').''; echo ""; echo ""; @@ -345,11 +345,14 @@ echo "".html_print_select_groups( true ).''; echo ''; -echo "".__('Agents').ui_print_help_tip(__('If you select several agents, only the common modules will be displayed'), true).''; +echo "".__('Agents').ui_print_help_tip( + __('If you select several agents, only the common modules will be displayed'), + true +).''; echo ''; -echo "".__('Modules').''; +echo "".__('Modules').''; echo ''; -echo ''.html_print_select( +echo ''.html_print_select( agents_get_group_agents(), 'id_agents[]', 0, @@ -363,8 +366,8 @@ echo ''.html_print_select( false, '' ).''; -echo "".html_print_image('images/darrowright.png', true).''; -echo ''.html_print_select( +echo ''; +echo ''.html_print_select( [], 'module[]', 0, @@ -388,7 +391,7 @@ echo ''; echo ''; echo ""; echo ''; -echo ""; +echo ""; ui_require_jquery_file('pandora.controls'); ui_require_jquery_file('ajaxqueue'); diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index 1e466e7f14..b7e72ba1d9 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -132,6 +132,14 @@ $output .= '>'; $own_info = get_user_info($config['id_user']); +$return_all_group = true; + +if (users_can_manage_group_all('RW') === false + && users_can_manage_group_all('RM') === false +) { + $return_all_group = false; +} + $output .= ''.__('Group').''; if (check_acl($config['id_user'], 0, 'RW')) { $output .= html_print_input( @@ -139,7 +147,7 @@ if (check_acl($config['id_user'], 0, 'RW')) { 'type' => 'select_groups', 'id_user' => $config['id_user'], 'privilege' => 'RW', - 'returnAllGroup' => true, + 'returnAllGroup' => $return_all_group, 'name' => 'graph_id_group', 'selected' => $id_group, 'script' => '', @@ -155,7 +163,7 @@ if (check_acl($config['id_user'], 0, 'RW')) { 'type' => 'select_groups', 'id_user' => $config['id_user'], 'privilege' => 'RM', - 'returnAllGroup' => true, + 'returnAllGroup' => $return_all_group, 'name' => 'graph_id_group', 'selected' => $id_group, 'script' => '', @@ -170,7 +178,7 @@ if (check_acl($config['id_user'], 0, 'RW')) { $output .= ''; $output .= ''; $output .= "".__('Description').''; -$output .= ""; +$output .= ""; if ($edit_graph) { $output .= $graphInTgraph['description']; } @@ -178,7 +186,7 @@ if ($edit_graph) { $output .= ''; $output .= ''; if ($stacked == CUSTOM_GRAPH_GAUGE) { - $hidden = ' style="display:none;" '; + $hidden = ' class="invisible" '; } else { $hidden = ''; } @@ -198,7 +206,7 @@ $output .= html_print_extended_select_for_time( ); $output .= ""; $output .= ''.__('Type of graph').''; -$output .= " "; +$output .= " "; require_once $config['homedir'].'/include/functions_graph.php'; @@ -284,12 +292,12 @@ $output .= ''; $output .= ''; if ($edit_graph) { - $output .= ""; - $output .= ""; + $output .= ""; + $output .= ""; $output .= ''; } else { - $output .= ""; - $output .= ""; + $output .= ""; + $output .= ""; $output .= ''; } diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 5fba0d2c96..79fdfde250 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -28,6 +28,8 @@ global $config; + + if (is_ajax()) { $search_agents = (bool) get_parameter('search_agents'); @@ -83,6 +85,20 @@ $change_weight = (bool) get_parameter('change_weight', false); $change_label = (bool) get_parameter('change_label', false); $id_graph = (int) get_parameter('id', 0); +if ($id_graph > 0) { + $graph_group = db_get_value('id_group', 'tgraph', 'id_graph', $id_graph); + if (!check_acl_restricted_all($config['id_user'], $graph_group, 'RW') + && !check_acl_restricted_all($config['id_user'], $graph_group, 'RM') + ) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access graph builder' + ); + include 'general/noaccess.php'; + exit; + } +} + if ($id_graph !== 0) { $sql = "SELECT * FROM tgraph WHERE (private = 0 OR (private = 1 AND id_user = '".$config['id_user']."')) @@ -269,19 +285,48 @@ if ($edit_graph) { $buttons = [ 'graph_list' => [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Graph list')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('Graph list'), + 'class' => 'invert_filter', + ] + ).'', ], 'main' => [ 'active' => false, - 'text' => ''.html_print_image('images/chart.png', true, ['title' => __('Main data')]).'', + 'text' => ''.html_print_image( + 'images/chart.png', + true, + [ + 'title' => __('Main data'), + 'class' => 'invert_filter', + ] + ).'', ], 'graph_editor' => [ 'active' => false, - 'text' => ''.html_print_image('images/builder.png', true, ['title' => __('Graph editor')]).'', + 'text' => ''.html_print_image( + 'images/builder.png', + true, + [ + 'title' => __('Graph editor'), + 'class' => 'invert_filter', + ] + ).'', ], 'view' => [ 'active' => false, - 'text' => ''.html_print_image('images/operation.png', true, ['title' => __('View graph')]).'', + 'text' => ''.html_print_image( + 'images/operation.png', + true, + [ + 'title' => __('View graph'), + 'class' => 'invert_filter', + + ] + ).'', ], ]; diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index cd38209425..0c8e2a58a1 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -25,6 +25,8 @@ if (! check_acl($config['id_user'], 0, 'RR') || enterprise_installed() === false return; } + + $report_r = check_acl($config['id_user'], 0, 'RR'); $report_w = check_acl($config['id_user'], 0, 'RW'); $report_m = check_acl($config['id_user'], 0, 'RM'); @@ -52,7 +54,14 @@ $max_graph = $config['max_graph_container']; $buttons['graph_list'] = [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Graph list')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('Graph list'), + 'class' => 'invert_filter', + ] + ).'', ]; $enterpriseEnable = false; @@ -69,7 +78,14 @@ $subsection = reporting_enterprise_add_graph_template_subsection('', $buttons); $buttons['graph_container'] = [ 'active' => true, - 'text' => ''.html_print_image('images/graph-container.png', true, ['title' => __('Graph container')]).'', + 'text' => ''.html_print_image( + 'images/graph-container.png', + true, + [ + 'title' => __('Graph container'), + 'class' => 'invert_filter', + ] + ).'', ]; // Header ui_print_page_header(__('Graph container'), '', false, '', false, $buttons); @@ -79,9 +95,9 @@ $container = folder_get_folders(); $tree = folder_get_folders_tree_recursive($container); echo folder_togge_tree_folders($tree); if ($report_r && $report_w) { - echo ""; - echo ''; - html_print_submit_button(__('Create container'), 'create', false, 'class="sub next" style="margin-right:5px;margin-top: 15px;"'); + echo ""; + echo ''; + html_print_submit_button(__('Create container'), 'create', false, 'class="sub next mrgn_right_5px mrgn_top_15px"'); echo ''; echo ''; } @@ -101,7 +117,7 @@ if ($report_r && $report_w) { }, success: function(data) { $("#div_"+hash).remove(); - $("#tgl_div_"+hash).prepend(""+data+""); + $("#tgl_div_"+hash).prepend(""+data+""); if($('div[class *= graph]').length == 0 && $('div[class *= bullet]').length == 0 && $('div[id *= gauge_]').length == 0){ $("#div_"+hash).remove(); diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index aa7f27a063..856f251947 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -31,6 +31,8 @@ if (!$report_r && !$report_w && !$report_m) { return; } + + $access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR')); $activeTab = get_parameter('tab', 'main'); @@ -42,7 +44,14 @@ if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NO $buttons['graph_list'] = [ 'active' => true, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Graph list')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('Graph list'), + 'class' => 'invert_filter', + ] + ).'', ]; if ($enterpriseEnable) { @@ -74,7 +83,14 @@ switch ($activeTab) { if ($enterpriseEnable) { $buttons['graph_container'] = [ 'active' => false, - 'text' => ''.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'', + 'text' => ''.html_print_image( + 'images/graph-container.png', + true, + [ + 'title' => __('Graphs containers'), + 'class' => 'invert_filter', + ] + ).'', ]; } @@ -88,7 +104,11 @@ ui_print_page_header(__('Reporting').' » '.__('Custom graphs'), 'images/ch // Delete module SQL code if ($delete_graph) { - if ($report_w || $report_m) { + $graph_group = db_get_value('id_group', 'tgraph', 'id_graph', $id); + + if (check_acl_restricted_all($config['id_user'], $graph_group, 'RW') + || check_acl_restricted_all($config['id_user'], $graph_group, 'RM') + ) { $exist = db_get_value('id_graph', 'tgraph_source', 'id_graph', $id); if ($exist) { $result = db_process_sql_delete('tgraph_source', ['id_graph' => $id]); @@ -229,22 +249,6 @@ $table_aux = new stdClass(); $filter['metaconsole'] = 0; } - - /* - $reports = reports_get_reports( - $filter, - [ - 'name', - 'description', - 'id_graph', - 'id_group', - ], - $return_all_group, - $access, - $group, - false - );*/ - if ($id_group != null || $search != null) { $graphs = custom_graphs_search($id_group, $search); } @@ -290,7 +294,10 @@ $table_aux = new stdClass(); foreach ($result_graphs as $graph) { $data = []; - $data[0] = ''.ui_print_truncate_text($graph['name'], 70).''; + $data[0] = ''.ui_print_truncate_text( + $graph['name'], + 70 + ).''; $data[1] = ui_print_truncate_text($graph['description'], 70); @@ -300,16 +307,35 @@ $table_aux = new stdClass(); $data[4] = ''; $table->cellclass[][4] = 'action_buttons'; if (($report_w || $report_m)) { - $data[4] = ''.html_print_image('images/config.png', true).''; + $data[4] = ''.html_print_image( + 'images/config.png', + true, + ['class' => 'invert_filter'] + ).''; } - if ($report_m) { + $data[5] = ''; + if (check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RM')) { $data[4] .= ''.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).''; - } + return false;">'.html_print_image( + 'images/cross.png', + true, + [ + 'alt' => __('Delete'), + 'title' => __('Delete'), + 'class' => 'invert_filter', + ] + ).''; - if ($report_m) { - $data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true); + $data[5] .= html_print_checkbox_extended( + 'delete_multiple[]', + $graph['id_graph'], + false, + false, + '', + 'class="check_deletemrgn_lft_2px"', + true + ); } array_push($table->data, $data); @@ -317,21 +343,21 @@ $table_aux = new stdClass(); if (!empty($result_graphs)) { - echo ""; - html_print_input_hidden('multiple_delete', 1); - html_print_table($table); - ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom'); - echo ""; + echo ""; + html_print_input_hidden('multiple_delete', 1); + html_print_table($table); + ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom'); + echo ""; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); - echo ''; + echo ''; echo ''; } - echo ""; + echo ""; if ($report_w || $report_m) { - echo ''; - html_print_submit_button(__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"'); + echo ''; + html_print_submit_button(__('Create graph'), 'create', false, 'class="sub next mrgn_right_5px"'); echo ''; } diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 4444396033..0af0bdea4f 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -32,6 +32,8 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) { exit; } + + if (!$is_metaconsole) { $url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder'; $url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite'; @@ -42,7 +44,6 @@ if (!$is_metaconsole) { $url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'; $url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template'; $url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard'; - $url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager'; } $pure = (int) get_parameter('pure', 0); @@ -53,23 +54,51 @@ if (defined('METACONSOLE')) { $buttons['visual_console'] = [ 'active' => true, - 'text' => ''.html_print_image('images/visual_console.png', true, ['title' => __('Visual Console List')]).'', + 'text' => ''.html_print_image( + 'images/visual_console.png', + true, + [ + 'title' => __('Visual Console List'), + 'class' => 'invert_filter', + ] + ).'', ]; $buttons['visual_console_favorite'] = [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('Visual Favourite Console'), + 'class' => 'invert_filter', + ] + ).'', ]; if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) { $buttons['visual_console_template'] = [ 'active' => false, - 'text' => ''.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'', + 'text' => ''.html_print_image( + 'images/templates.png', + true, + [ + 'title' => __('Visual Console Template'), + 'class' => 'invert_filter', + ] + ).'', ]; $buttons['visual_console_template_wizard'] = [ 'active' => false, - 'text' => ''.html_print_image('images/wand.png', true, ['title' => __('Visual Console Template Wizard')]).'', + 'text' => ''.html_print_image( + 'images/wand.png', + true, + [ + 'title' => __('Visual Console Template Wizard'), + 'class' => 'invert_filter', + ] + ).'', ]; } @@ -123,8 +152,8 @@ if ($delete_layout || $copy_layout) { // ACL for the visual console // $vconsole_read = check_acl ($config['id_user'], $group_id, "VR"); - $vconsole_write = check_acl($config['id_user'], $group_id, 'VW'); - $vconsole_manage = check_acl($config['id_user'], $group_id, 'VM'); + $vconsole_write = check_acl_restricted_all($config['id_user'], $group_id, 'VW'); + $vconsole_manage = check_acl_restricted_all($config['id_user'], $group_id, 'VM'); if (!$vconsole_write && !$vconsole_manage) { db_pandora_audit( @@ -282,7 +311,7 @@ if ($ag_group > 0) { } } -echo " +echo " "; if (!is_metaconsole()) { echo ""; } -echo ""; +echo ""; echo __('Search').' '; html_print_input_text('search', $search, '', 50); echo ''; -echo ""; +echo ""; echo __('Group').' '; $own_info = get_user_info($config['id_user']); @@ -310,11 +339,11 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'VR')) { echo ''; html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false); echo ''; -echo ""; +echo ""; echo __('Group Recursion').' '; html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()'); -echo ""; +echo ""; echo ""; echo ''; echo ''; @@ -441,18 +470,36 @@ if (!$maps && !is_metaconsole()) { $data[1] = ui_print_group_icon($map['id_group'], true); $data[2] = db_get_sql('SELECT COUNT(*) FROM tlayout_data WHERE id_layout = '.$map['id']); - // Fix: IW was the old ACL for report editing, now is RW - if ($vconsoles_write || $vconsoles_manage) { + $vconsoles_write_action_btn = check_acl_restricted_all($config['id_user'], $map['id_group'], 'VW'); + $vconsoles_manage_action_btn = check_acl_restricted_all($config['id_user'], $map['id_group'], 'VM'); + + if ($vconsoles_write_action_btn || $vconsoles_manage_action_btn) { if (!is_metaconsole()) { $table->cellclass[] = [ 3 => 'action_buttons', 4 => 'action_buttons', ]; - $data[3] = ''.html_print_image('images/copy.png', true).''; - $data[4] = ''.html_print_image('images/cross.png', true).''; + $data[3] = ''.html_print_image( + 'images/copy.png', + true, + ['class' => 'invert_filter'] + ).''; + $data[4] = ''.html_print_image( + 'images/cross.png', + true, + ['class' => 'invert_filter'] + ).''; } else { - $data[3] = ''.html_print_image('images/copy.png', true).''; - $data[4] = ''.html_print_image('images/cross.png', true).''; + $data[3] = ''.html_print_image( + 'images/copy.png', + true, + ['class' => 'invert_filter'] + ).''; + $data[4] = ''.html_print_image( + 'images/cross.png', + true, + ['class' => 'invert_filter'] + ).''; } } else { $data[3] = ''; @@ -468,9 +515,9 @@ if (!$maps && !is_metaconsole()) { if ($maps) { if (!is_metaconsole()) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } } diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 52d94006d7..298e36aa25 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -29,6 +29,7 @@ global $config; + require_once $config['homedir'].'/include/functions_custom_graphs.php'; require_once $config['homedir'].'/include/db/oracle.php'; @@ -140,6 +141,8 @@ $visual_format = 0; // Others. $filter_search = ''; +$filter_exclude = ''; + // Added for select fields. $total_time = true; @@ -183,6 +186,7 @@ switch ($action) { $dyn_height = 230; $landscape = false; $pagebreak = false; + $summary = 0; break; case 'save': @@ -312,11 +316,12 @@ switch ($action) { $idCustomGraph = $item['id_gs']; break; + case 'availability_graph': + $summary = $item['summary']; case 'SLA': case 'SLA_weekly': case 'SLA_monthly': case 'SLA_hourly': - case 'availability_graph': $description = $item['description']; $only_display_wrong = $item['only_display_wrong']; $monday = $item['monday']; @@ -339,6 +344,7 @@ switch ($action) { $failover_type = $item['failover_type']; break; + case 'histogram_data': case 'module_histogram_graph': $description = $item['description']; $period = $item['period']; @@ -546,9 +552,18 @@ switch ($action) { $show_summary_group = $style['show_summary_group']; - $filter_event_severity = json_decode($style['filter_event_severity'], true); - $filter_event_status = json_decode($style['filter_event_status'], true); - $filter_event_type = json_decode($style['filter_event_type'], true); + $filter_event_severity = json_decode( + $style['filter_event_severity'], + true + ); + $filter_event_status = json_decode( + $style['filter_event_status'], + true + ); + $filter_event_type = json_decode( + $style['filter_event_type'], + true + ); $event_graph_by_user_validator = $style['event_graph_by_user_validator']; $event_graph_by_criticity = $style['event_graph_by_criticity']; @@ -556,6 +571,7 @@ switch ($action) { $include_extended_events = $item['show_extended_events']; $filter_search = $style['event_filter_search']; + $filter_exclude = $style['event_filter_exclude']; break; case 'event_report_group': @@ -570,6 +586,7 @@ switch ($action) { $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated']; $filter_search = $style['event_filter_search']; + $filter_exclude = $style['event_filter_exclude']; $filter_event_severity = json_decode($style['filter_event_severity'], true); $filter_event_status = json_decode($style['filter_event_status'], true); @@ -607,6 +624,8 @@ switch ($action) { $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated']; $filter_search = $style['event_filter_search']; + $filter_exclude = $style['event_filter_exclude']; + $include_extended_events = $item['show_extended_events']; break; @@ -790,6 +809,7 @@ switch ($action) { case 'database_serialized': case 'last_value': case 'monitor_report': + case 'histogram_data': case 'min_value': case 'max_value': case 'avg_value': @@ -823,7 +843,7 @@ html_print_input_hidden('id_item', $idItem); $class = 'databox filters'; ?> - + @@ -836,11 +856,11 @@ $class = 'databox filters'; } ?> - - + + - + - - + + - + - - + + - - - + + + @@ -951,9 +971,9 @@ $class = 'databox filters'; - - - + + + - - + + - + - - + + - + - - + + - + "; ?> - - + + - + - - + + - + - - + + - + - - + + - + - - + + @@ -1120,8 +1140,8 @@ $class = 'databox filters'; ?> - - + + - + - + - + @@ -1158,7 +1178,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('monday', 1, $monday); @@ -1166,7 +1186,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('tuesday', 1, $tuesday); @@ -1174,7 +1194,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('wednesday', 1, $wednesday); @@ -1182,7 +1202,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('thursday', 1, $thursday); @@ -1190,7 +1210,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('friday', 1, $friday); @@ -1198,7 +1218,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('saturday', 1, $saturday); @@ -1206,7 +1226,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('sunday', 1, $sunday); @@ -1270,9 +1290,9 @@ $class = 'databox filters'; - - - + + + '; if (check_acl($config['id_user'], 0, 'RW')) { @@ -1306,9 +1326,9 @@ $class = 'databox filters'; ?> - - - + + + - - - + + + - - - + + + - - + + - + - + @@ -1482,8 +1502,8 @@ $class = 'databox filters'; - - + + ".html_print_image( + echo "".html_print_image( 'images/spinner.gif', true ).''; @@ -1544,8 +1564,8 @@ $class = 'databox filters'; - - + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + '; + echo ''; echo ' '.__('Target server').' '; html_print_select($result_servers, 'meta_servers', '', '', __('None'), 0); echo ''; } else { // If there are not metaconsole servers // don't allow to create new custom graphs. - $style_button_create_custom_graph = 'style="display: none;"'; + $style_button_create_custom_graph = 'class="invisible"'; } } } @@ -1870,9 +1890,9 @@ $class = 'databox filters'; - - - + + + - - + + - + - - + + - + - + - - - + + + - + - - + + - + - - - + + + - + - - + + - + - - + + - + - - + + @@ -2026,8 +2046,8 @@ $class = 'databox filters'; ?> - - + + - - - + + + - - - + + + - - + + - - + + @@ -2137,8 +2157,8 @@ $class = 'databox filters'; - - + + - - + + @@ -2174,14 +2194,14 @@ $class = 'databox filters'; - - + + - - - + + + - - + + - - + + - - + + @@ -2239,7 +2259,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('total_time', 1, $total_time); @@ -2247,7 +2267,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('time_failed', 1, $time_failed); @@ -2255,7 +2275,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('time_in_ok_status', 1, $time_in_ok_status); @@ -2263,7 +2283,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch( @@ -2275,7 +2295,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch( @@ -2287,7 +2307,7 @@ $class = 'databox filters'; - + '; html_print_checkbox_switch('time_of_downtime', 1, $time_of_downtime); @@ -2298,8 +2318,8 @@ $class = 'databox filters'; - - + + - - + + - - + + Select fields to show'); + echo __('Select fields to show'); ?> - + - + - + - + - - + + Select fields to show'); + echo __('Select fields to show'); ?> - + - + - - + + @@ -2432,8 +2452,8 @@ $class = 'databox filters'; - - + + - - + + - - + + - - + + @@ -2530,8 +2550,8 @@ $class = 'databox filters'; - - + + - - + + - + - - + + @@ -2611,8 +2631,8 @@ $class = 'databox filters'; - - + + - + - - + + - - + + @@ -2666,7 +2686,7 @@ $class = 'databox filters'; '; + echo ''; html_print_radio_button( 'priority_mode', REPORT_PRIORITY_MODE_OK, @@ -2675,10 +2695,10 @@ $class = 'databox filters'; '' ); - echo ''; + echo ''; echo __('Priority unknown mode'); - echo ''; + echo ''; html_print_radio_button( 'priority_mode', REPORT_PRIORITY_MODE_UNKNOWN, @@ -2690,8 +2710,8 @@ $class = 'databox filters'; - - + + - - + + @@ -2719,7 +2739,7 @@ $class = 'databox filters'; '; + echo ''; html_print_radio_button( 'failover_type', REPORT_FAILOVER_TYPE_NORMAL, @@ -2728,10 +2748,10 @@ $class = 'databox filters'; '' ); - echo ''; + echo ''; echo __('Failover simple'); - echo ''; + echo ''; html_print_radio_button( 'failover_type', REPORT_FAILOVER_TYPE_SIMPLE, @@ -2743,28 +2763,64 @@ $class = 'databox filters'; +<<<<<<< HEAD + + +======= + + + + + + + + + - + +>>>>>>> origin/develop + + + + + + - - + + - + - - + + - + - - + + '; + echo ''; html_print_radio_button( 'visual_format', 1, @@ -2821,9 +2877,9 @@ $class = 'databox filters'; '', !$lapse_calc ); - echo ''; + echo ''; echo __('Graph only'); - echo ''; + echo ''; html_print_radio_button( 'visual_format', 2, @@ -2832,9 +2888,9 @@ $class = 'databox filters'; '', !$lapse_calc ); - echo ''; + echo ''; echo __('Graph and table'); - echo ''; + echo ''; html_print_radio_button( 'visual_format', 3, @@ -2847,8 +2903,8 @@ $class = 'databox filters'; - - + + - + - - + + @@ -2894,13 +2950,13 @@ $class = 'databox filters'; - - + + - + $user) { @@ -2940,8 +2996,8 @@ $class = 'databox filters'; - - + + @@ -2958,8 +3014,8 @@ $class = 'databox filters'; - - + + @@ -2967,8 +3023,8 @@ $class = 'databox filters'; - - + + @@ -2982,7 +3038,7 @@ $class = 'databox filters'; '; +echo ''; if ($action == 'new') { html_print_submit_button( __('Create item'), @@ -3103,7 +3159,7 @@ function print_SLA_list($width, $action, $idItem=null) switch ($action) { case 'new': ?> - + '; + echo ''; echo ''; echo printSmallFont($nameAgent).$server_name_element; echo ''; @@ -3223,9 +3279,9 @@ function print_SLA_list($width, $action, $idItem=null) echo ''; echo $item_sla_limit; echo ''; - echo ''; + echo ''; echo ''; - echo html_print_image('images/cross.png', true); + echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']); echo ''; echo ''; echo ''; @@ -3239,7 +3295,7 @@ function print_SLA_list($width, $action, $idItem=null) echo ''; ?> - + - + 'invert_filter'] ); ?> @@ -3276,10 +3333,10 @@ function print_SLA_list($width, $action, $idItem=null) - + - + - + - + - + 'invert_filter'] ); ?> @@ -3429,7 +3487,7 @@ function print_SLA_list($width, $action, $idItem=null) } ?> - + - + + echo ' '.printSmallFont($nameAgent).$server_name_element.' '.printSmallFont($nameModule).' '.printSmallFont($nameAgentFailover).$server_name_element.' '.printSmallFont($nameModuleFailover).' - - '.html_print_image('images/cross.png', true).' + + '.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).' '; } else { - echo ' + echo ' '.printSmallFont($nameAgent).$server_name_element.' '.printSmallFont($nameModule).' - - '.html_print_image('images/cross.png', true).' + + '.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).' '; } } else { - echo ' + echo ' '.printSmallFont($nameAgent).$server_name_element.' '.printSmallFont($nameModule).' '.printSmallFont($operation[$item['operation']]).' - - '.html_print_image('images/cross.png', true).' + + '.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).' '; } @@ -3641,7 +3699,7 @@ function print_General_list($width, $action, $idItem=null, $type='general') ?> - + - + 'invert_filter'] ); ?> @@ -3674,7 +3733,7 @@ function print_General_list($width, $action, $idItem=null, $type='general') - + @@ -3698,7 +3757,7 @@ function print_General_list($width, $action, $idItem=null, $type='general') ?> - + - + - + 'invert_filter'] ); ?> @@ -3787,43 +3847,43 @@ function print_General_list($width, $action, $idItem=null, $type='general') } ?> - + "; -echo "".__('Please select a name.').''; +echo ""; +echo "".__('Please select a name.').''; echo ''; -echo ""; -echo "".__('Please select an agent.').''; +echo ""; +echo "".__('Please select an agent.').''; echo ''; -echo ""; -echo "".__('Please select a module.').''; +echo ""; +echo "".__('Please select a module.').''; echo ''; -echo ""; -echo "".__('Please insert a SQL query.').''; +echo ""; +echo "".__('Please insert a SQL query.').''; echo ''; -echo ""; -echo "".__('Please insert a URL.').''; +echo ""; +echo "".__('Please insert a URL.').''; echo ''; -echo ""; -echo "".__('Please checked a custom interval option.').''; +echo ""; +echo "".__('Please checked a custom interval option.').''; echo ''; -echo ""; -echo "".__('Please select a user.').''; +echo ""; +echo "".__('Please select a user.').''; echo ''; -echo ""; -echo "".__('Please select a group.').''; +echo ""; +echo "".__('Please select a group.').''; echo ''; ui_require_javascript_file( @@ -4096,6 +4156,7 @@ $(document).ready (function () { case 'max_value': case 'min_value': case 'monitor_report': + case 'histogram_data': case 'database_serialized': case 'last_value': case 'sumatory': @@ -4149,6 +4210,7 @@ $(document).ready (function () { case 'prediction_date': case 'projection_graph': case 'monitor_report': + case 'histogram_data': case 'module_histogram_graph': case 'avg_value': case 'max_value': @@ -4234,6 +4296,7 @@ $(document).ready (function () { case 'max_value': case 'min_value': case 'monitor_report': + case 'histogram_data': case 'database_serialized': case 'last_value': case 'sumatory': @@ -4282,6 +4345,7 @@ $(document).ready (function () { case 'prediction_date': case 'projection_graph': case 'monitor_report': + case 'histogram_data': case 'module_histogram_graph': case 'avg_value': case 'max_value': @@ -5099,6 +5163,7 @@ function chooseType() { $("#row_current_month").hide(); $("#row_failover_mode").hide(); $("#row_failover_type").hide(); + $("#row_summary").hide(); $("#row_working_time").hide(); $("#row_working_time_compare").hide(); $("#row_only_display_wrong").hide(); @@ -5141,6 +5206,7 @@ function chooseType() { $("#row_resolution").hide(); $("#row_last_value").hide(); $("#row_filter_search").hide(); + $("#row_filter_exclude").hide(); $("#row_percentil").hide(); $("#log_help_tip").css("visibility", "hidden"); $("#agents_row").hide(); @@ -5191,6 +5257,8 @@ function chooseType() { $("#row_extended_events").show(); $("#row_filter_search").show(); + $("#row_filter_exclude").show(); + $("#row_event_severity").show(); $("#row_event_status").show(); @@ -5290,8 +5358,10 @@ function chooseType() { if(failover_checked){ $("#row_failover_type").show(); } + $("#row_summary").show(); break; + case 'histogram_data': case 'module_histogram_graph': $("#row_description").show(); $("#row_period").show(); @@ -5403,11 +5473,9 @@ function chooseType() { case 'sql': $("#row_description").show(); $("#row_query").show(); - $("#row_max_items").show(); $("#row_header").show(); $("#row_custom").show(); $("#row_custom_example").show(); - $("#row_dyn_height").show(); $("#row_servers").show(); $("#row_historical_db_check").show(); break; @@ -5486,6 +5554,8 @@ function chooseType() { $("#row_extended_events").show(); $("#row_filter_search").show(); + $("#row_filter_exclude").show(); + $("#row_historical_db_check").hide(); break; @@ -5509,6 +5579,8 @@ function chooseType() { $('#agent_autocomplete').hide(); $('#agent_autocomplete_events').show(); $("#row_filter_search").show(); + $("#row_filter_exclude").show(); + $("#row_historical_db_check").hide(); break; @@ -5531,6 +5603,8 @@ function chooseType() { $('#agent_autocomplete').hide(); $('#agent_autocomplete_events').show(); $("#row_filter_search").show(); + $("#row_filter_exclude").show(); + $("#row_historical_db_check").hide(); break; diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index b3ce9c09f0..64e5819b1e 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -371,18 +371,54 @@ if ($items) { $table->head[0] = ''.__('P.').''; $table->head[1] = __('Type'); if (!$filterEnable) { - $table->head[1] .= ' '.html_print_image($arrow_up, true, ['title' => __('Ascendent')]).''.''.html_print_image($arrow_down, true, ['title' => __('Descent')]).''; + $table->head[1] .= ' '.html_print_image( + $arrow_up, + true, + [ + 'title' => __('Ascendent'), + 'class' => 'invert_filter', + ] + ).''.''.html_print_image( + $arrow_down, + true, + [ + 'title' => __('Descent'), + 'class' => 'invert_filter', + ] + ).''; } $table->head[2] = __('Agent'); if (!$filterEnable) { - $table->head[2] .= ' '.html_print_image($arrow_up, true, ['title' => __('Ascendent')]).''.''.html_print_image($arrow_down, true, ['title' => __('Descent')]).''; + $table->head[2] .= ' '.html_print_image( + $arrow_up, + true, + [ + 'title' => __('Ascendent'), + 'class' => 'invert_filter', + ] + ).''.''.html_print_image( + $arrow_down, + true, + [ + 'title' => __('Descent'), + 'class' => 'invert_filter', + ] + ).''; } $table->head[3] = __('Module'); if (!$filterEnable) { - $table->head[3] .= ' '.html_print_image($arrow_up, true, ['title' => __('Ascendent')]).''.''.html_print_image($arrow_down, true, ['title' => __('Descent')]).''; + $table->head[3] .= ' '.html_print_image( + $arrow_up, + true, + ['title' => __('Ascendent')] + ).''.''.html_print_image( + $arrow_down, + true, + ['title' => __('Descent')] + ).''; } $table->head[4] = __('Time lapse'); @@ -515,27 +551,92 @@ foreach ($items as $item) { $style = json_decode(io_safe_output($item['style']), true); + + // Macros + $items_macro = []; + + if (!empty($item['id_agent'])) { + $id_agent = $item['id_agent']; + // Add macros name. + $agent_description = agents_get_description($id_agent); + $agent_group = agents_get_agent_group($id_agent); + $agent_address = agents_get_address($id_agent); + $agent_alias = agents_get_alias($id_agent); + + $items_macro_agent = [ + 'id_agent' => $id_agent, + 'agent_description' => $agent_description, + 'agent_group' => $agent_group, + 'agent_address' => $agent_address, + 'agent_alias' => $agent_alias, + ]; + + $items_macro = array_merge($items_macro, $items_macro_agent); + } + + if (!empty($item['id_agent_module'])) { + $id_agent_module = $item['id_agent_module']; + $module_name = modules_get_agentmodule_name( + $id_agent_module + ); + $module_description = modules_get_agentmodule_descripcion( + $id_agent_module + ); + + $items_macro_module = [ + 'id_agent_module' => $id_agent_module, + 'module_name' => $module_name, + 'module_description' => $module_description, + ]; + + $items_macro = array_merge($items_macro, $items_macro_module); + } + + + if ($style['name_label'] != '') { $text = empty($style['name_label']) ? $item['description'] : $style['name_label']; - $row[5] = ui_print_truncate_text($text, 'description', true, true); } else { if ($item['name'] == '' && $item['description'] == '') { - $row[5] = '-'; + $text = '-'; } else { $text = empty($item['name']) ? $item['description'] : $item['name']; - $row[5] = ui_print_truncate_text($text, 'description', true, true); } } + // Apply macros + $items_macro['type'] = $item['type']; + $text = reporting_label_macro( + $items_macro, + $text + ); + $row[5] = ui_print_truncate_text($text, 'description', true, true); + + $row[6] = ''; if (check_acl($config['id_user'], $item['id_group'], 'RM')) { $table->cellclass[][6] = 'action_buttons'; - $row[6] .= ''.html_print_image('images/wrench_orange.png', true, ['title' => __('Edit')]).''; + $row[6] .= ''.html_print_image( + 'images/config.png', + true, + [ + 'title' => __('Edit'), + 'class' => 'invert_filter', + ] + ).''; $row[6] .= ' '; - $row[6] .= ''.html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; + $row[6] .= ''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; $row[6] .= ' '; - $row[6] .= html_print_checkbox_extended('delete_multiple[]', $item['id_rc'], false, false, '', 'class="check_delete"', true); + $row[6] .= html_print_checkbox_extended( + 'delete_multiple[]', + $item['id_rc'], + false, + false, + '', + 'class="check_delete"', + true + ); } $row[7] = ''; @@ -559,7 +660,7 @@ if (defined('METACONSOLE')) { ui_pagination($countItems, 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report='.$idReport.$urlFilter); echo ""; - echo ""; + echo ""; if (check_acl($config['id_user'], 0, 'RM')) { html_print_input_hidden('ids_items_to_delete', ''); @@ -583,7 +684,7 @@ if (defined('METACONSOLE')) { echo ""; - echo ""; + echo ""; html_print_input_hidden('ids_items_to_delete', ''); html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); @@ -708,11 +809,11 @@ function check_all_checkboxes() { function toggleFormFilter() { if ($("#form_filter").css('display') == 'none') { - $("#image_form_filter").attr('src', ); + $("#image_form_filter").attr('src', 'invert_filter'], true)."'"; ?> ); $("#form_filter").css('display',''); } else { - $("#image_form_filter").attr('src', ); + $("#image_form_filter").attr('src', 'invert_filter'], true)."'"; ?> ); $("#form_filter").css('display','none'); } } diff --git a/pandora_console/godmode/reporting/reporting_builder.main.php b/pandora_console/godmode/reporting/reporting_builder.main.php index 38d5e0a2d7..5b1be809d4 100755 --- a/pandora_console/godmode/reporting/reporting_builder.main.php +++ b/pandora_console/godmode/reporting/reporting_builder.main.php @@ -114,13 +114,19 @@ if (isset($write_groups[$idGroupReport]) === false && $idGroupReport) { $write_groups[$idGroupReport] = groups_get_name($idGroupReport); } +$return_all_group = false; + +if (users_can_manage_group_all('RW') === true) { + $return_all_group = true; +} + $table->data['group'][1] = ''; $table->data['group'][1] .= html_print_input( [ 'type' => 'select_groups', 'id_user' => $config['id_user'], 'privilege' => 'AR', - 'returnAllGroup' => true, + 'returnAllGroup' => $return_all_group, 'name' => 'id_group', 'selected' => $idGroupReport, 'script' => '', diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 65cd8c0c1a..7b38abef62 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -141,6 +141,8 @@ require_once $config['homedir'].'/include/functions_reports.php'; enterprise_include('operation/reporting/custom_reporting.php'); enterprise_include_once('include/functions_metaconsole.php'); + + $enterpriseEnable = false; if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NOT_HOOK) { $enterpriseEnable = true; @@ -158,6 +160,26 @@ $pure = get_parameter('pure', 0); $schedule_report = get_parameter('schbutton', ''); $pagination = (int) get_parameter('pagination', $config['block_size']); +if ($action == 'edit' && $idReport > 0) { + $report_group = db_get_value( + 'id_group', + 'treport', + 'id_report', + $idReport + ); + + if (! check_acl_restricted_all($config['id_user'], $report_group, 'RW') + && ! check_acl_restricted_all($config['id_user'], $report_group, 'RM') + ) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access report builder' + ); + include 'general/noaccess.php'; + exit; + } +} + if ($schedule_report != '') { $id_user_task = 1; $scheduled = 'no'; @@ -495,7 +517,14 @@ switch ($action) { $buttons = [ 'list_reports' => [ 'active' => false, - 'text' => ''.html_print_image('images/report_list.png', true, ['title' => __('Reports list')]).'', + 'text' => ''.html_print_image( + 'images/report_list.png', + true, + [ + 'title' => __('Reports list'), + 'class' => 'invert_filter', + ] + ).'', ], ]; @@ -909,8 +938,8 @@ switch ($action) { $data = []; - if (check_acl($config['id_user'], $report['id_group'], 'RW') - || check_acl($config['id_user'], $report['id_group'], 'RM') + if (check_acl_restricted_all($config['id_user'], $report['id_group'], 'RW') + || check_acl_restricted_all($config['id_user'], $report['id_group'], 'RM') ) { $data[0] = ''.ui_print_truncate_text($report['name'], 70).''; } else { @@ -938,14 +967,20 @@ switch ($action) { $data[2] .= html_print_image( 'images/html.png', true, - ['title' => __('HTML view')] + [ + 'title' => __('HTML view'), + 'class' => 'invert_filter', + ] ); $data[2] .= ''; $data[3] = ''; $data[3] .= html_print_image( 'images/xml.png', true, - ['title' => __('Export to XML')] + [ + 'title' => __('Export to XML'), + 'class' => 'invert_filter', + ] ); $data[3] .= ''; // I chose ajax.php because it's supposed @@ -994,7 +1029,7 @@ switch ($action) { switch ($type_access_selected) { case 'group_view': - $edit = check_acl( + $edit = check_acl_restricted_all( $config['id_user'], $report['id_group'], 'RW' @@ -1005,7 +1040,7 @@ switch ($action) { break; case 'group_edit': - $edit = check_acl( + $edit = check_acl_restricted_all( $config['id_user'], $report['id_group_edit'], 'RW' @@ -1040,7 +1075,7 @@ switch ($action) { } if ($edit) { - $data[$next] = ''; + $data[$next] = ''; $data[$next] .= html_print_input_image( 'edit', 'images/config.png', @@ -1058,14 +1093,17 @@ switch ($action) { } if ($delete) { - $data[$next] .= ''; + $data[$next] .= ''; $data[$next] .= html_print_input_image( 'delete', 'images/cross.png', 1, 'margin-right: 10px;', true, - ['title' => __('Delete')] + [ + 'title' => __('Delete'), + 'class' => 'invert_filter', + ] ); $data[$next] .= html_print_input_hidden( 'id_report', @@ -1135,9 +1173,9 @@ switch ($action) { ) { echo ''; if (defined('METACONSOLE')) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } html_print_submit_button( @@ -1148,7 +1186,7 @@ switch ($action) { ); echo ''; - echo ''; + echo ''; foreach ($reports as $report) { echo ''; @@ -1159,7 +1197,7 @@ switch ($action) { __('Delete'), 'delete_btn', false, - 'class="sub delete" style="margin-left:5px;"' + 'class="sub delete" class="mrgn_lft_5px"' ); echo ''; echo ''; @@ -1498,12 +1536,16 @@ switch ($action) { $values['text'] = $intervals; break; + case 'availability_graph': + $values['summary'] = get_parameter( + 'summary', + 0 + ); case 'SLA_monthly': case 'SLA_weekly': case 'SLA_hourly': case 'SLA_services': case 'SLA': - case 'availability_graph': $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter( 'combo_sla_sort_options', @@ -1861,6 +1903,11 @@ switch ($action) { '' ); + $event_filter_exclude = get_parameter( + 'filter_exclude', + '' + ); + // If metaconsole is activated. if (is_metaconsole() === true) { if (($values['type'] == 'custom_graph') @@ -1998,6 +2045,8 @@ switch ($action) { $style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_filter_search'] = $event_filter_search; + $style['event_filter_exclude'] = $event_filter_exclude; + if ($label != '') { $style['label'] = $label; @@ -2030,6 +2079,7 @@ switch ($action) { break; case 'module_histogram_graph': + case 'histogram_data': case 'agent_configuration': case 'alert_report_agent': case 'alert_report_module': @@ -2543,6 +2593,11 @@ switch ($action) { REPORT_FAILOVER_TYPE_NORMAL ); + $values['summary'] = get_parameter( + 'summary', + 0 + ); + $style = []; $style['show_in_same_row'] = get_parameter( 'show_in_same_row', @@ -2602,6 +2657,12 @@ switch ($action) { '' ); + $event_filter_exclude = get_parameter( + 'filter_exclude', + '' + ); + + // Added for events items. $style['show_summary_group'] = $show_summary_group; $style['filter_event_severity'] = json_encode( @@ -2619,6 +2680,8 @@ switch ($action) { $style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_filter_search'] = $event_filter_search; + $style['event_filter_exclude'] = $event_filter_exclude; + if ($label != '') { $style['label'] = $label; } else { @@ -2650,6 +2713,7 @@ switch ($action) { break; case 'module_histogram_graph': + case 'histogram_data': case 'agent_configuration': case 'alert_report_agent': case 'alert_report_module': @@ -3058,7 +3122,7 @@ switch ($action) { $buttons = [ 'list_reports' => [ 'active' => false, - 'text' => ''.html_print_image('images/report_list.png', true, ['title' => __('Reports list')]).'', + 'text' => ''.html_print_image('images/report_list.png', true, ['title' => __('Reports list'), 'class' => 'invert_filter']).'', ], ]; @@ -3130,19 +3194,26 @@ $urlB = 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder'; $buttons = [ 'list_reports' => [ 'active' => false, - 'text' => ''.html_print_image('images/report_list.png', true, ['title' => __('Reports list')]).'', + 'text' => ''.html_print_image( + 'images/report_list.png', + true, + [ + 'title' => __('Reports list'), + 'class' => 'invert_filter', + ] + ).'', ], 'main' => [ 'active' => false, - 'text' => ''.html_print_image('images/op_reporting.png', true, ['title' => __('Main data')]).'', + 'text' => ''.html_print_image('images/op_reporting.png', true, ['title' => __('Main data'), 'class' => 'invert_filter']).'', ], 'list_items' => [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List items')]).'', + 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List items'), 'class' => 'invert_filter']).'', ], 'item_editor' => [ 'active' => false, - 'text' => ''.html_print_image('images/pen.png', true, ['title' => __('Item editor')]).'', + 'text' => ''.html_print_image('images/pencil.png', true, ['title' => __('Item editor'), 'class' => 'invert_filter']).'', ], ]; @@ -3155,7 +3226,14 @@ if ($enterpriseEnable) { $buttons['view'] = [ 'active' => false, - 'text' => ''.html_print_image('images/operation.png', true, ['title' => __('View report')]).'', + 'text' => ''.html_print_image( + 'images/operation.png', + true, + [ + 'title' => __('View report'), + 'class' => 'invert_filter', + ] + ).'', ]; $buttons[$activeTab]['active'] = true; @@ -3168,7 +3246,7 @@ if ($idReport != 0) { $buttons = [ 'main' => [ 'active' => true, - 'text' => ''.html_print_image('images/report_list.png', true, ['title' => __('Reports list')]).'', + 'text' => ''.html_print_image('images/report_list.png', true, ['title' => __('Reports list'), 'class' => 'invert_filter']).'', ], ]; $textReportName = __('Create Custom Report'); diff --git a/pandora_console/godmode/reporting/visual_console_builder.data.php b/pandora_console/godmode/reporting/visual_console_builder.data.php index a4c79b1eb7..5e84b1375e 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.data.php +++ b/pandora_console/godmode/reporting/visual_console_builder.data.php @@ -116,32 +116,37 @@ $table->data[0][1] = html_print_input_text( $table->rowspan[0][2] = 6; if ($action == 'new') { - $table->data[0][2] = 'data[0][2] = ''; - $table->data[0][2] .= 'data[0][2] .= ''; } else { if (defined('METACONSOLE')) { - $table->data[0][2] = 'data[0][2] = ''; } else { - $table->data[0][2] = 'data[0][2] = ''; } - $table->data[0][2] .= 'data[0][2] .= ''; } -$table->data[1][0] = __('Group:'); +$table->data[1][0] = __('Group'); +$return_all_group = false; + +if (users_can_manage_group_all('RW') === true) { + $return_all_group = true; +} $table->data[1][1] = ''.html_print_input( [ 'type' => 'select_groups', 'id_user' => $config['id_user'], 'privilege' => 'RW', - 'returnAllGroup' => true, + 'returnAllGroup' => $return_all_group, 'name' => 'id_group', 'selected' => $idGroup, 'script' => '', @@ -211,7 +216,7 @@ $table->data[5][1] = 'data[5][1] .= ''.html_print_input_text('width', $preimagew, '', 10, 10, true, false).' x '.html_print_input_text('height', $preimageh, '', 10, 10, true, false).''; $table->data[5][1] .= ' - '.__('Get default image size').''; $table->data[6][0] = __('Favourite visual console'); @@ -432,4 +437,4 @@ $(document).ready (function () { } }); - \ No newline at end of file + diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 79eac961b8..310efdfabc 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -83,9 +83,9 @@ visual_map_editor_print_hack_translate_strings(); visual_map_editor_print_item_palette($visualConsole['id'], $background); if (!defined('METACONSOLE')) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } echo '"; +echo ""; echo ''; echo ''; @@ -163,11 +164,11 @@ html_print_input_hidden('message_size', __('Min allowed size is 1024x768')); // Loading dialog -echo "".__('Loading in progress').''.html_print_image('images/spinner.gif', true).''; +echo "".__('Loading in progress').''.html_print_image('images/spinner.gif', true).''; -echo "".__('Saving in progress').''.html_print_image('images/spinner.gif', true).''; +echo "".__('Saving in progress').''.html_print_image('images/spinner.gif', true).''; -echo "".__('Deletion in progress').''.html_print_image('images/spinner.gif', true).''; +echo "".__('Deletion in progress').''.html_print_image('images/spinner.gif', true).''; // CSS ui_require_css_file('color-picker', 'include/styles/js/'); diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index 43197edbc5..780ef8b397 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -119,7 +119,14 @@ $table->head[5] .= ' '.__('A.'). $table->size = []; $table->size['icon'] = '1%'; -$table->size[0] = '25%'; +$table->size[0] = '28%'; +$table->size[1] = ''; +$table->size[2] = '25%'; +$table->size[3] = '27%'; +$table->size[4] = '7%'; +$table->size[5] = '15%'; + + $table->align = []; if (!defined('METACONSOLE')) { @@ -141,9 +148,9 @@ $table->data = []; // Background $table->data[0]['icon'] = ''; -$table->data[0][0] = ''.__('Background').''; -$table->data[0][1] = ''.html_print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true, false, true, '', false, 'width: 120px;').''; -$table->data[0][2] = ''.html_print_input_text('width', $visualConsole['width'], '', 3, 5, true).' x '.html_print_input_text('height', $visualConsole['height'], '', 3, 5, true).''; +$table->data[0][0] = ''.__('Background').''; +$table->data[0][1] = ''.html_print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true, false, true, '', false, 'width: 120px;').''; +$table->data[0][2] = ''.html_print_input_text('width', $visualConsole['width'], '', 3, 5, true).' x '.html_print_input_text('height', $visualConsole['height'], '', 3, 5, true).''; $table->data[0][3] = $table->data[0][4] = $table->data[0][5] = ''; $i = 1; @@ -169,9 +176,12 @@ foreach ($layoutDatas as $layoutData) { switch ($layoutData['type']) { case STATIC_GRAPH: $table->data[($i + 1)]['icon'] = html_print_image( - 'images/camera.png', + 'images/camera_mc.png', true, - ['title' => __('Static Image')] + [ + 'title' => __('Static Image'), + 'class' => 'invert_filter', + ] ); break; @@ -179,7 +189,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)]['icon'] = html_print_image( 'images/chart_bar.png', true, - ['title' => __('Percentile Bar')] + [ + 'title' => __('Percentile Bar'), + 'class' => 'invert_filter', + ] ); break; @@ -195,7 +208,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)]['icon'] = html_print_image( 'images/chart_curve.png', true, - ['title' => __('Module Graph')] + [ + 'title' => __('Module Graph'), + 'class' => 'invert_filter', + ] ); break; @@ -211,7 +227,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)]['icon'] = html_print_image( 'images/binary.png', true, - ['title' => __('Simple Value')] + [ + 'title' => __('Simple Value'), + 'class' => 'invert_filter', + ] ); break; @@ -219,7 +238,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)]['icon'] = html_print_image( 'images/binary.png', true, - ['title' => __('Simple Value (Process Max)')] + [ + 'title' => __('Simple Value (Process Max)'), + 'class' => 'invert_filter', + ] ); break; @@ -227,7 +249,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)]['icon'] = html_print_image( 'images/binary.png', true, - ['title' => __('Simple Value (Process Min)')] + [ + 'title' => __('Simple Value (Process Min)'), + 'class' => 'invert_filter', + ] ); break; @@ -235,7 +260,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)]['icon'] = html_print_image( 'images/binary.png', true, - ['title' => __('Simple Value (Process Avg)')] + [ + 'title' => __('Simple Value (Process Avg)'), + 'class' => 'invert_filter', + ] ); break; @@ -251,7 +279,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)]['icon'] = html_print_image( 'images/photo.png', true, - ['title' => __('Icon')] + [ + 'title' => __('Icon'), + 'class' => 'invert_filter', + ] ); break; @@ -259,7 +290,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)]['icon'] = html_print_image( 'images/box_item.png', true, - ['title' => __('Box')] + [ + 'title' => __('Box'), + 'class' => 'invert_filter', + ] ); break; @@ -271,11 +305,15 @@ foreach ($layoutDatas as $layoutData) { ); break; + case NETWORK_LINK: case LINE_ITEM: $table->data[($i + 1)]['icon'] = html_print_image( 'images/line_item.png', true, - ['title' => __('Line')] + [ + 'title' => __('Line'), + 'class' => 'invert_filter', + ] ); break; @@ -303,13 +341,14 @@ foreach ($layoutDatas as $layoutData) { switch ($layoutData['type']) { case ICON: case BOX_ITEM: + case NETWORK_LINK: case LINE_ITEM: // hasn't the label. $table->data[($i + 1)][0] = ''; break; default: - $table->data[($i + 1)][0] = ''.html_print_input_hidden('label_'.$idLayoutData, $layoutData['label'], true).''.__('Edit label').''.''; + $table->data[($i + 1)][0] = ''.html_print_input_hidden('label_'.$idLayoutData, $layoutData['label'], true).''.__('Edit label').''.''; break; } @@ -345,6 +384,7 @@ foreach ($layoutDatas as $layoutData) { // Width and height switch ($layoutData['type']) { + case NETWORK_LINK: case LINE_ITEM: // hasn't the width and height. $table->data[($i + 1)][2] = ''; @@ -361,6 +401,7 @@ foreach ($layoutDatas as $layoutData) { // Position switch ($layoutData['type']) { + case NETWORK_LINK: case LINE_ITEM: // hasn't the width and height. $table->data[($i + 1)][3] = ''; @@ -375,6 +416,7 @@ foreach ($layoutDatas as $layoutData) { // Parent switch ($layoutData['type']) { case BOX_ITEM: + case NETWORK_LINK: case LINE_ITEM: case COLOR_CLOUD: $table->data[($i + 1)][4] = ''; @@ -402,7 +444,7 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)][5] = ''; $table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true); - $table->data[($i + 1)][5] .= ''.html_print_image('images/cross.png', true).''; + $table->data[($i + 1)][5] .= ''.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).''; // Second row $table->data[($i + 2)]['icon'] = ''; @@ -434,6 +476,7 @@ foreach ($layoutDatas as $layoutData) { case BOX_ITEM: case ICON: case LABEL: + case NETWORK_LINK: case LINE_ITEM: $table->data[($i + 2)][0] = ''; break; @@ -494,6 +537,7 @@ foreach ($layoutDatas as $layoutData) { case ICON: case LABEL: case BOX_ITEM: + case NETWORK_LINK: case LINE_ITEM: case GROUP_ITEM: $table->data[($i + 2)][1] = ''; @@ -598,6 +642,7 @@ foreach ($layoutDatas as $layoutData) { // Map linked switch ($layoutData['type']) { + case NETWORK_LINK: case LINE_ITEM: case BOX_ITEM: case AUTO_SLA_GRAPH: @@ -690,7 +735,7 @@ echo ''; // Trick for it have a traduct text for javascript. -echo ''.__('IP').''; +echo ''.__('IP').''; ?> diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 9cd6a4fd31..26fb5e0912 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -85,8 +85,8 @@ else if ($activeTab != 'data' || ($activeTab == 'data' && $action != 'new')) { // ACL for the existing visual console // $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR"); - $vconsole_write = check_acl($config['id_user'], $visualConsole['id_group'], 'VW'); - $vconsole_manage = check_acl($config['id_user'], $visualConsole['id_group'], 'VM'); + $vconsole_write = check_acl_restricted_all($config['id_user'], $visualConsole['id_group'], 'VW'); + $vconsole_manage = check_acl_restricted_all($config['id_user'], $visualConsole['id_group'], 'VM'); } else { db_pandora_audit( 'ACL Violation', @@ -143,8 +143,8 @@ switch ($activeTab) { // ACL for the new visual console // $vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR"); - $vconsole_write_new = check_acl($config['id_user'], $idGroup, 'VW'); - $vconsole_manage_new = check_acl($config['id_user'], $idGroup, 'VM'); + $vconsole_write_new = check_acl_restricted_all($config['id_user'], $idGroup, 'VW'); + $vconsole_manage_new = check_acl_restricted_all($config['id_user'], $idGroup, 'VM'); // The user should have permissions on the new group if (!$vconsole_write_new && !$vconsole_manage_new) { @@ -757,42 +757,42 @@ $buttons = []; $buttons['consoles_list'] = [ 'active' => false, - 'text' => ''.html_print_image('images/visual_console.png', true, ['title' => __('Visual consoles list')]).'', + 'text' => ''.html_print_image('images/visual_console.png', true, ['title' => __('Visual consoles list'), 'class' => 'invert_filter']).'', ]; $buttons['public_link'] = [ 'active' => false, - 'text' => ''.html_print_image('images/camera_mc.png', true, ['title' => __('Show link to public Visual Console')]).'', + 'text' => ''.html_print_image('images/camera_mc.png', true, ['title' => __('Show link to public Visual Console'), 'class' => 'invert_filter']).'', ]; $buttons['data'] = [ 'active' => false, - 'text' => ''.html_print_image('images/op_reporting.png', true, ['title' => __('Main data')]).'', + 'text' => ''.html_print_image('images/op_reporting.png', true, ['title' => __('Main data'), 'class' => 'invert_filter']).'', ]; $buttons['list_elements'] = [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List elements')]).'', + 'text' => ''.html_print_image('images/list.png', true, ['title' => __('List elements'), 'class' => 'invert_filter']).'', ]; if (enterprise_installed()) { $buttons['wizard_services'] = [ 'active' => false, - 'text' => ''.html_print_image('images/wand_services.png', true, ['title' => __('Services wizard')]).'', + 'text' => ''.html_print_image('images/wand_services.png', true, ['title' => __('Services wizard'), 'class' => 'invert_filter']).'', ]; } $buttons['wizard'] = [ 'active' => false, - 'text' => ''.html_print_image('images/wand.png', true, ['title' => __('Wizard')]).'', + 'text' => ''.html_print_image('images/wand.png', true, ['title' => __('Wizard'), 'class' => 'invert_filter']).'', ]; if ($config['legacy_vc']) { $buttons['editor'] = [ 'active' => false, - 'text' => ''.html_print_image('images/builder.png', true, ['title' => __('Builder')]).'', + 'text' => ''.html_print_image('images/builder.png', true, ['title' => __('Builder'), 'class' => 'invert_filter']).'', ]; } $buttons['view'] = [ 'active' => false, - 'text' => ''.html_print_image('images/operation.png', true, ['title' => __('View')]).'', + 'text' => ''.html_print_image('images/operation.png', true, ['title' => __('View'), 'class' => 'invert_filter']).'', ]; if ($action == 'new' || $idVisualConsole === false) { diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index 634f35c20a..9185598c99 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -449,7 +449,7 @@ $table->data['all_4'][1] = html_print_select( true, true ); -$table->data['all_4'][2] = ' '.__('Modules').''; +$table->data['all_4'][2] = ' '.__('Modules').''; $table->data['all_4'][3] = html_print_select( [], 'module[]', @@ -535,7 +535,7 @@ if (is_metaconsole()) { } if (defined('METACONSOLE')) { - echo "".__('Wizard').''; + echo "".__('Wizard').''; } html_print_table($table); @@ -553,9 +553,9 @@ echo ''; echo ''; // Trick for it have a traduct text for javascript. -echo ''.__('Any').''; -echo ''.__('None').''; -echo ''.__('Loading...').''; +echo ''.__('Any').''; +echo ''.__('None').''; +echo ''.__('Loading...').''; ?> '; - if ($rawjs) { - $output .= $rawjs; - } - - if ($return === false) { - echo $output; - } - - return $output_head.$output; - + return HTML::printForm($data, $return, $print_white_box); } @@ -786,112 +454,7 @@ class Wizard */ public function printFormAsGrid(array $data, bool $return=false) { - $form = $data['form']; - - $rows = $data['rows']; - - $js = $data['js']; - $rawjs = $data['js_block']; - $cb_function = $data['cb_function']; - $cb_args = $data['cb_args']; - - $output_head = ''; - - if ($return === false) { - echo $output_head; - } - - try { - if (isset($cb_function) === true) { - call_user_func_array( - $cb_function, - (isset($cb_args) === true) ? $cb_args : [] - ); - } - } catch (Exception $e) { - error_log('Error executing wizard callback: ', $e->getMessage()); - } - - $output_submit = ''; - $output = ''; - - $first_block_printed = false; - - if (is_array($rows)) { - foreach ($rows as $row) { - if ($row['new_form_block'] == true) { - if ($first_block_printed === true) { - // If first form block has been placed, then close it before starting a new one. - $output .= ''; - $output .= ''; - } else { - $output .= ''; - } - - $first_block_printed = true; - } - - $row_output = ''; - - foreach ($row['columns'] as $column) { - $width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;'; - $padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;'; - $padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;'; - $extra_styles = isset($column['style']) ? $column['style'] : ''; - $class = isset($column['class']) ? $column['class'] : ''; - - $row_output .= ''; - - foreach ($column['inputs'] as $input) { - if (is_array($input)) { - if ($input['arguments']['type'] != 'submit') { - $row_output .= $this->printBlockAsGrid($input, true); - } else { - $output_submit .= $this->printBlockAsGrid($input, true); - } - } else { - $row_output .= $input; - } - } - - $row_output .= ''; - } - - if (isset($row['toggle'])) { - $output .= ui_print_toggle( - [ - 'content' => $row_output, - 'name' => $row['toggle_label'], - 'hidden_default' => ! (bool) $row['toggle'], - 'return' => true, - ] - ); - } else { - $output .= $row_output; - } - - $output .= ''; - } - } - - $output .= ''; - - $output .= ''.$output_submit.''; - $output .= ''; - $output .= ''; - if ($rawjs) { - $output .= $rawjs; - } - - if ($return === false) { - echo $output; - } - - return $output_head.$output; - + return HTML::printFormAsGrid($data, $return); } @@ -905,57 +468,7 @@ class Wizard */ public function printFormAsList(array $data, bool $return=false) { - $form = $data['form']; - $inputs = $data['inputs']; - $js = $data['js']; - $rawjs = $data['js_block']; - $cb_function = $data['cb_function']; - $cb_args = $data['cb_args']; - - $output_head = ''; - - if ($return === false) { - echo $output_head; - } - - try { - if (isset($cb_function) === true) { - call_user_func_array( - $cb_function, - (isset($cb_args) === true) ? $cb_args : [] - ); - } - } catch (Exception $e) { - error_log('Error executing wizard callback: ', $e->getMessage()); - } - - $output = ''; - $output .= ''; - - foreach ($inputs as $input) { - if ($input['arguments']['type'] != 'submit') { - $output .= $this->printBlockAsList($input, true); - } else { - $output_submit .= $this->printBlockAsList($input, true); - } - } - - $output .= ''; - $output .= ''; - $output .= ''.$output_submit.''; - $output .= ''; - $output .= ''; - if ($rawjs) { - $output .= $rawjs; - } - - if ($return === false) { - echo $output; - } - - return $output_head.$output; - + return HTML::printFormAsList($data, $return); } diff --git a/pandora_console/images/eye.png b/pandora_console/images/eye.png old mode 100644 new mode 100755 index 52c38f3a2f..57f63bb0c8 Binary files a/pandora_console/images/eye.png and b/pandora_console/images/eye.png differ diff --git a/pandora_console/images/builder.menu_gray.png b/pandora_console/images/menu/builder.menu_gray.png similarity index 100% rename from pandora_console/images/builder.menu_gray.png rename to pandora_console/images/menu/builder.menu_gray.png diff --git a/pandora_console/images/builder.menu_white.png b/pandora_console/images/menu/builder.menu_white.png similarity index 100% rename from pandora_console/images/builder.menu_white.png rename to pandora_console/images/menu/builder.menu_white.png diff --git a/pandora_console/images/extensions.menu_gray.png b/pandora_console/images/menu/extensions.menu_gray.png similarity index 100% rename from pandora_console/images/extensions.menu_gray.png rename to pandora_console/images/menu/extensions.menu_gray.png diff --git a/pandora_console/images/extensions.menu_white.png b/pandora_console/images/menu/extensions.menu_white.png similarity index 100% rename from pandora_console/images/extensions.menu_white.png rename to pandora_console/images/menu/extensions.menu_white.png diff --git a/pandora_console/images/gm_alerts.menu_gray.png b/pandora_console/images/menu/gm_alerts.menu_gray.png similarity index 100% rename from pandora_console/images/gm_alerts.menu_gray.png rename to pandora_console/images/menu/gm_alerts.menu_gray.png diff --git a/pandora_console/images/gm_alerts.menu_white.png b/pandora_console/images/menu/gm_alerts.menu_white.png similarity index 100% rename from pandora_console/images/gm_alerts.menu_white.png rename to pandora_console/images/menu/gm_alerts.menu_white.png diff --git a/pandora_console/images/gm_configuration.menu_gray.png b/pandora_console/images/menu/gm_configuration.menu_gray.png similarity index 100% rename from pandora_console/images/gm_configuration.menu_gray.png rename to pandora_console/images/menu/gm_configuration.menu_gray.png diff --git a/pandora_console/images/gm_configuration.menu_white.png b/pandora_console/images/menu/gm_configuration.menu_white.png similarity index 100% rename from pandora_console/images/gm_configuration.menu_white.png rename to pandora_console/images/menu/gm_configuration.menu_white.png diff --git a/pandora_console/images/gm_discovery.menu.png b/pandora_console/images/menu/gm_discovery.menu.png similarity index 100% rename from pandora_console/images/gm_discovery.menu.png rename to pandora_console/images/menu/gm_discovery.menu.png diff --git a/pandora_console/images/gm_discovery.menu_white.png b/pandora_console/images/menu/gm_discovery.menu_white.png similarity index 100% rename from pandora_console/images/gm_discovery.menu_white.png rename to pandora_console/images/menu/gm_discovery.menu_white.png diff --git a/pandora_console/images/gm_events.menu_gray.png b/pandora_console/images/menu/gm_events.menu_gray.png similarity index 100% rename from pandora_console/images/gm_events.menu_gray.png rename to pandora_console/images/menu/gm_events.menu_gray.png diff --git a/pandora_console/images/gm_events.menu_white.png b/pandora_console/images/menu/gm_events.menu_white.png similarity index 100% rename from pandora_console/images/gm_events.menu_white.png rename to pandora_console/images/menu/gm_events.menu_white.png diff --git a/pandora_console/images/gm_library.menu_gray.png b/pandora_console/images/menu/gm_library.menu_gray.png similarity index 100% rename from pandora_console/images/gm_library.menu_gray.png rename to pandora_console/images/menu/gm_library.menu_gray.png diff --git a/pandora_console/images/gm_library.menu_white.png b/pandora_console/images/menu/gm_library.menu_white.png similarity index 100% rename from pandora_console/images/gm_library.menu_white.png rename to pandora_console/images/menu/gm_library.menu_white.png diff --git a/pandora_console/images/gm_resources.menu_gray.png b/pandora_console/images/menu/gm_resources.menu_gray.png similarity index 100% rename from pandora_console/images/gm_resources.menu_gray.png rename to pandora_console/images/menu/gm_resources.menu_gray.png diff --git a/pandora_console/images/gm_resources.menu_white.png b/pandora_console/images/menu/gm_resources.menu_white.png similarity index 100% rename from pandora_console/images/gm_resources.menu_white.png rename to pandora_console/images/menu/gm_resources.menu_white.png diff --git a/pandora_console/images/gm_servers.menu_gray.png b/pandora_console/images/menu/gm_servers.menu_gray.png similarity index 100% rename from pandora_console/images/gm_servers.menu_gray.png rename to pandora_console/images/menu/gm_servers.menu_gray.png diff --git a/pandora_console/images/gm_servers.menu_white.png b/pandora_console/images/menu/gm_servers.menu_white.png similarity index 100% rename from pandora_console/images/gm_servers.menu_white.png rename to pandora_console/images/menu/gm_servers.menu_white.png diff --git a/pandora_console/images/gm_setup.menu_gray.png b/pandora_console/images/menu/gm_setup.menu_gray.png similarity index 100% rename from pandora_console/images/gm_setup.menu_gray.png rename to pandora_console/images/menu/gm_setup.menu_gray.png diff --git a/pandora_console/images/gm_setup.menu_white.png b/pandora_console/images/menu/gm_setup.menu_white.png similarity index 100% rename from pandora_console/images/gm_setup.menu_white.png rename to pandora_console/images/menu/gm_setup.menu_white.png diff --git a/pandora_console/images/gm_users.menu_gray.png b/pandora_console/images/menu/gm_users.menu_gray.png similarity index 100% rename from pandora_console/images/gm_users.menu_gray.png rename to pandora_console/images/menu/gm_users.menu_gray.png diff --git a/pandora_console/images/gm_users.menu_white.png b/pandora_console/images/menu/gm_users.menu_white.png similarity index 100% rename from pandora_console/images/gm_users.menu_white.png rename to pandora_console/images/menu/gm_users.menu_white.png diff --git a/pandora_console/images/links.menu_gray.png b/pandora_console/images/menu/links.menu_gray.png similarity index 100% rename from pandora_console/images/links.menu_gray.png rename to pandora_console/images/menu/links.menu_gray.png diff --git a/pandora_console/images/links.menu_white.png b/pandora_console/images/menu/links.menu_white.png similarity index 100% rename from pandora_console/images/links.menu_white.png rename to pandora_console/images/menu/links.menu_white.png diff --git a/pandora_console/images/op_events.menu_gray.png b/pandora_console/images/menu/op_events.menu_gray.png similarity index 100% rename from pandora_console/images/op_events.menu_gray.png rename to pandora_console/images/menu/op_events.menu_gray.png diff --git a/pandora_console/images/op_events.menu_white.png b/pandora_console/images/menu/op_events.menu_white.png similarity index 100% rename from pandora_console/images/op_events.menu_white.png rename to pandora_console/images/menu/op_events.menu_white.png diff --git a/pandora_console/images/op_monitoring.menu_gray.png b/pandora_console/images/menu/op_monitoring.menu_gray.png similarity index 100% rename from pandora_console/images/op_monitoring.menu_gray.png rename to pandora_console/images/menu/op_monitoring.menu_gray.png diff --git a/pandora_console/images/op_monitoring.menu_white.png b/pandora_console/images/menu/op_monitoring.menu_white.png similarity index 100% rename from pandora_console/images/op_monitoring.menu_white.png rename to pandora_console/images/menu/op_monitoring.menu_white.png diff --git a/pandora_console/images/op_network.menu_gray.png b/pandora_console/images/menu/op_network.menu_gray.png similarity index 100% rename from pandora_console/images/op_network.menu_gray.png rename to pandora_console/images/menu/op_network.menu_gray.png diff --git a/pandora_console/images/op_network.menu_white.png b/pandora_console/images/menu/op_network.menu_white.png similarity index 100% rename from pandora_console/images/op_network.menu_white.png rename to pandora_console/images/menu/op_network.menu_white.png diff --git a/pandora_console/images/op_reporting.menu_gray.png b/pandora_console/images/menu/op_reporting.menu_gray.png similarity index 100% rename from pandora_console/images/op_reporting.menu_gray.png rename to pandora_console/images/menu/op_reporting.menu_gray.png diff --git a/pandora_console/images/op_reporting.menu_white.png b/pandora_console/images/menu/op_reporting.menu_white.png similarity index 100% rename from pandora_console/images/op_reporting.menu_white.png rename to pandora_console/images/menu/op_reporting.menu_white.png diff --git a/pandora_console/images/op_workspace.menu_gray.png b/pandora_console/images/menu/op_workspace.menu_gray.png similarity index 100% rename from pandora_console/images/op_workspace.menu_gray.png rename to pandora_console/images/menu/op_workspace.menu_gray.png diff --git a/pandora_console/images/op_workspace.menu_white.png b/pandora_console/images/menu/op_workspace.menu_white.png similarity index 100% rename from pandora_console/images/op_workspace.menu_white.png rename to pandora_console/images/menu/op_workspace.menu_white.png diff --git a/pandora_console/images/um_messages.menu_gray.png b/pandora_console/images/menu/um_messages.menu_gray.png similarity index 100% rename from pandora_console/images/um_messages.menu_gray.png rename to pandora_console/images/menu/um_messages.menu_gray.png diff --git a/pandora_console/images/um_messages.menu_white.png b/pandora_console/images/menu/um_messages.menu_white.png similarity index 100% rename from pandora_console/images/um_messages.menu_white.png rename to pandora_console/images/menu/um_messages.menu_white.png diff --git a/pandora_console/images/network_link_item.disabled.png b/pandora_console/images/network_link_item.disabled.png new file mode 100644 index 0000000000..65e00ca52d Binary files /dev/null and b/pandora_console/images/network_link_item.disabled.png differ diff --git a/pandora_console/images/network_link_item.png b/pandora_console/images/network_link_item.png new file mode 100644 index 0000000000..33a23aeef8 Binary files /dev/null and b/pandora_console/images/network_link_item.png differ diff --git a/pandora_console/images/operation.png b/pandora_console/images/operation.png old mode 100755 new mode 100644 index 57f63bb0c8..52c38f3a2f Binary files a/pandora_console/images/operation.png and b/pandora_console/images/operation.png differ diff --git a/pandora_console/images/spinner_charts.gif b/pandora_console/images/spinner_charts.gif new file mode 100644 index 0000000000..e092d81289 Binary files /dev/null and b/pandora_console/images/spinner_charts.gif differ diff --git a/pandora_console/images/user.png b/pandora_console/images/user.png new file mode 100644 index 0000000000..84b3b01cac Binary files /dev/null and b/pandora_console/images/user.png differ diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php index 81313fc660..73971caa9c 100644 --- a/pandora_console/include/ajax/alert_list.ajax.php +++ b/pandora_console/include/ajax/alert_list.ajax.php @@ -423,7 +423,7 @@ if ($show_update_action_menu) { ); $data .= ''; - $data .= ''; + $data .= ''; $data .= html_print_input_hidden( 'update_action', 1, @@ -436,7 +436,7 @@ if ($show_update_action_menu) { ); if (! $id_agente) { $data .= ''; - $data .= ''; + $data .= ''; $data .= __('Agent').' '.ui_print_help_icon( 'alert_scalate', true, @@ -457,7 +457,7 @@ if ($show_update_action_menu) { } $data .= ''; - $data .= ''; + $data .= ''; $data .= __('Module'); $data .= ''; $data .= ''; @@ -472,7 +472,7 @@ if ($show_update_action_menu) { $data .= ''; $data .= ''; $data .= ''; - $data .= ''; + $data .= ''; $data .= __('Action'); $data .= ''; $data .= ''; @@ -493,7 +493,7 @@ if ($show_update_action_menu) { $data .= ''; $data .= ''; $data .= ''; - $data .= ''; + $data .= ''; $data .= __('Number of alerts match from'); $data .= ''; $data .= ''; @@ -517,7 +517,7 @@ if ($show_update_action_menu) { $data .= ''; $data .= ''; $data .= ''; - $data .= ''; + $data .= ''; $data .= __('Threshold'); $data .= ''; $data .= ''; diff --git a/pandora_console/include/ajax/custom_fields.php b/pandora_console/include/ajax/custom_fields.php index 9dde75e669..8d07c98f36 100644 --- a/pandora_console/include/ajax/custom_fields.php +++ b/pandora_console/include/ajax/custom_fields.php @@ -54,6 +54,16 @@ if (check_login()) { $update_filter_cf = (bool) get_parameter('update_filter_cf', 0); $delete_filter_cf = (bool) get_parameter('delete_filter_cf', 0); $change_name_filter = (bool) get_parameter('change_name_filter', 0); + $check_csv_button = (bool) get_parameter('check_csv_button', 0); + + if ($check_csv_button) { + if (check_acl($config['id_user'], 0, 'PM')) { + echo json_encode($permission); + return; + } else { + exit; + } + } if ($get_custom_fields_data) { $name_custom_fields = get_parameter('name_custom_fields', 0); @@ -527,7 +537,7 @@ if (check_login()) { $type_form = get_parameter('type_form', ''); if ($type_form == 'save') { - $tabs = ''; + $tabs = ''; $tabs .= ""; $tabs .= ''; $tabs .= ""; diff --git a/pandora_console/include/ajax/double_auth.ajax.php b/pandora_console/include/ajax/double_auth.ajax.php index b5c816c6b3..ebe45a3894 100644 --- a/pandora_console/include/ajax/double_auth.ajax.php +++ b/pandora_console/include/ajax/double_auth.ajax.php @@ -18,6 +18,8 @@ check_login(); // Security check $id_user = (string) get_parameter('id_user'); $FA_forced = (int) get_parameter('FA_forced'); +$id_user_auth = (string) get_parameter('id_user_auth', $config['id_user']); + if ($id_user !== $config['id_user'] && $FA_forced != 1) { db_pandora_audit( @@ -70,12 +72,12 @@ if ($validate_double_auth_code) { if ($result && $save) { // Delete the actual value (if exists) - $where = ['id_user' => $id_user]; + $where = ['id_user' => $id_user_auth]; db_process_sql_delete('tuser_double_auth', $where); // Insert the new value $values = [ - 'id_user' => $id_user, + 'id_user' => $id_user_auth, 'secret' => $secret, ]; $result = (bool) db_process_sql_insert('tuser_double_auth', $values); @@ -152,12 +154,15 @@ if ($get_double_auth_data_page) { ob_clean(); ?> + + + '; + + if ($return === true) { + return $output; + } else { + echo $output; + } +} diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index 1b379bceb2..b641448af5 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -164,13 +164,13 @@ function config_wiz_modal( $output = ''; // Prints first step pandora registration. - $output .= ''; + $output .= ''; - $output .= ''; + $output .= ''; $output .= __('Please fill the following information in order to configure your %s instance successfully', get_product_name()).'.'; $output .= ''; - $output .= ''; + $output .= ''; $table = new StdClass(); $table->class = 'databox filters'; $table->width = '100%'; @@ -236,25 +236,25 @@ function config_wiz_modal( $output .= html_print_table($table, true); $output .= ''; - $output .= ''; + $output .= ''; $output .= html_print_submit_button( __('Cancel'), 'cancel', false, - 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub cancel submit-cancel" style="width:100px;"', + 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub cancel submit-cancel w100px"', true ); $output .= ''; - $output .= ''; + $output .= ''; $output .= html_print_submit_button( __('Continue'), 'register-next', false, - 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next" style="width:100px;"', + 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next w100px"', true ); $output .= ''; - $output .= ''; + $output .= ''; $output .= __('All fields required'); $output .= ''; $output .= ''; @@ -262,8 +262,8 @@ function config_wiz_modal( $output .= ''; // Verification modal. - $output .= ''; - $output .= ''; + $output .= ''; + $output .= ''; $output .= __('Are you sure you don\'t want to configure a base email?'); $output .= ''; $output .= __('You could change this options later in "alert actions" and setting your account.'); @@ -493,26 +493,26 @@ function registration_wiz_modal( $output .= ''; - $output .= ''; + $output .= '" class="invisible">'; + $output .= ''; $output .= html_print_image('images/pandora_circle_big.png', true); $output .= ''; - $output .= ''; + $output .= ''; $output .= __( 'Keep this %s console up to date with latest updates.', $product_name ); $output .= ''; - $output .= ''; + $output .= ''; $output .= ''; $output .= __('When you subscribe to the %s Update Manager service, you accept that we register your %s instance as an identifier on a database owned by %s. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the Update Manager options.', $product_name, $product_name, $product_name, $product_name); $output .= ''; $output .= ''; $output .= ''; - $output .= ''; + $output .= ''; $output .= html_print_submit_button( __('Cancel'), 'cancel_registration', @@ -521,24 +521,24 @@ function registration_wiz_modal( true ); $output .= ''; - $output .= ''; + $output .= ''; $output .= html_print_submit_button( __('OK!'), 'register', false, - 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next" style="width:100px;"', + 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next w100px"', true ); $output .= ''; $output .= ''; - $output .= ''; + $output .= ''; $output .= ''; $output .= ''; // Verification modal. - $output .= ''; - $output .= ''; + $output .= ''; + $output .= ''; $output .= __('Are you sure you don\'t want to use update manager?'); $output .= ''; $output .= __('You will need to update your system manually, through source code or RPM packages to be up to date with latest updates.'); @@ -547,8 +547,8 @@ function registration_wiz_modal( $output .= ''; // Results modal. - $output .= ''; - $output .= ''; + $output .= ''; + $output .= ''; $output .= ''; $output .= ''; @@ -761,19 +761,19 @@ function newsletter_wiz_modal( $output .= ''; - $output .= ''; - $output .= html_print_image('images/pandora_circle_big.png', true); + $output .= '" class="invisible">'; + $output .= ''; + $output .= html_print_image('image/pandora_big_circle.png', true); $output .= ''; - $output .= ''; + $output .= ''; $output .= __( 'Subscribe to our newsletter', $product_name ); $output .= ''; - $output .= ''; + $output .= ''; $output .= 'Stay up to date with updates, upgrades and promotions by subscribing to our newsletter.'; $output .= ''; $output .= __( @@ -788,7 +788,7 @@ function newsletter_wiz_modal( // Show regiter to newsletter state. $show_newsletter = ($display_newsletter !== true) ? 'inline-block' : 'none'; - $output .= ''; + $output .= ''; $output .= ''; $output .= ''.__('Email').' '; $output .= html_print_input_text_extended( @@ -806,34 +806,34 @@ function newsletter_wiz_modal( $output .= ''; $output .= ''; - $output .= ''; + $output .= ''; $output .= html_print_submit_button( __('Cancel'), 'cancel_newsletter', false, - 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel" style="width:100px;"', + 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel w100px"', true ); $output .= ''; - $output .= ''; + $output .= ''; $output .= html_print_submit_button( __('OK!'), 'newsletter', false, - 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next" style="width:100px;"', + 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next w100px"', true ); $output .= ''; $output .= ''; - $output .= ''; + $output .= ''; $output .= ''; $output .= ''; $output .= ''; // Verification modal. - $output .= ''; - $output .= ''; + $output .= ''; + $output .= ''; $output .= __('Are you sure you don\'t want to subscribe?'); $output .= ''; $output .= __('You will miss all news about amazing features and fixes!'); @@ -842,8 +842,8 @@ function newsletter_wiz_modal( $output .= ''; // Results modal. - $output .= ''; - $output .= ''; + $output .= ''; + $output .= ''; $output .= ''; $output .= ''; @@ -1437,7 +1437,7 @@ function update_manager_check_online_free_packages($is_ajax=true) var text4_mr_file = ""; text4_mr_file += ""; - text4_mr_file += ""; + text4_mr_file += ""; text4_mr_file += ""; text4_mr_file += ""; diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index c700c221c7..17e2d8baf0 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -123,12 +123,17 @@ function users_get_groups_for_select( $returnAllColumns=false, $id_groups=null, $keys_field='id_grupo', - $ajax_format=false + $ajax_format=false, + $check_user_can_manage_all=false ) { if ($id_groups === false) { $id_groups = null; } + if ($check_user_can_manage_all === true && users_can_manage_group_all($privilege) === false) { + $returnAllGroup = false; + } + $user_groups = users_get_groups( $id_user, $privilege, @@ -299,6 +304,7 @@ function users_get_groups( $search='' ) { static $group_cache = []; + $filter = ''; // Added users_group_cache to avoid unnecessary proccess on massive calls... static $users_group_cache = []; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 60aaaa64b1..25631f2b4d 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -42,8 +42,8 @@ function visual_map_print_item_toolbox($idDiv, $text, $float) $margin = 'margin-left'; } - echo ''; + echo ''; echo $text; echo ''; echo ''; @@ -238,9 +238,9 @@ function visual_map_print_item( if ($label_position == 'left') { $text = ''.$label.''; } else if ($label_position == 'right') { - $text = ''.$label.''; + $text = ''.$label.''; } else { - $text = ''.$label.''; + $text = ''.$label.''; } if (!isset($layoutData['status_calculated'])) { @@ -1135,15 +1135,15 @@ function visual_map_print_item( if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) { if ($width == 0) { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } else { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } else { @@ -1498,22 +1498,22 @@ function visual_map_print_item( if ($width == 0) { if ($layoutData['id_metaconsole'] != 0) { if ($layoutData['clock_animation'] == 'analogic_1') { - $img = ''; + $img = ''; } else { if ($layoutData['time_format'] = 'time') { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } else { if ($layoutData['clock_animation'] == 'analogic_1') { - $img = ''; + $img = ''; } else { if ($layoutData['time_format'] == 'time') { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } @@ -1550,15 +1550,15 @@ function visual_map_print_item( if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) { if ($width == 0 || $height == 0) { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } else { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } else { @@ -1568,7 +1568,7 @@ function visual_map_print_item( } else if ($layoutData['label_position'] == 'right') { $img = ''.graph_graphic_moduleevents($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).''; } else { - $img = ''.graph_graphic_moduleevents($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).''; + $img = ''.graph_graphic_moduleevents($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).''; } } else { if ($layoutData['label_position'] == 'left') { @@ -1576,7 +1576,7 @@ function visual_map_print_item( } else if ($layoutData['label_position'] == 'right') { $img = ''.graph_graphic_moduleevents($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).''; } else { - $img = ''.graph_graphic_moduleevents($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).''; + $img = ''.graph_graphic_moduleevents($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).''; } } } @@ -1796,9 +1796,9 @@ function visual_map_print_item( if ($layoutData['show_statistics'] == 1) { if (get_parameter('action') == 'edit') { if ($width == 0 || $height == 0) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } } else { $is_meta = is_metaconsole(); @@ -1876,19 +1876,19 @@ function visual_map_print_item( } echo '">'; - echo ""; - echo "".groups_get_name($layoutData['id_group'], true).''; + echo ""; + echo "".groups_get_name($layoutData['id_group'], true).''; echo ''; - echo ""; + echo ""; echo ''; - echo "".remove_right_zeros(number_format($stat_agent_cr, 2)).'%'; - echo "Critical"; - echo "".remove_right_zeros(number_format($stat_agent_wa, 2)).'%'; - echo "Warning"; - echo "".remove_right_zeros(number_format($stat_agent_ok, 2)).'%'; - echo "Normal"; - echo "".remove_right_zeros(number_format($stat_agent_un, 2)).'%'; - echo "Unknown"; + echo "".remove_right_zeros(number_format($stat_agent_cr, 2)).'%'; + echo "Critical"; + echo "".remove_right_zeros(number_format($stat_agent_wa, 2)).'%'; + echo "Warning"; + echo "".remove_right_zeros(number_format($stat_agent_ok, 2)).'%'; + echo "Normal"; + echo "".remove_right_zeros(number_format($stat_agent_un, 2)).'%'; + echo "Unknown"; echo ''; echo ''; echo ''; @@ -1948,15 +1948,15 @@ function visual_map_print_item( if (get_parameter('action') == 'edit' || (get_parameter('operation') == 'edit_visualmap')) { if ($width == 0) { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } else { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } else { @@ -1987,15 +1987,15 @@ function visual_map_print_item( if (get_parameter('action') == 'edit' || (get_parameter('operation') == 'edit_visualmap')) { if ($width == 0) { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } else { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } else { @@ -2017,15 +2017,15 @@ function visual_map_print_item( if (get_parameter('action') == 'edit' || (get_parameter('operation') == 'edit_visualmap')) { if ($width == 0) { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } else { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } else { @@ -2060,15 +2060,15 @@ function visual_map_print_item( if (get_parameter('action') == 'edit' || (get_parameter('operation') == 'edit_visualmap')) { if ($width == 0) { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } else { if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } else { @@ -3600,7 +3600,7 @@ function visual_map_print_visual_map( } if (is_metaconsole()) { - echo ""; + echo ""; } echo ''; + echo ''; // ----------------------------Hiden Form---------------------------- ?> @@ -79,8 +79,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) foreach ($titles as $item => $title) { echo ''.$title.''; + class="title_panel_span bolder invisible">'.$title.''; } ?> @@ -105,7 +104,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'handler_start', 'handler_end', ]; - $form_items['line_color_row']['html'] = ''.__('Border color').''.''.html_print_input_text_extended( + $form_items['line_color_row']['html'] = ''.__('Border color').''.''.html_print_input_text_extended( 'line_color', '#000000', 'text-line_color', @@ -131,7 +130,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'datos', 'box_item', ]; - $form_items['border_color_row']['html'] = ''.__('Border color').''.''.html_print_input_text_extended( + $form_items['border_color_row']['html'] = ''.__('Border color').''.''.html_print_input_text_extended( 'border_color', '#000000', 'text-border_color', @@ -158,7 +157,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'box_item', 'clock', ]; - $form_items['fill_color_row']['html'] = ''.__('Fill color').''.''.html_print_input_text_extended( + $form_items['fill_color_row']['html'] = ''.__('Fill color').''.''.html_print_input_text_extended( 'fill_color', '#000000', 'text-fill_color', @@ -191,29 +190,52 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'bars_graph', 'clock', ]; - $form_items['label_row']['html'] = ''.__('Label').ui_print_help_icon('macros_visual_maps', true).' + $form_items['label_row']['html'] = ''.__('Label').ui_print_help_icon('macros_visual_maps', true).' - + Label position - - '.html_print_image('images/label_up.png', true, ['style' => 'height:100%;width:100%;']).' + + '.html_print_image( + 'images/label_up.png', + true, + ['class' => 'height_100p w100p'] + ).' - - '.html_print_image('images/label_left.png', true, ['style' => 'height:100%;width:100%;']).' + + '.html_print_image( + 'images/label_left.png', + true, + ['class' => 'height_100p w100p'] + ).' - - Object + + Object - - '.html_print_image('images/label_right.png', true, ['style' => 'height:100%;width:100%;']).' + + '.html_print_image( + 'images/label_right.png', + true, + ['class' => 'height_100p w100p'] + ).' - - '.html_print_image('images/label_down_2.png', true, ['style' => 'height:100%;width:100%;']).' + + '.html_print_image( + 'images/label_down_2.png', + true, + ['class' => 'height_100p w100p'] + ).' - '.html_print_input_text('label', '', '', 20, 200, true).' - + '.html_print_input_text( + 'label', + '', + '', + 20, + 200, + true + ).' + '.__('Scroll the mouse wheel over the label editor to change the background color').' '; @@ -304,8 +326,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'group_item', ]; - $form_items['enable_link_row']['html'] = ''.__('Enable link').' - '.html_print_checkbox('enable_link', '', !is_metaconsole(), true).''; + $form_items['enable_link_row']['html'] = ''.__('Enable link').' + '.html_print_checkbox('enable_link', '', !is_metaconsole(), true).''; $form_items['preview_row'] = []; $form_items['preview_row']['items'] = [ @@ -314,7 +336,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'icon', 'group_item', ]; - $form_items['preview_row']['html'] = ''.''; + $form_items['preview_row']['html'] = ''.''; $form_items['background_color'] = []; $form_items['background_color']['items'] = [ @@ -341,7 +363,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) $form_items['grid_color_row'] = []; $form_items['grid_color_row']['items'] = ['bars_graph']; - $form_items['grid_color_row']['html'] = ''.__('Grid color').''.''.html_print_input_text_extended( + $form_items['grid_color_row']['html'] = ''.__('Grid color').''.''.html_print_input_text_extended( 'grid_color', '#000000', 'text-grid_color', @@ -359,11 +381,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'module_graph', 'datos', ]; - $form_items['radio_choice_graph']['html'] = ' - '.__('Module graph').' '.html_print_radio_button('radio_choice', 'module_graph', '', 'module_graph', true).' '.__('Custom graph').' '.html_print_radio_button('radio_choice', 'custom_graph', '', 'module_graph', true).''; + $form_items['radio_choice_graph']['html'] = ' + '.__('Module graph').' '.html_print_radio_button('radio_choice', 'module_graph', '', 'module_graph', true).' '.__('Custom graph').' '.html_print_radio_button('radio_choice', 'custom_graph', '', 'module_graph', true).''; $form_items['custom_graph_row'] = []; - $form_items['custom_graph_row']['html'] = ''.__('Custom graph').''; + $form_items['custom_graph_row']['html'] = ''.__('Custom graph').''; if (is_metaconsole()) { $graphs = []; $graphs = metaconsole_get_custom_graphs(true); @@ -461,12 +483,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'color_cloud', ]; $form_items['module_row']['html'] = ''.__('Module').' - '.html_print_select([], 'module', '', '', __('Any'), 0, true).''.__('Data image').': Off - Width: + '.html_print_select([], 'module', '', '', __('Any'), 0, true).''.__('Data image').': Off - Width: '; $form_items['resume_color_row'] = []; $form_items['resume_color_row']['items'] = ['donut_graph']; - $form_items['resume_color_row']['html'] = ''.__('Resume data color').''.''.html_print_input_text_extended( + $form_items['resume_color_row']['html'] = ''.__('Resume data color').''.''.html_print_input_text_extended( 'resume_color', '#000000', 'text-resume_color', @@ -632,7 +654,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'datos', ]; $form_items['percentile_item_row_3']['html'] = ''.__('Type').' - '.html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true, false, false, '', false, 'style="float: left;"').''; + '.html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true, false, false, '', false, 'class="float-left"').''; $form_items['percentile_item_row_4'] = []; $form_items['percentile_item_row_4']['items'] = [ @@ -641,7 +663,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) 'datos', ]; $form_items['percentile_item_row_4']['html'] = ''.__('Value to show').' - '.html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true, false, false, '', false, 'style="float: left;"').''; + '.html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true, false, false, '', false, 'class="float-left"').''; } else { $form_items['percentile_item_row_3'] = []; $form_items['percentile_item_row_3']['items'] = [ @@ -722,8 +744,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) $form_items['show_statistics_row'] = []; $form_items['show_statistics_row']['items'] = ['group_item']; - $form_items['show_statistics_row']['html'] = ''.__('Show statistics').' - '.html_print_checkbox('show_statistics', 1, '', true).''; + $form_items['show_statistics_row']['html'] = ''.__('Show statistics').' + '.html_print_checkbox('show_statistics', 1, '', true).''; // Start of Color Cloud rows // Diameter @@ -749,8 +771,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) // End of Color Cloud rows $form_items['show_on_top_row'] = []; $form_items['show_on_top_row']['items'] = ['group_item']; - $form_items['show_on_top_row']['html'] = ''.__('Always show on top').' - '.html_print_checkbox('show_on_top', 1, '', true).ui_print_help_tip(__('It allows the element to be superimposed to the rest of items of the visual console'), true).''; + $form_items['show_on_top_row']['html'] = ''.__('Always show on top').' + '.html_print_checkbox('show_on_top', 1, '', true).ui_print_help_tip(__('It allows the element to be superimposed to the rest of items of the visual console'), true).''; $show_last_value = [ '0' => __('Hide last value on boolean modules'), @@ -759,7 +781,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) ]; $form_items['show_last_value_row'] = []; $form_items['show_last_value_row']['items'] = ['static_graph']; - $form_items['show_last_value_row']['html'] = ''.__('Show last value').' + $form_items['show_last_value_row']['html'] = ''.__('Show last value').' '.html_print_select($show_last_value, 'last_value', 0, '', '', '', true).''; $form_items['module_graph_size_row'] = []; @@ -787,27 +809,27 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) $form_items['button_update_row'] = []; $form_items['button_update_row']['items'] = ['datos']; - $form_items['button_update_row']['html'] = ''.html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true).' '.html_print_button(__('Update'), 'update_button', false, 'update_button_palette_callback();', 'class="sub upd"', true).''; + $form_items['button_update_row']['html'] = ''.html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true).' '.html_print_button(__('Update'), 'update_button', false, 'update_button_palette_callback();', 'class="sub upd"', true).''; $form_items['button_create_row'] = []; $form_items['button_create_row']['items'] = ['datos']; - $form_items['button_create_row']['html'] = ''.html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true).' '.html_print_button(__('Create'), 'create_button', false, 'create_button_palette_callback();', 'class="sub wand"', true).''; + $form_items['button_create_row']['html'] = ''.html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true).' '.html_print_button(__('Create'), 'create_button', false, 'create_button_palette_callback();', 'class="sub wand"', true).''; foreach ($form_items as $item => $item_options) { - echo ''; + echo ''; echo $item_options['html']; echo ''; } ?> - + - + $item_options) { - echo ''; + echo ''; echo $item_options['html']; echo ''; } @@ -1193,11 +1215,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) '; - echo ''.__('Click start pointof the line').''; + echo ''.__('Click start pointof the line').''; - echo ''.__('Click end pointof the line').''; + echo ''.__('Click end pointof the line').''; ui_require_css_file('color-picker', 'include/styles/js/'); @@ -1288,9 +1310,9 @@ function visual_map_editor_print_toolbox() global $config; if (defined('METACONSOLE')) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } echo ''; @@ -1308,6 +1330,13 @@ function visual_map_editor_print_toolbox() visual_map_print_button_editor('box_item', __('Box'), 'left', false, 'box_item_min', true); visual_map_print_button_editor('line_item', __('Line'), 'left', false, 'line_item_min', true); visual_map_print_button_editor('color_cloud', __('Color cloud'), 'left', false, 'color_cloud_min', true); + if (isset($config['legacy_vc']) === false + || (bool) $config['legacy_vc'] === false + ) { + // Applies only on modern VC. + visual_map_print_button_editor('network_link', __('Network link'), 'left', false, 'network_link_min', true); + } + if (defined('METACONSOLE')) { echo ''; @@ -1326,7 +1355,7 @@ function visual_map_editor_print_toolbox() visual_map_print_button_editor('copy_item', __('Copy item'), 'right', true, 'copy_item', true); echo ''; echo ''; - echo ''; + echo ''; } @@ -1359,84 +1388,84 @@ function visual_map_print_button_editor( function visual_map_editor_print_hack_translate_strings() { // Trick for it have a traduct text for javascript. - echo ''.__('Any').''; - echo ''.__('IP').''; + echo ''.__('Any').''; + echo ''.__('IP').''; // Hack to translate messages in javascript. - echo ""; - echo "".__('Min allowed size is 1024x768.').''; + echo ""; + echo "".__('Min allowed size is 1024x768.').''; echo ''; - echo ""; - echo "".__('No custom graph defined.').''; + echo ""; + echo "".__('No custom graph defined.').''; echo ''; - echo ""; - echo "".__('No image or name defined.').''; + echo ""; + echo "".__('No image or name defined.').''; echo ''; - echo ""; - echo "".__('No label defined.').''; + echo ""; + echo "".__('No label defined.').''; echo ''; - echo ""; - echo "".__('No service defined.').''; + echo ""; + echo "".__('No service defined.').''; echo ''; - echo ""; - echo "".__('No image defined.').''; + echo ""; + echo "".__('No image defined.').''; echo ''; - echo ""; - echo "".__('No process defined.').''; + echo ""; + echo "".__('No process defined.').''; echo ''; - echo ""; - echo "".__('No Max value defined.').''; + echo ""; + echo "".__('No Max value defined.').''; echo ''; - echo ""; - echo "".__('No width defined.').''; + echo ""; + echo "".__('No width defined.').''; echo ''; - echo ""; - echo "".__('No height defined.').''; + echo ""; + echo "".__('No height defined.').''; echo ''; - echo ""; - echo "".__('The width must not exceed the size of the visual console container.').''; + echo ""; + echo "".__('The width must not exceed the size of the visual console container.').''; echo ''; - echo ""; - echo "".__('The height must not exceed the size of the visual console container.').''; + echo ""; + echo "".__('The height must not exceed the size of the visual console container.').''; echo ''; - echo ""; - echo "".__('No period defined.').''; + echo ""; + echo "".__('No period defined.').''; echo ''; - echo ""; - echo "".__('No agent defined.').''; + echo ""; + echo "".__('No agent defined.').''; echo ''; - echo ""; - echo "".__('No module defined.').''; + echo ""; + echo "".__('No module defined.').''; echo ''; - echo ""; - echo "".__('No module defined. This module must be string type.').''; + echo ""; + echo "".__('No module defined. This module must be string type.').''; echo ''; - echo ""; - echo "".__('Successfully save the changes.').''; + echo ""; + echo "".__('Successfully save the changes.').''; echo ''; - echo ""; - echo "".__('Could not be save.').''; + echo ""; + echo "".__('Could not be save.').''; echo ''; - echo ""; - echo "".__('No custom graph defined.').''; + echo ""; + echo "".__('No custom graph defined.').''; echo ''; } diff --git a/pandora_console/include/gettext.php b/pandora_console/include/gettext.php index 5d3abd83fe..5b3c5b7ee9 100644 --- a/pandora_console/include/gettext.php +++ b/pandora_console/include/gettext.php @@ -103,7 +103,7 @@ class gettext_reader { * @param object Reader the StreamReader object * @param boolean enable_cache Enable or disable caching of strings (default on) */ - function gettext_reader($Reader, $enable_cache = true) { + function __construct($Reader, $enable_cache = true) { $machine = php_uname("m"); $enabled64Bits = false; diff --git a/pandora_console/include/graphs/export_data.php b/pandora_console/include/graphs/export_data.php index 5843ca232d..f4de87ff3c 100644 --- a/pandora_console/include/graphs/export_data.php +++ b/pandora_console/include/graphs/export_data.php @@ -1,18 +1,32 @@ load_tables(); } -// Get data +// Get data. $type = (string) get_parameter('type', 'csv'); $data = (string) get_parameter('data'); @@ -36,10 +52,8 @@ $default_filename = 'data_exported - '.date($config['date_format']); $filename = (string) get_parameter('filename', $default_filename); $filename = io_safe_output($filename); -// Using first-class functions to avoid namespace conflicts -// Type: 'csv' /* - $data = array( + * $data = array( * 'head' => array(,,...,), * 'data' => array( * array(,,...,), @@ -49,6 +63,7 @@ $filename = io_safe_output($filename); * ) * ); */ + $output_csv = function ($data, $filename) { global $config; @@ -56,20 +71,22 @@ $output_csv = function ($data, $filename) { $excel_encoding = (bool) get_parameter('excel_encoding', false); - // CSV Output + // CSV Output. header('Content-Type: text/csv; charset=UTF-8'); header('Content-Disposition: attachment; filename="'.$filename.'.csv"'); - // BOM - if (!$excel_encoding) { - print pack('C*', 0xEF, 0xBB, 0xBF); + // BOM. + if ($excel_encoding === false) { + echo pack('C*', 0xEF, 0xBB, 0xBF); } // Header - // Item / data + // Item / data. foreach ($data as $items) { - if (!isset($items['head']) || !isset($items['data'])) { - throw new Exception(__('An error occured exporting the data')); + if (isset($items['head']) === false + || isset($items['data']) === false + ) { + throw new Exception(__('An error occured exporting the data')); } // Get key for item value. @@ -84,7 +101,7 @@ $output_csv = function ($data, $filename) { $item = str_replace('--> '.__('Selected'), '', $item); $line = implode($separator, $item); - if ($excel_encoding) { + if ($excel_encoding === true) { echo mb_convert_encoding($line, 'UTF-16LE', 'UTF-8')."\n"; } else { echo $line."\n"; @@ -93,9 +110,8 @@ $output_csv = function ($data, $filename) { } }; -// Type: 'json' /* - $data = array( + * $data = array( * array( * 'key' => , * 'key' => , @@ -117,8 +133,9 @@ $output_csv = function ($data, $filename) { * ) * ); */ + $output_json = function ($data, $filename) { - // JSON Output + // JSON Output. header('Content-Type: application/json; charset=UTF-8'); header('Content-Disposition: attachment; filename="'.$filename.'.json"'); @@ -134,7 +151,7 @@ $output_json = function ($data, $filename) { }; try { - if (!$data) { + if (empty($data) === true) { throw new Exception(__('An error occured exporting the data')); } diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index b2d9ee8824..259e9638cc 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -960,7 +960,6 @@ function pandoraFlotArea( legend, series_type, color, - water_mark, date_array, data_module_graph, params, @@ -977,7 +976,6 @@ function pandoraFlotArea( .shift(); var width = params.width; var vconsole = params.vconsole; - var dashboard = params.dashboard; var menu = params.menu; var min_x = date_array["start_date"] * 1000; var max_x = date_array["final_date"] * 1000; @@ -2392,7 +2390,7 @@ function pandoraFlotArea( if (series.data[j]) { var y = series.data[j][1]; - var x = Math.round(series.data[j][0]) - 1; + var x = Math.round(series.data[j][0]); } } @@ -2775,6 +2773,7 @@ function pandoraFlotArea( "src", homeurl + "images/zoom_cross.disabled.png" ); + $("#menu_cancelzoom_" + graph_id).attr("class", "invert_filter"); overview.clearSelection(); thresholded = false; max_draw = []; @@ -2799,17 +2798,6 @@ function pandoraFlotArea( ); adjust_menu(graph_id, plot, parent_height, width, show_legend); } - - if (!dashboard) { - if (water_mark) { - set_watermark( - graph_id, - plot, - $("#watermark_image_" + graph_id).attr("src") - ); - } - //adjust_menu(graph_id, plot, parent_height, width, show_legend); - } } function format_unit_yaxes(y) { diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index 7bc835a456..e195d3b1d4 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -306,7 +306,7 @@ function d3_gauges( $output = include_javascript_d3(true); foreach ($chart_data as $module) { - $output .= ""; + $output .= ""; } $output .= " - + data[] = $data; $table->rowclass[] = ''; $form_table = html_print_table($table, true); -$form_table .= ''.html_print_submit_button( +$form_table .= ''; +$form_table .= html_print_submit_button( __('Reload'), 'submit', false, 'class="sub upd"', true -).''; +); +$form_table .= ''; // Menu. -$menu_form = "".html_print_input_hidden('params', base64_encode($params_json), true); +$menu_form = "".html_print_input_hidden('params', base64_encode($params_json), true); if (empty($server_id) === false) { $menu_form .= html_print_input_hidden('server', $server_id, true); } +$menu_form .= ''; +$menu_form .= ''; +$menu_form .= html_print_image( + 'images/arrow_down_green.png', + true, + [ + 'class' => 'module_graph_menu_arrow', + 'float' => 'left', + ], + false, + false, + true +); +$menu_form .= ''; +$menu_form .= ''.__('Graph configuration menu').''; +$menu_form .= ui_print_help_tip( + __('In Pandora FMS, data is stored compressed. The data visualization in database, charts or CSV exported data won\'t match, because is interpreted at runtime. Please check \'Pandora FMS Engineering\' chapter from documentation.'), + true +); +$menu_form .= ''; +$menu_form .= ''; +$menu_form .= ''; +$menu_form .= $form_table; +$menu_form .= ''; +$menu_form .= ''; +$menu_form .= ''; + echo $menu_form; echo ' '.html_print_image('images/arrow_down_green.png', true, ['class' => 'module_graph_menu_arrow', 'float' => 'left'], false, false, true).' - '.__('Graph configuration menu').' - '.$form_table.' + '.__('Graph configuration menu').' + '.$form_table.' '; echo ''; @@ -303,7 +330,7 @@ html_print_div( ); // Graph. -echo ''; +$output = ''; $height = 280; $width = '90%'; @@ -320,8 +347,8 @@ $params = [ 'zoom' => $zoom, ]; -if (is_metaconsole()) { - $params['id_server'] = $server_id; +if (is_metaconsole() === true) { + $params['server_id'] = $server_id; } if ($config['type_interface_charts'] == 'line') { @@ -340,13 +367,13 @@ $params_combined = [ 'stacked' => $stacked, ]; -graphic_combined_module( - array_values($interface_traffic_modules), - $params, - $params_combined -); +$modules = array_values($interface_traffic_modules); +$output .= ''; +$output .= html_print_image('images/spinner_charts.gif', true); +$output .= ''; -echo ''; +$output .= ''; +echo $output; ?> @@ -362,6 +389,10 @@ ui_require_jquery_file( true ); ui_include_time_picker(true); + +if (is_metaconsole() === true && empty($server_id) === false) { + metaconsole_restore_db(); +} ?> diff --git a/pandora_console/operation/agentes/log_sources_status.php b/pandora_console/operation/agentes/log_sources_status.php index 61d785ce0f..ee1bd3ee35 100644 --- a/pandora_console/operation/agentes/log_sources_status.php +++ b/pandora_console/operation/agentes/log_sources_status.php @@ -54,7 +54,7 @@ foreach ($logs as $log) { ob_start(); if (!empty($table->data)) { - echo ''; + echo ''; html_print_table($table); echo ''; } else { @@ -63,7 +63,7 @@ if (!empty($table->data)) { } // Hidden form to perform post request to Log Viewer page when clicking on the Review field icon. -echo ''; +echo ''; html_print_input_hidden('agent_id', $agent_id, false); html_print_input_hidden('source', null, false); diff --git a/pandora_console/operation/agentes/networkmap.dinamic.php b/pandora_console/operation/agentes/networkmap.dinamic.php index 1a7296c0f5..29651ca1ad 100644 --- a/pandora_console/operation/agentes/networkmap.dinamic.php +++ b/pandora_console/operation/agentes/networkmap.dinamic.php @@ -98,7 +98,10 @@ if ($pure == 1) { 'text' => ''.html_print_image( 'images/normal_screen.png', true, - ['title' => __('Normal screen')] + [ + 'title' => __('Normal screen'), + 'class' => 'invert_filter', + ] ).'', ]; } else { @@ -108,7 +111,10 @@ if ($pure == 1) { 'text' => ''.html_print_image( 'images/full_screen.png', true, - ['title' => __('Full screen')] + [ + 'title' => __('Full screen'), + 'class' => 'invert_filter', + ] ).'', ]; $buttons['list'] = [ @@ -116,7 +122,10 @@ if ($pure == 1) { 'text' => ''.html_print_image( 'images/list.png', true, - ['title' => __('List of networkmap')] + [ + 'title' => __('List of networkmap'), + 'class' => 'invert_filter', + ] ).'', ]; } @@ -153,7 +162,7 @@ if (empty($height)) { if ($activeTab == 'radial_dynamic') { include_once 'include/functions_graph.php'; - echo ""; + echo ""; $filter = []; if ($networkmap['source'] == 0) { @@ -237,7 +246,7 @@ networkmap_print_jsdata($graph); $zoom_default = file($config['homedir'].'/images/zoom_default.svg'); ?> - + diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 147d417b76..4937b3d38f 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -80,9 +80,15 @@ if ($edit_networkmap) { } else { $id_group = $values['id_group']; + $id_group_acl_check = $id_group_map; + + if ($id_group_map === null) { + $id_group_acl_check = $values['id_group_map']; + } + // ACL for the network map. - $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); + $networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_acl_check, 'MW'); + $networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_acl_check, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -265,6 +271,12 @@ if ($not_found) { true ); + $return_all_group = false; + + if (users_can_manage_group_all('AR') === true) { + $return_all_group = true; + } + $table->data[1][0] = __('Group'); $table->data[1][1] = ''.html_print_select_groups( // Id_user. @@ -272,7 +284,7 @@ if ($not_found) { // Privilege. 'AR', // ReturnAllGroup. - true, + $return_all_group, // Name. 'id_group_map', // Selected. @@ -424,7 +436,7 @@ if ($not_found) { __('Save networkmap'), 'crt', false, - 'class="sub next"' + 'class="sub next" onclick="if (typeof(sent) == \'undefined\') {sent = 1; return true;} else {return false;}"' ); } diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index fc6141ec85..8c8c5ec087 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -57,8 +57,8 @@ if (enterprise_installed()) { // ACL for the network map. // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); - $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); + $networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -145,8 +145,8 @@ if (enterprise_installed()) { // ACL for the new network map - $networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM'); + $networkmap_write_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -230,8 +230,8 @@ if ($new_networkmap || $save_networkmap) { // ACL for the network map // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); - $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); + $networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -420,8 +420,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) { return; } - $networkmap_write = check_acl($config['id_user'], $id_group_map_old, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group_map_old, 'MM'); + $networkmap_write = check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MW'); + $networkmap_manage = check_acl_restricted_all($config['id_user'], $id_group_map_old, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -440,8 +440,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) { // ACL for the new network map $id_group_map = (int) get_parameter('id_group_map', 0); - $networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW'); - $networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM'); + $networkmap_write_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage_new = check_acl_restricted_all($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -590,10 +590,10 @@ switch ($tab) { if (!empty($ent_maps_to_migrate) || !empty($open_maps_to_migrate)) { ?> - - Networkmaps are not migrated, wait while migration is processed... + + Networkmaps are not migrated, wait while migration is processed... - + - + "; + echo ""; echo __('Current data at %s', $last_timestamp); echo ''; if (is_image_data($last_data)) { - echo ''; + echo ''; } else { $last_data = preg_replace('/', '<', $last_data); $last_data = preg_replace('/>/', '>', $last_data); $last_data = preg_replace('/\n/i', '', $last_data); $last_data = preg_replace('/\s/i', ' ', $last_data); - echo ""; + echo ""; echo $last_data; echo ''; ?> - + '; + $form_table .= ''; $form_table .= html_print_submit_button( __('Reload'), 'submit', @@ -398,7 +397,7 @@ ui_print_message_dialog( $form_table .= ''; // Menu. - $menu_form = ""; + $menu_form = ""; $menu_form .= html_print_input_hidden('id', $id, true); $menu_form .= html_print_input_hidden('label', $label, true); @@ -424,11 +423,15 @@ ui_print_message_dialog( false, true ); - $menu_form .= ''; - $menu_form .= __('Graph configuration menu'); + $menu_form .= ''; + $menu_form .= ''.__('Graph configuration menu').''; + $menu_form .= ui_print_help_tip( + __('In Pandora FMS, data is stored compressed. The data visualization in database, charts or CSV exported data won\'t match, because is interpreted at runtime. Please check \'Pandora FMS Engineering\' chapter from documentation.'), + true + ); $menu_form .= ''; $menu_form .= ''; - $menu_form .= ''; + $menu_form .= ''; $menu_form .= $form_table; $menu_form .= ''; $menu_form .= ''; @@ -445,59 +448,39 @@ ui_print_message_dialog( ] ); + $params = [ + 'agent_module_id' => $id, + 'period' => $period, + 'show_events' => $draw_events, + 'title' => $label, + 'unit_name' => $unit, + 'show_alerts' => $draw_alerts, + 'date' => $date, + 'unit' => $unit, + 'baseline' => $baseline, + 'homeurl' => $urlImage, + 'adapt_key' => 'adapter_'.$graph_type, + 'compare' => $time_compare, + 'show_unknown' => $unknown_graph, + 'percentil' => (($show_percentil) ? $config['percentil'] : null), + 'type_graph' => $config['type_module_charts'], + 'fullscale' => $fullscale, + 'zoom' => $zoom, + 'height' => 300, + 'type_mode_graph' => $type_mode_graph, + ]; + // Graph. $output = ''; - switch ($graph_type) { - case 'boolean': - case 'sparse': - case 'string': - $params = [ - 'agent_module_id' => $id, - 'period' => $period, - 'show_events' => $draw_events, - 'title' => $label, - 'unit_name' => $unit, - 'show_alerts' => $draw_alerts, - 'date' => $date, - 'unit' => $unit, - 'baseline' => $baseline, - 'homeurl' => $urlImage, - 'adapt_key' => 'adapter_'.$graph_type, - 'compare' => $time_compare, - 'show_unknown' => $unknown_graph, - 'percentil' => (($show_percentil) ? $config['percentil'] : null), - 'type_graph' => $config['type_module_charts'], - 'fullscale' => $fullscale, - 'zoom' => $zoom, - 'height' => 300, - 'type_mode_graph' => $type_mode_graph, - ]; - $output .= grafico_modulo_sparse($params); - $output .= ''; - if ($show_events_graph) { - $width = '500'; - $height = '450'; - $output .= graphic_module_events( - $id, - $width, - $height, - $period, - $config['homeurl'], - $zoom, - 'adapted_'.$graph_type, - $date, - true - ); - } - break; - - default: - $output .= fs_error_image('../images'); - break; - } - + $output .= ''; + $output .= html_print_image('images/spinner_charts.gif', true); + $output .= ''; $output .= ''; echo $output; + + if (is_metaconsole() === true && empty($server_id) === false) { + metaconsole_restore_db(); + } ?> @@ -580,5 +563,32 @@ ui_include_time_picker(true); arrow.attr('src',arrow.attr('src').replace(arrow_up, arrow_down)); } }); + + var graph_data = ""; + var url = ""; + var serverId = ""; + get_ajax_module(url, graph_data, serverId); }); + + + function get_ajax_module(url, graph_data, serverId) { + $.ajax({ + type: "POST", + url: url, + dataType: "html", + data: { + page: "include/ajax/module", + get_graph_module: true, + graph_data: graph_data, + server_id: serverId + }, + success: function (data) { + $("#stat-win-spinner").hide(); + $("#stat-win-module-graph").append(data); + }, + error: function (error) { + console.error(error); + } + }); + } diff --git a/pandora_console/operation/agentes/status_events.php b/pandora_console/operation/agentes/status_events.php index 87950e210b..8049d52b04 100755 --- a/pandora_console/operation/agentes/status_events.php +++ b/pandora_console/operation/agentes/status_events.php @@ -22,7 +22,7 @@ if (!isset($id_agente)) { require_once 'include/functions_events.php'; ui_require_css_file('events'); ui_toggle( - "".html_print_image('images/spinner.gif', true).'', + "".html_print_image('images/spinner.gif', true).'', __('Latest events for this agent'), __('Latest events for this agent'), '', diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 250b12e3de..9424792eba 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -40,13 +40,27 @@ if (! defined('METACONSOLE')) { $buttons['fields'] = [ 'active' => false, - 'text' => ''.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'', + 'text' => ''.html_print_image( + 'images/custom_columns.png', + true, + [ + 'title' => __('Custom fields'), + 'class' => 'invert_filter', + ] + ).'', 'operation' => true, ]; $buttons['view'] = [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('View')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('View'), + 'class' => 'invert_filter', + ] + ).'', 'operation' => true, ]; @@ -466,7 +480,7 @@ $table->data[0][6] = html_print_submit_button( __('Show'), 'uptbutton', false, - 'class="sub search" style="margin-top:0px;"', + 'class="sub search mgn_tp_0"', true ); @@ -1328,7 +1342,7 @@ if (!empty($result)) { $img = 'images/policies_brick.png'; $title = __('(Adopt) ').$policyInfo['name_policy']; } else { - $img = 'images/policies.png'; + $img = 'images/policies_mc.png'; $title = $policyInfo['name_policy']; } } else { @@ -1412,7 +1426,7 @@ if (!empty($result)) { } if (in_array('module_name', $show_fields) || is_metaconsole()) { - $data[3] = ui_print_truncate_text($row['module_name'], 'agent_small', false, true, true); + $data[3] = ui_print_truncate_text($row['module_name'], 'module_small', false, true, true); if ($row['extended_info'] != '') { $data[3] .= ui_print_help_tip($row['extended_info'], true, '/images/default_list.png'); } @@ -1423,7 +1437,7 @@ if (!empty($result)) { true, [ 'title' => $row['tags'], - 'style' => 'width: 20px; margin-left: 3px;', + 'class' => 'tag_row', ] ); } @@ -1616,10 +1630,10 @@ if (!empty($result)) { $data[8] = get_module_realtime_link_graph($row); if (!is_snapshot_data($row['datos'])) { - $data[8] .= ''.html_print_image('images/chart_curve.png', true, ['border' => '0', 'alt' => '']).''; + $data[8] .= ''.html_print_image('images/chart.png', true, ['border' => '0', 'alt' => '']).''; } - $data[8] .= ''.html_print_image( + $data[8] .= ''.html_print_image( 'images/binary.png', true, [ @@ -1629,7 +1643,7 @@ if (!empty($result)) { ).''; $data[8] .= ''.$row['module_name'].''; + class=\'invisible\'>'.$row['module_name'].''; } } @@ -1767,8 +1781,8 @@ if (!empty($result)) { $salida = $module_value; } else { $salida = '".$module_value.''.'".''.$sub_string.' '."".html_print_image('images/rosette.png', true).''; + class='invisible'>".$module_value.''.'".''.$sub_string.' '."".html_print_image('images/rosette.png', true).''; } } } diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index 18ecbe4828..edfbe50bb9 100755 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -115,8 +115,8 @@ if (!empty($all_data)) { $data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1); } -echo ''; -echo ''; +echo ''; +echo ''; // --------------------------------------------------------------------- // The status horizontal bars (Global health, Monitor sanity... // --------------------------------------------------------------------- @@ -175,7 +175,7 @@ ui_toggle( echo ''; // Left column -echo ''; +echo ''; // --------------------------------------------------------------------- // Last events information @@ -209,7 +209,7 @@ if ($is_admin) { include $config['homedir'].'/godmode/servers/servers.build_table.php'; } -$out = ''; +$out = ''; $out .= ' '.__('Event graph').''.html_print_image('images/spinner.gif', true, ['id' => 'spinner_total_event_graph']).''; $out .= ''; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index fdbd6905f5..3de7ae4608 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -984,14 +984,22 @@ if (is_ajax()) { $module = db_get_row('tagente_modulo', 'id_agente_modulo', $id_module); echo ''; - echo html_print_image('images/brick.png', true).' '; + echo html_print_image( + 'images/agent.png', + true, + ['class' => 'invert_filter'] + ).' '; echo ui_print_truncate_text($module['nombre'], 'module_small', false, true, false).''; echo ''.__('Type').': '; $agentmoduletype = modules_get_agentmodule_type($module['id_agente_modulo']); echo modules_get_moduletype_name($agentmoduletype).' '; echo html_print_image('images/'.modules_get_type_icon($agentmoduletype), true).''; echo ''.__('Module group').': '; - $modulegroup = modules_get_modulegroup_name(modules_get_agentmodule_modulegroup($module['id_agente_modulo'])); + $modulegroup = modules_get_modulegroup_name( + modules_get_agentmodule_modulegroup( + $module['id_agente_modulo'] + ) + ); if ($modulegroup === false) { echo __('None').''; } else { @@ -999,7 +1007,15 @@ if (is_ajax()) { } echo ''.__('Agent').': '; - echo ui_print_truncate_text(modules_get_agentmodule_agent_alias($module['id_agente_modulo']), 'agent_small', false, true, false).''; + echo ui_print_truncate_text( + modules_get_agentmodule_agent_alias( + $module['id_agente_modulo'] + ), + 'agent_small', + false, + true, + false + ).''; if ($module['id_tipo_modulo'] == 18) { echo ''.__('Address').': '; @@ -1013,7 +1029,7 @@ if (is_ajax()) { if (count($ips) == 1) { echo $ips[0]; } else { - echo ''; + echo ''; foreach ($ips as $ip) { echo ''.$ip.''; } @@ -1032,14 +1048,24 @@ if (is_ajax()) { if ($get_group_status_tooltip) { $id_group = (int) get_parameter('id_group'); $group = db_get_row('tgrupo', 'id_grupo', $id_group); - echo ''.html_print_image('images/groups_small/'.groups_get_icon($group['id_grupo']).'.png', true); + echo ''.html_print_image( + 'images/groups_small/'.groups_get_icon( + $group['id_grupo'] + ).'.png', + true + ); echo ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false).''; echo ''.__('Parent').': '; if ($group['parent'] == 0) { echo __('None').''; } else { $group_parent = db_get_row('tgrupo', 'id_grupo', $group['parent']); - echo html_print_image('images/groups_small/'.groups_get_icon($group['parent']).'.png', true); + echo html_print_image( + 'images/groups_small/'.groups_get_icon( + $group['parent'] + ).'.png', + true + ); echo $group_parent['nombre'].''; } @@ -1050,7 +1076,12 @@ if (is_ajax()) { } else { echo ''; foreach ($groups_sons as $group_son) { - echo html_print_image('images/groups_small/'.groups_get_icon($group_son['id_grupo']).'.png', true); + echo html_print_image( + 'images/groups_small/'.groups_get_icon( + $group_son['id_grupo'] + ).'.png', + true + ); echo $group_son['nombre'].''; } } @@ -1137,15 +1168,24 @@ if ($flag !== '') { // Check for Network FLAG change request. $flag_agent = get_parameter('flag_agent', ''); if ($flag_agent !== '') { - if ($flag_agent == 1 && check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { - db_process_sql_update('tagente_modulo', ['flag' => 1], ['id_agente' => $id_agente]); + if ($flag_agent == 1 && check_acl_one_of_groups( + $config['id_user'], + $all_groups, + 'AW' + ) + ) { + db_process_sql_update( + 'tagente_modulo', + ['flag' => 1], + ['id_agente' => $id_agente] + ); } } if ($agent['icon_path']) { $icon = gis_get_agent_icon_map($agent['id_agente'], true); } else { - $icon = 'images/bricks.png'; + $icon = 'images/agent.png'; } @@ -1156,7 +1196,14 @@ $tab = get_parameter('tab', 'main'); $managetab = []; if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || $is_extra) { - $managetab['text'] = ''.html_print_image('images/setup.png', true, ['title' => __('Manage')]).''; + $managetab['text'] = ''.html_print_image( + 'images/setup.png', + true, + [ + 'title' => __('Manage'), + 'class' => 'invert_filter', + ] + ).''; if ($tab == 'manage') { $managetab['active'] = true; @@ -1169,7 +1216,14 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || $is_extra) // Main tab. -$maintab['text'] = ''.html_print_image('images/agent_mc.png', true, ['title' => __('Main')]).''; +$maintab['text'] = ''.html_print_image( + 'images/agent.png', + true, + [ + 'title' => __('Main'), + 'class' => 'invert_filter', + ] +).''; if ($tab == 'main') { $maintab['active'] = true; @@ -1180,7 +1234,14 @@ if ($tab == 'main') { // Alert tab. -$alerttab['text'] = ''.html_print_image('images/op_alerts.png', true, ['title' => __('Alerts')]).''; +$alerttab['text'] = ''.html_print_image( + 'images/bell.png', + true, + [ + 'title' => __('Alerts'), + 'class' => 'invert_filter', + ] +).''; if ($tab == 'alert') { $alerttab['active'] = true; @@ -1228,7 +1289,14 @@ if ($url_route_analyzer) { // GIS tab. $gistab = []; if ($config['activate_gis']) { - $gistab['text'] = ''.html_print_image('images/op_gis.png', true, [ 'title' => __('GIS data')]).''; + $gistab['text'] = ''.html_print_image( + 'images/op_gis.png', + true, + [ + 'title' => __('GIS data'), + 'class' => 'invert_filter', + ] + ).''; if ($tab == 'gis') { $gistab['active'] = true; @@ -1241,7 +1309,14 @@ if ($config['activate_gis']) { // Incident tab. $total_incidents = agents_get_count_incidents($id_agente); if ($total_incidents > 0) { - $incidenttab['text'] = ''.html_print_image('images/book_edit.png', true, ['title' => __('Incidents')]).''; + $incidenttab['text'] = ''.html_print_image( + 'images/book_edit.png', + true, + [ + 'title' => __('Incidents'), + 'class' => 'invert_filter', + ] + ).''; if ($tab == 'incident') { $incidenttab['active'] = true; @@ -1253,7 +1328,14 @@ if ($total_incidents > 0) { // Url address tab. if ($agent['url_address'] != '') { - $urladdresstab['text'] = ''.html_print_image('images/link.png', true, ['title' => __('Url address')]).''; + $urladdresstab['text'] = ''.html_print_image( + 'images/link.png', + true, + [ + 'title' => __('Url address'), + 'class' => 'invert_filter', + ] + ).''; } if ($tab == 'url_address') { @@ -1264,7 +1346,14 @@ if ($tab == 'url_address') { // Custom fields tab. -$custom_fields['text'] = ''.html_print_image('images/custom_field.png', true, ['title' => __('Custom fields')]).''; +$custom_fields['text'] = ''.html_print_image( + 'images/custom_field.png', + true, + [ + 'title' => __('Custom fields'), + 'class' => 'invert_filter', + ] +).''; if ($tab == 'custom_fields') { $custom_fields['active'] = true; } else { @@ -1273,7 +1362,14 @@ if ($tab == 'custom_fields') { // Graphs tab. -$graphs['text'] = ''.html_print_image('images/chart.png', true, ['title' => __('Graphs')]).''; +$graphs['text'] = ''.html_print_image( + 'images/chart.png', + true, + [ + 'title' => __('Graphs'), + 'class' => 'invert_filter', + ] +).''; if ($tab == 'graphs') { $graphs['active'] = true; } else { @@ -1288,7 +1384,14 @@ if (enterprise_installed() && $config['log_collector']) { if ($agent_has_logs && !$is_windows) { $log_viewer_tab = []; - $log_viewer_tab['text'] = ''.html_print_image('images/gm_log.png', true, ['title' => __('Log Viewer')]).''; + $log_viewer_tab['text'] = ''.html_print_image( + 'images/gm_log.png', + true, + [ + 'title' => __('Log Viewer'), + 'class' => 'invert_filter', + ] + ).''; $log_viewer_tab['active'] = $tab == 'log_viewer'; } } @@ -1308,28 +1411,70 @@ if ($config['ehorus_enabled'] && !empty($config['ehorus_custom_field']) $ehorus_agent_id = agents_get_agent_custom_field($id_agente, $config['ehorus_custom_field']); if (!empty($ehorus_agent_id)) { $tab_url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=ehorus&id_agente='.$id_agente; - $ehorus_tab['text'] = ''.html_print_image('images/ehorus/ehorus.png', true, [ 'title' => __('eHorus')]).''; + $ehorus_tab['text'] = ''.html_print_image( + 'images/ehorus/ehorus.png', + true, + [ + 'title' => __('eHorus'), + 'class' => 'invert_filter', + ] + ).''; // Hidden subtab layer. - $ehorus_tab['sub_menu'] = ''; + $ehorus_tab['sub_menu'] = ''; $ehorus_tab['sub_menu'] .= ''; - $ehorus_tab['sub_menu'] .= ''.html_print_image('images/ehorus/terminal.png', true, [ 'title' => __('Terminal')]); + $ehorus_tab['sub_menu'] .= ''.html_print_image( + 'images/ehorus/terminal.png', + true, + [ + 'title' => __('Terminal'), + 'class' => 'invert_filter', + ] + ); $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; - $ehorus_tab['sub_menu'] .= ''.html_print_image('images/ehorus/vnc.png', true, [ 'title' => __('Display')]); + $ehorus_tab['sub_menu'] .= ''.html_print_image( + 'images/ehorus/vnc.png', + true, + [ + 'title' => __('Display'), + 'class' => 'invert_filter', + ] + ); $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; - $ehorus_tab['sub_menu'] .= ''.html_print_image('images/ehorus/processes.png', true, [ 'title' => __('Processes')]); + $ehorus_tab['sub_menu'] .= ''.html_print_image( + 'images/ehorus/processes.png', + true, + [ + 'title' => __('Processes'), + 'class' => 'invert_filter', + ] + ); $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; - $ehorus_tab['sub_menu'] .= ''.html_print_image('images/ehorus/services.png', true, [ 'title' => __('Services')]); + $ehorus_tab['sub_menu'] .= ''.html_print_image( + 'images/ehorus/services.png', + true, + [ + 'title' => __('Services'), + 'class' => 'invert_filter', + ] + ); $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; - $ehorus_tab['sub_menu'] .= ''.html_print_image('images/ehorus/files.png', true, [ 'title' => __('Files')]); + $ehorus_tab['sub_menu'] .= ''.html_print_image( + 'images/ehorus/files.png', + true, + [ + 'title' => __('Files'), + 'class' => 'invert_filter', + ] + ); $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= ''; @@ -1341,7 +1486,11 @@ if ($config['ehorus_enabled'] && !empty($config['ehorus_custom_field']) $is_sap = agents_get_sap_agents($id_agente); if ($is_sap) { - $saptab['text'] = ''.html_print_image('images/sap_icon.png', true, ['title' => __('SAP view')]).''; + $saptab['text'] = ''.html_print_image( + 'images/sap_icon.png', + true, + ['title' => __('SAP view')] + ).''; if ($tab == 'sap_view') { $saptab['active'] = true; } else { @@ -1389,6 +1538,7 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) { $onheader['ehorus'] = $ehorus_tab; } +$id_extension = get_parameter('id_extension', ''); // Tabs for extensions. $tab_name_extensions = ''; foreach ($config['extensions'] as $extension) { @@ -1431,13 +1581,11 @@ foreach ($config['extensions'] as $extension) { } $image = $extension['extension_ope_tab']['icon']; - $name = $extension['extension_ope_tab']['name']; - $id = $extension['extension_ope_tab']['id']; - $tab_name_extensions = $name; + $name = $extension['extension_ope_tab']['name']; + $id = $extension['extension_ope_tab']['id']; - $id_extension = get_parameter('id_extension', ''); - - if ($id_extension == $id) { + if ($id_extension === $id) { + $tab_name_extensions = $name; $active = true; } else { $active = false; @@ -1446,7 +1594,7 @@ foreach ($config['extensions'] as $extension) { $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=extension&id_agente='.$id_agente.'&id_extension='.$id; $extension_tab = [ - 'text' => ''.html_print_image($image, true, [ 'title' => $name]).'', + 'text' => ''.html_print_image($image, true, [ 'title' => $name, 'class' => 'invert_filter']).'', 'active' => $active, ]; diff --git a/pandora_console/operation/dashboard/public_dashboard.php b/pandora_console/operation/dashboard/public_dashboard.php index fc462e2e16..33d6ffd199 100644 --- a/pandora_console/operation/dashboard/public_dashboard.php +++ b/pandora_console/operation/dashboard/public_dashboard.php @@ -60,7 +60,6 @@ if ($config['force_instant_logout'] === true) { } } -while (@ob_end_flush()) { - // Dumping... - continue; +while (ob_get_length() > 0) { + ob_end_flush(); } diff --git a/pandora_console/operation/events/event_statistics.php b/pandora_console/operation/events/event_statistics.php deleted file mode 100644 index f1682b5987..0000000000 --- a/pandora_console/operation/events/event_statistics.php +++ /dev/null @@ -1,108 +0,0 @@ -'; - - echo ''; - echo ""; - echo ''.__('Event graph').''; - echo ''; - - echo ""; - echo ''.__('Event graph by user').''; - echo ''; - echo ''; - - echo ''; - echo ""; - echo grafico_eventos_total(); - echo ''; - - echo ""; - echo grafico_eventos_usuario(320, 280); - echo ''; - echo ''; - - echo ''; - echo ""; - echo ''.__('Event graph by agent').''; - echo ''; - - echo ""; - echo ''.__('Amount events validated').''; - echo ''; - echo ''; - - $where = ''; -if (!users_is_admin()) { - $where = 'AND event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')'; -} - - echo ''; - echo ""; - echo grafico_eventos_grupo(300, 250, $where); - echo ''; - - echo ""; - $extra_filter = []; -if (!users_is_admin()) { - $extra_filter['event_type'] = [ - 'unknown', - 'alert_fired', - 'alert_recovered', - 'alert_ceased', - 'alert_manual_validation', - 'critical', - 'warning', - 'normal', - ]; -} - - echo graph_events_validated(320, 250, $extra_filter); - echo ''; - echo ''; - -echo ''; diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php index 1e7d6e281b..b0893d8d5c 100644 --- a/pandora_console/operation/events/events.build_table.php +++ b/pandora_console/operation/events/events.build_table.php @@ -109,10 +109,10 @@ if ($group_rep == 2) { $uniq = uniqid(); if ($meta) { - $table->data[$key][2] = 'data[$key][2] = 'id.'-'.$uniq.'-0","'.$res['id_agent'].'",'.$res['id_server'].');\' />'; } else { - $table->data[$key][2] = 'data[$key][2] = 'id.'-'.$uniq.'-0",'.$res['id_agent'].',false);\'/>'; } @@ -348,7 +348,7 @@ if ($group_rep == 2) { } if (in_array('estado', $show_fields)) { - $table->head[$i] = ''.__('Status').html_print_sort_arrows( + $table->head[$i] = ''.__('Status').html_print_sort_arrows( array_merge($params, ['sort_field' => 'status']), 'sort' ).''; @@ -528,7 +528,10 @@ if ($group_rep == 2) { $data[$i] .= ''; } - $data[$i] .= ''.ui_print_truncate_text(strip_tags(io_safe_output($event['evento'])), 160).''; + $data[$i] .= ''.ui_print_truncate_text( + strip_tags(io_safe_output($event['evento'])), + 160 + ).''; if ($allow_action) { $data[$i] .= ''; } @@ -752,30 +755,30 @@ if ($group_rep == 2) { switch ($event['event_type']) { case 'going_unknown': if (!empty($event['unknown_instructions'])) { - $data[$i] = html_print_image('images/page_white_text.png', true, ['title' => str_replace("\n", '', io_safe_output($event['unknown_instructions']))]); + $data[$i] = html_print_image('images/page_white_text.png', true, ['class' => 'invert_filter', 'title' => str_replace("\n", '', io_safe_output($event['unknown_instructions']))]); } break; case 'going_up_critical': case 'going_down_critical': if (!empty($event['critical_instructions'])) { - $data[$i] = html_print_image('images/page_white_text.png', true, ['title' => str_replace("\n", '', io_safe_output($event['critical_instructions']))]); + $data[$i] = html_print_image('images/page_white_text.png', true, ['class' => 'invert_filter', 'title' => str_replace("\n", '', io_safe_output($event['critical_instructions']))]); } break; case 'going_down_warning': if (!empty($event['warning_instructions'])) { - $data[$i] = html_print_image('images/page_white_text.png', true, ['title' => str_replace("\n", '', io_safe_output($event['warning_instructions']))]); + $data[$i] = html_print_image('images/page_white_text.png', true, ['class' => 'invert_filter', 'title' => str_replace("\n", '', io_safe_output($event['warning_instructions']))]); } break; case 'system': if (!empty($event['critical_instructions'])) { - $data[$i] = html_print_image('images/page_white_text.png', true, ['title' => str_replace("\n", '', io_safe_output($event['critical_instructions']))]); + $data[$i] = html_print_image('images/page_white_text.png', true, ['class' => 'invert_filter', 'title' => str_replace("\n", '', io_safe_output($event['critical_instructions']))]); } else if (!empty($event['warning_instructions'])) { - $data[$i] = html_print_image('images/page_white_text.png', true, ['title' => str_replace("\n", '', io_safe_output($event['warning_instructions']))]); + $data[$i] = html_print_image('images/page_white_text.png', true, ['class' => 'invert_filter', 'title' => str_replace("\n", '', io_safe_output($event['warning_instructions']))]); } else if (!empty($event['unknown_instructions'])) { - $data[$i] = html_print_image('images/page_white_text.png', true, ['title' => str_replace("\n", '', io_safe_output($event['unknown_instructions']))]); + $data[$i] = html_print_image('images/page_white_text.png', true, ['class' => 'invert_filter', 'title' => str_replace("\n", '', io_safe_output($event['unknown_instructions']))]); } break; } @@ -828,7 +831,10 @@ if ($group_rep == 2) { $data[$i] .= html_print_image( 'images/eye.png', true, - ['title' => __('Show more')] + [ + 'class' => 'invert_filter', + 'title' => __('Show more'), + ] ); $data[$i] .= ''; @@ -849,7 +855,10 @@ if ($group_rep == 2) { $data[$i] .= html_print_image( 'images/hourglass.png', true, - ['title' => __('Change to in progress status')] + [ + 'class' => 'invert_filter', + 'title' => __('Change to in progress status'), + ] ); $data[$i] .= ''; } @@ -864,6 +873,7 @@ if ($group_rep == 2) { 'images/cross.png', true, [ + 'class' => 'invert_filter', 'title' => __('Delete event'), 'id' => 'delete_cross_'.$event['id_evento'], ] @@ -984,19 +994,22 @@ if ($group_rep == 2) { if (check_acl($config['id_user'], 0, 'EW')) { if ($config['event_replication'] != 1) { - echo ''; + echo ''; echo ''; html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false); echo '  '; html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"'); - echo "".html_print_image('images/spinner.gif', true).''; + echo "".html_print_image( + 'images/spinner.gif', + true + ).''; echo ''; - echo ''; + echo ''; echo __( 'A maximum of %s event custom responses can be selected', $config['max_execution_event_response'] ).''; - echo ''; + echo ''; echo __( 'Please, select an event' ).''; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index a9f05150b4..b216a3fe2f 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -44,6 +44,8 @@ require_once $config['homedir'].'/include/functions_ui.php'; // Check access. check_login(); + + $event_a = check_acl($config['id_user'], 0, 'ER'); $event_w = check_acl($config['id_user'], 0, 'EW'); $event_m = check_acl($config['id_user'], 0, 'EM'); @@ -140,8 +142,11 @@ $text_module = get_parameter( $filter['module_search'] ); $id_agent_module = get_parameter( - 'filter[id_agent_module]', - $filter['id_agent_module'] + 'id_agent_module', + get_parameter( + 'filter[id_agent_module]', + $filter['id_agent_module'] + ) ); $pagination = get_parameter( 'filter[pagination]', @@ -374,6 +379,9 @@ if (is_ajax()) { } $tmp->agent_name = io_safe_output($tmp->agent_name); + + $tmp->ack_utimestamp_raw = strtotime($tmp->ack_utimestamp); + $tmp->ack_utimestamp = ui_print_timestamp( $tmp->ack_utimestamp, true @@ -563,6 +571,7 @@ $data[1] = html_print_image( 'id' => 'button-add_with', 'style' => 'cursor: pointer;', 'title' => __('Add'), + 'class' => 'invert_filter', ] ); @@ -579,6 +588,7 @@ $data[1] .= ''.html_print_image( 'id' => 'button-remove_with', 'style' => 'cursor: pointer;', 'title' => __('Remove'), + 'class' => 'invert_filter', ] ); @@ -637,6 +647,7 @@ $data[1] = html_print_image( 'id' => 'button-add_without', 'style' => 'cursor: pointer;', 'title' => __('Add'), + 'class' => 'invert_filter', ] ); $data[1] .= html_print_input_hidden( @@ -651,6 +662,7 @@ $data[1] .= ''.html_print_image( 'id' => 'button-remove_without', 'style' => 'cursor: pointer;', 'title' => __('Remove'), + 'class' => 'invert_filter', ] ); $data[2] = html_print_select( @@ -692,7 +704,7 @@ $url .= ''; if ($pure) { // Fullscreen. // Floating menu - Start. - echo ''; + echo ''; echo ''; echo ''; @@ -703,7 +715,10 @@ if ($pure) { echo html_print_image( 'images/normal_screen.png', true, - ['title' => __('Back to normal mode')] + [ + 'title' => __('Back to normal mode'), + 'class' => 'invert_filter', + ] ); echo ''; echo ''; @@ -752,37 +767,82 @@ if ($pure) { // Fullscreen. $fullscreen['active'] = false; - $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).''; + $fullscreen['text'] = ''.html_print_image( + 'images/full_screen.png', + true, + [ + 'title' => __('Full screen'), + 'class' => 'invert_filter', + ] + ).''; // Event list. $list['active'] = false; - $list['text'] = ''.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).''; + $list['text'] = ''.html_print_image( + 'images/events_list.png', + true, + [ + 'title' => __('Event list'), + 'class' => 'invert_filter', + ] + ).''; // History event list. $history_list['active'] = false; - $history_list['text'] = ''.html_print_image('images/books.png', true, ['title' => __('History event list')]).''; + $history_list['text'] = ''.html_print_image( + 'images/books.png', + true, + [ + 'title' => __('History event list'), + 'class' => 'invert_filter', + ] + ).''; // RSS. $rss['active'] = false; - $rss['text'] = ''.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).''; - - // Marquee. - $marquee['active'] = false; - $marquee['text'] = ''.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).''; + $rss['text'] = ''.html_print_image( + 'images/rss.png', + true, + [ + 'title' => __('RSS Events'), + 'class' => 'invert_filter', + ] + ).''; // CSV. $csv['active'] = false; - $csv['text'] = ''.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).''; + $csv['text'] = ''.html_print_image( + 'images/csv.png', + true, + [ + 'title' => __('Export to CSV file'), + 'class' => 'invert_filter', + ] + ).''; // Sound events. $sound_event['active'] = false; - $sound_event['text'] = ''.html_print_image('images/sound.png', true, ['title' => __('Sound events')]).''; + $sound_event['text'] = ''.html_print_image( + 'images/sound.png', + true, + [ + 'title' => __('Sound events'), + 'class' => 'invert_filter', + ] + ).''; // If the user has administrator permission display manage tab. if ($event_w || $event_m) { // Manage events. $manage_events['active'] = false; - $manage_events['text'] = ''.html_print_image('images/setup.png', true, ['title' => __('Manage events')]).''; + $manage_events['text'] = ''.html_print_image( + 'images/setup.png', + true, + [ + 'title' => __('Manage events'), + 'class' => 'invert_filter', + ] + ).''; $manage_events['godmode'] = true; @@ -792,7 +852,6 @@ if ($pure) { 'list' => $list, 'history' => $history_list, 'rss' => $rss, - 'marquee' => $marquee, 'csv' => $csv, 'sound_event' => $sound_event, ]; @@ -802,7 +861,6 @@ if ($pure) { 'list' => $list, 'history' => $history_list, 'rss' => $rss, - 'marquee' => $marquee, 'csv' => $csv, 'sound_event' => $sound_event, ]; @@ -834,7 +892,7 @@ if ($pure) { unset($onheader['history']); ui_print_page_header( __('Events'), - 'images/op_events.png', + 'images/lightning_go.png', false, 'eventview', false, @@ -844,7 +902,6 @@ if ($pure) { ); } else { unset($onheader['rss']); - unset($onheader['marquee']); unset($onheader['csv']); unset($onheader['sound_event']); unset($onheader['fullscreen']); @@ -1269,8 +1326,8 @@ $adv_inputs[] = $in; // Tags. if (is_metaconsole()) { - $data = ''.__('Events with following tags').''.html_print_table($tabletags_with, true).''; - $data .= ''.__('Events without following tags').''.html_print_table($tabletags_without, true).''; + $data = ''.__('Events with following tags').''.html_print_table($tabletags_with, true).''; + $data .= ''.__('Events without following tags').''.html_print_table($tabletags_without, true).''; } else { $data = ''.__('Events with following tags').''.html_print_table($tabletags_with, true).''; $data .= ''.__('Events without following tags').''.html_print_table($tabletags_without, true).''; @@ -1564,21 +1621,45 @@ foreach ($event_responses as $val) { $array_events_actions[$val['id']] = $val['name']; } -if (check_acl($config['id_user'], 0, 'EW')) { +if (check_acl( + $config['id_user'], + 0, + 'EW' +) +) { echo ''; echo ''; echo ''; - html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false); + html_print_select( + $array_events_actions, + 'response_id', + '', + '', + '', + 0, + false, + false, + false + ); echo '  '; - html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"'); - echo "".html_print_image('images/spinner.gif', true).''; + html_print_button( + __('Execute event response'), + 'submit_event_response', + false, + 'execute_event_response(true);', + 'class="sub next"' + ); + echo "".html_print_image( + 'images/spinner.gif', + true + ).''; echo ''; - echo ''; + echo ''; echo __( 'A maximum of %s event custom responses can be selected', $config['max_execution_event_response'] ).''; - echo ''; + echo ''; echo __( 'Please, select an event' ).''; @@ -1611,8 +1692,8 @@ echo ""; echo ""; // Load filter div for dialog. -echo ''; -echo ''; +echo ''; +echo ''; if ($_GET['refr'] || $do_refresh === true) { $autorefresh_draw = true; @@ -1737,7 +1818,7 @@ function process_datatables_item(item) { if(typeof item.comments !== 'undefined' && item.comments.length > 80) { item.user_comment += ' '; - item.user_comment += ' __('Show more')]); ?>'; + item.user_comment += ' __('Show more'), 'class' => 'invert_filter']); ?>'; } // Grouped events. @@ -1903,7 +1984,7 @@ function process_datatables_item(item) { // Show more. item.options = ' __('Show more')]); ?>'; + item.options += ')" > __('Show more'), 'class' => 'invert_filter']); ?>'; ,'; if (item.max_id_evento) { item.options += item.max_id_evento+', '+ item.event_rep +', this)" id="val-'+item.max_id_evento+'">'; - item.options += ' __('Validate events')]); ?>'; + item.options += ' __('Validate events'), 'class' => 'invert_filter']); ?>'; } else { item.options += item.id_evento+', 0, this)" id="val-'+item.id_evento+'">'; - item.options += ' __('Validate event')]); ?>'; + item.options += ' __('Validate event'), 'class' => 'invert_filter']); ?>'; } } @@ -1930,7 +2011,7 @@ function process_datatables_item(item) { } else { item.options += item.id_evento+', 0, this)" id="proc-'+item.id_evento+'">'; } - item.options += ' __('Change to in progress status')]); ?>'; + item.options += ' __('Change to in progress status'), 'class' => 'invert_filter']); ?>'; } } @@ -1939,10 +2020,10 @@ function process_datatables_item(item) { item.options += ''; - item.options += ' __('Delete events')]); ?>'; + item.options += ' __('Delete events'), 'class' => 'invert_filter']); ?>'; } else { item.options += item.id_evento+', 0, this)" id="del-'+item.id_evento+'">'; - item.options += ' __('Delete event')]); ?>'; + item.options += ' __('Delete event'), 'class' => 'invert_filter']); ?>'; } } ": state = '1'; - img = ' __('Event validated'), 'class' => 'forced-title']); ?>'; + img = ' __('Event validated'), 'class' => 'forced-title invert_filter']); ?>'; break; case "": state = '2'; - img = ' __('Event in process'), 'class' => 'forced-title']); ?>'; + img = ' __('Event in process'), 'class' => 'forced-title invert_filter']); ?>'; break; } @@ -2007,7 +2088,7 @@ function process_datatables_item(item) { } item.estado = ''; - item.estado += ''; + item.estado += ''; item.estado += state; item.estado += ''; item.estado += img; diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index bcdddba26b..75e3ac6eef 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -377,7 +377,7 @@ if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM') ) { // Save filter div for dialog. - echo ''; + echo ''; $table = new StdClass; $table->id = 'save_filter_form'; $table->width = '100%'; @@ -481,7 +481,7 @@ if (check_acl($config['id_user'], 0, 'EW') __('Save filter'), 'save_filter', false, - 'class="sub upd" style="float:right;"', + 'class="sub upd float-right"', true ); echo ''; @@ -489,7 +489,7 @@ if (check_acl($config['id_user'], 0, 'EW') } // Load filter div for dialog. -echo ''; +echo ''; $table = new StdClass; $table->id = 'load_filter_form'; $table->width = '100%'; @@ -599,6 +599,7 @@ $data[1] = html_print_image( 'id' => 'button-add_with', 'style' => 'cursor: pointer;', 'title' => __('Add'), + 'class' => 'invert_filter', ] ); @@ -615,6 +616,7 @@ $data[1] .= ''.html_print_image( 'id' => 'button-remove_with', 'style' => 'cursor: pointer;', 'title' => __('Remove'), + 'class' => 'invert_filter', ] ); @@ -875,11 +877,11 @@ $table_advanced->rowclass[] = ''; $data = []; if (defined('METACONSOLE')) { - $data[0] = ''.__('Events with following tags').''.html_print_table($tabletags_with, true).''; - $data2[1] = ''.__('Events without following tags').''.html_print_table($tabletags_without, true).''; + $data[0] = ''.__('Events with following tags').''.html_print_table($tabletags_with, true).''; + $data2[1] = ''.__('Events without following tags').''.html_print_table($tabletags_without, true).''; } else { - $data[0] = ''.__('Events with following tags').''.html_print_table($tabletags_with, true).''; - $data[1] = ''.__('Events without following tags').''.html_print_table($tabletags_without, true).''; + $data[0] = ''.__('Events with following tags').''.html_print_table($tabletags_with, true).''; + $data[1] = ''.__('Events without following tags').''.html_print_table($tabletags_without, true).''; } $table_advanced->data[] = $data; @@ -1031,7 +1033,7 @@ $table->rowclass[] = ''; // The buttons. $data = []; -$data[0] = ''; +$data[0] = ''; if ($event_w || $event_m) { $data[0] .= ''.html_print_image('images/disk.png', true, ['border' => '0', 'title' => __('Save filter'), 'alt' => __('Save filter')]).' '; } @@ -1054,12 +1056,12 @@ $events_filter .= html_print_table($table, true); unset($table); -$botom_update = ""; +$botom_update = ""; $botom_update .= html_print_submit_button( __('Update'), 'update', false, - 'class="sub upd" style="float:right;"', + 'class="sub upd float-right"', true ); $botom_update .= ''; @@ -1096,7 +1098,7 @@ if (is_metaconsole()) { // Error div for ajax messages. -echo ""; +echo ""; ui_print_error_message( __('Error creating filter.'), 'data-type_info_box="error_create_filter"' diff --git a/pandora_console/operation/events/events_marquee.php b/pandora_console/operation/events/events_marquee.php deleted file mode 100644 index 034cfdd8bd..0000000000 --- a/pandora_console/operation/events/events_marquee.php +++ /dev/null @@ -1,127 +0,0 @@ -'; -echo ''; -echo ''.__('%s - Latest events', get_product_name()).''; - -$query = ui_get_full_url(); -echo ''; -echo ''; -echo ''; - -echo ""; -echo ''; -echo ''; -echo ""; -echo "$output"; -echo ''; -echo ''; -echo ''; diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index 326c96c3f7..5a7fc45f0f 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -56,9 +56,14 @@ echo ''.__('Sound Events').''; '; -echo ''; +if ($config['style'] === 'pandora_black') { + echo ''; +} else { + echo ''; +} + echo ''; -echo ""; +echo ""; echo "".__('Sound console').''; // Connection lost alert. @@ -71,12 +76,11 @@ ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1. $table = new StdClass; $table->width = '100%'; -$table->styleTable = 'padding-left:16px; padding-right:16px; padding-top:16px;'; -$table->class = ' '; +$table->class = 'w16px sound_div_background '; $table->size[0] = '10%'; -$table->style[0] = 'font-weight: bold; vertical-align: top;'; -$table->style[1] = 'font-weight: bold; vertical-align: top;'; -$table->style[2] = 'font-weight: bold; vertical-align: top;'; +$table->rowclass[0] = 'bold_top'; +$table->rowclass[1] = 'bold_top'; +$table->rowclass[2] = 'bold_top'; $table->data[0][0] = __('Group'); $table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true, false, true, '', false, 'max-width:200px;').''.''; @@ -88,16 +92,13 @@ $table->data[1][0] = __('Agent'); $table->data[1][1] = html_print_select($agents, 'id_agents[]', true, false, '', '', true, true, '', '', '', 'max-width:200px; height:100px', '', false, '', '', true); $table->data[1][2] = __('Event'); -$table->data[1][3] = html_print_textarea('events_fired', 200, 20, '', 'readonly="readonly" style="max-height:100px; background: #ddd; resize:none;"', true); +$table->data[1][3] = html_print_textarea('events_fired', 200, 20, '', 'readonly="readonly" style="max-height:100px; resize:none;"', true); html_print_table($table); $table = new StdClass; $table->width = '100%'; -$table->rowstyle[0] = 'text-align:center;'; -$table->styleTable = 'padding-top:16px;padding-bottom:16px;'; -$table->class = ' '; -$table->bgcolor = 'white'; +$table->class = 'w16px sound_div_background text_center'; $table->data[0][0] = ''.html_print_image('images/play.button.png', true, ['id' => 'button']).''; @@ -278,8 +279,6 @@ function check_event() { $(document).ready (function () { setInterval("check_event()", (10 * 1000)); //10 seconds between ajax request - $("#table1").css("background-color", "#fff"); - $("#table2").css("background-color", "#fff"); }); @@ -287,9 +286,8 @@ $(document).ready (function () { '; -while (@ob_end_flush()) { - // Dumping... - continue; +while (ob_get_length() > 0) { + ob_end_flush(); } echo ''; diff --git a/pandora_console/operation/gis_maps/ajax.php b/pandora_console/operation/gis_maps/ajax.php index 50f8e18798..8af52328dd 100644 --- a/pandora_console/operation/gis_maps/ajax.php +++ b/pandora_console/operation/gis_maps/ajax.php @@ -233,7 +233,7 @@ switch ($opt) { $returnJSON = []; $returnJSON['correct'] = 1; - $returnJSON['content'] = __('Agent').': '.agents_get_alias($row['tagente_id_agente']).''; + $returnJSON['content'] = __('Agent').': '.agents_get_alias($row['tagente_id_agente']).''; $returnJSON['content'] .= __('Position (Lat, Long, Alt)').': ('.$row['latitude'].', '.$row['longitude'].', '.$row['altitude'].') '; $returnJSON['content'] .= __('Start contact').': '.$row['start_timestamp'].''; $returnJSON['content'] .= __('Last contact').': '.$row['end_timestamp'].''; @@ -267,7 +267,7 @@ switch ($opt) { // Agent name $row = []; $row[] = __('Agent'); - $row[] = ''.$agent['alias'].''; + $row[] = ''.$agent['alias'].''; $table->data[] = $row; // Position @@ -436,7 +436,7 @@ switch ($opt) { // Group name $row = []; $row[] = __('Group'); - $row[] = ''.$group['nombre'].''; + $row[] = ''.$group['nombre'].''; $table->data[] = $row; // Position diff --git a/pandora_console/operation/gis_maps/gis_map.php b/pandora_console/operation/gis_maps/gis_map.php index 6afd84907e..a8a12b0012 100644 --- a/pandora_console/operation/gis_maps/gis_map.php +++ b/pandora_console/operation/gis_maps/gis_map.php @@ -170,8 +170,13 @@ if ($maps !== false) { $data['name'] = ''.$map['map_name'].' '; $data['group'] = ui_print_group_icon($map['group_id'], true); - if ($edit_gis_maps) { - if ($display_default_column) { + $data['default'] = ''; + $data['op'] = ''; + + if (check_acl_restricted_all($config['id_user'], $map['group_id'], 'MW') + || check_acl_restricted_all($config['id_user'], $map['group_id'], 'MM') + ) { + if (check_acl_restricted_all($config['id_user'], 0, 'MM')) { $checked = false; if ($map['default_map']) { $checked = true; @@ -182,7 +187,7 @@ if ($maps !== false) { } $table->cellclass[]['op'] = 'action_buttons'; - $data['op'] = ''.html_print_image('images/config.png', true, ['title' => __('Edit')]).''.''.html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; + $data['op'] = ''.html_print_image('images/config.png', true, ['title' => __('Edit')]).''.''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; } array_push($table->data, $data); diff --git a/pandora_console/operation/gis_maps/public_console.php b/pandora_console/operation/gis_maps/public_console.php index 116f172795..1070443ed1 100755 --- a/pandora_console/operation/gis_maps/public_console.php +++ b/pandora_console/operation/gis_maps/public_console.php @@ -131,11 +131,11 @@ $controls = [ $layers = gis_get_layers($idMap); -echo ''; +echo ''; echo ''.$map['map_name'].''; echo ''; -echo ""; +echo ""; echo ''; diff --git a/pandora_console/operation/gis_maps/render_view.php b/pandora_console/operation/gis_maps/render_view.php index 0494949d76..a0d017f389 100644 --- a/pandora_console/operation/gis_maps/render_view.php +++ b/pandora_console/operation/gis_maps/render_view.php @@ -114,22 +114,22 @@ $controls = [ $layers = gis_get_layers($idMap); // Render map -$has_management_acl = check_acl($config['id_user'], $map['group_id'], 'MW') - || check_acl($config['id_user'], $map['group_id'], 'MM'); +$has_management_acl = check_acl_restricted_all($config['id_user'], $map['group_id'], 'MW') + || check_acl_restricted_all($config['id_user'], $map['group_id'], 'MM'); $buttons = []; if ($config['pure'] == 0) { - $buttons[]['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).''; + $buttons[]['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } else { - $buttons[]['text'] = ''.html_print_image('images/normalscreen.png', true, ['title' => __('Back to normal mode')]).''; + $buttons[]['text'] = ''.html_print_image('images/normalscreen.png', true, ['title' => __('Back to normal mode'), 'class' => 'invert_filter']).''; } if ($has_management_acl) { $hash = md5($config['dbpass'].$idMap.$config['id_user']); $buttons['public_link']['text'] = ''.html_print_image('images/camera_mc.png', true, ['title' => __('Show link to public Visual Console')]).''; + ).'" target="_blank">'.html_print_image('images/camera_mc.png', true, ['title' => __('Show link to public Visual Console'), 'class' => 'invert_filter']).''; } $times = [ @@ -144,7 +144,7 @@ $times = [ SECONDS_2HOUR => __('2 hours'), ]; -$buttons[]['text'] = "".__('Refresh').': '.html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false).''; +$buttons[]['text'] = "".__('Refresh').': '.html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false).''; $status = [ 'all' => __('None'), @@ -154,10 +154,10 @@ $status = [ 'default' => __('Other'), ]; -$buttons[]['text'] = "".__('Filter by status').': '.html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false).''; +$buttons[]['text'] = "".__('Filter by status').': '.html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false).''; if ($has_management_acl) { - $buttons['setup']['text'] = ''.html_print_image('images/setup.png', true, ['title' => __('Setup')]).''; + $buttons['setup']['text'] = ''.html_print_image('images/setup.png', true, ['title' => __('Setup'), 'class' => 'invert_filter']).''; $buttons['setup']['godmode'] = 1; } diff --git a/pandora_console/operation/incidents/configure_integriaims_incident.php b/pandora_console/operation/incidents/configure_integriaims_incident.php index 4fed803927..8e07ca7eff 100644 --- a/pandora_console/operation/incidents/configure_integriaims_incident.php +++ b/pandora_console/operation/incidents/configure_integriaims_incident.php @@ -315,7 +315,7 @@ if (!$update) { echo ''; -echo ''; +echo ''; if ($update) { html_print_submit_button(__('Update'), 'accion', false, 'form="create_integria_incident_form" class="sub wand"'); } else { diff --git a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php index 423ec8075d..bb7050344c 100644 --- a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php +++ b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php @@ -243,7 +243,7 @@ foreach ($files as $key => $value) { if (check_acl($config['id_user'], 0, 'IW')) { $table_files->data[$i][5] .= ''; - $table_files->data[$i][5] .= html_print_image('images/cross.png', true, ['title' => __('Delete')]); + $table_files->data[$i][5] .= html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']); } $table_files->data[$i][5] .= ''; @@ -263,7 +263,7 @@ $table_files_section->data[1][0] .= html_print_textarea( true ); -$table_files_section->data[2][0] .= ''.html_print_submit_button(__('Upload'), 'accion', false, 'class="sub wand"', true).''; +$table_files_section->data[2][0] .= ''.html_print_submit_button(__('Upload'), 'accion', false, 'class="sub wand"', true).''; $upload_file_form = ''; @@ -318,7 +318,7 @@ $table_comments_section->data[0][0] .= html_print_textarea( true ); -$table_comments_section->data[1][1] .= ''.html_print_submit_button(__('Add'), 'accion', $comment_disabled, 'class="sub wand"', true).''; +$table_comments_section->data[1][1] .= ''.html_print_submit_button(__('Add'), 'accion', $comment_disabled, 'class="sub wand"', true).''; // Upload comment. If ticket is closed, this action cannot be performed. if ($upload_comment && $array_get_incidents[6] != 7) { @@ -352,7 +352,7 @@ $comment_table = ''; if (!empty($comments)) { foreach ($comments as $key => $value) { - $comment_table .= ''.$value[3].' said '.$value[1].''.$value[2].' Hours'; + $comment_table .= ''.$value[3].' said '.$value[1].''.$value[2].' Hours'; $comment_table .= ''.$value[4].''; } } else { diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php index 8b8029e3c0..52356b9262 100755 --- a/pandora_console/operation/incidents/incident.php +++ b/pandora_console/operation/incidents/incident.php @@ -300,13 +300,13 @@ if ($count_total >= 1) { echo ''; html_print_submit_button(__('Show'), 'submit-estado', false, ['class' => 'sub']); - echo ''.__('Status').''; + echo ''.__('Status').''; foreach (incidents_get_status() as $id => $str) { incidents_print_status_img($id); echo ' - '.$str.''; } - echo ''.__('Priority').''; + echo ''.__('Priority').''; foreach (incidents_get_priorities() as $id => $str) { incidents_print_priority_img($id); echo ' - '.$str.''; @@ -476,11 +476,11 @@ if ($count_total < 1) { array_push($table->data, $data); } - echo ''; + echo ''; html_print_table($table); - echo ''; + echo ''; if (check_acl($config['id_user'], 0, 'IW')) { - html_print_submit_button(__('Delete incidents'), 'delete_btn', false, 'class="sub delete" style="margin-right: 5px;"'); + html_print_submit_button(__('Delete incidents'), 'delete_btn', false, 'class="sub delete" class="mrgn_right_5px"'); } if (check_acl($config['id_user'], 0, 'IM')) { @@ -491,7 +491,7 @@ if ($count_total < 1) { echo ''; unset($table); if (check_acl($config['id_user'], 0, 'IW')) { - echo ''; + echo ''; echo ''; html_print_submit_button(__('Create incident'), 'crt', false, 'class="sub next"'); echo ''; @@ -500,4 +500,4 @@ if ($count_total < 1) { } -echo ' '; +echo ' '; diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index 70288d29bf..b432a7d34a 100755 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -390,12 +390,12 @@ echo ''; echo ''; if ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user'])) { - html_print_textarea('descripcion', 15, 80, $texto, 'style="height:200px;"'); + html_print_textarea('descripcion', 15, 80, $texto, 'class="height_200px"'); } else { - html_print_textarea('descripcion', 15, 80, $texto, 'style="height:200px;" disabled'); + html_print_textarea('descripcion', 15, 80, $texto, 'class="height:200px" disabled'); } -echo ''; +echo ''; // Only if user is the used who opened incident or (s)he is admin if (isset($id_inc) and ((check_acl($config['id_user'], $id_grupo, 'IM') == 1) or ($usuario == $config['id_user']))) { @@ -423,7 +423,7 @@ if (isset($id_inc)) { echo ''.__('Add note').''; echo ' - + '; @@ -438,7 +438,7 @@ if (isset($id_inc)) { foreach ($result as $row) { $data = []; - $data[0] = html_print_image('images/page_white_text.png', true, ['border' => '0']); + $data[0] = html_print_image('images/page_white_text.png', true, ['class' => 'invert_filter', 'border' => '0']); $data[1] = __('Author').': '.ui_print_username($row['id_usuario'], true).' ('.ui_print_timestamp($row['timestamp'], true).')'; array_push($table->data, $data); @@ -526,7 +526,7 @@ if (isset($id_inc)) { echo ' '.__('Filename').' '.__('Description').' - + '; } } diff --git a/pandora_console/operation/incidents/list_integriaims_incidents.php b/pandora_console/operation/incidents/list_integriaims_incidents.php index f18fb31566..9da970d00d 100644 --- a/pandora_console/operation/incidents/list_integriaims_incidents.php +++ b/pandora_console/operation/incidents/list_integriaims_incidents.php @@ -186,7 +186,7 @@ $table->data[2][3] .= html_print_input_text_extended( 50, false, '', - 'style="margin-left:5px;" placeholder="'.__('Created to').'"', + 'class="mrgn_lft_5px" placeholder="'.__('Created to').'"', true ); @@ -213,10 +213,10 @@ $decode_csv = base64_encode(json_encode($tickets_filters)); // ---- PRINT TABLE FILTERS ---- -$integria_incidents_form = ''; +$integria_incidents_form = ''; $integria_incidents_form .= html_print_table($table, true); -$integria_incidents_form .= ''; -$integria_incidents_form .= ''.html_print_button( +$integria_incidents_form .= ''; +$integria_incidents_form .= ''.html_print_button( __('Export to CSV'), 'csv_export', false, @@ -303,7 +303,7 @@ foreach ($incidents_paginated as $key => $value) { if (check_acl($config['id_user'], 0, 'IM')) { $table->data[$i][8] .= ''; - $table->data[$i][8] .= html_print_image('images/cross.png', true, ['title' => __('Delete')]); + $table->data[$i][8] .= html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']); $table->data[$i][8] .= ''; } @@ -322,7 +322,7 @@ if (empty($table->data) === true) { // Show button to create incident. if (check_acl($config['id_user'], 0, 'IR')) { echo ''; - echo ''; + echo ''; html_print_submit_button(__('Create'), 'create_new_incident', false, 'class="sub next"'); echo ''; echo ''; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 87a3da3af1..fe769e1525 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -393,8 +393,6 @@ if (check_acl($config['id_user'], 0, 'ER') $sub['operation/events/events']['text'] = __('View events'); $sub['operation/events/events']['id'] = 'View events'; $sub['operation/events/events']['pages'] = ['godmode/events/events']; - $sub['operation/events/event_statistics']['text'] = __('Statistics'); - $sub['operation/events/event_statistics']['id'] = 'Statistics'; // If ip doesn't is in list of allowed IP, isn't show this options. include_once 'include/functions_api.php'; @@ -432,11 +430,6 @@ if (check_acl($config['id_user'], 0, 'ER') $sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&fb64='.$fb64]['text'] = __('RSS'); $sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&fb64='.$fb64]['id'] = 'RSS'; $sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&fb64='.$fb64]['type'] = 'direct'; - - // Marquee. - $sub['operation/events/events_marquee.php']['text'] = __('Marquee'); - $sub['operation/events/events_marquee.php']['id'] = 'Marquee'; - $sub['operation/events/events_marquee.php']['type'] = 'direct'; } // Sound Events. diff --git a/pandora_console/operation/messages/message_edit.php b/pandora_console/operation/messages/message_edit.php index 6135c4b10b..2378372a2a 100644 --- a/pandora_console/operation/messages/message_edit.php +++ b/pandora_console/operation/messages/message_edit.php @@ -48,7 +48,10 @@ $buttons['message_list'] = [ 'text' => ''.html_print_image( 'images/email_inbox.png', true, - ['title' => __('Received messages')] + [ + 'title' => __('Received messages'), + 'class' => 'invert_filter', + ] ).'', ]; @@ -57,7 +60,10 @@ $buttons['sent_messages'] = [ 'text' => ''.html_print_image( 'images/email_outbox.png', true, - ['title' => __('Sent messages')] + [ + 'title' => __('Sent messages'), + 'class' => 'invert_filter', + ] ).'', ]; @@ -66,7 +72,10 @@ $buttons['create_message'] = [ 'text' => ''.html_print_image( 'images/new_message.png', true, - ['title' => __('Create message')] + [ + 'title' => __('Create message'), + 'class' => 'invert_filter', + ] ).'', ]; @@ -209,23 +218,6 @@ if (($new_msg) && (!empty($dst_user)) && (!$reply)) { ); } -// Create message (destination group). -if (($new_msg) && ($dst_group != '') && (!$reply)) { - $return = messages_create_message( - $config['id_user'], - [], - [$dst_group], - $subject, - $message - ); - - ui_print_result_message( - $return, - __('Message successfully sent'), - __('Error sending message to group %s', groups_get_name($dst_group)) - ); -} - // Message creation form. // User info. $own_info = get_user_info($config['id_user']); diff --git a/pandora_console/operation/messages/message_list.php b/pandora_console/operation/messages/message_list.php index ca040ed4b4..9b25b9da9c 100644 --- a/pandora_console/operation/messages/message_list.php +++ b/pandora_console/operation/messages/message_list.php @@ -29,6 +29,8 @@ require_once 'include/functions_messages.php'; +global $config; + $delete_msg = get_parameter('delete_message', 0); $multiple_delete = get_parameter('multiple_delete', 0); $show_sent = get_parameter('show_sent', 0); @@ -41,14 +43,16 @@ if ($show_sent !== 0) { $active_sent = true; } + + $buttons['message_list'] = [ 'active' => $active_list, - 'text' => ''.html_print_image('images/email_inbox.png', true, ['title' => __('Received messages')]).'', + 'text' => ''.html_print_image('images/email_inbox.png', true, ['title' => __('Received messages'), 'class' => 'invert_filter']).'', ]; $buttons['sent_messages'] = [ 'active' => $active_sent, - 'text' => ''.html_print_image('images/email_outbox.png', true, ['title' => __('Sent messages')]).'', + 'text' => ''.html_print_image('images/email_outbox.png', true, ['title' => __('Sent messages'), 'class' => 'invert_filter']).'', ]; $buttons['create_message'] = [ @@ -56,7 +60,10 @@ $buttons['create_message'] = [ 'text' => ''.html_print_image( 'images/new_message.png', true, - ['title' => __('Create message')] + [ + 'title' => __('Create message'), + 'class' => 'invert_filter', + ] ).'', ]; @@ -189,21 +196,21 @@ if (empty($messages)) { if ($message['read'] == 1) { if ($show_sent) { $data[0] .= ''; - $data[0] .= html_print_image('images/email_open.png', true, ['border' => 0, 'title' => __('Click to read')]); + $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Click to read'), 'class' => 'invert_filter']); $data[0] .= ''; } else { $data[0] .= ''; - $data[0] .= html_print_image('images/email_open.png', true, ['border' => 0, 'title' => __('Mark as unread')]); + $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Mark as unread'), 'class' => 'invert_filter']); $data[0] .= ''; } } else { if ($show_sent) { $data[0] .= ''; - $data[0] .= html_print_image('images/email.png', true, ['border' => 0, 'title' => __('Message unread - click to read')]); + $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Message unread - click to read'), 'class' => 'invert_filter']); $data[0] .= ''; } else { $data[0] .= ''; - $data[0] .= html_print_image('images/email.png', true, ['border' => 0, 'title' => __('Message unread - click to read')]); + $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Message unread - click to read'), 'class' => 'invert_filter']); $data[0] .= ''; } } @@ -247,10 +254,10 @@ if (empty($messages)) { $table->cellclass[][4] = 'action_buttons'; if ($show_sent) { $data[4] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; + onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; } else { $data[4] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; + onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; } array_push($table->data, $data); @@ -266,7 +273,7 @@ if (!empty($messages)) { html_print_input_hidden('multiple_delete', 1); html_print_table($table); - echo ""; + echo ""; html_print_submit_button( __('Delete'), 'delete_btn', @@ -277,9 +284,9 @@ if (!empty($messages)) { echo ''; } -echo ""; - echo ''; - html_print_submit_button(__('Create message'), 'create', false, 'class="sub next" style="margin-right:5px;"'); +echo ""; + echo ''; + html_print_submit_button(__('Create message'), 'create', false, 'class="sub next mrgn_right_5px"'); echo ''; echo ''; ?> diff --git a/pandora_console/operation/netflow/nf_live_view.php b/pandora_console/operation/netflow/nf_live_view.php index 6cbc1ea16d..dae0c9457a 100644 --- a/pandora_console/operation/netflow/nf_live_view.php +++ b/pandora_console/operation/netflow/nf_live_view.php @@ -352,12 +352,12 @@ if (is_metaconsole()) { $filter_type = 0; } - echo ""; + echo ""; echo "".ui_print_error_message('Define a name for the filter and click on Save as new filter again', '', true).''; echo ''; - echo ""; + echo ""; echo ''.__('Name').''; echo "".html_print_input_text( @@ -373,7 +373,7 @@ if (is_metaconsole()) { echo "".html_print_select_groups($config['id_user'], 'IW', $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false).''; echo ''; - $advanced_toggle = ''; + $advanced_toggle = ''; $advanced_toggle .= ''; if ($netflow_disable_custom_lvfilters) { @@ -381,7 +381,7 @@ if (is_metaconsole()) { $advanced_toggle .= ''; } else { $advanced_toggle .= ''.__('Filter').''; - $advanced_toggle .= ''.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true).''; + $advanced_toggle .= ''.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'class="mrgn_right_40px"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'class="mrgn_right_40px"', true).''; } @@ -403,7 +403,7 @@ if (is_metaconsole()) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { - $advanced_toggle .= "".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:25.46.157.214,160.253.135.249'), true).''; + $advanced_toggle .= "".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:25.46.157.214,160.253.135.249'), true).''; $advanced_toggle .= ''.html_print_input_text('ip_dst', $filter['ip_dst'], false, 40, 80, true).''; } @@ -411,7 +411,7 @@ if (is_metaconsole()) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { - $advanced_toggle .= "".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:25.46.157.214,160.253.135.249'), true).''; + $advanced_toggle .= "".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:25.46.157.214,160.253.135.249'), true).''; $advanced_toggle .= ''.html_print_input_text('ip_src', $filter['ip_src'], false, 40, 80, true).''; } @@ -422,7 +422,7 @@ if (is_metaconsole()) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { - $advanced_toggle .= "".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:80,22'), true).''; + $advanced_toggle .= "".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:80,22'), true).''; $advanced_toggle .= ''.html_print_input_text('dst_port', $filter['dst_port'], false, 40, 80, true).''; } @@ -430,19 +430,19 @@ if (is_metaconsole()) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { - $advanced_toggle .= "".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:80,22'), true).''; + $advanced_toggle .= "".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:80,22'), true).''; $advanced_toggle .= ''.html_print_input_text('src_port', $filter['src_port'], false, 40, 80, true).''; } $advanced_toggle .= ''; - $advanced_toggle .= ""; + $advanced_toggle .= ""; if ($netflow_disable_custom_lvfilters) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { $advanced_toggle .= ''.ui_print_help_icon('pcap_filter', true).''; - $advanced_toggle .= "".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true).''; + $advanced_toggle .= "".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "class='min-height-0px w90p'", true).''; } $advanced_toggle .= ''; @@ -490,14 +490,14 @@ if (is_metaconsole()) { echo ''; echo ''; - echo ""; + echo ""; echo html_print_submit_button(__('Draw'), 'draw_button', false, 'class="sub upd"', true); if (!$netflow_disable_custom_lvfilters) { if (check_acl($config['id_user'], 0, 'AW')) { - html_print_submit_button(__('Save as new filter'), 'save_button', false, 'style="margin-left: 5px;" class="sub upd" onClick="return defineFilterName();"'); - html_print_submit_button(__('Update current filter'), 'update_button', false, 'style="margin-left: 5px;" class="sub upd"'); + html_print_submit_button(__('Save as new filter'), 'save_button', false, ' class="sub upd mrgn_lft_5px" onClick="return defineFilterName();"'); + html_print_submit_button(__('Update current filter'), 'update_button', false, 'class="sub upd mrgn_lft_5px"'); } } diff --git a/pandora_console/operation/network/network_report.php b/pandora_console/operation/network/network_report.php index 64a984422e..9d9fca02f7 100644 --- a/pandora_console/operation/network/network_report.php +++ b/pandora_console/operation/network/network_report.php @@ -97,7 +97,7 @@ $table->data['0']['1'] .= html_print_select( $table->data['0']['2'] = ''; -$table->data['1']['0'] = ''; +$table->data['1']['0'] = ''; $table->data['1']['0'] .= ''; $table->data['1']['0'] .= __('Start date').' '; $table->data['1']['0'] .= html_print_input_text('date_lower', $date_lower, '', 10, 7, true); @@ -332,11 +332,11 @@ foreach ($data as $item) { if (empty($data)) { ui_print_info_message(__('No data found')); } else { - echo ''; + echo ''; html_print_table($table); // Print the graph. - echo ''; + echo ''; echo pie_graph( $chart_data, 320, diff --git a/pandora_console/operation/network/network_usage_map.php b/pandora_console/operation/network/network_usage_map.php index 0a63ecee27..391905197d 100644 --- a/pandora_console/operation/network/network_usage_map.php +++ b/pandora_console/operation/network/network_usage_map.php @@ -70,7 +70,7 @@ $table = new stdClass(); $table->class = 'databox filters'; $table->styleTable = 'width: 100%'; -$table->data['0']['0'] = ''; +$table->data['0']['0'] = ''; $table->data['0']['0'] .= ''; $table->data['0']['0'] .= __('Start date').' '; $table->data['0']['0'] .= html_print_input_text('date_lower', $date_lower, '', 10, 7, true); diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index fe43cfc238..000179fe4e 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -12,8 +12,11 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Login check +global $config; + check_login(); + require_once 'include/functions_custom_graphs.php'; $delete_graph = (bool) get_parameter('delete_graph'); @@ -145,19 +148,49 @@ if ($view_graph) { $options = []; - if (check_acl($config['id_user'], 0, 'RW')) { + if (check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RW') + || check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RM') + ) { $options = [ 'graph_list' => [ 'active' => false, - 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Graph list')]).'', + 'text' => ''.html_print_image( + 'images/list.png', + true, + [ + 'title' => __('Graph list'), + 'class' => 'invert_filter', + ] + ).'', ], 'main' => [ 'active' => false, - 'text' => ''.html_print_image('images/chart.png', true, ['title' => __('Main data')]).'', + 'text' => ''.html_print_image( + 'images/chart.png', + true, + [ + 'title' => __('Main data'), + 'class' => 'invert_filter', + ] + ).'', ], 'graph_editor' => [ 'active' => false, - 'text' => ''.html_print_image('images/builder.png', true, ['title' => __('Graph editor')]).'', + 'text' => ''.html_print_image( + 'images/builder.png', + true, + [ + 'title' => __('Graph editor'), + 'class' => 'invert_filter', + ] + ).'', + ], + ]; + } else { + $options = [ + 'graph_list' => [ + 'active' => false, + 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Graph list')]).'', ], ]; } @@ -165,14 +198,31 @@ if ($view_graph) { $options['view']['text'] = ''.html_print_image( 'images/operation.png', true, - ['title' => __('View graph')] + [ + 'title' => __('View graph'), + 'class' => 'invert_filter', + ] ).''; $options['view']['active'] = true; if ($config['pure'] == 0) { - $options['screen']['text'] = "".html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).''; + $options['screen']['text'] = "".html_print_image( + 'images/full_screen.png', + true, + [ + 'title' => __('Full screen mode'), + 'class' => 'invert_filter', + ] + ).''; } else { - $options['screen']['text'] = "".html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]).''; + $options['screen']['text'] = "".html_print_image( + 'images/normal_screen.png', + true, + [ + 'title' => __('Back to normal mode'), + 'class' => 'invert_filter', + ] + ).''; // In full screen, the manage options are not available $options = [ @@ -217,7 +267,7 @@ if ($view_graph) { echo ""; echo ''; if ($stacked == CUSTOM_GRAPH_VBARS) { - echo ''; + echo ''; } echo $graph_return; @@ -236,7 +286,7 @@ if ($view_graph) { $period_label = human_time_description_raw($period); echo ""; - echo ""; + echo ""; echo ''; echo ''; @@ -275,7 +325,7 @@ if ($view_graph) { echo ''; echo ""; - echo " ".__('Equalize maximum thresholds').''.ui_print_help_tip(__('If an option is selected, all graphs will have the highest value from all modules included in the graph as a maximum threshold'), true); + echo " ".__('Equalize maxiddmum thresholds').''.ui_print_help_tip(__('If an option is selected, all graphs will have the highest value from all modules included in the graph as a maximum threshold'), true); html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false); echo ''; @@ -362,7 +412,7 @@ if ($view_graph) { } // Header -ui_print_page_header(__('Reporting').' » '.__('Custom graph viewer'), 'images/reporting.png', false, '', false, ''); +ui_print_page_header(__('Reporting').' » '.__('Custom graph viewer'), 'images/op_reporting.png', false, '', false, ''); $graphs = custom_graphs_get_user(); diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 0bd400c6af..e49c2ae41d 100755 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -76,11 +76,23 @@ $options['list_reports'] = [ 'text' => ''.html_print_image( 'images/report_list.png', true, - ['title' => __('Report list')] + [ + 'title' => __('Report list'), + 'class' => 'invert_filter', + ] ).'', ]; -if (check_acl($config['id_user'], 0, 'RW')) { +if ($id_report > 0) { + $report_group = db_get_value( + 'id_group', + 'treport', + 'id_report', + $id_report + ); +} + +if (check_acl_restricted_all($config['id_user'], $report_group, 'RW')) { $options['main']['text'] = ''.html_print_image( 'images/op_reporting.png', true, @@ -90,13 +102,19 @@ if (check_acl($config['id_user'], 0, 'RW')) { $options['list_items']['text'] = ''.html_print_image( 'images/list.png', true, - ['title' => __('List items')] + [ + 'title' => __('List items'), + 'class' => 'invert_filter', + ] ).''; $options['item_editor']['text'] = ''.html_print_image( - 'images/pen.png', + 'images/pencil.png', true, - ['title' => __('Item editor')] + [ + 'title' => __('Item editor'), + 'class' => 'invert_filter', + ] ).''; if (enterprise_installed()) { @@ -106,14 +124,36 @@ if (check_acl($config['id_user'], 0, 'RW')) { $options['view'] = [ 'active' => true, - 'text' => ''.html_print_image('images/operation.png', true, ['title' => __('View report')]).'', + 'text' => ''.html_print_image( + 'images/operation.png', + true, + [ + 'title' => __('View report'), + 'class' => 'invert_filter', + + ] + ).'', ]; if (!defined('METACONSOLE')) { if ($config['pure'] == 0) { - $options['screen']['text'] = "".html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).''; + $options['screen']['text'] = "".html_print_image( + 'images/full_screen.png', + true, + [ + 'title' => __('Full screen mode'), + 'class' => 'invert_filter', + ] + ).''; } else { - $options['screen']['text'] = "".html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]).''; + $options['screen']['text'] = "".html_print_image( + 'images/normal_screen.png', + true, + [ + 'title' => __('Back to normal mode'), + 'class' => 'invert_filter', + ] + ).''; // In full screen, the manage options are not available $options = [ @@ -193,12 +233,12 @@ $table->data[0][0] = html_print_image( ); if (reporting_get_description($id_report)) { - $table->data[0][1] = ''.reporting_get_description($id_report).''; + $table->data[0][1] = ''.reporting_get_description($id_report).''; } else { - $table->data[0][1] = ''.reporting_get_name($id_report).''; + $table->data[0][1] = ''.reporting_get_name($id_report).''; } -$table->data[0][1] .= ''.__('Set initial date').html_print_checkbox('enable_init_date', 1, $enable_init_date, true); +$table->data[0][1] .= ''.__('Set initial date').html_print_checkbox('enable_init_date', 1, $enable_init_date, true); $html_enterprise = enterprise_hook( 'reporting_print_button_PDF', [$id_report] @@ -218,7 +258,7 @@ $table->data[1][2] .= html_print_input_text('date', $date, '', 12, 10, true).' ' $table->data[1][2] .= html_print_input_text('time', $time, '', 10, 7, true).' '; $table->data[1][2] .= html_print_submit_button(__('Update'), 'date_submit', false, 'class="sub next"', true); -echo ''; +echo ''; html_print_table($table); html_print_input_hidden('id_report', $id_report); echo ''; @@ -250,7 +290,7 @@ reporting_html_print_report($report, false, $config['custom_report_info']); // The rowspan of the first row is only 2 in controls table. Why is used the same code here and in the items?? $table->rowspan[0][0] = 1; -echo ''; +echo ''; echo html_print_image('images/wait.gif', true, ['border' => '0']); echo ''.__('Loading').'...'; echo ''; diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index 951c3c12ff..dede18d3f1 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -179,6 +179,8 @@ if ($searchAgents) { $userGroups = users_get_groups($config['id_user'], 'AR', false); $id_userGroups = array_keys($userGroups); + $has_secondary = enterprise_hook('agents_is_using_secondary_groups'); + $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress INNER JOIN taddress_agent ON taddress.id_a = taddress_agent.id_a @@ -188,10 +190,10 @@ if ($searchAgents) { if ($id != '') { $aux = $id[0]['id_agent']; $search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%cd ".$stringSearchSQL."%%' OR - t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR - t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR - t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR - t1.id_agente = $aux"; + t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR + t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR + t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR + t1.id_agente = $aux"; if (count($id) >= 2) { for ($i = 1; $i < count($id); $i++) { @@ -201,10 +203,15 @@ if ($searchAgents) { } } else { $search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR - t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR + t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t1.direccion COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR - t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%'"; + t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%'"; + } + + if ($has_secondary === true) { + $search_sql .= " OR (tasg.id_group IS NOT NULL AND + tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%'))"; } $sql = " @@ -235,7 +242,7 @@ if ($searchAgents) { AND ( ".$search_sql.' ) - '; + '; $select = 'SELECT DISTINCT(t1.id_agente), t1.ultimo_contacto, t1.nombre, t1.comentarios, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet'; if ($only_count) { diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php index e0b97dd6e1..e46a3887f4 100755 --- a/pandora_console/operation/search_agents.php +++ b/pandora_console/operation/search_agents.php @@ -105,14 +105,22 @@ if (!$agents || !$searchAgents) { $time = ui_print_timestamp($last_time, true); $time_style = $time; if ($diferencia > ($agent['intervalo'] * 2)) { - $time_style = ''.$time.''; + $time_style = ''.$time.''; } $manage_agent = ''; if (check_acl($config['id_user'], $agent['id_grupo'], 'AW')) { $url_manage = 'index.php?sec=estado&sec2=godmode/agentes/configurar_agente&id_agente='.$agent['id_agente']; - $manage_agent = ''.html_print_image('images/cog.png', true, ['title' => __('Manage'), 'alt' => __('Manage')]).''; + $manage_agent = ''.html_print_image( + 'images/cog.png', + true, + [ + 'title' => __('Manage'), + 'alt' => __('Manage'), + 'class' => 'invert_filter', + ] + ).''; } array_push( diff --git a/pandora_console/operation/search_helps.php b/pandora_console/operation/search_helps.php index 259e38f84a..2433355571 100644 --- a/pandora_console/operation/search_helps.php +++ b/pandora_console/operation/search_helps.php @@ -17,7 +17,7 @@ $totalHelps = check_acl($config['id_user'], 0, 'IR'); if ($helps === false || !$searchHelps) { echo "".__('Zero results found.').sprintf( - __('You can find more help in the wiki'), + __('You can find more help in the wiki'), 'http://wiki.pandorafms.com/index.php?search='.$config['search_keywords'] )."\n"; } else { diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index 29dbb33cab..813ef1b004 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -23,7 +23,7 @@ $searchUsers = check_acl($config['id_user'], 0, 'UM'); $searchPolicies = check_acl($config['id_user'], 0, 'AW'); $searchHelps = true; -echo ''; +echo ''; $anyfound = false; @@ -51,9 +51,9 @@ $table->style[15] = 'font-weight: bold; text-align: center;'; -$table->data[0][0] = html_print_image('images/agent.png', true, ['title' => __('Agents found')]); +$table->data[0][0] = html_print_image('images/agent.png', true, ['title' => __('Agents found'), 'class' => 'invert_filter']); $table->data[0][1] = "".sprintf(__('%s Found'), $totalAgents).''; -$table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found')]); +$table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found'), 'class' => 'invert_filter']); $table->data[0][3] = "".sprintf(__('%s Found'), $totalModules).''; // ------------------- DISABLED FOR SOME INSTALLATIONS------------------ @@ -61,16 +61,16 @@ $table->data[0][3] = "" . // ~ sprintf(__("%s Found"), $totalAlerts) . ""; // --------------------------------------------------------------------- -$table->data[0][6] = html_print_image('images/input_user.png', true, ['title' => __('Users found')]); +$table->data[0][6] = html_print_image('images/input_user.png', true, ['title' => __('Users found'), 'class' => 'invert_filter']); $table->data[0][7] = "".sprintf(__('%s Found'), $totalUsers).''; -$table->data[0][8] = html_print_image('images/chart_curve.png', true, ['title' => __('Graphs found')]); +$table->data[0][8] = html_print_image('images/chart_curve.png', true, ['title' => __('Graphs found'), 'class' => 'invert_filter']); $table->data[0][9] = "".sprintf(__('%s Found'), $totalGraphs).''; -$table->data[0][10] = html_print_image('images/reporting.png', true, ['title' => __('Reports found')]); +$table->data[0][10] = html_print_image('images/reporting.png', true, ['title' => __('Reports found'), 'class' => 'invert_filter']); $table->data[0][11] = "".sprintf(__('%s Found'), $totalReports).''; -$table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]); +$table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Visual consoles')]); $table->data[0][13] = "".sprintf(__('%s Found'), $totalMaps).''; if (enterprise_installed()) { - $table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]); + $table->data[0][14] = html_print_image('images/policies_mc.png', true, ['title' => __('Policies')]); $table->data[0][15] = "".sprintf(__('%s Found'), $totalPolicies).''; } diff --git a/pandora_console/operation/search_maps.getdata.php b/pandora_console/operation/search_maps.getdata.php index a74a721232..2f8fa18a49 100644 --- a/pandora_console/operation/search_maps.getdata.php +++ b/pandora_console/operation/search_maps.getdata.php @@ -19,7 +19,7 @@ $maps = false; $totalMaps = 0; if ($searchMaps) { - $user_groups = users_get_groups($config['id_user'], 'AR', false); + $user_groups = users_get_groups($config['id_user'], 'AR', true); $id_user_groups = array_keys($user_groups); $id_user_groups_str = implode(',', $id_user_groups); diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index 93c7db4593..e1a9d078e3 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -141,7 +141,7 @@ if ($searchMaps) { 'text' => "".html_print_image( 'images/visual_console.png', true, - ['title' => __('Maps')] + ['title' => __('Visual consoles')] ).'', 'active' => $searchTab == 'maps', ]; @@ -165,7 +165,7 @@ if ($searchModules) { if ($searchPolicies) { $policies_tab = [ 'text' => "".html_print_image( - 'images/policies.png', + 'images/policies_mc.png', true, ['title' => __('Policies')] ).'', diff --git a/pandora_console/operation/servers/recon_view.php b/pandora_console/operation/servers/recon_view.php index 3d12a24df4..2cb71042c9 100644 --- a/pandora_console/operation/servers/recon_view.php +++ b/pandora_console/operation/servers/recon_view.php @@ -44,10 +44,10 @@ if ($servers === false) { include_once $config['homedir'].'/include/functions_network_profiles.php'; if (check_acl($config['id_user'], 0, 'AW')) { - $options['manage']['text'] = "".html_print_image('images/setup.png', true, ['title' => __('Manage')]).''; + $options['manage']['text'] = "".html_print_image('images/setup.png', true, ['title' => __('Manage'), 'class' => 'invert_filter']).''; } - $options[]['text'] = "".html_print_image('images/refresh_mc.png', true, ['title' => __('Refresh')]).''; + $options[]['text'] = "".html_print_image('images/refresh_mc.png', true, ['title' => __('Refresh'), 'class' => 'invert_filter']).''; ui_print_page_header(__('Recon View'), 'images/op_recon.png', false, '', false, $options); @@ -120,7 +120,7 @@ if ($servers === false) { if ($task['disabled'] == 0) { $data[0] = ''; - $data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]); + $data[0] .= html_print_image('images/target.png', true, ['title' => __('Force'), 'class' => 'invert_filter']); $data[0] .= ''; } else { $data[0] = ''; @@ -144,11 +144,11 @@ if ($servers === false) { if ($task['id_recon_script'] == 0) { // Network recon task - $data[5] = html_print_image('images/network.png', true, ['title' => __('Network recon task')]).' '; + $data[5] = html_print_image('images/op_network.png', true, ['title' => __('Network recon task'), 'class' => 'invert_filter']).' '; $data[5] .= network_profiles_get_name($task['id_network_profile']); } else { // APP recon task - $data[5] = html_print_image('images/plugin.png', true).' '; + $data[5] = html_print_image('images/plugin.png', true, ['class' => 'invert_filter']).' '; $data[5] .= db_get_sql(sprintf('SELECT name FROM trecon_script WHERE id_recon_script = %d', $task['id_recon_script'])); } diff --git a/pandora_console/operation/snmpconsole/snmp_browser.php b/pandora_console/operation/snmpconsole/snmp_browser.php index 706117c4fe..a4839cce25 100644 --- a/pandora_console/operation/snmpconsole/snmp_browser.php +++ b/pandora_console/operation/snmpconsole/snmp_browser.php @@ -40,6 +40,8 @@ if (!check_acl($config['id_user'], 0, 'AR')) { exit(); } + + // Header. $url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_browser&pure='.$config['pure']; if ($config['pure']) { @@ -50,6 +52,7 @@ if ($config['pure']) { true, [ 'title' => __('Normal screen'), + 'class' => 'invert_filter', ] ); $link['text'] .= ''; @@ -61,6 +64,7 @@ if ($config['pure']) { true, [ 'title' => __('Full screen'), + 'class' => 'invert_filter', ] ); $link['text'] .= ''; @@ -79,9 +83,9 @@ ui_print_page_header( snmp_browser_print_container(false, '100%', '60%', '', true); // Div for modal -echo ''; +echo ''; // Div for loading modal. -echo ''; +echo ''; ?> @@ -139,7 +143,6 @@ function snmp_browser_show_add_module_massive(module_target = 'agent') { var snmp_extradata = snmp_browser_create_modules(module_target); // Load dinamically modal form. load_modal({ - target: $('#modal'), form: 'snmp_browser_add_module_form', extradata: [ { @@ -197,7 +200,7 @@ function waiting_modal(stop = false) { var waiting_modal = - '' + + '' + ' ' + ' '; @@ -322,21 +325,48 @@ function add_module_massive_controller(target = 'agent') }); // Select all Items. - $("input[name='select_all_left']").click(function () { - $('#id_item option').map(function() { - $(this).prop('selected', true); - }); - + $("#checkbox-select_all_left").change(function () { + if ($("#checkbox-select_all_left").prop('checked') == true) { + $('#id_item option').map(function() { + $(this).prop('selected', true); + }); + } else { + $('#id_item option').map(function() { + $(this).prop('selected', false); + }); + } + return false; }); - $("input[name='select_all_right']").click(function () { - $('#id_item2 option').map(function() { - $(this).prop('selected', true); - }); - + + $("#checkbox-select_all_right").change(function () { + if ($("#checkbox-select_all_right").prop('checked') == true) { + $('#id_item2 option').map(function() { + $(this).prop('selected', true); + }); + } else { + $('#id_item2 option').map(function() { + $(this).prop('selected', false); + }); + } + return false; }); + $("#id_item").click(function(e) { + if ($("#checkbox-select_all_left").prop('checked') == true) { + $("#checkbox-select_all_left").prop('checked', false); + } + }); + + $("#id_item2").click(function(e) { + if ($("#checkbox-select_all_right").prop('checked') == true) { + $("#checkbox-select_all_right").prop('checked', false); + } + }); + + $(".p-switch").css('display', 'table'); + // Select items. $("#right").click (function () { jQuery.each($("select[name='id_item[]'] option:selected"), function (key, value) { diff --git a/pandora_console/operation/snmpconsole/snmp_statistics.php b/pandora_console/operation/snmpconsole/snmp_statistics.php index 4f9c42cb1e..a240c7d6a6 100755 --- a/pandora_console/operation/snmpconsole/snmp_statistics.php +++ b/pandora_console/operation/snmpconsole/snmp_statistics.php @@ -38,19 +38,47 @@ $refr = (int) get_parameter('refr', 0); // Fullscreen $fullscreen = []; if ($config['pure']) { - $fullscreen['text'] = ''.html_print_image('images/normal_screen.png', true, ['title' => __('Normal screen')]).''; + $fullscreen['text'] = ''.html_print_image( + 'images/normal_screen.png', + true, + [ + 'title' => __('Normal screen'), + 'class' => 'invert_filter', + ] + ).''; } else { - $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).''; + $fullscreen['text'] = ''.html_print_image( + 'images/full_screen.png', + true, + [ + 'title' => __('Full screen'), + 'class' => 'invert_filter', + ] + ).''; } // List $list = []; -$list['text'] = ''.html_print_image('images/op_snmp.png', true, ['title' => __('List')]).''; +$list['text'] = ''.html_print_image( + 'images/op_snmp.png', + true, + [ + 'title' => __('List'), + 'class' => 'invert_filter', + ] +).''; // Statistics (This file) $statistics = []; $statistics['active'] = true; -$statistics['text'] = ''.html_print_image('images/op_reporting.png', true, ['title' => __('Statistics')]).''; +$statistics['text'] = ''.html_print_image( + 'images/op_reporting.png', + true, + [ + 'title' => __('Statistics'), + 'class' => 'invert_filter', + ] +).''; // Header ui_print_page_header( diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 99ce315891..5442f75823 100755 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -92,15 +92,43 @@ $url .= '&free_search_string='.$free_search_string.'&pagination='.$pagination; $url .= '&offset='.$offset.'&trap_type='.$trap_type.'&group_by='.$group_by; $url .= '&hours_ago='.$hours_ago.'&pure='.$pure; -$statistics['text'] = ''.html_print_image('images/op_reporting.png', true, ['title' => __('Statistics')]).''; -$list['text'] = ''.html_print_image('images/op_snmp.png', true, ['title' => __('List')]).''; +$statistics['text'] = ''.html_print_image( + 'images/op_reporting.png', + true, + [ + 'title' => __('Statistics'), + 'class' => 'invert_filter', + ] +).''; +$list['text'] = ''.html_print_image( + 'images/op_snmp.png', + true, + [ + 'title' => __('List'), + 'class' => 'invert_filter', + ] +).''; $list['active'] = true; if ($config['pure']) { - $fullscreen['text'] = ''.html_print_image('images/normal_screen.png', true, ['title' => __('Normal screen')]).''; + $fullscreen['text'] = ''.html_print_image( + 'images/normal_screen.png', + true, + [ + 'title' => __('Normal screen'), + 'class' => 'invert_filter', + ] + ).''; } else { // Fullscreen. - $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).''; + $fullscreen['text'] = ''.html_print_image( + 'images/full_screen.png', + true, + [ + 'title' => __('Full screen'), + 'class' => 'invert_filter', + ] + ).''; } @@ -619,7 +647,7 @@ $table->data[4][1] = html_print_input( ); // Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other). -$table->data[6][1] = ''.__('Trap type').''.ui_print_help_tip(__('Search by trap type'), true); +$table->data[4][3] = ''.__('Trap type').''.ui_print_help_tip(__('Search by trap type'), true); $trap_types = [ -1 => __('None'), 0 => __('Cold start (0)'), @@ -629,7 +657,7 @@ $trap_types = [ 4 => __('Authentication failure (4)'), 5 => __('Other'), ]; -$table->data[6][2] = html_print_select( +$table->data[4][4] = html_print_select( $trap_types, 'trap_type', $trap_type, @@ -718,20 +746,27 @@ if (empty($traps)) { $urlPagination = $normal_url.'&pagination='.$pagination.'&offset='.$offset; echo ''; - echo html_print_image('images/normal_screen.png', true, ['title' => __('Exit fullscreen')]); + echo html_print_image( + 'images/normal_screen.png', + true, + [ + 'title' => __('Exit fullscreen'), + 'class' => 'invert_filter', + ] + ); echo ''; echo ''; // Auto refresh control. echo ''; - echo ''; - echo ''; + echo ''; + echo ''; $normal_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure=1&trap_type='.$trap_type.'&group_by='.$group_by.'&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap; $urlPagination = $normal_url.'&pagination='.$pagination.'&offset='.$offset; - echo ''; + echo ''; echo __('Refresh every').':'; echo html_print_select(get_refresh_time_array(), 'refresh', $refr, '', '', 0, true, false, false); echo ''; @@ -997,17 +1032,41 @@ if ($traps !== false) { if ($trap['source'] == '') { $is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']); if ($is_admin) { - $data[8] .= ''.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).' '; + $data[8] .= ''.html_print_image( + 'images/cross.png', + true, + [ + 'border' => '0', + 'title' => __('Delete'), + 'class' => 'invert_filter', + ] + ).' '; } } else { $agent_trap_group = db_get_value('id_grupo', 'tagente', 'nombre', $trap['source']); if ((check_acl($config['id_user'], $agent_trap_group, 'IM'))) { - $data[8] .= ''.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).' '; + $data[8] .= ''.html_print_image( + 'images/cross.png', + true, + [ + 'border' => '0', + 'title' => __('Delete'), + 'class' => 'invert_filter', + ] + ).' '; } } - $data[8] .= ''.html_print_image('images/eye.png', true, ['alt' => __('Show more'), 'title' => __('Show more')]).''; + $data[8] .= ''.html_print_image( + 'images/eye.png', + true, + [ + 'alt' => __('Show more'), + 'title' => __('Show more'), + 'class' => 'invert_filter', + ] + ).''; $data[8] .= enterprise_hook('editor_link', [$trap]); @@ -1016,7 +1075,7 @@ if ($traps !== false) { array_push($table->data, $data); // Hiden file for description. - $string = ' + $string = ' '.''.__('Variable bindings:').' '; @@ -1157,7 +1216,7 @@ if ($idx == 0) { unset($table); -echo ''; +echo ''; if (check_acl($config['id_user'], 0, 'IW')) { html_print_submit_button(__('Validate'), 'updatebt', false, 'class="sub ok"'); } @@ -1170,7 +1229,7 @@ if (check_acl($config['id_user'], 0, 'IM')) { echo ''; -echo ''; +echo ''; echo ''.__('Status').''; echo html_print_image( 'images/pixel_green.png', @@ -1190,7 +1249,7 @@ echo html_print_image( ] ).' - '.__('Not validated'); echo ''; -echo ''; +echo ''; echo ''.__('Alert').''; echo html_print_image( 'images/pixel_yellow.png', @@ -1210,13 +1269,13 @@ echo html_print_image( ] ).' - '.__('Not fired'); echo ''; -echo ''; +echo ''; echo ''.__('Action').''; echo html_print_image('images/ok.png', true).' - '.__('Validate'); echo ''; -echo html_print_image('images/cross.png', true).' - '.__('Delete'); +echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']).' - '.__('Delete'); echo ''; -echo ''; +echo ''; echo ''.__('Legend').''; foreach (get_priorities() as $num => $name) { echo ''.$name.''; @@ -1224,7 +1283,7 @@ foreach (get_priorities() as $num => $name) { } echo ''; -echo ' '; +echo ' '; ui_include_time_picker(); ?> diff --git a/pandora_console/operation/system_alert.php b/pandora_console/operation/system_alert.php index e624e47c59..8e303ab053 100644 --- a/pandora_console/operation/system_alert.php +++ b/pandora_console/operation/system_alert.php @@ -16,11 +16,11 @@ if (check_login()) { "; - echo ""; + echo ""; echo get_pandora_error_for_header(); echo ''; - echo " + echo " OK "; } diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index 771e717fd5..4597a25beb 100755 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -44,7 +44,10 @@ if (!$strict_acl) { 'text' => "".html_print_image( 'images/tag.png', true, - ['title' => __('Tags')] + [ + 'title' => __('Tags'), + 'class' => 'invert_filter', + ] ).'', 'active' => ($tab == 'tag'), ]; @@ -53,7 +56,10 @@ if (!$strict_acl) { 'text' => "".html_print_image( 'images/operating_system.png', true, - ['title' => __('OS')] + [ + 'title' => __('OS'), + 'class' => 'invert_filter', + ] ).'', 'active' => ($tab == 'os'), ]; @@ -62,7 +68,10 @@ if (!$strict_acl) { 'text' => "".html_print_image( 'images/group.png', true, - ['title' => __('Groups')] + [ + 'title' => __('Groups'), + 'class' => 'invert_filter', + ] ).'', 'active' => ($tab == 'group'), ]; @@ -71,7 +80,10 @@ if (!$strict_acl) { 'text' => "".html_print_image( 'images/module_group.png', true, - ['title' => __('Module groups')] + [ + 'title' => __('Module groups'), + 'class' => 'invert_filter', + ] ).'', 'active' => ($tab == 'module_group'), ]; @@ -80,7 +92,10 @@ if (!$strict_acl) { 'text' => "".html_print_image( 'images/brick.png', true, - ['title' => __('Modules')] + [ + 'title' => __('Modules'), + 'class' => 'invert_filter', + ] ).'', 'active' => ($tab == 'module'), ]; @@ -90,7 +105,10 @@ if (!$strict_acl) { 'text' => "".html_print_image( 'images/policies_mc.png', true, - ['title' => __('Policies')] + [ + 'title' => __('Policies'), + 'class' => 'invert_filter', + ] ).'', 'active' => ($tab == 'policies'), ]; @@ -164,7 +182,7 @@ $agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init'); $row = []; $row[] = __('Search group'); -$row[] = html_print_input_text('search_group', $search_group, '', is_metaconsole() ? 50 : 40, 30, true); +$row[] = html_print_input_text('search_group', $search_group, '', is_metaconsole() ? 50 : 25, 30, true); if (is_metaconsole()) { $row[] = __('Show not init modules'); @@ -177,7 +195,7 @@ $table->data[] = $row; $row = []; $row[] = __('Search agent'); -$row[] = html_print_input_text('search_agent', $search_agent, '', is_metaconsole() ? 50 : 40, 30, true); +$row[] = html_print_input_text('search_agent', $search_agent, '', is_metaconsole() ? 50 : 25, 30, true); $row[] = __('Show not init agents'); $row[] = html_print_checkbox('show_not_init_agents', $show_not_init_agents, true, true); @@ -208,7 +226,7 @@ if (!is_metaconsole()) { $row = []; $row[] = __('Search module'); - $row[] = html_print_input_text('search_module', $search_module, '', 40, 30, true); + $row[] = html_print_input_text('search_module', $search_module, '', 25, 30, true); $row[] = __('Show not init modules'); $row[] = html_print_checkbox('show_not_init_modules', $show_not_init_modules, true, true); diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 4f93152b9a..269ef69203 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -423,10 +423,10 @@ if ($config['double_auth_enabled'] || ($config['double_auth_enabled'] == '' && $ } // Dialog. - $double_authentication .= ''; + $double_authentication .= ''; } -if ($double_auth_enabled && $config['double_auth_enabled'] && $config['2FA_all_users'] != '') { +if ($double_auth_enabled && $config['double_auth_enabled']) { $double_authentication .= html_print_button(__('Show information'), 'show_info', false, 'javascript:show_double_auth_info();', '', true); } @@ -666,7 +666,7 @@ if (is_metaconsole()) { if (!is_metaconsole()) { echo ' - + '.$area_data_timezone_polys.$area_data_timezone_rects.' '; } @@ -719,10 +719,10 @@ if ($config['ehorus_enabled'] && $config['ehorus_user_level_conf']) { $row = []; $row['name'] = __('Test'); $row['control'] = html_print_button(__('Start'), 'test-ehorus', false, 'ehorus_connection_test("'.$ehorus_host.'",'.$ehorus_port.')', 'class="sub next"', true); - $row['control'] .= ' '.html_print_image('images/spinner.gif', true).''; - $row['control'] .= ' '.html_print_image('images/status_sets/default/severity_normal.png', true).''; - $row['control'] .= ' '.html_print_image('images/status_sets/default/severity_critical.png', true).''; - $row['control'] .= ''; + $row['control'] .= ' '.html_print_image('images/spinner.gif', true).''; + $row['control'] .= ' '.html_print_image('images/status_sets/default/severity_normal.png', true).''; + $row['control'] .= ' '.html_print_image('images/status_sets/default/severity_critical.png', true).''; + $row['control'] .= ''; $table_remote->data['ehorus_test'] = $row; echo ''; @@ -981,6 +981,7 @@ function show_double_auth_info () { data: { page: 'include/ajax/double_auth.ajax', id_user: userID, + id_user_auth: userID, get_double_auth_data_page: 1, containerID: $dialogContainer.prop('id') }, diff --git a/pandora_console/operation/users/user_edit_header.php b/pandora_console/operation/users/user_edit_header.php index 3e18315842..8f1d3e9a02 100644 --- a/pandora_console/operation/users/user_edit_header.php +++ b/pandora_console/operation/users/user_edit_header.php @@ -85,9 +85,12 @@ if (is_metaconsole()) { 'main' => [ 'active' => $_GET['sec2'] === 'operation/users/user_edit', 'text' => "".html_print_image( - 'images/user_green.png', + 'images/user.png', true, - ['title' => __('User management')] + [ + 'title' => __('User management'), + 'class' => 'invert_filter', + ] ).'', ], 'notifications' => [ @@ -95,7 +98,10 @@ if (is_metaconsole()) { 'text' => "".html_print_image( 'images/alerts_template.png', true, - ['title' => __('User notifications')] + [ + 'title' => __('User notifications'), + 'class' => 'invert_filter', + ] ).'', ], ]; @@ -109,7 +115,7 @@ if (is_metaconsole()) { ui_print_page_header( __('User detail editor'), - 'images/op_workspace.png', + 'images/user.png', false, $helpers, false, diff --git a/pandora_console/operation/users/user_edit_notifications.php b/pandora_console/operation/users/user_edit_notifications.php index 611530a3b4..c7cd4bb1b5 100644 --- a/pandora_console/operation/users/user_edit_notifications.php +++ b/pandora_console/operation/users/user_edit_notifications.php @@ -89,8 +89,9 @@ foreach ($sources as $source) { echo ''; } -if ($disabled_flag) { - echo 'Disabled controls have been set by the system administrator'; +if ((bool) $disabled_flag === true) { + $s = __('Controls have been disabled by the system administrator'); + echo ''.$s.''; } echo ''; diff --git a/pandora_console/operation/visual_console/legacy_public_view.php b/pandora_console/operation/visual_console/legacy_public_view.php index 0a3aa56328..eae9f1767f 100644 --- a/pandora_console/operation/visual_console/legacy_public_view.php +++ b/pandora_console/operation/visual_console/legacy_public_view.php @@ -111,7 +111,7 @@ if ($layout) { } // Floating menu - Start. -echo ''; +echo ''; echo ''; echo ''; @@ -126,7 +126,7 @@ echo ''; // Countdown. echo ''; echo ''; -echo ''; +echo ''; echo ''; echo __('Refresh').':'; echo html_print_select( @@ -155,7 +155,7 @@ echo ''; echo ''; // QR code dialog. -echo ''; +echo ''; echo ''; echo ''; diff --git a/pandora_console/operation/visual_console/legacy_view.php b/pandora_console/operation/visual_console/legacy_view.php index 879024ad0f..37a7c4f18d 100644 --- a/pandora_console/operation/visual_console/legacy_view.php +++ b/pandora_console/operation/visual_console/legacy_view.php @@ -97,9 +97,9 @@ $bheight = $layout['height']; $pure_url = '&pure='.$config['pure']; // ACL -$vconsole_read = check_acl($config['id_user'], $id_group, 'VR'); -$vconsole_write = check_acl($config['id_user'], $id_group, 'VW'); -$vconsole_manage = check_acl($config['id_user'], $id_group, 'VM'); +$vconsole_read = check_acl_restricted_all($config['id_user'], $id_group, 'VR'); +$vconsole_write = check_acl_restricted_all($config['id_user'], $id_group, 'VW'); +$vconsole_manage = check_acl_restricted_all($config['id_user'], $id_group, 'VM'); if (! $vconsole_read && !$vconsole_write && !$vconsole_manage) { db_pandora_audit( @@ -129,47 +129,79 @@ if ($vconsole_write || $vconsole_manage) { ).'" target="_blank">'.html_print_image( 'images/camera_mc.png', true, - ['title' => __('Show link to public Visual Console')] + [ + 'title' => __('Show link to public Visual Console'), + 'class' => 'invert_filter', + ] ).''; $options['public_link']['active'] = false; $options['data']['text'] = ''.html_print_image( 'images/op_reporting.png', true, - ['title' => __('Main data')] + [ + 'title' => __('Main data'), + 'class' => 'invert_filter', + ] ).''; $options['list_elements']['text'] = ''.html_print_image( 'images/list.png', true, - ['title' => __('List elements')] + [ + 'title' => __('List elements'), + 'class' => 'invert_filter', + ] ).''; if (enterprise_installed()) { $options['wizard_services']['text'] = ''.html_print_image( 'images/wand_services.png', true, - ['title' => __('Services wizard')] + [ + 'title' => __('Services wizard'), + 'class' => 'invert_filter', + ] ).''; } $options['wizard']['text'] = ''.html_print_image( 'images/wand.png', true, - ['title' => __('Wizard')] + [ + 'title' => __('Wizard'), + 'class' => 'invert_filter', + ] ).''; $options['editor']['text'] = ''.html_print_image( 'images/builder.png', true, - ['title' => __('Builder')] + [ + 'title' => __('Builder'), + 'class' => 'invert_filter', + ] ).''; } -$options['view']['text'] = ''.html_print_image('images/operation.png', true, ['title' => __('View')]).''; +$options['view']['text'] = ''.html_print_image( + 'images/operation.png', + true, + [ + 'title' => __('View'), + 'class' => 'invert_filter', + ] +).''; $options['view']['active'] = true; if (!is_metaconsole()) { if (!$config['pure']) { - $options['pure']['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).''; + $options['pure']['text'] = ''.html_print_image( + 'images/full_screen.png', + true, + [ + 'title' => __('Full screen mode'), + 'class' => 'invert_filter', + ] + ).''; ui_print_page_header( $layout_name, 'images/visual_console.png', @@ -201,7 +233,7 @@ if ($config['pure']) { ).''; // Floating menu - Start. - echo ''; + echo ''; echo ''; echo ''; @@ -214,7 +246,7 @@ if ($config['pure']) { echo ''; } - echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]); + echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode'), 'class' => 'invert_filter']); echo ''; echo ''; diff --git a/pandora_console/operation/visual_console/public_view.php b/pandora_console/operation/visual_console/public_view.php index a21085b4ca..b1d3cbdf0b 100644 --- a/pandora_console/operation/visual_console/public_view.php +++ b/pandora_console/operation/visual_console/public_view.php @@ -93,7 +93,7 @@ $visualConsoleName = $visualConsoleData['name']; echo ''; // Floating menu - Start. -echo ''; +echo ''; echo ''; echo ''; @@ -136,7 +136,7 @@ echo ''; echo ''; // QR code dialog. -echo ''; +echo ''; echo ''; echo ''; @@ -178,6 +178,22 @@ $visualConsoleItems = VisualConsole::getItemsFromDB( var handleUpdate = function (prevProps, newProps) { if (!newProps) return; + //Remove spinner change VC. + document + .getElementById("visual-console-container") + .classList.remove("is-updating"); + + var div = document + .getElementById("visual-console-container") + .querySelector(".div-visual-console-spinner"); + + if (div !== null) { + var parent = div.parentElement; + if (parent !== null) { + parent.removeChild(div); + } + } + // Change the background color when the fullscreen mode is enabled. if (prevProps && prevProps.backgroundColor != newProps.backgroundColor @@ -201,17 +217,24 @@ $visualConsoleItems = VisualConsole::getItemsFromDB( var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi; var replacement = '$1' + newProps.id + '$2'; + var regex_hash = /(hash=)[^&]+(&?)/gi; + var replacement_hash = '$1' + newProps.hash + '$2'; // Tab links. var menuLinks = document.querySelectorAll("div#menu_tab a"); if (menuLinks !== null) { menuLinks.forEach(function (menuLink) { menuLink.href = menuLink.href.replace(regex, replacement); + menuLink.href = menuLink.href.replace( + regex_hash, + replacement_hash + ); }); } // Change the URL (if the browser has support). if ("history" in window) { var href = window.location.href.replace(regex, replacement); + href = href.replace(regex_hash, replacement_hash); window.history.replaceState({}, document.title, href); } } diff --git a/pandora_console/operation/visual_console/pure_ajax.php b/pandora_console/operation/visual_console/pure_ajax.php index 7eceebb80b..b9279cd2b5 100644 --- a/pandora_console/operation/visual_console/pure_ajax.php +++ b/pandora_console/operation/visual_console/pure_ajax.php @@ -126,47 +126,79 @@ if ($vconsole_write || $vconsole_manage) { $options['public_link']['text'] = ''.html_print_image( 'images/camera_mc.png', true, - ['title' => __('Show link to public Visual Console')] + [ + 'title' => __('Show link to public Visual Console'), + 'class' => 'invert_filter', + ] ).''; $options['public_link']['active'] = false; $options['data']['text'] = ''.html_print_image( 'images/op_reporting.png', true, - ['title' => __('Main data')] + [ + 'title' => __('Main data'), + 'class' => 'invert_filter', + ] ).''; $options['list_elements']['text'] = ''.html_print_image( 'images/list.png', true, - ['title' => __('List elements')] + [ + 'title' => __('List elements'), + 'class' => 'invert_filter', + ] ).''; if (enterprise_installed()) { $options['wizard_services']['text'] = ''.html_print_image( 'images/wand_services.png', true, - ['title' => __('Services wizard')] + [ + 'title' => __('Services wizard'), + 'class' => 'invert_filter', + ] ).''; } $options['wizard']['text'] = ''.html_print_image( 'images/wand.png', true, - ['title' => __('Wizard')] + [ + 'title' => __('Wizard'), + 'class' => 'invert_filter', + ] ).''; $options['editor']['text'] = ''.html_print_image( 'images/builder.png', true, - ['title' => __('Builder')] + [ + 'title' => __('Builder'), + 'class' => 'invert_filter', + ] ).''; } -$options['view']['text'] = ''.html_print_image('images/operation.png', true, ['title' => __('View')]).''; +$options['view']['text'] = ''.html_print_image( + 'images/operation.png', + true, + [ + 'title' => __('View'), + 'class' => 'invert_filter', + ] +).''; $options['view']['active'] = true; if (!is_metaconsole()) { if (!$config['pure']) { - $options['pure']['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).''; + $options['pure']['text'] = ''.html_print_image( + 'images/full_screen.png', + true, + [ + 'title' => __('Full screen mode'), + 'class' => 'invert_filter', + ] + ).''; ui_print_page_header($layout_name, 'images/visual_console.png', false, '', false, $options); } diff --git a/pandora_console/operation/visual_console/view.php b/pandora_console/operation/visual_console/view.php index fc8ed30e2c..1360d5fd60 100644 --- a/pandora_console/operation/visual_console/view.php +++ b/pandora_console/operation/visual_console/view.php @@ -53,13 +53,14 @@ function visual_map_print_button_editor_refactor( $class='', $disabled=false ) { + global $config; + html_print_button( $label, $idDiv, $disabled, '', - // "click_button_toolbox('".$idDiv."');", - 'class="sub visual_editor_button_toolbox '.$idDiv.' '.$class.'"', + 'class=" sub visual_editor_button_toolbox '.$idDiv.' '.$class.'"', false, true ); @@ -95,9 +96,9 @@ $groupId = $visualConsoleData['groupId']; $visualConsoleName = $visualConsoleData['name']; // ACL. -$aclRead = check_acl($config['id_user'], $groupId, 'VR'); -$aclWrite = check_acl($config['id_user'], $groupId, 'VW'); -$aclManage = check_acl($config['id_user'], $groupId, 'VM'); +$aclRead = check_acl_restricted_all($config['id_user'], $groupId, 'VR'); +$aclWrite = check_acl_restricted_all($config['id_user'], $groupId, 'VW'); +$aclManage = check_acl_restricted_all($config['id_user'], $groupId, 'VM'); if (!$aclRead && !$aclWrite && !$aclManage) { db_pandora_audit( @@ -114,7 +115,10 @@ $options = []; $options['consoles_list']['text'] = ''.html_print_image( 'images/visual_console.png', true, - ['title' => __('Visual consoles list')] + [ + 'title' => __('Visual consoles list'), + 'class' => 'invert_filter', + ] ).''; if ($aclWrite || $aclManage) { @@ -139,40 +143,58 @@ if ($aclWrite || $aclManage) { ).'" target="_blank">'.html_print_image( 'images/camera_mc.png', true, - ['title' => __('Show link to public Visual Console')] + [ + 'title' => __('Show link to public Visual Console'), + 'class' => 'invert_filter', + ] ).''; $options['public_link']['active'] = false; $options['data']['text'] = ''.html_print_image( 'images/op_reporting.png', true, - ['title' => __('Main data')] + [ + 'title' => __('Main data'), + 'class' => 'invert_filter', + ] ).''; $options['list_elements']['text'] = ''.html_print_image( 'images/list.png', true, - ['title' => __('List elements')] + [ + 'title' => __('List elements'), + 'class' => 'invert_filter', + ] ).''; if (enterprise_installed()) { $options['wizard_services']['text'] = ''.html_print_image( 'images/wand_services.png', true, - ['title' => __('Services wizard')] + [ + 'title' => __('Services wizard'), + 'class' => 'invert_filter', + ] ).''; } $options['wizard']['text'] = ''.html_print_image( 'images/wand.png', true, - ['title' => __('Wizard')] + [ + 'title' => __('Wizard'), + 'class' => 'invert_filter', + ] ).''; } $options['view']['text'] = ''.html_print_image( 'images/operation.png', true, - ['title' => __('View')] + [ + 'title' => __('View'), + 'class' => 'invert_filter', + ] ).''; $options['view']['active'] = true; @@ -181,7 +203,10 @@ if (!is_metaconsole()) { $options['pure']['text'] = ''.html_print_image( 'images/full_screen.png', true, - ['title' => __('Full screen mode')] + [ + 'title' => __('Full screen mode'), + 'class' => 'invert_filter', + ] ).''; ui_print_page_header( $visualConsoleName, @@ -280,6 +305,11 @@ if ($pure === false) { __('Color cloud'), 'color_cloud_min link-create-item' ); + visual_map_print_button_editor_refactor( + 'NETWORK_LINK', + __('Network link'), + 'network_link_min link-create-item' + ); enterprise_include_once('include/functions_visual_map_editor.php'); enterprise_hook( 'enterprise_visual_map_editor_print_toolbox_refactor' @@ -300,7 +330,11 @@ if ($pure === false) { ); echo ''; echo ''; - echo html_print_checkbox_switch('edit-mode', 1, false, true); + + if ($aclWrite || $aclManage) { + echo html_print_checkbox_switch('edit-mode', 1, false, true); + } + echo ''; } } @@ -309,7 +343,7 @@ echo ''; if ($pure === true) { // Floating menu - Start. - echo ''; + echo ''; echo ''; echo ''; @@ -323,7 +357,7 @@ if ($pure === true) { } echo ''; - echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]); + echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode'), 'class' => 'invert_filter']); echo ''; echo ''; @@ -470,11 +504,17 @@ ui_require_css_file('form'); var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi; var replacement = '$1' + newProps.id + '$2'; + var regex_hash = /(hash=)[^&]+(&?)/gi; + var replacement_hash = '$1' + newProps.hash + '$2'; // Tab links. var menuLinks = document.querySelectorAll("div#menu_tab a"); if (menuLinks !== null) { menuLinks.forEach(function (menuLink) { menuLink.href = menuLink.href.replace(regex, replacement); + menuLink.href = menuLink.href.replace( + regex_hash, + replacement_hash + ); }); } @@ -487,6 +527,7 @@ ui_require_css_file('form'); // Change the URL (if the browser has support). if ("history" in window) { var href = window.location.href.replace(regex, replacement); + href = href.replace(regex_hash, replacement_hash); window.history.replaceState({}, document.title, href); } } diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 2dbf78095c..425b1b5bf5 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -2,8 +2,8 @@ # Pandora FMS Console # %define name pandorafms_console -%define version 7.0NG.751 -%define release 210108 +%define version 7.0NG.752 +%define release 210311 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index 1eadbccaec..3b942ae95c 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -2,8 +2,8 @@ # Pandora FMS Console # %define name pandorafms_console -%define version 7.0NG.751 -%define release 210108 +%define version 7.0NG.752 +%define release 210311 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 941ece0d05..a767f3821f 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -2,8 +2,8 @@ # Pandora FMS Console # %define name pandorafms_console -%define version 7.0NG.751 -%define release 210108 +%define version 7.0NG.752 +%define release 210311 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_console/pandora_console_install b/pandora_console/pandora_console_install index 907ffb551f..374b0b4c74 100644 --- a/pandora_console/pandora_console_install +++ b/pandora_console/pandora_console_install @@ -9,7 +9,7 @@ # This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.751" +PI_VERSION="7.0NG.752" FORCE=0 DESTDIR="" LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 771b2e99fc..a4c3174889 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1317,6 +1317,7 @@ CREATE TABLE `tnotification_source` ( `enabled` int(1) DEFAULT NULL, `user_editable` int(1) DEFAULT NULL, `also_mail` int(1) DEFAULT NULL, + `subtype_blacklist` TEXT, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1559,6 +1560,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `failover_mode` tinyint(1) DEFAULT '1', `failover_type` tinyint(1) DEFAULT '1', `uncompressed_module` TINYINT DEFAULT '0', + `summary` tinyint(1) DEFAULT 0, `landscape` tinyint(1) UNSIGNED NOT NULL default 0, `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0, `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0, @@ -2070,7 +2072,7 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_data` ( -- ---------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `ttag` ( `id_tag` integer(10) unsigned NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', + `name` text NOT NULL default '', `description` text NOT NULL, `url` mediumtext NOT NULL, `email` text NULL, @@ -2652,6 +2654,7 @@ CREATE TABLE IF NOT EXISTS `tinventory_alert`( `last_fired` text NOT NULL default '', `disable_event` tinyint(1) UNSIGNED default 0, `enabled` tinyint(1) UNSIGNED default 1, + `alert_groups` text NOT NULL default '', PRIMARY KEY (`id`), FOREIGN KEY (`id_module_inventory`) REFERENCES tmodule_inventory(`id_module_inventory`) ON DELETE CASCADE ON UPDATE CASCADE @@ -3161,6 +3164,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `current_month` TINYINT(1) DEFAULT '1', `failover_mode` tinyint(1) DEFAULT '1', `failover_type` tinyint(1) DEFAULT '1', + `summary` tinyint(1) DEFAULT 0, `uncompressed_module` TINYINT DEFAULT '0', `landscape` tinyint(1) UNSIGNED NOT NULL default 0, `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0, @@ -3877,3 +3881,101 @@ CREATE TABLE `tnode_relations` ( `node_address` VARCHAR(60) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------------------------------------------------- +-- Table `tipam_network` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tipam_network` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `network` varchar(100) NOT NULL default '', + `name_network` varchar(255) default '', + `description` text NOT NULL, + `location` tinytext NOT NULL, + `id_recon_task` int(10) unsigned NOT NULL, + `scan_interval` tinyint(2) default 1, + `monitoring` tinyint(2) default 0, + `id_group` mediumint(8) unsigned NULL default 0, + `lightweight_mode` tinyint(2) default 0, + `users_operator` text, + PRIMARY KEY (`id`), + FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------------------------------------------------- +-- Table `tipam_ip` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tipam_ip` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `id_network` bigint(20) unsigned NOT NULL default 0, + `id_agent` int(10) unsigned NOT NULL, + `forced_agent` tinyint(2) NOT NULL default '0', + `ip` varchar(100) NOT NULL default '', + `ip_dec` int(10) unsigned NOT NULL, + `id_os` int(10) unsigned NOT NULL, + `forced_os` tinyint(2) NOT NULL default '0', + `hostname` tinytext NOT NULL, + `forced_hostname` tinyint(2) NOT NULL default '0', + `comments` text NOT NULL, + `alive` tinyint(2) NOT NULL default '0', + `managed` tinyint(2) NOT NULL default '0', + `reserved` tinyint(2) NOT NULL default '0', + `time_last_check` datetime NOT NULL default '1970-01-01 00:00:00', + `time_create` datetime NOT NULL default '1970-01-01 00:00:00', + `users_operator` text, + `time_last_edit` datetime NOT NULL default '1970-01-01 00:00:00', + `enabled` tinyint(2) NOT NULL default '1', + `generate_events` tinyint(2) NOT NULL default '0', + `leased` tinyint(2) DEFAULT '0', + `leased_expiration` bigint(20) DEFAULT '0', + `mac_address` varchar(20) DEFAULT NULL, + `leased_mode` tinyint(2) DEFAULT '0', + PRIMARY KEY (`id`), + FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------------------------------------------------- +-- Table `tipam_vlan` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tipam_vlan` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `name` varchar(250) NOT NULL, + `description` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------------------------------------------------- +-- Table `tipam_vlan_network` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tipam_vlan_network` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `id_vlan` bigint(20) unsigned NOT NULL, + `id_network` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id`), + FOREIGN KEY (`id_vlan`) REFERENCES tipam_vlan(`id`) ON UPDATE CASCADE ON DELETE CASCADE, + FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------------------------------------------------- +-- Table `tipam_supernet` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tipam_supernet` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `name` varchar(250) NOT NULL, + `description` text default '', + `address` varchar(250) NOT NULL, + `mask` varchar(250) NOT NULL, + `subneting_mask` varchar(250) default '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------------------------------------------------- +-- Table `tipam_supernet_network` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tipam_supernet_network` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `id_supernet` bigint(20) unsigned NOT NULL, + `id_network` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id`), + FOREIGN KEY (`id_supernet`) REFERENCES tipam_supernet(`id`) ON UPDATE CASCADE ON DELETE CASCADE, + FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 4113d8cf48..2ab4003336 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -14,7 +14,7 @@ INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (1,'eMail','Internal type','This alert send an email using internal Server SMTP capabilities (defined in each server, using: _field1_ as destination email address, and _field2_ as subject for message. _field3_ as text of message. _field4_ as content type (plain/text or html/text).',1,'[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]'); INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (2,'Internal Audit','Internal type','This alert save alert in internal audit system. Fields are static and only _field1_ is used.',1,'[\"Description\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]'); -INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (3,'Monitoring Event','Internal type','This alert create an special event into event manager.',1,'[\"Event text\",\"Event type\",\"Source\",\"Agent name or _agent_\",\"Event criticity\",\"ID extra\",\"Tags separated by commas\",\"Comments\",\"\",\"\"]','[\"\",\"alert_ceased,Alert ceased;alert_fired,Alert fired;alert_manual_validation,Alert manual validation;alert_recovered,Alert recovered;configuration_change,Configuration change ;error,Error;critical,Monitor Critical;normal,Monitor Normal;going_unknown,Monitor\",\"\",\"\",\"4,Critical;1,Informational;0,Maintenance;6,Major;5,Minor;2,Normal;3,Warning\",\"\",\"\",\"\",\"\",\"\"]'); +INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (3,'Monitoring Event','Internal type','This alert create an special event into event manager.',1,'[\"Event text\",\"Event type\",\"Source\",\"Agent name or _agent_\",\"Event severity\",\"ID extra\",\"Tags separated by commas\",\"Comments\",\"\",\"\"]','[\"\",\"alert_ceased,Alert ceased;alert_fired,Alert fired;alert_manual_validation,Alert manual validation;alert_recovered,Alert recovered;configuration_change,Configuration change ;error,Error;critical,Monitor Critical;normal,Monitor Normal;going_unknown,Monitor\",\"\",\"\",\"4,Critical;1,Informational;0,Maintenance;6,Major;5,Minor;2,Normal;3,Warning\",\"\",\"\",\"\",\"\",\"\"]'); INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (4,'Alertlog','echo _timestamp_ pandora _agent_ _data_ _field1_ _field2_ >> /var/log/pandora/pandora_alert.log','This is a default alert to write alerts in a standard ASCII plaintext log file in /var/log/pandora/pandora_alert.log ',0,'[\"Log Info 1\",\"Log Info 2\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]'); INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (5,'SNMP Trap','/usr/bin/snmptrap -v 1 -c _field1_ _field2_ _field3_ _field4_','Send a SNMPTRAP to 192.168.0.4. Please review config and adapt to your needs, this is only a sample, not functional itself.',0,'[\"Community\",\"Destination address\",\"OID\",\"Source address\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]'); INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (6,'Syslog','logger -p daemon.alert Pandora Alert _agent_ _data_ _field1_ _field2_','Uses field1 and field2 to generate Syslog alert in facility daemon with "alert" level.',0,'[\"Log Info 1\",\"Log Info 2\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]'); @@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_header', ''), ('custom_report_front_footer', ''), -('MR', 43), +('MR', 44), ('identification_reminder', 1), ('identification_reminder_timestamp', 0), -('current_package_enterprise', 751), +('current_package_enterprise', 752), ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'), ('custom_docs_logo', 'default_docs.png'), ('custom_support_logo', 'default_support.png'), @@ -1168,8 +1168,11 @@ INSERT INTO `treport_custom_sql` (`id`, `name`, `sql`) VALUES (4, 'Group vi -- trecon scripts INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (1, 'Discovery.Application.VMware', 'Discovery Application script to monitor VMware technologies (ESXi, VCenter, VSphere)', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}'); INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (2, 'Discovery.Cloud', 'Discovery Cloud script to monitor Cloud technologies (AWS.EC2, AWS.S3, AWS.RDS, RDS,ȊWS.EKS)', '/usr/share/pandora_server/util/recon_scripts/pcm_client.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}'); + -- IPAM is 3. -INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (4, 'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <create_incident_flag> <custom_field1> <custom_field2> <custom_field3> <custom_field4> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_field3 = Password * custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5. These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}'); +INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (4, 'IPMI Recon','Specific Pandora FMS Intel DCM Discovery (c) Artica ST 2011 <info@artica.es> Usage: ./ipmi-recon.pl <task_id> <group_id> <custom_field1> <custom_field2> <custom_field3> <custom_field4> * custom_field1 = Network i.e.: 192.168.100.0/24 * custom_field2 = Username * custom_field3 = Password * custom_field4 = Additional parameters i.e.: -D LAN_2_0','/usr/share/pandora_server/util/recon_scripts/ipmi-recon.pl','{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Network\",\"help\":\"i.e.: 192.168.100.0/24\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Additional parameters\",\"help\":\"Optional additional parameters such as -D LAN_2_0 to use IPMI ver 2.0 instead of 1.5. These options will also be passed to the IPMI plugin when the current values are read.\",\"value\":\"\",\"hide\":\"\"}}'); + +INSERT INTO `trecon_script` (`type`,`name`,`description`,`script`,`macros`) VALUES (3, 'IPAM Recon', 'This script is used to automatically detect network hosts availability and name, used as Recon Custom Script in the recon task. Parameters used are:\n\n* custom_field1 = network. i.e.: 192.168.100.0/24\n* custom_field2 = associated IPAM network id. i.e.: 4. Please do not change this value, it is assigned automatically in IPAM management.\n\nSee documentation for more information.', '/usr/share/pandora_server/util/recon_scripts/IPAMrecon.pl', '{"1":{"macro":"_field1_","desc":"Network","help":"i.e.: 192.168.100.0/24","value":"","hide":""}}'); INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `plugin_type`, `macros`, `parameters`) VALUES (1,'IPMI Plugin','Plugin to get IPMI monitors from a IPMI Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Target IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Username\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"true\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Sensor\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Additional Options\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','-h _field1_ -u _field2_ -p _field3_ -s _field4_ -- _field5_'); diff --git a/pandora_console/vendor/mpdf/mpdf/src/OtlDump.php b/pandora_console/vendor/mpdf/mpdf/src/OtlDump.php index 024c54d7db..edefcb69cb 100644 --- a/pandora_console/vendor/mpdf/mpdf/src/OtlDump.php +++ b/pandora_console/vendor/mpdf/mpdf/src/OtlDump.php @@ -1986,7 +1986,7 @@ $MarkAttachmentType = ' . var_export($this->MarkAttachmentType, true) . '; if ($level == 1) { $html .= ''; } - $html .= 'Lookup #' . $i . ' [tag: ' . $tag . ']'; + $html .= 'Lookup #' . $i . ' [tag: ' . $tag . ']'; $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']); if ($ignore) { $html .= 'Ignoring: ' . $ignore . ' '; @@ -3231,7 +3231,7 @@ $MarkAttachmentType = ' . var_export($this->MarkAttachmentType, true) . '; if ($level == 1) { $html .= ''; } - $html .= 'Lookup #' . $luli . ' [tag: ' . $tag . ']'; + $html .= 'Lookup #' . $luli . ' [tag: ' . $tag . ']'; $ignore = $this->_getGSUBignoreString($Lookup[$luli]['Flag'], $Lookup[$luli]['MarkFilteringSet']); if ($ignore) { $html .= 'Ignoring: ' . $ignore . ' '; diff --git a/pandora_console/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php b/pandora_console/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php index 1cfc3f974f..9911472c6b 100644 --- a/pandora_console/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php +++ b/pandora_console/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php @@ -24,12 +24,12 @@ class Swift_Plugins_Reporters_HtmlReporter implements Swift_Plugins_Reporter public function notify(Swift_Mime_SimpleMessage $message, $address, $result) { if (self::RESULT_PASS == $result) { - echo ''.PHP_EOL; + echo ''.PHP_EOL; echo 'PASS '.$address.PHP_EOL; echo ''.PHP_EOL; flush(); } else { - echo ''.PHP_EOL; + echo ''.PHP_EOL; echo 'FAIL '.$address.PHP_EOL; echo ''.PHP_EOL; flush(); diff --git a/pandora_console/views/dashboard/formDashboard.php b/pandora_console/views/dashboard/formDashboard.php index 9fbaf555f3..05164f7b00 100644 --- a/pandora_console/views/dashboard/formDashboard.php +++ b/pandora_console/views/dashboard/formDashboard.php @@ -43,6 +43,12 @@ if (empty($arrayDashboard) === true) { } } +$return_all_group = false; + +if (users_can_manage_group_all('RW') === true) { + $return_all_group = true; +} + $dataQuery = ['dashboardId' => $dashboardId]; $url = ui_get_full_url( @@ -100,12 +106,13 @@ $inputs = [ [ 'label' => __('Group'), 'arguments' => [ - 'name' => 'id_group', - 'id' => 'id_group', - 'type' => 'select_groups', - 'selected' => $arrayDashboard['id_group'], - 'return' => true, - 'required' => true, + 'name' => 'id_group', + 'id' => 'id_group', + 'type' => 'select_groups', + 'returnAllGroup' => $return_all_group, + 'selected' => $arrayDashboard['id_group'], + 'return' => true, + 'required' => true, ], ], ], diff --git a/pandora_console/views/dashboard/header.php b/pandora_console/views/dashboard/header.php index ea43f54ee7..13b625a4d0 100644 --- a/pandora_console/views/dashboard/header.php +++ b/pandora_console/views/dashboard/header.php @@ -27,6 +27,10 @@ */ // Button for display full screen mode. +global $config; + + + $queryFull = [ 'dashboardId' => $dashboardId, 'refr' => $refr, @@ -37,7 +41,10 @@ $fullscreen['text'] = ''; $fullscreen['text'] .= html_print_image( 'images/full_screen.png', true, - ['title' => __('Full screen mode')] + [ + 'title' => __('Full screen mode'), + 'class' => 'invert_filter', + ] ); $fullscreen['text'] .= ''; @@ -48,7 +55,10 @@ $normalscreen['text'] = ''; $normalscreen['text'] .= html_print_image( 'images/normal_screen.png', true, - ['title' => __('Back to normal mode')] + [ + 'title' => __('Back to normal mode'), + 'class' => 'invert_filter', + ] ); $normalscreen['text'] .= ''; @@ -68,7 +78,10 @@ $options['text'] .= ')\'>'; $options['text'] .= html_print_image( 'images/setup.png', true, - ['title' => __('Options')] + [ + 'title' => __('Options'), + 'class' => 'invert_filter', + ] ); $options['text'] .= ''; @@ -77,7 +90,10 @@ $back_to_dashboard_list['text'] = ''; $back_to_dashboard_list['text'] .= html_print_image( 'images/list.png', true, - ['title' => __('Back to dashboards list')] + [ + 'title' => __('Back to dashboards list'), + 'class' => 'invert_filter', + ] ); $back_to_dashboard_list['text'] .= ''; @@ -97,7 +113,10 @@ $slides['text'] .= ')\'>'; $slides['text'] .= html_print_image( 'images/images.png', true, - ['title' => __('Slides mode')] + [ + 'title' => __('Slides mode'), + 'class' => 'invert_filter', + ] ); $slides['text'] .= ''; @@ -115,7 +134,10 @@ $publiclink['text'] = ' __('Show link to public dashboard')] + [ + 'title' => __('Show link to public dashboard'), + 'class' => 'invert_filter', + ] ); $publiclink['text'] .= ''; @@ -130,8 +152,8 @@ if ($config['public_dashboard'] === true) { $urlRefresh = $url.'&'.http_build_query($queryRefresh); } -$comboRefreshCountdown['text'] = ''; -$comboRefresh['text'] = ''; +$comboRefreshCountdown['text'] = ''; +$comboRefresh['text'] = ''; $comboRefresh['text'] .= __('Refresh').':'; $comboRefresh['text'] .= html_print_select( \get_refresh_time_array(), @@ -180,11 +202,14 @@ $enable_disable['text'] = html_print_checkbox_switch( ); // New Widget. -$newWidget['text'] = ''; +$newWidget['text'] = ''; $newWidget['text'] .= html_print_image( 'images/add.png', true, - ['title' => __('Add Cell')] + [ + 'title' => __('Add Cell'), + 'class' => 'invert_filter', + ] ); $newWidget['text'] .= ''; @@ -194,7 +219,7 @@ if ($config['public_dashboard'] === true) { 'combo_refresh_countdown' => $comboRefreshCountdown, ]; } else if ($config['pure']) { - if (check_acl($config['id_user'], 0, 'RW') === 0) { + if (check_acl_restricted_all($config['id_user'], $dashboardGroup, 'RW') === 0) { $buttons = [ 'back_to_dashboard_list' => $back_to_dashboard_list, 'normalscreen' => $normalscreen, @@ -221,7 +246,7 @@ if ($config['public_dashboard'] === true) { } } } else { - if (check_acl($config['id_user'], 0, 'RW') === 0) { + if (check_acl_restricted_all($config['id_user'], $dashboardGroup, 'RW') === 0) { $buttons = [ 'back_to_dashboard_list' => $back_to_dashboard_list, 'fullscreen' => $fullscreen, diff --git a/pandora_console/views/dashboard/layout.php b/pandora_console/views/dashboard/layout.php index 57dd228898..de0273c684 100644 --- a/pandora_console/views/dashboard/layout.php +++ b/pandora_console/views/dashboard/layout.php @@ -43,10 +43,10 @@ $output = ''; // Div for modal update dashboard. -$output .= ''; -$output .= ''; -$output .= ''; -$output .= ''; +$output .= ''; +$output .= ''; +$output .= ''; +$output .= ''; // Layout. $output .= ''; diff --git a/pandora_console/views/dashboard/list.php b/pandora_console/views/dashboard/list.php index 0362a97854..44fd9a6570 100644 --- a/pandora_console/views/dashboard/list.php +++ b/pandora_console/views/dashboard/list.php @@ -150,18 +150,24 @@ if (empty($dashboards) === true) { $data['full_screen'] = ''; $data['full_screen'] .= \html_print_image( 'images/fullscreen.png', - true + true, + ['class' => 'invert_filter'] ); $data['full_screen'] .= ''; if ($manageDashboards === 1) { + $data['copy'] = ''; + $data['delete'] = ''; + } + + if (check_acl_restricted_all($config['id_user'], $dashboard['id_group'], 'RM')) { $dataQueryCopy = [ 'dashboardId' => $dashboard['id'], 'copyDashboard' => 1, ]; $urlCopy = $urlDashboard.'&'.\http_build_query($dataQueryCopy); $data['copy'] = ''; - $data['copy'] .= html_print_image('images/copy.png', true); + $data['copy'] .= html_print_image('images/copy.png', true, ['class' => 'invert_filter']); $data['copy'] .= ''; $dataQueryDelete = [ @@ -174,7 +180,8 @@ if (empty($dashboards) === true) { $data['delete'] .= '" onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'; $data['delete'] .= \html_print_image( 'images/cross.png', - true + true, + ['class' => 'invert_filter'] ); $data['delete'] .= ''; } @@ -208,7 +215,7 @@ if ($writeDashboards === 1) { } // Button for display modal options dashboard. - $output = ' $text, @@ -233,7 +240,7 @@ if ($writeDashboards === 1) { echo $output; // Div for modal update dashboard. - echo ''; + echo ''; ui_require_javascript_file('pandora_dashboards'); } diff --git a/pandora_console/views/dashboard/slides.php b/pandora_console/views/dashboard/slides.php index 0526f541b1..109760d20e 100644 --- a/pandora_console/views/dashboard/slides.php +++ b/pandora_console/views/dashboard/slides.php @@ -37,7 +37,10 @@ $output .= ''; $output .= html_print_image( 'images/normal_screen.png', true, - ['title' => __('Exit fullscreen')] + [ + 'title' => __('Exit fullscreen'), + 'class' => 'invert_filter', + ] ); $output .= ''; $output .= ''; diff --git a/pandora_plugins/intel_dcm/extensions/intel_dcm_setup.php b/pandora_plugins/intel_dcm/extensions/intel_dcm_setup.php index ac78e6fc30..d446365ace 100644 --- a/pandora_plugins/intel_dcm/extensions/intel_dcm_setup.php +++ b/pandora_plugins/intel_dcm/extensions/intel_dcm_setup.php @@ -44,10 +44,27 @@ function main_intel_dcm() { global $config; - ui_print_page_header(__('Intel DCM Setup'), 'images/setup.png', false, '', true, ''); + ui_print_page_header( + __('Intel DCM Setup'), + 'images/setup.png', + false, + '', + true, + '' + ); - if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { - db_pandora_audit('ACL Violation', 'Trying to access Setup Management'); + if (! check_acl( + $config['id_user'], + 0, + 'PM' + ) && ! is_user_admin( + $config['id_user'] + ) + ) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access Setup Management' + ); include 'general/noaccess.php'; return; diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 3cde5aea19..ec1a4d6834 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.751-210108 +Version: 7.0NG.752-210311 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 34c54df1a4..354acc4570 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/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.751-210108" +pandora_version="7.0NG.752-210311" package_cpan=0 package_pandora=1 diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 980aa82d76..1bb24a96dd 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -1,7 +1,7 @@ ############################################################################# # Pandora FMS Server Parameters # Pandora FMS, the Flexible Monitoring System. -# Version 7.0NG.751 +# Version 7.0NG.752 # Licensed under GPL license v2, # (c) 2003-2021 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -350,7 +350,7 @@ max_log_generation 1 max_queue_files 5000 -# Use the XML file last modification time as timestamp. +# If set to 0, the timestamp attribute in XML data files will be ignored and the system time will be used instead. # use_xml_timestamp 1 diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index 28d5d6cdbb..195fc9ed7b 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -277,7 +277,7 @@ autocreate_group 10 # If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback). # If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback). -autocreate_group_force 1 +autocreate_group_force 0 # Set to 1 if want to autocreate agents with Pandora FMS Data Server, # set to 0 to disable @@ -295,7 +295,7 @@ max_log_size 1048576 max_queue_files 250 -# Use the XML file last modification time as timestamp. +# If set to 0, the timestamp attribute in XML data files will be ignored and the system time will be used instead. # use_xml_timestamp 1 diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 98fa9f108a..3fdaa7baef 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -44,8 +44,8 @@ our @EXPORT = qw( ); # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG.751"; -my $pandora_build = "210108"; +my $pandora_version = "7.0NG.752"; +my $pandora_build = "210311"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index cffa235f04..24b89ce1f1 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1023,26 +1023,26 @@ sub pandora_execute_action ($$$$$$$$$;$) { $field20 = defined($action->{'field20'}) && $action->{'field20'} ne "" ? $action->{'field20'} : $alert->{'field20'}; } else { - $field1 = defined($action->{'field1'}) && $action->{'field1'} ne "" ? $action->{'field1'} : $alert->{'field1'}; - $field2 = defined($action->{'field2'}) && $action->{'field2'} ne "" ? $action->{'field2'} : $alert->{'field2'}; - $field3 = defined($action->{'field3'}) && $action->{'field3'} ne "" ? $action->{'field3'} : $alert->{'field3'}; - $field4 = defined($action->{'field4'}) && $action->{'field4'} ne "" ? $action->{'field4'} : $alert->{'field4'}; - $field5 = defined($action->{'field5'}) && $action->{'field5'} ne "" ? $action->{'field5'} : $alert->{'field5'}; - $field6 = defined($action->{'field6'}) && $action->{'field6'} ne "" ? $action->{'field6'} : $alert->{'field6'}; - $field7 = defined($action->{'field7'}) && $action->{'field7'} ne "" ? $action->{'field7'} : $alert->{'field7'}; - $field8 = defined($action->{'field8'}) && $action->{'field8'} ne "" ? $action->{'field8'} : $alert->{'field8'}; - $field9 = defined($action->{'field9'}) && $action->{'field9'} ne "" ? $action->{'field9'} : $alert->{'field9'}; - $field10 = defined($action->{'field10'}) && $action->{'field10'} ne "" ? $action->{'field10'} : $alert->{'field10'}; - $field11 = defined($action->{'field11'}) && $action->{'field11'} ne "" ? $action->{'field11'} : $alert->{'field11'}; - $field12 = defined($action->{'field12'}) && $action->{'field12'} ne "" ? $action->{'field12'} : $alert->{'field12'}; - $field13 = defined($action->{'field13'}) && $action->{'field13'} ne "" ? $action->{'field13'} : $alert->{'field13'}; - $field14 = defined($action->{'field14'}) && $action->{'field14'} ne "" ? $action->{'field14'} : $alert->{'field14'}; - $field15 = defined($action->{'field15'}) && $action->{'field15'} ne "" ? $action->{'field15'} : $alert->{'field15'}; - $field16 = defined($action->{'field16'}) && $action->{'field16'} ne "" ? $action->{'field16'} : $alert->{'field16'}; - $field17 = defined($action->{'field17'}) && $action->{'field17'} ne "" ? $action->{'field17'} : $alert->{'field17'}; - $field18 = defined($action->{'field18'}) && $action->{'field18'} ne "" ? $action->{'field18'} : $alert->{'field18'}; - $field19 = defined($action->{'field19'}) && $action->{'field19'} ne "" ? $action->{'field19'} : $alert->{'field19'}; - $field20 = defined($action->{'field20'}) && $action->{'field20'} ne "" ? $action->{'field20'} : $alert->{'field20'}; + $field1 = defined($alert->{'field1'}) && $alert->{'field1'} ne "" ? $alert->{'field1'} : $action->{'field1'}; + $field2 = defined($alert->{'field2'}) && $alert->{'field2'} ne "" ? $alert->{'field2'} : $action->{'field2'}; + $field3 = defined($alert->{'field3'}) && $alert->{'field3'} ne "" ? $alert->{'field3'} : $action->{'field3'}; + $field4 = defined($alert->{'field4'}) && $alert->{'field4'} ne "" ? $alert->{'field4'} : $action->{'field4'}; + $field5 = defined($alert->{'field5'}) && $alert->{'field5'} ne "" ? $alert->{'field5'} : $action->{'field5'}; + $field6 = defined($alert->{'field6'}) && $alert->{'field6'} ne "" ? $alert->{'field6'} : $action->{'field6'}; + $field7 = defined($alert->{'field7'}) && $alert->{'field7'} ne "" ? $alert->{'field7'} : $action->{'field7'}; + $field8 = defined($alert->{'field8'}) && $alert->{'field8'} ne "" ? $alert->{'field8'} : $action->{'field8'}; + $field9 = defined($alert->{'field9'}) && $alert->{'field9'} ne "" ? $alert->{'field9'} : $action->{'field9'}; + $field10 = defined($alert->{'field10'}) && $alert->{'field10'} ne "" ? $alert->{'field10'} : $action->{'field10'}; + $field11 = defined($alert->{'field11'}) && $alert->{'field11'} ne "" ? $alert->{'field11'} : $action->{'field11'}; + $field12 = defined($alert->{'field12'}) && $alert->{'field12'} ne "" ? $alert->{'field12'} : $action->{'field12'}; + $field13 = defined($alert->{'field13'}) && $alert->{'field13'} ne "" ? $alert->{'field13'} : $action->{'field13'}; + $field14 = defined($alert->{'field14'}) && $alert->{'field14'} ne "" ? $alert->{'field14'} : $action->{'field14'}; + $field15 = defined($alert->{'field15'}) && $alert->{'field15'} ne "" ? $alert->{'field15'} : $action->{'field15'}; + $field16 = defined($alert->{'field16'}) && $alert->{'field16'} ne "" ? $alert->{'field16'} : $action->{'field16'}; + $field17 = defined($alert->{'field17'}) && $alert->{'field17'} ne "" ? $alert->{'field17'} : $action->{'field17'}; + $field18 = defined($alert->{'field18'}) && $alert->{'field18'} ne "" ? $alert->{'field18'} : $action->{'field18'}; + $field19 = defined($alert->{'field19'}) && $alert->{'field19'} ne "" ? $alert->{'field19'} : $action->{'field19'}; + $field20 = defined($alert->{'field20'}) && $alert->{'field20'} ne "" ? $alert->{'field20'} : $action->{'field20'}; } # Recovery fields, thanks to Kato Atsushi @@ -4296,7 +4296,7 @@ sub on_demand_macro($$$$$$;$) { if ($field_value eq ''){ $field_value = 'Module ' . $field_number . " not found"; } - elsif ($unit_mod ne '') { + elsif (defined($unit_mod) && $unit_mod ne '') { $field_value .= $unit_mod; } diff --git a/pandora_server/lib/PandoraFMS/NetworkServer.pm b/pandora_server/lib/PandoraFMS/NetworkServer.pm index 9fa9bf5741..d7b6519109 100644 --- a/pandora_server/lib/PandoraFMS/NetworkServer.pm +++ b/pandora_server/lib/PandoraFMS/NetworkServer.pm @@ -496,9 +496,11 @@ sub exec_network_module ($$$$) { } elsif ($id_tipo_modulo == 7){ # ICMP (data for latency in ms) $module_data = pandora_ping_latency ($pa_config, $ip_target, $timeout, $retries); - + if (defined($module_data)) { - $module_result = 1; # Unsuccessful + $module_result = 0; # Successful + } else { + $module_result = 1; # Unsuccessful: Cannot reach target. } } diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index a5489635fa..1b889a33b0 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -33,8 +33,8 @@ use base 'Exporter'; our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG.751"; -my $pandora_build = "210108"; +my $pandora_version = "7.0NG.752"; +my $pandora_build = "210311"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); @@ -959,7 +959,7 @@ sub print_error { if (is_enabled($conf->{'as_server_plugin'})) { print STDERR $msg . "\n"; print $value . "\n"; - exit 1; + exit 0; } print_module($conf, { @@ -968,7 +968,7 @@ sub print_error { value => $value, desc => $msg, }); - exit 1; + exit 0; } ################################################################################ diff --git a/pandora_server/lib/PandoraFMS/Sendmail.pm b/pandora_server/lib/PandoraFMS/Sendmail.pm index 07bb80586d..79be51e44c 100644 --- a/pandora_server/lib/PandoraFMS/Sendmail.pm +++ b/pandora_server/lib/PandoraFMS/Sendmail.pm @@ -217,9 +217,19 @@ sub sendmail { print STDERR "> [...", length($$data), " bytes sent ...]\n"; } } - my @sockets = $Sel->can_write($mailcfg{'timeout'}); - return 0 if (!@sockets); - syswrite($sockets[0], $$data) || return 0; + my @sockets = $Sel->can_write($mailcfg{'timeout'}); + return 0 if (!@sockets); + eval { + local $SIG{__DIE__}; + # Split log data in chunks if case write is + my $data_sent = 0; + while ($data_sent < length($$data)) { + $data_sent += syswrite($sockets[0], $$data, length($$data) - $data_sent, $data_sent) || die $!; + } + }; + if ($@) { + print STDERR "[sendmail] error: $!\n"; + } } 1; } diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index f30b1e1cee..7d7c3fbfd9 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -2462,7 +2462,7 @@ sub p_decode_json { if ($JSON::VERSION > 2.90) { # Initialize JSON manager. - my $json = JSON->new->allow_nonref; + my $json = JSON->new->utf8->allow_nonref; $decoded_data = $json->decode($data); } else { $decoded_data = decode_json($data); diff --git a/pandora_server/lib/PandoraFMS/WMIServer.pm b/pandora_server/lib/PandoraFMS/WMIServer.pm index 9925c6ff31..74b32f50a0 100644 --- a/pandora_server/lib/PandoraFMS/WMIServer.pm +++ b/pandora_server/lib/PandoraFMS/WMIServer.pm @@ -220,7 +220,7 @@ sub data_consumer ($$) { my $col_number; for(my $i = 0; $i < @output_col; $i++ ) { - if( $output_col[$i] =~ /$selected_col/ ) { + if( $output_col[$i] =~ /$selected_col/i ) { $col_number = $i; last; } diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 4b5220a625..b67521022d 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -2,8 +2,8 @@ # Pandora FMS Server # %define name pandorafms_server -%define version 7.0NG.751 -%define release 210108 +%define version 7.0NG.752 +%define release 210311 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 4997b25d45..c5db0e8c0a 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -2,8 +2,8 @@ # Pandora FMS Server # %define name pandorafms_server -%define version 7.0NG.751 -%define release 210108 +%define version 7.0NG.752 +%define release 210311 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 6a88d5fc1f..bc2a62de7e 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -8,8 +8,8 @@ # This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.751" -PI_BUILD="210108" +PI_VERSION="7.0NG.752" +PI_BUILD="210311" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 907576d975..4f03017475 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.751 PS210108"; +my $version = "7.0NG.752 PS210311"; # Pandora server configuration my %conf; @@ -428,8 +428,8 @@ sub pandora_purgedb ($$) { ############################################################################### # Compact agent data. ############################################################################### -sub pandora_compactdb ($$) { - my ($conf, $dbh) = @_; +sub pandora_compactdb ($$$) { + my ($conf, $dbh, $dbh_conf) = @_; my %count_hash; my %id_agent_hash; @@ -534,9 +534,9 @@ sub pandora_compactdb ($$) { # Mark the last compact date if (defined ($conf->{'_last_compact'})) { - db_do ($dbh, 'UPDATE tconfig SET value=? WHERE token=?', $last_compact, 'last_compact'); + db_do ($dbh_conf, 'UPDATE tconfig SET value=? WHERE token=?', $last_compact, 'last_compact'); } else { - db_do ($dbh, 'INSERT INTO tconfig (value, token) VALUES (?, ?)', $last_compact, 'last_compact'); + db_do ($dbh_conf, 'INSERT INTO tconfig (value, token) VALUES (?, ?)', $last_compact, 'last_compact'); } } @@ -1045,7 +1045,7 @@ sub pandoradb_main ($$$) { # Compact on if enable and DaysCompact are below DaysPurge if (($conf->{'_onlypurge'} == 0) && ($conf->{'_days_compact'} < $conf->{'_days_purge'})) { - pandora_compactdb ($conf, defined ($history_dbh) ? $history_dbh : $dbh); + pandora_compactdb ($conf, defined ($history_dbh) ? $history_dbh : $dbh, $dbh); } # Update tconfig with last time of database maintance time (now) @@ -1055,6 +1055,9 @@ sub pandoradb_main ($$$) { # Move SNMP modules back to the Enterprise server enterprise_hook("claim_back_snmp_modules", [$dbh, $conf]); + # Check if there are discovery tasks with wrong id_recon_server + pandora_check_forgotten_discovery_tasks ($conf, $dbh); + # Recalculating dynamic intervals. enterprise_hook("update_min_max", [$dbh, $conf]); @@ -1064,6 +1067,41 @@ sub pandoradb_main ($$$) { log_message ('', "Ending at ". strftime ("%Y-%m-%d %H:%M:%S", localtime()) . "\n"); } +############################################################################### +# Check for discovery tasks configured with servers down +############################################################################### + +sub pandora_check_forgotten_discovery_tasks { + my ($conf, $dbh) = @_; + + log_message ('FORGOTTEN DISCOVERY TASKS', "Check for discovery tasks bound to inactive servers."); + + my @discovery_tasks = get_db_rows ($dbh, 'SELECT id_rt, id_recon_server, name FROM trecon_task'); + my $discovery_tasks_count = @discovery_tasks; + + # End of the check (this server has not discovery tasks!). + if ($discovery_tasks_count eq 0) { + log_message('FORGOTTEN DISCOVERY TASKS', 'There are not defined discovery tasks. Skipping.'); + return; + } + + my $master_server = get_db_value ($dbh, 'SELECT id_server FROM tserver WHERE server_type = ? AND status != -1', DISCOVERYSERVER); + + # Goes through all the tasks to check if any have the server down. + foreach my $task (@discovery_tasks) { + if ($task->{'id_recon_server'} ne $master_server) { + my $this_server_status = get_db_value ($dbh, 'SELECT status FROM tserver WHERE id_server = ?', $task->{'id_recon_server'}); + if (!defined($this_server_status) || $this_server_status eq -1) { + my $updated_task = db_process_update ($dbh, 'trecon_task', { 'id_recon_server' => $master_server }, { 'id_rt' => $task->{'id_rt'} }); + log_message('FORGOTTEN DISCOVERY TASKS', 'Updated discovery task '.$task->{'name'}); + } + } + } + + log_message('FORGOTTEN DISCOVERY TASKS', 'Step ended'); +} + + # Init pandora_init_pdb(\%conf); diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 17009b3754..6fd7ae604d 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.751 PS210108"; +my $version = "7.0NG.752 PS210311"; # save program name for logging my $progname = basename($0); diff --git a/pandora_server/util/recon_scripts/ipmi-recon.pl b/pandora_server/util/recon_scripts/ipmi-recon.pl index 7f1e3f6393..0f525815f2 100644 --- a/pandora_server/util/recon_scripts/ipmi-recon.pl +++ b/pandora_server/util/recon_scripts/ipmi-recon.pl @@ -38,13 +38,12 @@ if ($OSNAME eq "freebsd") { my $task_id = $ARGV[0]; # Passed automatically by the server my $target_group = $ARGV[1]; # Defined by user -my $create_incident = $ARGV[2]; # Defined by user # Used Custom Fields in this script -my $target_network = $ARGV[3]; # Filed1 defined by user -my $username = $ARGV[4]; # Field2 defined by user -my $password = $ARGV[5]; # Field3 defined by user -my $extraopts = $ARGV[6]; # Field4 defined by user +my $target_network = $ARGV[2]; # Filed1 defined by user +my $username = $ARGV[3]; # Field2 defined by user +my $password = $ARGV[4]; # Field3 defined by user +my $extraopts = $ARGV[5]; # Field4 defined by user # Map Sensor type to module type and thresholds # 0 = numeric, record has thresholds @@ -115,7 +114,7 @@ sub show_help { print "\nSpecific Pandora FMS Intel DCM Discovery\n"; print "(c) Artica ST 2011 \n\n"; print "Usage:\n\n"; - print " $0 \n\n"; + print " $0 \n\n"; print " * custom_field1 = network. i.e.: 192.168.100.0/24\n"; print " * custom_field2 = username \n"; print " * custom_field3 = password \n"; @@ -264,7 +263,7 @@ if (! defined ($net_addr)) { # Scan the network for host my ($total_hosts, $hosts_found, $addr_found) = ($net_addr->num, 0, ''); -for (my $i = 1; $net_addr < $net_addr->broadcast; $i++, $net_addr++) { +for (my $i = 1; $i<= $total_hosts && $net_addr <= $net_addr->broadcast; $i++, $net_addr++) { if ($net_addr =~ /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.(\d{1,3})\b/) { if($1 eq '0' || $1 eq '255') { next; diff --git a/pandora_server/util/styles_backup.sh b/pandora_server/util/styles_backup.sh new file mode 100644 index 0000000000..e91147581b --- /dev/null +++ b/pandora_server/util/styles_backup.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +#DATE +DATE=$(date +%Y-%m-%d-%H%M%S) + +#CREATE STYLES BACKUP FOLDER +mkdir "/var/www/html/pandora_console/styles_backup" + +#BACKUP DIR +BACKUP_DIR="/var/www/html/pandora_console/styles_backup/" + +#IMAGES BACKUP +echo "Creating backup of images..." +SOURCE="/var/www/html/pandora_console/images/" +tar -cvzpf $BACKUP_DIR/images-backup-$DATE.tar.gz $SOURCE +echo "Done." + +#STYLES BACKUP +echo "Creating backup of styles..." +SOURCE="/var/www/html/pandora_console/include/styles" +tar -cvzpf $BACKUP_DIR/styles-backup-$DATE.tar.gz $SOURCE +echo "Done." + +exit 0 diff --git a/visual_console_client/package.json b/visual_console_client/package.json index 33abee513e..5b89d7420b 100644 --- a/visual_console_client/package.json +++ b/visual_console_client/package.json @@ -47,5 +47,9 @@ "webpack": "^4.29.6", "webpack-cli": "^3.3.0", "webpack-dev-server": "^3.3.1" - } + }, + "browserslist": [ + "> 1%", + "last 2 versions" + ] } diff --git a/visual_console_client/src/.prettierrc b/visual_console_client/src/.prettierrc new file mode 100644 index 0000000000..8fea948a1e --- /dev/null +++ b/visual_console_client/src/.prettierrc @@ -0,0 +1,5 @@ +{ + "trailingComma": "none", + "singleQuote": false, + "arrowParens": "avoid" +} \ No newline at end of file diff --git a/visual_console_client/src/Item.ts b/visual_console_client/src/Item.ts index 14cc42aaa9..f7f1456513 100644 --- a/visual_console_client/src/Item.ts +++ b/visual_console_client/src/Item.ts @@ -46,7 +46,8 @@ export const enum ItemType { DONUT_GRAPH = 17, BARS_GRAPH = 18, CLOCK = 19, - COLOR_CLOUD = 20 + COLOR_CLOUD = 20, + NETWORK_LINK = 21 } // Base item properties. This interface should be extended by the item implementations. @@ -61,6 +62,7 @@ export interface ItemProps extends Position, Size { parentId: number | null; aclGroupId: number | null; cacheExpiration: number | null; + colorStatus: string; } export interface ItemClickEvent { @@ -136,6 +138,7 @@ export function itemBasePropsDecoder(data: AnyObject): ItemProps | never { parentId: parseIntOr(data.parentId, null), aclGroupId: parseIntOr(data.aclGroupId, null), cacheExpiration: parseIntOr(data.cacheExpiration, null), + colorStatus: notEmptyStringOr(data.colorStatus, "#CCC"), ...sizePropsDecoder(data), // Object spread. It will merge the properties of the two objects. ...positionPropsDecoder(data) // Object spread. It will merge the properties of the two objects. }; @@ -208,6 +211,9 @@ export function titleItem(id: number): string { case ItemType.COLOR_CLOUD: title = t("Color cloud"); break; + case ItemType.NETWORK_LINK: + title = t("Network link"); + break; default: title = t("Item"); break; @@ -293,6 +299,14 @@ abstract class VisualConsoleItem { * @param element Element to move inside its container. */ private initMovementListener(element: HTMLElement): void { + // Avoid line movement as 'block' force using circles. + if ( + this.props.type == ItemType.LINE_ITEM || + this.props.type == ItemType.NETWORK_LINK + ) { + return; + } + this.removeMovement = addMovementListener( element, (x: Position["x"], y: Position["y"]) => { @@ -372,6 +386,12 @@ abstract class VisualConsoleItem { * @param element Element to move inside its container. */ protected initResizementListener(element: HTMLElement): void { + if ( + this.props.type == ItemType.LINE_ITEM || + this.props.type == ItemType.NETWORK_LINK + ) { + return; + } this.removeResizement = addResizementListener( element, (width: Size["width"], height: Size["height"]) => { @@ -824,7 +844,8 @@ abstract class VisualConsoleItem { if ( prevProps && - (this.props.isLinkEnabled && prevProps.link !== this.props.link) + this.props.isLinkEnabled && + prevProps.link !== this.props.link ) { if (this.props.link !== null) { this.elementRef.setAttribute("href", this.props.link); @@ -839,6 +860,7 @@ abstract class VisualConsoleItem { this.elementRef.classList.remove("is-editing"); } } + if (!prevMeta || prevMeta.isFetching !== this.meta.isFetching) { if (this.meta.isFetching) { this.elementRef.classList.add("is-fetching"); @@ -999,8 +1021,13 @@ abstract class VisualConsoleItem { */ protected resizeElement(width: number, height: number): void { // The most valuable size is the content size. - this.childElementRef.style.width = width > 0 ? `${width}px` : null; - this.childElementRef.style.height = height > 0 ? `${height}px` : null; + if ( + this.props.type != ItemType.LINE_ITEM && + this.props.type != ItemType.NETWORK_LINK + ) { + this.childElementRef.style.width = width > 0 ? `${width}px` : null; + this.childElementRef.style.height = height > 0 ? `${height}px` : null; + } if (this.props.label && this.props.label.length > 0) { // Ugly table to show the label as its legacy counterpart. @@ -1178,7 +1205,10 @@ abstract class VisualConsoleItem { }; this.initMovementListener(this.elementRef); - if (this.props.type !== 13) { + if ( + this.props.type !== ItemType.LINE_ITEM && + this.props.type !== ItemType.NETWORK_LINK + ) { this.initResizementListener(this.elementRef); } } @@ -1194,7 +1224,7 @@ abstract class VisualConsoleItem { }; this.stopMovementListener(); - if (this.props.type !== 13) { + if (this.props.type !== ItemType.LINE_ITEM) { this.stopResizementListener(); } } diff --git a/visual_console_client/src/VisualConsole.ts b/visual_console_client/src/VisualConsole.ts index fb03e986f1..9c6581dc55 100644 --- a/visual_console_client/src/VisualConsole.ts +++ b/visual_console_client/src/VisualConsole.ts @@ -6,7 +6,8 @@ import { notEmptyStringOr, itemMetaDecoder, t, - ellipsize + ellipsize, + debounce } from "./lib"; import Item, { ItemType, @@ -20,6 +21,7 @@ import Item, { import StaticGraph, { staticGraphPropsDecoder } from "./items/StaticGraph"; import Icon, { iconPropsDecoder } from "./items/Icon"; import ColorCloud, { colorCloudPropsDecoder } from "./items/ColorCloud"; +import NetworkLink, { networkLinkPropsDecoder } from "./items/NetworkLink"; import Group, { groupPropsDecoder } from "./items/Group"; import Clock, { clockPropsDecoder } from "./items/Clock"; import Box, { boxPropsDecoder } from "./items/Box"; @@ -35,7 +37,6 @@ import DonutGraph, { donutGraphPropsDecoder } from "./items/DonutGraph"; import BarsGraph, { barsGraphPropsDecoder } from "./items/BarsGraph"; import ModuleGraph, { moduleGraphPropsDecoder } from "./items/ModuleGraph"; import Service, { servicePropsDecoder } from "./items/Service"; -import { FormContainer } from "./Form"; // TODO: Document. // eslint-disable-next-line @typescript-eslint/explicit-function-return-type @@ -82,6 +83,8 @@ function itemInstanceFrom(data: AnyObject) { return new Clock(clockPropsDecoder(data), meta); case ItemType.COLOR_CLOUD: return new ColorCloud(colorCloudPropsDecoder(data), meta); + case ItemType.NETWORK_LINK: + return new NetworkLink(networkLinkPropsDecoder(data), meta); default: throw new TypeError("item not found"); } @@ -130,6 +133,8 @@ function decodeProps(data: AnyObject) { return clockPropsDecoder(data); case ItemType.COLOR_CLOUD: return colorCloudPropsDecoder(data); + case ItemType.NETWORK_LINK: + return networkLinkPropsDecoder(data); default: throw new TypeError("decoder not found"); } @@ -206,6 +211,16 @@ export default class VisualConsole { private relations: { [key: string]: Line; } = {}; + + // Dictionary which store the related items (by ID). + private lineLinks: { + [key: number]: { [key: number]: { [key: string]: number } }; + } = {}; + + private lines: { + [key: number]: { [key: string]: number }; + } = {}; + // Event manager for click events. private readonly clickEventManager = new TypedEvent(); // Event manager for double click events. @@ -266,6 +281,9 @@ export default class VisualConsole { } }); + // Move lines conneted with this item. + this.updateLinesConnected(e.item.props, e.newPosition, false); + // console.log(`Moved element #${e.item.props.id}`, e); }; @@ -275,9 +293,36 @@ export default class VisualConsole { */ private handleElementMovementFinished: (e: ItemMovedEvent) => void = e => { this.movedEventManager.emit(e); + // Move lines conneted with this item. + this.updateLinesConnected(e.item.props, e.newPosition, true); // console.log(`Movement finished for element #${e.item.props.id}`, e); }; + /** + * Verifies if x,y are inside item coordinates. + * @param x Coordinate X + * @param y Coordinate Y + * @param item ItemProps instance. + */ + private coordinatesInItem(x: number, y: number, props: ItemProps) { + if ( + props.type == ItemType.LINE_ITEM || + props.type == ItemType.NETWORK_LINK + ) { + return false; + } + + if ( + x > props.x && + x < props.x + props.width && + y > props.y && + y < props.y + props.height + ) { + return true; + } + return false; + } + /** * React to a line movement. * @param e Event object. @@ -285,7 +330,12 @@ export default class VisualConsole { private handleLineElementMovementFinished: ( e: LineMovedEvent ) => void = e => { + // Update links. + this.refreshLink(e.item); + + // Build line relationships between items and lines. this.lineMovedEventManager.emit(e); + // console.log(`Movement finished for element #${e.item.props.id}`, e); }; @@ -373,6 +423,205 @@ export default class VisualConsole { this.unSelectItems(); }; + /** + * Refresh link for given line. + * + * @param line Line. + */ + protected refreshLink(l: Line) { + let line: number = l.props.id; + let itemAtStart = 0; + let itemAtEnd = 0; + + try { + for (let i in this.elementsById) { + if ( + this.coordinatesInItem( + l.props.startPosition.x, + l.props.startPosition.y, + this.elementsById[i].props + ) + ) { + // Start position at element i. + itemAtStart = parseInt(i); + } + + if ( + this.coordinatesInItem( + l.props.endPosition.x, + l.props.endPosition.y, + this.elementsById[i].props + ) + ) { + // Start position at element i. + itemAtEnd = parseInt(i); + } + } + + if (this.lineLinks == null) { + this.lineLinks = {}; + } + + if (this.lines == null) { + this.lines = {}; + } + + if (itemAtStart == line) { + itemAtStart = 0; + } + + if (itemAtEnd == line) { + itemAtEnd = 0; + } + + // Initialize line if not registered. + if (this.lines[line] == null) { + this.lines[line] = { + start: itemAtStart, + end: itemAtEnd + }; + } + + // Register 'start' side of the line. + if (itemAtStart > 0) { + // Initialize. + if (this.lineLinks[itemAtStart] == null) { + this.lineLinks[itemAtStart] = {}; + } + + // Assign. + this.lineLinks[itemAtStart][line] = { + start: itemAtStart, + end: itemAtEnd + }; + + // Register line if not exists prviously. + } else { + // Clean previous line relationship. + if (this.lines[line]["start"] > 0) { + this.lineLinks[this.lines[line]["start"]][line]["start"] = 0; + this.lines[line]["start"] = 0; + } + } + + if (itemAtEnd > 0) { + if (this.lineLinks[itemAtEnd] == null) { + this.lineLinks[itemAtEnd] = {}; + } + + this.lineLinks[itemAtEnd][line] = { + start: itemAtStart, + end: itemAtEnd + }; + } else { + // Clean previous line relationship. + if (this.lines[line]["end"] > 0) { + this.lineLinks[this.lines[line]["end"]][line]["end"] = 0; + this.lines[line]["end"] = 0; + } + } + + this.lines[line] = { + start: itemAtStart, + end: itemAtEnd + }; + + // Cleanup. + for (let i in this.lineLinks) { + if (this.lineLinks[i][line]) { + if ( + this.lineLinks[i][line].start == 0 && + this.lineLinks[i][line].end == 0 + ) { + // Object not connected to a line. + delete this.lineLinks[i][line]; + + if (Object.keys(this.lineLinks[i]).length === 0) { + delete this.lineLinks[i]; + } + } + } + } + } catch (error) { + console.error(error); + } + } + + /** + * Updates lines connected to this item. + * + * @param item Item moved. + * @param newPosition New location for item. + * @param oldPosition Old location for item. + * @param save Save to ajax or not. + */ + protected updateLinesConnected(item: ItemProps, to: Position, save: boolean) { + if (this.lineLinks[item.id] == null) { + return; + } + + Object.keys(this.lineLinks[item.id]).forEach(i => { + let lineId = parseInt(i); + let line = this.elementsById[lineId] as Line; + if (line.props) { + let startX = line.props.startPosition.x; + let startY = line.props.startPosition.y; + let endX = line.props.endPosition.x; + let endY = line.props.endPosition.y; + + if (item.id == this.lineLinks[item.id][lineId]["start"]) { + startX = to.x + item.width / 2; + startY = to.y + item.height / 2; + } + + if (item.id == this.lineLinks[item.id][lineId]["end"]) { + endX = to.x + item.width / 2; + endY = to.y + item.height / 2; + } + + // Update line movement. + this.updateElement({ + ...line.props, + startX: startX, + startY: startY, + endX: endX, + endY: endY + }); + + if (save) { + let debouncedLinePositionSave = debounce( + 500, + (options: AnyObject) => { + this.lineMovedEventManager.emit({ + item: options.line, + startPosition: { + x: options.startX, + y: options.startY + }, + endPosition: { + x: options.endX, + y: options.endY + } + }); + } + ); + + // Save line positon. + debouncedLinePositionSave({ + line: line, + startX: startX, + startY: startY, + endX: endX, + endY: endY + }); + } + } + }); + + // Update parents... + this.buildRelations(item.id, to.x + item.width / 2, to.y + item.height / 2); + } + public constructor( container: HTMLElement, props: AnyObject, @@ -397,6 +646,13 @@ export default class VisualConsole { // Create lines. this.buildRelations(); + // Re-attach all connected lines if any. + this.elements.forEach(item => { + if (item instanceof Line) { + this.refreshLink(item); + } + }); + this.containerRef.addEventListener("click", this.handleContainerClick); } @@ -424,17 +680,18 @@ export default class VisualConsole { // Item event handlers. itemInstance.onRemove(context.handleElementRemove); itemInstance.onSelectionChanged(context.handleElementSelectionChanged); - - // TODO:Continue itemInstance.onClick(context.handleElementClick); itemInstance.onDblClick(context.handleElementDblClick); - itemInstance.onMoved(context.handleElementMovement); - itemInstance.onMovementFinished(context.handleElementMovementFinished); + + // TODO:Continue if (itemInstance instanceof Line) { itemInstance.onLineMovementFinished( context.handleLineElementMovementFinished ); + this.refreshLink(itemInstance); } else { + itemInstance.onMoved(context.handleElementMovement); + itemInstance.onMovementFinished(context.handleElementMovementFinished); itemInstance.onResized(context.handleElementResizement); itemInstance.onResizeFinished(context.handleElementResizementFinished); } @@ -443,7 +700,7 @@ export default class VisualConsole { context.containerRef.append(itemInstance.elementRef); return itemInstance; } catch (error) { - console.log("Error creating a new element:", error.message); + console.error("Error creating a new element:", error.message); } return; } @@ -480,7 +737,7 @@ export default class VisualConsole { try { this.elementsById[item.id].props = decodeProps(item); } catch (error) { - console.log("Error updating an element:", error.message); + console.error("Error updating an element:", error.message); } } } @@ -497,9 +754,11 @@ export default class VisualConsole { public updateElement(item: AnyObject): void { // Update item. try { - this.elementsById[item.id].props = decodeProps(item); + this.elementsById[item.id].props = { + ...decodeProps(item) + }; } catch (error) { - console.log("Error updating element:", error.message); + console.error("Error updating element:", error.message); } // Re-build relations. @@ -538,24 +797,28 @@ export default class VisualConsole { public render(prevProps: VisualConsoleProps | null = null): void { if (prevProps) { if (prevProps.backgroundURL !== this.props.backgroundURL) { - this.containerRef.style.backgroundImage = - this.props.backgroundURL !== null - ? `url(${this.props.backgroundURL})` - : null; - } - if (prevProps.backgroundColor !== this.props.backgroundColor) { - this.containerRef.style.backgroundColor = this.props.backgroundColor; + if (this.props.backgroundURL) + this.containerRef.style.backgroundImage = + this.props.backgroundURL !== null + ? `url(${this.props.backgroundURL})` + : ""; } + if (this.props.backgroundColor != null) + if (prevProps.backgroundColor !== this.props.backgroundColor) { + this.containerRef.style.backgroundColor = this.props.backgroundColor; + } if (this.sizeChanged(prevProps, this.props)) { this.resizeElement(this.props.width, this.props.height); } } else { - this.containerRef.style.backgroundImage = - this.props.backgroundURL !== null - ? `url(${this.props.backgroundURL})` - : null; + if (this.props.backgroundURL) + this.containerRef.style.backgroundImage = + this.props.backgroundURL !== null + ? `url(${this.props.backgroundURL})` + : ""; - this.containerRef.style.backgroundColor = this.props.backgroundColor; + if (this.props.backgroundColor) + this.containerRef.style.backgroundColor = this.props.backgroundColor; this.resizeElement(this.props.width, this.props.height); } } @@ -614,8 +877,11 @@ export default class VisualConsole { /** * Create line elements which connect the elements with their parents. + * + * When itemId is being moved, overwrite position of the 'parent' or 'child' + * endpoints of the line, using X and Y values. */ - public buildRelations(): void { + public buildRelations(itemId?: number, x?: number, y?: number): void { // Clear relations. this.clearRelations(); // Add relations. @@ -623,7 +889,23 @@ export default class VisualConsole { if (item.props.parentId !== null) { const parent = this.elementsById[item.props.parentId]; const child = this.elementsById[item.props.id]; - if (parent && child) this.addRelationLine(parent, child); + + if (parent && child) { + if (itemId != undefined) { + if (item.props.parentId == itemId) { + // Update parent line position. + this.addRelationLine(parent, child, x, y); + } else if (item.props.id == itemId) { + // Update child line position. + this.addRelationLine(parent, child, undefined, undefined, x, y); + } else { + this.addRelationLine(parent, child); + } + } else { + // No movements default behaviour. + this.addRelationLine(parent, child); + } + } } }); } @@ -749,7 +1031,11 @@ export default class VisualConsole { */ private addRelationLine( parent: Item, - child: Item + child: Item, + parentX?: number, + parentY?: number, + childX?: number, + childY?: number ): Line { const identifier = `${parent.props.id}|${child.props.id}`; if (this.relations[identifier] != null) { @@ -757,9 +1043,27 @@ export default class VisualConsole { } // Get the items center. - const { x: startX, y: startY } = this.getVisualCenter(parent.props, parent); - const { x: endX, y: endY } = this.getVisualCenter(child.props, child); + let { x: startX, y: startY } = this.getVisualCenter(parent.props, parent); + let { x: endX, y: endY } = this.getVisualCenter(child.props, child); + // Overwrite positions if needed (while moving it!). + if (parentX != null) { + startX = parentX; + } + + if (parentY != null) { + startY = parentY; + } + + if (childX != null) { + endX = childX; + } + + if (childY != null) { + endY = childY; + } + + // Line inherits child element status. const line = new Line( linePropsDecoder({ id: 0, @@ -771,7 +1075,7 @@ export default class VisualConsole { width: 0, height: 0, lineWidth: this.props.relationLineWidth, - color: "#CCCCCC" + color: notEmptyStringOr(child.props.colorStatus, "#CCC") }), itemMetaDecoder({ receivedAt: new Date() @@ -973,7 +1277,8 @@ export default class VisualConsole { [ItemType.DONUT_GRAPH]: DonutGraph, [ItemType.BARS_GRAPH]: BarsGraph, [ItemType.CLOCK]: Clock, - [ItemType.COLOR_CLOUD]: ColorCloud + [ItemType.COLOR_CLOUD]: ColorCloud, + [ItemType.NETWORK_LINK]: NetworkLink }; /** diff --git a/visual_console_client/src/items/Line.ts b/visual_console_client/src/items/Line.ts index 5efa5881cb..2c39a3cb8b 100644 --- a/visual_console_client/src/items/Line.ts +++ b/visual_console_client/src/items/Line.ts @@ -8,9 +8,9 @@ import { import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item"; import TypedEvent, { Listener, Disposable } from "../lib/TypedEvent"; -interface LineProps extends ItemProps { +export interface LineProps extends ItemProps { // Overrided properties. - readonly type: ItemType.LINE_ITEM; + type: number; label: null; isLinkEnabled: false; parentId: null; @@ -20,6 +20,16 @@ interface LineProps extends ItemProps { endPosition: Position; lineWidth: number; color: string | null; + viewportOffsetX: number; + viewportOffsetY: number; + labelEnd: string; + labelStart: string; + linkedEnd: number | null; + linkedStart: number | null; + labelEndWidth: number; + labelEndHeight: number; + labelStartWidth: number; + labelStartHeight: number; } /** @@ -54,7 +64,17 @@ export function linePropsDecoder(data: AnyObject): LineProps | never { y: parseIntOr(data.endY, 0) }, lineWidth: parseIntOr(data.lineWidth || data.borderWidth, 1), - color: notEmptyStringOr(data.borderColor || data.color, null) + color: notEmptyStringOr(data.borderColor || data.color, null), + viewportOffsetX: 0, + viewportOffsetY: 0, + labelEnd: notEmptyStringOr(data.labelEnd, ""), + labelEndWidth: parseIntOr(data.labelEndWidth, 0), + linkedEnd: data.linkedEnd, + linkedStart: data.linkedStart, + labelEndHeight: parseIntOr(data.labelEndHeight, 0), + labelStart: notEmptyStringOr(data.labelStart, ""), + labelStartWidth: parseIntOr(data.labelStartWidth, 0), + labelStartHeight: parseIntOr(data.labelStartHeight, 0) }; /* @@ -82,20 +102,20 @@ export interface LineMovedEvent { } export default class Line extends Item { - private circleRadius = 8; + protected circleRadius = 8; // To control if the line movement is enabled. - private moveMode: boolean = false; + protected moveMode: boolean = false; // To control if the line is moving. - private isMoving: boolean = false; + protected isMoving: boolean = false; // Event manager for moved events. - private readonly lineMovedEventManager = new TypedEvent(); + public readonly lineMovedEventManager = new TypedEvent(); // List of references to clean the event listeners. - private readonly lineMovedEventDisposables: Disposable[] = []; + protected readonly lineMovedEventDisposables: Disposable[] = []; // This function will only run the 2nd arg function after the time // of the first arg have passed after its last execution. - private debouncedStartPositionMovementSave = debounce( + protected debouncedStartPositionMovementSave = debounce( 500, // ms. (x: Position["x"], y: Position["y"]) => { this.isMoving = false; @@ -110,13 +130,13 @@ export default class Line extends Item { ); // This property will store the function // to clean the movement listener. - private removeStartPositionMovement: Function | null = null; + protected removeStartPositionMovement: Function | null = null; /** * Start the movement funtionality for the start position. * @param element Element to move inside its container. */ - private initStartPositionMovementListener( + protected initStartPositionMovementListener( element: HTMLElement, container: HTMLElement ): void { @@ -124,8 +144,8 @@ export default class Line extends Item { element, (x: Position["x"], y: Position["y"]) => { // Calculate the center of the circle. - x += this.circleRadius; - y += this.circleRadius; + x += this.circleRadius - this.props.viewportOffsetX / 2; + y += this.circleRadius - this.props.viewportOffsetY / 2; const startPosition = { x, y }; @@ -153,7 +173,7 @@ export default class Line extends Item { // This function will only run the 2nd arg function after the time // of the first arg have passed after its last execution. - private debouncedEndPositionMovementSave = debounce( + protected debouncedEndPositionMovementSave = debounce( 500, // ms. (x: Position["x"], y: Position["y"]) => { this.isMoving = false; @@ -168,13 +188,13 @@ export default class Line extends Item { ); // This property will store the function // to clean the movement listener. - private removeEndPositionMovement: Function | null = null; + protected removeEndPositionMovement: Function | null = null; /** * End the movement funtionality for the end position. * @param element Element to move inside its container. */ - private initEndPositionMovementListener( + protected initEndPositionMovementListener( element: HTMLElement, container: HTMLElement ): void { @@ -182,8 +202,8 @@ export default class Line extends Item { element, (x: Position["x"], y: Position["y"]) => { // Calculate the center of the circle. - x += this.circleRadius; - y += this.circleRadius; + x += this.circleRadius - this.props.viewportOffsetX / 2; + y += this.circleRadius - this.props.viewportOffsetY / 2; this.isMoving = true; this.props = { @@ -231,6 +251,11 @@ export default class Line extends Item { this.moveMode = meta.editMode; this.init(); + + super.resizeElement( + Math.max(props.width, props.viewportOffsetX), + Math.max(props.height, props.viewportOffsetY) + ); } /** @@ -272,27 +297,33 @@ export default class Line extends Item { const element: HTMLDivElement = document.createElement("div"); element.className = "line"; - const { + let { x, // Box x y, // Box y width, // Box width height, // Box height - lineWidth, // Line thickness + lineWidth, // Line thickness, + viewportOffsetX, // viewport width, + viewportOffsetY, // viewport heigth, startPosition, // Line start position endPosition, // Line end position color // Line color } = this.props; - const x1 = startPosition.x - x + lineWidth / 2; - const y1 = startPosition.y - y + lineWidth / 2; - const x2 = endPosition.x - x + lineWidth / 2; - const y2 = endPosition.y - y + lineWidth / 2; + width = width + viewportOffsetX; + height = height + viewportOffsetY; + + const x1 = startPosition.x - x + lineWidth / 2 + viewportOffsetX / 2; + const y1 = startPosition.y - y + lineWidth / 2 + viewportOffsetY / 2; + const x2 = endPosition.x - x + lineWidth / 2 + viewportOffsetX / 2; + const y2 = endPosition.y - y + lineWidth / 2 + viewportOffsetY / 2; // SVG container. const svg = document.createElementNS(svgNS, "svg"); // Set SVG size. svg.setAttribute("width", `${width + lineWidth}`); svg.setAttribute("height", `${height + lineWidth}`); + const line = document.createElementNS(svgNS, "line"); line.setAttribute("x1", `${x1}`); line.setAttribute("y1", `${y1}`); @@ -308,21 +339,26 @@ export default class Line extends Item { } protected updateDomElement(element: HTMLElement): void { - const { + let { x, // Box x y, // Box y width, // Box width height, // Box height lineWidth, // Line thickness + viewportOffsetX, // viewport width, + viewportOffsetY, // viewport heigth, startPosition, // Line start position endPosition, // Line end position color // Line color } = this.props; - const x1 = startPosition.x - x + lineWidth / 2; - const y1 = startPosition.y - y + lineWidth / 2; - const x2 = endPosition.x - x + lineWidth / 2; - const y2 = endPosition.y - y + lineWidth / 2; + width = width + viewportOffsetX; + height = height + viewportOffsetY; + + const x1 = startPosition.x - x + lineWidth / 2 + viewportOffsetX / 2; + const y1 = startPosition.y - y + lineWidth / 2 + viewportOffsetY / 2; + const x2 = endPosition.x - x + lineWidth / 2 + viewportOffsetX / 2; + const y2 = endPosition.y - y + lineWidth / 2 + viewportOffsetY / 2; const svgs = element.getElementsByTagName("svg"); @@ -352,9 +388,6 @@ export default class Line extends Item { } if (this.moveMode) { - const startIsLeft = startPosition.x - endPosition.x <= 0; - const startIsTop = startPosition.y - endPosition.y <= 0; - let startCircle: HTMLElement = document.createElement("div"); let endCircle: HTMLElement = document.createElement("div"); @@ -384,12 +417,8 @@ export default class Line extends Item { startCircle.style.borderRadius = "50%"; startCircle.style.backgroundColor = `${color}`; startCircle.style.position = "absolute"; - startCircle.style.left = startIsLeft - ? `-${this.circleRadius}px` - : `${width + lineWidth - this.circleRadius}px`; - startCircle.style.top = startIsTop - ? `-${this.circleRadius}px` - : `${height + lineWidth - this.circleRadius}px`; + startCircle.style.left = `${x1 - this.circleRadius}px`; + startCircle.style.top = `${y1 - this.circleRadius}px`; endCircle.classList.add( "visual-console-item-line-circle", @@ -400,12 +429,8 @@ export default class Line extends Item { endCircle.style.borderRadius = "50%"; endCircle.style.backgroundColor = `${color}`; endCircle.style.position = "absolute"; - endCircle.style.left = startIsLeft - ? `${width + lineWidth - 8}px` - : `-${this.circleRadius}px`; - endCircle.style.top = startIsTop - ? `${height + lineWidth - this.circleRadius}px` - : `-${this.circleRadius}px`; + endCircle.style.left = `${x2 - this.circleRadius}px`; + endCircle.style.top = `${y2 - this.circleRadius}px`; if (element.parentElement !== null) { const circles = element.parentElement.getElementsByClassName( @@ -421,10 +446,14 @@ export default class Line extends Item { } // Init the movement listeners. - this.initStartPositionMovementListener(startCircle, this.elementRef - .parentElement as HTMLElement); - this.initEndPositionMovementListener(endCircle, this.elementRef - .parentElement as HTMLElement); + this.initStartPositionMovementListener( + startCircle, + this.elementRef.parentElement as HTMLElement + ); + this.initEndPositionMovementListener( + endCircle, + this.elementRef.parentElement as HTMLElement + ); } else if (!this.moveMode) { this.stopStartPositionMovementListener(); // Remove circles. diff --git a/visual_console_client/src/items/NetworkLink.ts b/visual_console_client/src/items/NetworkLink.ts new file mode 100644 index 0000000000..d0feb6f813 --- /dev/null +++ b/visual_console_client/src/items/NetworkLink.ts @@ -0,0 +1,314 @@ +import { AnyObject, Position, ItemMeta } from "../lib/types"; +import { debounce, notEmptyStringOr, parseIntOr } from "../lib"; +import { ItemType } from "../Item"; +import Line, { LineProps, linePropsDecoder } from "./Line"; + +const svgNS = "http://www.w3.org/2000/svg"; + +export interface NetworkLinkProps extends LineProps { + // Overrided properties. + type: number; + labelStart: string; + labelEnd: string; +} + +/** + * Build a valid typed object from a raw object. + * This will allow us to ensure the type safety. + * + * @param data Raw object. + * @return An object representing the item props. + * @throws Will throw a TypeError if some property + * is missing from the raw object or have an invalid type. + */ +export function networkLinkPropsDecoder( + data: AnyObject +): NetworkLinkProps | never { + return { + ...linePropsDecoder(data), // Object spread. It will merge the properties of the two objects. + type: ItemType.NETWORK_LINK, + viewportOffsetX: 0, + viewportOffsetY: 0, + labelEnd: notEmptyStringOr(data.labelEnd, ""), + labelEndWidth: parseIntOr(data.labelEndWidth, 0), + labelEndHeight: parseIntOr(data.labelEndHeight, 0), + labelStart: notEmptyStringOr(data.labelStart, ""), + labelStartWidth: parseIntOr(data.labelStartWidth, 0), + labelStartHeight: parseIntOr(data.labelStartHeight, 0) + }; +} + +export default class NetworkLink extends Line { + /** + * @override + */ + public constructor(props: NetworkLinkProps, meta: ItemMeta) { + /* + * We need to override the constructor cause we need to obtain the + * box size and position from the start and finish points of the line. + */ + super( + { + ...props + }, + { + ...meta + } + ); + + this.render(); + } + + /** + * @override + */ + protected debouncedStartPositionMovementSave = debounce( + 50, // ms. + (x: Position["x"], y: Position["y"]) => { + this.isMoving = false; + + const startPosition = { x, y }; + + // Re-Paint after move. + this.render(); + + // Emit the movement event. + this.lineMovedEventManager.emit({ + item: this, + startPosition, + endPosition: this.props.endPosition + }); + } + ); + + protected debouncedEndPositionMovementSave = debounce( + 50, // ms. + (x: Position["x"], y: Position["y"]) => { + this.isMoving = false; + const endPosition = { x, y }; + + // Re-Paint after move. + this.render(); + + // Emit the movement event. + this.lineMovedEventManager.emit({ + item: this, + endPosition, + startPosition: this.props.startPosition + }); + } + ); + + protected updateDomElement(element: HTMLElement): void { + super.updateDomElement(element); + + let { + x, // Box x + y, // Box y + lineWidth, // Line thickness + viewportOffsetX, // viewport width, + viewportOffsetY, // viewport heigth, + startPosition, // Line start position + endPosition, // Line end position + color, // Line color + labelEnd, + labelStart, + labelEndWidth, + labelEndHeight, + labelStartWidth, + labelStartHeight + } = this.props; + + const svgs = element.getElementsByTagName("svg"); + let line; + let svg; + + if (svgs.length > 0) { + svg = svgs.item(0); + + if (svg != null) { + // Set SVG size. + const lines = svg.getElementsByTagNameNS(svgNS, "line"); + let groups = svg.getElementsByTagNameNS(svgNS, "g"); + while (groups.length > 0) { + groups[0].remove(); + } + + if (lines.length > 0) { + line = lines.item(0); + } + } + } else { + // No line or svg, no more actions are required. + return; + } + + if (svg == null || line == null) { + // No more actionas are required. + return; + } + + // Font size and text adjustments. + const fontsize = 10; + const adjustment = 25; + + const lineX1 = startPosition.x - x + lineWidth / 2 + viewportOffsetX / 2; + const lineY1 = startPosition.y - y + lineWidth / 2 + viewportOffsetY / 2; + const lineX2 = endPosition.x - x + lineWidth / 2 + viewportOffsetX / 2; + const lineY2 = endPosition.y - y + lineWidth / 2 + viewportOffsetY / 2; + + let x1 = startPosition.x - x + lineWidth / 2 + viewportOffsetX / 2; + let y1 = startPosition.y - y + lineWidth / 2 + viewportOffsetY / 2; + let x2 = endPosition.x - x + lineWidth / 2 + viewportOffsetX / 2; + let y2 = endPosition.y - y + lineWidth / 2 + viewportOffsetY / 2; + + // Calculate angle (rotation). + let rad = Math.atan2(lineY2 - lineY1, lineX2 - lineX1); + let g = (rad * 180) / Math.PI; + + // Calculate effective 'text' box sizes. + const fontheight = 25; + if (labelStartWidth <= 0) { + let lines = labelStart.split(""); + labelStartWidth = 0; + lines.forEach(l => { + if (l.length > labelStartWidth) { + labelStartWidth = l.length * fontsize; + } + }); + if (labelStartHeight <= 0) { + labelStartHeight = lines.length * fontheight; + } + } + + if (labelEndWidth <= 0) { + let lines = labelEnd.split(""); + labelEndWidth = 0; + lines.forEach(l => { + if (l.length > labelEndWidth) { + labelEndWidth = l.length * fontsize; + } + }); + if (labelEndHeight <= 0) { + labelEndHeight = lines.length * fontheight; + } + } + + if (x1 < x2) { + // x1 on left of x2. + x1 += adjustment; + x2 -= adjustment + labelEndWidth; + } + + if (x1 > x2) { + // x1 on right of x2. + x1 -= adjustment + labelStartWidth; + x2 += adjustment; + } + + if (y1 < y2) { + // y1 on y2. + y1 += adjustment; + y2 -= adjustment + labelEndHeight; + } + + if (y1 > y2) { + // y1 under y2. + y1 -= adjustment + labelStartHeight; + y2 += adjustment; + } + + if (typeof color == "undefined") { + color = "#000"; + } + + // Clean. + if (element.parentElement !== null) { + const labels = element.parentElement.getElementsByClassName( + "vc-item-nl-label" + ); + while (labels.length > 0) { + const label = labels.item(0); + if (label) label.remove(); + } + + const arrows = element.parentElement.getElementsByClassName( + "vc-item-nl-arrow" + ); + while (arrows.length > 0) { + const arrow = arrows.item(0); + if (arrow) arrow.remove(); + } + } + + let arrowSize = lineWidth * 2; + + let arrowPosX = lineX1 + (lineX2 - lineX1) / 2 - arrowSize; + let arrowPosY = lineY1 + (lineY2 - lineY1) / 2 - arrowSize; + + let arrowStart: HTMLElement = document.createElement("div"); + arrowStart.classList.add("vc-item-nl-arrow"); + arrowStart.style.position = "absolute"; + arrowStart.style.border = `${arrowSize}px solid transparent`; + arrowStart.style.borderBottom = `${arrowSize}px solid ${color}`; + arrowStart.style.left = `${arrowPosX}px`; + arrowStart.style.top = `${arrowPosY}px`; + arrowStart.style.transform = `rotate(${90 + g}deg)`; + + let arrowEnd: HTMLElement = document.createElement("div"); + arrowEnd.classList.add("vc-item-nl-arrow"); + arrowEnd.style.position = "absolute"; + arrowEnd.style.border = `${arrowSize}px solid transparent`; + arrowEnd.style.borderBottom = `${arrowSize}px solid ${color}`; + arrowEnd.style.left = `${arrowPosX}px`; + arrowEnd.style.top = `${arrowPosY}px`; + arrowEnd.style.transform = `rotate(${270 + g}deg)`; + + if (element.parentElement !== null) { + element.parentElement.appendChild(arrowStart); + element.parentElement.appendChild(arrowEnd); + } + + if (labelStart != "") { + let htmlLabelStart: HTMLElement = document.createElement("div"); + + try { + htmlLabelStart.innerHTML = labelStart; + htmlLabelStart.style.position = "absolute"; + htmlLabelStart.style.left = `${x1}px`; + htmlLabelStart.style.top = `${y1}px`; + htmlLabelStart.style.width = `${labelStartWidth}px`; + htmlLabelStart.style.border = `2px solid ${color}`; + + htmlLabelStart.classList.add("vc-item-nl-label", "label-start"); + } catch (error) { + console.error(error); + } + + if (element.parentElement !== null) { + element.parentElement.appendChild(htmlLabelStart); + } + } + + if (labelEnd != "") { + let htmlLabelEnd: HTMLElement = document.createElement("div"); + + try { + htmlLabelEnd.innerHTML = labelEnd; + htmlLabelEnd.style.position = "absolute"; + htmlLabelEnd.style.left = `${x2}px`; + htmlLabelEnd.style.top = `${y2}px`; + htmlLabelEnd.style.width = `${labelEndWidth}px`; + htmlLabelEnd.style.border = `2px solid ${color}`; + + htmlLabelEnd.classList.add("vc-item-nl-label", "label-end"); + } catch (error) { + console.error(error); + } + + if (element.parentElement !== null) { + element.parentElement.appendChild(htmlLabelEnd); + } + } + } +} diff --git a/visual_console_client/src/items/Service.ts b/visual_console_client/src/items/Service.ts index f6a6850494..5e83dc392a 100644 --- a/visual_console_client/src/items/Service.ts +++ b/visual_console_client/src/items/Service.ts @@ -68,6 +68,14 @@ export default class Service extends Item { element.style.background = `url(${this.props.statusImageSrc}) no-repeat`; element.style.backgroundSize = "contain"; element.style.backgroundPosition = "center"; + if (this.props.encodedTitle !== null) { + element.className = "service image forced_title"; + element.setAttribute("data-use_title_for_force_title", "1"); + element.setAttribute( + "data-title", + decodeBase64(this.props.encodedTitle) + ); + } } else if (this.props.encodedTitle !== null) { element.innerHTML = decodeBase64(this.props.encodedTitle); } @@ -84,6 +92,14 @@ export default class Service extends Item
+
'; html_print_checkbox_switch('monday', 1, $monday); @@ -1166,7 +1186,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('tuesday', 1, $tuesday); @@ -1174,7 +1194,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('wednesday', 1, $wednesday); @@ -1182,7 +1202,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('thursday', 1, $thursday); @@ -1190,7 +1210,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('friday', 1, $friday); @@ -1198,7 +1218,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('saturday', 1, $saturday); @@ -1206,7 +1226,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('sunday', 1, $sunday); @@ -1270,9 +1290,9 @@ $class = 'databox filters';
'; html_print_checkbox_switch('total_time', 1, $total_time); @@ -2247,7 +2267,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('time_failed', 1, $time_failed); @@ -2255,7 +2275,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('time_in_ok_status', 1, $time_in_ok_status); @@ -2263,7 +2283,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch( @@ -2275,7 +2295,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch( @@ -2287,7 +2307,7 @@ $class = 'databox filters';
'; html_print_checkbox_switch('time_of_downtime', 1, $time_of_downtime); @@ -2298,8 +2318,8 @@ $class = 'databox filters';
Select fields to show
-
".__('Please select a name.').'
".__('Please select an agent.').'
".__('Please select a module.').'
".__('Please insert a SQL query.').'
".__('Please insert a URL.').'
".__('Please checked a custom interval option.').'
".__('Please select a user.').'
".__('Please select a group.').'
'; $output .= __('You could change this options later in "alert actions" and setting your account.'); @@ -493,26 +493,26 @@ function registration_wiz_modal( $output .= '
'; $output .= __('When you subscribe to the %s Update Manager service, you accept that we register your %s instance as an identifier on a database owned by %s. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the Update Manager options.', $product_name, $product_name, $product_name, $product_name); $output .= '
'; $output .= __('You will need to update your system manually, through source code or RPM packages to be up to date with latest updates.'); @@ -547,8 +547,8 @@ function registration_wiz_modal( $output .= '
Stay up to date with updates, upgrades and promotions by subscribing to our newsletter.
'; $output .= __( @@ -788,7 +788,7 @@ function newsletter_wiz_modal( // Show regiter to newsletter state. $show_newsletter = ($display_newsletter !== true) ? 'inline-block' : 'none'; - $output .= '
'; $output .= __('You will miss all news about amazing features and fixes!'); @@ -842,8 +842,8 @@ function newsletter_wiz_modal( $output .= '
".__('Min allowed size is 1024x768.').'
".__('No custom graph defined.').'
".__('No image or name defined.').'
".__('No label defined.').'
".__('No service defined.').'
".__('No image defined.').'
".__('No process defined.').'
".__('No Max value defined.').'
".__('No width defined.').'
".__('No height defined.').'
".__('The width must not exceed the size of the visual console container.').'
".__('The height must not exceed the size of the visual console container.').'
".__('No period defined.').'
".__('No agent defined.').'
".__('No module defined.').'
".__('No module defined. This module must be string type.').'
".__('Successfully save the changes.').'
".__('Could not be save.').'
Networkmaps are not migrated, wait while migration is processed...