This repository has been archived by the owner on Mar 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.php
109 lines (83 loc) · 4.25 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
<?php
/*
------------------------------------------------------------------------
Surveyticket
Copyright (C) 2012-2017 by the Surveyticket plugin Development Team.
------------------------------------------------------------------------
LICENSE
This file is part of Surveyticket plugin project.
Surveyticket 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.
Surveyticket 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 Surveyticket plugin. If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------------------------
@package Surveyticket plugin
@author David Durieux
@author Infotel
@copyright Copyright (c) 2012-2017 Surveyticket plugin 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/surveyticket
@since 2012
------------------------------------------------------------------------
*/
define ("PLUGIN_SURVEYTICKET_VERSION", "9.3+1.0");
// Init the hooks of surveyticket
function plugin_init_surveyticket() {
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['surveyticket'] = true;
if (isset($_SESSION["glpiID"])) {
$plugin = new Plugin();
if ($plugin->isActivated('surveyticket')) {
Plugin::registerClass('PluginSurveyticketProfile', array('addtabon' => array('Profile')));
$PLUGIN_HOOKS['change_profile']['surveyticket'] = array('PluginSurveyticketProfile', 'initProfile');
if (Session::haveRight("plugin_surveyticket_use", CREATE)) {
if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false ||
strpos($_SERVER['REQUEST_URI'], "helpdesk.public.php") !== false ||
strpos($_SERVER['REQUEST_URI'], "tracking.injector.php") !== false) {
$PLUGIN_HOOKS['add_javascript']['surveyticket'][] = 'scripts/surveyticket.js';
$PLUGIN_HOOKS['add_javascript']['surveyticket'][] = 'scripts/surveyticket_load_scripts.js';
$PLUGIN_HOOKS['pre_item_add']['surveyticket'] = array('Ticket' =>
array('PluginSurveyticketTicket', 'preAddTicket'));
$PLUGIN_HOOKS['item_add']['surveyticket'] = array('Ticket' =>
array('PluginSurveyticketTicket', 'postAddTicket'));
$PLUGIN_HOOKS['item_empty']['surveyticket'] = array('Ticket' =>
array('PluginSurveyticketTicket', 'emptyTicket'));
}
}
$PLUGIN_HOOKS['post_item_form']['surveyticket'] = ['PluginSurveyticketTicket', 'postForm'];
if (Session::haveRight("config", READ)) {
$PLUGIN_HOOKS["menu_toadd"]['surveyticket'] = array('config' => 'PluginSurveyticketMenu');
}
}
}
}
// Name and Version of the plugin
function plugin_version_surveyticket() {
return array('name' => __('Survey', 'surveyticket'),
'shortname' => 'surveyticket',
'version' => PLUGIN_SURVEYTICKET_VERSION,
'author' => '<a href="mailto:david@durieux.family">David DURIEUX</a> &
<a href="http://infotel.com/services/expertise-technique/glpi/">Infotel</a>',
'homepage' => 'https://github.com/pluginsGLPI/surveyticket',
'minGlpiVersion' => '9.3',
'license' => 'AGPLv3+',
);
}
// Optional : check prerequisites before install : may print errors or add to message after redirect
function plugin_surveyticket_check_prerequisites() {
if (version_compare(GLPI_VERSION, '9.3', 'lt') || version_compare(GLPI_VERSION, '9.4', 'ge')) {
_e('Your GLPI version not compatible, require 9.3', 'surveyticket');
return FALSE;
}
return TRUE;
}
function plugin_surveyticket_check_config() {
return TRUE;
}