Skip to content

Commit

Permalink
Merge branch 'development' into ITC-1911
Browse files Browse the repository at this point in the history
  • Loading branch information
ibering authored Jul 29, 2022
2 parents 3c93917 + 5f1bcca commit 1dddb13
Show file tree
Hide file tree
Showing 66 changed files with 2,189 additions and 593 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ plugins/PRINTERModule
plugins/VMWAREHORIZONModule
plugins/DB2Module
plugins/MSSQLModule
plugins/PRINTERModule
plugins/ORACLEModule
plugins/UPSModule
plugins/CustomalertModule
6 changes: 3 additions & 3 deletions UPDATE.sh
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ oitc agent --migrate
echo "Checking that a server certificate for the openITCOCKPIT Monitoring Agent exists"
oitc agent --generate-server-ca

# ITC-2800
echo "Apply strict checking of host group assignments by container permissions"
oitc HostgroupContainerPermissions
# ITC-2800 ITC-2819
#echo "Apply strict checking of host group assignments by container permissions"
#oitc HostgroupContainerPermissions

# ITC-1911
echo "Cleanup for invalid parent hosts on satellite instance"
Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,21 @@
"ext-soap": "*",
"ext-sockets": "*",
"ext-zip": "*",
"alchemy/zippy": "^1.0",
"azuyalabs/yasumi": "^2.2",
"cakephp/authentication": "^2.0",
"cakephp/authorization": "^2.0",
"cakephp/cakephp": "^4.0",
"cakephp/migrations": "@stable",
"cakephp/plugin-installer": "^1.0",
"cboden/ratchet": "^0.4.1",
"chillerlan/php-qrcode": "^3.4.1 || ^4.3.3",
"ddeboer/imap": "^1.9",
"endroid/qr-code": "3.9.6",
"erusev/parsedown": "^1.7",
"erusev/parsedown-extra": "^0.7.1",
"freedsx/ldap": "^0.5.0",
"friendsofcake/cakepdf": "4.0.0-beta",
"guiguiboy/php-cli-progress-bar": "^0.0.4",
"guzzlehttp/guzzle": "^6.5",
"guzzlehttp/guzzle": "^7.4",
"itnovum/acl": "^0.7.2",
"jbbcode/jbbcode": "^1.4",
"jdorn/sql-formatter": "^1.2",
Expand Down
27 changes: 24 additions & 3 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,18 @@
use Cake\Core\Configure\Engine\PhpConfig;
use Cake\Database\TypeFactory;
use Cake\Datasource\ConnectionManager;
use Cake\Error\ConsoleErrorHandler;

// CakePHP 4.3.x (for php 7.2, bionic)
use Cake\Error\ErrorHandler;

// CakePHP 4.3.x (for php 7.2, bionic)
use Cake\Error\ErrorTrap;

// CakePHP 4.4.x (requires php 7.4)
use Cake\Error\ExceptionTrap;

