Repository navigation
Expand file tree
/
Copy pathmanifest.json.php
More file actions
130 lines (116 loc) · 4.54 KB
/
Copy pathmanifest.json.php
File metadata and controls
130 lines (116 loc) · 4.54 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
/* Copyright (C) 2023 EVARISK <technique@evarisk.com>
*
* This program 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.
*
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file manifest.json.php
* \ingroup digiquali
* \brief File for The Web App
*/
if (!defined('NOREQUIREUSER')) {
define('NOREQUIREUSER', '1');
}
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
if (!defined('NOREQUIRETRAN')) {
define('NOREQUIRETRAN', '1');
}
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1');
}
if (!defined('NOLOGIN')) {
define('NOLOGIN', '1');
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOSESSION')) {
define('NOSESSION', '1');
}
if (!defined('NOCSRFCHECK')) { // We accept to go on this page from external website.
define('NOCSRFCHECK', '1');
}
if (!defined('NOIPCHECK')) { // Do not check IP defined into conf $dolibarr_main_restrict_ip.
define('NOIPCHECK', '1');
}
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
// Load Dolibarr environment
if (file_exists('../main.inc.php')) {
require_once __DIR__ . '/../main.inc.php';
} elseif (file_exists('../../main.inc.php')) {
require_once __DIR__ . '/../../main.inc.php';
} else {
die('Include of main fails');
}
top_httphead('text/json');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) {
header('Cache-Control: max-age=10800, public, must-revalidate');
// For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server
header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800).' GMT');
} else {
header('Cache-Control: no-cache');
}
// Initialize technical objects
$manifest = new stdClass();
$manifest->short_name = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . '-DigiQuali';
$manifest->name = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . '-DigiQuali';
$manifest->icons = [];
$img = new stdClass();
$img->src = dol_buildpath('/digiquali/img/digiquali_color.svg', 1);
$img->type = 'image/svg+xml';
$img->sizes = '150x150';
$manifest->icons[] = $img;
$img = new stdClass();
$img->src = dol_buildpath('/digiquali/img/digiquali_color_192.png', 1);
$img->type = 'image/png';
$img->sizes = '192x192';
$manifest->icons[] = $img;
$img = new stdClass();
$img->src = dol_buildpath('/digiquali/img/digiquali_color_512.png', 1);
$img->type = 'image/png';
$img->sizes = '512x512';
$manifest->icons[] = $img;
$manifest->id = dol_buildpath('/digiquali/view/frontend/pwa_home.php', 1) . '?source=pwa';
$manifest->start_url = dol_buildpath('/digiquali/view/frontend/pwa_home.php', 1) . '?source=pwa';
$manifest->background_color = '#ffffff';
$manifest->display = 'standalone';
$manifest->display_override = ['window-controls-overlay'];
// The folder is resolved through one of its files: dol_buildpath() falls back to the main root for a path it cannot find
$manifest->scope = dirname(dol_buildpath('/digiquali/view/frontend/pwa_home.php', 1)) . '/';
$manifest->theme_color = '#ffffff';
$manifest->description = 'Système de management de la qualité pour Dolibarr';
$img = new stdClass();
$img->src = dol_buildpath('/digiquali/img/digiquali_color_512.png', 1);
$img->type = 'image/png';
$img->sizes = '512x512';
$img->form_factor = 'narrow';
$manifest->screenshots[] = $img;
$img = new stdClass();
$img->src = dol_buildpath('/digiquali/img/digiquali_color_512.png', 1);
$img->type = 'image/png';
$img->sizes = '512x512';
$img->form_factor = 'wide';
$manifest->screenshots[] = $img;
print json_encode($manifest);