-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.php
145 lines (103 loc) · 5.32 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/*
* @version $Id$
-------------------------------------------------------------------------
FusionInventory
Copyright (C) 2003-2010 by the INDEPNET Development Team.
http://www.fusioninventory.org/ http://forge.fusioninventory.org/
-------------------------------------------------------------------------
LICENSE
This file is part of FusionInventory plugins.
FusionInventory 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 2 of the License, or
(at your option) any later version.
FusionInventory 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 FusionInventory; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: DURIEUX David
// Purpose of file:
// ----------------------------------------------------------------------
include_once ("includes.php");
// Init the hooks of fusinvdeploy
function plugin_init_fusinvdeploy() {
global $PLUGIN_HOOKS,$CFG_GLPI,$LANG;
// ##### 1. Stop if fusioninventory not activated #####
$plugin = new Plugin;
if (!$plugin->isActivated("fusioninventory")) {
if (isset($_GET['id']) AND isset($_GET['action'])
AND strstr($_SERVER['HTTP_REFERER'], "front/plugin.php")) {
switch ($_GET['action']) {
case 'activate':
addMessageAfterRedirect($LANG['plugin_fusinvdeploy']["setup"][17]);
break;
case 'uninstall':
addMessageAfterRedirect($LANG['plugin_fusinvdeploy']["setup"][18]);
glpi_header($CFG_GLPI["root_doc"]."/front/plugin.php");
break;
}
}
return false;
}
// ##### 2. register class #####
Plugin::registerClass('PluginFusinvdeployPackage');
Plugin::registerClass('PluginFusinvdeployFile');
Plugin::registerClass('PluginFusinvdeployPackageFile');
Plugin::registerClass('PluginFusinvdeployDependence');
Plugin::registerClass('PluginFusinvdeployHistory');
Plugin::registerClass('PluginFusinvDeployConfig');
// ##### 3. get informations of the plugin #####
$a_plugin = plugin_version_fusinvdeploy();
$moduleId = PluginFusioninventoryModule::getModuleId($a_plugin['shortname']);
// ##### 4. Set in session module_id #####
$_SESSION["plugin_".$a_plugin['shortname']."_moduleid"] = $moduleId;
// ##### 5. Set in session XMLtags of methods #####
$_SESSION['glpi_plugin_fusioninventory']['xmltags']['DOWNLOAD'] = 'PluginFusinvdeployCommunicationOcsdeploy';
if (!isset($_SESSION['glpi_plugin_fusioninventory']['configuration']['moduletabforms']['fusinvdeploy'][$LANG['plugin_fusinvdeploy']["title"][0]])) {
$_SESSION['glpi_plugin_fusioninventory']['configuration']['moduletabforms']['fusinvdeploy'][$LANG['plugin_fusinvdeploy']["title"][0]] = array('class'=>'PluginFusinvDeployConfig',
'submitbutton'=>'plugin_fusinvdeploy_config_set',
'submitmethod'=>'putForm');
}
//$PLUGIN_HOOKS['init_session']['fusioninventory'] = array('Profile', 'initSession');
$PLUGIN_HOOKS['change_profile']['fusinvdeploy'] = PluginFusioninventoryProfile::changeprofile($moduleId,$a_plugin['shortname']);
//$PLUGIN_HOOKS['menu_entry']['fusinvdeploy'] = true;
$PLUGIN_HOOKS['submenu_entry']['fusioninventory']['add']['packages'] = '../fusinvdeploy/front/package.form.php?add=1';
$PLUGIN_HOOKS['submenu_entry']['fusioninventory']['search']['packages'] = '../fusinvdeploy/front/package.php';
$PLUGIN_HOOKS['submenu_entry']['fusioninventory']['add']['files'] = '../fusinvdeploy/front/file.form.php?add=1';
$PLUGIN_HOOKS['submenu_entry']['fusioninventory']['search']['files'] = '../fusinvdeploy/front/file.php';
}
// Name and Version of the plugin
function plugin_version_fusinvdeploy() {
return array('name' => 'FusionInventory DEPLOY',
'shortname' => 'fusinvdeploy',
'version' => '2.3.0-1',
'author' =>'<a href="mailto:[email protected]">David DURIEUX</a>
& <a href="mailto:[email protected]">Vincent MAZZONI</a>',
'homepage' =>'http://forge.fusioninventory.org/projects/pluginfusinvdeploy',
'minGlpiVersion' => '0.78'// For compatibility / no install in version < 0.78
);
}
// Optional : check prerequisites before install : may print errors or add to message after redirect
function plugin_fusinvdeploy_check_prerequisites() {
global $LANG;
if (GLPI_VERSION >= '0.78') {
$plugin = new Plugin;
if (!$plugin->isActivated("fusioninventory")) {
return false;
}
return true;
} else {
echo $LANG['plugin_fusinvdeploy']["errors"][50];
}
}
function plugin_fusinvdeploy_check_config() {
return true;
}
?>