1<?php 2/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> 4 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20/** 21 * \file htdocs/admin/index.php 22 * \brief Home page of setup area 23 */ 24 25require '../main.inc.php'; 26 27// Load translation files required by the page 28$langs->loadLangs(array('admin', 'companies')); 29 30if (!$user->admin) accessforbidden(); 31 32// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context 33$hookmanager->initHooks(array('homesetup')); 34 35 36/* 37 * View 38 */ 39 40$form = new Form($db); 41 42$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; 43llxHeader('', $langs->trans("Setup"), $wikihelp); 44 45 46print load_fiche_titre($langs->trans("SetupArea"), '', 'tools'); 47 48if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) 49{ 50 $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE); 51 if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) 52 { 53 $i = 0; 54 while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) 55 { 56 $tmp = explode('|', $reg[1]); 57 if (!empty($tmp[1])) $langs->load($tmp[1]); 58 $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE); 59 $i++; 60 } 61 62 print "\n<!-- Start of welcome text for setup page -->\n"; 63 print '<table width="100%" class="notopnoleftnoright"><tr><td>'; 64 print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE); 65 print '</td></tr></table><br>'; 66 print "\n<!-- End of welcome text for setup page -->\n"; 67 } 68} 69 70print '<span class="opacitymedium hideonsmartphone">'; 71print $langs->trans("SetupDescription1").' '; 72print $langs->trans("AreaForAdminOnly").' '; 73print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules")); 74print "<br><br>"; 75print '</span>'; 76 77print '<br>'; 78 79// Show info setup company 80if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete = 1; 81print img_picto('', 'puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); 82if (!empty($setupcompanynotcomplete)) 83{ 84 $langs->load("errors"); 85 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"'); 86 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>'; 87} 88print '<br>'; 89print '<br>'; 90print '<br>'; 91 92// Show info setup module 93print img_picto('', 'puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); 94if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled 95{ 96 $langs->load("errors"); 97 $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"'); 98 print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>'; 99} 100print '<br>'; 101print '<br>'; 102print '<br>'; 103print '<br>'; 104 105// Add hook to add information 106$parameters = array(); 107$reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks 108print $hookmanager->resPrint; 109if (empty($reshook)) 110{ 111 // Show into other 112 print '<span class="opacitymedium">'.$langs->trans("SetupDescription5")."</span><br>"; 113 print "<br>"; 114 115 // Show logo 116 print '<div class="center"><div class="logo_setup"></div></div>'; 117} 118 119// End of page 120llxFooter(); 121$db->close(); 122