index.php 4.2 KB

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