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 1
/
setup.php
executable file
·124 lines (96 loc) · 3.84 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
<?php
/*
------------------------------------------------------------------------
GLPI Plugin Renamer
Copyright (C) 2014 by the GLPI Plugin Renamer Development Team.
https://forge.indepnet.net/projects/renamer
------------------------------------------------------------------------
LICENSE
This file is part of GLPI Plugin Renamer project.
GLPI Plugin Renamer 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.
GLPI Plugin Renamer 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 GLPI Plugin Renamer. If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------------------------
@package GLPI Plugin Renamer
@author Stanislas Kita (Teclib')
@copyright Copyright (c) 2014 GLPI Plugin Renamer Development team
@license GPLv3 or (at your option) any later version
http://www.gnu.org/licenses/gpl.html
@link https://forge.indepnet.net/projects/renamer
@since 2014
------------------------------------------------------------------------
*/
/**
* function to initialize the plugin
* @global array $PLUGIN_HOOKS
*/
function plugin_init_renamer() {
global $PLUGIN_HOOKS;
$plugin = new Plugin();
$PLUGIN_HOOKS['csrf_compliant']['renamer'] = true;
$PLUGIN_HOOKS['change_profile']['renamer'] = array('PluginRenamerProfile', 'changeProfile');
Plugin::registerClass('PluginRenamerInstall');
Plugin::registerClass('PluginRenamerRenamer');
Plugin::registerClass('PluginRenamerConfig');
Plugin::registerClass('PluginRenamerProfile', array('addtabon' => array('Profile')));
if (Session::getLoginUserID()) {
if (Session::haveRight("config", UPDATE)) {
// Add link in GLPI plugins list :
$PLUGIN_HOOKS['config_page']['renamer'] = "front/config.form.php";
// add to 'Admin' menu :
$PLUGIN_HOOKS["menu_toadd"]['renamer'] = array('admin' => 'PluginRenamerMenu');
}
}
if (Session::getLoginUserID() && $plugin->isActivated('renamer')) {
$PLUGIN_HOOKS['add_javascript']['renamer'] = array('scripts/jquery-picklist.min.js',
'scripts/renamer.js.php');
$PLUGIN_HOOKS['add_css']['renamer'] = array( 'css/renamer.css',
'css/jquery-picklist.css',
'jquery-picklist-ie7.css');
}
}
/**
*function to define the version for glpi for plugin
* @return array
*/
function plugin_version_renamer() {
return array('name' => __("Renamer", "renamer"),
'version' => '0.90-1.0',
'author' => 'TECLIB\'',
'license' => 'GPLv3',
'homepage' => 'https://github.com/TECLIB/renamer',
'minGlpiVersion' => '0.85');
}
/**
* function to check the prerequisites
* @return boolean
*/
function plugin_renamer_check_prerequisites() {
if (version_compare(GLPI_VERSION, '0.85', 'lt')) {
echo "This plugin requires GLPI >= 0.85";
return false;
}
return true;
}
/**
* function to check the initial configuration
* @param boolean $verbose
* @return boolean
*/
function plugin_renamer_check_config($verbose = false) {
if (true) {
//your configuration check
return true;
}
if ($verbose) {
echo _x('plugin', 'Installed / not configured');
}
return false;
}