This repository has been archived by the owner on May 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.php
60 lines (46 loc) · 1.71 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
<?php
//Load php libraries (test)
require_once GLPI_ROOT."/plugins/mobile/lib/QueryPath-2.1.2-minimal/QueryPath.php";
// Init the hooks of the plugins -Needed
function plugin_init_mobile() {
global $PLUGIN_HOOKS, $LANG;
$PLUGIN_HOOKS['csrf_compliant']['mobile'] = true;
$mobile_index = 'front/central.php';
$PLUGIN_HOOKS['menu_entry']['mobile'] = $mobile_index;
$PLUGIN_HOOKS['config_page']['mobile'] = $mobile_index;
//if mobile navigator detected, redirect to plugin mobile
$plug = new Plugin();
if ($plug->isInstalled('mobile') && $plug->isActivated('mobile')) {
if (PluginMobileCommon::isNavigatorMobile()) {
PluginMobileCommon::redirectMobile();
}
}
}
// Get the name and the version of the plugin - Needed
function plugin_version_mobile() {
return array('name' => "Mobile",
'version' => "2.0",
'author' => "<a href='mailto:adelaunay@teclib.com'>Alexandre DELAUNAY</a>",
'homepage' => "http://www.teclib.com/",
'minGlpiVersion' => "0.84");
}
// Optional : check prerequisites before install : may print errors or add to message after redirect
function plugin_mobile_check_prerequisites() {
if (version_compare(GLPI_VERSION,'0.84','>=')) {
return true;
} else {
echo "GLPI version not compatible need 0.84 min";
}
}
// Check configuration process for plugin : need to return true if succeeded
// Can display a message only if failure and $verbose is true
function plugin_mobile_check_config($verbose=false) {
global $LANG;
if (true) { // Your configuration check
return true;
}
if ($verbose) {
echo $LANG['plugins'][2];
}
return false;
}