dolibarr/htdocs/admin/index.php

158 lines
5.9 KiB
PHP
Raw Permalink Normal View History

<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2012-03-10 13:52:08 +01:00
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
2003-01-18 18:15:23 +01:00
*
* 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
2003-01-18 18:15:23 +01:00
* (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
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2003-01-18 18:15:23 +01:00
*/
/**
* \file htdocs/admin/index.php
2013-08-05 10:10:44 +02:00
* \brief Home page of setup area
*/
2022-09-07 20:08:59 +02:00
// Load Dolibarr environment
require '../main.inc.php';
2003-01-18 18:15:23 +01:00
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
2018-05-26 18:41:16 +02:00
// Load translation files required by the page
$langs->loadLangs(array('admin', 'companies'));
2022-09-12 11:06:55 +02:00
$action = '';
2021-02-26 22:04:03 +01:00
if (!$user->admin) {
accessforbidden();
}
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
2013-08-05 10:10:44 +02:00
$hookmanager->initHooks(array('homesetup'));
/*
2009-01-21 14:20:26 +01:00
* View
*/
2019-03-24 16:10:03 +01:00
$form = new Form($db);
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-index');
2019-09-27 11:51:34 +02:00
print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
2022-01-28 19:28:37 +01:00
if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
2024-12-12 14:47:48 +01:00
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
$i = 0;
2021-07-04 18:30:20 +02:00
$reg = array();
2024-12-12 14:47:48 +01:00
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', getDolGlobalString('MAIN_MOTD_SETUPPAGE'), $reg) && $i < 100) {
$tmp = explode('|', $reg[1]);
2021-02-26 22:04:03 +01:00
if (!empty($tmp[1])) {
$langs->load($tmp[1]);
}
2024-12-12 14:47:48 +01:00
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
$i++;
}
print "\n<!-- Start of welcome text for setup page -->\n";
print '<table width="100%" class="notopnoleftnoright"><tr><td>';
print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
print '</td></tr></table><br>';
print "\n<!-- End of welcome text for setup page -->\n";
}
}
2020-05-11 00:35:05 +02:00
print '<span class="opacitymedium hideonsmartphone">';
print $langs->trans("SetupDescription1").' ';
2009-09-07 03:06:05 +02:00
print $langs->trans("AreaForAdminOnly").' ';
2019-11-28 12:50:38 +01:00
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
print "<br><br>";
2020-05-11 00:35:05 +02:00
print '</span>';
2022-01-28 19:28:37 +01:00
print '<br>';
2013-08-05 10:10:44 +02:00
// Show info setup company
if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') || getDolGlobalString('MAIN_INFO_SOCIETE_SETUP_TODO_WARNING')) {
2021-02-26 22:04:03 +01:00
$setupcompanynotcomplete = 1;
}
2022-01-28 19:28:37 +01:00
print '<section class="setupsection">';
2021-09-27 12:24:01 +02:00
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"));
2021-10-19 19:52:18 +02:00
print '<br><br>';
print $langs->trans("SetupDescription3b");
2021-02-26 22:04:03 +01:00
if (!empty($setupcompanynotcomplete)) {
2012-10-18 10:36:53 +02:00
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
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>';
}
2022-01-28 19:28:37 +01:00
print '</section>';
print '<br>';
print '<br>';
2022-01-28 19:28:37 +01:00
print '<section class="setupsection">';
2013-08-05 10:10:44 +02:00
2024-06-19 18:21:19 +02:00
// Define $nbmodulesnotautoenabled - TODO This code is at different places
$nbmodulesnotautoenabled = count($conf->modules);
2024-06-19 18:21:19 +02:00
$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
foreach ($listofmodulesautoenabled as $moduleautoenable) {
if (in_array($moduleautoenable, $conf->modules)) {
$nbmodulesnotautoenabled--;
}
2023-12-04 11:41:14 +01:00
}
2013-08-05 10:10:44 +02:00
// Show info setup module
2021-08-10 12:26:41 +02:00
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"));
2021-08-10 11:40:25 +02:00
print '<br><br>'.$langs->trans("SetupDescription4b");
if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
2019-03-28 09:20:05 +01:00
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
}
2022-01-28 19:28:37 +01:00
print '</section>';
print '<br>';
2009-08-20 03:39:54 +02:00
print '<br>';
2014-02-02 19:00:56 +01:00
print '<br>';
2013-08-05 10:10:44 +02:00
// Add hook to add information
$parameters = array();
2022-09-12 11:06:55 +02:00
$object = new stdClass();
$reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
2013-08-05 10:10:44 +02:00
print $hookmanager->resPrint;
2021-02-26 22:04:03 +01:00
if (empty($reshook)) {
2013-08-05 10:10:44 +02:00
// Show into other
2022-09-12 11:06:55 +02:00
//print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
2021-10-05 08:55:57 +02:00
print '<br class="hideonsmartphone">';
2013-08-05 10:10:44 +02:00
// Show logo
2014-11-25 20:13:43 +01:00
print '<div class="center"><div class="logo_setup"></div></div>';
2013-08-05 10:10:44 +02:00
}
2003-01-18 18:15:23 +01:00
2018-07-28 18:03:14 +02:00
// End of page
llxFooter();
2013-01-10 18:50:07 +01:00
$db->close();