-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathhook.php
More file actions
109 lines (96 loc) · 3.15 KB
/
Copy pathhook.php
File metadata and controls
109 lines (96 loc) · 3.15 KB
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
function plugin_protocolsmanager_install() {
global $DB;
$profileRight = new ProfileRight();
$profiles_id = $_SESSION['glpiactiveprofile']['id'];
foreach (['plugin_protocolsmanager_config' => ALLSTANDARDRIGHT, 'plugin_protocolsmanager_tab' => READ] as $right => $value) {
if (!countElementsInTable('glpi_profilerights', ['profiles_id' => $profiles_id, 'name' => $right])) {
$profileRight->add(['profiles_id' => $profiles_id, 'name' => $right, 'rights' => $value]);
}
}
if (!$DB->tableExists('glpi_plugin_protocolsmanager_configs')) {
$DB->doQuery("CREATE TABLE glpi_plugin_protocolsmanager_configs (
id int NOT NULL auto_increment,
name varchar(255),
font varchar(255),
fontsize varchar(255),
logo varchar(255),
content text,
footer text,
city varchar(255),
serial_mode int,
man_mode int NOT NULL DEFAULT 1,
column1 varchar(255),
column2 varchar(255),
orientation varchar(10),
breakword int,
email_mode int,
email_template int,
upper_content text,
header_color varchar(7),
is_default tinyint(1) NOT NULL DEFAULT 0,
show_state tinyint(1) NOT NULL DEFAULT 0,
logo_height tinyint NOT NULL DEFAULT 20,
logo_align varchar(10) NOT NULL DEFAULT 'left',
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci");
$DB->insert('glpi_plugin_protocolsmanager_configs', [
'name' => 'Equipment report',
'font' => 'DejaVu Sans',
'fontsize' => '9',
'content' => "User: \n I have read the terms of use of IT equipment in the Example Company.",
'footer' => "Example Company \n Example Street 21 \n 01-234 Example City",
'city' => 'Example city',
'serial_mode' => 1,
'man_mode' => 1,
'orientation' => 'Portrait',
'breakword' => 0,
'email_mode' => 2,
'header_color' => '#dee2e6',
'is_default' => 0,
'show_state' => 0,
'logo_height' => 20,
'logo_align' => 'left',
]);
}
if (!$DB->tableExists('glpi_plugin_protocolsmanager_emailconfig')) {
$DB->doQuery("CREATE TABLE glpi_plugin_protocolsmanager_emailconfig (
id int NOT NULL auto_increment,
tname varchar(255),
send_user int,
email_content text,
email_subject varchar(255),
email_footer varchar(255),
recipients varchar(255),
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci");
}
if (!$DB->tableExists('glpi_plugin_protocolsmanager_protocols')) {
$DB->doQuery("CREATE TABLE glpi_plugin_protocolsmanager_protocols (
id int NOT NULL auto_increment,
name varchar(255),
user_id int,
gen_date datetime,
author varchar(255),
document_id int,
document_type varchar(255),
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci");
}
return true;
}
function plugin_protocolsmanager_uninstall() {
global $DB;
$tables = [
'glpi_plugin_protocolsmanager_protocols',
'glpi_plugin_protocolsmanager_configs',
'glpi_plugin_protocolsmanager_emailconfig',
];
foreach ($tables as $table) {
$DB->doQuery("DROP TABLE IF EXISTS `$table`");
}
$DB->delete('glpi_profilerights', [
'name' => ['plugin_protocolsmanager_config', 'plugin_protocolsmanager_tab'],
]);
return true;
}