28if (!defined(
'NOREQUIREUSER')) {
29 define(
'NOREQUIREUSER',
'1');
31if (!defined(
'NOREQUIRESOC')) {
32 define(
'NOREQUIRESOC',
'1');
34if (!defined(
'NOREQUIRETRAN')) {
35 define(
'NOREQUIRETRAN',
'1');
37if (!defined(
'NOTOKENRENEWAL')) {
38 define(
'NOTOKENRENEWAL',
'1');
40if (!defined(
'NOLOGIN')) {
41 define(
'NOLOGIN',
'1');
43if (!defined(
'NOREQUIREMENU')) {
44 define(
'NOREQUIREMENU',
'1');
46if (!defined(
'NOREQUIREHTML')) {
47 define(
'NOREQUIREHTML',
'1');
49if (!defined(
'NOREQUIREAJAX')) {
50 define(
'NOREQUIREAJAX',
'1');
52if (!defined(
'NOSESSION')) {
53 define(
'NOSESSION',
'1');
56require_once __DIR__.
'/../../main.inc.php';
60if (empty($dolibarr_nocache)) {
61 header(
'Cache-Control: max-age=10800, public, must-revalidate');
63 header(
'Expires: '.gmdate(
'D, d M Y H:i:s',
dol_now(
'gmt') + 10800).
' GMT');
65 header(
'Cache-Control: no-cache');
69$manifest =
new stdClass();
72$manifest->name = constant(
'DOL_APPLICATION_TITLE');
73if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
74 $manifest->name = $conf->global->MAIN_APPLICATION_TITLE;
76$manifest->short_name = $manifest->name;
79if (!preg_match(
'/#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]$/', $manifest->theme_color)) {
80 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
81 $manifest->theme_color =
'#'.colorArrayToHex(
colorStringToArray($manifest->theme_color));
83$manifest->background_color =
getDolGlobalString(
'MAIN_MANIFEST_APPLI_BG_COLOR',
"#ffffff");
84if (!preg_match(
'/#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]$/', $manifest->background_color)) {
85 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
86 $manifest->background_color =
'#'.colorArrayToHex(
colorStringToArray($manifest->background_color));
88$manifest->theme_color = empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR) ?
getDolGlobalString(
'THEME_ELDY_TOPMENU_BACK1',
'#F05F40') : $conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR;
89$manifest->background_color = empty($conf->global->MAIN_MANIFEST_APPLI_BG_COLOR) ?
"#ffffff" : $conf->global->MAIN_MANIFEST_APPLI_BG_COLOR;
90$manifest->display =
"standalone";
91$manifest->splash_pages =
null;
92$manifest->icons = array();
93$manifest->start_url = constant(
'DOL_MAIN_URL_ROOT');
94$manifest->id = constant(
'DOL_MAIN_URL_ROOT');
96if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
97 $icon =
new stdClass();
98 $icon->src = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL;
99 if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) {
100 $icon->sizes = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE.
"x".$conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE;
102 $icon->sizes =
"512x512";
104 $icon->type =
"image/png";
105 $manifest->icons[] = $icon;
106} elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
107 if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)) {
108 $iconRelativePath =
'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI;
109 $iconPath = $conf->mycompany->dir_output.
'/'.$iconRelativePath;
110 if (is_readable($iconPath)) {
111 $imgSize = getimagesize($iconPath);
112 if (!empty($imgSize)) {
113 $icon =
new stdClass();
114 $icon->src = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
115 $icon->sizes = $imgSize[0].
"x".$imgSize[1];
116 $icon->type =
"image/png";
117 $manifest->icons[] = $icon;
122 if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)) {
123 $iconRelativePath =
'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL;
124 $iconPath = $conf->mycompany->dir_output.
'/'.$iconRelativePath;
125 if (is_readable($iconPath)) {
126 $imgSize = getimagesize($iconPath);
128 $icon =
new stdClass();
129 $icon->src = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
130 $icon->sizes = $imgSize[0].
"x".$imgSize[1];
131 $icon->type =
"image/png";
132 $manifest->icons[] = $icon;
137 if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
138 $iconRelativePath =
'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED;
139 $iconPath = $conf->mycompany->dir_output.
'/'.$iconRelativePath;
140 if (is_readable($iconPath)) {
141 $imgSize = getimagesize($iconPath);
143 $icon =
new stdClass();
144 $icon->src = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
145 $icon->sizes = $imgSize[0].
"x".$imgSize[1];
146 $icon->type =
"image/png";
147 $manifest->icons[] = $icon;
154if (empty($manifest->icons)) {
155 $icon =
new stdClass();
156 $icon->src = DOL_URL_ROOT.
'/theme/dolibarr_256x256_color.png';
157 $icon->sizes =
"256x256";
158 $icon->type =
"image/png";
159 $manifest->icons[] = $icon;
163print json_encode($manifest);
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
dol_now($mode='auto')
Return date for now.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.