-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup.php
executable file
·126 lines (101 loc) · 4.7 KB
/
setup.php
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/*
------------------------------------------------------------------------
TimelineTicket
Copyright (C) 2013-2022 by the TimelineTicket Development Team.
https://github.com/pluginsGLPI/timelineticket
------------------------------------------------------------------------
LICENSE
This file is part of TimelineTicket project.
TimelineTicket plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TimelineTicket plugin 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with TimelineTicket plugin. If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------------------------
@package TimelineTicket plugin
@copyright Copyright (c) 2013-2022 TimelineTicket team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://github.com/pluginsGLPI/timelineticket
@since 2013
------------------------------------------------------------------------
*/
define("PLUGIN_TIMELINETICKET_VERSION", "10.0+1.2");
if (!defined("PLUGIN_TIMELINETICKET_DIR")) {
define("PLUGIN_TIMELINETICKET_DIR", Plugin::getPhpDir("timelineticket"));
define("PLUGIN_TIMELINETICKET_NOTFULL_DIR", Plugin::getPhpDir("timelineticket", false));
define("PLUGIN_TIMELINETICKET_WEBDIR", Plugin::getWebDir("timelineticket"));
}
function plugin_version_timelineticket()
{
return ['name' => _n("Timeline of ticket", "Timeline of tickets", 2, "timelineticket"),
'version' => PLUGIN_TIMELINETICKET_VERSION,
'homepage' => 'https://github.com/pluginsGLPI/timelineticket',
'license' => 'AGPLv3+',
'author' => 'Nelly Mahu-Lasson && David Durieux && Xavier Caillaud',
'requirements' => [
'glpi' => [
'min' => '10.0',
'max' => '11.0',
'dev' => false
]
]
];
}
function plugin_init_timelineticket()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['timelineticket'] = true;
// add autoload for vendor
include_once(PLUGIN_TIMELINETICKET_DIR . "/vendor/autoload.php");
if (Plugin::isPluginActive('timelineticket')) { // check if plugin is active
$PLUGIN_HOOKS['change_profile']['timelineticket'] = ['PluginTimelineticketProfile', 'initProfile'];
$PLUGIN_HOOKS['show_item_stats']['timelineticket'] = [
'Ticket' => 'plugin_timelineticket_item_stats'
];
Plugin::registerClass('PluginTimelineticketProfile', ['addtabon' => 'Profile']);
if (Session::haveRightsOr('plugin_timelineticket_ticket', [READ, UPDATE])) {
Plugin::registerClass(
'PluginTimelineticketDisplay',
['addtabon' => ['Ticket']]
);
}
$PLUGIN_HOOKS['item_purge']['timelineticket'] = [
'Ticket' => 'plugin_timelineticket_ticket_purge',
'Group_Ticket' => ['PluginTimelineticketAssignGroup', 'deleteGroupTicket'],
'Ticket_User' => ['PluginTimelineticketAssignUser', 'deleteUserTicket']
];
$PLUGIN_HOOKS['item_add']['timelineticket'] = [
'Ticket' => 'plugin_timelineticket_ticket_add',
'Group_Ticket' => ['PluginTimelineticketAssignGroup', 'addGroupTicket'],
'Ticket_User' => ['PluginTimelineticketAssignUser', 'addUserTicket']
];
$PLUGIN_HOOKS['item_update']['timelineticket'] = [
'Ticket' => 'plugin_timelineticket_ticket_update'
];
if (Session::haveRight("config", UPDATE)
|| Session::haveRight('plugin_timelineticket_ticket', UPDATE)) {// Config page
$PLUGIN_HOOKS['config_page']['timelineticket'] = 'front/config.form.php';
}
if (Plugin::isPluginActive('mydashboard')) {
$PLUGIN_HOOKS['mydashboard']['timelineticket'] = ["PluginTimelineticketDashboard"];
}
}
}
/**
* @return bool
*/
function plugin_timelineticket_check_prerequisites()
{
if (!is_readable(__DIR__ . '/vendor/autoload.php') || !is_file(__DIR__ . '/vendor/autoload.php')) {
echo "Run composer install --no-dev in the plugin directory<br>";
return false;
}
return true;
}