1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <[email protected]> |
4
|
|
|
* Copyright (C) 2004-2012 Laurent Destailleur <[email protected]> |
5
|
|
|
* Copyright (C) 2015 Jean-François Ferry <[email protected]> |
6
|
|
|
* Copyright (C) 2024 Rafael San José <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This program is free software; you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU General Public License as published by |
10
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
11
|
|
|
* (at your option) any later version. |
12
|
|
|
* |
13
|
|
|
* This program is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
* GNU General Public License for more details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU General Public License |
19
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace DoliModules\Admin\Controller; |
23
|
|
|
|
24
|
|
|
global $conf; |
25
|
|
|
global $db; |
26
|
|
|
global $user; |
27
|
|
|
global $hookmanager; |
28
|
|
|
global $user; |
29
|
|
|
global $menumanager; |
30
|
|
|
global $langs; |
31
|
|
|
global $mysoc; |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
// Load Dolibarr environment |
35
|
|
|
/* |
36
|
|
|
require BASE_PATH . '/main.inc.php'; |
37
|
|
|
require_once BASE_PATH . '/../Dolibarr/Lib/Admin.php'; |
38
|
|
|
require_once BASE_PATH . '/../Dolibarr/Lib/Company.php'; |
39
|
|
|
require_once BASE_PATH . '/../Dolibarr/Lib/Date.php'; |
40
|
|
|
require_once BASE_PATH . '/../Dolibarr/Lib/Images.php'; |
41
|
|
|
require_once BASE_PATH . '/../Dolibarr/Lib/Files.php'; |
42
|
|
|
require_once BASE_PATH . '/../Dolibarr/Lib/Functions2.php'; |
43
|
|
|
*/ |
44
|
|
|
|
45
|
|
|
use DoliCore\Base\DolibarrController; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* \file htdocs/admin/index.php |
49
|
|
|
* \brief Home page of setup area |
50
|
|
|
*/ |
51
|
|
|
class AdminController extends DolibarrController |
52
|
|
|
{ |
53
|
|
|
/** |
54
|
|
|
* \file htdocs/adherents/type.php |
55
|
|
|
* \ingroup member |
56
|
|
|
* \brief Member's type setup |
57
|
|
|
*/ |
58
|
|
|
public function index($executeActions = true): bool |
59
|
|
|
{ |
60
|
|
|
global $conf; |
61
|
|
|
global $db; |
62
|
|
|
global $user; |
63
|
|
|
global $hookmanager; |
64
|
|
|
global $user; |
65
|
|
|
global $menumanager; |
66
|
|
|
global $langs; |
67
|
|
|
global $mysoc; |
68
|
|
|
|
69
|
|
|
// Load translation files required by the page |
70
|
|
|
$langs->loadLangs(array('admin', 'companies')); |
71
|
|
|
|
72
|
|
|
$action = ''; |
73
|
|
|
|
74
|
|
|
if (!$user->admin) { |
75
|
|
|
accessforbidden(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
79
|
|
|
$hookmanager->initHooks(array('homesetup')); |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
/* |
83
|
|
|
* View |
84
|
|
|
*/ |
85
|
|
|
|
86
|
|
|
$form = new Form($db); |
87
|
|
|
|
88
|
|
|
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; |
89
|
|
|
llxHeader('', $langs->trans("Setup"), $wikihelp); |
90
|
|
|
|
91
|
|
|
|
92
|
|
|
print load_fiche_titre($langs->trans("SetupArea"), '', 'tools'); |
93
|
|
|
|
94
|
|
|
|
95
|
|
|
if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) { |
96
|
|
|
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE); |
97
|
|
|
if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) { |
98
|
|
|
$i = 0; |
99
|
|
|
$reg = array(); |
100
|
|
|
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) { |
101
|
|
|
$tmp = explode('|', $reg[1]); |
102
|
|
|
if (!empty($tmp[1])) { |
103
|
|
|
$langs->load($tmp[1]); |
104
|
|
|
} |
105
|
|
|
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\(' . preg_quote($reg[1]) . '\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE); |
106
|
|
|
$i++; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
print "\n<!-- Start of welcome text for setup page -->\n"; |
110
|
|
|
print '<table width="100%" class="notopnoleftnoright"><tr><td>'; |
111
|
|
|
print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE); |
112
|
|
|
print '</td></tr></table><br>'; |
113
|
|
|
print "\n<!-- End of welcome text for setup page -->\n"; |
114
|
|
|
} |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
print '<span class="opacitymedium hideonsmartphone">'; |
118
|
|
|
print $langs->trans("SetupDescription1") . ' '; |
119
|
|
|
print $langs->trans("AreaForAdminOnly") . ' '; |
120
|
|
|
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules")); |
121
|
|
|
print "<br><br>"; |
122
|
|
|
print '</span>'; |
123
|
|
|
|
124
|
|
|
print '<br>'; |
125
|
|
|
|
126
|
|
|
// Show info setup company |
127
|
|
|
if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') || getDolGlobalString('MAIN_INFO_SOCIETE_SETUP_TODO_WARNING')) { |
128
|
|
|
$setupcompanynotcomplete = 1; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
print '<section class="setupsection">'; |
132
|
|
|
|
133
|
|
|
print img_picto('', 'company', 'class="paddingright valignmiddle double"') . ' ' . $langs->trans("SetupDescriptionLink", DOL_URL_ROOT . '/admin/company.php?mainmenu=home' . (empty($setupcompanynotcomplete) ? '' : '&action=edit&token=' . newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); |
134
|
|
|
print '<br><br>'; |
135
|
|
|
print $langs->trans("SetupDescription3b"); |
136
|
|
|
if (!empty($setupcompanynotcomplete)) { |
137
|
|
|
$langs->load("errors"); |
138
|
|
|
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"'); |
139
|
|
|
print '<br><div class="warning"><a href="' . DOL_URL_ROOT . '/admin/company.php?mainmenu=home' . (empty($setupcompanynotcomplete) ? '' : '&action=edit') . '">' . $warnpicto . $langs->trans("WarningMandatorySetupNotComplete") . '</a></div>'; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
print '</section>'; |
143
|
|
|
|
144
|
|
|
print '<br>'; |
145
|
|
|
print '<br>'; |
146
|
|
|
|
147
|
|
|
print '<section class="setupsection">'; |
148
|
|
|
|
149
|
|
|
$nbmodulesnotautoenabled = count($conf->modules); |
150
|
|
|
if (in_array('fckeditor', $conf->modules)) { |
151
|
|
|
$nbmodulesnotautoenabled--; |
152
|
|
|
} |
153
|
|
|
if (in_array('export', $conf->modules)) { |
154
|
|
|
$nbmodulesnotautoenabled--; |
155
|
|
|
} |
156
|
|
|
if (in_array('import', $conf->modules)) { |
157
|
|
|
$nbmodulesnotautoenabled--; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
// Show info setup module |
161
|
|
|
print img_picto('', 'cog', 'class="paddingright valignmiddle double"') . ' ' . $langs->trans("SetupDescriptionLink", DOL_URL_ROOT . '/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); |
162
|
|
|
print '<br><br>' . $langs->trans("SetupDescription4b"); |
163
|
|
|
if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled |
164
|
|
|
$langs->load("errors"); |
165
|
|
|
$warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"'); |
166
|
|
|
print '<br><div class="warning"><a href="' . DOL_URL_ROOT . '/admin/modules.php?mainmenu=home">' . $warnpicto . $langs->trans("WarningEnableYourModulesApplications") . '</a></div>'; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
print '</section>'; |
170
|
|
|
|
171
|
|
|
print '<br>'; |
172
|
|
|
print '<br>'; |
173
|
|
|
print '<br>'; |
174
|
|
|
|
175
|
|
|
// Add hook to add information |
176
|
|
|
$parameters = array(); |
177
|
|
|
$object = new stdClass(); |
|
|
|
|
178
|
|
|
$reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
179
|
|
|
print $hookmanager->resPrint; |
180
|
|
|
if (empty($reshook)) { |
181
|
|
|
// Show into other |
182
|
|
|
//print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>"; |
183
|
|
|
print '<br class="hideonsmartphone">'; |
184
|
|
|
|
185
|
|
|
// Show logo |
186
|
|
|
print '<div class="center"><div class="logo_setup"></div></div>'; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
// End of page |
190
|
|
|
llxFooter(); |
191
|
|
|
$db->close(); |
|
|
|
|
192
|
|
|
} |
193
|
|
|
} |
194
|
|
|
|