resolved conflicts in ver_agente
This commit is contained in:
commit
3ffd976365
|
@ -1,5 +1,5 @@
|
||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.728-181025
|
Version: 7.0NG.728-181107
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.728-181025"
|
pandora_version="7.0NG.728-181107"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.728';
|
use constant AGENT_VERSION => '7.0NG.728';
|
||||||
use constant AGENT_BUILD => '181025';
|
use constant AGENT_BUILD => '181107';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.728
|
%define version 7.0NG.728
|
||||||
%define release 181025
|
%define release 181107
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -95,6 +95,7 @@ if [ ! -e /etc/pandora/plugins ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e /etc/pandora/collections ]; then
|
if [ ! -e /etc/pandora/collections ]; then
|
||||||
|
mkdir -p /usr/share/pandora_agent/collections
|
||||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.728
|
%define version 7.0NG.728
|
||||||
%define release 181025
|
%define release 181107
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -88,7 +88,7 @@ if [ ! -e /etc/pandora/plugins ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e /etc/pandora/collections ]; then
|
if [ ! -e /etc/pandora/collections ]; then
|
||||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
mkdir /etc/pandora/collections
|
||||||
fi
|
fi
|
||||||
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent
|
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.728"
|
PI_VERSION="7.0NG.728"
|
||||||
PI_BUILD="181025"
|
PI_BUILD="181107"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -388,8 +388,8 @@ install () {
|
||||||
|
|
||||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
|
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
|
||||||
|
|
||||||
echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
|
echo "Creating the collections directory in to $PANDORA_BASE$PANDORA_HOME/collections..."
|
||||||
cp -r collections $PANDORA_BASE$PANDORA_HOME
|
mkdir -p $PANDORA_BASE$PANDORA_HOME/collections
|
||||||
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
|
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
|
||||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
|
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,33 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
# Retrieve information from all filesystems
|
# Retrieve information from all filesystems
|
||||||
my $all_filesystems = 0;
|
my $all_filesystems = 0;
|
||||||
|
|
||||||
# Regex flag
|
# Regex flag
|
||||||
my $regex_mode = 0;
|
my $regex_mode = 0;
|
||||||
|
my $inode_mode = 0;
|
||||||
|
|
||||||
|
# Exclusion
|
||||||
|
my @exclude_fs = ();
|
||||||
|
my $cmd = undef;
|
||||||
|
|
||||||
|
|
||||||
|
sub in_array {
|
||||||
|
my ($array, $value) = @_;
|
||||||
|
|
||||||
|
if (!defined($value)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %params = map { $_ => 1 } @{$array};
|
||||||
|
if (exists($params{$value})) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sub check_re($$){
|
sub check_re($$){
|
||||||
my $item = shift;
|
my $item = shift;
|
||||||
|
@ -65,10 +86,24 @@ if ($#ARGV < 0) {
|
||||||
$all_filesystems = 1;
|
$all_filesystems = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if regex mode is enabled
|
while ($#ARGV >= 0) {
|
||||||
if ($ARGV[0] eq "-r") {
|
my $param = shift @ARGV;
|
||||||
$regex_mode = 1;
|
if ($param eq '-r') {
|
||||||
shift @ARGV;
|
$regex_mode = 1;
|
||||||
|
shift @ARGV;
|
||||||
|
}
|
||||||
|
elsif ($param eq '-i') {
|
||||||
|
$inode_mode = 1;
|
||||||
|
}
|
||||||
|
elsif ($param eq '-exclude_fs') {
|
||||||
|
my $_tmp = shift @ARGV;
|
||||||
|
chomp ($_tmp);
|
||||||
|
@exclude_fs = split /,/, $_tmp;
|
||||||
|
}
|
||||||
|
elsif ($param eq '-custom_cmd') {
|
||||||
|
$cmd = shift @ARGV;
|
||||||
|
chomp ($cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse command line parameters
|
# Parse command line parameters
|
||||||
|
@ -90,7 +125,15 @@ if ($onlyexclude) {
|
||||||
|
|
||||||
# Retrieve filesystem information
|
# Retrieve filesystem information
|
||||||
# -P use the POSIX output format for portability
|
# -P use the POSIX output format for portability
|
||||||
my @df = `df -P`;
|
|
||||||
|
|
||||||
|
$cmd = 'df -PT' unless defined($cmd);
|
||||||
|
|
||||||
|
if ($inode_mode > 0) {
|
||||||
|
$cmd = 'df -PTi';
|
||||||
|
}
|
||||||
|
|
||||||
|
my @df = `$cmd`;
|
||||||
shift (@df);
|
shift (@df);
|
||||||
|
|
||||||
# No filesystems? Something went wrong.
|
# No filesystems? Something went wrong.
|
||||||
|
@ -102,9 +145,13 @@ my %out;
|
||||||
# Parse filesystem usage
|
# Parse filesystem usage
|
||||||
foreach my $row (@df) {
|
foreach my $row (@df) {
|
||||||
my @columns = split (' ', $row);
|
my @columns = split (' ', $row);
|
||||||
exit 1 if ($#columns < 4);
|
exit 1 if ($#columns < 5);
|
||||||
if (check_in (\%filesystems,$columns[0]) || ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0]) )) {
|
|
||||||
$out{$columns[0]} = $columns[4] ;
|
next if (in_array(\@exclude_fs, $columns[1]) > 0);
|
||||||
|
|
||||||
|
if (check_in (\%filesystems,$columns[0])
|
||||||
|
|| ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0])) ){
|
||||||
|
$out{$columns[0]} = $columns[5] ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +162,7 @@ while (my ($filesystem, $use) = each (%out)) {
|
||||||
|
|
||||||
# Print module output
|
# Print module output
|
||||||
print "<module>\n";
|
print "<module>\n";
|
||||||
print "<name><![CDATA[" . $filesystem . "]]></name>\n";
|
print "<name><![CDATA[" . ($inode_mode > 0 ? 'Inodes:' : '') . $filesystem . "]]></name>\n";
|
||||||
print "<type><![CDATA[generic_data]]></type>\n";
|
print "<type><![CDATA[generic_data]]></type>\n";
|
||||||
print "<data><![CDATA[" . $use . "]]></data>\n";
|
print "<data><![CDATA[" . $use . "]]></data>\n";
|
||||||
print "<description><![CDATA[% of usage in this volume]]></description>\n";
|
print "<description><![CDATA[% of usage in this volume]]></description>\n";
|
||||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{181025}
|
{181107}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
|
|
@ -227,7 +227,7 @@ int Cron::getResetValue (int position) {
|
||||||
* @return false if should not execute
|
* @return false if should not execute
|
||||||
*/
|
*/
|
||||||
bool Cron::shouldExecuteAt (time_t date) {
|
bool Cron::shouldExecuteAt (time_t date) {
|
||||||
return this->utimestamp < date;
|
return this->utimestamp <= date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.728(Build 181025)")
|
#define PANDORA_VERSION ("7.0NG.728(Build 181107)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.728(Build 181025))"
|
VALUE "ProductVersion", "(7.0NG.728(Build 181107))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.728-181025
|
Version: 7.0NG.728-181107
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
Installed-Size: 42112
|
Installed-Size: 42112
|
||||||
Maintainer: Artica ST <deptec@artica.es>
|
Maintainer: Artica ST <deptec@artica.es>
|
||||||
Homepage: http://pandorafms.org/
|
Homepage: http://pandorafms.org/
|
||||||
Depends: php5.6 | php5, php5.6-snmp | php5-snmp, php5.6-gd | php5-gd, php5.6-mysql | php5-mysql, php-db, php5.6-xmlrpc | php5-xmlrpc, php-gettext, php5.6-curl | php5-curl, graphviz, dbconfig-common, php5.6-ldap | php5-ldap, mysql-client | virtual-mysql-client
|
Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc
|
||||||
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.
|
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.728-181025"
|
pandora_version="7.0NG.728-181107"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"name": "Pandora FMS",
|
||||||
|
"description": "Pandora Flexible Monitoring System ",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Artica",
|
||||||
|
"email": "info@artica.es"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"mpdf/mpdf": "^7.1",
|
||||||
|
"swiftmailer/swiftmailer": "^6.0"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,442 @@
|
||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"content-hash": "18364e5cd8c79657279985942190b4a7",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "doctrine/lexer",
|
||||||
|
"version": "v1.0.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/doctrine/lexer.git",
|
||||||
|
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
|
||||||
|
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Doctrine\\Common\\Lexer\\": "lib/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Roman Borschel",
|
||||||
|
"email": "roman@code-factory.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Guilherme Blanco",
|
||||||
|
"email": "guilhermeblanco@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Johannes Schmitt",
|
||||||
|
"email": "schmittjoh@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
|
||||||
|
"homepage": "http://www.doctrine-project.org",
|
||||||
|
"keywords": [
|
||||||
|
"lexer",
|
||||||
|
"parser"
|
||||||
|
],
|
||||||
|
"time": "2014-09-09T13:34:57+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "egulias/email-validator",
|
||||||
|
"version": "2.1.6",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/egulias/EmailValidator.git",
|
||||||
|
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
|
||||||
|
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"doctrine/lexer": "^1.0.1",
|
||||||
|
"php": ">= 5.5"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dominicsayers/isemail": "dev-master",
|
||||||
|
"phpunit/phpunit": "^4.8.35||^5.7||^6.0",
|
||||||
|
"satooshi/php-coveralls": "^1.0.1"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Egulias\\EmailValidator\\": "EmailValidator"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Eduardo Gulias Davis"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A library for validating emails against several RFCs",
|
||||||
|
"homepage": "https://github.com/egulias/EmailValidator",
|
||||||
|
"keywords": [
|
||||||
|
"email",
|
||||||
|
"emailvalidation",
|
||||||
|
"emailvalidator",
|
||||||
|
"validation",
|
||||||
|
"validator"
|
||||||
|
],
|
||||||
|
"time": "2018-09-25T20:47:26+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mpdf/mpdf",
|
||||||
|
"version": "v7.1.5",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/mpdf/mpdf.git",
|
||||||
|
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
|
||||||
|
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-gd": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"myclabs/deep-copy": "^1.7",
|
||||||
|
"paragonie/random_compat": "^1.4|^2.0|9.99.99",
|
||||||
|
"php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0",
|
||||||
|
"psr/log": "^1.0",
|
||||||
|
"setasign/fpdi": "1.6.*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^0.9.5",
|
||||||
|
"phpunit/phpunit": "^5.0",
|
||||||
|
"squizlabs/php_codesniffer": "^2.7.0",
|
||||||
|
"tracy/tracy": "^2.4"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-bcmath": "Needed for generation of some types of barcodes",
|
||||||
|
"ext-xml": "Needed mainly for SVG manipulation",
|
||||||
|
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-development": "7.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Mpdf\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GPL-2.0-only"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Matěj Humpál",
|
||||||
|
"role": "Developer, maintainer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ian Back",
|
||||||
|
"role": "Developer (retired)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
|
||||||
|
"homepage": "https://mpdf.github.io",
|
||||||
|
"keywords": [
|
||||||
|
"pdf",
|
||||||
|
"php",
|
||||||
|
"utf-8"
|
||||||
|
],
|
||||||
|
"time": "2018-09-19T09:58:39+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "myclabs/deep-copy",
|
||||||
|
"version": "1.7.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||||
|
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
|
||||||
|
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^5.6 || ^7.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/collections": "^1.0",
|
||||||
|
"doctrine/common": "^2.6",
|
||||||
|
"phpunit/phpunit": "^4.1"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"DeepCopy\\": "src/DeepCopy/"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/DeepCopy/deep_copy.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "Create deep copies (clones) of your objects",
|
||||||
|
"keywords": [
|
||||||
|
"clone",
|
||||||
|
"copy",
|
||||||
|
"duplicate",
|
||||||
|
"object",
|
||||||
|
"object graph"
|
||||||
|
],
|
||||||
|
"time": "2017-10-19T19:58:43+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "paragonie/random_compat",
|
||||||
|
"version": "v9.99.99",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/paragonie/random_compat.git",
|
||||||
|
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||||
|
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "4.*|5.*",
|
||||||
|
"vimeo/psalm": "^1"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Paragon Initiative Enterprises",
|
||||||
|
"email": "security@paragonie.com",
|
||||||
|
"homepage": "https://paragonie.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
||||||
|
"keywords": [
|
||||||
|
"csprng",
|
||||||
|
"polyfill",
|
||||||
|
"pseudorandom",
|
||||||
|
"random"
|
||||||
|
],
|
||||||
|
"time": "2018-07-02T15:55:56+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/log",
|
||||||
|
"version": "1.0.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/log.git",
|
||||||
|
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||||
|
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Log\\": "Psr/Log/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "http://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for logging libraries",
|
||||||
|
"homepage": "https://github.com/php-fig/log",
|
||||||
|
"keywords": [
|
||||||
|
"log",
|
||||||
|
"psr",
|
||||||
|
"psr-3"
|
||||||
|
],
|
||||||
|
"time": "2016-10-10T12:19:37+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "setasign/fpdi",
|
||||||
|
"version": "1.6.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Setasign/FPDI.git",
|
||||||
|
"reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
|
||||||
|
"reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.",
|
||||||
|
"setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.",
|
||||||
|
"setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF."
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"filters/",
|
||||||
|
"fpdi.php",
|
||||||
|
"fpdf_tpl.php",
|
||||||
|
"fpdi_pdf_parser.php",
|
||||||
|
"pdf_context.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jan Slabon",
|
||||||
|
"email": "jan.slabon@setasign.com",
|
||||||
|
"homepage": "https://www.setasign.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
|
||||||
|
"homepage": "https://www.setasign.com/fpdi",
|
||||||
|
"keywords": [
|
||||||
|
"fpdf",
|
||||||
|
"fpdi",
|
||||||
|
"pdf"
|
||||||
|
],
|
||||||
|
"time": "2017-05-11T14:25:49+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "swiftmailer/swiftmailer",
|
||||||
|
"version": "v6.1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/swiftmailer/swiftmailer.git",
|
||||||
|
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4",
|
||||||
|
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"egulias/email-validator": "~2.0",
|
||||||
|
"php": ">=7.0.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "~0.9.1",
|
||||||
|
"symfony/phpunit-bridge": "~3.3@dev"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-intl": "Needed to support internationalized email addresses",
|
||||||
|
"true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "6.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"lib/swift_required.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Chris Corbyn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Swiftmailer, free feature-rich PHP mailer",
|
||||||
|
"homepage": "https://swiftmailer.symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"email",
|
||||||
|
"mail",
|
||||||
|
"mailer"
|
||||||
|
],
|
||||||
|
"time": "2018-09-11T07:12:52+00:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packages-dev": [],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": [],
|
||||||
|
"platform-dev": []
|
||||||
|
}
|
|
@ -472,7 +472,7 @@ function print_alerts_summary_modal_window($id, $alerts) {
|
||||||
|
|
||||||
if ($alert["times_fired"] > 0) {
|
if ($alert["times_fired"] > 0) {
|
||||||
$status = STATUS_ALERT_FIRED;
|
$status = STATUS_ALERT_FIRED;
|
||||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||||
}
|
}
|
||||||
elseif ($alert["disabled"] > 0) {
|
elseif ($alert["disabled"] > 0) {
|
||||||
$status = STATUS_ALERT_DISABLED;
|
$status = STATUS_ALERT_DISABLED;
|
||||||
|
|
|
@ -14,52 +14,35 @@
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
/*
|
|
||||||
function extension_db_status_extension_tables() {
|
|
||||||
return array(
|
|
||||||
'tbackup',
|
|
||||||
'tfiles_repo',
|
|
||||||
'tfiles_repo_group',
|
|
||||||
'tipam_ip',
|
|
||||||
'tipam_network',
|
|
||||||
'tuser_task',
|
|
||||||
'tuser_task_scheduled',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function extension_db_status() {
|
function extension_db_status() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$db_user = get_parameter('db_user', '');
|
$db_user = get_parameter('db_user', '');
|
||||||
$db_password = get_parameter('db_password', '');
|
$db_password = get_parameter('db_password', '');
|
||||||
$db_host = get_parameter('db_host', '');
|
$db_host = get_parameter('db_host', '');
|
||||||
$db_name = get_parameter('db_name', '');
|
$db_name = get_parameter('db_name', '');
|
||||||
$db_status_execute = (bool)get_parameter('db_status_execute', false);
|
$db_status_execute = (bool)get_parameter('db_status_execute', false);
|
||||||
|
|
||||||
|
|
||||||
ui_print_page_header (__("DB Schema check"),
|
ui_print_page_header (__("DB Schema check"),
|
||||||
"images/extensions.png", false, "", true, "");
|
"images/extensions.png", false, "", true, "");
|
||||||
|
|
||||||
|
|
||||||
if (!is_user_admin($config['id_user'])) {
|
if (!is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access db status");
|
"Trying to access db status");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ui_print_info_message(
|
ui_print_info_message(
|
||||||
__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.'));
|
__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.'));
|
||||||
ui_print_info_message(
|
ui_print_info_message(
|
||||||
__('At the moment the checks is for MySQL/MariaDB.'));
|
__('At the moment the checks is for MySQL/MariaDB.'));
|
||||||
|
|
||||||
echo "<form method='post'>";
|
echo "<form method='post'>";
|
||||||
|
|
||||||
echo "<fieldset>";
|
echo "<fieldset>";
|
||||||
echo "<legend>" . __('DB settings') . "</legend>";
|
echo "<legend>" . __('DB settings') . "</legend>";
|
||||||
$table = null;
|
$table = new stdClass();
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
$row = array();
|
$row = array();
|
||||||
$row[] = __("DB User with privileges");
|
$row[] = __("DB User with privileges");
|
||||||
|
@ -75,175 +58,263 @@ function extension_db_status() {
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo "</fieldset>";
|
echo "</fieldset>";
|
||||||
|
|
||||||
echo "<div style='text-align: right;'>";
|
echo "<div style='text-align: right;'>";
|
||||||
html_print_input_hidden('db_status_execute', 1);
|
html_print_input_hidden('db_status_execute', 1);
|
||||||
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
|
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
|
|
||||||
if ($db_status_execute) {
|
if ($db_status_execute) {
|
||||||
extension_db_status_execute_checks($db_user, $db_password,
|
extension_db_status_execute_checks($db_user, $db_password,
|
||||||
$db_host, $db_name);
|
$db_host, $db_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function extension_db_status_execute_checks($db_user, $db_password, $db_host, $db_name) {
|
function extension_db_status_execute_checks($db_user, $db_password, $db_host, $db_name) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$connection_system = $config['dbconnection'];
|
$connection_system = $config['dbconnection'];
|
||||||
|
|
||||||
// Avoid SQL injection
|
// Avoid SQL injection
|
||||||
$db_name = io_safe_output($db_name);
|
$db_name = io_safe_output($db_name);
|
||||||
$db_name = str_replace(';', ' ', $db_name);
|
$db_name = str_replace(';', ' ', $db_name);
|
||||||
$db_name = explode(" ", $db_name);
|
$db_name = explode(" ", $db_name);
|
||||||
$db_name = $db_name[0];
|
$db_name = $db_name[0];
|
||||||
|
|
||||||
$connection_test = mysql_connect ($db_host, $db_user, $db_password);
|
if ($config["mysqli"] === true) {
|
||||||
|
$connection_test = mysqli_connect($db_host, $db_user, $db_password);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$connection_test = mysql_connect($db_host, $db_user, $db_password);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$connection_test) {
|
if (!$connection_test) {
|
||||||
ui_print_error_message(
|
ui_print_error_message(
|
||||||
__('Unsuccessful connected to the DB'));
|
__('Unsuccessful connected to the DB'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$create_db = mysql_query ("CREATE DATABASE `$db_name`");
|
if($config["mysqli"] === true){
|
||||||
|
$create_db = mysqli_query($connection_test, "CREATE DATABASE `$db_name`");
|
||||||
|
}else{
|
||||||
|
$create_db = mysql_query("CREATE DATABASE `$db_name`");
|
||||||
|
}
|
||||||
|
|
||||||
if (!$create_db) {
|
if (!$create_db) {
|
||||||
ui_print_error_message(
|
ui_print_error_message(
|
||||||
__('Unsuccessful created the testing DB'));
|
__('Unsuccessful created the testing DB'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mysql_select_db($db_name, $connection_test);
|
if ($config["mysqli"] === true) {
|
||||||
|
mysqli_select_db($connection_test, $db_name);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mysql_select_db($db_name, $connection_test);
|
||||||
|
}
|
||||||
|
|
||||||
$install_tables = extension_db_status_execute_sql_file(
|
$install_tables = extension_db_status_execute_sql_file(
|
||||||
$config['homedir'] . "/pandoradb.sql",
|
$config['homedir'] . "/pandoradb.sql",
|
||||||
$connection_test);
|
$connection_test);
|
||||||
|
|
||||||
if (!$install_tables) {
|
if (!$install_tables) {
|
||||||
ui_print_error_message(
|
ui_print_error_message(
|
||||||
__('Unsuccessful installed tables into the testing DB'));
|
__('Unsuccessful installed tables into the testing DB'));
|
||||||
}
|
}
|
||||||
else {/*
|
else {
|
||||||
if (enterprise_installed()) {
|
|
||||||
$install_tables_enterprise =
|
|
||||||
extension_db_status_execute_sql_file(
|
|
||||||
$config['homedir'] . "/enterprise/pandoradb.sql",
|
|
||||||
$connection_test);
|
|
||||||
|
|
||||||
if (!$install_tables_enterprise) {
|
|
||||||
ui_print_error_message(
|
|
||||||
__('Unsuccessful installed enterprise tables into the testing DB'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
extension_db_check_tables_differences(
|
extension_db_check_tables_differences(
|
||||||
$connection_test,
|
$connection_test,
|
||||||
$connection_system,
|
$connection_system,
|
||||||
$db_name,
|
$db_name,
|
||||||
$config['dbname']);
|
$config['dbname']);
|
||||||
//extension_db_check_data_differences();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_select_db($db_name, $connection_test);
|
if ($config["mysqli"] === true) {
|
||||||
mysql_query ("DROP DATABASE IF EXISTS `$db_name`");
|
mysqli_select_db($connection_test, $db_name);
|
||||||
|
mysqli_query($connection_test, "DROP DATABASE IF EXISTS `$db_name`");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mysql_select_db($db_name, $connection_test);
|
||||||
|
mysql_query("DROP DATABASE IF EXISTS `$db_name`", $connection_test);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function extension_db_check_tables_differences($connection_test,
|
function extension_db_check_tables_differences($connection_test,
|
||||||
$connection_system, $db_name_test, $db_name_system) {
|
$connection_system, $db_name_test, $db_name_system) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
|
||||||
// --------- Check the tables --------------------------------------
|
// --------- Check the tables --------------------------------------
|
||||||
mysql_select_db($db_name_test, $connection_test);
|
if ($config["mysqli"] === true) {
|
||||||
$result = mysql_query("SHOW TABLES", $connection_test);
|
mysqli_select_db($connection_test, $db_name_test);
|
||||||
|
$result = mysqli_query($connection_test, "SHOW TABLES");
|
||||||
|
}else{
|
||||||
|
mysql_select_db($db_name_test, $connection_test);
|
||||||
|
$result = mysql_query("SHOW TABLES", $connection_test);
|
||||||
|
}
|
||||||
|
|
||||||
$tables_test = array();
|
$tables_test = array();
|
||||||
while ($row = mysql_fetch_array ($result)) {
|
|
||||||
$tables_test[] = $row[0];
|
if ($config["mysqli"] === true) {
|
||||||
|
while ($row = mysqli_fetch_array($result)) {
|
||||||
|
$tables_test[] = $row[0];
|
||||||
|
}
|
||||||
|
mysqli_free_result($result);
|
||||||
|
|
||||||
|
mysqli_select_db($connection_test, $db_name_system);
|
||||||
|
|
||||||
|
$result = mysqli_query( $connection_test, "SHOW TABLES");
|
||||||
}
|
}
|
||||||
mysql_free_result ($result);
|
else{
|
||||||
//~ $tables_test = array_merge($tables_test,
|
while ($row = mysql_fetch_array($result)) {
|
||||||
//~ extension_db_status_extension_tables());
|
$tables_test[] = $row[0];
|
||||||
|
}
|
||||||
mysql_select_db($db_name_system, $connection_test);
|
mysql_free_result($result);
|
||||||
$result = mysql_query("SHOW TABLES", $connection_test);
|
|
||||||
|
mysql_select_db($db_name_system, $connection_test);
|
||||||
|
|
||||||
|
$result = mysql_query("SHOW TABLES", $connection_test);
|
||||||
|
}
|
||||||
|
|
||||||
$tables_system = array();
|
$tables_system = array();
|
||||||
while ($row = mysql_fetch_array ($result)) {
|
|
||||||
$tables_system[] = $row[0];
|
if ($config["mysqli"] === true) {
|
||||||
|
while ($row = mysqli_fetch_array ($result)) {
|
||||||
|
$tables_system[] = $row[0];
|
||||||
|
}
|
||||||
|
mysqli_free_result($result);
|
||||||
}
|
}
|
||||||
mysql_free_result ($result);
|
else{
|
||||||
|
while ($row = mysql_fetch_array ($result)) {
|
||||||
|
$tables_system[] = $row[0];
|
||||||
|
}
|
||||||
|
mysql_free_result($result);
|
||||||
|
}
|
||||||
|
|
||||||
$diff_tables = array_diff($tables_test, $tables_system);
|
$diff_tables = array_diff($tables_test, $tables_system);
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
!empty($diff_tables),
|
!empty($diff_tables),
|
||||||
__('Success! %s DB contains all tables', get_product_name()),
|
__('Success! %s DB contains all tables', get_product_name()),
|
||||||
__('%s DB could not retrieve all tables. The missing tables are (%s)',
|
__('%s DB could not retrieve all tables. The missing tables are (%s)',
|
||||||
get_product_name(), implode(", ", $diff_tables)));
|
get_product_name(), implode(", ", $diff_tables)));
|
||||||
|
|
||||||
if (!empty($diff_tables)) {
|
if (!empty($diff_tables)) {
|
||||||
foreach ($diff_tables as $table) {
|
foreach ($diff_tables as $table) {
|
||||||
mysql_select_db($db_name_test, $connection_test);
|
if ($config["mysqli"] === true) {
|
||||||
$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test);
|
mysqli_select_db($connection_test, $db_name_test);
|
||||||
$tables_test = array();
|
$result = mysqli_query($connection_test, "SHOW CREATE TABLE " . $table);
|
||||||
while ($row = mysql_fetch_array ($result)) {
|
$tables_test = array();
|
||||||
ui_print_info_message(
|
while ($row = mysql_fetch_array($result)) {
|
||||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
ui_print_info_message(
|
||||||
'<pre>' .
|
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||||
$row[1] .
|
'<pre>' .
|
||||||
'</pre>'
|
$row[1] .
|
||||||
);
|
'</pre>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
mysqli_free_result($result);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mysql_select_db($db_name_test, $connection_test);
|
||||||
|
$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test);
|
||||||
|
$tables_test = array();
|
||||||
|
while ($row = mysql_fetch_array($result)) {
|
||||||
|
ui_print_info_message(
|
||||||
|
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||||
|
'<pre>' .
|
||||||
|
$row[1] .
|
||||||
|
'</pre>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
mysql_free_result($result);
|
||||||
}
|
}
|
||||||
mysql_free_result ($result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------- Check the fields -------------------------------
|
// --------------- Check the fields -------------------------------
|
||||||
$correct_fields = true;
|
$correct_fields = true;
|
||||||
|
|
||||||
foreach ($tables_system as $table) {
|
foreach ($tables_system as $table) {
|
||||||
|
if ($config["mysqli"] === true) {
|
||||||
mysql_select_db($db_name_test, $connection_test);
|
mysqli_select_db($connection_test, $db_name_test);
|
||||||
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
$result = mysqli_query($connection_test, "EXPLAIN " . $table);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mysql_select_db($db_name_test, $connection_test);
|
||||||
|
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
||||||
|
}
|
||||||
|
|
||||||
$fields_test = array();
|
$fields_test = array();
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
while ($row = mysql_fetch_array ($result)) {
|
if ($config["mysqli"] === true) {
|
||||||
$fields_test[$row[0]] = array(
|
while ($row = mysqli_fetch_array ($result)) {
|
||||||
'field ' => $row[0],
|
$fields_test[$row[0]] = array(
|
||||||
'type' => $row[1],
|
'field ' => $row[0],
|
||||||
'null' => $row[2],
|
'type' => $row[1],
|
||||||
'key' => $row[3],
|
'null' => $row[2],
|
||||||
'default' => $row[4],
|
'key' => $row[3],
|
||||||
'extra' => $row[5]);
|
'default' => $row[4],
|
||||||
|
'extra' => $row[5]);
|
||||||
|
}
|
||||||
|
mysqli_free_result ($result);
|
||||||
|
mysqli_select_db($connection_test, $db_name_system);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
while ($row = mysql_fetch_array ($result)) {
|
||||||
|
$fields_test[$row[0]] = array(
|
||||||
|
'field ' => $row[0],
|
||||||
|
'type' => $row[1],
|
||||||
|
'null' => $row[2],
|
||||||
|
'key' => $row[3],
|
||||||
|
'default' => $row[4],
|
||||||
|
'extra' => $row[5]);
|
||||||
|
}
|
||||||
|
mysql_free_result ($result);
|
||||||
|
mysql_select_db($db_name_system, $connection_test);
|
||||||
}
|
}
|
||||||
mysql_free_result ($result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($config["mysqli"] === true){
|
||||||
|
$result = mysqli_query($connection_test, "EXPLAIN " . $table);
|
||||||
mysql_select_db($db_name_system, $connection_test);
|
}
|
||||||
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
else{
|
||||||
|
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
||||||
|
}
|
||||||
|
|
||||||
$fields_system = array();
|
$fields_system = array();
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
while ($row = mysql_fetch_array ($result)) {
|
if ($config["mysqli"] === true) {
|
||||||
$fields_system[$row[0]] = array(
|
while ($row = mysqli_fetch_array ($result)) {
|
||||||
'field ' => $row[0],
|
$fields_system[$row[0]] = array(
|
||||||
'type' => $row[1],
|
'field ' => $row[0],
|
||||||
'null' => $row[2],
|
'type' => $row[1],
|
||||||
'key' => $row[3],
|
'null' => $row[2],
|
||||||
'default' => $row[4],
|
'key' => $row[3],
|
||||||
'extra' => $row[5]);
|
'default' => $row[4],
|
||||||
|
'extra' => $row[5]);
|
||||||
|
}
|
||||||
|
mysqli_free_result($result);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
while ($row = mysql_fetch_array($result)) {
|
||||||
|
$fields_system[$row[0]] = array(
|
||||||
|
'field ' => $row[0],
|
||||||
|
'type' => $row[1],
|
||||||
|
'null' => $row[2],
|
||||||
|
'key' => $row[3],
|
||||||
|
'default' => $row[4],
|
||||||
|
'extra' => $row[5]);
|
||||||
|
}
|
||||||
|
mysql_free_result($result);
|
||||||
}
|
}
|
||||||
mysql_free_result ($result);
|
|
||||||
}
|
}
|
||||||
foreach ($fields_test as $name_field => $field_test) {
|
foreach ($fields_test as $name_field => $field_test) {
|
||||||
if (!isset($fields_system[$name_field])) {
|
if (!isset($fields_system[$name_field])) {
|
||||||
$correct_fields = false;
|
$correct_fields = false;
|
||||||
|
|
||||||
ui_print_error_message(
|
ui_print_error_message(
|
||||||
__('Unsuccessful the table %s has not the field %s',
|
__('Unsuccessful the table %s has not the field %s',
|
||||||
$table, $name_field));
|
$table, $name_field));
|
||||||
|
@ -257,63 +328,59 @@ function extension_db_check_tables_differences($connection_test,
|
||||||
else {
|
else {
|
||||||
$correct_fields = false;
|
$correct_fields = false;
|
||||||
$field_system = $fields_system[$name_field];
|
$field_system = $fields_system[$name_field];
|
||||||
|
|
||||||
$diff = array_diff($field_test, $field_system);
|
$diff = array_diff($field_test, $field_system);
|
||||||
|
|
||||||
if (!empty($diff)) {
|
if (!empty($diff)) {
|
||||||
$info_message = "";
|
$info_message = "";
|
||||||
$error_message = "";
|
$error_message = "";
|
||||||
if($diff['type']){
|
if($diff['type']){
|
||||||
$error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."<br>";
|
$error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($diff['null']){
|
if($diff['null']){
|
||||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").<br>";
|
$error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($diff['default']){
|
if($diff['default']){
|
||||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.<br>";
|
$error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
|
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
|
||||||
$null_defect = " NULL";
|
$null_defect = " NULL";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$null_defect = " NOT NULL";
|
$null_defect = " NOT NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($field_test['default']) || $field_test['default'] == ""){
|
if(!isset($field_test['default']) || $field_test['default'] == ""){
|
||||||
$default_value = "";
|
$default_value = "";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$default_value = " DEFAULT ".$field_test['default'];
|
$default_value = " DEFAULT ".$field_test['default'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($diff['type'] || $diff['null'] || $diff['default']){
|
if($diff['type'] || $diff['null'] || $diff['default']){
|
||||||
$info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";";
|
$info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($diff['key']){
|
if($diff['key']){
|
||||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.<br>";
|
$error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.<br>";
|
||||||
$info_message .= "<br><br>Please check the SQL file for to know the kind of key needed.";
|
$info_message .= "<br><br>Please check the SQL file for to know the kind of key needed.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($diff['extra']){
|
if($diff['extra']){
|
||||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.<br>";
|
$error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.<br>";
|
||||||
$info_message .= "<br><br>Please check the SQL file for to know the kind of extra config needed.";
|
$info_message .= "<br><br>Please check the SQL file for to know the kind of extra config needed.";
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_error_message(
|
ui_print_error_message(__($error_message));
|
||||||
__($error_message));
|
|
||||||
|
ui_print_info_message(__($info_message));
|
||||||
ui_print_info_message(
|
|
||||||
__($info_message));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($correct_fields) {
|
if ($correct_fields) {
|
||||||
ui_print_success_message(
|
ui_print_success_message(
|
||||||
__('Successful all the tables have the correct fields')
|
__('Successful all the tables have the correct fields')
|
||||||
|
@ -322,6 +389,7 @@ function extension_db_check_tables_differences($connection_test,
|
||||||
}
|
}
|
||||||
|
|
||||||
function extension_db_status_execute_sql_file($url, $connection) {
|
function extension_db_status_execute_sql_file($url, $connection) {
|
||||||
|
global $config;
|
||||||
if (file_exists($url)) {
|
if (file_exists($url)) {
|
||||||
$file_content = file($url);
|
$file_content = file($url);
|
||||||
$query = "";
|
$query = "";
|
||||||
|
@ -329,10 +397,19 @@ function extension_db_status_execute_sql_file($url, $connection) {
|
||||||
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
|
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
|
||||||
$query .= $sql_line;
|
$query .= $sql_line;
|
||||||
if (preg_match("/;[\040]*\$/", $sql_line)) {
|
if (preg_match("/;[\040]*\$/", $sql_line)) {
|
||||||
if (!$result = mysql_query($query, $connection)) {
|
if ($config["mysqli"] === true) {
|
||||||
echo mysql_error(); //Uncomment for debug
|
if (!$result = mysqli_query($connection, $query)) {
|
||||||
echo "<i><br>$query<br></i>";
|
echo mysqli_error(); //Uncomment for debug
|
||||||
return 0;
|
echo "<i><br>$query<br></i>";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if (!$result = mysql_query($query, $connection)) {
|
||||||
|
echo mysql_error(); //Uncomment for debug
|
||||||
|
echo "<i><br>$query<br></i>";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$query = "";
|
$query = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,123 +16,80 @@
|
||||||
|
|
||||||
function dbmanager_query ($sql, &$error, $dbconnection) {
|
function dbmanager_query ($sql, &$error, $dbconnection) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
|
||||||
case "mysql":
|
|
||||||
$retval = array();
|
|
||||||
|
|
||||||
if ($sql == '')
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$sql = html_entity_decode($sql, ENT_QUOTES);
|
|
||||||
if ($config["mysqli"]) {
|
|
||||||
$result = mysqli_query ($dbconnection, $sql);
|
|
||||||
if ($result === false) {
|
|
||||||
$backtrace = debug_backtrace ();
|
|
||||||
$error = mysqli_error ($dbconnection);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$result = mysql_query ($sql, $dbconnection);
|
|
||||||
if ($result === false) {
|
|
||||||
$backtrace = debug_backtrace ();
|
|
||||||
$error = mysql_error ();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result === true) {
|
|
||||||
if($config["mysqli"]){
|
|
||||||
return mysqli_affected_rows ($dbconnection);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return mysql_affected_rows ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($config["mysqli"]){
|
|
||||||
while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) {
|
|
||||||
array_push ($retval, $row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
|
|
||||||
array_push ($retval, $row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($config["mysqli"]){
|
$retval = array();
|
||||||
mysqli_free_result ($result);
|
|
||||||
}
|
if ($sql == '')
|
||||||
else{
|
return false;
|
||||||
mysql_free_result ($result);
|
|
||||||
}
|
$sql = html_entity_decode($sql, ENT_QUOTES);
|
||||||
|
if ($config["mysqli"]) {
|
||||||
if (! empty ($retval))
|
$result = mysqli_query ($dbconnection, $sql);
|
||||||
return $retval;
|
if ($result === false) {
|
||||||
|
$backtrace = debug_backtrace ();
|
||||||
//Return false, check with === or !==
|
$error = mysqli_error ($dbconnection);
|
||||||
return "Empty";
|
return false;
|
||||||
break;
|
}
|
||||||
case "postgresql":
|
|
||||||
case "oracle":
|
|
||||||
$retval = array();
|
|
||||||
|
|
||||||
if ($sql == '')
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$sql = html_entity_decode($sql, ENT_QUOTES);
|
|
||||||
|
|
||||||
$result = db_process_sql($sql, "affected_rows", '', false, $status);
|
|
||||||
|
|
||||||
//$result = mysql_query ($sql);
|
|
||||||
if ($result === false) {
|
|
||||||
$backtrace = debug_backtrace();
|
|
||||||
$error = db_get_last_error();
|
|
||||||
|
|
||||||
if (empty($error)) {
|
|
||||||
return "Empty";
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($status == 2) {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
$result = mysql_query ($sql, $dbconnection);
|
||||||
|
if ($result === false) {
|
||||||
|
$backtrace = debug_backtrace ();
|
||||||
|
$error = mysql_error ();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result === true) {
|
||||||
|
if($config["mysqli"]){
|
||||||
|
return mysqli_affected_rows ($dbconnection);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return mysql_affected_rows ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($config["mysqli"]){
|
||||||
|
while ($row = mysqli_fetch_array ($result, MYSQLI_ASSOC)) {
|
||||||
|
array_push ($retval, $row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
|
||||||
|
array_push ($retval, $row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($config["mysqli"]){
|
||||||
|
mysqli_free_result ($result);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mysql_free_result ($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty ($retval))
|
||||||
|
return $retval;
|
||||||
|
|
||||||
|
//Return false, check with === or !==
|
||||||
|
return "Empty";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function dbmgr_extension_main () {
|
function dbmgr_extension_main () {
|
||||||
ui_require_css_file ('dbmanager', 'extensions/dbmanager/');
|
ui_require_css_file ('dbmanager', 'extensions/dbmanager/');
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (!is_user_admin($config['id_user'])) {
|
if (!is_user_admin($config['id_user'])) {
|
||||||
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
|
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Disabled at the moment.
|
|
||||||
if (!check_referer()) {
|
|
||||||
require ("general/noaccess.php");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sql = (string) get_parameter ('sql');
|
$sql = (string) get_parameter ('sql');
|
||||||
|
|
||||||
ui_print_page_header (__('Database interface'), "images/gm_db.png", false, false, true);
|
ui_print_page_header (__('Database interface'), "images/gm_db.png", false, false, true);
|
||||||
|
|
||||||
echo '<div class="notify">';
|
echo '<div class="notify">';
|
||||||
echo __("This is an advanced extension to interface with %s database directly from WEB console
|
echo __("This is an advanced extension to interface with %s database directly from WEB console
|
||||||
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
|
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
|
||||||
|
@ -142,10 +99,10 @@ function dbmgr_extension_main () {
|
||||||
with a depth knowledge of %s internals.",
|
with a depth knowledge of %s internals.",
|
||||||
get_product_name(), get_product_name(), get_product_name());
|
get_product_name(), get_product_name(), get_product_name());
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
|
echo "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
|
||||||
|
|
||||||
echo "<br /><br />";
|
echo "<br /><br />";
|
||||||
echo "<form method='post' action=''>";
|
echo "<form method='post' action=''>";
|
||||||
html_print_textarea ('sql', 5, 50, html_entity_decode($sql, ENT_QUOTES));
|
html_print_textarea ('sql', 5, 50, html_entity_decode($sql, ENT_QUOTES));
|
||||||
|
@ -155,45 +112,45 @@ function dbmgr_extension_main () {
|
||||||
html_print_submit_button (__('Execute SQL'), '', false, 'class="sub next"');
|
html_print_submit_button (__('Execute SQL'), '', false, 'class="sub next"');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
|
|
||||||
// Processing SQL Code
|
// Processing SQL Code
|
||||||
if ($sql == '')
|
if ($sql == '')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<hr />";
|
echo "<hr />";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
|
|
||||||
$dbconnection = $config['dbconnection'];
|
$dbconnection = $config['dbconnection'];
|
||||||
$error = '';
|
$error = '';
|
||||||
|
|
||||||
$result = dbmanager_query ($sql, $error, $dbconnection);
|
$result = dbmanager_query ($sql, $error, $dbconnection);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
echo '<strong>An error has occured when querying the database.</strong><br />';
|
echo '<strong>An error has occured when querying the database.</strong><br />';
|
||||||
echo $error;
|
echo $error;
|
||||||
|
|
||||||
db_pandora_audit("DB Interface Extension", "Error in SQL", false, false, $sql);
|
db_pandora_audit("DB Interface Extension", "Error in SQL", false, false, $sql);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! is_array ($result)) {
|
if (! is_array ($result)) {
|
||||||
echo "<strong>Output: <strong>".$result;
|
echo "<strong>Output: <strong>".$result;
|
||||||
|
|
||||||
db_pandora_audit("DB Interface Extension", "SQL", false, false, $sql);
|
db_pandora_audit("DB Interface Extension", "SQL", false, false, $sql);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<div style='overflow: auto;'>";
|
echo "<div style='overflow: auto;'>";
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox data';
|
$table->class = 'databox data';
|
||||||
$table->head = array_keys ($result[0]);
|
$table->head = array_keys ($result[0]);
|
||||||
|
|
||||||
$table->data = $result;
|
$table->data = $result;
|
||||||
|
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ function createXMLData($agent, $agentModule, $time, $data) {
|
||||||
$data
|
$data
|
||||||
);
|
);
|
||||||
|
|
||||||
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . str_replace($time, " ", "_") . ".data";
|
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . strtotime($time) . ".data";
|
||||||
return (bool) @file_put_contents($file_name, $xml);
|
return (bool) @file_put_contents($file_name, $xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ function mainInsertData() {
|
||||||
$utimestamp = strtotime($date . " " . $time) - get_fixed_offset();
|
$utimestamp = strtotime($date . " " . $time) - get_fixed_offset();
|
||||||
$timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp);
|
$timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp);
|
||||||
$result = createXMLData($agent, $agentModule, $timestamp, $data);
|
$result = createXMLData($agent, $agentModule, $timestamp, $data);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$done++;
|
$done++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,15 @@ switch($graph) {
|
||||||
if (count($data_array) > 1) {
|
if (count($data_array) > 1) {
|
||||||
$data = $data_array[1];
|
$data = $data_array[1];
|
||||||
}
|
}
|
||||||
|
// Redefine boolean data
|
||||||
|
switch ($data) {
|
||||||
|
case "up(1)":
|
||||||
|
$data = 1;
|
||||||
|
break;
|
||||||
|
case "down(0)":
|
||||||
|
$data = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
|
||||||
|
|
||||||
|
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -1180,13 +1180,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 21);
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 22);
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '728');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '729');
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tconfig_os`
|
-- Table `tconfig_os`
|
||||||
|
@ -1230,6 +1230,7 @@ ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REF
|
||||||
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
|
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
|
||||||
alter table tusuario add autorefresh_white_list text not null default '';
|
alter table tusuario add autorefresh_white_list text not null default '';
|
||||||
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
|
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
|
||||||
|
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tagente_modulo`
|
-- Table `tagente_modulo`
|
||||||
|
@ -1740,6 +1741,8 @@ CREATE TABLE IF NOT EXISTS `tlayout_template` (
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tlayout_template_data`
|
-- Table `tlayout_template_data`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
|
|
@ -198,8 +198,12 @@ echo "<div class='modalgobutton gopandora'>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(".cerrar").click(function(){
|
$(".cerrar").click(function(){
|
||||||
$("#alert_messages").hide();
|
$("#alert_messages")
|
||||||
$( "#opacidad" ).remove();
|
.css('opacity', 0)
|
||||||
|
.hide();
|
||||||
|
$( "#opacidad" )
|
||||||
|
.css('opacity', 0)
|
||||||
|
.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".gopandora").click(function(){
|
$(".gopandora").click(function(){
|
||||||
|
|
|
@ -70,9 +70,10 @@ switch ($login_screen) {
|
||||||
$logo_link = 'index.php';
|
$logo_link = 'index.php';
|
||||||
$logo_title = __('Refresh');
|
$logo_title = __('Refresh');
|
||||||
break;
|
break;
|
||||||
$splash_title = __('Splash login');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$splash_title = __('Splash login');
|
||||||
|
|
||||||
$url = '?login=1';
|
$url = '?login=1';
|
||||||
//These variables come from index.php
|
//These variables come from index.php
|
||||||
if (!empty ($page) && !empty ($sec)) {
|
if (!empty ($page) && !empty ($sec)) {
|
||||||
|
@ -303,7 +304,7 @@ echo '</div>';
|
||||||
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '') . '</div>';
|
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '') . '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
if ($process_error_message == '' && $mail != "") {
|
if (!isset($process_error_message) && isset($mail)) {
|
||||||
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
||||||
echo '<div class="content_alert">';
|
echo '<div class="content_alert">';
|
||||||
echo '<div class="icon_message_alert">';
|
echo '<div class="icon_message_alert">';
|
||||||
|
@ -315,13 +316,13 @@ if ($process_error_message == '' && $mail != "") {
|
||||||
echo '<p>' . __('An email has been sent to your email address') . '</p>';
|
echo '<p>' . __('An email has been sent to your email address') . '</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button("Ok", 'reset_correct_button', false);
|
html_print_submit_button("Ok", 'reset_correct_button', false);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
else if ($process_error_message != '') {
|
else if (isset($process_error_message)) {
|
||||||
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
||||||
echo '<div class="content_alert">';
|
echo '<div class="content_alert">';
|
||||||
echo '<div class="icon_message_alert">';
|
echo '<div class="icon_message_alert">';
|
||||||
|
@ -333,7 +334,7 @@ else if ($process_error_message != '') {
|
||||||
echo '<p>' . $process_error_message . '</p>';
|
echo '<p>' . $process_error_message . '</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button("Ok", 'reset_correct_button', false);
|
html_print_submit_button("Ok", 'reset_correct_button', false);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
@ -341,7 +342,7 @@ else if ($process_error_message != '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($correct_reset_pass_process != "") {
|
if (isset($correct_reset_pass_process)) {
|
||||||
echo '<div id="final_process_correct" title="' . __('Password reset') . '">';
|
echo '<div id="final_process_correct" title="' . __('Password reset') . '">';
|
||||||
echo '<div class="content_alert">';
|
echo '<div class="content_alert">';
|
||||||
echo '<div class="icon_message_alert">';
|
echo '<div class="icon_message_alert">';
|
||||||
|
@ -353,7 +354,7 @@ if ($correct_reset_pass_process != "") {
|
||||||
echo '<p>' . $correct_reset_pass_process . '</p>';
|
echo '<p>' . $correct_reset_pass_process . '</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="button_message_alert">';
|
echo '<div class="button_message_alert">';
|
||||||
html_print_submit_button("Ok", 'final_process_correct_button', false);
|
html_print_submit_button("Ok", 'final_process_correct_button', false);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
|
@ -92,8 +92,8 @@ echo '<div id="login_id_dialog" title="' .
|
||||||
|
|
||||||
if ($zone_selected == "") {
|
if ($zone_selected == "") {
|
||||||
if ($config["timezone"] != "") {
|
if ($config["timezone"] != "") {
|
||||||
list($zone) = explode("/", $config["timezone"]);
|
$zone_array = explode("/", $config["timezone"]);
|
||||||
$zone_selected = $zone;
|
$zone_selected = $zone_array[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$zone_selected = 'Europe';
|
$zone_selected = 'Europe';
|
||||||
|
@ -102,7 +102,7 @@ echo '<div id="login_id_dialog" title="' .
|
||||||
|
|
||||||
$timezones = timezone_identifiers_list();
|
$timezones = timezone_identifiers_list();
|
||||||
foreach ($timezones as $timezone) {
|
foreach ($timezones as $timezone) {
|
||||||
if (strpos($timezone, $zone_selected) !== false) {
|
if (strpos($timezone, $zone_selected) !== false) {
|
||||||
$timezone_country = preg_replace('/^.*\//', '', $timezone);
|
$timezone_country = preg_replace('/^.*\//', '', $timezone);
|
||||||
$timezone_n[$timezone] = $timezone_country;
|
$timezone_n[$timezone] = $timezone_country;
|
||||||
}
|
}
|
||||||
|
@ -195,8 +195,9 @@ $("#language").click(function () {
|
||||||
{"page": "general/login_required",
|
{"page": "general/login_required",
|
||||||
"change_language": change_language},
|
"change_language": change_language},
|
||||||
function (data) {}
|
function (data) {}
|
||||||
);
|
).done(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -210,6 +210,7 @@ if (!empty($all_data)) {
|
||||||
echo '<div id="activity">';
|
echo '<div id="activity">';
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
|
$table->class = "databox data";
|
||||||
$table->width = '100%'; //Don't specify px
|
$table->width = '100%'; //Don't specify px
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
$table->size = array ();
|
$table->size = array ();
|
||||||
|
@ -274,7 +275,12 @@ if (!empty($all_data)) {
|
||||||
. human_time_comparation($session['utimestamp'], 'tiny');
|
. human_time_comparation($session['utimestamp'], 'tiny');
|
||||||
$data[3] = $session_ip_origen;
|
$data[3] = $session_ip_origen;
|
||||||
$description = str_replace(array(',', ', '), ', ', $session['descripcion']);
|
$description = str_replace(array(',', ', '), ', ', $session['descripcion']);
|
||||||
$data[4] = '<div >' . io_safe_output($description) . '</div>';
|
if(strlen($description)>100){
|
||||||
|
$data[4] = '<div >' . io_safe_output(substr($description, 0, 150).'...') . '</div>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$data[4] = '<div >' . io_safe_output($description) . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ foreach ($result as $row) {
|
||||||
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
|
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
|
||||||
. ui_print_timestamp($row["utimestamp"], true);
|
. ui_print_timestamp($row["utimestamp"], true);
|
||||||
$data[3] = $row["ip_origen"];
|
$data[3] = $row["ip_origen"];
|
||||||
$data[4] = $row["descripcion"];
|
$data[4] = io_safe_output($row["descripcion"]);
|
||||||
|
|
||||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||||
$data[5] = enterprise_hook("cell1EntepriseAudit", array($row["id_sesion"]));
|
$data[5] = enterprise_hook("cell1EntepriseAudit", array($row["id_sesion"]));
|
||||||
|
|
|
@ -541,7 +541,7 @@ if (!empty($interfaces_list)) {
|
||||||
$table->data[0][1] = '';
|
$table->data[0][1] = '';
|
||||||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||||
|
|
||||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;');
|
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
|
||||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||||
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||||
|
|
|
@ -1772,13 +1772,15 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
|
||||||
// =====================
|
// =====================
|
||||||
if ($enable_module) {
|
if ($enable_module) {
|
||||||
$result = modules_change_disabled($enable_module, 0);
|
$result = modules_change_disabled($enable_module, 0);
|
||||||
|
$modulo_nombre = db_get_row_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$enable_module."");
|
||||||
|
$modulo_nombre = $modulo_nombre['nombre'];
|
||||||
|
|
||||||
if ($result === NOERR) {
|
if ($result === NOERR) {
|
||||||
enterprise_hook('config_agents_enable_module_conf', array($id_agente, $enable_module));
|
enterprise_hook('config_agents_enable_module_conf', array($id_agente, $enable_module));
|
||||||
db_pandora_audit("Module management", 'Enable ' . $enable_module);
|
db_pandora_audit("Module management", 'Enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_pandora_audit("Module management", 'Fail to enable ' . $enable_module);
|
db_pandora_audit("Module management", 'Fail to enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
|
@ -1787,13 +1789,15 @@ if ($enable_module) {
|
||||||
|
|
||||||
if ($disable_module) {
|
if ($disable_module) {
|
||||||
$result = modules_change_disabled($disable_module, 1);
|
$result = modules_change_disabled($disable_module, 1);
|
||||||
|
$modulo_nombre = db_get_row_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$disable_module."");
|
||||||
|
$modulo_nombre = $modulo_nombre['nombre'];
|
||||||
|
|
||||||
if ($result === NOERR) {
|
if ($result === NOERR) {
|
||||||
enterprise_hook('config_agents_disable_module_conf', array($id_agente, $disable_module));
|
enterprise_hook('config_agents_disable_module_conf', array($id_agente, $disable_module));
|
||||||
db_pandora_audit("Module management", 'Disable ' . $disable_module);
|
db_pandora_audit("Module management", 'Disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_pandora_audit("Module management", 'Fail to disable ' . $disable_module);
|
db_pandora_audit("Module management", 'Fail to disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
|
|
|
@ -481,15 +481,14 @@ if ($agents !== false) {
|
||||||
|
|
||||||
if($agent["id_os"] == 100){
|
if($agent["id_os"] == 100){
|
||||||
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
||||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.$agent['nombre'].'</a>';
|
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.$agent['alias'].'</a>';
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
echo "<a alt =".$agent["nombre"]." href='index.php?sec=gagente&
|
echo "<a alt =".$agent["nombre"]." href='index.php?sec=gagente&
|
||||||
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
|
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
|
||||||
id_agente=" . $agent["id_agente"] . "'>" .
|
id_agente=" . $agent["id_agente"] . "'>" .
|
||||||
'<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
|
'<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
|
||||||
"</a>";
|
"</a>";
|
||||||
}
|
}
|
||||||
echo "</strong>";
|
echo "</strong>";
|
||||||
|
|
||||||
$in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime
|
$in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime
|
||||||
|
|
|
@ -139,7 +139,7 @@ if (($policy_page) || (isset($agent))) {
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
}
|
}
|
||||||
echo '<td class="datos" style="font-weight: bold; width:20%;">';
|
echo '<td class="datos" style="font-weight: bold; width:20%;">';
|
||||||
echo __("Type");
|
echo __("<p>Type</p>");
|
||||||
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
|
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
|
||||||
html_print_input_hidden ('edit_module', 1);
|
html_print_input_hidden ('edit_module', 1);
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
@ -313,7 +313,7 @@ $selectIntervalUp = '';
|
||||||
$selectIntervalDown = '';
|
$selectIntervalDown = '';
|
||||||
$sortField = get_parameter('sort_field');
|
$sortField = get_parameter('sort_field');
|
||||||
$sort = get_parameter('sort', 'none');
|
$sort = get_parameter('sort', 'none');
|
||||||
$selected = 'border: 1px solid black;';
|
$selected = '';
|
||||||
|
|
||||||
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
|
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
|
||||||
|
|
||||||
|
@ -547,7 +547,8 @@ $table->head[7] = __('Warn');
|
||||||
|
|
||||||
|
|
||||||
$table->head[8] = __('Action');
|
$table->head[8] = __('Action');
|
||||||
$table->head[9] = '<span title="' . __('Delete') . '">' . __('D.') . '</span>';
|
$table->head[9] = '<span title="' . __('Delete') . '">' . __('Del.') . '</span>'.
|
||||||
|
html_print_checkbox('all_delete', 0, false, true, false);
|
||||||
|
|
||||||
$table->rowstyle = array();
|
$table->rowstyle = array();
|
||||||
$table->style = array ();
|
$table->style = array ();
|
||||||
|
@ -607,7 +608,7 @@ foreach ($modules as $module) {
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
|
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
|
||||||
$table->colspan[$i - 1][0] = 10;
|
$table->colspan[$i - 1][0] = 10;
|
||||||
else
|
else
|
||||||
$table->colspan[$i - 1][0] = 8;
|
$table->colspan[$i - 1][0] = 9;
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
}
|
}
|
||||||
|
@ -778,12 +779,13 @@ foreach ($modules as $module) {
|
||||||
|
|
||||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||||
// Delete module
|
// Delete module
|
||||||
$data[9] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
|
||||||
$data[9] .= ' <a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||||
$data[9] .= html_print_image ('images/cross.png', true,
|
$data[9] .= html_print_image ('images/cross.png', true,
|
||||||
array ('title' => __('Delete')));
|
array ('title' => __('Delete')));
|
||||||
$data[9] .= '</a> ';
|
$data[9] .= '</a> ';
|
||||||
|
$data[9] .= html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
@ -807,17 +809,32 @@ if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
$('[id^=checkbox-id_delete]').change(function(){
|
$('[id^=checkbox-id_delete]').change(function(){
|
||||||
if($(this).parent().parent().hasClass('checkselected')){
|
if($(this).parent().parent().hasClass('checkselected')){
|
||||||
$(this).parent().parent().removeClass('checkselected');
|
$(this).parent().parent().removeClass('checkselected');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$(this).parent().parent().addClass('checkselected');
|
$(this).parent().parent().addClass('checkselected');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
$('[id^=checkbox-all_delete]').change(function(){
|
||||||
|
if ($("#checkbox-all_delete").prop("checked")) {
|
||||||
|
$('[id^=checkbox-id_delete]').parent().parent().addClass('checkselected');
|
||||||
|
$("[name^=id_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('[id^=checkbox-id_delete]').parent().parent().removeClass('checkselected');
|
||||||
|
$("[name^=id_delete").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function change_mod_filter() {
|
function change_mod_filter() {
|
||||||
var checked = $("#checkbox-status_hierachy_mode").is(":checked");
|
var checked = $("#checkbox-status_hierachy_mode").is(":checked");
|
||||||
|
|
|
@ -34,6 +34,11 @@ if (is_ajax ()) {
|
||||||
|
|
||||||
// Decrypt passwords in the component.
|
// Decrypt passwords in the component.
|
||||||
$component['plugin_pass'] = io_output_password($component['plugin_pass']);
|
$component['plugin_pass'] = io_output_password($component['plugin_pass']);
|
||||||
|
|
||||||
|
$component['str_warning'] = io_safe_output($component['str_warning']);
|
||||||
|
$component['str_critical'] = io_safe_output($component['str_critical']);
|
||||||
|
$component['warning_inverse'] = (bool)$component['warning_inverse'];
|
||||||
|
$component['critical_inverse'] = (bool)$component['critical_inverse'];
|
||||||
|
|
||||||
echo io_json_mb_encode ($component);
|
echo io_json_mb_encode ($component);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -179,9 +179,23 @@ if ($create_action) {
|
||||||
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
|
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
|
||||||
|
/* Show errors */
|
||||||
|
if (!isset($messageAction)) {
|
||||||
|
$messageAction = __('Could not be created');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name == "") {
|
||||||
|
$messageAction = __('No name specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_alert_command == "") {
|
||||||
|
$messageAction = __('No command specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
$messageAction = ui_print_result_message ($result,
|
||||||
__('Successfully created'),
|
__('Successfully created'),
|
||||||
__('Could not be created'));
|
$messageAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update_action) {
|
if ($update_action) {
|
||||||
|
|
|
@ -307,9 +307,22 @@ if ($create_command) {
|
||||||
db_pandora_audit("Command management", "Fail try to create alert command", false, false);
|
db_pandora_audit("Command management", "Fail try to create alert command", false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
/* Show errors */
|
||||||
|
if (!isset($messageAction)) {
|
||||||
|
$messageAction = __('Could not be created');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name == "") {
|
||||||
|
$messageAction = __('No name specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($command == "") {
|
||||||
|
$messageAction = __('No command specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
$messageAction = ui_print_result_message ($result,
|
||||||
__('Successfully created'),
|
__('Successfully created'),
|
||||||
__('Could not be created'));
|
$messageAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -102,16 +102,8 @@ if ($groups_user === false) {
|
||||||
$groups_id = implode(',', array_keys($groups_user));
|
$groups_id = implode(',', array_keys($groups_user));
|
||||||
|
|
||||||
$form_filter .= "<tr>";
|
$form_filter .= "<tr>";
|
||||||
switch ($config["dbtype"]) {
|
|
||||||
case "mysql":
|
|
||||||
case "postgresql":
|
|
||||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
|
|
||||||
break;
|
|
||||||
case "oracle":
|
|
||||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id)");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
|
||||||
$arrayActions = array();
|
$arrayActions = array();
|
||||||
if (is_array($temp)) {
|
if (is_array($temp)) {
|
||||||
foreach ($temp as $actionElement) {
|
foreach ($temp as $actionElement) {
|
||||||
|
@ -186,23 +178,10 @@ if ($searchFlag) {
|
||||||
field3_recovery LIKE '%" . trim($fieldContent) . "%')";
|
field3_recovery LIKE '%" . trim($fieldContent) . "%')";
|
||||||
if (strlen(trim($moduleName)) > 0)
|
if (strlen(trim($moduleName)) > 0)
|
||||||
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%" . trim($moduleName) . "%')";
|
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%" . trim($moduleName) . "%')";
|
||||||
//if ($agentID != -1)
|
|
||||||
//$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = " . $agentID . ")";
|
|
||||||
if (strlen(trim($agentName)) > 0) {
|
if (strlen(trim($agentName)) > 0) {
|
||||||
|
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
||||||
switch ($config["dbtype"]) {
|
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
||||||
case "mysql":
|
WHERE t1.alias LIKE '" . trim($agentName) . "')";
|
||||||
case "postgresql":
|
|
||||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
|
||||||
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
|
||||||
WHERE t1.alias LIKE '" . trim($agentName) . "')";
|
|
||||||
break;
|
|
||||||
case "oracle":
|
|
||||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
|
||||||
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
|
||||||
WHERE t1.alias LIKE '" . trim($agentName) . "')";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($actionID != -1 && $actionID != '')
|
if ($actionID != -1 && $actionID != '')
|
||||||
$where .= " AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")";
|
$where .= " AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")";
|
||||||
|
@ -212,17 +191,7 @@ if ($searchFlag) {
|
||||||
$where .= " AND talert_template_modules.standby = " . $standby;
|
$where .= " AND talert_template_modules.standby = " . $standby;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
$id_agents = array_keys ($agents);
|
||||||
case "mysql":
|
|
||||||
case "postgresql":
|
|
||||||
$id_agents = array_keys ($agents);
|
|
||||||
break;
|
|
||||||
case "oracle":
|
|
||||||
$id_agents = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$total = agents_get_alerts_simple ($id_agents, false,
|
$total = agents_get_alerts_simple ($id_agents, false,
|
||||||
false, $where, false, false, false, true);
|
false, $where, false, false, false, true);
|
||||||
|
@ -645,7 +614,7 @@ foreach ($simple_alerts as $alert) {
|
||||||
|
|
||||||
if ($alert["times_fired"] > 0) {
|
if ($alert["times_fired"] > 0) {
|
||||||
$status = STATUS_ALERT_FIRED;
|
$status = STATUS_ALERT_FIRED;
|
||||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||||
}
|
}
|
||||||
elseif ($alert["disabled"] > 0) {
|
elseif ($alert["disabled"] > 0) {
|
||||||
$status = STATUS_ALERT_DISABLED;
|
$status = STATUS_ALERT_DISABLED;
|
||||||
|
@ -704,27 +673,32 @@ foreach ($simple_alerts as $alert) {
|
||||||
// To manage alert is necessary LW permissions in the agent group
|
// To manage alert is necessary LW permissions in the agent group
|
||||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
||||||
$data[4] .= ' <form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
|
$data[4] .= ' <form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
|
||||||
if ($alert['disabled']) {
|
$is_cluster = (bool)get_parameter('id_cluster');
|
||||||
|
if (!$is_cluster) {
|
||||||
}
|
if ($alert['disabled']) {
|
||||||
else {
|
$data[4] .= html_print_image('images/add.disabled.png',
|
||||||
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
|
true, array('title' => __("Add action")));
|
||||||
|
}
|
||||||
$data[4] .= '</a>';
|
else {
|
||||||
|
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
|
||||||
|
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
|
||||||
|
$data[4] .= '</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
|
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
|
||||||
$data[4] .= html_print_input_hidden ('delete_alert', 1, true);
|
$data[4] .= html_print_input_hidden ('delete_alert', 1, true);
|
||||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||||
$data[4] .= '</form>';
|
$data[4] .= '</form>';
|
||||||
|
|
||||||
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">';
|
if ($is_cluster) {
|
||||||
|
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">';
|
||||||
|
|
||||||
$data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update')));
|
$data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update')));
|
||||||
$data[4] .= html_print_input_hidden ('upd_alert', 1, true);
|
$data[4] .= html_print_input_hidden ('upd_alert', 1, true);
|
||||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||||
|
|
||||||
$data[4] .= '</form>';
|
$data[4] .= '</form>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
||||||
|
|
|
@ -126,9 +126,24 @@ if ($create_alert) {
|
||||||
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'");
|
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$messageAction = ui_print_result_message ($id,
|
|
||||||
__('Successfully created'), __('Could not be created'), '', true);
|
/* Show errors */
|
||||||
|
if (!isset($messageAction)) {
|
||||||
|
$messageAction = __('Could not be created');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_alert_template == "") {
|
||||||
|
$messageAction = __('No template specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_agent_module == "") {
|
||||||
|
$messageAction = __('No module specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
$messageAction = ui_print_result_message ($id,
|
||||||
|
__('Successfully created'), $messageAction, '', true);
|
||||||
|
|
||||||
|
|
||||||
if ($id !== false) {
|
if ($id !== false) {
|
||||||
$action_select = get_parameter('action_select');
|
$action_select = get_parameter('action_select');
|
||||||
|
|
||||||
|
|
|
@ -112,8 +112,14 @@ if ($create_special_day) {
|
||||||
$values = array();
|
$values = array();
|
||||||
$values['id_group'] = (string) get_parameter ('id_group');
|
$values['id_group'] = (string) get_parameter ('id_group');
|
||||||
$values['description'] = (string) get_parameter ('description');
|
$values['description'] = (string) get_parameter ('description');
|
||||||
|
|
||||||
list($year, $month, $day) = explode("-", $date);
|
|
||||||
|
$array_date = explode("-", $date);
|
||||||
|
|
||||||
|
$year = $array_date[0];
|
||||||
|
$month = $array_date[1];
|
||||||
|
$day = $array_date[2];
|
||||||
|
|
||||||
if ($year == '*') {
|
if ($year == '*') {
|
||||||
# '0001' means every year.
|
# '0001' means every year.
|
||||||
$year = '0001';
|
$year = '0001';
|
||||||
|
@ -130,6 +136,7 @@ if ($create_special_day) {
|
||||||
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
|
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
|
||||||
if ($date_check == $date) {
|
if ($date_check == $date) {
|
||||||
$result = '';
|
$result = '';
|
||||||
|
$messageAction = __('Could not be created, it already exists');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = alerts_create_alert_special_day ($date, $same_day, $values);
|
$result = alerts_create_alert_special_day ($date, $same_day, $values);
|
||||||
|
@ -143,10 +150,16 @@ if ($create_special_day) {
|
||||||
else {
|
else {
|
||||||
db_pandora_audit("Command management", "Fail try to create special day", false, false);
|
db_pandora_audit("Command management", "Fail try to create special day", false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
|
||||||
|
/* Show errors */
|
||||||
|
if (!isset($messageAction)) {
|
||||||
|
$messageAction = __('Could not be created');
|
||||||
|
}
|
||||||
|
|
||||||
|
$messageAction = ui_print_result_message ($result,
|
||||||
__('Successfully created'),
|
__('Successfully created'),
|
||||||
__('Could not be created'));
|
$messageAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update_special_day) {
|
if ($update_special_day) {
|
||||||
|
@ -158,20 +171,25 @@ if ($update_special_day) {
|
||||||
$description = (string) get_parameter ('description');
|
$description = (string) get_parameter ('description');
|
||||||
$id_group = (string) get_parameter ('id_group');
|
$id_group = (string) get_parameter ('id_group');
|
||||||
$id_group_orig = (string) get_parameter ('id_group_orig');
|
$id_group_orig = (string) get_parameter ('id_group_orig');
|
||||||
|
|
||||||
list($year, $month, $day) = explode("-", $date);
|
$array_date = explode("-", $date);
|
||||||
|
|
||||||
|
$year = $array_date[0];
|
||||||
|
$month = $array_date[1];
|
||||||
|
$day = $array_date[2];
|
||||||
|
|
||||||
if ($year == '*') {
|
if ($year == '*') {
|
||||||
# '0001' means every year.
|
# '0001' means every year.
|
||||||
$year = '0001';
|
$year = '0001';
|
||||||
$date = $year . '-' . $month . '-' . $day;
|
$date = $year . '-' . $month . '-' . $day;
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = array ();
|
$values = array ();
|
||||||
$values['date'] = $date;
|
$values['date'] = $date;
|
||||||
$values['id_group'] = $id_group;
|
$values['id_group'] = $id_group;
|
||||||
$values['same_day'] = $same_day;
|
$values['same_day'] = $same_day;
|
||||||
$values['description'] = $description;
|
$values['description'] = $description;
|
||||||
|
|
||||||
if (!checkdate ($month, $day, $year)) {
|
if (!checkdate ($month, $day, $year)) {
|
||||||
$result = '';
|
$result = '';
|
||||||
}
|
}
|
||||||
|
@ -183,6 +201,7 @@ if ($update_special_day) {
|
||||||
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
|
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
|
||||||
if ($date_check == $date) {
|
if ($date_check == $date) {
|
||||||
$result = '';
|
$result = '';
|
||||||
|
$messageAction = __('Could not be updated, it already exists');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = alerts_update_alert_special_day ($id, $values);
|
$result = alerts_update_alert_special_day ($id, $values);
|
||||||
|
@ -202,9 +221,15 @@ if ($update_special_day) {
|
||||||
db_pandora_audit("Command management", "Fail to update special day " . $id, false, false);
|
db_pandora_audit("Command management", "Fail to update special day " . $id, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
|
||||||
|
/* Show errors */
|
||||||
|
if (!isset($messageAction)) {
|
||||||
|
$messageAction = __('Could not be updated');
|
||||||
|
}
|
||||||
|
|
||||||
|
$messageAction = ui_print_result_message ($result,
|
||||||
__('Successfully updated'),
|
__('Successfully updated'),
|
||||||
__('Could not be updated'));
|
$messageAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($delete_special_day) {
|
if ($delete_special_day) {
|
||||||
|
|
|
@ -82,7 +82,7 @@ $table_details->data[] = $data;
|
||||||
|
|
||||||
if ($alert["times_fired"] > 0) {
|
if ($alert["times_fired"] > 0) {
|
||||||
$status = STATUS_ALERT_FIRED;
|
$status = STATUS_ALERT_FIRED;
|
||||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||||
}
|
}
|
||||||
elseif ($alert["disabled"] > 0) {
|
elseif ($alert["disabled"] > 0) {
|
||||||
$status = STATUS_ALERT_DISABLED;
|
$status = STATUS_ALERT_DISABLED;
|
||||||
|
|
|
@ -428,9 +428,21 @@ if ($create_template) {
|
||||||
json_encode($values));
|
json_encode($values));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
|
||||||
|
/* Show errors */
|
||||||
|
if (!isset($messageAction)) {
|
||||||
|
$messageAction = __('Could not be created');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name == "") {
|
||||||
|
$messageAction = __('No template name specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
$messageAction = ui_print_result_message ($result,
|
||||||
__('Successfully created'),
|
__('Successfully created'),
|
||||||
__('Could not be created'));
|
$messageAction);
|
||||||
|
|
||||||
|
|
||||||
/* Go to previous step in case of error */
|
/* Go to previous step in case of error */
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
$step = $step - 1;
|
$step = $step - 1;
|
||||||
|
|
|
@ -111,7 +111,7 @@ $table->head[2] = __('Event type');
|
||||||
$table->head[3] = __('Event status');
|
$table->head[3] = __('Event status');
|
||||||
$table->head[4] = __('Severity');
|
$table->head[4] = __('Severity');
|
||||||
$table->head[5] = __('Action') .
|
$table->head[5] = __('Action') .
|
||||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
html_print_checkbox('all_delete', 0, false, true, false);
|
||||||
$table->style = array ();
|
$table->style = array ();
|
||||||
$table->style[0] = 'font-weight: bold';
|
$table->style[0] = 'font-weight: bold';
|
||||||
$table->align = array ();
|
$table->align = array ();
|
||||||
|
@ -178,12 +178,32 @@ echo "</div>";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function check_all_checkboxes() {
|
|
||||||
if ($("#checkbox-all_delete").prop("checked")) {
|
$("input[name=all_delete]").css("margin-left", "32px");
|
||||||
$(".check_delete").prop('checked', true);
|
|
||||||
}
|
$( document ).ready(function() {
|
||||||
else {
|
|
||||||
$(".check_delete").prop('checked', false);
|
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||||
}
|
if($(this).parent().parent().hasClass('checkselected')){
|
||||||
}
|
$(this).parent().parent().removeClass('checkselected');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$(this).parent().parent().addClass('checkselected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[id^=checkbox-all_delete]').change(function(){
|
||||||
|
if ($("#checkbox-all_delete").prop("checked")) {
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -151,10 +151,13 @@ $table->head[] = __("Login Function");
|
||||||
$table->head[] = __("Agent operation tab");
|
$table->head[] = __("Agent operation tab");
|
||||||
$table->head[] = __("Agent godmode tab");
|
$table->head[] = __("Agent godmode tab");
|
||||||
$table->head[] = __("Operation");
|
$table->head[] = __("Operation");
|
||||||
|
/*
|
||||||
$table->width = array();
|
$table->width = array();
|
||||||
$table->width[] = '30%';
|
$table->width[] = '30%';
|
||||||
$table->width[] = '30%';
|
$table->width[] = '30%';
|
||||||
|
*/
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox data';
|
||||||
|
|
||||||
$table->align = array();
|
$table->align = array();
|
||||||
$table->align[] = 'left';
|
$table->align[] = 'left';
|
||||||
|
|
|
@ -245,11 +245,12 @@ $module_types = db_get_all_rows_filter (
|
||||||
if ($module_types === false)
|
if ($module_types === false)
|
||||||
$module_types = array ();
|
$module_types = array ();
|
||||||
|
|
||||||
$types = '';
|
$types = array();
|
||||||
foreach ($module_types as $type) {
|
foreach ($module_types as $type) {
|
||||||
$types[$type['id_tipo']] = $type['description'];
|
$types[$type['id_tipo']] = $type['description'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
@ -274,7 +275,7 @@ $table->data['form_modules_1'][1] = html_print_select ($types, 'module_type', ''
|
||||||
'width:100%');
|
'width:100%');
|
||||||
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
|
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
|
||||||
html_print_checkbox_extended("force_type", 'type', '', '', false,
|
html_print_checkbox_extended("force_type", 'type', '', '', false,
|
||||||
'', 'style="margin-right: 40px;"', true);
|
'style="margin-right: 40px;"', true, '');
|
||||||
|
|
||||||
$modules = array ();
|
$modules = array ();
|
||||||
if ($module_type != '') {
|
if ($module_type != '') {
|
||||||
|
|
|
@ -175,6 +175,7 @@ if ($update) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table = new stdClass();
|
||||||
$table->id = 'delete_table';
|
$table->id = 'delete_table';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
@ -235,7 +236,7 @@ switch ($config["dbtype"]) {
|
||||||
if ($module_types === false)
|
if ($module_types === false)
|
||||||
$module_types = array ();
|
$module_types = array ();
|
||||||
|
|
||||||
$types = '';
|
$types = array();
|
||||||
foreach ($module_types as $type) {
|
foreach ($module_types as $type) {
|
||||||
$types[$type['id_tipo']] = $type['description'];
|
$types[$type['id_tipo']] = $type['description'];
|
||||||
}
|
}
|
||||||
|
@ -248,22 +249,18 @@ $snmp_versions['3'] = 'v. 3';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$table->data['selection_mode'][0] = __('Selection mode');
|
$table->data['selection_mode'][0] = __('Selection mode');
|
||||||
$table->data['selection_mode'][1] = '<span style="width:110px;display:inline-block;">'.__('Select modules first ') . '</span>' .
|
$table->data['selection_mode'][1] = '<span style="width:110px;display:inline-block;">'.__('Select modules first ') . '</span>' .
|
||||||
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>';
|
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>';
|
||||||
$table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-block;">'.__('Select agents first ') . '</span>' .
|
$table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-block;">'.__('Select agents first ') . '</span>' .
|
||||||
html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
|
html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$table->rowclass['form_modules_1'] = 'select_modules_row';
|
$table->rowclass['form_modules_1'] = 'select_modules_row';
|
||||||
$table->data['form_modules_1'][0] = __('Module type');
|
$table->data['form_modules_1'][0] = __('Module type');
|
||||||
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
|
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
|
||||||
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
|
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
|
||||||
$table->data['form_modules_1'][0] .= '</span>';
|
$table->data['form_modules_1'][0] .= '</span>';
|
||||||
|
|
||||||
$types[0] = __('All');
|
$types[0] = __('All');
|
||||||
$table->colspan['form_modules_1'][1] = 2;
|
$table->colspan['form_modules_1'][1] = 2;
|
||||||
$table->data['form_modules_1'][1] = html_print_select ($types,
|
$table->data['form_modules_1'][1] = html_print_select ($types,
|
||||||
|
@ -271,7 +268,7 @@ $table->data['form_modules_1'][1] = html_print_select ($types,
|
||||||
|
|
||||||
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
|
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
|
||||||
html_print_checkbox_extended ("force_type", 'type', '', '', false,
|
html_print_checkbox_extended ("force_type", 'type', '', '', false,
|
||||||
'', 'style="margin-right: 40px;"', true);
|
'style="margin-right: 40px;"', true, '');
|
||||||
|
|
||||||
$modules = array ();
|
$modules = array ();
|
||||||
if ($module_type != '') {
|
if ($module_type != '') {
|
||||||
|
|
|
@ -193,7 +193,7 @@ $table->class = 'databox data';
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
$table->head[0] = __('Name');
|
$table->head[0] = __('Name');
|
||||||
$table->head[1] = __('Action') .
|
$table->head[1] = __('Action') .
|
||||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
html_print_checkbox('all_delete', 0, false, true, false);
|
||||||
$table->style = array ();
|
$table->style = array ();
|
||||||
$table->style[0] = 'font-weight: bold';
|
$table->style[0] = 'font-weight: bold';
|
||||||
$table->align = array ();
|
$table->align = array ();
|
||||||
|
@ -250,12 +250,31 @@ enterprise_hook('close_meta_frame');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function check_all_checkboxes() {
|
|
||||||
if ($("input[name=all_delete]").prop('checked')) {
|
$( document ).ready(function() {
|
||||||
$(".check_delete").prop('checked', true);
|
|
||||||
}
|
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||||
else {
|
if($(this).parent().parent().hasClass('checkselected')){
|
||||||
$(".check_delete").prop('checked', false);
|
$(this).parent().parent().removeClass('checkselected');
|
||||||
}
|
}
|
||||||
}
|
else{
|
||||||
|
$(this).parent().parent().addClass('checkselected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[id^=checkbox-all_delete]').change(function(){
|
||||||
|
if ($("#checkbox-all_delete").prop("checked")) {
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -568,8 +568,7 @@ $table->head[3] = __('Description');
|
||||||
$table->head[4] = __('Group');
|
$table->head[4] = __('Group');
|
||||||
$table->head[5] = __('Max/Min');
|
$table->head[5] = __('Max/Min');
|
||||||
$table->head[6] = __('Action') .
|
$table->head[6] = __('Action') .
|
||||||
html_print_checkbox('all_delete', 0, false, true, false,
|
html_print_checkbox('all_delete', 0, false, true, false);
|
||||||
'check_all_checkboxes();');
|
|
||||||
$table->size = array ();
|
$table->size = array ();
|
||||||
$table->size[1] = '75px';
|
$table->size[1] = '75px';
|
||||||
$table->size[6] = '80px';
|
$table->size[6] = '80px';
|
||||||
|
@ -650,12 +649,30 @@ enterprise_hook('close_meta_frame');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function check_all_checkboxes() {
|
|
||||||
if ($("input[name=all_delete]").prop("checked")) {
|
$( document ).ready(function() {
|
||||||
$(".check_delete").prop("checked", true);
|
|
||||||
}
|
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||||
else {
|
if($(this).parent().parent().hasClass('checkselected')){
|
||||||
$(".check_delete").prop("checked", true);
|
$(this).parent().parent().removeClass('checkselected');
|
||||||
}
|
}
|
||||||
}
|
else{
|
||||||
|
$(this).parent().parent().addClass('checkselected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[id^=checkbox-all_delete]').change(function(){
|
||||||
|
if ($("#checkbox-all_delete").prop("checked")) {
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -125,7 +125,7 @@ $table->data[4][1] .= html_print_input_text ('max_warning', $max_warning,
|
||||||
'', 5, 15, true) . '</span>';
|
'', 5, 15, true) . '</span>';
|
||||||
$table->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').' </em> ';
|
$table->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').' </em> ';
|
||||||
$table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
|
$table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
|
||||||
'', 5, 15, true) . '</span>';
|
'', 5, 64, true) . '</span>';
|
||||||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||||
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
|
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ $table->data[5][1] .= html_print_input_text ('max_critical', $max_critical,
|
||||||
'', 5, 15, true) . '</span>';
|
'', 5, 15, true) . '</span>';
|
||||||
$table->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').' </em> ';
|
$table->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').' </em> ';
|
||||||
$table->data[5][1] .= html_print_input_text ('str_critical', $str_critical,
|
$table->data[5][1] .= html_print_input_text ('str_critical', $str_critical,
|
||||||
'', 5, 15, true) . '</span>';
|
'', 5, 64, true) . '</span>';
|
||||||
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||||
$table->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true);
|
$table->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true);
|
||||||
|
|
||||||
|
|
|
@ -239,16 +239,33 @@ echo '</div></form>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// If you click on the input type checkbox with id checkbox-all_delete
|
|
||||||
$('#checkbox-all_delete').click(function() {
|
$( document ).ready(function() {
|
||||||
// If selected (if the checked property equals true)
|
|
||||||
if ($(this).prop('checked')) {
|
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||||
// Select each input that has the class .check_delete
|
if($(this).parent().parent().hasClass('checkselected')){
|
||||||
$('.check_delete').prop('checked', true);
|
$(this).parent().parent().removeClass('checkselected');
|
||||||
} else {
|
}
|
||||||
// deselect every input that has the class .check_delete
|
else{
|
||||||
$('.check_delete').prop('checked', false);
|
$(this).parent().parent().addClass('checkselected');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// If you click on the input type checkbox with id checkbox-all_delete
|
||||||
|
$('[id^=checkbox-all_delete]').change(function(){
|
||||||
|
// If selected (if the checked property equals true)
|
||||||
|
if ($("#checkbox-all_delete").prop("checked")) {
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||||
|
// Select each input that has the class .check_delete
|
||||||
|
$(".check_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||||
|
// deselect every input that has the class .check_delete
|
||||||
|
$(".check_delete").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -119,8 +119,7 @@ $table->head = array ();
|
||||||
$table->head[0] = __('Name');
|
$table->head[0] = __('Name');
|
||||||
$table->head[1] = __('Group');
|
$table->head[1] = __('Group');
|
||||||
$table->head[2] = __('Action') .
|
$table->head[2] = __('Action') .
|
||||||
html_print_checkbox('all_delete', 0, false, true, false,
|
html_print_checkbox('all_delete', 0, false, true, false);
|
||||||
'check_all_checkboxes();');
|
|
||||||
$table->style = array ();
|
$table->style = array ();
|
||||||
$table->style[0] = 'font-weight: bold';
|
$table->style[0] = 'font-weight: bold';
|
||||||
$table->align = array ();
|
$table->align = array ();
|
||||||
|
@ -174,12 +173,30 @@ enterprise_hook('close_meta_frame');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function check_all_checkboxes() {
|
|
||||||
if ($("input[name=all_delete]").attr('checked')) {
|
$( document ).ready(function() {
|
||||||
$(".check_delete").attr('checked', true);
|
|
||||||
}
|
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||||
else {
|
if($(this).parent().parent().hasClass('checkselected')){
|
||||||
$(".check_delete").attr('checked', false);
|
$(this).parent().parent().removeClass('checkselected');
|
||||||
}
|
}
|
||||||
}
|
else{
|
||||||
|
$(this).parent().parent().addClass('checkselected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[id^=checkbox-all_delete]').change(function(){
|
||||||
|
if ($("#checkbox-all_delete").prop("checked")) {
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -195,7 +195,8 @@ if ($add_module) {
|
||||||
"')");
|
"')");
|
||||||
|
|
||||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
|
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
|
||||||
|
|
||||||
$order = $order['field_order'];
|
$order = $order['field_order'];
|
||||||
foreach($id_agent_modules as $id_agent_module){
|
foreach($id_agent_modules as $id_agent_module){
|
||||||
$order++;
|
$order++;
|
||||||
|
@ -207,8 +208,13 @@ if ($add_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($delete_module) {
|
if ($delete_module) {
|
||||||
|
$id_graph = get_parameter('id');
|
||||||
|
|
||||||
$deleteGraph = get_parameter('delete');
|
$deleteGraph = get_parameter('delete');
|
||||||
|
$order_val = db_get_value('field_order', 'tgraph_source', 'id_gs', $deleteGraph);
|
||||||
$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
|
$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
|
||||||
|
db_process_sql ('UPDATE tgraph_source SET field_order=field_order-1 WHERE id_graph='.$id_graph.' AND field_order>'.$order_val);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($change_weight) {
|
if ($change_weight) {
|
||||||
|
|
|
@ -168,8 +168,7 @@ if (!empty ($graphs)) {
|
||||||
$op_column = true;
|
$op_column = true;
|
||||||
$table->align[4] = 'left';
|
$table->align[4] = 'left';
|
||||||
$table->head[4] = __('Op.') .
|
$table->head[4] = __('Op.') .
|
||||||
html_print_checkbox('all_delete', 0, false, true, false,
|
html_print_checkbox('all_delete', 0, false, true, false);
|
||||||
'check_all_checkboxes();');
|
|
||||||
$table->size[4] = '90px';
|
$table->size[4] = '90px';
|
||||||
}
|
}
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
@ -236,13 +235,29 @@ else {
|
||||||
|
|
||||||
$("input[name=all_delete]").css("margin-left", "32px");
|
$("input[name=all_delete]").css("margin-left", "32px");
|
||||||
|
|
||||||
function check_all_checkboxes() {
|
$( document ).ready(function() {
|
||||||
if ($("input[name=all_delete]").prop("checked")) {
|
|
||||||
$(".check_delete").prop("checked", true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(".check_delete").prop("checked", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||||
|
if($(this).parent().parent().hasClass('checkselected')){
|
||||||
|
$(this).parent().parent().removeClass('checkselected');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$(this).parent().parent().addClass('checkselected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[id^=checkbox-all_delete]').change(function(){
|
||||||
|
if ($("#checkbox-all_delete").prop("checked")) {
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,27 @@ $( document ).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('[id^=checkbox-massive_report_check]').change(function(){
|
||||||
|
if($(this).parent().parent().parent().hasClass('checkselected')){
|
||||||
|
$(this).parent().parent().parent().removeClass('checkselected');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$(this).parent().parent().parent().addClass('checkselected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[id^=checkbox-all_delete]').change(function(){
|
||||||
|
if ($("#checkbox-all_delete").prop("checked")) {
|
||||||
|
$('[id^=checkbox-massive_report_check]').parent().parent().parent().addClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('[id^=checkbox-massive_report_check]').parent().parent().parent().removeClass('checkselected');
|
||||||
|
$(".check_delete").prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -715,9 +736,10 @@ switch ($action) {
|
||||||
if ($edit || $delete) {
|
if ($edit || $delete) {
|
||||||
$columnview = true;
|
$columnview = true;
|
||||||
if (!isset($table->head[$next])) {
|
if (!isset($table->head[$next])) {
|
||||||
$table->head[$next] = '<span title="Operations">' . __('Op.') . '</span>';
|
$table->head[$next] = '<span title="Operations">' . __('Op.') . '</span>'.
|
||||||
|
html_print_checkbox('all_delete', 0, false, true, false);
|
||||||
$table->size = array ();
|
$table->size = array ();
|
||||||
$table->size[$next] = '80px';
|
//$table->size[$next] = '80px';
|
||||||
$table->style[$next] = 'text-align:left;';
|
$table->style[$next] = 'text-align:left;';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1847,7 +1869,7 @@ switch ($action) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
metaconsole_restore_db_force();
|
metaconsole_restore_db();
|
||||||
|
|
||||||
$temp_sort[$report_item['id_rc']] = $element_name;
|
$temp_sort[$report_item['id_rc']] = $element_name;
|
||||||
|
|
||||||
|
|
|
@ -728,7 +728,7 @@ else {
|
||||||
|
|
||||||
if ($rows !== false) {
|
if ($rows !== false) {
|
||||||
if(defined('METACONSOLE'))
|
if(defined('METACONSOLE'))
|
||||||
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox">';
|
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
|
||||||
else
|
else
|
||||||
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
|
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ $rows = db_get_all_rows_in_table('tupdate_settings');
|
||||||
|
|
||||||
$settings = new StdClass;
|
$settings = new StdClass;
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$settings->$row['key'] = $row['value'];
|
$settings->{$row['key']} = $row['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<script type="text/javascript">';
|
echo '<script type="text/javascript">';
|
||||||
|
|
|
@ -121,8 +121,8 @@ $zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarc
|
||||||
$zone_selected = get_parameter('zone');
|
$zone_selected = get_parameter('zone');
|
||||||
if ($zone_selected == "") {
|
if ($zone_selected == "") {
|
||||||
if ($config["timezone"] != "") {
|
if ($config["timezone"] != "") {
|
||||||
list($zone) = explode("/", $config["timezone"]);
|
$zone_array = explode("/", $config["timezone"]);
|
||||||
$zone_selected = $zone;
|
$zone_selected = $zone_array[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$zone_selected = 'Europe';
|
$zone_selected = 'Europe';
|
||||||
|
@ -131,7 +131,7 @@ if ($zone_selected == "") {
|
||||||
|
|
||||||
$timezones = timezone_identifiers_list();
|
$timezones = timezone_identifiers_list();
|
||||||
foreach ($timezones as $timezone) {
|
foreach ($timezones as $timezone) {
|
||||||
if (strpos($timezone, $zone_selected) !== false) {
|
if (strpos($timezone, $zone_selected) !== false) {
|
||||||
$timezone_n[$timezone] = $timezone;
|
$timezone_n[$timezone] = $timezone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ $table->data[36][0] = __('Include agents manually disabled');
|
||||||
$table->data[36][1] = __('Yes').' '.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).' ';
|
$table->data[36][1] = __('Yes').' '.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).' ';
|
||||||
$table->data[36][1] .= __('No').' '.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
|
$table->data[36][1] .= __('No').' '.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
|
||||||
|
|
||||||
$table->data[37][0] = __('audit log directory') .
|
$table->data[37][0] = __('Audit log directory') .
|
||||||
ui_print_help_tip (__("Directory where audit log is stored."), true);
|
ui_print_help_tip (__("Directory where audit log is stored."), true);
|
||||||
$table->data[37][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true);
|
$table->data[37][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true);
|
||||||
|
|
||||||
|
|
|
@ -83,13 +83,8 @@ $table_behaviour->data[$row][1] = html_print_checkbox('paginate_module', 1,
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$table_behaviour->data[$row][0] = __('Display data of proc modules in other format');
|
$table_behaviour->data[$row][0] = __('Display data of proc modules in other format');
|
||||||
$table_behaviour->data[$row][1] = __('Yes') . ' ' .
|
$table_behaviour->data[$row][1] = html_print_checkbox('render_proc', 1,
|
||||||
html_print_radio_button ('render_proc', 1, '',
|
$config['render_proc'], true);
|
||||||
$config["render_proc"], true) .
|
|
||||||
' ';
|
|
||||||
$table_behaviour->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('render_proc', 0, '',
|
|
||||||
$config["render_proc"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$table_behaviour->data[$row][0] = __('Display text proc modules have state is ok');
|
$table_behaviour->data[$row][0] = __('Display text proc modules have state is ok');
|
||||||
|
@ -103,13 +98,8 @@ $row++;
|
||||||
//Daniel maya 02/06/2016 Display menu with click --INI
|
//Daniel maya 02/06/2016 Display menu with click --INI
|
||||||
$table_behaviour->data[$row][0] = __('Click to display lateral menus').
|
$table_behaviour->data[$row][0] = __('Click to display lateral menus').
|
||||||
ui_print_help_tip(__('When enabled, the lateral menus are shown when left clicking them, instead of hovering over them'), true);
|
ui_print_help_tip(__('When enabled, the lateral menus are shown when left clicking them, instead of hovering over them'), true);
|
||||||
$table_behaviour->data[$row][1] = __('Yes') . ' ' .
|
$table_behaviour->data[$row][1] = html_print_checkbox('click_display', 1,
|
||||||
html_print_radio_button ('click_display', 1, '',
|
$config['click_display'], true);
|
||||||
$config["click_display"], true) .
|
|
||||||
' ';
|
|
||||||
$table_behaviour->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('click_display', 0, '',
|
|
||||||
$config["click_display"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
//Daniel maya 02/06/2016 Display menu with click --END
|
//Daniel maya 02/06/2016 Display menu with click --END
|
||||||
|
|
||||||
|
@ -126,13 +116,8 @@ if (enterprise_installed()) {
|
||||||
|
|
||||||
$table_behaviour->data[$row][0] = __('Classic menu mode').
|
$table_behaviour->data[$row][0] = __('Classic menu mode').
|
||||||
ui_print_help_tip(__('Text menu options always visible, don\'t hide'), true);
|
ui_print_help_tip(__('Text menu options always visible, don\'t hide'), true);
|
||||||
$table_behaviour->data[$row][1] = __('Yes') . ' ' .
|
$table_behaviour->data[$row][1] = html_print_checkbox('classic_menu', 1,
|
||||||
html_print_radio_button ('classic_menu', 1, '',
|
$config['classic_menu'], true);
|
||||||
$config["classic_menu"], true) .
|
|
||||||
' ';
|
|
||||||
$table_behaviour->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('classic_menu', 0, '',
|
|
||||||
$config["classic_menu"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
echo "<fieldset>";
|
echo "<fieldset>";
|
||||||
|
@ -398,41 +383,31 @@ if(enterprise_installed()) {
|
||||||
$row++;
|
$row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_styles->data[$row][0] = __('Disable logo in graphs');
|
if (enterprise_installed()){
|
||||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
$table_styles->data[$row][0] = __('Disable logo in graphs');
|
||||||
html_print_radio_button_extended ('fixed_graph', 1, '', $config["fixed_graph"], $open, '','',true) .
|
$table_styles->data[$row][1] = html_print_checkbox('fixed_graph', 1,
|
||||||
' ';
|
$config['fixed_graph'], true);
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
|
||||||
/* Hello there! :)
|
/* Hello there! :)
|
||||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button_extended ('fixed_graph', 0, '', $config["fixed_graph"], $open, '','',true, $open,'visualmodal');
|
|
||||||
$row++;
|
|
||||||
|
|
||||||
$table_styles->data[$row][0] = __('Disable helps');
|
$table_styles->data[$row][0] = __('Disable helps');
|
||||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
$table_styles->data[$row][1] = html_print_checkbox('disable_help', 1,
|
||||||
html_print_radio_button ('disable_help', 1, '', $config["disable_help"], true) .
|
$config['disable_help'], true);
|
||||||
' ';
|
|
||||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('disable_help', 0, '', $config["disable_help"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$table_styles->data[$row][0] = __('Fixed header');
|
$table_styles->data[$row][0] = __('Fixed header');
|
||||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
$table_styles->data[$row][1] = html_print_checkbox('fixed_header', 1,
|
||||||
html_print_radio_button ('fixed_header', 1, '', $config["fixed_header"], true) .
|
$config['fixed_header'], true);
|
||||||
' ';
|
|
||||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('fixed_header', 0, '', $config["fixed_header"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$table_styles->data[$row][0] = __('Fixed menu');
|
$table_styles->data[$row][0] = __('Fixed menu');
|
||||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
$table_styles->data[$row][1] = html_print_checkbox('fixed_menu', 1,
|
||||||
html_print_radio_button ('fixed_menu', 1, '', $config["fixed_menu"], true) .
|
$config['fixed_menu'], true);
|
||||||
' ';
|
|
||||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('fixed_menu', 0, '', $config["fixed_menu"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
// For 5.1 Autohidden menu feature
|
// For 5.1 Autohidden menu feature
|
||||||
|
@ -441,11 +416,8 @@ $table_styles->data['autohidden'][1] = html_print_checkbox('autohidden_menu',
|
||||||
1, $config['autohidden_menu'], true);
|
1, $config['autohidden_menu'], true);
|
||||||
|
|
||||||
$table_styles->data[$row][0] = __('Visual effects and animation');
|
$table_styles->data[$row][0] = __('Visual effects and animation');
|
||||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
$table_styles->data[$row][1] = html_print_checkbox('visual_animation', 1,
|
||||||
html_print_radio_button ('visual_animation', 1, '', $config["visual_animation"], true) .
|
$config['visual_animation'], true);
|
||||||
' ';
|
|
||||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('visual_animation', 0, '', $config["visual_animation"], true);
|
|
||||||
|
|
||||||
echo "<fieldset>";
|
echo "<fieldset>";
|
||||||
echo "<legend>" . __('Style configuration') . "</legend>";
|
echo "<legend>" . __('Style configuration') . "</legend>";
|
||||||
|
@ -465,10 +437,8 @@ $table_gis->data = array ();
|
||||||
|
|
||||||
$table_gis->data[$row][0] = __('GIS Labels') .
|
$table_gis->data[$row][0] = __('GIS Labels') .
|
||||||
ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true);
|
ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true);
|
||||||
$table_gis->data[$row][1] = __('Yes') . ' ' .
|
$table_gis->data[$row][1] = html_print_checkbox('gis_label', 1,
|
||||||
html_print_radio_button ('gis_label', 1, '', $config["gis_label"], true).' ';
|
$config['gis_label'], true);
|
||||||
$table_gis->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('gis_label', 0, '', $config["gis_label"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$listIcons = gis_get_array_list_icons();
|
$listIcons = gis_get_array_list_icons();
|
||||||
|
@ -558,10 +528,8 @@ $row++;
|
||||||
|
|
||||||
$table_font->data[$row][0] = __('Show unit along with value in reports') .
|
$table_font->data[$row][0] = __('Show unit along with value in reports') .
|
||||||
ui_print_help_tip(__('This enabling this, max, min and avg values will be shown with units.'), true);
|
ui_print_help_tip(__('This enabling this, max, min and avg values will be shown with units.'), true);
|
||||||
$table_font->data[$row][1] = __('Yes') . ' ' .
|
$table_font->data[$row][1] = html_print_checkbox('simple_module_value', 1,
|
||||||
html_print_radio_button ('simple_module_value', 1, '', $config["simple_module_value"], true).' ';
|
$config['simple_module_value'], true);
|
||||||
$table_font->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('simple_module_value', 0, '', $config["simple_module_value"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
echo "<fieldset>";
|
echo "<fieldset>";
|
||||||
|
@ -647,8 +615,8 @@ $table_chars->data[$row][1] = html_print_input_text ('custom_graph_width',
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$table_chars->data[$row][0] = __('Use round corners');
|
$table_chars->data[$row][0] = __('Use round corners');
|
||||||
$table_chars->data[$row][1] = __('Yes').' '.html_print_radio_button ('round_corner', 1, '', $config["round_corner"], true).' ';
|
$table_chars->data[$row][1] = html_print_checkbox('round_corner', 1,
|
||||||
$table_chars->data[$row][1] .= __('No').' '.html_print_radio_button ('round_corner', 0, '', $config["round_corner"], true);
|
$config['round_corner'], true);
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$table_chars->data[$row][0] = __('Type of module charts');
|
$table_chars->data[$row][0] = __('Type of module charts');
|
||||||
|
@ -876,14 +844,8 @@ $table_other->data['custom_report_front-footer'][1] = html_print_textarea('custo
|
||||||
|
|
||||||
|
|
||||||
$table_other->data[$row][0] = __('Show QR Code icon in the header');
|
$table_other->data[$row][0] = __('Show QR Code icon in the header');
|
||||||
$table_other->data[$row][1] = __('Yes') . ' ' .
|
$table_other->data[$row][1] = html_print_checkbox('show_qr_code_header', 1,
|
||||||
html_print_radio_button ('show_qr_code_header', 1, '',
|
$config['show_qr_code_header'], true);
|
||||||
$config["show_qr_code_header"], true) .
|
|
||||||
' ';
|
|
||||||
$table_other->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('show_qr_code_header', 0, '',
|
|
||||||
$config["show_qr_code_header"], true);
|
|
||||||
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$table_other->data[$row][0] = __('Custom graphviz directory') .
|
$table_other->data[$row][0] = __('Custom graphviz directory') .
|
||||||
|
@ -903,13 +865,8 @@ $row++;
|
||||||
$table_other->data[$row][0] = __('Show only the group name');
|
$table_other->data[$row][0] = __('Show only the group name');
|
||||||
$table_other->data[$row][0] .= ui_print_help_tip(
|
$table_other->data[$row][0] .= ui_print_help_tip(
|
||||||
__('Show the group name instead the group icon.'), true);
|
__('Show the group name instead the group icon.'), true);
|
||||||
$table_other->data[$row][1] = __('Yes') . ' ' .
|
html_print_checkbox('show_group_name', 1,
|
||||||
html_print_radio_button ('show_group_name', 1, '',
|
$config['show_group_name'], true);
|
||||||
$config["show_group_name"], true) .
|
|
||||||
' ';
|
|
||||||
$table_other->data[$row][1] .= __('No') . ' ' .
|
|
||||||
html_print_radio_button ('show_group_name', 0, '',
|
|
||||||
$config["show_group_name"], true);
|
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
$table_other->data[$row][0] = __('Date format string') . ui_print_help_icon("date_format", true);
|
$table_other->data[$row][0] = __('Date format string') . ui_print_help_icon("date_format", true);
|
||||||
|
|
|
@ -133,13 +133,12 @@ if ($new_user && $config['admin_can_add_user']) {
|
||||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
$user_info['id_skin'] = '';
|
$user_info['id_skin'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_info['section'] = '';
|
$user_info['section'] = '';
|
||||||
$user_info['data_section'] = '';
|
$user_info['data_section'] = '';
|
||||||
//This attributes are inherited from global configuration
|
//This attributes are inherited from global configuration
|
||||||
$user_info['block_size'] = $config["block_size"];
|
$user_info['block_size'] = $config["block_size"];
|
||||||
$user_info['flash_chart'] = $config["flash_charts"];
|
|
||||||
|
|
||||||
if (enterprise_installed() && defined('METACONSOLE')) {
|
if (enterprise_installed() && defined('METACONSOLE')) {
|
||||||
$user_info['metaconsole_agents_manager'] = 0;
|
$user_info['metaconsole_agents_manager'] = 0;
|
||||||
$user_info['metaconsole_assigned_server'] = '';
|
$user_info['metaconsole_assigned_server'] = '';
|
||||||
|
@ -154,6 +153,8 @@ if ($create_user) {
|
||||||
}
|
}
|
||||||
if (html_print_csrf_error()) return;
|
if (html_print_csrf_error()) return;
|
||||||
|
|
||||||
|
$user_is_admin = (int) get_parameter ('is_admin', 0);
|
||||||
|
|
||||||
$values = array ();
|
$values = array ();
|
||||||
$values['id_user'] = (string) get_parameter ('id_user');
|
$values['id_user'] = (string) get_parameter ('id_user');
|
||||||
$values['fullname'] = (string) get_parameter ('fullname');
|
$values['fullname'] = (string) get_parameter ('fullname');
|
||||||
|
@ -164,19 +165,18 @@ if ($create_user) {
|
||||||
$values['email'] = (string) get_parameter ('email');
|
$values['email'] = (string) get_parameter ('email');
|
||||||
$values['phone'] = (string) get_parameter ('phone');
|
$values['phone'] = (string) get_parameter ('phone');
|
||||||
$values['comments'] = (string) get_parameter ('comments');
|
$values['comments'] = (string) get_parameter ('comments');
|
||||||
$values['is_admin'] = (int) get_parameter ('is_admin', 0);
|
$values['is_admin'] = $user_is_admin;
|
||||||
$values['language'] = get_parameter ('language', 'default');
|
$values['language'] = get_parameter ('language', 'default');
|
||||||
$values['timezone'] = (string) get_parameter('timezone');
|
$values['timezone'] = (string) get_parameter('timezone');
|
||||||
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
||||||
$dashboard = get_parameter('dashboard', '');
|
$dashboard = get_parameter('dashboard', '');
|
||||||
$visual_console = get_parameter('visual_console', '');
|
$visual_console = get_parameter('visual_console', '');
|
||||||
|
|
||||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
$values['id_skin'] = (int) get_parameter ('skin', 0);
|
$values['id_skin'] = (int) get_parameter ('skin', 0);
|
||||||
}
|
}
|
||||||
$values['block_size'] = (int) get_parameter ('block_size', $config["block_size"]);
|
$values['block_size'] = (int) get_parameter ('block_size', $config["block_size"]);
|
||||||
$values['flash_chart'] = (int) get_parameter ('flash_charts', $config["flash_charts"]);
|
|
||||||
|
|
||||||
$values['section'] = get_parameter ('section');
|
$values['section'] = get_parameter ('section');
|
||||||
if (($values['section'] == 'Event list') || ($values['section'] == 'Group view') || ($values['section'] == 'Alert detail') || ($values['section'] == 'Tactical view') || ($values['section'] == 'Default')) {
|
if (($values['section'] == 'Event list') || ($values['section'] == 'Group view') || ($values['section'] == 'Alert detail') || ($values['section'] == 'Tactical view') || ($values['section'] == 'Default')) {
|
||||||
$values["data_section"] = '';
|
$values["data_section"] = '';
|
||||||
|
@ -187,21 +187,21 @@ if ($create_user) {
|
||||||
} else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){
|
} else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){
|
||||||
$values["data_section"] = get_parameter ('data_section');
|
$values["data_section"] = get_parameter ('data_section');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
$values['force_change_pass'] = 1;
|
$values['force_change_pass'] = 1;
|
||||||
$values['last_pass_change'] = date ("Y/m/d H:i:s", get_system_time());
|
$values['last_pass_change'] = date ("Y/m/d H:i:s", get_system_time());
|
||||||
if(defined('METACONSOLE')) {
|
if(defined('METACONSOLE')) {
|
||||||
$values['metaconsole_access'] = get_parameter ('metaconsole_access', 'basic');
|
$values['metaconsole_access'] = get_parameter ('metaconsole_access', 'basic');
|
||||||
$values['metaconsole_agents_manager'] = get_parameter ('metaconsole_agents_manager', '0');
|
$values['metaconsole_agents_manager'] = ($user_is_admin == 1 ? 1 : get_parameter ('metaconsole_agents_manager', '0'));
|
||||||
$values['metaconsole_assigned_server'] = get_parameter ('metaconsole_assigned_server', '');
|
$values['metaconsole_assigned_server'] = get_parameter ('metaconsole_assigned_server', '');
|
||||||
$values['metaconsole_access_node'] = get_parameter ('metaconsole_access_node', '0');
|
$values['metaconsole_access_node'] = ($user_is_admin == 1 ? 1 : get_parameter ('metaconsole_access_node', '0'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$values["not_login"] = (bool)get_parameter ('not_login', false);
|
$values["not_login"] = (bool)get_parameter ('not_login', false);
|
||||||
$values["strict_acl"] = (bool)get_parameter ('strict_acl', false);
|
$values["strict_acl"] = (bool)get_parameter ('strict_acl', false);
|
||||||
$values["session_time"] = (int)get_parameter('session_time', 0);
|
$values["session_time"] = (int)get_parameter('session_time', 0);
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
ui_print_error_message (__('User ID cannot be empty'));
|
ui_print_error_message (__('User ID cannot be empty'));
|
||||||
$user_info = $values;
|
$user_info = $values;
|
||||||
|
@ -225,7 +225,7 @@ if ($create_user) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$info =
|
$info =
|
||||||
'{"Id_user":"' . $values['id_user'] . '","FullName":"' . $values['fullname'] . '","Firstname":"'. $values['firstname'] .'","Lastname":"'. $values['lastname'] . '","Email":"' . $values['email'] . '","Phone":"' . $values['phone'] . '","Comments":"' . $values['comments'] .'","Is_admin":"' . $values['is_admin'] .'","Language":"' . $values['language'] .'","Timezone":"' . $values['timezone'] . '","Block size":"' . $values['block_size'] . '","Interactive Charts":"' . $values['flash_chart'].'"';
|
'{"Id_user":"' . $values['id_user'] . '","FullName":"' . $values['fullname'] . '","Firstname":"'. $values['firstname'] .'","Lastname":"'. $values['lastname'] . '","Email":"' . $values['email'] . '","Phone":"' . $values['phone'] . '","Comments":"' . $values['comments'] .'","Is_admin":"' . $values['is_admin'] .'","Language":"' . $values['language'] .'","Timezone":"' . $values['timezone'] . '","Block size":"' . $values['block_size'] . '"';
|
||||||
|
|
||||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
$info .= ',"Skin":"' . $values['id_skin'].'"}';
|
$info .= ',"Skin":"' . $values['id_skin'].'"}';
|
||||||
|
@ -233,25 +233,12 @@ if ($create_user) {
|
||||||
else{
|
else{
|
||||||
$info .= '}';
|
$info .= '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
$result = create_user($id, $password_new, $values);
|
||||||
case "mysql":
|
if ($result) {
|
||||||
case "postgresql":
|
$res = save_pass_history($id, $password_new);
|
||||||
$result = create_user($id, $password_new, $values);
|
|
||||||
if ($result) {
|
|
||||||
$res = save_pass_history($id, $password_new);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "oracle":
|
|
||||||
$result = db_process_sql('/INSERT INTO tusuario (fullname, firstname, lastname, email, phone, comments, is_admin, language, id_skin, block_size, flash_chart, id_user, password, last_connect, registered) VALUES (\'' . $values['fullname'] . '\',\'\',\'\',\'\',\'\',\'\',' . $values['is_admin'] . ',\'' . $values['language'] .'\',' . $values['id_skin'] . ',' . $values['block_size'] . ',' . $values['flash_chart'] . ',\'' . $id . '\',\'' . $password_new . '\',0,\'' . get_system_time () . '\')');
|
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
$res = db_process_sql('/INSERT INTO tpassword_history (id_user, password, date_begin) VALUES (\'' . $id . '\',\'' . md5($password_new) . '\',\'' . date ("Y/m/d H:i:s", get_system_time()) . '\')');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
db_pandora_audit("User management",
|
db_pandora_audit("User management",
|
||||||
"Created user ".io_safe_output($id), false, false, $info);
|
"Created user ".io_safe_output($id), false, false, $info);
|
||||||
|
|
||||||
|
@ -301,9 +288,7 @@ if ($update_user) {
|
||||||
$values['id_skin'] = get_parameter ('skin', 0);
|
$values['id_skin'] = get_parameter ('skin', 0);
|
||||||
}
|
}
|
||||||
$values['block_size'] = get_parameter ('block_size', $config["block_size"]);
|
$values['block_size'] = get_parameter ('block_size', $config["block_size"]);
|
||||||
$values['flash_chart'] = get_parameter ('flash_charts', $config["flash_charts"]);
|
|
||||||
|
|
||||||
|
|
||||||
$values['section'] = get_parameter ('section');
|
$values['section'] = get_parameter ('section');
|
||||||
if (($values['section'] == 'Event list') || ($values['section'] == 'Group view') || ($values['section'] == 'Alert detail') || ($values['section'] == 'Tactical view') || ($values['section'] == 'Default')) {
|
if (($values['section'] == 'Event list') || ($values['section'] == 'Group view') || ($values['section'] == 'Alert detail') || ($values['section'] == 'Tactical view') || ($values['section'] == 'Default')) {
|
||||||
$values["data_section"] = '';
|
$values["data_section"] = '';
|
||||||
|
@ -384,7 +369,6 @@ if ($update_user) {
|
||||||
"Language":"' . $values['language'] . '",
|
"Language":"' . $values['language'] . '",
|
||||||
"Timezone":"' . $values['timezone'] . '",
|
"Timezone":"' . $values['timezone'] . '",
|
||||||
"Block size":"' . $values['block_size'] . '",
|
"Block size":"' . $values['block_size'] . '",
|
||||||
"Flash Chats":"' . $values['flash_chart'] . '",
|
|
||||||
"Section":"' . $values['section'].'"';
|
"Section":"' . $values['section'].'"';
|
||||||
|
|
||||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
|
@ -588,8 +572,6 @@ if (!$meta) {
|
||||||
|
|
||||||
$table->data[11][0] = __('Interactive charts').' '.ui_print_help_tip(__('Whether to use Javascript or static PNG graphs'), true) ;
|
$table->data[11][0] = __('Interactive charts').' '.ui_print_help_tip(__('Whether to use Javascript or static PNG graphs'), true) ;
|
||||||
$values = array(-1 => __('Use global conf'), 1 => __('Yes'), 0 => __('No'));
|
$values = array(-1 => __('Use global conf'), 1 => __('Yes'), 0 => __('No'));
|
||||||
$table->data[11][1] = html_print_select($values, 'flash_charts',
|
|
||||||
$user_info["flash_chart"], '', '', -1, true, false, false);
|
|
||||||
|
|
||||||
$table->data[12][0] = __('Home screen').
|
$table->data[12][0] = __('Home screen').
|
||||||
ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true);
|
ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true);
|
||||||
|
@ -738,12 +720,11 @@ $(document).ready (function () {
|
||||||
$('input:radio[name="is_admin"]').change(function() {
|
$('input:radio[name="is_admin"]').change(function() {
|
||||||
if($('#radiobtn0002').prop('checked')) {
|
if($('#radiobtn0002').prop('checked')) {
|
||||||
$('#user_configuration_table-metaconsole_agents_manager').show();
|
$('#user_configuration_table-metaconsole_agents_manager').show();
|
||||||
$('#user_configuration_table-metaconsole_assigned_server').show();
|
|
||||||
$('#user_configuration_table-metaconsole_access_node').show();
|
$('#user_configuration_table-metaconsole_access_node').show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#user_configuration_table-metaconsole_agents_manager').hide();
|
$('#user_configuration_table-metaconsole_agents_manager').hide();
|
||||||
$('#user_configuration_table-metaconsole_assigned_server').hide();
|
$('#user_configuration_table-metaconsole_assigned_server').show();
|
||||||
$('#user_configuration_table-metaconsole_access_node').hide();
|
$('#user_configuration_table-metaconsole_access_node').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -270,7 +270,7 @@ if ($create_profile) {
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->cellpadding = 0;
|
$table->cellpadding = 0;
|
||||||
$table->cellspacing = 0;
|
$table->cellspacing = 0;
|
||||||
$table->class = 'databox profile_list';
|
$table->class = 'databox profile_list data';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 274 B |
Binary file not shown.
After Width: | Height: | Size: 397 B |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -38,6 +38,9 @@ $get_event_name = (bool) get_parameter ('get_event_name');
|
||||||
$meta = get_parameter ('meta', 0);
|
$meta = get_parameter ('meta', 0);
|
||||||
$history = get_parameter ('history', 0);
|
$history = get_parameter ('history', 0);
|
||||||
$table_events = get_parameter('table_events', 0);
|
$table_events = get_parameter('table_events', 0);
|
||||||
|
$total_events = (bool)get_parameter('total_events');
|
||||||
|
$total_event_graph = (bool)get_parameter('total_event_graph');
|
||||||
|
$graphic_event_group = (bool)get_parameter('graphic_event_group');
|
||||||
|
|
||||||
if ($get_event_name) {
|
if ($get_event_name) {
|
||||||
$event_id = get_parameter ('event_id');
|
$event_id = get_parameter ('event_id');
|
||||||
|
@ -412,7 +415,7 @@ if ($get_extended_event) {
|
||||||
$custom_data = events_page_custom_data($event);
|
$custom_data = events_page_custom_data($event);
|
||||||
|
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
metaconsole_restore_db_force();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
$general = events_page_general($event);
|
$general = events_page_general($event);
|
||||||
|
@ -605,4 +608,37 @@ if ($get_list_events_agents) {
|
||||||
echo $returned_list;
|
echo $returned_list;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($total_events) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento ';
|
||||||
|
if ($config['event_view_hr']) {
|
||||||
|
$sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - ' . $config['event_view_hr'] * SECONDS_1HOUR . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$system_events = db_get_value_sql($sql_count_event);
|
||||||
|
echo $system_events;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($total_event_graph) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
require_once($config["homedir"] . '/include/functions_graph.php');
|
||||||
|
|
||||||
|
$prueba = grafico_eventos_total("", 280, 150, false, true);
|
||||||
|
echo $prueba;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($graphic_event_group) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
require_once($config["homedir"] . '/include/functions_graph.php');
|
||||||
|
|
||||||
|
$prueba = grafico_eventos_grupo(280, 150, "", false, true);
|
||||||
|
echo $prueba;
|
||||||
|
return;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -539,14 +539,6 @@ if ($list_modules) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
|
||||||
case "oracle":
|
|
||||||
if (isset($order['field']) && $order['field'] == 'tagente_modulo.nombre') {
|
|
||||||
$order['field'] = 'dbms_lob.substr(tagente_modulo.nombre,4000,1)';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
|
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
|
||||||
$groups = users_get_groups($config["id_user"], $access);
|
$groups = users_get_groups($config["id_user"], $access);
|
||||||
|
|
||||||
|
@ -599,8 +591,7 @@ if ($list_modules) {
|
||||||
|
|
||||||
//Count monitors/modules
|
//Count monitors/modules
|
||||||
$order_sql = $order['field'] . " " . $order['order'];
|
$order_sql = $order['field'] . " " . $order['order'];
|
||||||
$sql = "SELECT COUNT(*)
|
$sql_condition = "FROM tagente_modulo
|
||||||
FROM tagente_modulo
|
|
||||||
$tags_join
|
$tags_join
|
||||||
INNER JOIN tagente_estado
|
INNER JOIN tagente_estado
|
||||||
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||||
|
@ -609,13 +600,15 @@ if ($list_modules) {
|
||||||
WHERE tagente_modulo.id_agente = $id_agente
|
WHERE tagente_modulo.id_agente = $id_agente
|
||||||
AND nombre LIKE '$status_text_monitor_sql'
|
AND nombre LIKE '$status_text_monitor_sql'
|
||||||
AND delete_pending = 0
|
AND delete_pending = 0
|
||||||
|
AND disabled = 0
|
||||||
AND $status_filter_sql
|
AND $status_filter_sql
|
||||||
|
AND $status_module_group_filter
|
||||||
$tags_sql
|
$tags_sql
|
||||||
AND tagente_estado.estado != $monitor_filter
|
AND tagente_estado.estado != $monitor_filter
|
||||||
GROUP BY tagente_modulo.id_agente_modulo
|
|
||||||
";
|
";
|
||||||
|
|
||||||
$count_modules = db_get_all_rows_sql($sql);
|
$count_modules = db_get_all_rows_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)' . $sql_condition);
|
||||||
|
|
||||||
if (isset($count_modules[0]))
|
if (isset($count_modules[0]))
|
||||||
$count_modules = reset($count_modules[0]);
|
$count_modules = reset($count_modules[0]);
|
||||||
else
|
else
|
||||||
|
@ -623,22 +616,9 @@ if ($list_modules) {
|
||||||
|
|
||||||
//Get monitors/modules
|
//Get monitors/modules
|
||||||
// Get all module from agent
|
// Get all module from agent
|
||||||
$sql = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*
|
$sql_modules_info = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*
|
||||||
FROM tagente_modulo
|
$sql_condition
|
||||||
$tags_join
|
GROUP BY tagente_modulo.id_agente_modulo ORDER BY $order_sql";
|
||||||
INNER JOIN tagente_estado
|
|
||||||
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
|
||||||
LEFT JOIN tmodule_group
|
|
||||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
|
||||||
WHERE tagente_modulo.id_agente = $id_agente
|
|
||||||
AND nombre LIKE '$status_text_monitor_sql'
|
|
||||||
AND delete_pending = 0
|
|
||||||
AND $status_filter_sql
|
|
||||||
$tags_sql
|
|
||||||
AND tagente_estado.estado != $monitor_filter
|
|
||||||
GROUP BY tagente_modulo.id_agente_modulo
|
|
||||||
ORDER BY tmodule_group.name, $order_sql
|
|
||||||
";
|
|
||||||
|
|
||||||
if ($monitors_change_filter) {
|
if ($monitors_change_filter) {
|
||||||
$limit = " LIMIT " . $config['block_size'] . " OFFSET 0";
|
$limit = " LIMIT " . $config['block_size'] . " OFFSET 0";
|
||||||
|
@ -651,10 +631,10 @@ if ($list_modules) {
|
||||||
$paginate_module = $config['paginate_module'];
|
$paginate_module = $config['paginate_module'];
|
||||||
|
|
||||||
if ($paginate_module) {
|
if ($paginate_module) {
|
||||||
$modules = db_get_all_rows_sql ($sql . $limit);
|
$modules = db_get_all_rows_sql ($sql_modules_info . $limit);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$modules = db_get_all_rows_sql ($sql);
|
$modules = db_get_all_rows_sql ($sql_modules_info);
|
||||||
}
|
}
|
||||||
if (empty ($modules)) {
|
if (empty ($modules)) {
|
||||||
$modules = array ();
|
$modules = array ();
|
||||||
|
|
|
@ -541,10 +541,9 @@ function get_users ($order = false) {
|
||||||
* @return string userid
|
* @return string userid
|
||||||
*/
|
*/
|
||||||
function stripdn ($dn) {
|
function stripdn ($dn) {
|
||||||
list ($uid, $trash) = explode (',', $dn, 2);
|
$array_explode = explode (',', $dn, 2);
|
||||||
list ($trash, $user) = explode ('=', $uid);
|
$array_explode2 = explode ('=', $array_explode[0]);
|
||||||
|
return ($$array_explode2[1]);
|
||||||
return ($user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -601,4 +600,4 @@ function ldap_connect_bind () {
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -112,20 +112,113 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||||
$aux_font_size = $config['font_size'];
|
$aux_font_size = $config['font_size'];
|
||||||
$config['font_size'] = $config['font_size'] + 3;
|
$config['font_size'] = $config['font_size'] + 3;
|
||||||
|
|
||||||
if($type_graph_pdf == 'combined'){
|
echo '<div>';
|
||||||
echo '<div>';
|
switch ($type_graph_pdf) {
|
||||||
|
case 'combined':
|
||||||
echo graphic_combined_module(
|
echo graphic_combined_module(
|
||||||
$module_list,
|
$module_list,
|
||||||
$params,
|
$params,
|
||||||
$params_combined
|
$params_combined
|
||||||
);
|
);
|
||||||
echo '</div>';
|
break;
|
||||||
}
|
case 'sparse':
|
||||||
elseif($type_graph_pdf == 'sparse'){
|
|
||||||
echo '<div>';
|
|
||||||
echo grafico_modulo_sparse($params);
|
echo grafico_modulo_sparse($params);
|
||||||
echo '</div>';
|
break;
|
||||||
|
case 'pie_chart':
|
||||||
|
echo flot_pie_chart(
|
||||||
|
$params['values'],
|
||||||
|
$params['keys'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['water_mark_url'],
|
||||||
|
$params['font'],
|
||||||
|
$params['font_size'],
|
||||||
|
$params['legend_position'],
|
||||||
|
$params['colors'],
|
||||||
|
$params['hide_labels']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'vbar':
|
||||||
|
echo flot_vcolumn_chart(
|
||||||
|
$params['chart_data'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['color'],
|
||||||
|
$params['legend'],
|
||||||
|
$params['long_index'],
|
||||||
|
$params['homeurl'],
|
||||||
|
$params['unit'],
|
||||||
|
$params['water_mark_url'],
|
||||||
|
$params['homedir'],
|
||||||
|
$params['font'],
|
||||||
|
$params['font_size'],
|
||||||
|
$params['from_ux'],
|
||||||
|
$params['from_wux'],
|
||||||
|
$params['backgroundColor'],
|
||||||
|
$params['tick_color']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'hbar':
|
||||||
|
echo flot_hcolumn_chart(
|
||||||
|
$params['chart_data'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['water_mark_url'],
|
||||||
|
$params['font'],
|
||||||
|
$params['font_size'],
|
||||||
|
$params['backgroundColor'],
|
||||||
|
$params['tick_color'],
|
||||||
|
$params['val_min'],
|
||||||
|
$params['val_max']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'ring_graph':
|
||||||
|
echo flot_custom_pie_chart (
|
||||||
|
$params['chart_data'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['colors'],
|
||||||
|
$params['module_name_list'],
|
||||||
|
$params['long_index'],
|
||||||
|
$params['no_data'],
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
$params['water_mark'],
|
||||||
|
$params['font'],
|
||||||
|
$params['font_size'],
|
||||||
|
$params['unit'],
|
||||||
|
$params['ttl'],
|
||||||
|
$params['homeurl'],
|
||||||
|
$params['background_color'],
|
||||||
|
$params['legend_position'],
|
||||||
|
$params['background_color']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'slicebar':
|
||||||
|
echo flot_slicesbar_graph (
|
||||||
|
$params['graph_data'],
|
||||||
|
$params['period'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['legend'],
|
||||||
|
$params['colors'],
|
||||||
|
$params['fontpath'],
|
||||||
|
$params['round_corner'],
|
||||||
|
$params['homeurl'],
|
||||||
|
$params['watermark'],
|
||||||
|
$params['adapt_key'],
|
||||||
|
$params['stat_winalse'],
|
||||||
|
$params['id_agent'],
|
||||||
|
$params['full_legend_daterray'],
|
||||||
|
$params['not_interactive'],
|
||||||
|
1
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
# code...
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
$config['font_size'] = $aux_font_size;
|
$config['font_size'] = $aux_font_size;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC181025';
|
$build_version = 'PC181107';
|
||||||
$pandora_version = 'v7.0NG.728';
|
$pandora_version = 'v7.0NG.728';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
@ -78,7 +78,7 @@ else {
|
||||||
|
|
||||||
// Check if mysqli is available
|
// Check if mysqli is available
|
||||||
if (!(isset($config["mysqli"]))) {
|
if (!(isset($config["mysqli"]))) {
|
||||||
$config["mysqli"] = extension_loaded(mysqli);
|
$config["mysqli"] = extension_loaded('mysqli');
|
||||||
}
|
}
|
||||||
|
|
||||||
$config['start_time'] = microtime (true);
|
$config['start_time'] = microtime (true);
|
||||||
|
@ -250,10 +250,20 @@ if (isset($_POST['vc_refr'])) {
|
||||||
|
|
||||||
|
|
||||||
//======= Autorefresh code =============================================
|
//======= Autorefresh code =============================================
|
||||||
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
|
if(isset($config['id_user'])){
|
||||||
$autorefresh_list = json_decode($select[0]['value']);
|
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
|
||||||
$config['autorefresh_white_list'] = array();
|
if(isset($select[0]['value'])){
|
||||||
$config['autorefresh_white_list'] = $autorefresh_list;
|
$autorefresh_list = json_decode($select[0]['value']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$autorefresh_list =null;
|
||||||
|
}
|
||||||
|
$config['autorefresh_white_list'] = array();
|
||||||
|
$config['autorefresh_white_list'] = $autorefresh_list;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$config['autorefresh_white_list'] = null;
|
||||||
|
}
|
||||||
// Specific metaconsole autorefresh white list sections
|
// Specific metaconsole autorefresh white list sections
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
$config['autorefresh_white_list'][] = 'monitoring/tactical';
|
$config['autorefresh_white_list'][] = 'monitoring/tactical';
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null) {
|
function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null, $charset = "utf8") {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($host === null)
|
if ($host === null)
|
||||||
|
@ -42,6 +42,8 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
|
||||||
}
|
}
|
||||||
db_change_cache_id ($db, $host);
|
db_change_cache_id ($db, $host);
|
||||||
|
|
||||||
|
mysqli_set_charset($connect_id, $charset);
|
||||||
|
|
||||||
mysqli_select_db($connect_id, $db);
|
mysqli_select_db($connect_id, $db);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -52,6 +54,8 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
|
||||||
|
|
||||||
db_change_cache_id ($db, $host);
|
db_change_cache_id ($db, $host);
|
||||||
|
|
||||||
|
@mysql_set_charset($connect_id, $charset);
|
||||||
|
|
||||||
mysql_select_db($db, $connect_id);
|
mysql_select_db($db, $connect_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,47 +1202,6 @@ function mysql_db_get_type_field_table($table, $field) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the element count of a table.
|
|
||||||
*
|
|
||||||
* @param string $sql SQL query to get the element count.
|
|
||||||
*
|
|
||||||
* @return int Return the number of elements in the table.
|
|
||||||
*/
|
|
||||||
function mysql_db_get_table_count($sql, $search_history_db = false) {
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
$history_count = 0;
|
|
||||||
$count = mysql_db_get_value_sql ($sql);
|
|
||||||
if ($count === false) {
|
|
||||||
$count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search the history DB for matches
|
|
||||||
if ($search_history_db && $config['history_db_enabled'] == 1) {
|
|
||||||
|
|
||||||
// Connect to the history DB
|
|
||||||
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
|
||||||
if ($config["mysqli"]) {
|
|
||||||
$config['history_db_connection'] = mysqli_connect_db ($config['history_db_host'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_name'], $config['history_db_port'], false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$config['history_db_connection'] = mysql_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($config['history_db_connection'] !== false) {
|
|
||||||
$history_count = mysql_db_get_value_sql ($sql, $config['history_db_connection']);
|
|
||||||
if ($history_count === false) {
|
|
||||||
$history_count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$count += $history_count;
|
|
||||||
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mysql_get_fields($table) {
|
function mysql_get_fields($table) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
|
|
@ -1476,42 +1476,6 @@ function oracle_list_all_field_table($table_name, $return_mode = 'array') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the element count of a table.
|
|
||||||
*
|
|
||||||
* @param string $sql SQL query to get the element count.
|
|
||||||
*
|
|
||||||
* @return int Return the number of elements in the table.
|
|
||||||
*/
|
|
||||||
function oracle_db_get_table_count($sql, $search_history_db = false) {
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
$history_count = 0;
|
|
||||||
$count = oracle_db_get_value_sql ($sql);
|
|
||||||
if ($count === false) {
|
|
||||||
$count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search the history DB for matches
|
|
||||||
if ($search_history_db && $config['history_db_enabled'] == 1) {
|
|
||||||
|
|
||||||
// Connect to the history DB
|
|
||||||
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
|
||||||
$config['history_db_connection'] = oracle_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
|
|
||||||
}
|
|
||||||
if ($config['history_db_connection'] !== false) {
|
|
||||||
$history_count = oracle_db_get_value_sql ($sql, $config['history_db_connection']);
|
|
||||||
if ($history_count === false) {
|
|
||||||
$history_count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$count += $history_count;
|
|
||||||
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a file with an oracle schema sentences.
|
* Process a file with an oracle schema sentences.
|
||||||
* Based on the function which installs the pandoradb.sql schema.
|
* Based on the function which installs the pandoradb.sql schema.
|
||||||
|
|
|
@ -1055,40 +1055,5 @@ function postgresql_db_get_type_field_table($table, $field) {
|
||||||
return pg_field_type($result, $field);
|
return pg_field_type($result, $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the element count of a table.
|
|
||||||
*
|
|
||||||
* @param string $sql SQL query to get the element count.
|
|
||||||
*
|
|
||||||
* @return int Return the number of elements in the table.
|
|
||||||
*/
|
|
||||||
function postgresql_db_get_table_count($sql, $search_history_db = false) {
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
$history_count = 0;
|
|
||||||
$count = postgresql_db_get_value_sql ($sql);
|
|
||||||
if ($count === false) {
|
|
||||||
$count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search the history DB for matches
|
|
||||||
if ($search_history_db && $config['history_db_enabled'] == 1) {
|
|
||||||
|
|
||||||
// Connect to the history DB
|
|
||||||
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
|
||||||
$config['history_db_connection'] = postgresql_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
|
|
||||||
}
|
|
||||||
if ($config['history_db_connection'] !== false) {
|
|
||||||
$history_count = postgresql_db_get_value_sql ($sql, $config['history_db_connection']);
|
|
||||||
if ($history_count === false) {
|
|
||||||
$history_count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$count += $history_count;
|
|
||||||
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -69,6 +69,10 @@ require_once('functions_io.php');
|
||||||
//}
|
//}
|
||||||
|
|
||||||
function https_is_running() {
|
function https_is_running() {
|
||||||
|
if(isset ($_SERVER['HTTP_X_FORWARDED_PROTO'])
|
||||||
|
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (isset ($_SERVER['HTTPS'])
|
if (isset ($_SERVER['HTTPS'])
|
||||||
&& ($_SERVER['HTTPS'] === true
|
&& ($_SERVER['HTTPS'] === true
|
||||||
|| $_SERVER['HTTPS'] == 'on')) {
|
|| $_SERVER['HTTPS'] == 'on')) {
|
||||||
|
@ -1369,10 +1373,11 @@ function is_metaconsole() {
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_management_allowed() {
|
function is_management_allowed($hkey = '') {
|
||||||
global $config;
|
global $config;
|
||||||
return ( (is_metaconsole() && $config["centralized_management"])
|
return ( (is_metaconsole() && $config["centralized_management"])
|
||||||
|| (!is_metaconsole() && !$config["centralized_management"]));
|
|| (!is_metaconsole() && !$config["centralized_management"])
|
||||||
|
|| (!is_metaconsole() && $config["centralized_management"]) && $hkey == generate_hash_to_api());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2466,26 +2471,26 @@ function is_double_auth_enabled ($user) {
|
||||||
|
|
||||||
function clear_pandora_error_for_header() {
|
function clear_pandora_error_for_header() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$config["alert_cnt"] = 0;
|
$config["alert_cnt"] = 0;
|
||||||
$_SESSION["alert_msg"] = array();
|
$_SESSION["alert_msg"] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_pandora_error_for_header($message, $title = null) {
|
function set_pandora_error_for_header($message, $title = null) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (!isset($config['alert_cnt']))
|
if (!isset($config['alert_cnt']))
|
||||||
$config['alert_cnt'] = 0;
|
$config['alert_cnt'] = 0;
|
||||||
|
|
||||||
if (!isset($_SESSION['alert_msg']))
|
if ( ( !isset($_SESSION['alert_msg']) && (!is_array($_SESSION['alert_msg'])) ) )
|
||||||
$_SESSION['alert_msg'] = array();
|
$_SESSION['alert_msg'] = array();
|
||||||
|
|
||||||
$message_config = array();
|
$message_config = array();
|
||||||
if (isset($title))
|
if (isset($title))
|
||||||
$message_config['title'] = $title;
|
$message_config['title'] = $title;
|
||||||
$message_config['message'] = $message;
|
$message_config['message'] = $message;
|
||||||
$message_config['no_close'] = true;
|
$message_config['no_close'] = true;
|
||||||
|
|
||||||
$config['alert_cnt']++;
|
$config['alert_cnt']++;
|
||||||
$_SESSION['alert_msg'][] = array('type' => 'error', 'message' => $message_config);
|
$_SESSION['alert_msg'][] = array('type' => 'error', 'message' => $message_config);
|
||||||
}
|
}
|
||||||
|
@ -3128,16 +3133,23 @@ function series_type_graph_array($data, $show_elements_graph){
|
||||||
if (isset($show_elements_graph['labels']) &&
|
if (isset($show_elements_graph['labels']) &&
|
||||||
is_array($show_elements_graph['labels']) &&
|
is_array($show_elements_graph['labels']) &&
|
||||||
(count($show_elements_graph['labels']) > 0)){
|
(count($show_elements_graph['labels']) > 0)){
|
||||||
$name_legend = $data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']] . ' ' ;
|
if ($show_elements_graph['unit'])
|
||||||
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
|
||||||
|
else
|
||||||
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(strpos($key, 'baseline') !== false){
|
if(strpos($key, 'baseline') !== false){
|
||||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
|
if ($show_elements_graph['unit'])
|
||||||
$value['module_name'] . ' Baseline ';
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .'Baseline ';
|
||||||
|
else
|
||||||
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . 'Baseline ';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
|
if ($show_elements_graph['unit'])
|
||||||
$value['module_name'] . ': ';
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
|
||||||
|
else
|
||||||
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3173,6 +3185,11 @@ function series_type_graph_array($data, $show_elements_graph){
|
||||||
!$show_elements_graph['fullscale'] && strpos($key, 'max') !== false){
|
!$show_elements_graph['fullscale'] && strpos($key, 'max') !== false){
|
||||||
$data_return['series_type'][$key] = $type_graph;
|
$data_return['series_type'][$key] = $type_graph;
|
||||||
|
|
||||||
|
if ($show_elements_graph['unit'])
|
||||||
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
|
||||||
|
else
|
||||||
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
|
||||||
|
|
||||||
$data_return['legend'][$key] = $name_legend;
|
$data_return['legend'][$key] = $name_legend;
|
||||||
if($show_elements_graph['type_mode_graph']){
|
if($show_elements_graph['type_mode_graph']){
|
||||||
$data_return['legend'][$key] .=
|
$data_return['legend'][$key] .=
|
||||||
|
@ -3234,6 +3251,10 @@ function series_type_graph_array($data, $show_elements_graph){
|
||||||
__('Percentil') . ' ' .
|
__('Percentil') . ' ' .
|
||||||
$config['percentil'] .
|
$config['percentil'] .
|
||||||
'º ' . __('of module') . ' ';
|
'º ' . __('of module') . ' ';
|
||||||
|
if ($show_elements_graph['unit'])
|
||||||
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
|
||||||
|
else
|
||||||
|
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
|
||||||
$data_return['legend'][$key] .= $name_legend;
|
$data_return['legend'][$key] .= $name_legend;
|
||||||
$data_return['legend'][$key] .= remove_right_zeros(
|
$data_return['legend'][$key] .= remove_right_zeros(
|
||||||
number_format(
|
number_format(
|
||||||
|
@ -3367,4 +3388,8 @@ function validate_csrf_code() {
|
||||||
return isset($code) && isset($_SESSION['csrf_code'])
|
return isset($code) && isset($_SESSION['csrf_code'])
|
||||||
&& $_SESSION['csrf_code'] == $code;
|
&& $_SESSION['csrf_code'] == $code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generate_hash_to_api(){
|
||||||
|
hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key'));
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -28,13 +28,14 @@ require_once($config['homedir'] . '/include/functions_users.php');
|
||||||
*
|
*
|
||||||
* @param int $id_agent The agent id.
|
* @param int $id_agent The agent id.
|
||||||
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
||||||
|
* @param boolean $force_meta
|
||||||
*
|
*
|
||||||
* @return boolean The result to check if the agent is in the DB.
|
* @return boolean The result to check if the agent is in the DB.
|
||||||
*/
|
*/
|
||||||
function agents_check_agent_exists($id_agent, $show_disabled = true) {
|
function agents_check_agent_exists($id_agent, $show_disabled = true, $force_meta = false) {
|
||||||
$agent = db_get_value_filter(
|
$agent = db_get_value_filter(
|
||||||
'id_agente',
|
'id_agente',
|
||||||
'tagente',
|
$force_meta ? 'tmetaconsole_agent' : 'tagente',
|
||||||
array('id_agente' => $id_agent, 'disabled' => !$show_disabled)
|
array('id_agente' => $id_agent, 'disabled' => !$show_disabled)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2733,17 +2734,18 @@ function agents_count_agents_filter ($filter = array(), $access = "AR") {
|
||||||
*
|
*
|
||||||
* @param int Id agent
|
* @param int Id agent
|
||||||
* @param string ACL access bit
|
* @param string ACL access bit
|
||||||
|
* @param boolean $force_meta
|
||||||
*
|
*
|
||||||
* @return True if user has access, false if user has not permissions and
|
* @return True if user has access, false if user has not permissions and
|
||||||
* null if id agent does not exist
|
* null if id agent does not exist
|
||||||
*/
|
*/
|
||||||
function agents_check_access_agent ($id_agent, $access = "AR") {
|
function agents_check_access_agent ($id_agent, $access = "AR", $force_meta = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (users_access_to_agent($id_agent, $access)) return true;
|
if (users_access_to_agent($id_agent, $access, false, $force_meta)) return true;
|
||||||
|
|
||||||
// If agent exist return false
|
// If agent exist return false
|
||||||
if (agents_check_agent_exists($id_agent)) return false;
|
if (agents_check_agent_exists($id_agent, true, $force_meta)) return false;
|
||||||
// Return null otherwise
|
// Return null otherwise
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ include_once($config['homedir'] . "/include/functions_network_components.php");
|
||||||
include_once($config['homedir'] . "/include/functions_netflow.php");
|
include_once($config['homedir'] . "/include/functions_netflow.php");
|
||||||
include_once($config['homedir'] . "/include/functions_servers.php");
|
include_once($config['homedir'] . "/include/functions_servers.php");
|
||||||
include_once($config['homedir'] . "/include/functions_planned_downtimes.php");
|
include_once($config['homedir'] . "/include/functions_planned_downtimes.php");
|
||||||
include_once($config['homedir'] . "/include/functions_db.php");
|
|
||||||
enterprise_include_once ('include/functions_local_components.php');
|
enterprise_include_once ('include/functions_local_components.php');
|
||||||
enterprise_include_once ('include/functions_events.php');
|
enterprise_include_once ('include/functions_events.php');
|
||||||
enterprise_include_once ('include/functions_agents.php');
|
enterprise_include_once ('include/functions_agents.php');
|
||||||
|
@ -100,7 +99,7 @@ function returnError($typeError, $returnType = 'string') {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
returnData("string",
|
returnData("string",
|
||||||
array('type' => 'string', 'data' => __($typeError)));
|
array('type' => 'string', 'data' => __($returnType)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5412,7 +5411,8 @@ function api_set_planned_downtimes_created ($id, $thrash1, $other, $thrash3) {
|
||||||
'periodically_day_to' => $other['data'][14],
|
'periodically_day_to' => $other['data'][14],
|
||||||
'type_downtime' => $other['data'][15],
|
'type_downtime' => $other['data'][15],
|
||||||
'type_execution' => $other['data'][16],
|
'type_execution' => $other['data'][16],
|
||||||
'type_periodicity' => $other['data'][17]
|
'type_periodicity' => $other['data'][17],
|
||||||
|
'id_user' => $other['data'][18]
|
||||||
);
|
);
|
||||||
|
|
||||||
$returned = planned_downtimes_created($values);
|
$returned = planned_downtimes_created($values);
|
||||||
|
@ -6870,7 +6870,6 @@ function api_get_graph_module_data($id, $thrash1, $other, $thrash2) {
|
||||||
$ttl = 1;
|
$ttl = 1;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
$config['flash_charts'] = 0;
|
|
||||||
|
|
||||||
$params =array(
|
$params =array(
|
||||||
'agent_module_id' => $id,
|
'agent_module_id' => $id,
|
||||||
|
@ -6950,7 +6949,7 @@ function api_set_new_user($id, $thrash2, $other, $thrash3) {
|
||||||
* @param string $id String username for user login in Pandora
|
* @param string $id String username for user login in Pandora
|
||||||
* @param $thrash2 Don't use.
|
* @param $thrash2 Don't use.
|
||||||
* @param array $other it's array, $other as param is <fullname>;<firstname>;<lastname>;<middlename>;<password>;
|
* @param array $other it's array, $other as param is <fullname>;<firstname>;<lastname>;<middlename>;<password>;
|
||||||
* <email>;<phone>;<language>;<comments>;<is_admin>;<block_size>;<flash_chart> in this order and separator char
|
* <email>;<phone>;<language>;<comments>;<is_admin>;<block_size>;in this order and separator char
|
||||||
* (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
* (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||||
* example:
|
* example:
|
||||||
*
|
*
|
||||||
|
@ -6975,15 +6974,14 @@ function api_set_update_user($id, $thrash2, $other, $thrash3) {
|
||||||
'lastname',
|
'lastname',
|
||||||
'middlename',
|
'middlename',
|
||||||
'password',
|
'password',
|
||||||
'email',
|
'email',
|
||||||
'phone',
|
'phone',
|
||||||
'language',
|
'language',
|
||||||
'comments',
|
'comments',
|
||||||
'is_admin',
|
'is_admin',
|
||||||
'block_size',
|
'block_size'
|
||||||
'flash_chart');
|
);
|
||||||
|
|
||||||
|
|
||||||
if ($id == "") {
|
if ($id == "") {
|
||||||
returnError('error_update_user',
|
returnError('error_update_user',
|
||||||
__('Error updating user. Id_user cannot be left blank.'));
|
__('Error updating user. Id_user cannot be left blank.'));
|
||||||
|
@ -9280,18 +9278,27 @@ function api_get_agent_id($trash1, $trash2, $data, $returnType) {
|
||||||
* Agent alias for a given id
|
* Agent alias for a given id
|
||||||
*
|
*
|
||||||
* @param int $id_agent
|
* @param int $id_agent
|
||||||
|
* @param int $id_node Only for metaconsole
|
||||||
|
* @param $thrash1 Don't use.
|
||||||
|
* @param $returnType
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
// http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora
|
// http://localhost/pandora_console/include/api.php?op=get&op2=agent_alias&id=1&apipass=1234&user=admin&pass=pandora
|
||||||
function api_get_agent_alias($id_agent, $trash1, $trash2, $returnType) {
|
// http://localhost/pandora_console/enterprise/meta/include/api.php?op=get&op2=agent_alias&id=1&id2=1&apipass=1234&user=admin&pass=pandora
|
||||||
if (defined ('METACONSOLE')) {
|
function api_get_agent_alias($id_agent, $id_node, $trash1, $returnType) {
|
||||||
return;
|
$table_agent_alias = 'tagente';
|
||||||
|
$force_meta=false;
|
||||||
|
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$table_agent_alias = 'tmetaconsole_agent';
|
||||||
|
$force_meta = true;
|
||||||
|
$id_agent = db_get_value_sql("SELECT id_agente FROM tmetaconsole_agent WHERE id_tagente = $id_agent AND id_tmetaconsole_setup = $id_node");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!util_api_check_agent_and_print_error($id_agent, $returnType)) return;
|
if (!util_api_check_agent_and_print_error($id_agent, $returnType, 'AR', $force_meta)) return;
|
||||||
|
|
||||||
$sql = sprintf('SELECT alias
|
$sql = sprintf('SELECT alias
|
||||||
FROM tagente
|
FROM ' . $table_agent_alias . '
|
||||||
WHERE id_agente = %d', $id_agent);
|
WHERE id_agente = %d', $id_agent);
|
||||||
$value = db_get_value_sql($sql);
|
$value = db_get_value_sql($sql);
|
||||||
|
|
||||||
|
@ -9523,8 +9530,11 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$id_agent = $agent_cache['id_tagente'];
|
$id_agent = $agent_cache['id_tagente'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$values['id_agente'] = $id_agent;
|
||||||
|
|
||||||
if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AR')) {
|
if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AR')) {
|
||||||
if (is_metaconsole()) metaconsole_restore_db();
|
if (is_metaconsole()) metaconsole_restore_db();
|
||||||
return;
|
return;
|
||||||
|
@ -10753,22 +10763,20 @@ function api_set_metaconsole_synch($keys) {
|
||||||
array(db_escape_key_identifier('value') => $value),
|
array(db_escape_key_identifier('value') => $value),
|
||||||
array(db_escape_key_identifier('key') => $key));
|
array(db_escape_key_identifier('key') => $key));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate update the license in nodes:
|
// Validate update the license in nodes:
|
||||||
enterprise_include_once('include/functions_metaconsole.php');
|
enterprise_include_once('include/functions_metaconsole.php');
|
||||||
list ($nodes_failed, $total_nodes) = metaconsole_update_all_nodes_license();
|
$array_metaconsole_update = metaconsole_update_all_nodes_license();
|
||||||
if ($nodes_failed === 0) {
|
if ($array_metaconsole_update[0] === 0) {
|
||||||
echo __('Metaconsole and all nodes license updated');
|
ui_print_success_message(__('Metaconsole and all nodes license updated'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo __('Metaconsole license updated but %d of %d node synchronization failed', $nodes_failed, $total_nodes);
|
ui_print_error_message(__('Metaconsole license updated but %d of %d node synchronization failed', $array_metaconsole_update[0], $array_metaconsole_update[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo __('This function is only for metaconsole');
|
echo __('This function is only for metaconsole');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
||||||
|
@ -10862,12 +10870,17 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
||||||
else
|
else
|
||||||
db_pandora_audit("Report management", "Failed to create cluster agent $name");
|
db_pandora_audit("Report management", "Failed to create cluster agent $name");
|
||||||
|
|
||||||
returnData('string',
|
if ($id_cluster !== false)
|
||||||
array('type' => 'string', 'data' => (int)$id_cluster));
|
returnData('string',
|
||||||
|
array('type' => 'string', 'data' => (int)$id_cluster));
|
||||||
|
else
|
||||||
|
returnError('error_set_new_cluster', __('Failed to create cluster.'));
|
||||||
} else {
|
} else {
|
||||||
returnError('error_set_new_cluster', __('Agent name cannot be empty.'));
|
returnError('error_set_new_cluster', __('Agent name cannot be empty.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) {
|
function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) {
|
||||||
|
@ -11306,6 +11319,7 @@ function api_get_cluster_status($id_cluster, $trash1, $trash2, $returnType) {
|
||||||
|
|
||||||
if ($value === false) {
|
if ($value === false) {
|
||||||
returnError('id_not_found', $returnType);
|
returnError('id_not_found', $returnType);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array('type' => 'string', 'data' => $value);
|
$data = array('type' => 'string', 'data' => $value);
|
||||||
|
@ -11323,6 +11337,7 @@ function api_get_cluster_id_by_name($cluster_name, $trash1, $trash2, $returnType
|
||||||
$value = cluster_get_id_by_name($cluster_name);
|
$value = cluster_get_id_by_name($cluster_name);
|
||||||
if(($value === false) || ($value === null)){
|
if(($value === false) || ($value === null)){
|
||||||
returnError('id_not_found', $returnType);
|
returnError('id_not_found', $returnType);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cluster_group = clusters_get_group($value);
|
$cluster_group = clusters_get_group($value);
|
||||||
|
@ -11477,10 +11492,10 @@ function api_get_cluster_items ($cluster_id){
|
||||||
// AUX FUNCTIONS
|
// AUX FUNCTIONS
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR") {
|
function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR", $force_meta = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$check_agent = agents_check_access_agent($id_agent, $access);
|
$check_agent = agents_check_access_agent($id_agent, $access, $force_meta);
|
||||||
if ($check_agent === true) return true;
|
if ($check_agent === true) return true;
|
||||||
|
|
||||||
if ($check_agent === false || !check_acl($config['id_user'], 0, $access)) {
|
if ($check_agent === false || !check_acl($config['id_user'], 0, $access)) {
|
||||||
|
@ -11492,282 +11507,8 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function api_get_user_info($thrash1, $thrash2, $other, $returnType) {
|
|
||||||
if (defined ('METACONSOLE')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$separator = ';';
|
|
||||||
|
|
||||||
$other = json_decode(base64_decode($other['data']),true);
|
|
||||||
|
|
||||||
$sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"';
|
|
||||||
|
|
||||||
$user_info = db_get_all_rows_sql($sql);
|
|
||||||
|
|
||||||
if (count($user_info) > 0 and $user_info !== false) {
|
|
||||||
$data = array('type' => 'array', 'data' => $user_info);
|
|
||||||
returnData($returnType, $data, $separator);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
This function receives different parameters to process one of these actions the logging process in our application from the records in the audit of pandora fms, to avoid concurrent access of administrator users, and optionally to prohibit access to non-administrator users:
|
|
||||||
|
|
||||||
Parameter 0
|
|
||||||
|
|
||||||
The User ID that attempts the action is used to check the status of the application for access.
|
|
||||||
|
|
||||||
Parameter 1
|
|
||||||
|
|
||||||
Login, logout, exclude, browse.
|
|
||||||
|
|
||||||
These requests receive a response that we can treat as we consider, this function only sends answers, does not perform any action in your application, you must customize them.
|
|
||||||
|
|
||||||
Login action: free (register our access), taken, denied (if you are not an administrator user and parameter four is set to 1, register the expulsion).
|
|
||||||
|
|
||||||
Browse action: It has the same answers as login, but does not register anything in the audit.
|
|
||||||
|
|
||||||
Logout action: It records the deslogeo but does not send a response.
|
|
||||||
|
|
||||||
All other actions do not return a response,
|
|
||||||
|
|
||||||
Parameter 2
|
|
||||||
|
|
||||||
IP address of the application is also used to check the status of the application for access.
|
|
||||||
|
|
||||||
Parameter 3
|
|
||||||
|
|
||||||
Name of the application, it is also used to check the status of the application for access.
|
|
||||||
|
|
||||||
Parameter 4
|
|
||||||
|
|
||||||
If you mark 1 you will avoid the access to the non-administrators users, returning the response `denied' and registering that expulsion in the audit of pandora fms.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function api_set_access_process($thrash1, $thrash2, $other, $returnType) {
|
|
||||||
if (defined ('METACONSOLE')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$other['data'] = explode('|',$other['data']);
|
|
||||||
|
|
||||||
$sql = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario != "'.$other['data'][0].'" order by utimestamp DESC limit 1';
|
|
||||||
$audit_concurrence = db_get_all_rows_sql($sql);
|
|
||||||
$sql_user = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario = "'.$other['data'][0].'" order by utimestamp DESC limit 1';
|
|
||||||
$audit_concurrence_user = db_get_all_rows_sql($sql_user);
|
|
||||||
$sql2 = 'select id_usuario,utimestamp,accion from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logoff%" and id_usuario = "'.$audit_concurrence[0]['id_usuario'].'" order by utimestamp DESC limit 1';
|
|
||||||
$audit_concurrence_2 = db_get_all_rows_sql($sql2);
|
|
||||||
|
|
||||||
//The user trying to log in is an administrator
|
|
||||||
if(users_is_admin($other['data'][0])){
|
|
||||||
//The admin user is trying to login
|
|
||||||
if($other['data'][1] == 'login'){
|
|
||||||
// Check if there is an administrator user logged in prior to our last login
|
|
||||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
|
|
||||||
// Check if the administrator user logged in later to us has unlogged and left the node free
|
|
||||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
|
|
||||||
// The administrator user logged in later has not yet unlogged
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'taken'));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// The administrator user logged in later has already unlogged
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// There is no administrator user who has logged in since then to log us in.
|
|
||||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
elseif ($other['data'][1] == 'logout') {
|
|
||||||
// The administrator user wants to log out
|
|
||||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
|
|
||||||
}
|
|
||||||
elseif ($other['data'][1] == 'exclude') {
|
|
||||||
// The administrator user has ejected another administrator user who was logged in
|
|
||||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
|
||||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2] , $audit_concurrence[0]['id_usuario']);
|
|
||||||
|
|
||||||
}
|
|
||||||
//The admin user is trying to browse
|
|
||||||
elseif ($other['data'][1] == 'browse') {
|
|
||||||
// Check if there is an administrator user logged in prior to our last login
|
|
||||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
|
|
||||||
// Check if the administrator user logged in later to us has unlogged and left the node free
|
|
||||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
|
|
||||||
// The administrator user logged in later has not yet unlogged
|
|
||||||
returnData('string', array('type' => 'string', 'data' => $audit_concurrence[0]['id_usuario']));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// The administrator user logged in later has already unlogged
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// There is no administrator user who has logged in since then to log us in.
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
elseif ($other['data'][1] == 'cancelled'){
|
|
||||||
//The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in.
|
|
||||||
db_pandora_audit($other['data'][3].' cancelled access', 'Cancelled access in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'cancelled'));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
if($other['data'][4] == 1){
|
|
||||||
//The user trying to log in is not an administrator and is not allowed no admin access
|
|
||||||
db_pandora_audit($other['data'][3].' denied access', 'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'denied'));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//The user trying to log in is not an administrator and is allowed no admin access
|
|
||||||
if($other['data'][1] == 'login'){
|
|
||||||
//The user trying to login is not admin, can enter without concurrent use filter
|
|
||||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
|
||||||
|
|
||||||
}
|
|
||||||
elseif ($other['data'][1] == 'logout') {
|
|
||||||
//The user trying to logoff is not admin
|
|
||||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
|
|
||||||
}
|
|
||||||
elseif ($other['data'][1] == 'browse'){
|
|
||||||
//The user trying to browse in an app page is not admin, can enter without concurrent use filter
|
|
||||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function api_get_traps($thrash1, $thrash2, $other, $returnType) {
|
|
||||||
|
|
||||||
if (defined ('METACONSOLE')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$other['data'] = explode('|',$other['data']);
|
|
||||||
|
|
||||||
$other['data'][1] = date("Y-m-d H:i:s",$other['data'][1]);
|
|
||||||
|
|
||||||
$sql = 'SELECT * from ttrap where timestamp >= "'.$other['data'][1].'"';
|
|
||||||
|
|
||||||
// $sql = 'SELECT * from ttrap where source = "'.$other['data'][0].'" and timestamp >= "'.$other['data'][1].'"';
|
|
||||||
|
|
||||||
if($other['data'][4]){
|
|
||||||
$other['data'][4] = date("Y-m-d H:i:s",$other['data'][4]);
|
|
||||||
$sql .= ' and timestamp <= "'.$other['data'][4].'"';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($other['data'][2]){
|
|
||||||
$sql .= ' limit '.$other['data'][2];
|
|
||||||
}
|
|
||||||
|
|
||||||
if($other['data'][3]){
|
|
||||||
$sql .= ' offset '.$other['data'][3];
|
|
||||||
}
|
|
||||||
|
|
||||||
if($other['data'][5]){
|
|
||||||
$sql .= ' and status = 0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sizeof($other['data']) == 0){
|
|
||||||
$sql = 'SELECT * from ttrap';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$traps = db_get_all_rows_sql($sql);
|
|
||||||
|
|
||||||
if($other['data'][6]){
|
|
||||||
|
|
||||||
foreach ($traps as $key => $value) {
|
|
||||||
|
|
||||||
if(!strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'false'){
|
|
||||||
unset($traps[$key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'true'){
|
|
||||||
unset($traps[$key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$traps_json = json_encode($traps);
|
|
||||||
|
|
||||||
if (count($traps) > 0 and $traps !== false) {
|
|
||||||
returnData('string', array('type' => 'string', 'data' => $traps_json));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
|
|
||||||
|
|
||||||
if (defined ('METACONSOLE')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($id == 'all'){
|
|
||||||
$result = db_process_sql_update('ttrap',array('status' => 1));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$result = db_process_sql_update('ttrap',
|
|
||||||
array('status' => 1), array('id_trap' => $id));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_error($result)) {
|
|
||||||
// TODO: Improve the error returning more info
|
|
||||||
returnError('error_update_trap', __('Error in trap update.'));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
returnData('string',
|
|
||||||
array('type' => 'string',
|
|
||||||
'data' => __('Validated traps.')));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
|
|
||||||
|
|
||||||
if (defined ('METACONSOLE')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($id == 'all'){
|
|
||||||
$result = db_process_sql ('delete from ttrap');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$result = db_process_sql_delete('ttrap',array('id_trap' => $id));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_error($result)) {
|
|
||||||
// TODO: Improve the error returning more info
|
|
||||||
returnError('error_delete_trap', __('Error in trap delete.'));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
returnData('string',
|
|
||||||
array('type' => 'string',
|
|
||||||
'data' => __('Deleted traps.')));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -43,7 +43,6 @@ function config_create_value ($token, $value) {
|
||||||
*/
|
*/
|
||||||
function config_update_value ($token, $value) {
|
function config_update_value ($token, $value) {
|
||||||
global $config;
|
global $config;
|
||||||
$config['flash_charts'] = true;
|
|
||||||
// Include functions_io to can call __() function
|
// Include functions_io to can call __() function
|
||||||
include_once($config['homedir'] . '/include/functions_io.php');
|
include_once($config['homedir'] . '/include/functions_io.php');
|
||||||
|
|
||||||
|
@ -1533,7 +1532,7 @@ function config_process_config () {
|
||||||
else {
|
else {
|
||||||
if (!json_decode(io_safe_output($config['ad_adv_perms']))) {
|
if (!json_decode(io_safe_output($config['ad_adv_perms']))) {
|
||||||
$temp_ad_adv_perms = array();
|
$temp_ad_adv_perms = array();
|
||||||
if ($config['ad_adv_perms'] != '') {
|
if (!isset($config['ad_adv_perms']) && $config['ad_adv_perms'] != '') {
|
||||||
$perms = explode(';', io_safe_output($config['ad_adv_perms']));
|
$perms = explode(';', io_safe_output($config['ad_adv_perms']));
|
||||||
foreach ($perms as $ad_adv_perm) {
|
foreach ($perms as $ad_adv_perm) {
|
||||||
if (preg_match('/[\[\]]/',$ad_adv_perm)) {
|
if (preg_match('/[\[\]]/',$ad_adv_perm)) {
|
||||||
|
@ -1597,7 +1596,7 @@ function config_process_config () {
|
||||||
else {
|
else {
|
||||||
if (!json_decode(io_safe_output($config['ldap_adv_perms']))) {
|
if (!json_decode(io_safe_output($config['ldap_adv_perms']))) {
|
||||||
$temp_ldap_adv_perms = array();
|
$temp_ldap_adv_perms = array();
|
||||||
if ($config['ldap_adv_perms'] != '') {
|
if (!isset($config['ad_adv_perms']) && $config['ldap_adv_perms'] != '') {
|
||||||
$perms = explode(';', io_safe_output($config['ldap_adv_perms']));
|
$perms = explode(';', io_safe_output($config['ldap_adv_perms']));
|
||||||
foreach ($perms as $ad_adv_perm) {
|
foreach ($perms as $ad_adv_perm) {
|
||||||
if (preg_match('/[\[\]]/',$ad_adv_perm)) {
|
if (preg_match('/[\[\]]/',$ad_adv_perm)) {
|
||||||
|
@ -2260,8 +2259,7 @@ function config_user_set_custom_config() {
|
||||||
if ($userinfo['last_connect'] < (time()-SECONDS_1MINUTE)) {
|
if ($userinfo['last_connect'] < (time()-SECONDS_1MINUTE)) {
|
||||||
update_user($config['id_user'], array('last_connect' => time()));
|
update_user($config['id_user'], array('last_connect' => time()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If block_size or flash_chart are provided then override global settings
|
|
||||||
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
|
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
|
||||||
$config["block_size"] = $userinfo["block_size"];
|
$config["block_size"] = $userinfo["block_size"];
|
||||||
|
|
||||||
|
@ -2279,9 +2277,14 @@ function config_user_set_custom_config() {
|
||||||
|
|
||||||
function config_prepare_session() {
|
function config_prepare_session() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$user = users_get_user_by_id($config["id_user"]);
|
if(isset($config["id_user"])){
|
||||||
$user_sesion_time = $user['session_time'];
|
$user = users_get_user_by_id($config["id_user"]);
|
||||||
|
$user_sesion_time = $user['session_time'];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$user_sesion_time = null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($user_sesion_time == 0) {
|
if ($user_sesion_time == 0) {
|
||||||
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
|
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
|
||||||
|
@ -2291,20 +2294,20 @@ function config_prepare_session() {
|
||||||
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
|
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
|
||||||
$sessionCookieExpireTime = $user_sesion_time;
|
$sessionCookieExpireTime = $user_sesion_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sessionCookieExpireTime <= 0)
|
if ($sessionCookieExpireTime <= 0)
|
||||||
$sessionCookieExpireTime = 10 * 365 * 24 * 60 * 60;
|
$sessionCookieExpireTime = 10 * 365 * 24 * 60 * 60;
|
||||||
else
|
else
|
||||||
$sessionCookieExpireTime *= 60;
|
$sessionCookieExpireTime *= 60;
|
||||||
|
|
||||||
ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);
|
@ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);
|
||||||
session_set_cookie_params ($sessionCookieExpireTime);
|
@session_set_cookie_params ($sessionCookieExpireTime);
|
||||||
|
|
||||||
// Reset the expiration time upon page load //session_name() is default name of session PHPSESSID
|
// Reset the expiration time upon page load //session_name() is default name of session PHPSESSID
|
||||||
|
|
||||||
if (isset($_COOKIE[session_name()]))
|
if (isset($_COOKIE[session_name()]))
|
||||||
setcookie(session_name(), $_COOKIE[session_name()], time() + $sessionCookieExpireTime, "/");
|
setcookie(session_name(), $_COOKIE[session_name()], time() + $sessionCookieExpireTime, "/");
|
||||||
|
|
||||||
ini_set("post_max_size", $config["max_file_size"]);
|
ini_set("post_max_size", $config["max_file_size"]);
|
||||||
ini_set("upload_max_filesize", $config["max_file_size"]);
|
ini_set("upload_max_filesize", $config["max_file_size"]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,44 +43,55 @@ function cron_update_module_interval ($module_id, $cron) {
|
||||||
|
|
||||||
// Get the number of seconds left to the next execution of the given cron entry.
|
// Get the number of seconds left to the next execution of the given cron entry.
|
||||||
function cron_next_execution ($cron, $module_interval, $module_id) {
|
function cron_next_execution ($cron, $module_interval, $module_id) {
|
||||||
|
|
||||||
// Get day of the week and month from cron config
|
// Get day of the week and month from cron config
|
||||||
list ($minute, $hour, $mday, $month, $wday) = explode (" ", $cron);
|
$cron_array = explode (" ", $cron);
|
||||||
|
$minute = $cron_array[0];
|
||||||
|
$hour = $cron_array[1];
|
||||||
|
$mday = $cron_array[2];
|
||||||
|
$month = $cron_array[3];
|
||||||
|
$wday = $cron_array[4];
|
||||||
|
|
||||||
// Get last execution time
|
// Get last execution time
|
||||||
$last_execution = db_get_value('utimestamp', 'tagente_estado', 'id_agente_modulo', $module_id);
|
$last_execution = db_get_value('utimestamp', 'tagente_estado', 'id_agente_modulo', $module_id);
|
||||||
$cur_time = ($last_execution !== false) ? $last_execution : time();
|
$cur_time = ($last_execution !== false) ? $last_execution : time();
|
||||||
|
|
||||||
// Any day of the way
|
// Any day of the way
|
||||||
if ($wday == '*') {
|
if ($wday == '*') {
|
||||||
$nex_time = cron_next_execution_date ($cron, $cur_time, $module_interval);
|
$nex_time = cron_next_execution_date ($cron, $cur_time, $module_interval);
|
||||||
return $nex_time - $cur_time;
|
return $nex_time - $cur_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A specific day of the week
|
// A specific day of the week
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$nex_time = $cur_time;
|
$nex_time = $cur_time;
|
||||||
do {
|
do {
|
||||||
$nex_time = cron_next_execution_date ($cron, $nex_time, $module_interval);
|
$nex_time = cron_next_execution_date ($cron, $nex_time, $module_interval);
|
||||||
$nex_time_wd = $nex_time;
|
$nex_time_wd = $nex_time;
|
||||||
list ($nex_mon, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
|
||||||
|
$array_nex = explode (" ", date ("m w", $nex_time_wd));
|
||||||
|
$nex_mon = $array_nex[0];
|
||||||
|
$nex_wday = $array_nex[1];
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// Check the day of the week
|
// Check the day of the week
|
||||||
if ($nex_wday == $wday) {
|
if ($nex_wday == $wday) {
|
||||||
return $nex_time_wd - $cur_time;
|
return $nex_time_wd - $cur_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move to the next day of the month
|
// Move to the next day of the month
|
||||||
$nex_time_wd += SECONDS_1DAY;
|
$nex_time_wd += SECONDS_1DAY;
|
||||||
list ($nex_mon_wd, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
|
||||||
|
$array_nex_w = explode (" ", date ("m w", $nex_time_wd));
|
||||||
|
$nex_mon_wd = $array_nex_w[0];
|
||||||
|
$nex_wday = $array_nex_w[1];
|
||||||
}
|
}
|
||||||
while ($mday == '*' && $nex_mon_wd == $nex_mon);
|
while ($mday == '*' && $nex_mon_wd == $nex_mon);
|
||||||
|
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
while ($count < SECONDS_1MINUTE);
|
while ($count < SECONDS_1MINUTE);
|
||||||
|
|
||||||
// Something went wrong, default to 5 minutes
|
// Something went wrong, default to 5 minutes
|
||||||
return SECONDS_5MINUTES;
|
return SECONDS_5MINUTES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,13 +43,13 @@ function db_select_engine() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function db_connect($host = null, $db = null, $user = null, $pass = null, $port = null, $critical = true) {
|
function db_connect($host = null, $db = null, $user = null, $pass = null, $port = null, $critical = true, $charset = "utf8") {
|
||||||
global $config;
|
global $config;
|
||||||
static $error = 0;
|
static $error = 0;
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$return = mysql_connect_db($host, $db, $user, $pass, $port);
|
$return = mysql_connect_db($host, $db, $user, $pass, $port, $charset);
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$return = postgresql_connect_db($host, $db, $user, $pass, $port);
|
$return = postgresql_connect_db($host, $db, $user, $pass, $port);
|
||||||
|
@ -544,28 +544,30 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($events as $event) {
|
if(is_array($events)){
|
||||||
switch ($event["event_type"]) {
|
foreach ($events as $event) {
|
||||||
case "going_up_critical":
|
switch ($event["event_type"]) {
|
||||||
case "going_up_warning":
|
case "going_up_critical":
|
||||||
case "going_up_normal":
|
case "going_up_warning":
|
||||||
case "going_down_critical":
|
case "going_up_normal":
|
||||||
case "going_down_warning":
|
case "going_down_critical":
|
||||||
case "going_down_normal": {
|
case "going_down_warning":
|
||||||
if ($last_status == 1) {
|
case "going_down_normal": {
|
||||||
$return[$i]["time_to"] = $event["utimestamp"];
|
if ($last_status == 1) {
|
||||||
$i++;
|
$return[$i]["time_to"] = $event["utimestamp"];
|
||||||
$last_status = 0;
|
$i++;
|
||||||
|
$last_status = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
case "going_unknown":{
|
||||||
}
|
if ($last_status == 0){
|
||||||
case "going_unknown":{
|
$return[$i] = array();
|
||||||
if ($last_status == 0){
|
$return[$i]["time_from"] = $event["utimestamp"];
|
||||||
$return[$i] = array();
|
$last_status = 1;
|
||||||
$return[$i]["time_from"] = $event["utimestamp"];
|
}
|
||||||
$last_status = 1;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -893,7 +895,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
||||||
}
|
}
|
||||||
|
|
||||||
//sort current slice
|
//sort current slice
|
||||||
if(count($return[$pool_id]['data'] > 1)) {
|
if(count($return[$pool_id]['data']) > 1) {
|
||||||
usort(
|
usort(
|
||||||
$return[$pool_id]['data'],
|
$return[$pool_id]['data'],
|
||||||
function ($a, $b) {
|
function ($a, $b) {
|
||||||
|
@ -1654,28 +1656,12 @@ function db_get_type_field_table($table, $field) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the element count of a table.
|
* Get the columns of a table.
|
||||||
*
|
*
|
||||||
* @param string $sql SQL query to get the element count.
|
* @param string $table table to retrieve columns.
|
||||||
*
|
*
|
||||||
* @return int Return the number of elements in the table.
|
* @return array with column names.
|
||||||
*/
|
*/
|
||||||
function db_get_table_count($table, $search_history_db = false) {
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
|
||||||
case "mysql":
|
|
||||||
return mysql_db_get_table_count($table, $search_history_db);
|
|
||||||
break;
|
|
||||||
case "postgresql":
|
|
||||||
return postgresql_db_get_table_count($table, $search_history_db);
|
|
||||||
break;
|
|
||||||
case "oracle":
|
|
||||||
return oracle_db_get_table_count($table, $search_history_db);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function db_get_fields($table) {
|
function db_get_fields($table) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
|
|
@ -850,25 +850,14 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
||||||
if ($filter == '') {
|
if ($filter == '') {
|
||||||
$filter = '1 = 1';
|
$filter = '1 = 1';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
$sql = sprintf ("SELECT DISTINCT tevento.*
|
||||||
case "mysql":
|
FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
|
||||||
case "postgresql":
|
WHERE %s %s
|
||||||
$sql = sprintf ("SELECT DISTINCT tevento.*
|
ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
|
||||||
FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
|
|
||||||
WHERE %s %s
|
|
||||||
ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
|
|
||||||
break;
|
|
||||||
case "oracle":
|
|
||||||
$sql = sprintf ("SELECT *
|
|
||||||
FROM tevento
|
|
||||||
WHERE %s %s AND rownum <= %d
|
|
||||||
ORDER BY utimestamp DESC", $agent_condition, $filter, $limit);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = db_get_all_rows_sql ($sql);
|
$result = db_get_all_rows_sql ($sql);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
if ($return) {
|
if ($return) {
|
||||||
$returned = ui_print_info_message (__('No events'), '', true);
|
$returned = ui_print_info_message (__('No events'), '', true);
|
||||||
|
@ -997,8 +986,6 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
||||||
|
|
||||||
$data[4] = "<a class='$myclass' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'>".
|
$data[4] = "<a class='$myclass' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'>".
|
||||||
agents_get_alias($event["id_agente"]). "</A>";
|
agents_get_alias($event["id_agente"]). "</A>";
|
||||||
|
|
||||||
// ui_print_agent_name ($event["id_agente"], true, 25, '', true);
|
|
||||||
// for System or SNMP generated alerts
|
// for System or SNMP generated alerts
|
||||||
}
|
}
|
||||||
elseif ($event["event_type"] == "system") {
|
elseif ($event["event_type"] == "system") {
|
||||||
|
@ -1162,7 +1149,7 @@ function events_print_type_description ($type, $return = false) {
|
||||||
break;
|
break;
|
||||||
case "going_down_critical":
|
case "going_down_critical":
|
||||||
case "going_up_critical": //This is to be backwards compatible
|
case "going_up_critical": //This is to be backwards compatible
|
||||||
$output .= __('Going down to critical state');
|
$output .= __('Going up to critical state');
|
||||||
break;
|
break;
|
||||||
case "going_up_normal":
|
case "going_up_normal":
|
||||||
case "going_down_normal": //This is to be backwards compatible
|
case "going_down_normal": //This is to be backwards compatible
|
||||||
|
@ -1863,15 +1850,20 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor
|
||||||
// Substitute each macro
|
// Substitute each macro
|
||||||
if (strpos($target, '_agent_address_') !== false) {
|
if (strpos($target, '_agent_address_') !== false) {
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
$server = metaconsole_get_connection_by_id ($server_id);
|
$agente_table_name = 'tmetaconsole_agent';
|
||||||
metaconsole_connect($server);
|
$filter = array(
|
||||||
}
|
'id_tagente' => $event['id_agente'],
|
||||||
|
'id_tmetaconsole_setup' => $server_id
|
||||||
$target = str_replace('_agent_address_', $event['id_agente'], $target);
|
);
|
||||||
|
} else {
|
||||||
if($meta) {
|
$agente_table_name = 'tagente';
|
||||||
metaconsole_restore_db_force();
|
$filter = array('id_agente' => $event['id_agente']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
|
||||||
|
// If agent has not an ip, display N/A
|
||||||
|
if ($ip === false) $ip = __('N/A');
|
||||||
|
$target = str_replace('_agent_address_', $ip, $target);
|
||||||
}
|
}
|
||||||
if (strpos($target, '_agent_id_') !== false) {
|
if (strpos($target, '_agent_id_') !== false) {
|
||||||
$target = str_replace('_agent_id_', $event['id_agente'], $target);
|
$target = str_replace('_agent_id_', $event['id_agente'], $target);
|
||||||
|
@ -1896,7 +1888,7 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor
|
||||||
);
|
);
|
||||||
|
|
||||||
if($meta) {
|
if($meta) {
|
||||||
metaconsole_restore_db_force();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$target = str_replace('_module_address_', __('N/A'), $target);
|
$target = str_replace('_module_address_', __('N/A'), $target);
|
||||||
|
@ -2677,13 +2669,14 @@ function events_page_comments ($event, $childrens_ids = array()) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) {
|
if (((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) && $config["show_events_in_local"] == false || $config["event_replication"] == false) {
|
||||||
$comments_form = '<br><div id="comments_form" style="width:98%;">'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%;"', true);
|
$comments_form = '<br><div id="comments_form" style="width:98%;">'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%; disabled"', true);
|
||||||
|
|
||||||
$comments_form .= '<br><div style="text-align:right;">'.html_print_button(__('Add comment'),'comment_button',false,'event_comment();','class="sub next"',true).'</div><br></div>';
|
$comments_form .= '<br><div style="text-align:right;">'.html_print_button(__('Add comment'),'comment_button',false,'event_comment();','class="sub next"',true).'</div><br></div>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$comments_form = '';
|
$comments_form = ui_print_message(__( 'If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$comments = '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';
|
$comments = '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';
|
||||||
|
|
|
@ -1286,7 +1286,6 @@ function graphic_combined_module (
|
||||||
$background_color = $params['backgroundColor'];
|
$background_color = $params['backgroundColor'];
|
||||||
$datelimit = $date_array["start_date"];
|
$datelimit = $date_array["start_date"];
|
||||||
$fixed_font_size = $config['font_size'];
|
$fixed_font_size = $config['font_size'];
|
||||||
$flash_charts = false;
|
|
||||||
|
|
||||||
if($config["fixed_graph"] == false){
|
if($config["fixed_graph"] == false){
|
||||||
$water_mark = array(
|
$water_mark = array(
|
||||||
|
@ -1820,11 +1819,8 @@ function graphic_combined_module (
|
||||||
$height = 500;
|
$height = 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
$flash_charts = true;
|
|
||||||
|
|
||||||
if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){
|
if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){
|
||||||
$output = hbar_graph(
|
$output = hbar_graph(
|
||||||
true,
|
|
||||||
$graph_values,
|
$graph_values,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
|
@ -1847,7 +1843,6 @@ function graphic_combined_module (
|
||||||
|
|
||||||
if($params_combined['stacked'] == CUSTOM_GRAPH_VBARS){
|
if($params_combined['stacked'] == CUSTOM_GRAPH_VBARS){
|
||||||
$output = vbar_graph(
|
$output = vbar_graph(
|
||||||
true,
|
|
||||||
$graph_values,
|
$graph_values,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
|
@ -1941,7 +1936,6 @@ function graphic_combined_module (
|
||||||
$color = color_graph_array();
|
$color = color_graph_array();
|
||||||
|
|
||||||
$output = ring_graph(
|
$output = ring_graph(
|
||||||
true,
|
|
||||||
$graph_values,
|
$graph_values,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
|
@ -2162,8 +2156,8 @@ function graph_alert_status ($defined_alerts, $fired_alerts, $width = 300, $heig
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = pie2d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
$out = pie_graph($data, $width, $height, __("other"),
|
||||||
'', '', $config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
'', '', $config['fontpath'], $config['font_size'], 1, "hidden", $colors, false);
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $out;
|
return $out;
|
||||||
|
@ -2194,19 +2188,26 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
||||||
|
|
||||||
if ($data_agents == false) {
|
if ($data_agents == false) {
|
||||||
$groups = implode(',', array_keys(users_get_groups(false, 'AR', false)));
|
$groups = implode(',', array_keys(users_get_groups(false, 'AR', false)));
|
||||||
|
$p_table = "tagente";
|
||||||
|
$s_table = "tagent_secondary_group";
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$p_table = "tmetaconsole_agent";
|
||||||
|
$s_table = "tmetaconsole_agent_secondary_group";
|
||||||
|
}
|
||||||
$data = db_get_row_sql(sprintf('SELECT
|
$data = db_get_row_sql(sprintf('SELECT
|
||||||
SUM(critical_count) AS Critical,
|
SUM(critical_count) AS Critical,
|
||||||
SUM(warning_count) AS Warning,
|
SUM(warning_count) AS Warning,
|
||||||
SUM(normal_count) AS Normal,
|
SUM(normal_count) AS Normal,
|
||||||
SUM(unknown_count) AS Unknown
|
SUM(unknown_count) AS Unknown
|
||||||
%s
|
%s
|
||||||
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
|
FROM %s ta LEFT JOIN %s tasg
|
||||||
ON ta.id_agente = tasg.id_agent
|
ON ta.id_agente = tasg.id_agent
|
||||||
WHERE
|
WHERE
|
||||||
ta.disabled = 0 AND
|
ta.disabled = 0 AND
|
||||||
%s
|
%s
|
||||||
(ta.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
(ta.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||||
$show_not_init ? ', SUM(notinit_count) "Not init"' : '',
|
$show_not_init ? ', SUM(notinit_count) "Not init"' : '',
|
||||||
|
$p_table, $s_table,
|
||||||
empty($id_agent) ? '' : "ta.id_agente = $id_agent AND",
|
empty($id_agent) ? '' : "ta.id_agente = $id_agent AND",
|
||||||
$groups,
|
$groups,
|
||||||
$groups
|
$groups
|
||||||
|
@ -2240,11 +2241,22 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
||||||
if (array_sum($data) == 0) {
|
if (array_sum($data) == 0) {
|
||||||
$data = array();
|
$data = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = pie2d_graph($config['flash_charts'], $data, $width, $height,
|
$out = pie_graph(
|
||||||
__("other"), ui_get_full_url(false, false, false, false), '',
|
$data,
|
||||||
$config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
$width,
|
||||||
|
$height,
|
||||||
|
__("other"),
|
||||||
|
ui_get_full_url(false, false, false, false),
|
||||||
|
'',
|
||||||
|
$config['fontpath'],
|
||||||
|
$config['font_size'],
|
||||||
|
1,
|
||||||
|
"hidden",
|
||||||
|
$colors,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
@ -2316,8 +2328,19 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
|
||||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
|
||||||
'', $water_mark, $config['fontpath'], $config['font_size'], 1, "bottom");
|
return pie_graph(
|
||||||
|
$data,
|
||||||
|
$width,
|
||||||
|
$height,
|
||||||
|
__("other"),
|
||||||
|
'',
|
||||||
|
$water_mark,
|
||||||
|
$config['fontpath'],
|
||||||
|
$config['font_size'],
|
||||||
|
1,
|
||||||
|
"bottom"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) {
|
function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) {
|
||||||
|
@ -2393,31 +2416,48 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va
|
||||||
"&colorRGB=". $colorRGB . "' />";
|
"&colorRGB=". $colorRGB . "' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek = null, $time_from = null, $time_to = null, $width, $height, $home_url, $ttl = 1, $data = false, $round_corner = null) {
|
function graph_sla_slicebar (
|
||||||
|
$id, $period, $sla_min, $sla_max,
|
||||||
|
$date, $daysWeek = null, $time_from = null,
|
||||||
|
$time_to = null, $width, $height, $home_url,
|
||||||
|
$ttl = 1, $data = false, $round_corner = null) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($round_corner === null) {
|
if ($round_corner === null) {
|
||||||
$round_corner = $config['round_corner'];
|
$round_corner = $config['round_corner'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the data is not provided, we got it
|
|
||||||
if ($data === false) {
|
|
||||||
$data = reporting_get_agentmodule_sla_array ($id, $period,
|
|
||||||
$sla_min, $sla_max, $date, $daysWeek, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
$col_planned_downtime = '#20973F';
|
$col_planned_downtime = '#20973F';
|
||||||
|
|
||||||
$colors = array(1 => COL_NORMAL,
|
$colors = array(
|
||||||
|
1 => COL_NORMAL,
|
||||||
2 => COL_WARNING,
|
2 => COL_WARNING,
|
||||||
3 => COL_CRITICAL,
|
3 => COL_CRITICAL,
|
||||||
4 => COL_UNKNOWN,
|
4 => COL_UNKNOWN,
|
||||||
5 => COL_DOWNTIME,
|
5 => COL_DOWNTIME,
|
||||||
6 => COL_NOTINIT,
|
6 => COL_NOTINIT,
|
||||||
7 => COL_IGNORED);
|
7 => COL_IGNORED
|
||||||
|
);
|
||||||
return slicesbar_graph($data, $period, $width, $height, $colors,
|
|
||||||
$config['fontpath'], $round_corner, $home_url, $ttl);
|
return $return['chart'] = flot_slicesbar_graph (
|
||||||
|
$data,
|
||||||
|
$period,
|
||||||
|
$width,
|
||||||
|
$height,
|
||||||
|
'',
|
||||||
|
$colors,
|
||||||
|
$config['fontpath'],
|
||||||
|
$round_corner,
|
||||||
|
$home_url,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
array(),
|
||||||
|
true,
|
||||||
|
$ttl
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2456,9 +2496,11 @@ function grafico_incidente_prioridad () {
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
return pie_graph(
|
||||||
|
$data, 320, 200,
|
||||||
__('Other'), '', '',
|
__('Other'), '', '',
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2496,8 +2538,8 @@ function graph_incidents_status () {
|
||||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
return pie_graph($data, 320, 200,
|
||||||
__('Other'), '', '',
|
__('Other'), '', '',
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
}
|
}
|
||||||
|
@ -2553,7 +2595,7 @@ function graphic_incident_group () {
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
return pie_graph($data, 320, 200,
|
||||||
__('Other'), '', '',
|
__('Other'), '', '',
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
}
|
}
|
||||||
|
@ -2608,7 +2650,8 @@ function graphic_incident_user () {
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
return pie_graph(
|
||||||
|
$data, 320, 200,
|
||||||
__('Other'), '', '',
|
__('Other'), '', '',
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
}
|
}
|
||||||
|
@ -2662,7 +2705,8 @@ function graphic_incident_source($width = 320, $height = 200) {
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
return pie_graph(
|
||||||
|
$data, $width, $height,
|
||||||
__('Other'), '', '',
|
__('Other'), '', '',
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
}
|
}
|
||||||
|
@ -2670,27 +2714,27 @@ function graphic_incident_source($width = 320, $height = 200) {
|
||||||
function graph_events_validated($width = 300, $height = 200, $extra_filters = array(), $meta = false, $history = false) {
|
function graph_events_validated($width = 300, $height = 200, $extra_filters = array(), $meta = false, $history = false) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
$event_type = false;
|
$event_type = false;
|
||||||
if (array_key_exists('event_type', $extra_filters))
|
if (array_key_exists('event_type', $extra_filters))
|
||||||
$event_type = $extra_filters['event_type'];
|
$event_type = $extra_filters['event_type'];
|
||||||
|
|
||||||
$event_severity = false;
|
$event_severity = false;
|
||||||
if (array_key_exists('event_severity', $extra_filters))
|
if (array_key_exists('event_severity', $extra_filters))
|
||||||
$event_severity = $extra_filters['event_severity'];
|
$event_severity = $extra_filters['event_severity'];
|
||||||
|
|
||||||
$event_status = false;
|
$event_status = false;
|
||||||
if (array_key_exists('event_status', $extra_filters))
|
if (array_key_exists('event_status', $extra_filters))
|
||||||
$event_status = $extra_filters['event_status'];
|
$event_status = $extra_filters['event_status'];
|
||||||
|
|
||||||
$event_filter_search = false;
|
$event_filter_search = false;
|
||||||
if (array_key_exists('event_filter_search', $extra_filters))
|
if (array_key_exists('event_filter_search', $extra_filters))
|
||||||
$event_filter_search = $extra_filters['event_filter_search'];
|
$event_filter_search = $extra_filters['event_filter_search'];
|
||||||
|
|
||||||
$data_graph = events_get_count_events_validated(
|
$data_graph = events_get_count_events_validated(
|
||||||
array('id_group' => array_keys(users_get_groups())), null, null,
|
array('id_group' => array_keys(users_get_groups())), null, null,
|
||||||
$event_severity, $event_type, $event_status, $event_filter_search);
|
$event_severity, $event_type, $event_status, $event_filter_search);
|
||||||
|
|
||||||
$colors = array();
|
$colors = array();
|
||||||
foreach ($data_graph as $k => $v) {
|
foreach ($data_graph as $k => $v) {
|
||||||
if ($k == __('Validated')) {
|
if ($k == __('Validated')) {
|
||||||
|
@ -2700,17 +2744,26 @@ function graph_events_validated($width = 300, $height = 200, $extra_filters = ar
|
||||||
$colors[$k] = COL_CRITICAL;
|
$colors[$k] = COL_CRITICAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($config["fixed_graph"] == false){
|
if($config["fixed_graph"] == false){
|
||||||
$water_mark = array('file' =>
|
$water_mark = array('file' =>
|
||||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo pie3d_graph(
|
echo pie_graph(
|
||||||
true, $data_graph, $width, $height, __("other"), "",
|
$data_graph,
|
||||||
|
$width,
|
||||||
|
$height,
|
||||||
|
__("other"),
|
||||||
|
"",
|
||||||
$water_mark,
|
$water_mark,
|
||||||
$config['fontpath'], $config['font_size'], 1, false, $colors);
|
$config['fontpath'],
|
||||||
|
$config['font_size'],
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
$colors
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2719,10 +2772,8 @@ function graph_events_validated($width = 300, $height = 200, $extra_filters = ar
|
||||||
* @param integer width pie graph width
|
* @param integer width pie graph width
|
||||||
* @param integer height pie graph height
|
* @param integer height pie graph height
|
||||||
* @param string url
|
* @param string url
|
||||||
* @param bool if the graph required is or not for metaconsole
|
|
||||||
* @param bool if the graph required is or not for history table
|
|
||||||
*/
|
*/
|
||||||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = false, $history = false, $noWaterMark = true) {
|
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $noWaterMark = true, $time_limit = false) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
|
@ -2752,26 +2803,17 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
||||||
$url = str_replace(
|
$url = str_replace(
|
||||||
'SELECT_id_agente_modulo', 'SELECT id_agente_modulo', $url);
|
'SELECT_id_agente_modulo', 'SELECT id_agente_modulo', $url);
|
||||||
|
|
||||||
|
$event_table = 'tevento';
|
||||||
// Choose the table where search if metaconsole or not
|
$field_extra = '';
|
||||||
if ($meta) {
|
$groupby_extra = '';
|
||||||
if ($history) {
|
|
||||||
$event_table = 'tmetaconsole_event_history';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$event_table = 'tmetaconsole_event';
|
|
||||||
}
|
|
||||||
$field_extra = ', agent_name';
|
|
||||||
$groupby_extra = ', server_id';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$event_table = 'tevento';
|
|
||||||
$field_extra = '';
|
|
||||||
$groupby_extra = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add tags condition to filter
|
// Add tags condition to filter
|
||||||
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
||||||
|
|
||||||
|
if ($time_limit && $config['event_view_hr']) {
|
||||||
|
$tags_condition .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " .
|
||||||
|
$config['event_view_hr'] * SECONDS_1HOUR . ")";
|
||||||
|
}
|
||||||
|
|
||||||
//This will give the distinct id_agente, give the id_grupo that goes
|
//This will give the distinct id_agente, give the id_grupo that goes
|
||||||
//with it and then the number of times it occured. GROUP BY statement
|
//with it and then the number of times it occured. GROUP BY statement
|
||||||
|
@ -2805,13 +2847,8 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
||||||
$system_events += $row["count"];
|
$system_events += $row["count"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($meta) {
|
$alias = agents_get_alias($row["id_agente"]);
|
||||||
$name = mb_substr (io_safe_output($row['agent_name']), 0, 25)." (".$row["count"].")";
|
$name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
|
||||||
}
|
|
||||||
else {
|
|
||||||
$alias = agents_get_alias($row["id_agente"]);
|
|
||||||
$name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
|
|
||||||
}
|
|
||||||
$data[$name] = $row["count"];
|
$data[$name] = $row["count"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2822,14 +2859,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
||||||
$name = __('SYSTEM')." (".$system_events.")";
|
$name = __('SYSTEM')." (".$system_events.")";
|
||||||
$data[$name] = $system_events;
|
$data[$name] = $system_events;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if ($other_events > 0) {
|
|
||||||
$name = __('Other')." (".$other_events.")";
|
|
||||||
$data[$name] = $other_events;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Sort the data
|
// Sort the data
|
||||||
arsort($data);
|
arsort($data);
|
||||||
if ($noWaterMark) {
|
if ($noWaterMark) {
|
||||||
|
@ -2841,7 +2871,8 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
||||||
$water_mark = array();
|
$water_mark = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
return pie_graph(
|
||||||
|
$data, $width, $height,
|
||||||
__('Other'), '', $water_mark,
|
__('Other'), '', $water_mark,
|
||||||
$config['fontpath'], $config['font_size'], 1, 'bottom');
|
$config['fontpath'], $config['font_size'], 1, 'bottom');
|
||||||
}
|
}
|
||||||
|
@ -2851,7 +2882,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
||||||
*
|
*
|
||||||
* @param string filter Filter for query in DB
|
* @param string filter Filter for query in DB
|
||||||
*/
|
*/
|
||||||
function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true) {
|
function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true, $time_limit = false) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
|
@ -2860,23 +2891,25 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
|
||||||
// Add tags condition to filter
|
// Add tags condition to filter
|
||||||
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
||||||
$filter .= $tags_condition;
|
$filter .= $tags_condition;
|
||||||
|
if ($time_limit && $config['event_view_hr']) {
|
||||||
|
$filter .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " . $config['event_view_hr'] * SECONDS_1HOUR . ")";
|
||||||
|
}
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$legend = array ();
|
$legend = array ();
|
||||||
$total = 0;
|
$total = 0;
|
||||||
|
|
||||||
$where = '';
|
$where = "WHERE 1=1";
|
||||||
if (!users_is_admin()) {
|
if (!users_is_admin()) {
|
||||||
$where = 'WHERE event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')';
|
$where = 'WHERE event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf("SELECT criticity, COUNT(id_evento) events
|
$sql = sprintf("SELECT criticity, COUNT(id_evento) events
|
||||||
FROM tevento
|
FROM tevento
|
||||||
LEFT JOIN tagent_secondary_group tasg
|
LEFT JOIN tagent_secondary_group tasg
|
||||||
ON tevento.id_agente = tasg.id_agent
|
ON tevento.id_agente = tasg.id_agent
|
||||||
%s %s
|
%s %s
|
||||||
GROUP BY criticity ORDER BY events DESC", $where , $filter);
|
GROUP BY criticity ORDER BY events DESC", $where , $filter);
|
||||||
|
|
||||||
$criticities = db_get_all_rows_sql ($sql, false, false);
|
$criticities = db_get_all_rows_sql ($sql, false, false);
|
||||||
|
|
||||||
if (empty($criticities)) {
|
if (empty($criticities)) {
|
||||||
|
@ -2925,7 +2958,8 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
|
||||||
$water_mark = array();
|
$water_mark = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
return pie_graph(
|
||||||
|
$data, $width, $height,
|
||||||
__('Other'), '', $water_mark,
|
__('Other'), '', $water_mark,
|
||||||
$config['fontpath'], $config['font_size'], 1, 'bottom', $colors);
|
$config['fontpath'], $config['font_size'], 1, 'bottom', $colors);
|
||||||
}
|
}
|
||||||
|
@ -2975,7 +3009,8 @@ function grafico_eventos_usuario ($width, $height) {
|
||||||
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
|
||||||
|
|
||||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
return pie_graph(
|
||||||
|
$data, $width, $height,
|
||||||
__('Other'), '', $water_mark,
|
__('Other'), '', $water_mark,
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
}
|
}
|
||||||
|
@ -2991,10 +3026,11 @@ function grafico_eventos_usuario ($width, $height) {
|
||||||
function graph_custom_sql_graph ($id, $width, $height,
|
function graph_custom_sql_graph ($id, $width, $height,
|
||||||
$type = 'sql_graph_vbar', $only_image = false, $homeurl = '',
|
$type = 'sql_graph_vbar', $only_image = false, $homeurl = '',
|
||||||
$ttl = 1, $max_num_elements = 8) {
|
$ttl = 1, $max_num_elements = 8) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
|
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
|
||||||
|
|
||||||
$report_content = db_get_row ('treport_content', 'id_rc', $id);
|
$report_content = db_get_row ('treport_content', 'id_rc', $id);
|
||||||
if($id != null){
|
if($id != null){
|
||||||
$historical_db = db_get_value_sql("SELECT historical_db from treport_content where id_rc =".$id);
|
$historical_db = db_get_value_sql("SELECT historical_db from treport_content where id_rc =".$id);
|
||||||
|
@ -3009,42 +3045,30 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||||
$sql = db_get_row('treport_custom_sql', 'id', $report_content["treport_custom_sql_id"]);
|
$sql = db_get_row('treport_custom_sql', 'id', $report_content["treport_custom_sql_id"]);
|
||||||
$sql = io_safe_output($sql['sql']);
|
$sql = io_safe_output($sql['sql']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
|
if (($config['metaconsole'] == 1) && defined('METACONSOLE')) {
|
||||||
$metaconsole_connection = enterprise_hook('metaconsole_get_connection', array($report_content['server_name']));
|
$metaconsole_connection = enterprise_hook('metaconsole_get_connection', array($report_content['server_name']));
|
||||||
|
|
||||||
if ($metaconsole_connection === false) {
|
if ($metaconsole_connection === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enterprise_hook('metaconsole_load_external_db', array($metaconsole_connection)) != NOERR) {
|
if (enterprise_hook('metaconsole_load_external_db', array($metaconsole_connection)) != NOERR) {
|
||||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
|
||||||
case "mysql":
|
|
||||||
case "postgresql":
|
|
||||||
break;
|
|
||||||
case "oracle":
|
|
||||||
$sql = str_replace(";", "", $sql);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data_result = db_get_all_rows_sql ($sql,$historical_db);
|
$data_result = db_get_all_rows_sql ($sql,$historical_db);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (($config['metaconsole'] == 1) && defined('METACONSOLE'))
|
if (($config['metaconsole'] == 1) && defined('METACONSOLE'))
|
||||||
enterprise_hook('metaconsole_restore_db');
|
enterprise_hook('metaconsole_restore_db');
|
||||||
|
|
||||||
if ($data_result === false)
|
if ($data_result === false)
|
||||||
$data_result = array ();
|
$data_result = array ();
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($data_result as $data_item) {
|
foreach ($data_result as $data_item) {
|
||||||
$count++;
|
$count++;
|
||||||
|
@ -3086,23 +3110,16 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$flash_charts = $config['flash_charts'];
|
|
||||||
|
|
||||||
if ($only_image) {
|
|
||||||
$flash_charts = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($config["fixed_graph"] == false){
|
if($config["fixed_graph"] == false){
|
||||||
$water_mark = array('file' =>
|
$water_mark = array('file' =>
|
||||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'sql_graph_vbar': // vertical bar
|
case 'sql_graph_vbar': // vertical bar
|
||||||
return vbar_graph(
|
return vbar_graph(
|
||||||
$flash_charts,
|
|
||||||
$data,
|
$data,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
|
@ -3119,14 +3136,13 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||||
$ttl,
|
$ttl,
|
||||||
$homeurl,
|
$homeurl,
|
||||||
"white",
|
"white",
|
||||||
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
"#c1c1c1"
|
||||||
"c1c1c1"
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'sql_graph_hbar': // horizontal bar
|
case 'sql_graph_hbar': // horizontal bar
|
||||||
return hbar_graph(
|
return hbar_graph(
|
||||||
$flash_charts,
|
|
||||||
$data,
|
$data,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
|
@ -3143,12 +3159,21 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||||
$ttl,
|
$ttl,
|
||||||
$homeurl,
|
$homeurl,
|
||||||
'white',
|
'white',
|
||||||
'c1c1c1'
|
'#c1c1c1'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'sql_graph_pie': // Pie
|
case 'sql_graph_pie': // Pie
|
||||||
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl,
|
return pie_graph(
|
||||||
$water_mark, $config['fontpath'], '', $ttl);
|
$data,
|
||||||
|
$width,
|
||||||
|
$height,
|
||||||
|
__("other"),
|
||||||
|
$homeurl,
|
||||||
|
$water_mark,
|
||||||
|
$config['fontpath'],
|
||||||
|
$config['font_size'],
|
||||||
|
$ttl
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3166,10 +3191,9 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||||
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
|
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
|
|
||||||
|
@ -3187,12 +3211,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
||||||
for ($i = 0; $i < $interval; $i++) {
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
$bottom = $datelimit + ($periodtime * $i);
|
$bottom = $datelimit + ($periodtime * $i);
|
||||||
if (! $graphic_type) {
|
if (! $graphic_type) {
|
||||||
if ($config['flash_charts']) {
|
$name = date('H:i', $bottom);
|
||||||
$name = date('H:i', $bottom);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$name = date('H\h', $bottom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$name = $bottom;
|
$name = $bottom;
|
||||||
|
@ -3237,23 +3256,10 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
||||||
}
|
}
|
||||||
|
|
||||||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||||
|
|
||||||
// Draw slicebar graph
|
// Draw slicebar graph
|
||||||
if ($config['flash_charts']) {
|
$out = flot_slicesbar_graph($data, $period, 100, 40, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
|
||||||
|
|
||||||
// Draw legend
|
|
||||||
$out .= "<br>";
|
|
||||||
$out .= " ";
|
|
||||||
foreach ($legend as $hour) {
|
|
||||||
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
|
|
||||||
$out .= " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
@ -3293,12 +3299,7 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
|
||||||
for ($i = 0; $i < $interval; $i++) {
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
$bottom = $datelimit + ($periodtime * $i);
|
$bottom = $datelimit + ($periodtime * $i);
|
||||||
if (! $graphic_type) {
|
if (! $graphic_type) {
|
||||||
if ($config['flash_charts']) {
|
$name = date('H\h', $bottom);
|
||||||
$name = date('H:i:s', $bottom);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$name = date('H\h', $bottom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$name = $bottom;
|
$name = $bottom;
|
||||||
|
@ -3341,23 +3342,31 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
|
||||||
$cont++;
|
$cont++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
$colors = array(
|
||||||
|
1 => COL_NORMAL,
|
||||||
|
2 => COL_WARNING,
|
||||||
|
3 => COL_CRITICAL,
|
||||||
|
4 => COL_UNKNOWN
|
||||||
|
);
|
||||||
|
|
||||||
// Draw slicebar graph
|
$out = flot_slicesbar_graph(
|
||||||
if ($config['flash_charts']) {
|
$data,
|
||||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent);
|
$period,
|
||||||
}
|
100,
|
||||||
else {
|
$height,
|
||||||
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
$full_legend,
|
||||||
|
$colors,
|
||||||
// Draw legend
|
$config['fontpath'],
|
||||||
$out .= "<br>";
|
$config['round_corner'],
|
||||||
$out .= " ";
|
$homeurl,
|
||||||
foreach ($legend as $hour) {
|
'',
|
||||||
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
|
'',
|
||||||
$out .= " ";
|
false,
|
||||||
}
|
$id_agent,
|
||||||
}
|
array(),
|
||||||
|
true,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $out;
|
return $out;
|
||||||
|
@ -3861,18 +3870,14 @@ function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image =
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$flash_chart = $config['flash_charts'];
|
|
||||||
if ($only_image) {
|
|
||||||
$flash_chart = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($config["fixed_graph"] == false){
|
if($config["fixed_graph"] == false){
|
||||||
$water_mark = array('file' =>
|
$water_mark = array('file' =>
|
||||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pie3d_graph($flash_chart, $values, 370, 200,
|
return pie_graph(
|
||||||
|
$values, 370, 200,
|
||||||
__('Other'), $config['homeurl'], $water_mark,
|
__('Other'), $config['homeurl'], $water_mark,
|
||||||
$config['fontpath'], $config['font_size'], $ttl);
|
$config['fontpath'], $config['font_size'], $ttl);
|
||||||
}
|
}
|
||||||
|
@ -4048,12 +4053,20 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
|
||||||
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
||||||
|
|
||||||
// Draw slicebar graph
|
// Draw slicebar graph
|
||||||
if ($config['flash_charts']) {
|
echo flot_slicesbar_graph(
|
||||||
echo flot_slicesbar_graph($data, $period, $width, 50, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key, $stat_win);
|
$data,
|
||||||
}
|
$period,
|
||||||
else {
|
$width,
|
||||||
echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
50,
|
||||||
}
|
$legend,
|
||||||
|
$colors,
|
||||||
|
$config['fontpath'],
|
||||||
|
$config['round_corner'],
|
||||||
|
$homeurl,
|
||||||
|
'',
|
||||||
|
$adapt_key,
|
||||||
|
$stat_win
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {
|
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
require_once ($config['homedir'].'/include/functions_users.php');
|
require_once ($config['homedir'].'/include/functions_users.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1226,7 +1228,7 @@ function groups_get_monitors_counter ($group, $agent_filter = array(), $module_f
|
||||||
else
|
else
|
||||||
$module_status = array($module_filter["status"]);
|
$module_status = array($module_filter["status"]);
|
||||||
|
|
||||||
$status_array = "";
|
$status_array = array();
|
||||||
foreach ($module_status as $status) {
|
foreach ($module_status as $status) {
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
case AGENT_MODULE_STATUS_ALL:
|
case AGENT_MODULE_STATUS_ALL:
|
||||||
|
|
|
@ -95,16 +95,18 @@ function groupview_get_all_counters($tree_group) {
|
||||||
? 'tmetaconsole_agent_secondary_group'
|
? 'tmetaconsole_agent_secondary_group'
|
||||||
: 'tagent_secondary_group';
|
: 'tagent_secondary_group';
|
||||||
$sql =
|
$sql =
|
||||||
"SELECT SUM(ta.normal_count) AS _monitors_ok_,
|
"SELECT SUM(ta.critical_count) AS _monitors_critical_,
|
||||||
SUM(ta.critical_count) AS _monitors_critical_,
|
|
||||||
SUM(ta.warning_count) AS _monitors_warning_,
|
SUM(ta.warning_count) AS _monitors_warning_,
|
||||||
SUM(ta.unknown_count) AS _monitors_unknown_,
|
SUM(ta.unknown_count) AS _monitors_unknown_,
|
||||||
SUM(ta.notinit_count) AS _monitors_not_init_,
|
SUM(ta.notinit_count) AS _monitors_not_init_,
|
||||||
SUM(ta.fired_count) AS _monitors_alerts_fired_,
|
SUM(ta.normal_count) AS _monitors_ok_,
|
||||||
SUM(ta.total_count) AS _monitor_checks_,
|
SUM(ta.total_count) AS _monitor_checks_,
|
||||||
|
SUM(ta.fired_count) AS _monitors_alerts_fired_,
|
||||||
SUM(IF(ta.critical_count > 0, 1, 0)) AS _agents_critical_,
|
SUM(IF(ta.critical_count > 0, 1, 0)) AS _agents_critical_,
|
||||||
|
SUM(IF(ta.critical_count = 0 AND ta.warning_count > 0, 1, 0)) AS _agents_warning_,
|
||||||
SUM(IF(ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0, 1, 0)) AS _agents_unknown_,
|
SUM(IF(ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0, 1, 0)) AS _agents_unknown_,
|
||||||
SUM(IF(ta.total_count = ta.notinit_count, 1, 0)) AS _agents_not_init_,
|
SUM(IF(ta.total_count = ta.notinit_count, 1, 0)) AS _agents_not_init_,
|
||||||
|
SUM(IF(ta.total_count = ta.normal_count AND ta.total_count <> ta.notinit_count, 1, 0)) AS _agents_ok_,
|
||||||
COUNT(ta.id_agente) AS _total_agents_,
|
COUNT(ta.id_agente) AS _total_agents_,
|
||||||
'$all_name' AS _name_,
|
'$all_name' AS _name_,
|
||||||
0 AS _id_,
|
0 AS _id_,
|
||||||
|
@ -169,9 +171,11 @@ function groupview_get_groups_list($id_user = false, $access = 'AR', $is_not_pag
|
||||||
$list[$id_group]['_id_'] = $agent_counter['id'];
|
$list[$id_group]['_id_'] = $agent_counter['id'];
|
||||||
$list[$id_group]['_iconImg_'] = $agent_counter['icon'];
|
$list[$id_group]['_iconImg_'] = $agent_counter['icon'];
|
||||||
|
|
||||||
$list[$id_group]['_agents_not_init_'] = $agent_counter['counters']['not_init'];
|
|
||||||
$list[$id_group]['_agents_unknown_'] = $agent_counter['counters']['unknown'];
|
|
||||||
$list[$id_group]['_agents_critical_'] = $agent_counter['counters']['critical'];
|
$list[$id_group]['_agents_critical_'] = $agent_counter['counters']['critical'];
|
||||||
|
$list[$id_group]['_agents_warning_'] = $agent_counter['counters']['warning'];
|
||||||
|
$list[$id_group]['_agents_unknown_'] = $agent_counter['counters']['unknown'];
|
||||||
|
$list[$id_group]['_agents_not_init_'] = $agent_counter['counters']['not_init'];
|
||||||
|
$list[$id_group]['_agents_ok_'] = $agent_counter['counters']['ok'];
|
||||||
$list[$id_group]['_total_agents_'] = $agent_counter['counters']['total'];
|
$list[$id_group]['_total_agents_'] = $agent_counter['counters']['total'];
|
||||||
|
|
||||||
$list[$id_group]['_monitors_critical_'] = (int)$modules_counters[$id_group]['total_module_critical'];
|
$list[$id_group]['_monitors_critical_'] = (int)$modules_counters[$id_group]['total_module_critical'];
|
||||||
|
|
|
@ -374,13 +374,18 @@ function __ ($string /*, variable arguments */) {
|
||||||
global $l10n;
|
global $l10n;
|
||||||
global $config;
|
global $config;
|
||||||
static $extensions_cache = array();
|
static $extensions_cache = array();
|
||||||
|
|
||||||
if (array_key_exists($config["id_user"], $extensions_cache)) {
|
if( !isset($config["id_user"]) && count($extensions_cache) > 0 ) {
|
||||||
$extensions = $extensions_cache[$config["id_user"]];
|
if (array_key_exists($config["id_user"], $extensions_cache)) {
|
||||||
|
$extensions = $extensions_cache[$config["id_user"]];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$extensions = extensions_get_extensions();
|
||||||
|
$extensions_cache[$config["id_user"]] = $extensions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
$extensions = extensions_get_extensions();
|
$extension =null;
|
||||||
$extensions_cache[$config["id_user"]] = $extensions;
|
|
||||||
}
|
}
|
||||||
if (empty($extensions))
|
if (empty($extensions))
|
||||||
$extensions = array();
|
$extensions = array();
|
||||||
|
@ -490,7 +495,7 @@ function io_input_password($password) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
enterprise_include_once('include/functions_crypto.php');
|
enterprise_include_once('include/functions_crypto.php');
|
||||||
$ciphertext = enterprise_hook('crypto_encrypt', array($password));
|
$ciphertext = enterprise_hook('openssl_encrypt_decrypt', array('encrypt', $password));
|
||||||
if ($ciphertext === ENTERPRISE_NOT_HOOK) {
|
if ($ciphertext === ENTERPRISE_NOT_HOOK) {
|
||||||
return $password;
|
return $password;
|
||||||
}
|
}
|
||||||
|
@ -499,7 +504,7 @@ function io_input_password($password) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process the given password read from the Pandora FMS Database,
|
* Process the given password read from the Pandora FMS Database,
|
||||||
* decrypting it if necessary.
|
* decrypting it if necessary.
|
||||||
*
|
*
|
||||||
* @param string password Password read from the DB.
|
* @param string password Password read from the DB.
|
||||||
|
@ -510,7 +515,7 @@ function io_output_password($password) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
enterprise_include_once('include/functions_crypto.php');
|
enterprise_include_once('include/functions_crypto.php');
|
||||||
$plaintext = enterprise_hook('crypto_decrypt', array($password));
|
$plaintext = enterprise_hook('openssl_encrypt_decrypt', array('decrypt', $password));
|
||||||
if ($plaintext === ENTERPRISE_NOT_HOOK) {
|
if ($plaintext === ENTERPRISE_NOT_HOOK) {
|
||||||
return $password;
|
return $password;
|
||||||
}
|
}
|
||||||
|
|
|
@ -666,6 +666,8 @@ function planned_downtimes_stop ($downtime) {
|
||||||
function planned_downtimes_created ($values) {
|
function planned_downtimes_created ($values) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
$check_id_user = (bool) db_get_value ('id_user', 'tusuario', 'id_user', $values['id_user']);
|
||||||
|
$check_group = (bool) db_get_value ('id_grupo', 'tgrupo', 'id_grupo', $values['id_group']);
|
||||||
$check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $values['name']);
|
$check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $values['name']);
|
||||||
|
|
||||||
$datetime_from = strtotime ($values['once_date_from'] . ' ' . $values['once_time_from']);
|
$datetime_from = strtotime ($values['once_date_from'] . ' ' . $values['once_time_from']);
|
||||||
|
@ -702,6 +704,31 @@ function planned_downtimes_created ($values) {
|
||||||
'message' => __('Not created. Error inserting data') . ". "
|
'message' => __('Not created. Error inserting data') . ". "
|
||||||
. __('The end day must be higher than the start day'));
|
. __('The end day must be higher than the start day'));
|
||||||
}
|
}
|
||||||
|
else if ($values['type_downtime'] !== 'quiet' && $values['type_downtime'] !== 'disable_agents' && $values['type_downtime'] !== 'disable_agents_alerts') {
|
||||||
|
return array('return' => false,
|
||||||
|
'message' => __('Not created. Error inserting data') . ". "
|
||||||
|
. __('The downtime must be quiet, disable_agents or disable_agents_alerts'));
|
||||||
|
}
|
||||||
|
else if ($values['type_execution'] !== 'periodically' && $values['type_execution'] !== 'once' ) {
|
||||||
|
return array('return' => false,
|
||||||
|
'message' => __('Not created. Error inserting data') . ". "
|
||||||
|
. __('The execution must be once or periodically'));
|
||||||
|
}
|
||||||
|
else if ($values['type_periodicity'] !== 'weekly' && $values['type_periodicity'] !== 'monthly' ) {
|
||||||
|
return array('return' => false,
|
||||||
|
'message' => __('Not created. Error inserting data') . ". "
|
||||||
|
. __('The periodicity must be weekly or monthly'));
|
||||||
|
}
|
||||||
|
else if (!$check_id_user){
|
||||||
|
return array('return' => false,
|
||||||
|
'message' => __('Not created. Error inserting data') . ". "
|
||||||
|
. __('User not exist'));
|
||||||
|
}
|
||||||
|
else if (!$check_group && $values['id_group'] != 0) {
|
||||||
|
return array('return' => false,
|
||||||
|
'message' => __('Not created. Error inserting data') . ". "
|
||||||
|
. __('Group not exist'));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (trim(io_safe_output($values['name'])) != '') {
|
if (trim(io_safe_output($values['name'])) != '') {
|
||||||
if (!$check) {
|
if (!$check) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -113,7 +113,10 @@ function html_do_report_info($report) {
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>' . __('Report date') . ': </b></td>';
|
<td><b>' . __('Report date') . ': </b></td>';
|
||||||
if (isset($report['period'])) {
|
if (isset($report['period'])) {
|
||||||
$html .= '<td>' . date($config["date_format"], ($report['datetime'] - $report['period']));
|
if (is_numeric($report['datetime']) && is_numeric($report['period'])) {
|
||||||
|
$html .= '<td>' . date($config["date_format"], ($report['datetime'] - $report['period'])) . '</td>';
|
||||||
|
}
|
||||||
|
$html .= '<td></td>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$html .= '<td>' . __('Items period before') . ' <b>' . date($config["date_format"], $report['datetime']) . '</b></td>';
|
$html .= '<td>' . __('Items period before') . ' <b>' . date($config["date_format"], $report['datetime']) . '</b></td>';
|
||||||
|
@ -348,16 +351,16 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$style = json_decode(io_safe_output($style), true);
|
$style = json_decode(io_safe_output($style), true);
|
||||||
$hide_notinit_agent = $style['hide_notinit_agents'];
|
$hide_notinit_agent = $style['hide_notinit_agents'];
|
||||||
$same_agent_in_resume = "";
|
$same_agent_in_resume = "";
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($mini) {
|
if ($mini) {
|
||||||
$font_size = '1.5';
|
$font_size = '1.5';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$font_size = '3';
|
$font_size = '3';
|
||||||
}
|
}
|
||||||
|
|
||||||
$metaconsole_on = is_metaconsole();
|
$metaconsole_on = is_metaconsole();
|
||||||
if($metaconsole_on){
|
if($metaconsole_on){
|
||||||
$src= '../../';
|
$src= '../../';
|
||||||
|
@ -371,20 +374,19 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table->data['sla']['cell'] = $item['failed'];
|
$table->data['sla']['cell'] = $item['failed'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (!empty($item['planned_downtimes'])) {
|
if (!empty($item['planned_downtimes'])) {
|
||||||
$downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']);
|
$downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']);
|
||||||
|
|
||||||
if (!empty($downtimes_table)) {
|
if (!empty($downtimes_table)) {
|
||||||
$table->colspan['planned_downtime']['cell'] = 3;
|
$table->colspan['planned_downtime']['cell'] = 3;
|
||||||
$table->data['planned_downtime']['cell'] = $downtimes_table;
|
$table->data['planned_downtime']['cell'] = $downtimes_table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($item['data'])){
|
if(!(!isset($item['data']) && $hide_notinit_agent == 1)) {
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
|
|
||||||
$table1->align = array();
|
$table1->align = array();
|
||||||
$table1->align[0] = 'left';
|
$table1->align[0] = 'left';
|
||||||
$table1->align[1] = 'left';
|
$table1->align[1] = 'left';
|
||||||
|
@ -392,9 +394,9 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table1->align[3] = 'right';
|
$table1->align[3] = 'right';
|
||||||
$table1->align[4] = 'right';
|
$table1->align[4] = 'right';
|
||||||
$table1->align[5] = 'right';
|
$table1->align[5] = 'right';
|
||||||
|
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
|
|
||||||
$table1->head = array ();
|
$table1->head = array ();
|
||||||
$table1->head[0] = __('Agent');
|
$table1->head[0] = __('Agent');
|
||||||
$table1->head[1] = __('Module');
|
$table1->head[1] = __('Module');
|
||||||
|
@ -402,7 +404,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table1->head[3] = __('SLA Limit');
|
$table1->head[3] = __('SLA Limit');
|
||||||
$table1->head[4] = __('SLA Compliance');
|
$table1->head[4] = __('SLA Compliance');
|
||||||
$table1->head[5] = __('Status');
|
$table1->head[5] = __('Status');
|
||||||
|
|
||||||
$table1->headstyle = array();
|
$table1->headstyle = array();
|
||||||
$table1->headstyle[2] = 'text-align: right';
|
$table1->headstyle[2] = 'text-align: right';
|
||||||
$table1->headstyle[3] = 'text-align: right';
|
$table1->headstyle[3] = 'text-align: right';
|
||||||
|
@ -412,7 +414,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
//second_table for time globals
|
//second_table for time globals
|
||||||
$table2 = new stdClass();
|
$table2 = new stdClass();
|
||||||
$table2->width = '99%';
|
$table2->width = '99%';
|
||||||
|
|
||||||
$table2->align = array();
|
$table2->align = array();
|
||||||
$table2->align[0] = 'left';
|
$table2->align[0] = 'left';
|
||||||
$table2->align[1] = 'left';
|
$table2->align[1] = 'left';
|
||||||
|
@ -421,9 +423,9 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table2->align[4] = 'right';
|
$table2->align[4] = 'right';
|
||||||
$table2->align[5] = 'right';
|
$table2->align[5] = 'right';
|
||||||
$table2->align[6] = 'right';
|
$table2->align[6] = 'right';
|
||||||
|
|
||||||
$table2->data = array ();
|
$table2->data = array ();
|
||||||
|
|
||||||
$table2->head = array ();
|
$table2->head = array ();
|
||||||
$table2->head[0] = __('Global Time');
|
$table2->head[0] = __('Global Time');
|
||||||
$table2->head[1] = __('Time Total');
|
$table2->head[1] = __('Time Total');
|
||||||
|
@ -432,7 +434,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table2->head[4] = __('Time Unknown');
|
$table2->head[4] = __('Time Unknown');
|
||||||
$table2->head[5] = __('Time Not Init');
|
$table2->head[5] = __('Time Not Init');
|
||||||
$table2->head[6] = __('Downtime');
|
$table2->head[6] = __('Downtime');
|
||||||
|
|
||||||
$table2->headstyle = array();
|
$table2->headstyle = array();
|
||||||
$table2->headstyle[2] = 'text-align: right';
|
$table2->headstyle[2] = 'text-align: right';
|
||||||
$table2->headstyle[3] = 'text-align: right';
|
$table2->headstyle[3] = 'text-align: right';
|
||||||
|
@ -443,7 +445,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
//third_table for time globals
|
//third_table for time globals
|
||||||
$table3 = new stdClass();
|
$table3 = new stdClass();
|
||||||
$table3->width = '99%';
|
$table3->width = '99%';
|
||||||
|
|
||||||
$table3->align = array();
|
$table3->align = array();
|
||||||
$table3->align[0] = 'left';
|
$table3->align[0] = 'left';
|
||||||
$table3->align[1] = 'left';
|
$table3->align[1] = 'left';
|
||||||
|
@ -452,16 +454,16 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table3->align[4] = 'right';
|
$table3->align[4] = 'right';
|
||||||
$table3->align[5] = 'right';
|
$table3->align[5] = 'right';
|
||||||
$table3->align[6] = 'right';
|
$table3->align[6] = 'right';
|
||||||
|
|
||||||
$table3->data = array ();
|
$table3->data = array ();
|
||||||
|
|
||||||
$table3->head = array ();
|
$table3->head = array ();
|
||||||
$table3->head[0] = __('Checks Time');
|
$table3->head[0] = __('Checks Time');
|
||||||
$table3->head[1] = __('Checks Total');
|
$table3->head[1] = __('Checks Total');
|
||||||
$table3->head[2] = __('Checks Failed');
|
$table3->head[2] = __('Checks Failed');
|
||||||
$table3->head[3] = __('Checks OK');
|
$table3->head[3] = __('Checks OK');
|
||||||
$table3->head[4] = __('Checks Unknown');
|
$table3->head[4] = __('Checks Unknown');
|
||||||
|
|
||||||
$table3->headstyle = array();
|
$table3->headstyle = array();
|
||||||
$table3->headstyle[2] = 'text-align: right';
|
$table3->headstyle[2] = 'text-align: right';
|
||||||
$table3->headstyle[3] = 'text-align: right';
|
$table3->headstyle[3] = 'text-align: right';
|
||||||
|
@ -471,20 +473,22 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
foreach ($item['data'] as $sla) {
|
foreach ($item['data'] as $sla) {
|
||||||
if(isset($sla)){
|
if(isset($sla)){
|
||||||
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
|
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
|
||||||
if (!$hide_notinit_agent) {
|
|
||||||
//first_table
|
|
||||||
$row = array();
|
|
||||||
$row[] = $sla['agent'];
|
|
||||||
$row[] = $sla['module'];
|
|
||||||
|
|
||||||
if(is_numeric($sla['dinamic_text'])){
|
//first_table
|
||||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
$row = array();
|
||||||
sla_truncate($sla['min'], $config['graph_precision']);
|
$row[] = $sla['agent'];
|
||||||
}
|
$row[] = $sla['module'];
|
||||||
else{
|
|
||||||
$row[] = $sla['dinamic_text'];
|
if(is_numeric($sla['dinamic_text'])){
|
||||||
}
|
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
||||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
sla_truncate($sla['min'], $config['graph_precision']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$row[] = $sla['dinamic_text'];
|
||||||
|
}
|
||||||
|
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||||
|
|
||||||
|
if (!$hide_notinit_agent) {
|
||||||
|
|
||||||
if (reporting_sla_is_not_init_from_array($sla)) {
|
if (reporting_sla_is_not_init_from_array($sla)) {
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
|
||||||
|
@ -523,7 +527,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$row2[] = '<span style="color: '.COL_CRITICAL.';">' . human_time_description_raw($sla['time_error'], true) . '</span>';
|
$row2[] = '<span style="color: '.COL_CRITICAL.';">' . human_time_description_raw($sla['time_error'], true) . '</span>';
|
||||||
else
|
else
|
||||||
$row2[] = '--';
|
$row2[] = '--';
|
||||||
|
|
||||||
if($sla['time_ok'] != 0)
|
if($sla['time_ok'] != 0)
|
||||||
$row2[] = '<span style="color: '.COL_NORMAL.';">' . human_time_description_raw($sla['time_ok'], true) . '</span>';
|
$row2[] = '<span style="color: '.COL_NORMAL.';">' . human_time_description_raw($sla['time_ok'], true) . '</span>';
|
||||||
else
|
else
|
||||||
|
@ -561,15 +565,15 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$row[] = $sla['module'];
|
$row[] = $sla['module'];
|
||||||
|
|
||||||
if(is_numeric($sla['dinamic_text'])){
|
if(is_numeric($sla['dinamic_text'])){
|
||||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
|
||||||
sla_truncate($sla['min'], $config['graph_precision']);
|
sla_truncate($sla['min'], $config['graph_precision']);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$row[] = $sla['dinamic_text'];
|
$row[] = $sla['dinamic_text'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||||
|
|
||||||
if ($sla['sla_value_unknown']) {
|
if ($sla['sla_value_unknown']) {
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
||||||
__('N/A') . '</span>';
|
__('N/A') . '</span>';
|
||||||
|
@ -602,7 +606,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$row2[] = '<span style="color: '.COL_CRITICAL.';">' . human_time_description_raw($sla['time_error'], true) . '</span>';
|
$row2[] = '<span style="color: '.COL_CRITICAL.';">' . human_time_description_raw($sla['time_error'], true) . '</span>';
|
||||||
else
|
else
|
||||||
$row2[] = '--';
|
$row2[] = '--';
|
||||||
|
|
||||||
if($sla['time_ok'] != 0)
|
if($sla['time_ok'] != 0)
|
||||||
$row2[] = '<span style="color: '.COL_NORMAL.';">' . human_time_description_raw($sla['time_ok'], true) . '</span>';
|
$row2[] = '<span style="color: '.COL_NORMAL.';">' . human_time_description_raw($sla['time_ok'], true) . '</span>';
|
||||||
else
|
else
|
||||||
|
@ -638,7 +642,6 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table3->data[] = $row3;
|
$table3->data[] = $row3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->colspan['sla']['cell'] = 2;
|
$table->colspan['sla']['cell'] = 2;
|
||||||
$table->data['sla']['cell'] = html_print_table($table1, true);
|
$table->data['sla']['cell'] = html_print_table($table1, true);
|
||||||
$table->colspan['time_global']['cell'] = 2;
|
$table->colspan['time_global']['cell'] = 2;
|
||||||
|
@ -646,11 +649,18 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table->colspan['checks_global']['cell'] = 2;
|
$table->colspan['checks_global']['cell'] = 2;
|
||||||
$table->data['checks_global']['cell'] = html_print_table($table3, true);
|
$table->data['checks_global']['cell'] = html_print_table($table3, true);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$table->colspan['error']['cell'] = 3;
|
||||||
|
$table->data['error']['cell'] =
|
||||||
|
__('There are no Agent/Modules defined');
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($item['charts'])) {
|
if (!empty($item['charts'])) {
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
|
$table1->size = array ();
|
||||||
|
$table1->size[0] = '10%';
|
||||||
|
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
if (!$hide_notinit_agent) {
|
if (!$hide_notinit_agent) {
|
||||||
foreach ($item['charts'] as $chart) {
|
foreach ($item['charts'] as $chart) {
|
||||||
|
@ -681,32 +691,32 @@ function reporting_html_SLA($table, $item, $mini) {
|
||||||
$table1->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
$table1->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
||||||
$table1->size[1] = '14%';
|
$table1->size[1] = '14%';
|
||||||
$table1->data[0][1] = '<span>'.__('OK') . '</span>';
|
$table1->data[0][1] = '<span>'.__('OK') . '</span>';
|
||||||
|
|
||||||
$table1->size[2] = '2%';
|
$table1->size[2] = '2%';
|
||||||
$table1->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
$table1->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
||||||
$table1->size[3] = '14%';
|
$table1->size[3] = '14%';
|
||||||
$table1->data[0][3] = '<span>'.__('Critical'). '</span>';
|
$table1->data[0][3] = '<span>'.__('Critical'). '</span>';
|
||||||
|
|
||||||
$table1->size[4] = '2%';
|
$table1->size[4] = '2%';
|
||||||
$table1->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
$table1->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
||||||
$table1->size[5] = '14%';
|
$table1->size[5] = '14%';
|
||||||
$table1->data[0][5] = '<span>'.__('Unknow'). '</span>';
|
$table1->data[0][5] = '<span>'.__('Unknow'). '</span>';
|
||||||
|
|
||||||
$table1->size[6] = '2%';
|
$table1->size[6] = '2%';
|
||||||
$table1->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
$table1->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
||||||
$table1->size[7] = '14%';
|
$table1->size[7] = '14%';
|
||||||
$table1->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
$table1->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
||||||
|
|
||||||
$table1->size[8] = '2%';
|
$table1->size[8] = '2%';
|
||||||
$table1->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
$table1->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
||||||
$table1->size[9] = '14%';
|
$table1->size[9] = '14%';
|
||||||
$table1->data[0][9] = '<span>'.__('Downtimes'). '</span>';
|
$table1->data[0][9] = '<span>'.__('Downtimes'). '</span>';
|
||||||
|
|
||||||
$table1->size[10] = '2%';
|
$table1->size[10] = '2%';
|
||||||
$table1->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
$table1->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
||||||
$table1->size[11] = '15%';
|
$table1->size[11] = '15%';
|
||||||
$table1->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
$table1->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
||||||
|
|
||||||
$table->colspan['legend']['cell'] = 2;
|
$table->colspan['legend']['cell'] = 2;
|
||||||
$table->data['legend']['cell'] = html_print_table($table1, true);
|
$table->data['legend']['cell'] = html_print_table($table1, true);
|
||||||
}
|
}
|
||||||
|
@ -2316,14 +2326,14 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$style = json_decode(io_safe_output($style), true);
|
$style = json_decode(io_safe_output($style), true);
|
||||||
$hide_notinit_agent = $style['hide_notinit_agents'];
|
$hide_notinit_agent = $style['hide_notinit_agents'];
|
||||||
$same_agent_in_resume = "";
|
$same_agent_in_resume = "";
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (!empty($item["data"])) {
|
if (!empty($item["data"]) || $hide_notinit_agent !=1) {
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
|
|
||||||
$table1->head = array ();
|
$table1->head = array ();
|
||||||
$table1->head[0] = __('Agent');
|
$table1->head[0] = __('Agent');
|
||||||
// HACK it is saved in show_graph field.
|
// HACK it is saved in show_graph field.
|
||||||
|
@ -2341,7 +2351,7 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table1->head[6] = __('Time Not Init Module');
|
$table1->head[6] = __('Time Not Init Module');
|
||||||
$table1->head[7] = __('Time Downtime');
|
$table1->head[7] = __('Time Downtime');
|
||||||
$table1->head[8] = __('% Ok');
|
$table1->head[8] = __('% Ok');
|
||||||
|
|
||||||
$table1->headstyle = array();
|
$table1->headstyle = array();
|
||||||
$table1->headstyle[0] = 'text-align: left';
|
$table1->headstyle[0] = 'text-align: left';
|
||||||
$table1->headstyle[1] = 'text-align: left';
|
$table1->headstyle[1] = 'text-align: left';
|
||||||
|
@ -2352,7 +2362,7 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table1->headstyle[6] = 'text-align: right';
|
$table1->headstyle[6] = 'text-align: right';
|
||||||
$table1->headstyle[7] = 'text-align: right';
|
$table1->headstyle[7] = 'text-align: right';
|
||||||
$table1->headstyle[8] = 'text-align: right';
|
$table1->headstyle[8] = 'text-align: right';
|
||||||
|
|
||||||
$table1->style[0] = 'text-align: left';
|
$table1->style[0] = 'text-align: left';
|
||||||
$table1->style[1] = 'text-align: left';
|
$table1->style[1] = 'text-align: left';
|
||||||
$table1->style[2] = 'text-align: right';
|
$table1->style[2] = 'text-align: right';
|
||||||
|
@ -2391,7 +2401,7 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table2->headstyle[4] = 'text-align: right';
|
$table2->headstyle[4] = 'text-align: right';
|
||||||
$table2->headstyle[5] = 'text-align: right';
|
$table2->headstyle[5] = 'text-align: right';
|
||||||
//$table2->headstyle[6] = 'text-align: right';
|
//$table2->headstyle[6] = 'text-align: right';
|
||||||
|
|
||||||
$table2->style[0] = 'text-align: left';
|
$table2->style[0] = 'text-align: left';
|
||||||
$table2->style[1] = 'text-align: left';
|
$table2->style[1] = 'text-align: left';
|
||||||
$table2->style[2] = 'text-align: right';
|
$table2->style[2] = 'text-align: right';
|
||||||
|
@ -2402,22 +2412,22 @@ function reporting_html_availability(&$table, $item) {
|
||||||
|
|
||||||
foreach ($item['data'] as $row) {
|
foreach ($item['data'] as $row) {
|
||||||
$the_first_men_time = get_agent_first_time(io_safe_output($row['agent']));
|
$the_first_men_time = get_agent_first_time(io_safe_output($row['agent']));
|
||||||
|
|
||||||
if (!$hide_notinit_agent) {
|
if (!$hide_notinit_agent) {
|
||||||
$table_row = array();
|
$table_row = array();
|
||||||
$table_row[] = $row['agent'];
|
$table_row[] = $row['agent'];
|
||||||
$table_row[] = $row['availability_item'];
|
$table_row[] = $row['availability_item'];
|
||||||
|
|
||||||
if($row['time_total'] != 0)
|
if($row['time_total'] != 0)
|
||||||
$table_row[] = human_time_description_raw($row['time_total'], true);
|
$table_row[] = human_time_description_raw($row['time_total'], true);
|
||||||
else
|
else
|
||||||
$table_row[] = '--';
|
$table_row[] = '--';
|
||||||
|
|
||||||
if($row['time_error'] != 0)
|
if($row['time_error'] != 0)
|
||||||
$table_row[] = human_time_description_raw($row['time_error'], true);
|
$table_row[] = human_time_description_raw($row['time_error'], true);
|
||||||
else
|
else
|
||||||
$table_row[] = '--';
|
$table_row[] = '--';
|
||||||
|
|
||||||
if($row['time_ok'] != 0)
|
if($row['time_ok'] != 0)
|
||||||
$table_row[] = human_time_description_raw($row['time_ok'], true);
|
$table_row[] = human_time_description_raw($row['time_ok'], true);
|
||||||
else
|
else
|
||||||
|
@ -2427,7 +2437,7 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table_row[] = human_time_description_raw($row['time_unknown'], true);
|
$table_row[] = human_time_description_raw($row['time_unknown'], true);
|
||||||
else
|
else
|
||||||
$table_row[] = '--';
|
$table_row[] = '--';
|
||||||
|
|
||||||
if($row['time_not_init'] != 0)
|
if($row['time_not_init'] != 0)
|
||||||
$table_row[] = human_time_description_raw($row['time_not_init'], true);
|
$table_row[] = human_time_description_raw($row['time_not_init'], true);
|
||||||
else
|
else
|
||||||
|
@ -2437,8 +2447,8 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table_row[] = human_time_description_raw($row['time_downtime'], true);
|
$table_row[] = human_time_description_raw($row['time_downtime'], true);
|
||||||
else
|
else
|
||||||
$table_row[] = '--';
|
$table_row[] = '--';
|
||||||
|
|
||||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
||||||
|
|
||||||
$table_row2 = array();
|
$table_row2 = array();
|
||||||
$table_row2[] = $row['agent'];
|
$table_row2[] = $row['agent'];
|
||||||
|
@ -2446,24 +2456,24 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table_row2[] = $row['checks_total'];
|
$table_row2[] = $row['checks_total'];
|
||||||
$table_row2[] = $row['checks_error'];
|
$table_row2[] = $row['checks_error'];
|
||||||
$table_row2[] = $row['checks_ok'];
|
$table_row2[] = $row['checks_ok'];
|
||||||
$table_row2[] = $row['checks_unknown'];
|
$table_row2[] = $row['checks_unknown'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($item['date']['to'] > $the_first_men_time) {
|
if ($item['date']['to'] > $the_first_men_time) {
|
||||||
$table_row = array();
|
$table_row = array();
|
||||||
$table_row[] = $row['agent'];
|
$table_row[] = $row['agent'];
|
||||||
$table_row[] = $row['availability_item'];
|
$table_row[] = $row['availability_item'];
|
||||||
|
|
||||||
if($row['time_total'] != 0)
|
if($row['time_total'] != 0)
|
||||||
$table_row[] = human_time_description_raw($row['time_total'], true);
|
$table_row[] = human_time_description_raw($row['time_total'], true);
|
||||||
else
|
else
|
||||||
$table_row[] = '--';
|
$table_row[] = '--';
|
||||||
|
|
||||||
if($row['time_error'] != 0)
|
if($row['time_error'] != 0)
|
||||||
$table_row[] = human_time_description_raw($row['time_error'], true);
|
$table_row[] = human_time_description_raw($row['time_error'], true);
|
||||||
else
|
else
|
||||||
$table_row[] = '--';
|
$table_row[] = '--';
|
||||||
|
|
||||||
if($row['time_ok'] != 0)
|
if($row['time_ok'] != 0)
|
||||||
$table_row[] = human_time_description_raw($row['time_ok'], true);
|
$table_row[] = human_time_description_raw($row['time_ok'], true);
|
||||||
else
|
else
|
||||||
|
@ -2473,7 +2483,7 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table_row[] = human_time_description_raw($row['time_unknown'], true);
|
$table_row[] = human_time_description_raw($row['time_unknown'], true);
|
||||||
else
|
else
|
||||||
$table_row[] = '--';
|
$table_row[] = '--';
|
||||||
|
|
||||||
if($row['time_not_init'] != 0)
|
if($row['time_not_init'] != 0)
|
||||||
$table_row[] = human_time_description_raw($row['time_not_init'], true);
|
$table_row[] = human_time_description_raw($row['time_not_init'], true);
|
||||||
else
|
else
|
||||||
|
@ -2483,8 +2493,8 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table_row[] = human_time_description_raw($row['time_downtime'], true);
|
$table_row[] = human_time_description_raw($row['time_downtime'], true);
|
||||||
else
|
else
|
||||||
$table_row[] = '--';
|
$table_row[] = '--';
|
||||||
|
|
||||||
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($row['SLA'], $config['graph_precision']). '%</span>';
|
||||||
|
|
||||||
$table_row2 = array();
|
$table_row2 = array();
|
||||||
$table_row2[] = $row['agent'];
|
$table_row2[] = $row['agent'];
|
||||||
|
@ -2498,7 +2508,6 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$same_agent_in_resume = $item['data']['agent'];
|
$same_agent_in_resume = $item['data']['agent'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table1->data[] = $table_row;
|
$table1->data[] = $table_row;
|
||||||
$table2->data[] = $table_row2;
|
$table2->data[] = $table_row2;
|
||||||
}
|
}
|
||||||
|
@ -2508,19 +2517,19 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table->data['error']['cell'] =
|
$table->data['error']['cell'] =
|
||||||
__('There are no Agent/Modules defined');
|
__('There are no Agent/Modules defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->colspan[1][0] = 2;
|
$table->colspan[1][0] = 2;
|
||||||
$table->colspan[2][0] = 2;
|
$table->colspan[2][0] = 2;
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = html_print_table($table1, true);
|
$data[0] = html_print_table($table1, true);
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
|
||||||
if ($item['resume']['resume']){
|
if ($item['resume']['resume']){
|
||||||
$data2 = array();
|
$data2 = array();
|
||||||
$data2[0] = html_print_table($table2, true);
|
$data2[0] = html_print_table($table2, true);
|
||||||
array_push ($table->data, $data2);
|
array_push ($table->data, $data2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item['resume']['resume'] && !empty($item["data"])) {
|
if ($item['resume']['resume'] && !empty($item["data"])) {
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
|
@ -2531,29 +2540,29 @@ function reporting_html_availability(&$table, $item) {
|
||||||
$table1->head['min_text'] = __('Agent min value');
|
$table1->head['min_text'] = __('Agent min value');
|
||||||
$table1->head['min'] = __('Min Value');
|
$table1->head['min'] = __('Min Value');
|
||||||
$table1->head['avg'] = __('Average Value');
|
$table1->head['avg'] = __('Average Value');
|
||||||
|
|
||||||
$table1->headstyle = array();
|
$table1->headstyle = array();
|
||||||
$table1->headstyle['min_text'] = 'text-align: left';
|
$table1->headstyle['min_text'] = 'text-align: left';
|
||||||
$table1->headstyle['min'] = 'text-align: right';
|
$table1->headstyle['min'] = 'text-align: right';
|
||||||
$table1->headstyle['max_text'] = 'text-align: left';
|
$table1->headstyle['max_text'] = 'text-align: left';
|
||||||
$table1->headstyle['max'] = 'text-align: right';
|
$table1->headstyle['max'] = 'text-align: right';
|
||||||
$table1->headstyle['avg'] = 'text-align: right';
|
$table1->headstyle['avg'] = 'text-align: right';
|
||||||
|
|
||||||
$table1->style = array();
|
$table1->style = array();
|
||||||
$table1->style['min_text'] = 'text-align: left';
|
$table1->style['min_text'] = 'text-align: left';
|
||||||
$table1->style['min'] = 'text-align: right';
|
$table1->style['min'] = 'text-align: right';
|
||||||
$table1->style['max_text'] = 'text-align: left';
|
$table1->style['max_text'] = 'text-align: left';
|
||||||
$table1->style['max'] = 'text-align: right';
|
$table1->style['max'] = 'text-align: right';
|
||||||
$table1->style['avg'] = 'text-align: right';
|
$table1->style['avg'] = 'text-align: right';
|
||||||
|
|
||||||
$table1->data[] = array(
|
$table1->data[] = array(
|
||||||
'max_text' => $item['resume']['max_text'],
|
'max_text' => $item['resume']['max_text'],
|
||||||
'max' => sla_truncate($item['resume']['max'], $config['graph_precision']) . "%",
|
'max' => sla_truncate($item['resume']['max'], $config['graph_precision']) . "%",
|
||||||
'min_text' => $item['resume']['min_text'],
|
'min_text' => $item['resume']['min_text'],
|
||||||
'min' => sla_truncate($item['resume']['min'], $config['graph_precision']) . "%",
|
'min' => sla_truncate($item['resume']['min'], $config['graph_precision']) . "%",
|
||||||
'avg' => '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($item['resume']['avg'], $config['graph_precision']) . "%</span>"
|
'avg' => '<span style="font-size: 1.2em; font-weight:bold;">' . sla_truncate($item['resume']['avg'], $config['graph_precision']) . "%</span>"
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->colspan[3][0] = 3;
|
$table->colspan[3][0] = 3;
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = html_print_table($table1, true);
|
$data[0] = html_print_table($table1, true);
|
||||||
|
@ -2574,6 +2583,11 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
|
$table1->size = array();
|
||||||
|
$table1->size[0] = '10%';
|
||||||
|
$table1->size[1] = '80%';
|
||||||
|
$table1->size[2] = '5%';
|
||||||
|
$table1->size[3] = '5%';
|
||||||
foreach ($item['charts'] as $chart) {
|
foreach ($item['charts'] as $chart) {
|
||||||
$checks_resume = '';
|
$checks_resume = '';
|
||||||
$sla_value = '';
|
$sla_value = '';
|
||||||
|
@ -2604,7 +2618,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||||
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
|
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
|
||||||
$sla_value .
|
$sla_value .
|
||||||
'</span>',
|
'</span>',
|
||||||
$checks_resume
|
$checks_resume
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2619,12 +2633,12 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||||
$table2->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
$table2->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
||||||
$table2->size[1] = '14%';
|
$table2->size[1] = '14%';
|
||||||
$table2->data[0][1] = '<span>'.__('OK') . '</span>';
|
$table2->data[0][1] = '<span>'.__('OK') . '</span>';
|
||||||
|
|
||||||
$table2->size[2] = '2%';
|
$table2->size[2] = '2%';
|
||||||
$table2->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
$table2->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
||||||
$table2->size[3] = '14%';
|
$table2->size[3] = '14%';
|
||||||
$table2->data[0][3] = '<span>'.__('Critical'). '</span>';
|
$table2->data[0][3] = '<span>'.__('Critical'). '</span>';
|
||||||
|
|
||||||
$table2->size[4] = '2%';
|
$table2->size[4] = '2%';
|
||||||
$table2->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
$table2->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
||||||
$table2->size[5] = '14%';
|
$table2->size[5] = '14%';
|
||||||
|
@ -2634,7 +2648,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||||
$table2->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
$table2->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
||||||
$table2->size[7] = '14%';
|
$table2->size[7] = '14%';
|
||||||
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
||||||
|
|
||||||
$table2->size[8] = '2%';
|
$table2->size[8] = '2%';
|
||||||
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
||||||
$table2->size[9] = '14%';
|
$table2->size[9] = '14%';
|
||||||
|
@ -2644,9 +2658,9 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||||
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
||||||
$table2->size[11] = '15%';
|
$table2->size[11] = '15%';
|
||||||
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->colspan['charts']['cell'] = 2;
|
$table->colspan['charts']['cell'] = 2;
|
||||||
$table->data['charts']['cell'] = html_print_table($table1, true);
|
$table->data['charts']['cell'] = html_print_table($table1, true);
|
||||||
$table->colspan['legend']['cell'] = 2;
|
$table->colspan['legend']['cell'] = 2;
|
||||||
|
@ -2857,24 +2871,6 @@ function reporting_html_sql(&$table, $item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -2899,8 +2895,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
||||||
|
|
||||||
if ($data["monitor_checks"] > 0) {
|
if ($data["monitor_checks"] > 0) {
|
||||||
// Fixed width non interactive charts
|
// Fixed width non interactive charts
|
||||||
$status_chart_width = $config["flash_charts"] == false
|
$status_chart_width = $graph_width;
|
||||||
? 100 : $graph_width;
|
|
||||||
|
|
||||||
$tdata[0] =
|
$tdata[0] =
|
||||||
'<div style="margin: auto; width: ' . $graph_width . 'px;">' .
|
'<div style="margin: auto; width: ' . $graph_width . 'px;">' .
|
||||||
|
@ -3038,125 +3033,6 @@ function reporting_get_fired_alerts_table ($alerts_fired) {
|
||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a report for alerts in a group of agents.
|
|
||||||
*
|
|
||||||
* It prints the numbers of alerts defined, fired and not fired in a group.
|
|
||||||
* It also prints all the alerts that were fired grouped by agents.
|
|
||||||
*
|
|
||||||
* @param int $id_group Group to get info of the alerts.
|
|
||||||
* @param int $period Period of time of the desired alert report.
|
|
||||||
* @param int $date Beggining date of the report (current date by default).
|
|
||||||
* @param bool $return Flag to return or echo the report (echo by default).
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return = false) {
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
$output = '';
|
|
||||||
$alerts = get_group_alerts ($id_group);
|
|
||||||
$alerts_fired = get_alerts_fired ($alerts, $period, $date);
|
|
||||||
|
|
||||||
$fired_percentage = 0;
|
|
||||||
if (sizeof ($alerts) > 0)
|
|
||||||
$fired_percentage = round (sizeof ($alerts_fired) / sizeof ($alerts) * 100, 2);
|
|
||||||
$not_fired_percentage = 100 - $fired_percentage;
|
|
||||||
|
|
||||||
$data = array ();
|
|
||||||
$data[__('Alerts fired')] = $fired_percentage;
|
|
||||||
$data[__('Alerts not fired')] = $not_fired_percentage;
|
|
||||||
|
|
||||||
$output .= pie3d_graph(false, $data, 280, 150,
|
|
||||||
__("other"),
|
|
||||||
ui_get_full_url(false, false, false, false) . '/',
|
|
||||||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
|
||||||
$config['fontpath'], $config['font_size']);
|
|
||||||
|
|
||||||
$output .= '<strong>'.__('Alerts fired').': '.sizeof ($alerts_fired).'</strong><br />';
|
|
||||||
$output .= '<strong>'.__('Total alerts monitored').': '.sizeof ($alerts).'</strong><br />';
|
|
||||||
|
|
||||||
if (! sizeof ($alerts_fired)) {
|
|
||||||
if (!$return)
|
|
||||||
echo $output;
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
$table = reporting_get_fired_alerts_table ($alerts_fired);
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->class = 'databox';
|
|
||||||
$table->size = array ();
|
|
||||||
$table->size[0] = '100px';
|
|
||||||
$table->style = array ();
|
|
||||||
$table->style[0] = 'font-weight: bold';
|
|
||||||
|
|
||||||
$output .= html_print_table ($table, true);
|
|
||||||
|
|
||||||
if (!$return)
|
|
||||||
echo $output;
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a report for monitors modules in a group of agents.
|
|
||||||
*
|
|
||||||
* It prints the numbers of monitors defined, showing those which went up and down, in a group.
|
|
||||||
* It also prints all the down monitors in the group.
|
|
||||||
*
|
|
||||||
* @param int $id_group Group to get info of the monitors.
|
|
||||||
* @param int $period Period of time of the desired monitor report.
|
|
||||||
* @param int $date Beginning date of the report in UNIX time (current date by default).
|
|
||||||
* @param bool $return Flag to return or echo the report (by default).
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return = false) {
|
|
||||||
if (empty ($date)) //If date is 0, false or empty
|
|
||||||
$date = get_system_time ();
|
|
||||||
|
|
||||||
$datelimit = $date - $period;
|
|
||||||
$output = '';
|
|
||||||
|
|
||||||
$monitors = modules_get_monitors_in_group ($id_group);
|
|
||||||
if (empty ($monitors)) //If monitors has returned false or an empty array
|
|
||||||
return;
|
|
||||||
$monitors_down = modules_get_monitors_down ($monitors, $period, $date);
|
|
||||||
$down_percentage = round (count ($monitors_down) / count ($monitors) * 100, 2);
|
|
||||||
$not_down_percentage = 100 - $down_percentage;
|
|
||||||
|
|
||||||
$output .= '<strong>'.__('Total monitors').': '.count ($monitors).'</strong><br />';
|
|
||||||
$output .= '<strong>'.__('Monitors down on period').': '.count ($monitors_down).'</strong><br />';
|
|
||||||
|
|
||||||
$table = reporting_get_monitors_down_table ($monitors_down);
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->class = 'databox';
|
|
||||||
$table->size = array ();
|
|
||||||
$table->size[0] = '100px';
|
|
||||||
$table->style = array ();
|
|
||||||
$table->style[0] = 'font-weight: bold';
|
|
||||||
|
|
||||||
$table->size = array ();
|
|
||||||
$table->size[0] = '100px';
|
|
||||||
|
|
||||||
$output .= html_print_table ($table, true);
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data[__('Monitors OK')] = $down_percentage;
|
|
||||||
$data[__('Monitors BAD')] = $not_down_percentage;
|
|
||||||
|
|
||||||
$output .= pie3d_graph(false, $data, 280, 150,
|
|
||||||
__("other"),
|
|
||||||
ui_get_full_url(false, false, false, false) . '/',
|
|
||||||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
|
||||||
$config['fontpath'], $config['font_size']);
|
|
||||||
|
|
||||||
if (!$return)
|
|
||||||
echo $output;
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a report table with all the monitors down.
|
* Get a report table with all the monitors down.
|
||||||
*
|
*
|
||||||
|
@ -3797,6 +3673,7 @@ function reporting_get_last_activity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reporting_get_event_histogram ($events, $text_header_event = false) {
|
function reporting_get_event_histogram ($events, $text_header_event = false) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
if (!defined("METACONSOLE")) {
|
if (!defined("METACONSOLE")) {
|
||||||
include_once ($config['homedir'] .'/include/graphs/functions_gd.php');
|
include_once ($config['homedir'] .'/include/graphs/functions_gd.php');
|
||||||
|
@ -3879,37 +3756,38 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
if (!$text_header_event) {
|
$table->width = '100%';
|
||||||
$table->width = '100%';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (defined("METACONSOLE")) {
|
|
||||||
$table->width = '100%';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$table->width = '70%';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
$table->size = array ();
|
$table->size = array ();
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
$table->title = '<span>' . $text_header_event . '</span>';
|
$table->title = '<span>' . $text_header_event . '</span>';
|
||||||
$table->data[0][0] = "" ;
|
$table->data[0][0] = "" ;
|
||||||
|
|
||||||
if (!empty($graph_data)) {
|
|
||||||
if (defined("METACONSOLE"))
|
|
||||||
$slicebar = flot_slicesbar_graph($graph_data, $max_value, "100%", 35, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url);
|
|
||||||
else {
|
|
||||||
if (!$text_header_event) {
|
|
||||||
$slicebar = slicesbar_graph($graph_data, $max_value, 700, 25, $colors, $config['fontpath'], $config['round_corner'], $urlImage, $ttl);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$slicebar = slicesbar_graph($graph_data, $max_value, 350, 18, $colors, $config['fontpath'], $config['round_corner'], $urlImage, $ttl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!empty($graph_data)) {
|
||||||
|
$url_slice = defined("METACONSOLE")
|
||||||
|
? $url
|
||||||
|
: $urlImage;
|
||||||
|
|
||||||
|
$slicebar = flot_slicesbar_graph (
|
||||||
|
$graph_data,
|
||||||
|
$max_value,
|
||||||
|
100,
|
||||||
|
35,
|
||||||
|
$full_legend,
|
||||||
|
$colors,
|
||||||
|
$config['fontpath'],
|
||||||
|
$config['round_corner'],
|
||||||
|
$url,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
array(),
|
||||||
|
true,
|
||||||
|
$ttl
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[0][0] = $slicebar;
|
$table->data[0][0] = $slicebar;
|
||||||
}
|
}
|
||||||
|
@ -3956,9 +3834,9 @@ function reporting_get_event_histogram_meta ($width) {
|
||||||
|
|
||||||
$ttl = 1;
|
$ttl = 1;
|
||||||
$urlImage = ui_get_full_url(false, true, false, false);
|
$urlImage = ui_get_full_url(false, true, false, false);
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
|
|
||||||
|
@ -3981,10 +3859,10 @@ function reporting_get_event_histogram_meta ($width) {
|
||||||
EVENT_CRIT_MAJOR => COL_MAJOR,
|
EVENT_CRIT_MAJOR => COL_MAJOR,
|
||||||
EVENT_CRIT_CRITICAL => COL_CRITICAL
|
EVENT_CRIT_CRITICAL => COL_CRITICAL
|
||||||
);
|
);
|
||||||
|
|
||||||
$user_groups = users_get_groups($config['id_user'], 'ER');
|
$user_groups = users_get_groups($config['id_user'], 'ER');
|
||||||
$user_groups_ids = array_keys($user_groups);
|
$user_groups_ids = array_keys($user_groups);
|
||||||
|
|
||||||
if (empty($user_groups)) {
|
if (empty($user_groups)) {
|
||||||
$groups_condition = ' AND 1 = 0 ';
|
$groups_condition = ' AND 1 = 0 ';
|
||||||
}
|
}
|
||||||
|
@ -3996,51 +3874,46 @@ function reporting_get_event_histogram_meta ($width) {
|
||||||
$groups_condition .= " AND id_grupo != 0";
|
$groups_condition .= " AND id_grupo != 0";
|
||||||
}
|
}
|
||||||
$status_condition = " AND estado = 0 ";
|
$status_condition = " AND estado = 0 ";
|
||||||
|
|
||||||
$cont = 0;
|
$cont = 0;
|
||||||
for ($i = 0; $i < $interval; $i++) {
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
$bottom = $datelimit + ($periodtime * $i);
|
$bottom = $datelimit + ($periodtime * $i);
|
||||||
if (! $graphic_type) {
|
if (! $graphic_type) {
|
||||||
if ($config['flash_charts']) {
|
$name = date('H:i:s', $bottom);
|
||||||
$name = date('H:i:s', $bottom);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$name = date('H\h', $bottom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$name = $bottom;
|
$name = $bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show less values in legend
|
// Show less values in legend
|
||||||
if ($cont == 0 or $cont % 2)
|
if ($cont == 0 or $cont % 2)
|
||||||
$legend[$cont] = $name;
|
$legend[$cont] = $name;
|
||||||
|
|
||||||
if ($from_agent_view) {
|
if ($from_agent_view) {
|
||||||
$full_date = date('Y/m/d', $bottom);
|
$full_date = date('Y/m/d', $bottom);
|
||||||
$full_legend_date[$cont] = $full_date;
|
$full_legend_date[$cont] = $full_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
$full_legend[$cont] = $name;
|
$full_legend[$cont] = $name;
|
||||||
|
|
||||||
$top = $datelimit + ($periodtime * ($i + 1));
|
$top = $datelimit + ($periodtime * ($i + 1));
|
||||||
|
|
||||||
$time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top;
|
$time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top;
|
||||||
$sql = sprintf('SELECT criticity,utimestamp
|
$sql = sprintf('SELECT criticity,utimestamp
|
||||||
FROM tmetaconsole_event
|
FROM tmetaconsole_event
|
||||||
WHERE %s %s %s
|
WHERE %s %s %s
|
||||||
ORDER BY criticity DESC',
|
ORDER BY criticity DESC',
|
||||||
$time_condition, $groups_condition, $status_condition);
|
$time_condition, $groups_condition, $status_condition);
|
||||||
|
|
||||||
$events = db_get_all_rows_sql($sql);
|
$events = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
$events_criticity = array();
|
$events_criticity = array();
|
||||||
if(is_array($events)){
|
if(is_array($events)){
|
||||||
foreach ($events as $key => $value) {
|
foreach ($events as $key => $value) {
|
||||||
array_push($events_criticity,$value['criticity']);
|
array_push($events_criticity,$value['criticity']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($events)) {
|
if (!empty($events)) {
|
||||||
if(array_search('4',$events_criticity) !== false){
|
if(array_search('4',$events_criticity) !== false){
|
||||||
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
|
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
|
||||||
|
@ -4061,16 +3934,14 @@ function reporting_get_event_histogram_meta ($width) {
|
||||||
}else {
|
}else {
|
||||||
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
|
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[$cont]['utimestamp'] = $periodtime;
|
$data[$cont]['utimestamp'] = $periodtime;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$data[$cont]['utimestamp'] = $periodtime;
|
$data[$cont]['utimestamp'] = $periodtime;
|
||||||
$data[$cont]['data'] = 1;
|
$data[$cont]['data'] = 1;
|
||||||
}
|
}
|
||||||
$cont++;
|
$cont++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
|
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
@ -4080,16 +3951,33 @@ function reporting_get_event_histogram_meta ($width) {
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
$table->title = '<span>' . $text_header_event . '</span>';
|
$table->title = '<span>' . $text_header_event . '</span>';
|
||||||
$table->data[0][0] = "" ;
|
$table->data[0][0] = "" ;
|
||||||
|
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
$slicebar = flot_slicesbar_graph($data, $period, "100%", 30, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url, '', '', false, 0, $full_legend_date);
|
$slicebar = flot_slicesbar_graph(
|
||||||
|
$data,
|
||||||
|
$period,
|
||||||
|
100,
|
||||||
|
30,
|
||||||
|
$full_legend,
|
||||||
|
$colors,
|
||||||
|
$config['fontpath'],
|
||||||
|
$config['round_corner'],
|
||||||
|
$url,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
$full_legend_date,
|
||||||
|
true,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[0][0] = $slicebar;
|
$table->data[0][0] = $slicebar;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$table->data[0][0] = __('No events');
|
$table->data[0][0] = __('No events');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$text_header_event) {
|
if (!$text_header_event) {
|
||||||
$event_graph = '<fieldset class="databox tactical_set">
|
$event_graph = '<fieldset class="databox tactical_set">
|
||||||
<legend>' .
|
<legend>' .
|
||||||
|
@ -4101,7 +3989,6 @@ function reporting_get_event_histogram_meta ($width) {
|
||||||
$table->class = 'noclass';
|
$table->class = 'noclass';
|
||||||
$event_graph = html_print_table($table, true);
|
$event_graph = html_print_table($table, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $event_graph;
|
return $event_graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -468,8 +468,6 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
||||||
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
||||||
include_graphs_dependencies();
|
include_graphs_dependencies();
|
||||||
|
|
||||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
|
||||||
|
|
||||||
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
||||||
|
|
||||||
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
||||||
|
@ -483,17 +481,27 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the agent info
|
||||||
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
||||||
|
if ($agent == false) return;
|
||||||
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && ! check_acl ($config["id_user"], $agent["id_grupo"], "AW") && !$is_extra) {
|
|
||||||
|
// Check all groups
|
||||||
|
$groups = agents_get_all_groups_agent($id_agente, $agent["id_grupo"]);
|
||||||
|
if (! check_acl_one_of_groups ($config["id_user"], $groups, "AR") && ! check_acl_one_of_groups ($config["id_user"], $groups, "AW") && !$is_extra) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access Agent General Information");
|
"Trying to access Agent General Information");
|
||||||
require_once ("general/noaccess.php");
|
require_once ("general/noaccess.php");
|
||||||
|
if (!empty($server_data) && is_metaconsole()) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($agent === false) {
|
if ($agent === false) {
|
||||||
ui_print_error_message(__('There was a problem loading agent'));
|
ui_print_error_message(__('There was a problem loading agent'));
|
||||||
|
if (!empty($server_data) && is_metaconsole()) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +530,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
||||||
$hashdata = $user.$pwd_deserialiced['auth_token'];
|
$hashdata = $user.$pwd_deserialiced['auth_token'];
|
||||||
|
|
||||||
$hashdata = md5($hashdata);
|
$hashdata = md5($hashdata);
|
||||||
$url = $server_data["server_url"] . "/index.php?" .
|
$url = "//" . $server_data["server_url"] . "/index.php?" .
|
||||||
"sec=estado&" .
|
"sec=estado&" .
|
||||||
"sec2=operation/agentes/ver_agente&" .
|
"sec2=operation/agentes/ver_agente&" .
|
||||||
"id_agente=" . $agent["id_agente"] . "&" .
|
"id_agente=" . $agent["id_agente"] . "&" .
|
||||||
|
@ -608,7 +616,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
||||||
$go_to_agent = '<div style="text-align: right;">';
|
$go_to_agent = '<div style="text-align: right;">';
|
||||||
|
|
||||||
if($agent["id_os"] != 100){
|
if($agent["id_os"] != 100){
|
||||||
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
$go_to_agent .= '<a target=_blank href="' . "//" . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||||
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -855,7 +855,8 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
||||||
// Restore the default connection.
|
// Restore the default connection.
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
$errors++;
|
$errors++;
|
||||||
break;
|
//break; It does not work in the php7 version remplace for:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,7 +979,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
||||||
|
|
||||||
if ($alert["times_fired"] > 0) {
|
if ($alert["times_fired"] > 0) {
|
||||||
$status = STATUS_ALERT_FIRED;
|
$status = STATUS_ALERT_FIRED;
|
||||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||||
}
|
}
|
||||||
elseif ($alert["disabled"] > 0) {
|
elseif ($alert["disabled"] > 0) {
|
||||||
$status = STATUS_ALERT_DISABLED;
|
$status = STATUS_ALERT_DISABLED;
|
||||||
|
@ -1593,24 +1594,16 @@ function ui_process_page_head ($string, $bitfield) {
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
//End load JQuery
|
//End load JQuery
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
include_once($config["homedir"] . '/include/graphs/functions_flot.php');
|
||||||
|
$output .= include_javascript_dependencies_flot_graph(true);
|
||||||
|
|
||||||
if ($config['flash_charts']) {
|
|
||||||
//Include the javascript for the js charts library
|
|
||||||
include_once($config["homedir"] . '/include/graphs/functions_flot.php');
|
|
||||||
$output .= include_javascript_dependencies_flot_graph(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$output .= '<!--[if gte IE 6]>
|
$output .= '<!--[if gte IE 6]>
|
||||||
<link rel="stylesheet" href="include/styles/ie.css" type="text/css"/>
|
<link rel="stylesheet" href="include/styles/ie.css" type="text/css"/>
|
||||||
<![endif]-->';
|
<![endif]-->';
|
||||||
|
|
||||||
$output .= $string;
|
$output .= $string;
|
||||||
|
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1968,6 +1961,23 @@ function ui_print_help_tip ($text, $return = false, $img = 'images/tip.png', $is
|
||||||
echo $output;
|
echo $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ui_print_help_tip_border ($text, $return = false, $img = 'images/tip_border.png', $is_relative = false) {
|
||||||
|
$output =
|
||||||
|
'<a href="javascript:" class="tip" >' .
|
||||||
|
html_print_image (
|
||||||
|
$img,
|
||||||
|
true,
|
||||||
|
array('title' => $text),
|
||||||
|
false,
|
||||||
|
$is_relative && is_metaconsole()
|
||||||
|
) .
|
||||||
|
'</a>';
|
||||||
|
|
||||||
|
if ($return)
|
||||||
|
return $output;
|
||||||
|
echo $output;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Powerful debug function that also shows a backtrace.
|
* Powerful debug function that also shows a backtrace.
|
||||||
*
|
*
|
||||||
|
@ -2139,19 +2149,25 @@ function ui_format_filesize ($bytes) {
|
||||||
*/
|
*/
|
||||||
function ui_get_status_images_path () {
|
function ui_get_status_images_path () {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$imageset = $config["status_images_set"];
|
$imageset = $config["status_images_set"];
|
||||||
|
|
||||||
if (strpos ($imageset, ",") === false)
|
if (strpos ($imageset, ",") === false)
|
||||||
$imageset .= ",40x18";
|
$imageset .= ",40x18";
|
||||||
list ($imageset, $sizes) = preg_split ("/\,/", $imageset);
|
|
||||||
|
$array_split = preg_split ("/\,/", $imageset);
|
||||||
|
$imageset = $array_split[0];
|
||||||
|
$sizes = $array_split[1];
|
||||||
|
|
||||||
if (strpos ($sizes, "x") === false)
|
if (strpos ($sizes, "x") === false)
|
||||||
$sizes .= "x18";
|
$sizes .= "x18";
|
||||||
list ($imagewidth, $imageheight) = preg_split ("/x/", $sizes);
|
|
||||||
|
$array_split_size = preg_split ("/x/", $sizes);
|
||||||
|
$imagewidth = $array_split_size[0];
|
||||||
|
$imageheight = $array_split_size[1];
|
||||||
|
|
||||||
$imagespath = 'images/status_sets/'.$imageset;
|
$imagespath = 'images/status_sets/'.$imageset;
|
||||||
|
|
||||||
return array ($imagespath);
|
return array ($imagespath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2168,20 +2184,21 @@ function ui_get_status_images_path () {
|
||||||
*/
|
*/
|
||||||
function ui_print_status_image ($type, $title = "", $return = false, $options = false, $path = false) {
|
function ui_print_status_image ($type, $title = "", $return = false, $options = false, $path = false) {
|
||||||
if ($path === false) {
|
if ($path === false) {
|
||||||
list ($imagepath) = ui_get_status_images_path ();
|
$imagepath_array = ui_get_status_images_path ();
|
||||||
|
$imagepath = $imagepath_array[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$imagepath = $path;
|
$imagepath = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
$imagepath .= "/" . $type;
|
$imagepath .= "/" . $type;
|
||||||
|
|
||||||
if ($options === false) {
|
if ($options === false) {
|
||||||
$options = array();
|
$options = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$options['title'] = $title;
|
$options['title'] = $title;
|
||||||
|
|
||||||
return html_print_image ($imagepath, $return, $options, false, false, false, true);
|
return html_print_image ($imagepath, $return, $options, false, false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2378,6 +2395,10 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
|
||||||
$port = null; // null means 'use the starndard port'
|
$port = null; // null means 'use the starndard port'
|
||||||
$proxy = false; //By default Pandora FMS doesn't run across proxy.
|
$proxy = false; //By default Pandora FMS doesn't run across proxy.
|
||||||
|
|
||||||
|
if(isset ($_SERVER['HTTP_X_FORWARDED_PROTO'])
|
||||||
|
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
||||||
|
$_SERVER['HTTPS'] = 'on';
|
||||||
|
}
|
||||||
if (isset ($_SERVER['HTTPS'])
|
if (isset ($_SERVER['HTTPS'])
|
||||||
&& ($_SERVER['HTTPS'] === true
|
&& ($_SERVER['HTTPS'] === true
|
||||||
|| $_SERVER['HTTPS'] == 'on')) {
|
|| $_SERVER['HTTPS'] == 'on')) {
|
||||||
|
@ -3828,8 +3849,7 @@ function ui_print_module_string_value($value, $id_agente_module,
|
||||||
'id_module' => $id_agente_module,
|
'id_module' => $id_agente_module,
|
||||||
'last_data' => $value,
|
'last_data' => $value,
|
||||||
'interval' => $current_interval,
|
'interval' => $current_interval,
|
||||||
'module_name' => $module_name,
|
'module_name' => $module_name
|
||||||
'timestamp' => db_get_value('timestamp', 'tagente_estado', 'id_agente_modulo', $id_agente_module)
|
|
||||||
));
|
));
|
||||||
$salida = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
$salida = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||||
} else {
|
} else {
|
||||||
|
@ -3947,8 +3967,14 @@ function ui_get_snapshot_link($params, $only_params = false) {
|
||||||
"id=" . $params['id_module'] .
|
"id=" . $params['id_module'] .
|
||||||
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name']))).
|
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name']))).
|
||||||
"&id_node=" . $params['id_node'];
|
"&id_node=" . $params['id_node'];
|
||||||
if ($params['timestamp'] != 0) $url .= "×tamp=" . $parms['timestamp'];
|
|
||||||
if ($params['timestamp'] != 0) $url .= "&refr=" . $parms['interval'];
|
if ($params['timestamp'] != 0) {
|
||||||
|
$url .= "×tamp=" . $params['timestamp'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($params['interval'] != 0) {
|
||||||
|
$url .= "&refr=" . $params['interval'];
|
||||||
|
}
|
||||||
|
|
||||||
// Second parameter of js winopeng_var
|
// Second parameter of js winopeng_var
|
||||||
$win_handle = dechex(crc32('snapshot_' . $params['id_module']));
|
$win_handle = dechex(crc32('snapshot_' . $params['id_module']));
|
||||||
|
|
|
@ -1203,7 +1203,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
if ($layoutData['label_position']=='left') {
|
if ($layoutData['label_position']=='left') {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
hbar_graph(true, $module_data,
|
hbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1211,7 +1211,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
vbar_graph(true, $module_data,
|
vbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1221,7 +1221,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
elseif($layoutData['label_position']=='right') {
|
elseif($layoutData['label_position']=='right') {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||||
hbar_graph(true, $module_data,
|
hbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1229,7 +1229,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||||
vbar_graph(true, $module_data,
|
vbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1238,14 +1238,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = hbar_graph(true, $module_data,
|
$img = hbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = vbar_graph(true, $module_data,
|
$img = vbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1257,7 +1257,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
if ($layoutData['label_position']=='left') {
|
if ($layoutData['label_position']=='left') {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
hbar_graph(true, $module_data,
|
hbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1265,7 +1265,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
vbar_graph(true, $module_data,
|
vbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1275,7 +1275,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
elseif($layoutData['label_position']=='right') {
|
elseif($layoutData['label_position']=='right') {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||||
hbar_graph(true, $module_data,
|
hbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1283,7 +1283,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||||
vbar_graph(true, $module_data,
|
vbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1292,14 +1292,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = hbar_graph(true, $module_data,
|
$img = hbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = vbar_graph(true, $module_data,
|
$img = vbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -1479,7 +1479,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
$img = '<img src="../../images/console/signes/module-events.png">';
|
$img = '<img src="../../images/console/signes/module-events.png">';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$img = '<img src="images/console/signes/module-events.png">';
|
$img = '<img src="images/console/signes/module-events.png">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -1494,28 +1494,28 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
else {
|
else {
|
||||||
if ($width == 0 || $height == 0) {
|
if ($width == 0 || $height == 0) {
|
||||||
if ($layoutData['label_position']=='left') {
|
if ($layoutData['label_position']=='left') {
|
||||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;width:500px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||||
}
|
}
|
||||||
elseif ($layoutData['label_position']=='right') {
|
elseif ($layoutData['label_position']=='right') {
|
||||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
|
$img = '<div style="width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if ($layoutData['label_position']=='left') {
|
if ($layoutData['label_position']=='left') {
|
||||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||||
}
|
}
|
||||||
elseif ($layoutData['label_position']=='right') {
|
elseif ($layoutData['label_position']=='right') {
|
||||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;width:500px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
|
$img = '<div style="width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
if ($layoutData['id_metaconsole'] != 0) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
|
@ -1524,7 +1524,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||||
$z_index = 2 + 1;
|
$z_index = 2 + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = "item ";
|
$class = "item ";
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case STATIC_GRAPH:
|
case STATIC_GRAPH:
|
||||||
|
@ -3597,17 +3597,17 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
||||||
$retval[$layout['id']] = $layout;
|
$retval[$layout['id']] = $layout;
|
||||||
|
|
||||||
//add_perms
|
//add_perms
|
||||||
if ($groups[$layout['id_group']]['vconsole_view']){
|
if (isset($groups[$layout['id_group']]['vconsole_view'])){
|
||||||
$retval[$layout['id']]['vr'] = $groups[$layout['id_group']]['vconsole_view'];
|
$retval[$layout['id']]['vr'] = $groups[$layout['id_group']]['vconsole_view'];
|
||||||
}
|
}
|
||||||
if ($groups[$layout['id_group']]['vconsole_edit']){
|
if (isset($groups[$layout['id_group']]['vconsole_edit'])){
|
||||||
$retval[$layout['id']]['vw'] = $groups[$layout['id_group']]['vconsole_edit'];
|
$retval[$layout['id']]['vw'] = $groups[$layout['id_group']]['vconsole_edit'];
|
||||||
}
|
}
|
||||||
if ($groups[$layout['id_group']]['vconsole_management']){
|
if (isset($groups[$layout['id_group']]['vconsole_management'])){
|
||||||
$retval[$layout['id']]['vm'] = $groups[$layout['id_group']]['vconsole_management'];
|
$retval[$layout['id']]['vm'] = $groups[$layout['id_group']]['vconsole_management'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -476,20 +476,20 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||||
$form_items['background_row_2']['items'] = array('background', 'datos');
|
$form_items['background_row_2']['items'] = array('background', 'datos');
|
||||||
$form_items['background_row_2']['html'] = '<td align="left">' .
|
$form_items['background_row_2']['html'] = '<td align="left">' .
|
||||||
__('Original Size') . '</td>
|
__('Original Size') . '</td>
|
||||||
<td align="left">' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"', true) . '</td>';
|
<td align="left">' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub vs_button_ghost"', true) . '</td>';
|
||||||
|
|
||||||
|
|
||||||
$form_items['background_row_3'] = array();
|
$form_items['background_row_3'] = array();
|
||||||
$form_items['background_row_3']['items'] = array('background', 'datos');
|
$form_items['background_row_3']['items'] = array('background', 'datos');
|
||||||
$form_items['background_row_3']['html'] = '<td align="left">' .
|
$form_items['background_row_3']['html'] = '<td align="left">' .
|
||||||
__('Aspect ratio') . '</td>
|
__('Aspect ratio') . '</td>
|
||||||
<td align="left">' . html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"', true) . '</td>';
|
<td align="left">' . html_print_button(__('Proportional Width'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub vs_button_ghost"', true) . '</td>';
|
||||||
|
|
||||||
|
|
||||||
$form_items['background_row_4'] = array();
|
$form_items['background_row_4'] = array();
|
||||||
$form_items['background_row_4']['items'] = array('background', 'datos');
|
$form_items['background_row_4']['items'] = array('background', 'datos');
|
||||||
$form_items['background_row_4']['html'] = '<td align="left"></td>
|
$form_items['background_row_4']['html'] = '<td align="left"></td>
|
||||||
<td align="left">' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub"', true) . '</td>';
|
<td align="left">' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub vs_button_ghost"', true) . '</td>';
|
||||||
|
|
||||||
|
|
||||||
$form_items['percentile_bar_row_1'] = array();
|
$form_items['percentile_bar_row_1'] = array();
|
||||||
|
@ -640,7 +640,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||||
|
|
||||||
|
|
||||||
foreach ($form_items as $item => $item_options) {
|
foreach ($form_items as $item => $item_options) {
|
||||||
echo '<tr id="' . $item . '" style="" class="' . implode(' ', $item_options['items']) . '">';
|
echo '<tr id="' . $item . '" style="" class="' . implode(' ', (array)$item_options['items']) . '">';
|
||||||
echo $item_options['html'];
|
echo $item_options['html'];
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
@ -721,9 +721,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||||
|
|
||||||
$node_visual_maps = db_get_all_rows_filter("tlayout", array(), array("id", "name"));
|
$node_visual_maps = db_get_all_rows_filter("tlayout", array(), array("id", "name"));
|
||||||
|
|
||||||
foreach ($node_visual_maps as $node_visual_map) {
|
if(isset($node_visual_maps) && is_array($node_visual_maps)){
|
||||||
$node_visual_map["node_id"] = (int) $server["id"];
|
foreach ($node_visual_maps as $node_visual_map) {
|
||||||
$visual_maps[] = $node_visual_map;
|
$node_visual_map["node_id"] = (int) $server["id"];
|
||||||
|
$visual_maps[] = $node_visual_map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
|
|
|
@ -266,10 +266,9 @@ class gettext_reader {
|
||||||
return $this->find_string($string, $half, $end);
|
return $this->find_string($string, $half, $end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates a string
|
* Translates a string
|
||||||
*
|
|
||||||
* @access public
|
* @access public
|
||||||
* @param string string to be translated
|
* @param string string to be translated
|
||||||
* @return string translated string (or original, if not found)
|
* @return string translated string (or original, if not found)
|
||||||
|
@ -277,8 +276,8 @@ class gettext_reader {
|
||||||
function translate($string) {
|
function translate($string) {
|
||||||
if ($this->short_circuit)
|
if ($this->short_circuit)
|
||||||
return $string;
|
return $string;
|
||||||
$this->load_tables();
|
$this->load_tables();
|
||||||
|
|
||||||
if ($this->enable_cache) {
|
if ($this->enable_cache) {
|
||||||
// Caching enabled, get translated string from cache
|
// Caching enabled, get translated string from cache
|
||||||
if (array_key_exists($string, $this->cache_translations))
|
if (array_key_exists($string, $this->cache_translations))
|
||||||
|
@ -294,99 +293,6 @@ class gettext_reader {
|
||||||
return $this->get_translation_string($num);
|
return $this->get_translation_string($num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get possible plural forms from MO header
|
|
||||||
*
|
|
||||||
* @access private
|
|
||||||
* @return string plural form header
|
|
||||||
*/
|
|
||||||
function get_plural_forms() {
|
|
||||||
// lets assume message number 0 is header
|
|
||||||
// this is true, right?
|
|
||||||
$this->load_tables();
|
|
||||||
|
|
||||||
// cache header field for plural forms
|
|
||||||
if (! is_string($this->pluralheader)) {
|
|
||||||
if ($this->enable_cache) {
|
|
||||||
$header = $this->cache_translations[""];
|
|
||||||
} else {
|
|
||||||
$header = $this->get_translation_string(0);
|
|
||||||
}
|
|
||||||
if (eregi("plural-forms: ([^\n]*)\n", $header, $regs))
|
|
||||||
$expr = $regs[1];
|
|
||||||
else
|
|
||||||
$expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
|
|
||||||
$this->pluralheader = $expr;
|
|
||||||
}
|
|
||||||
return $this->pluralheader;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detects which plural form to take
|
|
||||||
*
|
|
||||||
* @access private
|
|
||||||
* @param n count
|
|
||||||
* @return int array index of the right plural form
|
|
||||||
*/
|
|
||||||
function select_string($n) {
|
|
||||||
$string = $this->get_plural_forms();
|
|
||||||
$string = str_replace('nplurals',"\$total",$string);
|
|
||||||
$string = str_replace("n",$n,$string);
|
|
||||||
$string = str_replace('plural',"\$plural",$string);
|
|
||||||
|
|
||||||
$total = 0;
|
|
||||||
$plural = 0;
|
|
||||||
|
|
||||||
eval("$string");
|
|
||||||
if ($plural >= $total) $plural = $total - 1;
|
|
||||||
return $plural;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plural version of gettext
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param string single
|
|
||||||
* @param string plural
|
|
||||||
* @param string number
|
|
||||||
* @return translated plural form
|
|
||||||
*/
|
|
||||||
function ngettext($single, $plural, $number) {
|
|
||||||
if ($this->short_circuit) {
|
|
||||||
if ($number != 1)
|
|
||||||
return $plural;
|
|
||||||
else
|
|
||||||
return $single;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find out the appropriate form
|
|
||||||
$select = $this->select_string($number);
|
|
||||||
|
|
||||||
// this should contains all strings separated by NULLs
|
|
||||||
$key = $single.chr(0).$plural;
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->enable_cache) {
|
|
||||||
if (! array_key_exists($key, $this->cache_translations)) {
|
|
||||||
return ($number != 1) ? $plural : $single;
|
|
||||||
} else {
|
|
||||||
$result = $this->cache_translations[$key];
|
|
||||||
$list = explode(chr(0), $result);
|
|
||||||
return $list[$select];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$num = $this->find_string($key);
|
|
||||||
if ($num == -1) {
|
|
||||||
return ($number != 1) ? $plural : $single;
|
|
||||||
} else {
|
|
||||||
$result = $this->get_translation_string($num);
|
|
||||||
$list = explode(chr(0), $result);
|
|
||||||
return $list[$select];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -93,23 +93,6 @@ switch($graph_type) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
function histogram($chart_data, $width, $height, $font, $max, $title,
|
|
||||||
$mode, $ttl = 1) {
|
|
||||||
|
|
||||||
$graph = array();
|
|
||||||
$graph['data'] = $chart_data;
|
|
||||||
$graph['width'] = $width;
|
|
||||||
$graph['height'] = $height;
|
|
||||||
$graph['font'] = $font;
|
|
||||||
$graph['max'] = $max;
|
|
||||||
$graph['title'] = $title;
|
|
||||||
$graph['mode'] = $mode;
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
||||||
|
|
||||||
return "<img src='include/graphs/functions_gd.php?static_graph=1&graph_type=histogram&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
||||||
}
|
|
||||||
|
|
||||||
function progressbar($progress, $width, $height, $title, $font,
|
function progressbar($progress, $width, $height, $title, $font,
|
||||||
$mode = 1, $out_of_lim_str = false, $out_of_lim_image = false,
|
$mode = 1, $out_of_lim_str = false, $out_of_lim_image = false,
|
||||||
$ttl = 1) {
|
$ttl = 1) {
|
||||||
|
@ -134,26 +117,7 @@ function progressbar($progress, $width, $height, $title, $font,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
|
||||||
$font, $round_corner, $home_url = '', $ttl = 1) {
|
|
||||||
|
|
||||||
$graph = array();
|
|
||||||
$graph['data'] = $chart_data;
|
|
||||||
$graph['period'] = $period;
|
|
||||||
$graph['width'] = $width;
|
|
||||||
$graph['height'] = $height;
|
|
||||||
$graph['font'] = $font;
|
|
||||||
$graph['round_corner'] = $round_corner;
|
|
||||||
$graph['color'] = $colors;
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
||||||
|
|
||||||
return "<img src='".$home_url."include/graphs/functions_pchart.php?static_graph=1&graph_type=slicebar&ttl=".$ttl."&id_graph=".$id_graph."' style='width:100%;'>";
|
|
||||||
}
|
|
||||||
|
|
||||||
function vbar_graph(
|
function vbar_graph(
|
||||||
$flash_chart,
|
|
||||||
$chart_data,
|
$chart_data,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
|
@ -180,43 +144,46 @@ function vbar_graph(
|
||||||
return '<img src="' . $no_data_image . '" />';
|
return '<img src="' . $no_data_image . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($flash_chart) {
|
if($ttl == 2){
|
||||||
return flot_vcolumn_chart ($chart_data, $width, $height, $color,
|
$params = array(
|
||||||
$legend, $long_index, $homeurl, $unit, $water_mark_url,
|
'chart_data' => $chart_data,
|
||||||
$homedir,$font,$font_size, $from_ux, $from_wux, $backgroundColor,
|
'width' => $width,
|
||||||
$tick_color);
|
'height' => $height,
|
||||||
|
'color' => $color,
|
||||||
|
'legend' => $legend,
|
||||||
|
'long_index' => $long_index,
|
||||||
|
'homeurl' => $homeurl,
|
||||||
|
'unit' => $unit,
|
||||||
|
'water_mark_url' => $water_mark_url,
|
||||||
|
'homedir' => $homedir,
|
||||||
|
'font' => $font,
|
||||||
|
'font_size' => $font_size,
|
||||||
|
'from_ux' => $from_ux,
|
||||||
|
'from_wux' => $from_wux,
|
||||||
|
'backgroundColor' => $backgroundColor,
|
||||||
|
'tick_color' => $tick_color
|
||||||
|
);
|
||||||
|
return generator_chart_to_pdf('vbar', $params);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$new_chart_data = array();
|
|
||||||
foreach ($chart_data as $key => $value) {
|
|
||||||
if(strlen($key) > 20 && strpos($key, ' - ') !== false){
|
|
||||||
$key_temp = explode(" - ",$key);
|
|
||||||
$key_temp[0] = $key_temp[0]." \n";
|
|
||||||
$key_temp[1]= '...'.substr($key_temp[1],-15);
|
|
||||||
$key2 = $key_temp[0].$key_temp[1];
|
|
||||||
io_safe_output($key2);
|
|
||||||
$new_chart_data[$key2]['g'] = $chart_data[$key]['g'];
|
|
||||||
} else {
|
|
||||||
$new_chart_data[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$graph = array();
|
return flot_vcolumn_chart (
|
||||||
$graph['data'] = $new_chart_data;
|
$chart_data,
|
||||||
$graph['width'] = $width;
|
$width,
|
||||||
$graph['height'] = $height;
|
$height,
|
||||||
$graph['color'] = $color;
|
$color,
|
||||||
$graph['legend'] = $legend;
|
$legend,
|
||||||
$graph['xaxisname'] = $xaxisname;
|
$long_index,
|
||||||
$graph['yaxisname'] = $yaxisname;
|
$homeurl,
|
||||||
$graph['water_mark'] = $water_mark_file;
|
$unit,
|
||||||
$graph['font'] = $font;
|
$water_mark_url,
|
||||||
$graph['font_size'] = $font_size;
|
$homedir,
|
||||||
|
$font,
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
$font_size,
|
||||||
|
$from_ux,
|
||||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=vbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
$from_wux,
|
||||||
}
|
$backgroundColor,
|
||||||
|
$tick_color
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function area_graph(
|
function area_graph(
|
||||||
|
@ -295,7 +262,7 @@ function stacked_gauge($chart_data, $width, $height,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hbar_graph($flash_chart, $chart_data, $width, $height,
|
function hbar_graph($chart_data, $width, $height,
|
||||||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||||
|
@ -307,68 +274,39 @@ function hbar_graph($flash_chart, $chart_data, $width, $height,
|
||||||
return '<img src="' . $no_data_image . '" />';
|
return '<img src="' . $no_data_image . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($flash_chart) {
|
if($ttl == 2){
|
||||||
return flot_hcolumn_chart(
|
$params = array(
|
||||||
$chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color, $val_min, $val_max);
|
'chart_data' => $chart_data,
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height,
|
||||||
|
'water_mark_url' => $water_mark_url,
|
||||||
|
'font' => $font,
|
||||||
|
'font_size' => $font_size,
|
||||||
|
'backgroundColor' => $backgroundColor,
|
||||||
|
'tick_color' => $tick_color,
|
||||||
|
'val_min' => $val_min,
|
||||||
|
'val_max' => $val_max
|
||||||
|
);
|
||||||
|
return generator_chart_to_pdf('hbar', $params);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
foreach ($chart_data as $key => $value) {
|
|
||||||
$str_key = io_safe_output($key);
|
|
||||||
if(strlen($str_key) > 40){
|
|
||||||
if(strpos($str_key, ' - ') != -1){
|
|
||||||
$key_temp = explode(" - ",$str_key);
|
|
||||||
$key_temp[0] = $key_temp[0]." <br>";
|
|
||||||
$key_temp[1]= '...'.substr($key_temp[1],-20);
|
|
||||||
$key2 = $key_temp[0].$key_temp[1];
|
|
||||||
}
|
|
||||||
$chart_data[$key2]['g'] = $chart_data[$key]['g'];
|
|
||||||
unset($chart_data[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$graph = array();
|
return flot_hcolumn_chart(
|
||||||
$graph['data'] = $chart_data;
|
$chart_data,
|
||||||
$graph['width'] = $width;
|
$width,
|
||||||
$graph['height'] = $height;
|
$height,
|
||||||
$graph['color'] = $color;
|
$water_mark_url,
|
||||||
$graph['legend'] = $legend;
|
$font,
|
||||||
$graph['xaxisname'] = $xaxisname;
|
$font_size,
|
||||||
$graph['yaxisname'] = $yaxisname;
|
$backgroundColor,
|
||||||
$graph['force_height'] = $force_height;
|
$tick_color,
|
||||||
$graph['water_mark'] = $water_mark_file;
|
$val_min,
|
||||||
$graph['font'] = $font;
|
$val_max
|
||||||
$graph['font_size'] = $font_size;
|
);
|
||||||
$graph['force_steps'] = $force_steps;
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
||||||
|
|
||||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=hbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pie3d_graph($flash_chart, $chart_data, $width, $height,
|
function pie_graph($chart_data, $width,
|
||||||
$others_str = "other", $homedir = "", $water_mark = "", $font = '',
|
|
||||||
$font_size = '', $ttl = 1, $legend_position = false, $colors = '',
|
|
||||||
$hide_labels = false) {
|
|
||||||
|
|
||||||
return pie_graph('3d', $flash_chart, $chart_data, $width, $height,
|
|
||||||
$others_str, $homedir, $water_mark, $font, $font_size, $ttl,
|
|
||||||
$legend_position, $colors, $hide_labels);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pie2d_graph($flash_chart, $chart_data, $width, $height,
|
|
||||||
$others_str = "other", $homedir="", $water_mark = "", $font = '',
|
|
||||||
$font_size = '', $ttl = 1, $legend_position = false, $colors = '',
|
|
||||||
$hide_labels = false) {
|
|
||||||
|
|
||||||
return pie_graph('2d', $flash_chart, $chart_data, $width, $height,
|
|
||||||
$others_str, $homedir, $water_mark, $font, $font_size, $ttl,
|
|
||||||
$legend_position, $colors, $hide_labels);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pie_graph($graph_type, $flash_chart, $chart_data, $width,
|
|
||||||
$height, $others_str = "other", $homedir="", $water_mark = "",
|
$height, $others_str = "other", $homedir="", $water_mark = "",
|
||||||
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
$font = '', $font_size = 8, $ttl = 1, $legend_position = false,
|
||||||
$colors = '', $hide_labels = false) {
|
$colors = '', $hide_labels = false) {
|
||||||
|
|
||||||
if (empty($chart_data)) {
|
if (empty($chart_data)) {
|
||||||
|
@ -405,37 +343,38 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width,
|
||||||
$chart_data = $chart_data_trunc;
|
$chart_data = $chart_data_trunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($flash_chart) {
|
if($ttl == 2){
|
||||||
return flot_pie_chart(array_values($chart_data),
|
$params = array(
|
||||||
array_keys($chart_data), $width, $height, $water_mark_url,
|
'values' => array_values($chart_data),
|
||||||
$font, $font_size, $legend_position, $colors, $hide_labels);
|
'keys' => array_keys($chart_data),
|
||||||
}
|
'width' => $width,
|
||||||
else {
|
'height' => $height,
|
||||||
//TODO SET THE LEGEND POSITION
|
'water_mark_url' => $water_mark_url,
|
||||||
$graph = array();
|
'font' => $font,
|
||||||
$graph['data'] = $chart_data;
|
'font_size' => $font_size,
|
||||||
$graph['width'] = $width;
|
'legend_position' => $legend_position,
|
||||||
$graph['height'] = $height;
|
'colors' => $colors,
|
||||||
$graph['water_mark'] = $water_mark_file;
|
'hide_labels' => $hide_labels
|
||||||
$graph['font'] = $font;
|
);
|
||||||
$graph['font_size'] = $font_size;
|
|
||||||
$graph['legend_position'] = $legend_position;
|
|
||||||
$graph['color'] = $colors;
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
return generator_chart_to_pdf('pie_chart', $params);
|
||||||
|
|
||||||
switch ($graph_type) {
|
|
||||||
case "2d":
|
|
||||||
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=pie2d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
||||||
break;
|
|
||||||
case "3d":
|
|
||||||
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=pie3d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return flot_pie_chart(
|
||||||
|
array_values($chart_data),
|
||||||
|
array_keys($chart_data),
|
||||||
|
$width,
|
||||||
|
$height,
|
||||||
|
$water_mark_url,
|
||||||
|
$font,
|
||||||
|
$font_size,
|
||||||
|
$legend_position,
|
||||||
|
$colors,
|
||||||
|
$hide_labels
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ring_graph($flash_chart, $chart_data, $width,
|
function ring_graph($chart_data, $width,
|
||||||
$height, $others_str = "other", $homedir="", $water_mark = "",
|
$height, $others_str = "other", $homedir="", $water_mark = "",
|
||||||
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
||||||
$colors = '', $hide_labels = false,$background_color = 'white') {
|
$colors = '', $hide_labels = false,$background_color = 'white') {
|
||||||
|
@ -449,64 +388,49 @@ function ring_graph($flash_chart, $chart_data, $width,
|
||||||
// This library allows only 8 colors
|
// This library allows only 8 colors
|
||||||
$max_values = 18;
|
$max_values = 18;
|
||||||
|
|
||||||
if ($flash_chart) {
|
if($ttl == 2){
|
||||||
return flot_custom_pie_chart ($flash_chart, $chart_data,
|
$params = array(
|
||||||
$width, $height, $colors, $module_name_list, $long_index,
|
'chart_data' => $chart_data,
|
||||||
$no_data, false, '', $water_mark, $font, $font_size,
|
'width' => $width,
|
||||||
$unit, $ttl, $homeurl, $background_color, $legend_position,$background_color);
|
'height' => $height,
|
||||||
|
'colors' => $colors,
|
||||||
|
'module_name_list' => $module_name_list,
|
||||||
|
'long_index' => $long_index,
|
||||||
|
'no_data' => $no_data,
|
||||||
|
'water_mark' => $water_mark,
|
||||||
|
'font' => $font,
|
||||||
|
'font_size' => $font_size,
|
||||||
|
'unit' => $unit,
|
||||||
|
'ttl' => $ttl,
|
||||||
|
'homeurl' => $homeurl,
|
||||||
|
'background_color' => $background_color,
|
||||||
|
'legend_position' => $legend_position,
|
||||||
|
'background_color' => $background_color
|
||||||
|
);
|
||||||
|
|
||||||
|
return generator_chart_to_pdf('ring_graph', $params);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$total_modules = $chart_data['total_modules'];
|
|
||||||
unset($chart_data['total_modules']);
|
|
||||||
|
|
||||||
$max_values = 9;
|
return flot_custom_pie_chart (
|
||||||
//Remove the html_entities
|
$chart_data,
|
||||||
$n = 0;
|
$width,
|
||||||
$temp = array();
|
$height,
|
||||||
$coloretes = array();
|
$colors,
|
||||||
foreach ($chart_data as $key => $value) {
|
$module_name_list,
|
||||||
if ($n < $max_values) {
|
$long_index,
|
||||||
$temp[io_safe_output($key)] = $value['value'];
|
$no_data,
|
||||||
$legend[] = io_safe_output($key) .": " . $value['value'] . " " .$value['unit'];
|
false,
|
||||||
}
|
'',
|
||||||
$n++;
|
$water_mark,
|
||||||
}
|
$font,
|
||||||
$chart_data = $temp;
|
$font_size,
|
||||||
|
$unit,
|
||||||
$chart_data_trunc = array();
|
$ttl,
|
||||||
$coloretes = array();
|
$homeurl,
|
||||||
$n = 1;
|
$background_color,
|
||||||
//~ foreach ($chart_data as $key => $value) {
|
$legend_position,
|
||||||
//~ if ($n < $max_values) {
|
$background_color
|
||||||
|
);
|
||||||
//~ $chart_data_trunc[$key] = $value;
|
|
||||||
//~ }
|
|
||||||
//~ else {
|
|
||||||
//~ if (!isset($chart_data_trunc[$others_str])) {
|
|
||||||
//~ $chart_data_trunc[$others_str] = 0;
|
|
||||||
//~ }
|
|
||||||
//~ $chart_data_trunc[$others_str] += $value;
|
|
||||||
//~ }
|
|
||||||
//~ $n++;
|
|
||||||
//~ }
|
|
||||||
//~ $chart_data = $chart_data_trunc;
|
|
||||||
|
|
||||||
//TODO SET THE LEGEND POSITION
|
|
||||||
$graph = array();
|
|
||||||
$graph['data'] = $chart_data;
|
|
||||||
$graph['width'] = $width;
|
|
||||||
$graph['height'] = $height;
|
|
||||||
$graph['water_mark'] = $water_mark_file;
|
|
||||||
$graph['font'] = $font;
|
|
||||||
$graph['font_size'] = $font_size;
|
|
||||||
$graph['legend_position'] = $legend_position;
|
|
||||||
$graph['legend'] = $legend;
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
||||||
|
|
||||||
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=ring3d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, water_mark, separator, legend_position, height, colors, hide_labels) {
|
function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, water_mark, separator, legend_position, height, colors, hide_labels) {
|
||||||
var labels = labels.split(separator);
|
var labels = labels.split(separator);
|
||||||
var data = values.split(separator);
|
var data = values.split(separator);
|
||||||
|
|
||||||
if (colors != '') {
|
if (colors != '') {
|
||||||
colors = colors.split(separator);
|
colors = colors.split(separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pieRadius = 0.9;
|
var pieRadius = 0.9;
|
||||||
|
|
||||||
var color = null;
|
var color = null;
|
||||||
|
@ -17,62 +14,43 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat
|
||||||
if (colors != '') {
|
if (colors != '') {
|
||||||
color = colors[i];
|
color = colors[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
data[i] = { label: labels[i], data: parseFloat(data[i]), color: color}
|
data[i] = { label: labels[i], data: parseFloat(data[i]), color: color}
|
||||||
}
|
}
|
||||||
|
|
||||||
var label_conf;
|
|
||||||
|
|
||||||
if (width < 400 || hide_labels) {
|
|
||||||
label_conf = {
|
|
||||||
show: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
label_conf = {
|
|
||||||
show: true,
|
|
||||||
radius: pieRadius,
|
|
||||||
formatter: function(label, series) {
|
|
||||||
return '<div style="font-size:' + font_size + 'pt;' +
|
|
||||||
'text-align:center;padding:2px;color:white;">' +
|
|
||||||
label + '<br/>' + series.percent.toFixed(2) + '%</div>';
|
|
||||||
},
|
|
||||||
background: {
|
|
||||||
opacity: 0.5,
|
|
||||||
color: ''
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var show_legend = true;
|
var show_legend = true;
|
||||||
if (legend_position == 'hidden') {
|
if (legend_position == 'hidden') {
|
||||||
show_legend = false;
|
show_legend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var conf_pie = {
|
var conf_pie = {
|
||||||
series: {
|
series: {
|
||||||
pie: {
|
pie: {
|
||||||
show: true,
|
show: true,
|
||||||
radius: pieRadius,
|
radius: pieRadius
|
||||||
//offset: {top: -100},
|
|
||||||
label: label_conf,
|
|
||||||
//$label_str
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
show: show_legend
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
hoverable: true,
|
|
||||||
clickable: true
|
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
legend: {
|
||||||
if (width < 400) {
|
show: show_legend
|
||||||
conf_pie.legend.labelFormatter = function(label, series) {
|
},
|
||||||
return label + " (" + series.percent.toFixed(2) + "%)";
|
grid: {
|
||||||
}
|
hoverable: true,
|
||||||
|
clickable: true
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(hide_labels != false && hide_labels != 0){
|
||||||
|
conf_pie.series.pie.label = {
|
||||||
|
show: true,
|
||||||
|
radius: 2/3,
|
||||||
|
formatter: labelFormatter,
|
||||||
|
threshold: 0.1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
conf_pie.series.pie.label = {
|
||||||
|
show:false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (legend_position) {
|
switch (legend_position) {
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
|
@ -89,7 +67,7 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat
|
||||||
var plot = $.plot($('#'+graph_id), data, conf_pie);
|
var plot = $.plot($('#'+graph_id), data, conf_pie);
|
||||||
|
|
||||||
var legends = $('#'+graph_id+' .legendLabel');
|
var legends = $('#'+graph_id+' .legendLabel');
|
||||||
legends.css('font-size', font_size+'pt');
|
legends.css('font-size', font_size+'pt');
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
$('#' + graph_id).bind('plothover', pieHover);
|
$('#' + graph_id).bind('plothover', pieHover);
|
||||||
|
@ -106,14 +84,18 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat
|
||||||
legends.eq(index).css('color', '');
|
legends.eq(index).css('color', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function labelFormatter(label, series) {
|
||||||
|
return '<div style="font-size:' + font_size + 'pt;' + 'text-align:center;padding:2px;color:white;">' +
|
||||||
|
label + '<br/>' + series.percent.toFixed(2) + '%</div>';
|
||||||
|
}
|
||||||
|
|
||||||
// Reset styles
|
// Reset styles
|
||||||
function resetInteractivity() {
|
function resetInteractivity() {
|
||||||
legends.css('color', '#3F3F3D');
|
legends.css('color', '#3F3F3D');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (water_mark) {
|
if (water_mark) {
|
||||||
set_watermark(graph_id, plot,
|
set_watermark(graph_id, plot,$('#watermark_image_' + graph_id).attr('src'));
|
||||||
$('#watermark_image_' + graph_id).attr('src'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,16 +669,21 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent, full_legend) {
|
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick,
|
||||||
|
font, font_size, separator, separator2, id_agent, full_legend, not_interactive) {
|
||||||
|
|
||||||
values = values.split(separator2);
|
values = values.split(separator2);
|
||||||
labels = labels.split(separator);
|
labels = labels.split(separator);
|
||||||
legend = legend.split(separator);
|
legend = legend.split(separator);
|
||||||
acumulate_data = acumulate_data.split(separator);
|
acumulate_data = acumulate_data.split(separator);
|
||||||
datacolor = datacolor.split(separator);
|
datacolor = datacolor.split(separator);
|
||||||
|
|
||||||
if (full_legend != false) {
|
if (full_legend != false) {
|
||||||
full_legend = full_legend.split(separator);
|
full_legend = full_legend.split(separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var font_size = parseInt(font_size);
|
||||||
|
var font = font.split("/").pop().split(".").shift();
|
||||||
// Check possible adapt_keys on classes
|
// Check possible adapt_keys on classes
|
||||||
check_adaptions(graph_id);
|
check_adaptions(graph_id);
|
||||||
|
|
||||||
|
@ -704,6 +691,7 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
||||||
|
|
||||||
for (i=0;i<values.length;i++) {
|
for (i=0;i<values.length;i++) {
|
||||||
var serie = values[i].split(separator);
|
var serie = values[i].split(separator);
|
||||||
|
|
||||||
var aux = new Array();
|
var aux = new Array();
|
||||||
$.each(serie,function(i,v) {
|
$.each(serie,function(i,v) {
|
||||||
aux.push([v, i]);
|
aux.push([v, i]);
|
||||||
|
@ -711,75 +699,63 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
||||||
|
|
||||||
datas.push({
|
datas.push({
|
||||||
data: aux,
|
data: aux,
|
||||||
bars: { show: true, fill: true ,fillColor: datacolor[i] , horizontal: true, lineWidth:0, steps:false }
|
bars: {
|
||||||
|
show: true,
|
||||||
|
fill: 1,
|
||||||
|
fillColor: { colors: [ { opacity: 1 }, { opacity: 1 } ] },
|
||||||
|
lineWidth:0,
|
||||||
|
horizontal: true,
|
||||||
|
steps:false,
|
||||||
|
barWidth: 24 * 60 * 60 * 600
|
||||||
|
},
|
||||||
|
color:datacolor[i]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var stack = 0, bars = true, lines = false, steps = false;
|
|
||||||
|
|
||||||
var regex = /visual_console/;
|
var regex = /visual_console/;
|
||||||
var match = regex.exec(window.location.href);
|
var match = regex.exec(window.location.href);
|
||||||
|
|
||||||
if (match == null) {
|
var options = {
|
||||||
var options = {
|
series: {
|
||||||
series: {
|
stack: true,
|
||||||
stack: stack,
|
bars:{
|
||||||
shadowSize: 0.1,
|
align: 'center'
|
||||||
color: '#ddd'
|
}
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
borderWidth:1,
|
||||||
|
borderColor: '#C1C1C1',
|
||||||
|
tickColor: '#fff'
|
||||||
},
|
},
|
||||||
grid: {
|
xaxes: [ {
|
||||||
hoverable: true,
|
tickFormatter: xFormatter,
|
||||||
clickable: true,
|
color: '',
|
||||||
borderWidth:1,
|
tickSize: intervaltick,
|
||||||
borderColor: '',
|
tickLength: 0,
|
||||||
tickColor: '#fff'
|
font: {
|
||||||
},
|
size: font_size + 2,
|
||||||
xaxes: [ {
|
family: font+'Font'
|
||||||
tickFormatter: xFormatter,
|
|
||||||
color: '',
|
|
||||||
tickSize: intervaltick,
|
|
||||||
tickLength: 0
|
|
||||||
} ],
|
|
||||||
yaxes: [ {
|
|
||||||
show: false,
|
|
||||||
tickLength: 0
|
|
||||||
}],
|
|
||||||
legend: {
|
|
||||||
show: false
|
|
||||||
}
|
}
|
||||||
};
|
} ],
|
||||||
|
yaxes: [ {
|
||||||
|
show: false,
|
||||||
|
tickLength: 0
|
||||||
|
}],
|
||||||
|
legend: {
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (match == null && not_interactive == 0) {
|
||||||
|
options.grid['hoverable'] = true;
|
||||||
|
options.grid['clickable'] = true;
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
var options = {
|
options.grid['hoverable'] = false;
|
||||||
series: {
|
options.grid['clickable'] = false;
|
||||||
stack: stack,
|
|
||||||
shadowSize: 0.1,
|
|
||||||
color: '#ddd'
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
hoverable: false,
|
|
||||||
clickable: false,
|
|
||||||
borderWidth:1,
|
|
||||||
borderColor: '',
|
|
||||||
tickColor: '#fff'
|
|
||||||
},
|
|
||||||
xaxes: [ {
|
|
||||||
tickFormatter: xFormatter,
|
|
||||||
color: '',
|
|
||||||
tickSize: intervaltick,
|
|
||||||
tickLength: 0
|
|
||||||
} ],
|
|
||||||
yaxes: [ {
|
|
||||||
show: false,
|
|
||||||
tickLength: 0
|
|
||||||
}],
|
|
||||||
legend: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var plot = $.plot($('#'+graph_id), datas, options );
|
$.plot($('#'+graph_id), datas, options );
|
||||||
|
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
// Events
|
// Events
|
||||||
|
@ -849,12 +825,10 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
||||||
|
|
||||||
// Format functions
|
// Format functions
|
||||||
function xFormatter(v, axis) {
|
function xFormatter(v, axis) {
|
||||||
for (i = 0; i < acumulate_data.length; i++) {
|
v = new Date(1000*v);
|
||||||
if (acumulate_data[i] == v) {
|
date_format = (v.getHours()<10?'0':'') + v.getHours() + ":" +
|
||||||
return '<span style=\'font-size: 6pt\'>' + legend[i] + '</span>';
|
(v.getMinutes()<10?'0':'') + v.getMinutes();
|
||||||
}
|
return date_format;
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2262,17 +2236,25 @@ function pandoraFlotArea( graph_id, values, legend,
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#overview_' + graph_id).css('display', 'none');
|
$('#overview_' + graph_id).css('display', 'none');
|
||||||
|
|
||||||
if (menu) {
|
if (menu) {
|
||||||
var parent_height;
|
var parent_height;
|
||||||
$('#menu_overview_' + graph_id).click(function() {
|
$('#menu_overview_' + graph_id).click(function() {
|
||||||
$('#overview_' + graph_id).toggle();
|
$('#overview_' + graph_id).toggle();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#menu_export_csv_"+graph_id)
|
$("#menu_export_csv_"+graph_id).click(function (e) {
|
||||||
.click(function (event) {
|
e.preventDefault();
|
||||||
event.preventDefault();
|
|
||||||
plot.exportDataCSV();
|
plot.exportDataCSV();
|
||||||
|
var es_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||||
|
if(es_firefox){
|
||||||
|
$("#dialog").css('visibility', 'visible').dialog();
|
||||||
|
}
|
||||||
|
delete data_base[0].threshold;
|
||||||
|
plot = $.plot($('#' + graph_id), data_base,
|
||||||
|
$.extend(true, {}, options, {
|
||||||
|
legend: { show: true }
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#menu_threshold_' + graph_id).click(function() {
|
$('#menu_threshold_' + graph_id).click(function() {
|
||||||
|
@ -2508,7 +2490,6 @@ function update_left_width_canvas(graph_id) {
|
||||||
|
|
||||||
function check_adaptions(graph_id) {
|
function check_adaptions(graph_id) {
|
||||||
var classes = $('#'+graph_id).attr('class').split(' ');
|
var classes = $('#'+graph_id).attr('class').split(' ');
|
||||||
|
|
||||||
$.each(classes, function(i,v) {
|
$.each(classes, function(i,v) {
|
||||||
// If has a class starting with adapted, we adapt it
|
// If has a class starting with adapted, we adapt it
|
||||||
if (v.split('_')[0] == 'adapted') {
|
if (v.split('_')[0] == 'adapted') {
|
||||||
|
|
|
@ -371,16 +371,16 @@ function menu_graph(
|
||||||
function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
||||||
$font = '', $font_size = 8, $legend_position = '', $colors = '',
|
$font = '', $font_size = 8, $legend_position = '', $colors = '',
|
||||||
$hide_labels = false) {
|
$hide_labels = false) {
|
||||||
|
|
||||||
// include_javascript_dependencies_flot_graph();
|
// include_javascript_dependencies_flot_graph();
|
||||||
|
|
||||||
$series = sizeof($values);
|
$series = sizeof($values);
|
||||||
if (($series != sizeof ($labels)) || ($series == 0) ) {
|
if (($series != sizeof ($labels)) || ($series == 0) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph_id = uniqid('graph_');
|
$graph_id = uniqid('graph_');
|
||||||
|
|
||||||
switch ($legend_position) {
|
switch ($legend_position) {
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
$height = $height + (count($values) * 24);
|
$height = $height + (count($values) * 24);
|
||||||
|
@ -390,9 +390,9 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
||||||
//TODO FOR TOP OR LEFT OR RIGHT
|
//TODO FOR TOP OR LEFT OR RIGHT
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px;'></div>";
|
$return = "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px;'></div>";
|
||||||
|
|
||||||
if ($water_mark != '') {
|
if ($water_mark != '') {
|
||||||
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
||||||
$water_mark = 'true';
|
$water_mark = 'true';
|
||||||
|
@ -400,28 +400,28 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
||||||
else {
|
else {
|
||||||
$water_mark = 'false';
|
$water_mark = 'false';
|
||||||
}
|
}
|
||||||
|
|
||||||
$separator = ';;::;;';
|
$separator = ';;::;;';
|
||||||
|
|
||||||
$labels = implode($separator, $labels);
|
$labels = implode($separator, $labels);
|
||||||
$values = implode($separator, $values);
|
$values = implode($separator, $values);
|
||||||
if (!empty($colors)) {
|
if (!empty($colors)) {
|
||||||
$colors = implode($separator, $colors);
|
$colors = implode($separator, $colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return .= "<script type='text/javascript'>";
|
$return .= "<script type='text/javascript'>";
|
||||||
|
|
||||||
$return .= "pandoraFlotPie('$graph_id', '$values', '$labels',
|
$return .= "pandoraFlotPie('$graph_id', '$values', '$labels',
|
||||||
'$series', '$width', $font_size, $water_mark, '$separator',
|
'$series', '$width', $font_size, $water_mark, '$separator',
|
||||||
'$legend_position', '$height', '$colors', " . json_encode($hide_labels) . ")";
|
'$legend_position', '$height', '$colors', " . json_encode($hide_labels) . ")";
|
||||||
|
|
||||||
$return .= "</script>";
|
$return .= "</script>";
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints a FLOT pie chart
|
// Prints a FLOT pie chart
|
||||||
function flot_custom_pie_chart ($flash_charts, $graph_values,
|
function flot_custom_pie_chart ($graph_values,
|
||||||
$width, $height, $colors, $module_name_list, $long_index,
|
$width, $height, $colors, $module_name_list, $long_index,
|
||||||
$no_data,$xaxisname, $yaxisname, $water_mark, $fontpath, $font_size,
|
$no_data,$xaxisname, $yaxisname, $water_mark, $fontpath, $font_size,
|
||||||
$unit, $ttl, $homeurl, $background_color, $legend_position) {
|
$unit, $ttl, $homeurl, $background_color, $legend_position) {
|
||||||
|
@ -684,78 +684,107 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array()) {
|
function flot_slicesbar_graph (
|
||||||
|
$graph_data, $period, $width,
|
||||||
|
$height, $legend, $colors, $fontpath,
|
||||||
|
$round_corner, $homeurl, $watermark = '',
|
||||||
|
$adapt_key = '', $stat_win = false,
|
||||||
|
$id_agent = 0, $full_legend_date = array(),
|
||||||
|
$not_interactive = 0, $ttl = 1,
|
||||||
|
$widgets = false) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// include_javascript_dependencies_flot_graph();
|
if($ttl == 2){
|
||||||
|
$params = array(
|
||||||
$stacked_str = 'stack: stack,';
|
'graph_data' => $graph_data,
|
||||||
|
'period' => $period,
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height,
|
||||||
|
'legend' => $legend,
|
||||||
|
'colors' => $colors,
|
||||||
|
'fontpath' => $fontpath,
|
||||||
|
'round_corner' => $round_corner,
|
||||||
|
'homeurl' => $homeurl,
|
||||||
|
'watermark' => $watermark = '',
|
||||||
|
'adapt_key' => $adapt_key = '',
|
||||||
|
'stat_win' => $stat_win = false,
|
||||||
|
'id_agent' => $id_agent = 0,
|
||||||
|
'full_legend_date' => $full_legend_date = array(),
|
||||||
|
'not_interactive' => $not_interactive = 0,
|
||||||
|
'ttl' => $ttl = 1
|
||||||
|
);
|
||||||
|
|
||||||
|
return generator_chart_to_pdf('slicebar', $params);
|
||||||
|
}
|
||||||
|
|
||||||
// Get a unique identifier to graph
|
// Get a unique identifier to graph
|
||||||
$graph_id = uniqid('graph_');
|
$graph_id = uniqid('graph_');
|
||||||
|
|
||||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||||
if ($stat_win) {
|
if ($stat_win) {
|
||||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px; display: inline-block;'></div>";
|
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px; display: inline-block;'></div>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px;'></div>";
|
if($widgets){
|
||||||
|
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px;'></div>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
||||||
|
|
||||||
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
||||||
$separator = ';;::;;';
|
$separator = ';;::;;';
|
||||||
$separator2 = ':,:,,,:,:';
|
$separator2 = ':,:,,,:,:';
|
||||||
|
|
||||||
// Transform data from our format to library format
|
// Transform data from our format to library format
|
||||||
$labels = array();
|
$labels = array();
|
||||||
$a = array();
|
$a = array();
|
||||||
$vars = array();
|
$vars = array();
|
||||||
|
|
||||||
$datacolor = array();
|
$datacolor = array();
|
||||||
|
|
||||||
$max = 0;
|
$max = 0;
|
||||||
|
|
||||||
$i = count($graph_data);
|
$i = count($graph_data);
|
||||||
|
|
||||||
$intervaltick = $period / $i;
|
$intervaltick = $period / $i;
|
||||||
|
|
||||||
$leg_max_length = 0;
|
$fontsize = $config['font_size'];
|
||||||
foreach ($legend as $l) {
|
$fontpath = $config['fontpath'];
|
||||||
if (strlen($l) > $leg_max_length) {
|
|
||||||
$leg_max_length = strlen($l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$fontsize = 7;
|
|
||||||
|
|
||||||
$extra_height = 15;
|
$extra_height = 15;
|
||||||
if (defined("METACONSOLE"))
|
if (defined("METACONSOLE"))
|
||||||
$extra_height = 20;
|
$extra_height = 20;
|
||||||
|
|
||||||
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize."pt; display:none; position:absolute; overflow: auto; height: ".$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize."pt; display:none; position:absolute; overflow: auto; height: ".$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
||||||
|
|
||||||
$maxticks = (int) ($width / ($fontsize * $leg_max_length));
|
$maxticks = (int) 20;
|
||||||
|
|
||||||
$i_aux = $i;
|
$i_aux = $i;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if ($i_aux <= $maxticks ) {
|
if ($i_aux <= $maxticks ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$intervaltick*= 2;
|
$intervaltick*= 2;
|
||||||
|
|
||||||
$i_aux /= 2;
|
$i_aux /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$intervaltick = (int) $intervaltick;
|
$intervaltick = (int) $intervaltick;
|
||||||
|
|
||||||
$acumulate = 0;
|
$acumulate = 0;
|
||||||
$c = 0;
|
$c = 0;
|
||||||
$acumulate_data = array();
|
$acumulate_data = array();
|
||||||
foreach ($graph_data as $label => $values) {
|
foreach ($graph_data as $label => $values) {
|
||||||
$labels[] = $label;
|
$labels[] = $label;
|
||||||
$i--;
|
$i--;
|
||||||
|
|
||||||
foreach ($values as $key => $value) {
|
foreach ($values as $key => $value) {
|
||||||
$jsvar = "d_".$graph_id."_".$i;
|
$jsvar = "d_".$graph_id."_".$i;
|
||||||
if ($key == 'data') {
|
if ($key == 'data') {
|
||||||
|
@ -763,54 +792,57 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$data[$jsvar][] = $value;
|
$data[$jsvar][] = $value;
|
||||||
|
|
||||||
$acumulate_data[$c] = $acumulate;
|
$acumulate_data[$c] = $acumulate;
|
||||||
$acumulate += $value;
|
$acumulate += $value;
|
||||||
$c++;
|
$c++;
|
||||||
|
|
||||||
if ($value > $max) {
|
if ($value > $max) {
|
||||||
$max = $value;
|
$max = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store serialized data to use it from javascript
|
// Store serialized data to use it from javascript
|
||||||
$labels = implode($separator,$labels);
|
$labels = implode($separator,$labels);
|
||||||
$datacolor = implode($separator,$datacolor);
|
$datacolor = implode($separator,$datacolor);
|
||||||
$legend = io_safe_output(implode($separator,$legend));
|
if(is_array($legend)){
|
||||||
if (!empty($full_legend_date)) {
|
$legend = io_safe_output(implode($separator,$legend));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($full_legend_date) && count($full_legend_date) > 0 ) {
|
||||||
$full_legend_date = io_safe_output(implode($separator,$full_legend_date));
|
$full_legend_date = io_safe_output(implode($separator,$full_legend_date));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$full_legend_date = false;
|
$full_legend_date = false;
|
||||||
}
|
}
|
||||||
$acumulate_data = io_safe_output(implode($separator,$acumulate_data));
|
$acumulate_data = io_safe_output(implode($separator,$acumulate_data));
|
||||||
|
|
||||||
// Store data series in javascript format
|
// Store data series in javascript format
|
||||||
$jsvars = '';
|
$jsvars = '';
|
||||||
$jsseries = array();
|
$jsseries = array();
|
||||||
|
|
||||||
$date = get_system_time ();
|
$date = get_system_time ();
|
||||||
$datelimit = ($date - $period) * 1000;
|
$datelimit = ($date - $period) * 1000;
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$values2 = array();
|
$values2 = array();
|
||||||
|
|
||||||
foreach ($data as $jsvar => $values) {
|
foreach ($data as $jsvar => $values) {
|
||||||
$values2[] = implode($separator,$values);
|
$values2[] = implode($separator,$values);
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = implode($separator2, $values2);
|
$values = implode($separator2, $values2);
|
||||||
|
|
||||||
// Javascript code
|
// Javascript code
|
||||||
$return .= "<script type='text/javascript'>";
|
$return .= "<script type='text/javascript'>";
|
||||||
$return .= "//<![CDATA[\n";
|
$return .= "//<![CDATA[\n";
|
||||||
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent, '$full_legend_date')";
|
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive)";
|
||||||
$return .= "\n//]]>";
|
$return .= "\n//]]>";
|
||||||
$return .= "</script>";
|
$return .= "</script>";
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,966 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
ob_start(); //HACK TO EAT ANYTHING THAT CORRUPS THE IMAGE FILE
|
|
||||||
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
include_once('functions_utils.php');
|
|
||||||
include_once('../functions_io.php');
|
|
||||||
include_once('../functions.php');
|
|
||||||
include_once('../functions_html.php');
|
|
||||||
|
|
||||||
/* pChart library inclusions */
|
|
||||||
include_once("pChart/pData.class.php");
|
|
||||||
include_once("pChart/pDraw.class.php");
|
|
||||||
include_once("pChart/pImage.class.php");
|
|
||||||
include_once("pChart/pPie.class.php");
|
|
||||||
include_once("pChart/pScatter.class.php");
|
|
||||||
include_once("pChart/pRadar.class.php");
|
|
||||||
|
|
||||||
// Define default fine colors
|
|
||||||
|
|
||||||
$default_fine_colors = array();
|
|
||||||
$default_fine_colors[] = "#2222FF";
|
|
||||||
$default_fine_colors[] = "#00DD00";
|
|
||||||
$default_fine_colors[] = "#CC0033";
|
|
||||||
$default_fine_colors[] = "#9900CC";
|
|
||||||
$default_fine_colors[] = "#FFCC66";
|
|
||||||
$default_fine_colors[] = "#999999";
|
|
||||||
|
|
||||||
// Default values
|
|
||||||
|
|
||||||
$antialiasing = true;
|
|
||||||
$font = '../fonts/unicode.ttf';
|
|
||||||
$xaxisname = '';
|
|
||||||
$yaxisname = '';
|
|
||||||
$legend = null;
|
|
||||||
$colors = null;
|
|
||||||
$font_size = 8;
|
|
||||||
$force_steps = true;
|
|
||||||
$legend_position = null;
|
|
||||||
$series_type = null;
|
|
||||||
|
|
||||||
|
|
||||||
$graph_type = get_parameter('graph_type', '');
|
|
||||||
|
|
||||||
$id_graph = get_parameter('id_graph', false);
|
|
||||||
|
|
||||||
$graph_threshold = get_parameter('graph_threshold', false);
|
|
||||||
|
|
||||||
$id_module = get_parameter('id_module');
|
|
||||||
|
|
||||||
|
|
||||||
if (!$id_graph) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ttl = get_parameter('ttl', 1);
|
|
||||||
|
|
||||||
$graph = unserialize_in_temp($id_graph, true, $ttl);
|
|
||||||
|
|
||||||
if (!$graph) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = $graph['data'];
|
|
||||||
$width = $graph['width'];
|
|
||||||
$height = $graph['height'];
|
|
||||||
|
|
||||||
if (isset($graph['legend_position'])) {
|
|
||||||
$legend_position = $graph['legend_position'];
|
|
||||||
}
|
|
||||||
if (isset($graph['color'])) {
|
|
||||||
$colors = $graph['color'];
|
|
||||||
}
|
|
||||||
if (isset($graph['legend'])) {
|
|
||||||
$legend = $graph['legend'];
|
|
||||||
}
|
|
||||||
if (isset($graph['xaxisname'])) {
|
|
||||||
$xaxisname = $graph['xaxisname'];
|
|
||||||
}
|
|
||||||
if (isset($graph['yaxisname'])) {
|
|
||||||
$yaxisname = $graph['yaxisname'];
|
|
||||||
}
|
|
||||||
if (isset($graph['round_corner'])) {
|
|
||||||
$round_corner = $graph['round_corner'];
|
|
||||||
}
|
|
||||||
if (isset($graph['font'])) {
|
|
||||||
if (!empty($graph['font'])) {
|
|
||||||
$font = $graph['font'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($graph['font_size'])) {
|
|
||||||
if (!empty($graph['font_size'])) {
|
|
||||||
$font_size = $graph['font_size'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($graph['backgroundColor'])) {
|
|
||||||
if (!empty($graph['backgroundColor'])) {
|
|
||||||
$backgroundColor = $graph['backgroundColor'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($graph['antialiasing'])) {
|
|
||||||
$antialiasing = $graph['antialiasing'];
|
|
||||||
}
|
|
||||||
$force_height = true;
|
|
||||||
if (isset($graph['force_height'])) {
|
|
||||||
$force_height = $graph['force_height'];
|
|
||||||
}
|
|
||||||
if (isset($graph['period'])) {
|
|
||||||
$period = $graph['period'];
|
|
||||||
}
|
|
||||||
if (isset($graph['unit'])){
|
|
||||||
$unit = $graph['unit'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$force_height) {
|
|
||||||
if ($height < (count($graph['data']) * 14)) {
|
|
||||||
$height = (count($graph['data']) * 14);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$water_mark = '';
|
|
||||||
if (isset($graph['water_mark'])) {
|
|
||||||
//"/var/www/pandora_console/images/logo_vertical_water.png";
|
|
||||||
$water_mark = $graph['water_mark'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($graph['force_steps'])) {
|
|
||||||
$force_steps = $graph['force_steps'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($graph['series_type'])) {
|
|
||||||
$series_type = $graph['series_type'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($graph['percentil'])){
|
|
||||||
$percentil = $graph['percentil'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$step = 1;
|
|
||||||
if ($force_steps) {
|
|
||||||
$pixels_between_xdata = 50;
|
|
||||||
$max_xdata_display = round($width / $pixels_between_xdata);
|
|
||||||
$ndata = count($data);
|
|
||||||
if ($max_xdata_display > $ndata) {
|
|
||||||
$xdata_display = $ndata;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$xdata_display = $max_xdata_display;
|
|
||||||
}
|
|
||||||
|
|
||||||
$step = round($ndata/$xdata_display);
|
|
||||||
}
|
|
||||||
|
|
||||||
$c = 1;
|
|
||||||
|
|
||||||
switch ($graph_type) {
|
|
||||||
case 'hbar':
|
|
||||||
case 'vbar':
|
|
||||||
foreach ($data as $i => $values) {
|
|
||||||
foreach ($values as $name => $val) {
|
|
||||||
$data_values[$name][] = $val;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data_keys[] = $i;
|
|
||||||
|
|
||||||
}
|
|
||||||
$fine_colors = array();
|
|
||||||
|
|
||||||
// If is set fine colors we store it or set default
|
|
||||||
|
|
||||||
foreach ($colors as $i => $fine_color) {
|
|
||||||
$rgb_fine = html_html2rgb($fine_color);
|
|
||||||
$fine_colors[$i]['R'] = $rgb_fine[0];
|
|
||||||
$fine_colors[$i]['G'] = $rgb_fine[1];
|
|
||||||
$fine_colors[$i]['B'] = $rgb_fine[2];
|
|
||||||
$fine_colors[$i]['Alpha'] = 100;
|
|
||||||
}
|
|
||||||
$colors = $fine_colors;
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 'bullet_chart':
|
|
||||||
$anterior = 0;
|
|
||||||
foreach ($data as $i => $values) {
|
|
||||||
foreach ($values as $key => $val) {
|
|
||||||
switch ($key) {
|
|
||||||
case 0:
|
|
||||||
$name = __("Max");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
$name = __("Actual");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$name = __("Min");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$data_values[$name][] = ($val - $anterior);
|
|
||||||
$anterior += (($val - $anterior)<0) ? 0 : ($val - $anterior);
|
|
||||||
}
|
|
||||||
$anterior = 0;
|
|
||||||
$data_keys[] = $i;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'progress':
|
|
||||||
case 'area':
|
|
||||||
case 'stacked_area':
|
|
||||||
case 'stacked_line':
|
|
||||||
case 'line':
|
|
||||||
case 'threshold':
|
|
||||||
case 'scatter':
|
|
||||||
|
|
||||||
if (!empty($percentil)) {
|
|
||||||
$count_percentil = count($percentil);
|
|
||||||
for ($j=0; $j < $count_percentil; $j++) {
|
|
||||||
$i=0;
|
|
||||||
foreach ($data as $key => $value) {
|
|
||||||
$data[$key]['percentil' . $j] = $percentil[$j][$i];
|
|
||||||
if($graph_type == 'area'){
|
|
||||||
$series_type['percentil' . $j] = 'line';
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach ($data as $i => $d) {
|
|
||||||
$data_values[] = $d;
|
|
||||||
|
|
||||||
if (($c % $step) == 0) {
|
|
||||||
$data_keys[] = $i;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data_keys[] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 'slicebar':
|
|
||||||
case 'polar':
|
|
||||||
case 'radar':
|
|
||||||
case 'pie3d':
|
|
||||||
case 'pie2d':
|
|
||||||
case 'ring3d':
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch($graph_type) {
|
|
||||||
case 'slicebar':
|
|
||||||
case 'polar':
|
|
||||||
case 'radar':
|
|
||||||
case 'pie3d':
|
|
||||||
case 'pie2d':
|
|
||||||
case 'ring3d':
|
|
||||||
case 'bullet_chart':
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!is_array(reset($data_values))) {
|
|
||||||
$data_values = array($data_values);
|
|
||||||
if (is_array($colors) && !empty($colors)) {
|
|
||||||
$colors = array($colors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$rgb_color = array();
|
|
||||||
|
|
||||||
if (!isset($colors))
|
|
||||||
$colors = array();
|
|
||||||
|
|
||||||
if (empty($colors)) {
|
|
||||||
$colors = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($colors as $i => $color) {
|
|
||||||
if (isset ($color['border'])) {
|
|
||||||
$rgb['border'] = html_html2rgb($color['border']);
|
|
||||||
|
|
||||||
if (isset($rgb['border'])) {
|
|
||||||
$rgb_color[$i]['border']['R'] = $rgb['border'][0];
|
|
||||||
$rgb_color[$i]['border']['G'] = $rgb['border'][1];
|
|
||||||
$rgb_color[$i]['border']['B'] = $rgb['border'][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset ($color['color'])) {
|
|
||||||
$rgb['color'] = html_html2rgb($color['color']);
|
|
||||||
|
|
||||||
if (isset($rgb['color'])) {
|
|
||||||
$rgb_color[$i]['color']['R'] = $rgb['color'][0];
|
|
||||||
$rgb_color[$i]['color']['G'] = $rgb['color'][1];
|
|
||||||
$rgb_color[$i]['color']['B'] = $rgb['color'][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset ($color['alpha'])) {
|
|
||||||
$rgb_color[$i]['alpha'] = $color['alpha'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//add color for percentil
|
|
||||||
if($percentil){
|
|
||||||
for ($j=0; $j < $count_percentil; $j++) {
|
|
||||||
if (isset ($colors[$j]['border'])) {
|
|
||||||
$rgb['border'] = html_html2rgb($colors[$j]['border']);
|
|
||||||
|
|
||||||
if (isset($rgb['border'])) {
|
|
||||||
$rgb_color['percentil' . $j]['border']['R'] = $rgb['border'][0];
|
|
||||||
$rgb_color['percentil' . $j]['border']['G'] = $rgb['border'][1];
|
|
||||||
$rgb_color['percentil' . $j]['border']['B'] = $rgb['border'][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset ($colors[$j]['color'])) {
|
|
||||||
$rgb['color'] = html_html2rgb($colors[$j]['color']);
|
|
||||||
|
|
||||||
if (isset($rgb['color'])) {
|
|
||||||
$rgb_color['percentil' . $j]['color']['R'] = $rgb['color'][0];
|
|
||||||
$rgb_color['percentil' . $j]['color']['G'] = $rgb['color'][1];
|
|
||||||
$rgb_color['percentil' . $j]['color']['B'] = $rgb['color'][2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset ($colors[$j]['alpha'])) {
|
|
||||||
$rgb_color['percentil' . $j]['alpha'] = $colors[$j]['alpha'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//add for report with max 15 modules comparation repeat
|
|
||||||
$countlegend = count($legend);
|
|
||||||
if($countlegend > 15){
|
|
||||||
$i=16;
|
|
||||||
$l=0;
|
|
||||||
while ($countlegend > 15){
|
|
||||||
$rgb_color[$i] = $rgb_color[$l];
|
|
||||||
$l++;
|
|
||||||
$i++;
|
|
||||||
$countlegend--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ob_get_clean(); //HACK TO EAT ANYTHING THAT CORRUPS THE IMAGE FILE
|
|
||||||
|
|
||||||
switch ($graph_type) {
|
|
||||||
case 'ring3d':
|
|
||||||
pch_ring_graph($graph_type, array_values($data), $legend,
|
|
||||||
$width, $height, $font, $water_mark, $font_size, $legend_position, $colors);
|
|
||||||
break;
|
|
||||||
case 'bullet_chart':
|
|
||||||
pch_bullet_chart($graph_type, $data_values, $legend,
|
|
||||||
$width, $height, $font, $water_mark, $font_size, $legend_position, $colors);
|
|
||||||
break;
|
|
||||||
case 'pie3d':
|
|
||||||
case 'pie2d':
|
|
||||||
pch_pie_graph($graph_type, array_values($data), array_keys($data),
|
|
||||||
$width, $height, $font, $water_mark, $font_size, $legend_position, $colors);
|
|
||||||
break;
|
|
||||||
case 'slicebar':
|
|
||||||
pch_slicebar_graph($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size);
|
|
||||||
break;
|
|
||||||
case 'polar':
|
|
||||||
case 'radar':
|
|
||||||
pch_kiviat_graph($graph_type, array_values($data), array_keys($data),
|
|
||||||
$width, $height, $font, $font_size);
|
|
||||||
break;
|
|
||||||
case 'hbar':
|
|
||||||
case 'vbar':
|
|
||||||
pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height,
|
|
||||||
$font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false,
|
|
||||||
$legend, $fine_colors, $water_mark, $font_size);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case 'threshold':
|
|
||||||
pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
|
|
||||||
$height, $font, $antialiasing, $xaxisname, $yaxisname, $title,
|
|
||||||
$font_size);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size) {
|
|
||||||
/* CAT:Slicebar charts */
|
|
||||||
|
|
||||||
set_time_limit (0);
|
|
||||||
|
|
||||||
// Dataset definition
|
|
||||||
$myPicture = new pImage($width,$height);
|
|
||||||
|
|
||||||
/* Turn of Antialiasing */
|
|
||||||
$myPicture->Antialias = 0;
|
|
||||||
|
|
||||||
$myPicture->setFontProperties(array("FontName"=> $font, "FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
|
|
||||||
|
|
||||||
// Round corners defined in global setup
|
|
||||||
if ($round_corner != 0)
|
|
||||||
$radius = ($height > 18) ? 8 : 0;
|
|
||||||
else
|
|
||||||
$radius = 0;
|
|
||||||
|
|
||||||
$thinest_slice = $width / $period;
|
|
||||||
|
|
||||||
/* Color stuff */
|
|
||||||
$colorsrgb = array();
|
|
||||||
foreach($colors as $key => $col) {
|
|
||||||
$rgb = html_html2rgb($col);
|
|
||||||
$colorsrgb[$key]['R'] = $rgb[0];
|
|
||||||
$colorsrgb[$key]['G'] = $rgb[1];
|
|
||||||
$colorsrgb[$key]['B'] = $rgb[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
foreach ($data as $d) {
|
|
||||||
$color = $d['data'];
|
|
||||||
$color = $colorsrgb[$color];
|
|
||||||
$ratio = $thinest_slice * $d['utimestamp'];
|
|
||||||
$myPicture->drawRoundedFilledRectangle ($i, 0, $ratio+$i,
|
|
||||||
$height, $radius,
|
|
||||||
array('R' => $color['R'],
|
|
||||||
'G' => $color['G'],
|
|
||||||
'B' => $color['B'])
|
|
||||||
);
|
|
||||||
$i+=$ratio;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($round_corner) {
|
|
||||||
/* Under this value, the rounded rectangle is painted great */
|
|
||||||
if ($thinest_slice <= 16) {
|
|
||||||
/* Clean a bit of pixels */
|
|
||||||
for ($i = 0; $i < 7; $i++) {
|
|
||||||
$myPicture->drawLine (0, $i, 6 - $i, $i, array('R' => 255, 'G' => 255, 'B' => 255));
|
|
||||||
}
|
|
||||||
$end = $height - 1;
|
|
||||||
for ($i = 0; $i < 7; $i++) {
|
|
||||||
$myPicture->drawLine (0, $end - $i, 5 - $i, $end - $i, array('R' => 255, 'G' => 255, 'B' => 255));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$myPicture->drawRoundedRectangle (0, 0, $width,
|
|
||||||
$height - 1, $radius, array('R' => 157, 'G' => 157, 'B' => 157));
|
|
||||||
|
|
||||||
$myPicture->Stroke ();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
|
|
||||||
$height, $font, $water_mark, $font_size, $legend_position, $colors) {
|
|
||||||
/* CAT:Pie charts */
|
|
||||||
|
|
||||||
/* Create and populate the pData object */
|
|
||||||
$MyData = new pData();
|
|
||||||
$MyData->addPoints($data_values,"ScoreA");
|
|
||||||
$MyData->setSerieDescription("ScoreA","Application A");
|
|
||||||
|
|
||||||
/* Define the absissa serie */
|
|
||||||
$MyData->addPoints($legend_values,"Labels");
|
|
||||||
$MyData->setAbscissa("Labels");
|
|
||||||
|
|
||||||
/* Create the pChart object */
|
|
||||||
$myPicture = new pImage($width,$height,$MyData,TRUE);
|
|
||||||
|
|
||||||
/* Set the default font properties */
|
|
||||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
|
|
||||||
|
|
||||||
$water_mark_height = 0;
|
|
||||||
$water_mark_width = 0;
|
|
||||||
if (!empty($water_mark)) {
|
|
||||||
if (is_array($water_mark)) {
|
|
||||||
if (!empty($water_mark['file'])) {
|
|
||||||
$water_mark = $water_mark['file'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$size_water_mark = getimagesize($water_mark);
|
|
||||||
$water_mark_height = $size_water_mark[1];
|
|
||||||
$water_mark_width = $size_water_mark[0];
|
|
||||||
|
|
||||||
$myPicture->drawFromPNG(($width - $water_mark_width),
|
|
||||||
($height - $water_mark_height) - 50, $water_mark);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Create the pPie object */
|
|
||||||
$PieChart = new pPie($myPicture,$MyData);
|
|
||||||
foreach ($legend_values as $key => $value) {
|
|
||||||
if (isset($colors[$value])) {
|
|
||||||
$PieChart->setSliceColor($key, hex_2_rgb($colors[$value]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Draw an AA pie chart */
|
|
||||||
switch($graph_type) {
|
|
||||||
case "pie2d":
|
|
||||||
$PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
|
|
||||||
break;
|
|
||||||
case "pie3d":
|
|
||||||
$PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>5,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE, "SecondPass"=>FALSE));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write down the legend next to the 2nd chart*/
|
|
||||||
//Calculate the bottom margin from the size of string in each index
|
|
||||||
$max_chars = graph_get_max_index($legend_values);
|
|
||||||
|
|
||||||
if ($legend_position != 'hidden') {
|
|
||||||
// This is a hardcore adjustment to match most of the graphs, please don't alter
|
|
||||||
$legend_with_aprox = 32 + (9.5 * $max_chars);
|
|
||||||
|
|
||||||
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enable shadow computing */
|
|
||||||
$myPicture->setShadow(TRUE,
|
|
||||||
array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
|
|
||||||
|
|
||||||
/* Render the picture */
|
|
||||||
$myPicture->stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pch_ring_graph ($graph_type, $data_values, $legend_values, $width,
|
|
||||||
$height, $font, $water_mark, $font_size, $legend_position, $colors) {
|
|
||||||
/* CAT:Ring charts */
|
|
||||||
|
|
||||||
/* Create and populate the pData object */
|
|
||||||
$MyData = new pData();
|
|
||||||
$MyData->addPoints($data_values,"ScoreA");
|
|
||||||
$MyData->setSerieDescription("ScoreA","Application A");
|
|
||||||
|
|
||||||
/* Define the absissa serie */
|
|
||||||
$MyData->addPoints($legend_values,"Labels");
|
|
||||||
$MyData->setAbscissa("Labels");
|
|
||||||
|
|
||||||
/* Create the pChart object */
|
|
||||||
$myPicture = new pImage($width,$height,$MyData,TRUE);
|
|
||||||
|
|
||||||
/* Set the default font properties */
|
|
||||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
|
|
||||||
|
|
||||||
$water_mark_height = 0;
|
|
||||||
$water_mark_width = 0;
|
|
||||||
if (!empty($water_mark)) {
|
|
||||||
if (is_array($water_mark)) {
|
|
||||||
if (!empty($water_mark['file'])) {
|
|
||||||
$water_mark = $water_mark['file'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$size_water_mark = getimagesize($water_mark);
|
|
||||||
$water_mark_height = $size_water_mark[1];
|
|
||||||
$water_mark_width = $size_water_mark[0];
|
|
||||||
|
|
||||||
$myPicture->drawFromPNG(($width - $water_mark_width),
|
|
||||||
($height - $water_mark_height) - 50, $water_mark);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Create the pPie object */
|
|
||||||
$PieChart = new pPie($myPicture,$MyData);
|
|
||||||
foreach ($legend_values as $key => $value) {
|
|
||||||
if (isset($colors[$value])) {
|
|
||||||
$PieChart->setSliceColor($key, hex_2_rgb($colors[$value]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Draw an AA pie chart */
|
|
||||||
$PieChart->draw3DRing($width/3, $height/2,array("InnerRadius"=>100, "InnerRadius"=>10,"DrawLabels"=>TRUE,"LabelStacked"=>FALSE,"Precision"=>2,"Border"=>FALSE,"WriteValues"=>TRUE,"ValueR"=>0,"ValueG"=>0,"ValueB"=>0,"ValuePadding" => 15));
|
|
||||||
|
|
||||||
|
|
||||||
/* Write down the legend next to the 2nd chart*/
|
|
||||||
//Calculate the bottom margin from the size of string in each index
|
|
||||||
$max_chars = graph_get_max_index($legend_values);
|
|
||||||
|
|
||||||
if ($legend_position != 'hidden') {
|
|
||||||
// This is a hardcore adjustment to match most of the graphs, please don't alter
|
|
||||||
$legend_with_aprox = 150 + (4.5 * $max_chars);
|
|
||||||
|
|
||||||
$PieChart->drawPieLegend($width - $legend_with_aprox, 10, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enable shadow computing */
|
|
||||||
$myPicture->setShadow(TRUE,
|
|
||||||
array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
|
|
||||||
|
|
||||||
/* Render the picture */
|
|
||||||
$myPicture->stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width,
|
|
||||||
$height, $font, $font_size) {
|
|
||||||
/* CAT:Radar/Polar charts */
|
|
||||||
|
|
||||||
/* Create and populate the pData object */
|
|
||||||
$MyData = new pData();
|
|
||||||
$MyData->addPoints($data_values,"ScoreA");
|
|
||||||
$MyData->setSerieDescription("ScoreA","Application A");
|
|
||||||
|
|
||||||
/* Define the absissa serie */
|
|
||||||
$MyData->addPoints($legend_values,"Labels");
|
|
||||||
$MyData->setAbscissa("Labels");
|
|
||||||
|
|
||||||
/* Create the pChart object */
|
|
||||||
$myPicture = new pImage($width,$height,$MyData,TRUE);
|
|
||||||
|
|
||||||
/* Set the default font properties */
|
|
||||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
|
|
||||||
|
|
||||||
/* Create the pRadar object */
|
|
||||||
$SplitChart = new pRadar();
|
|
||||||
|
|
||||||
/* Draw a radar chart */
|
|
||||||
$myPicture->setGraphArea(20,25,$width-10,$height-10);
|
|
||||||
|
|
||||||
/* Draw an AA pie chart */
|
|
||||||
switch($graph_type) {
|
|
||||||
case "radar":
|
|
||||||
$Options = array("SkipLabels"=>0,"LabelPos"=>RADAR_LABELS_HORIZONTAL,
|
|
||||||
"LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR,
|
|
||||||
"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,
|
|
||||||
"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
|
|
||||||
"FontName"=>$font,"FontSize"=>$font_size);
|
|
||||||
$SplitChart->drawRadar($myPicture,$MyData,$Options);
|
|
||||||
break;
|
|
||||||
case "polar":
|
|
||||||
$Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
|
|
||||||
"FontName"=>$font,"FontSize"=>$font_size);
|
|
||||||
$SplitChart->drawRadar($myPicture,$MyData,$Options);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Render the picture */
|
|
||||||
$myPicture->stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
|
|
||||||
$antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "",
|
|
||||||
$show_values = false, $legend = array(), $fine_colors = array(), $water_mark = '', $font_size) {
|
|
||||||
/* CAT: Vertical Bar Chart */
|
|
||||||
if (!is_array($legend) || empty($legend)) {
|
|
||||||
unset($legend);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create and populate the pData object */
|
|
||||||
$MyData = new pData();
|
|
||||||
$overridePalette = array();
|
|
||||||
foreach ($data as $i => $values) {
|
|
||||||
$MyData->addPoints($values,$i);
|
|
||||||
|
|
||||||
if (!empty($rgb_color)) {
|
|
||||||
$MyData->setPalette($i,
|
|
||||||
array("R" => $rgb_color[$i]['color']["R"],
|
|
||||||
"G" => $rgb_color[$i]['color']["G"],
|
|
||||||
"B" => $rgb_color[$i]['color']["B"],
|
|
||||||
"BorderR" => $rgb_color[$i]['border']["R"],
|
|
||||||
"BorderG" => $rgb_color[$i]['border']["G"],
|
|
||||||
"BorderB" => $rgb_color[$i]['border']["B"],
|
|
||||||
"Alpha" => $rgb_color[$i]['alpha']));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign cyclic colors to bars if are setted
|
|
||||||
if ($fine_colors) {
|
|
||||||
$c = 0;
|
|
||||||
foreach ($values as $ii => $vv) {
|
|
||||||
if (!isset($fine_colors[$c])) {
|
|
||||||
$c = 0;
|
|
||||||
}
|
|
||||||
$overridePalette[$ii] = $fine_colors[$c];
|
|
||||||
$c++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$overridePalette = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$MyData->setAxisName(0,$yaxisname);
|
|
||||||
$MyData->addPoints($index,"Xaxis");
|
|
||||||
$MyData->setSerieDescription("Xaxis", $xaxisname);
|
|
||||||
$MyData->setAbscissa("Xaxis");
|
|
||||||
|
|
||||||
|
|
||||||
/* Create the pChart object */
|
|
||||||
$myPicture = new pImage($width,$height,$MyData);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Turn of Antialiasing */
|
|
||||||
$myPicture->Antialias = $antialiasing;
|
|
||||||
|
|
||||||
/* Add a border to the picture */
|
|
||||||
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
|
|
||||||
|
|
||||||
/* Turn on shadow computing */
|
|
||||||
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>120,"G"=>120,"B"=>120,"Alpha"=>10));
|
|
||||||
|
|
||||||
$pdf = get_parameter('pdf',false);
|
|
||||||
|
|
||||||
if($pdf == true){
|
|
||||||
$font_size = $font_size+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Set the default font */
|
|
||||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
|
||||||
|
|
||||||
/* Draw the scale */
|
|
||||||
// TODO: AvoidTickWhenEmpty = FALSE When the distance between two ticks will be less than 50 px
|
|
||||||
// TODO: AvoidTickWhenEmpty = TRUE When the distance between two ticks will be greater than 50 px
|
|
||||||
|
|
||||||
//Calculate the top margin from the size of string in each index
|
|
||||||
$max_chars = graph_get_max_index($index);
|
|
||||||
$margin_top = 10 * $max_chars;
|
|
||||||
|
|
||||||
switch($graph_type) {
|
|
||||||
case "vbar":
|
|
||||||
$scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE,
|
|
||||||
"GridR"=>1000,"GridG"=>1000,"GridB"=>1000,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,
|
|
||||||
"Mode"=>SCALE_MODE_START0, "LabelRotation" => 45);
|
|
||||||
$margin_left = 40+50;
|
|
||||||
$margin_right = 90;
|
|
||||||
$margin_top = 10;
|
|
||||||
$margin_bottom = (3 * $max_chars)+80;
|
|
||||||
break;
|
|
||||||
case "hbar":
|
|
||||||
$scaleSettings = array("GridR"=>1000,"GridG"=>1000,"GridB"=>1000,"DrawSubTicks"=>TRUE,
|
|
||||||
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM,
|
|
||||||
"LabelValuesRotation" => 30);
|
|
||||||
$margin_left = $font_size * $max_chars;
|
|
||||||
$margin_right = 15;
|
|
||||||
$margin_top = 40;
|
|
||||||
$margin_bottom = 10;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Define the chart area */
|
|
||||||
$myPicture->setGraphArea($margin_left, $margin_top, $width - $margin_right, $height - $margin_bottom);
|
|
||||||
|
|
||||||
$myPicture->drawScale($scaleSettings);
|
|
||||||
|
|
||||||
/* Turn on shadow computing */
|
|
||||||
$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
|
||||||
|
|
||||||
|
|
||||||
/* Draw the chart */
|
|
||||||
$settings = array("ForceTransparency"=>"-1", "Gradient"=>FALSE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette);
|
|
||||||
|
|
||||||
/* goes through a series of colors and assigns them to the bars, when it ends it starts from the beginning */
|
|
||||||
|
|
||||||
for ($i=0,$j=1; $i < count($settings['OverrideColors']); $i++) {
|
|
||||||
|
|
||||||
switch ($j) {
|
|
||||||
case 1:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 43;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 98;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 201;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 243;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 86;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 157;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 191;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 191;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 191;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 251;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 183;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 50;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 157;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 117;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 177;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 39;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 172;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 151;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 171;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 42;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 46;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 185;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 218;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 87;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 60;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 182;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 203;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 105;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 65;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 179;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 11:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 228;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 35;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 102;
|
|
||||||
$j++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 12:
|
|
||||||
$settings['OverrideColors'][$i]['R'] = 252;
|
|
||||||
$settings['OverrideColors'][$i]['G'] = 130;
|
|
||||||
$settings['OverrideColors'][$i]['B'] = 53;
|
|
||||||
$j = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$myPicture->drawBarChart($settings);
|
|
||||||
|
|
||||||
// Paint the water mark at the last moment to show it in front
|
|
||||||
if (!empty($water_mark)) {
|
|
||||||
$size_water_mark = getimagesize($water_mark);
|
|
||||||
$water_mark_width = $size_water_mark[0];
|
|
||||||
|
|
||||||
$myPicture->drawFromPNG(($width - $water_mark_width - $margin_right),
|
|
||||||
$margin_top, $water_mark);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Render the picture */
|
|
||||||
$myPicture->stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font,
|
|
||||||
$antialiasing, $xaxisname = "", $yaxisname = "", $title = "",
|
|
||||||
$show_values = false, $show_legend = false, $font_size) {
|
|
||||||
/* CAT:Threshold Chart */
|
|
||||||
|
|
||||||
/* Create and populate the pData object */
|
|
||||||
$MyData = new pData();
|
|
||||||
$MyData->addPoints($data,"DEFCA");
|
|
||||||
$MyData->setAxisName(0,$yaxisname);
|
|
||||||
$MyData->setAxisDisplay(0,AXIS_FORMAT_CURRENCY);
|
|
||||||
$MyData->addPoints($index,"Labels");
|
|
||||||
$MyData->setSerieDescription("Labels",$xaxisname);
|
|
||||||
$MyData->setAbscissa("Labels");
|
|
||||||
$MyData->setPalette("DEFCA",array("R"=>55,"G"=>91,"B"=>127));
|
|
||||||
|
|
||||||
/* Create the pChart object */
|
|
||||||
$myPicture = new pImage(700,230,$MyData);
|
|
||||||
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>220,"StartG"=>220,"StartB"=>220,"EndR"=>255,"EndG"=>255,"EndB"=>255,"Alpha"=>100));
|
|
||||||
$myPicture->drawRectangle(0,0,699,229,array("R"=>200,"G"=>200,"B"=>200));
|
|
||||||
|
|
||||||
/* Write the picture title */
|
|
||||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
|
||||||
$myPicture->drawText(60,35,$title,array("FontSize"=>$font_size,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
|
|
||||||
|
|
||||||
/* Do some cosmetic and draw the chart */
|
|
||||||
$myPicture->setGraphArea(60,40,670,190);
|
|
||||||
$myPicture->drawFilledRectangle(60,40,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
|
|
||||||
$myPicture->drawScale(array("GridR"=>180,"GridG"=>180,"GridB"=>180, "Mode" => SCALE_MODE_START0));
|
|
||||||
$myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
|
||||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
|
||||||
$settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
|
|
||||||
$myPicture->drawSplineChart($settings);
|
|
||||||
$myPicture->setShadow(FALSE);
|
|
||||||
|
|
||||||
if ($show_legend) {
|
|
||||||
/* Write the chart legend */
|
|
||||||
$myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Render the picture */
|
|
||||||
$myPicture->stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pch_bullet_chart($graph_type, $data, $legend,
|
|
||||||
$width, $height, $font, $water_mark, $font_size, $legend_position, $colors) {
|
|
||||||
|
|
||||||
|
|
||||||
/* Create and populate the pData object */
|
|
||||||
$MyData = new pData();
|
|
||||||
|
|
||||||
foreach ($data as $key => $dat) {
|
|
||||||
$MyData->addPoints($dat, $key);
|
|
||||||
}
|
|
||||||
$MyData->setPalette(__("Min"),array("R"=>55,"G"=>91,"B"=>127));
|
|
||||||
$MyData->setPalette(__("Actual"),array("R"=>70,"G"=>130,"B"=>180));
|
|
||||||
$MyData->setPalette(__("Max"),array("R"=>221,"G"=>221,"B"=>221));
|
|
||||||
|
|
||||||
$MyData->addPoints($legend,"Labels");
|
|
||||||
|
|
||||||
|
|
||||||
$MyData->setAbscissa("Labels");
|
|
||||||
$MyData->setSerieDescription("Labels", __("Agents/Modules"));
|
|
||||||
|
|
||||||
$height_t = ($height * count($data) ) + 40;
|
|
||||||
$height_t = $height;
|
|
||||||
$max_chars = graph_get_max_index($legend);
|
|
||||||
$width_t = ($width + ( 100 + $max_chars));
|
|
||||||
|
|
||||||
/* Create the pChart object */
|
|
||||||
$myPicture = new pImage($width_t, $height_t,$MyData);
|
|
||||||
|
|
||||||
/* Write the picture title */
|
|
||||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
|
||||||
|
|
||||||
/* Write the chart title */
|
|
||||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
|
||||||
|
|
||||||
$height_t - 10;
|
|
||||||
/* Draw the scale and chart */
|
|
||||||
$myPicture->setGraphArea(250,20,($width + 100), $height_t);
|
|
||||||
$myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM, "Mode"=>SCALE_MODE_ADDALL_START0,
|
|
||||||
"LabelingMethod"=>LABELING_DIFFERENT, "GridR"=>255, "GridG"=>255,
|
|
||||||
"GridB"=>255, "GridAlpha"=>50, "TickR"=>0,"TickG"=>0, "TickB"=>0,
|
|
||||||
"TickAlpha"=>50, "LabelRotation"=>0, "CycleBackground"=>1,
|
|
||||||
"DrawXLines"=>1, "DrawSubTicks"=>1, "SubTickR"=>255,
|
|
||||||
"SubTickG"=>0, "SubTickB"=>0, "SubTickAlpha"=>50,
|
|
||||||
"DrawYLines"=>ALL));
|
|
||||||
$myPicture->drawStackedBarChart(array("MODE"=>SCALE_MODE_START0));
|
|
||||||
|
|
||||||
/* Write the chart legend */
|
|
||||||
//$myPicture->drawLegend(0,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
|
|
||||||
|
|
||||||
/* Render the picture */
|
|
||||||
$myPicture->stroke();
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -1,107 +0,0 @@
|
||||||
0;32;11011001100
|
|
||||||
1;33;11001101100
|
|
||||||
2;34;11001100110
|
|
||||||
3;35;10010011000
|
|
||||||
4;36;10010001100
|
|
||||||
5;37;10001001100
|
|
||||||
6;38;10011001000
|
|
||||||
7;39;10011000100
|
|
||||||
8;40;10001100100
|
|
||||||
9;41;11001001000
|
|
||||||
10;42;11001000100
|
|
||||||
11;43;11000100100
|
|
||||||
12;44;10110011100
|
|
||||||
13;45;10011011100
|
|
||||||
14;46;10011001110
|
|
||||||
15;47;10111001100
|
|
||||||
16;48;10011101100
|
|
||||||
17;49;10011100110
|
|
||||||
18;50;11001110010
|
|
||||||
19;51;11001011100
|
|
||||||
20;52;11001001110
|
|
||||||
21;53;11011100100
|
|
||||||
22;54;11001110100
|
|
||||||
23;55;11101101110
|
|
||||||
24;56;11101001100
|
|
||||||
25;57;11100101100
|
|
||||||
26;58;11100100110
|
|
||||||
27;59;11101100100
|
|
||||||
28;60;11100110100
|
|
||||||
29;61;11100110010
|
|
||||||
30;62;11011011000
|
|
||||||
31;63;11011000110
|
|
||||||
32;64;11000110110
|
|
||||||
33;65;10100011000
|
|
||||||
34;66;10001011000
|
|
||||||
35;67;10001000110
|
|
||||||
36;68;10110001000
|
|
||||||
37;69;10001101000
|
|
||||||
38;70;10001100010
|
|
||||||
39;71;11010001000
|
|
||||||
40;72;11000101000
|
|
||||||
41;73;11000100010
|
|
||||||
42;74;10110111000
|
|
||||||
43;75;10110001110
|
|
||||||
44;76;10001101110
|
|
||||||
45;77;10111011000
|
|
||||||
46;78;10111000110
|
|
||||||
47;79;10001110110
|
|
||||||
48;80;11101110110
|
|
||||||
49;81;11010001110
|
|
||||||
50;82;11000101110
|
|
||||||
51;83;11011101000
|
|
||||||
52;84;11011100010
|
|
||||||
53;85;11011101110
|
|
||||||
54;86;11101011000
|
|
||||||
55;87;11101000110
|
|
||||||
56;88;11100010110
|
|
||||||
57;89;11101101000
|
|
||||||
58;90;11101100010
|
|
||||||
59;91;11100011010
|
|
||||||
60;92;11101111010
|
|
||||||
61;93;11001000010
|
|
||||||
62;94;11110001010
|
|
||||||
63;95;10100110000
|
|
||||||
64;96;10100001100
|
|
||||||
65;97;10010110000
|
|
||||||
66;98;10010000110
|
|
||||||
67;99;10000101100
|
|
||||||
68;100;10000100110
|
|
||||||
69;101;10110010000
|
|
||||||
70;102;10110000100
|
|
||||||
71;103;10011010000
|
|
||||||
72;104;10011000010
|
|
||||||
73;105;10000110100
|
|
||||||
74;106;10000110010
|
|
||||||
75;107;11000010010
|
|
||||||
76;108;11001010000
|
|
||||||
77;109;11110111010
|
|
||||||
78;110;11000010100
|
|
||||||
79;111;10001111010
|
|
||||||
80;112;10100111100
|
|
||||||
81;113;10010111100
|
|
||||||
82;114;10010011110
|
|
||||||
83;115;10111100100
|
|
||||||
84;116;10011110100
|
|
||||||
85;117;10011110010
|
|
||||||
86;118;11110100100
|
|
||||||
87;119;11110010100
|
|
||||||
88;120;11110010010
|
|
||||||
89;121;11011011110
|
|
||||||
90;122;11011110110
|
|
||||||
91;123;11110110110
|
|
||||||
92;124;10101111000
|
|
||||||
93;125;10100011110
|
|
||||||
94;126;10001011110
|
|
||||||
95;200;10111101000
|
|
||||||
96;201;10111100010
|
|
||||||
97;202;11110101000
|
|
||||||
98;203;11110100010
|
|
||||||
99;204;10111011110
|
|
||||||
100;205;10111101110
|
|
||||||
101;206;11101011110
|
|
||||||
102;207;11110101110
|
|
||||||
103;208;11010000100
|
|
||||||
104;209;11010010000
|
|
||||||
105;210;11010011100
|
|
||||||
106;211;1100011101011
|
|
|
@ -1,44 +0,0 @@
|
||||||
0;101001101101
|
|
||||||
1;110100101011
|
|
||||||
2;101100101011
|
|
||||||
3;110110010101
|
|
||||||
4;101001101011
|
|
||||||
5;110100110101
|
|
||||||
6;101100110101
|
|
||||||
7;101001011011
|
|
||||||
8;110100101101
|
|
||||||
9;101100101101
|
|
||||||
A;110101001011
|
|
||||||
B;101101001011
|
|
||||||
C;110110100101
|
|
||||||
D;101011001011
|
|
||||||
E;110101100101
|
|
||||||
F;101101100101
|
|
||||||
G;101010011011
|
|
||||||
H;110101001101
|
|
||||||
I;101101001101
|
|
||||||
J;101011001101
|
|
||||||
K;110101010011
|
|
||||||
L;101101010011
|
|
||||||
M;110110101001
|
|
||||||
N;101011010011
|
|
||||||
O;110101101001
|
|
||||||
P;101101101001
|
|
||||||
Q;101010110011
|
|
||||||
R;110101011001
|
|
||||||
S;101101011001
|
|
||||||
T;101011011001
|
|
||||||
U;110010101011
|
|
||||||
V;100110101011
|
|
||||||
W;110011010101
|
|
||||||
X;100101101011
|
|
||||||
Y;110010110101
|
|
||||||
Z;100110110101
|
|
||||||
-;100101011011
|
|
||||||
.;110010101101
|
|
||||||
;100110101101
|
|
||||||
$;100100100101
|
|
||||||
/;100100101001
|
|
||||||
+;100101001001
|
|
||||||
%;101001001001
|
|
||||||
*;100101101101
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue