index.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/admin/index.php
  21. * \brief Home page of setup area
  22. */
  23. require '../main.inc.php';
  24. $langs->load("admin");
  25. $langs->load("companies");
  26. if (!$user->admin) accessforbidden();
  27. // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
  28. $hookmanager->initHooks(array('homesetup'));
  29. /*
  30. * View
  31. */
  32. $wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
  33. llxHeader('',$langs->trans("Setup"),$wikihelp);
  34. $form = new Form($db);
  35. print load_fiche_titre($langs->trans("SetupArea"),'','title_setup.png');
  36. if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
  37. {
  38. $conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$conf->global->MAIN_MOTD_SETUPPAGE);
  39. if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
  40. {
  41. $i=0;
  42. while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_MOTD_SETUPPAGE,$reg) && $i < 100)
  43. {
  44. $tmp=explode('|',$reg[1]);
  45. if (! empty($tmp[1])) $langs->load($tmp[1]);
  46. $conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_MOTD_SETUPPAGE);
  47. $i++;
  48. }
  49. print "\n<!-- Start of welcome text for setup page -->\n";
  50. print '<table width="100%" class="notopnoleftnoright"><tr><td>';
  51. print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
  52. print '</td></tr></table><br>';
  53. print "\n<!-- End of welcome text for setup page -->\n";
  54. }
  55. }
  56. print $langs->trans("SetupDescription1").' ';
  57. print $langs->trans("AreaForAdminOnly").' ';
  58. print $langs->trans("SetupDescription2")."<br><br>";
  59. print '<br>';
  60. // Show info setup company
  61. if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
  62. print img_picto('','puce').' '.$langs->trans("SetupDescription3",DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'));
  63. if (! empty($setupcompanynotcomplete))
  64. {
  65. $langs->load("errors");
  66. $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
  67. 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>';
  68. }
  69. print '<br>';
  70. print '<br>';
  71. print '<br>';
  72. // Show info setup module
  73. print img_picto('','puce').' '.$langs->trans("SetupDescription4",DOL_URL_ROOT.'/admin/modules.php?mainmenu=home');
  74. if (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
  75. {
  76. $langs->load("errors");
  77. $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
  78. print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
  79. }
  80. print '<br>';
  81. print '<br>';
  82. print '<br>';
  83. print '<br>';
  84. // Add hook to add information
  85. $parameters=array();
  86. $reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
  87. print $hookmanager->resPrint;
  88. if (empty($reshook))
  89. {
  90. // Show into other
  91. print $langs->trans("SetupDescription5")."<br>";
  92. print "<br>";
  93. // Show logo
  94. print '<div class="center"><div class="logo_setup"></div></div>';
  95. }
  96. llxFooter();
  97. $db->close();