// CakePHP 4.4.x (requires php 7.4)
use Cake\Http\ServerRequest;
use Cake\Log\Log;
use Cake\Mailer\Email;
Expand Down Expand Up @@ -143,12 +153,23 @@
* Register application error and exception handlers.
*/
$isCli = PHP_SAPI === 'cli';
if ($isCli) {
(new ErrorTrap(Configure::read('Error')))->register();
if (class_exists('\Cake\Error\ErrorTrap')) {
// CakePHP 4.4 / php >= 7.4
if ($isCli) {
(new ErrorTrap(Configure::read('Error')))->register();
} else {
(new ExceptionTrap(Configure::read('Error')))->register();
}
} else {
(new ExceptionTrap(Configure::read('Error')))->register();
// CakePHP 4.3.x / php 7.2
if ($isCli) {
(new ConsoleErrorHandler(Configure::read('Error')))->register();
} else {
(new ErrorHandler(Configure::read('Error')))->register();
}
}


/*
* Include the CLI bootstrap overrides.
*/
Expand Down
2 changes: 1 addition & 1 deletion config/version.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

if (!defined('OPENITCOCKPIT_VERSION')) {
define('OPENITCOCKPIT_VERSION', '4.5.0');
define('OPENITCOCKPIT_VERSION', '4.5.1');
}

return [];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"dependencies": {
"@egjs/hammerjs": "^2.0.17",
"@fortawesome/fontawesome-free": "^5.15.1",
"@fortawesome/fontawesome-free": "^6.1.1",
"@fullcalendar/bootstrap": "^4.4.2",
"@fullcalendar/core": "^4.4.2",
"@fullcalendar/daygrid": "^4.4.2",
Expand Down
6 changes: 4 additions & 2 deletions plugins/MapModule/src/Controller/MapeditorsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ public function mapsummaryitem() {
$hosts = [];
$services = [];
if (!empty($hostIds)) {
$hostsById = $HostsTable->getHostsWithServicesByIdsForMapeditor($hostIds);
$hostsById = $HostsTable->getHostsWithServicesByIdsForMapeditor($hostIds, false);

if (!empty($hostsById)) {
if ($this->hasRootPrivileges === false) {
Expand All @@ -709,7 +709,9 @@ public function mapsummaryitem() {
}
}
foreach ($hostsById as $host) {
$hosts[$host['id']] = $host;
$hosts[$host['id']] = [
'Host' => $host
];
foreach ($host['services'] as $serviceData) {
$services[$serviceData['id']] = [
'Service' => $serviceData
Expand Down
15 changes: 11 additions & 4 deletions plugins/MapModule/src/Lib/ExportTasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
namespace MapModule\Lib;


use Alchemy\Zippy\Zippy;
use App\Lib\PluginExportTasks;
use Cake\Core\Configure;
use Cake\Log\Log;
use Cake\ORM\TableRegistry;
use Cake\Utility\Hash;
use itnovum\openITCOCKPIT\Core\FileDebugger;
Expand All @@ -28,8 +28,6 @@ public function beforeExport(): bool {
return true;
}

$zippy = Zippy::load();

//Create zip file with all maps per satellite if DistributeModule is loaded

/** @var MapsTable $MapsTable */
Expand Down Expand Up @@ -67,7 +65,16 @@ public function beforeExport(): bool {

if (!empty($files)) {
//Cannot create an empty zip
$archive = $zippy->create($mapZipArchive, $files);
$zipArchive = new \ZipArchive();
if ($zipArchive->open($mapZipArchive, \ZipArchive::CREATE) !== true) {
Log::error('Cant create zip file');
} else {
foreach ($files as $filename => $file) {
$zipArchive->addFile($file, $filename);
}
$zipArchive->close();
}

}

if (file_exists($mapJson)) {
Expand Down
45 changes: 45 additions & 0 deletions resources/locales/de_DE/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -10682,6 +10682,51 @@ msgstr "Host Ausgabe"
msgid "Instance"
msgstr "Instanz"

#: src/Template/Browsers/index.php:567
#: src/Template/Browsers/index.php:438
#: src/Template/Hosts/index.php:641
#: src/Template/Hosts/index.php:510
msgid "Host notes"
msgstr "Hostnotizen"

#: src/Template/Browsers/index.php:415
msgid "Column configuration"
msgstr "Spaltenkonfiguration"


#: src/Template/Browsers/index.php:419
msgid "Columns"
msgstr "Spalten"

#: src/Template/Browsers/index.php:466
msgid "Save Columns configuration in browser"
msgstr "Spaltenkonfiguration in Browser speichern"

#: src/Template/Angular/columns_config_import.php:33
msgid "Import configuration"
msgstr "Import Konfiguration"

#: src/Template/Angular/columns_config_import.php:54
msgid "Paste a column configuration string"
msgstr "Erhaltenen Spaltenkonfiguration einfügen"


#: src/Template/Angular/columns_config_import.php:42
msgid "Import column configuration"
msgstr "Import Spaltenkonfiguration"

#: src/Template/Angular/columns_config_export.php:43
msgid "Share configuration"
msgstr "Teile Konfiguration"

#: src/Template/Angular/columns_config_export.php:43
msgid "Share column configuration"
msgstr "Teile Spaltenkonfiguration"

#: src/Template/Angular/columns_config_export.php:51
msgid "Share this column configuration string"
msgstr "Teile diese Spaltenkonfiguration"

#: src/Template/Browsers/index.php:492
#: src/Template/Currentstatereports/index.php:316
#: src/Template/Currentstatereports/index.php:369
Expand Down
43 changes: 43 additions & 0 deletions resources/locales/en_US/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -10681,6 +10681,49 @@ msgstr ""
msgid "Instance"
msgstr ""

#: src/Template/Browsers/index.php:567
#: src/Template/Browsers/index.php:438
#: src/Template/Hosts/index.php:641
#: src/Template/Hosts/index.php:510
msgid "Host notes"
msgstr ""

#: src/Template/Browsers/index.php:415
msgid "Column configuration"
msgstr ""

#: src/Template/Browsers/index.php:419
msgid "Columns"
msgstr ""

#: src/Template/Browsers/index.php:466
msgid "Save Columns configuration in browser"
msgstr ""

#: src/Template/Angular/columns_config_import.php:33
msgid "Import configuration"
msgstr ""

#: src/Template/Angular/columns_config_import.php:42
msgid "Import column configuration"
msgstr ""

#: src/Template/Angular/columns_config_import.php:54
msgid "Paste a column configuration string"
msgstr ""

#: src/Template/Angular/columns_config_export.php:33
msgid "Share configuration"
msgstr ""

#: src/Template/Angular/columns_config_export.php:43
msgid "Share column configuration"
msgstr ""

#: src/Template/Angular/columns_config_export.php:51
msgid "Share this column configuration string"
msgstr ""

#: src/Template/Browsers/index.php:492
#: src/Template/Currentstatereports/index.php:316
#: src/Template/Currentstatereports/index.php:369
Expand Down
57 changes: 44 additions & 13 deletions src/3rd/imageSmoothArc.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,24 @@ function imageSmoothArcDrawSegment ($img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY
$xp = -1; $yp = +1; $xa = 0; $ya = +1;
}
if ( $stop < ($i+1)*(M_PI/2) && $x <= $xStop ) {
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1 );
$alpha = 127-(127-$color[3])*$error1;
$alpha = (int)$alpha;
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$y1 = $_y1; if ($aaStopX) imageSetPixel($img, $cx+$xp*($x)+$xa, $cy+$yp*($y1+1)+$ya, $diffColor1);

} else {
$y = $b * sqrt( 1 - ($x*$x)/($a*$a) );
$error = $y - (int)($y);
$y = (int)($y);
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error );
$alpha = 127-(127-$color[3])*$error;
$alpha = (int)$alpha;
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$y1 = $y; if ($x < $aaAngleX ) imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y1+1)+$ya, $diffColor);
}
if ($start > $i*M_PI/2 && $x <= $xStart) {
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2 );
$alpha = 127-(127-$color[3])*$error2;
$alpha = (int)$alpha;
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha);
$y2 = $_y2; if ($aaStartX) imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y2-1)+$ya, $diffColor2);
} else {
$y2 = 0;
Expand All @@ -142,18 +148,24 @@ function imageSmoothArcDrawSegment ($img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY
$xp = +1; $yp = +1; $xa = 1; $ya = 1;
}
if ( $start > $i*M_PI/2 && $x < $xStart ) {
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2 );
$alpha = 127-(127-$color[3])*$error2;
$alpha = (int)$alpha;
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$y1 = $_y2; if ($aaStartX) imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y1+1)+$ya, $diffColor2);

} else {
$y = $b * sqrt( 1 - ($x*$x)/($a*$a) );
$error = $y - (int)($y);
$y = (int) $y;
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error );
$alpha = 127-(127-$color[3])*$error;
$alpha = (int)$alpha;
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$y1 = $y; if ($x < $aaAngleX ) imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y1+1)+$ya, $diffColor);
}
if ($stop < ($i+1)*M_PI/2 && $x <= $xStop) {
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1 );
$alpha = 127-(127-$color[3])*$error1;
$alpha = (int)$alpha;
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$y2 = $_y1; if ($aaStopX) imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y2-1)+$ya, $diffColor1);
} else {
$y2 = 0;
Expand Down Expand Up @@ -206,17 +218,23 @@ function imageSmoothArcDrawSegment ($img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY
$xp = -1; $yp = +1; $xa = 0; $ya = 1;
}
if ( $stop < ($i+1)*(M_PI/2) && $y <= $yStop ) {
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1 );
$alpha = 127-(127-$color[3])*$error1;
$alpha = (int)$alpha;
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$x1 = $_x1; if (!$aaStopX) imageSetPixel($img, $cx+$xp*($x1-1)+$xa, $cy+$yp*($y)+$ya, $diffColor1);
}
if ($start > $i*M_PI/2 && $y < $yStart) {
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2 );
$alpha = 127-(127-$color[3])*$error2;
$alpha = (int)$alpha;
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$x2 = $_x2; if (!$aaStartX) imageSetPixel($img, $cx+$xp*($x2+1)+$xa, $cy+$yp*($y)+$ya, $diffColor2);
} else {
$x = $a * sqrt( 1 - ($y*$y)/($b*$b) );
$error = $x - (int)($x);
$x = (int)($x);
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error );
$alpha = 127-(127-$color[3])*$error;
$alpha = (int)$alpha;
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$x1 = $x; if ($y < $aaAngleY && $y <= $yStop ) imageSetPixel($img, $cx+$xp*($x1+1)+$xa, $cy+$yp*$y+$ya, $diffColor);
}
}
Expand All @@ -232,17 +250,23 @@ function imageSmoothArcDrawSegment ($img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY
$xp = +1; $yp = +1; $xa = 1; $ya = 1;
}
if ( $start > $i*M_PI/2 && $y < $yStart ) {
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2 );
$alpha = 127-(127-$color[3])*$error2;
$alpha = (int)$alpha;
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$x1 = $_x2; if (!$aaStartX) imageSetPixel($img, $cx+$xp*($x1-1)+$xa, $cy+$yp*$y+$ya, $diffColor2);
}
if ($stop < ($i+1)*M_PI/2 && $y <= $yStop) {
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1 );
$alpha = 127-(127-$color[3])*$error1;
$alpha = (int)$alpha;
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$x2 = $_x1; if (!$aaStopX) imageSetPixel($img, $cx+$xp*($x2+1)+$xa, $cy+$yp*$y+$ya, $diffColor1);
} else {
$x = $a * sqrt( 1 - ($y*$y)/($b*$b) );
$error = $x - (int)($x);
$x = (int)($x);
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error );
$alpha = 127-(127-$color[3])*$error;
$alpha = (int)$alpha;
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], $alpha );
$x1 = $x; if ($y < $aaAngleY && $y < $yStart) imageSetPixel($img,$cx+$xp*($x1+1)+$xa, $cy+$yp*$y+$ya, $diffColor);
}
}
Expand Down Expand Up @@ -279,6 +303,13 @@ function imageSmoothArc ( $img, $cx, $cy, $w, $h, $color, $start, $stop)
// This script does not use any special algorithms, everything is completely
// written from scratch; see http://de.wikipedia.org/wiki/Ellipse for formulas.

// Deprecated: Implicit conversion from float 107.23210326031347 to int loses precision
// Fix for php 8.1
$color[0] = (int)$color[0];
$color[1] = (int)$color[1];
$color[2] = (int)$color[2];
$color[3] = (int)$color[3];

while ($start < 0)
$start += 2*M_PI;
while ($stop < 0)
Expand Down Expand Up @@ -341,4 +372,4 @@ function imageSmoothArc ( $img, $cx, $cy, $w, $h, $color, $start, $stop)
}
}
}
?>

Loading

0 comments on commit 1dddb13

Please sign in to comment.