-
Notifications
You must be signed in to change notification settings - Fork 0
/
hook.php
102 lines (82 loc) · 3.44 KB
/
hook.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
<?php
/*
-------------------------------------------------------------------------
Ewikit plugin for GLPI
Copyright (C) 2021-2022 by the Ewikit Development Team.
-------------------------------------------------------------------------
LICENSE
This file is part of wikit.
wikit 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.
wikit 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 wikit. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
function plugin_wikit_install()
{
global $DB;
if (!$DB->tableExists("glpi_plugin_wikit_configs")) {
$DB->runFile(PLUGIN_WIKIT_DIR . "/install/sql/empty-1.1.0.sql");
if (!$DB->fieldExists("glpi_plugin_wikit_configs", "persona", false)) {
$query = "ALTER TABLE `glpi_plugin_wikit_configs` ADD `persona` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Navy';";
$DB->doQuery($query);
}
if (!$DB->fieldExists("glpi_plugin_wikit_configs", "icon_url", false)) {
$query = "ALTER TABLE `glpi_plugin_wikit_configs` ADD `icon_url` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL;";
$DB->doQuery($query);
}
$input['webchattoken'] = "";
$input['description_text'] = __('A problem ? Ask me your question ??', 'wikit');
$input['home_description_text'] = __('Welcome to the digital service center!', 'wikit');
$input['close_text'] = __('Close the window', 'wikit');
$input['open_newwindow_text'] = __('Open in new tab', 'wikit');
$input['maximize_text'] = __('Enlarge window', 'wikit');
$input['minimize_text'] = __('Shrink window', 'wikit');
$input['persona'] = "Navy";
$input['icon_url'] = "";
$input['width'] = "50";
$input['height'] = "50";
$input['top'] = "93";
$input['bottom'] = "7";
$input['left'] = "97";
$input['right'] = "3";
$config = new PluginWikitConfig();
$input['id'] = 1;
$config->add($input);
} elseif (!$DB->fieldExists("glpi_plugin_wikit_configs", "width")) {
$DB->runFile(PLUGIN_WIKIT_DIR . "/install/sql/update-1.1.0.sql");
}
if (!$DB->fieldExists("glpi_plugin_wikit_configs", "persona", false)) {
$query = "ALTER TABLE `glpi_plugin_wikit_configs` ADD `persona` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Navy';";
$DB->doQuery($query);
}
if (!$DB->fieldExists("glpi_plugin_wikit_configs", "icon_url", false)) {
$query = "ALTER TABLE `glpi_plugin_wikit_configs` ADD `icon_url` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL;";
$DB->doQuery($query);
}
return true;
}
/**
* Plugin uninstall process
*
* @return boolean
*/
function plugin_wikit_uninstall()
{
global $DB;
// Plugin tables deletion
$tables = ["glpi_plugin_wikit_configs"];
foreach ($tables as $table) {
$DB->dropTable($table);
}
}
function plugin_wikit_display_login()
{
PluginWikitLogin::displayWebChat();
}