This repository was archived by the owner on Jan 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.php
More file actions
102 lines (94 loc) · 3.52 KB
/
setup.php
File metadata and controls
102 lines (94 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* ---------------------------------------------------------------------
* groupcategory is a plugin to customizes the list of accessible
* ticket categories for ticket requesters.
* ---------------------------------------------------------------------
* LICENSE
*
* This file is part of groupcategory.
*
* groupcategory 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; either version 3 of the License, or
* (at your option) any later version.
*
* groupcategory 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.
*
* You should have received a copy of the GNU General Public License
* along with Formcreator. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
* @copyright Copyright © 2022-2023 probeSys'
* @license http://www.gnu.org/licenses/agpl.txt AGPLv3+
* @link https://github.com/Probesys/glpi-plugins-groupcategory
* @link https://plugins.glpi-project.org/#/plugin/groupcategory
* ---------------------------------------------------------------------
*/
// Version of the plugin
define('PLUGIN_GROUPCATEGORY_VERSION', '1.5.2');
define('PLUGIN_GROUPCATEGORY_GLPI_MIN_VERSION', '9.4');
define('PLUGIN_GROUPCATEGORY_NAMESPACE', 'groupcategory');
// Maximum GLPI version, exclusive
define("PLUGIN_GROUPCATEGORY_GLPI_MAX_VERSION", "11.0");
if (!defined("PLUGIN_GROUPCATEGORY_DIR")) {
define("PLUGIN_GROUPCATEGORY_DIR", Plugin::getPhpDir("groupcategory"));
}
if (!defined("PLUGIN_GROUPCATEGORY_WEB_DIR")) {
define("PLUGIN_GROUPCATEGORY_WEB_DIR", Plugin::getWebDir("groupcategory"));
}
/**
* Plugin description
*
* @return boolean
*/
function plugin_version_groupcategory()
{
return [
'name' => 'GroupCategory',
'version' => PLUGIN_GROUPCATEGORY_VERSION,
'author' => '<a href="https://www.probesys.com">PROBESYS</a>',
'homepage' => 'https://github.com/Probesys/glpi-plugins-groupcategory',
'license' => 'GPLv2+',
'minGlpiVersion' => PLUGIN_GROUPCATEGORY_GLPI_MIN_VERSION,
];
}
/**
* Initialize plugin
*
* @return boolean
*/
function plugin_init_groupcategory()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant'][PLUGIN_GROUPCATEGORY_NAMESPACE] = true;
//$PLUGIN_HOOKS['post_show_item'][PLUGIN_GROUPCATEGORY_NAMESPACE] = ['PluginGroupcategoryGroupcategory', 'post_show_item'];
$PLUGIN_HOOKS['post_item_form'][PLUGIN_GROUPCATEGORY_NAMESPACE] = ['PluginGroupcategoryGroupcategory', 'post_item_form'];
$PLUGIN_HOOKS['pre_item_update'][PLUGIN_GROUPCATEGORY_NAMESPACE] = [
'Group' => 'plugin_groupcategory_group_update',
];
}
/**
* Check plugin's prerequisites before installation
*/
function plugin_groupcategory_check_prerequisites()
{
if (version_compare(GLPI_VERSION, PLUGIN_GROUPCATEGORY_GLPI_MIN_VERSION, 'lt') || version_compare(GLPI_VERSION, PLUGIN_GROUPCATEGORY_GLPI_MAX_VERSION, 'ge')) {
echo __('This plugin requires GLPI >= ' . PLUGIN_GROUPCATEGORY_GLPI_MIN_VERSION . ' and GLPI < ' . PLUGIN_GROUPCATEGORY_GLPI_MAX_VERSION . '<br>');
} else {
return true;
}
return false;
}
/**
* Check if config is compatible with plugin
*
* @return boolean
*/
function plugin_groupcategory_check_config()
{
// nothing to do
return true;
}