Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.

Commit 2f01e02

Browse files
committed
Add GLPI 9.5 compatibility
* Add marketplace compatibility * Use sodium encryption for mantis password * Use GLPI 9.5 min required PHP version * Add 4.4.0 version definition
1 parent e6a677c commit 2f01e02

10 files changed

Lines changed: 602 additions & 376 deletions

File tree

.travis.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
language: php
22
php:
3-
- 5.6
3+
- 7.2
44
- 7.4
5-
- nightly
65

76
before_script:
87
- composer self-update
@@ -11,10 +10,6 @@ before_script:
1110
script:
1211
- vendor/bin/robo --no-interaction code:cs --strict
1312

14-
matrix:
15-
allow_failures:
16-
- php: nightly
17-
1813
cache:
1914
directories:
2015
- $HOME/.composer/cache

ajax/ajax.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
$output = "";
3333

34+
$web_dir = Plugin::getWebDir('mantis');
35+
3436
switch ($_POST['action']) {
3537

3638
// TEST CONNECTION TO MANTIS
@@ -43,12 +45,12 @@
4345
$_POST['login'],
4446
$_POST['pwd']);
4547
if ($res) {
46-
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/check24.png'/>";
48+
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/check24.png'/>";
4749
} else {
48-
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/cross24.png'/>Access denied";
50+
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/cross24.png'/>Access denied";
4951
}
5052
} catch (Exception $e) {
51-
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/cross24.png'/>Error IP or Path";
53+
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/cross24.png'/>Error IP or Path";
5254
}
5355
break;
5456

@@ -58,9 +60,9 @@
5860
$ws->initializeConnection();
5961
$res = $ws->existIssueWithId($_POST['id']);
6062
if ($res) {
61-
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/check24.png' />";
63+
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/check24.png' />";
6264
} else {
63-
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/cross24.png'/>";
65+
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/cross24.png'/>";
6466
}
6567
break;
6668

@@ -70,9 +72,9 @@
7072
$ws->initializeConnection();
7173
$res = $ws->existProjectWithName($_POST['name']);
7274
if ($res) {
73-
echo "<img id='resultImg' src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/check24.png' />";
75+
echo "<img id='resultImg' src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/check24.png' />";
7476
} else {
75-
echo "<img id='resultImg' src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/cross24.png'/>";
77+
echo "<img id='resultImg' src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/cross24.png'/>";
7678
}
7779
break;
7880

@@ -83,7 +85,7 @@
8385
$ws->getConnexion($_POST['host'],
8486
$_POST['url'],
8587
$_POST['login'],
86-
Toolbox::decrypt($_POST['pwd'], GLPIKEY));
88+
Toolbox::sodiumDecrypt($_POST['pwd']));
8789
$result = $ws->getStateMantis();
8890

8991
if (! $result) {
@@ -168,7 +170,7 @@
168170
$mantis = new PluginMantisMantis();
169171
// verify if a link already exists
170172
if ($mantis->IfExistLink($idItem, $id_mantis_issue, $itemType)) {
171-
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/warning24.png'/>"
173+
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/warning24.png'/>"
172174
."ERROR :". __("This GLPi object is already linked to the selected MantisBT issue", "mantis");
173175
} else {
174176
$result = $ws->getIssueById($id_mantis_issue);
@@ -209,7 +211,7 @@
209211
$mantis = new PluginMantisMantis();
210212
// on verifie si un lien est deja creé
211213
if ($mantis->IfExistLink($id_ticket, $id_mantis_issue, $itemType)) {
212-
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $CFG_GLPI['root_doc'] . "/plugins/mantis/pics/warning24.png'/>"
214+
echo "<img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E" . $web_dir . "/pics/warning24.png'/>"
213215
. __("This GLPi object is already linked to the selected MantisBT issue", "mantis");
214216
} else {
215217

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"require": {
3-
"php": ">= 5.6.0"
3+
"php": "^7.2"
44
},
55
"require-dev": {
66
"glpi-project/tools": "^0.1"
77
},
88
"config": {
9+
"optimize-autoloader": true,
910
"platform": {
10-
"php": "5.6"
11-
}
11+
"php": "7.2.0"
12+
},
13+
"sort-packages": true
1214
}
1315
}

0 commit comments

Comments
 (0)