constall.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <?php
  2. /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
  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. * \file htdocs/admin/system/constall.php
  21. * \brief Page to show all Dolibarr setup (config file and database constants)
  22. */
  23. // Load Dolibarr environment
  24. require '../../main.inc.php';
  25. // Load translation files required by the page
  26. $langs->loadLangs(array("install", "user", "admin"));
  27. if (!$user->admin) {
  28. accessforbidden();
  29. }
  30. /*
  31. * View
  32. */
  33. llxHeader();
  34. print load_fiche_titre($langs->trans("SummaryConst"), '', 'title_setup');
  35. print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')');
  36. // Parameters in conf.php file (when a parameter start with ?, it is shown only if defined)
  37. $configfileparameters = array(
  38. 'dolibarr_main_url_root',
  39. 'dolibarr_main_url_root_alt',
  40. 'dolibarr_main_document_root',
  41. 'dolibarr_main_document_root_alt',
  42. 'dolibarr_main_data_root',
  43. 'separator',
  44. 'dolibarr_main_db_host',
  45. 'dolibarr_main_db_port',
  46. 'dolibarr_main_db_name',
  47. 'dolibarr_main_db_type',
  48. 'dolibarr_main_db_user',
  49. 'dolibarr_main_db_pass',
  50. 'dolibarr_main_db_character_set',
  51. 'dolibarr_main_db_collation',
  52. '?dolibarr_main_db_prefix',
  53. 'separator',
  54. 'dolibarr_main_authentication',
  55. 'separator',
  56. '?dolibarr_main_auth_ldap_login_attribute',
  57. '?dolibarr_main_auth_ldap_host',
  58. '?dolibarr_main_auth_ldap_port',
  59. '?dolibarr_main_auth_ldap_version',
  60. '?dolibarr_main_auth_ldap_dn',
  61. '?dolibarr_main_auth_ldap_admin_login',
  62. '?dolibarr_main_auth_ldap_admin_pass',
  63. '?dolibarr_main_auth_ldap_debug',
  64. 'separator',
  65. '?dolibarr_lib_FPDF_PATH',
  66. '?dolibarr_lib_TCPDF_PATH',
  67. '?dolibarr_lib_FPDI_PATH',
  68. '?dolibarr_lib_TCPDI_PATH',
  69. '?dolibarr_lib_NUSOAP_PATH',
  70. '?dolibarr_lib_GEOIP_PATH',
  71. '?dolibarr_lib_ODTPHP_PATH',
  72. '?dolibarr_lib_ODTPHP_PATHTOPCLZIP',
  73. '?dolibarr_js_CKEDITOR',
  74. '?dolibarr_js_JQUERY',
  75. '?dolibarr_js_JQUERY_UI',
  76. '?dolibarr_font_DOL_DEFAULT_TTF',
  77. '?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
  78. 'separator',
  79. '?dolibarr_mailing_limit_sendbyweb',
  80. '?dolibarr_mailing_limit_sendbycli',
  81. '?dolibarr_mailing_limit_sendbyday',
  82. '?dolibarr_strict_mode'
  83. );
  84. $configfilelib = array(
  85. // 'separator',
  86. $langs->trans("URLRoot"),
  87. $langs->trans("URLRoot").' (alt)',
  88. $langs->trans("DocumentRootServer"),
  89. $langs->trans("DocumentRootServer").' (alt)',
  90. $langs->trans("DataRootServer"),
  91. 'separator',
  92. $langs->trans("DatabaseServer"),
  93. $langs->trans("DatabasePort"),
  94. $langs->trans("DatabaseName"),
  95. $langs->trans("DriverType"),
  96. $langs->trans("DatabaseUser"),
  97. $langs->trans("DatabasePassword"),
  98. $langs->trans("DBStoringCharset"),
  99. $langs->trans("DBSortingCharset"),
  100. $langs->trans("Prefix"),
  101. 'separator',
  102. $langs->trans("AuthenticationMode"),
  103. 'separator',
  104. 'dolibarr_main_auth_ldap_login_attribute',
  105. 'dolibarr_main_auth_ldap_host',
  106. 'dolibarr_main_auth_ldap_port',
  107. 'dolibarr_main_auth_ldap_version',
  108. 'dolibarr_main_auth_ldap_dn',
  109. 'dolibarr_main_auth_ldap_admin_login',
  110. 'dolibarr_main_auth_ldap_admin_pass',
  111. 'dolibarr_main_auth_ldap_debug',
  112. 'separator',
  113. 'dolibarr_lib_TCPDF_PATH',
  114. 'dolibarr_lib_FPDI_PATH',
  115. 'dolibarr_lib_NUSOAP_PATH',
  116. 'dolibarr_lib_GEOIP_PATH',
  117. 'dolibarr_lib_ODTPHP_PATH',
  118. 'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
  119. 'dolibarr_js_CKEDITOR',
  120. 'dolibarr_js_JQUERY',
  121. 'dolibarr_js_JQUERY_UI',
  122. 'dolibarr_font_DOL_DEFAULT_TTF',
  123. 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
  124. 'separator',
  125. 'Limit nb of email sent by page',
  126. 'Strict mode is on/off'
  127. );
  128. print '<table class="noborder centpercent">';
  129. print '<tr class="liste_titre"><td width="280">'.$langs->trans("Label").'</td>';
  130. print '<td>'.$langs->trans("Parameter").'</td>';
  131. print '<td>'.$langs->trans("Value").'</td>';
  132. print '</tr>'."\n";
  133. $i = 0;
  134. foreach ($configfileparameters as $key) {
  135. $ignore = 0;
  136. if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) {
  137. $ignore = 1;
  138. }
  139. if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) {
  140. $ignore = 1;
  141. }
  142. if (empty($ignore)) {
  143. $newkey = preg_replace('/^\?/', '', $key);
  144. if (preg_match('/^\?/', $key) && empty(${$newkey})) {
  145. $i++;
  146. continue; // We discard parametes starting with ?
  147. }
  148. if ($newkey == 'separator' && $lastkeyshown == 'separator') {
  149. $i++;
  150. continue;
  151. }
  152. print '<tr class="oddeven">';
  153. if ($newkey == 'separator') {
  154. print '<td colspan="3">&nbsp;</td>';
  155. } else {
  156. // Label
  157. print "<td>".$configfilelib[$i].'</td>';
  158. // Key
  159. print '<td>'.$newkey.'</td>';
  160. // Value
  161. print "<td>";
  162. if ($newkey == 'dolibarr_main_db_pass') {
  163. print preg_replace('/./i', '*', ${$newkey});
  164. } elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) {
  165. print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
  166. } else {
  167. print ${$newkey};
  168. }
  169. if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) {
  170. print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
  171. }
  172. print "</td>";
  173. }
  174. print "</tr>\n";
  175. $lastkeyshown = $newkey;
  176. }
  177. $i++;
  178. }
  179. print '</table>';
  180. print '<br>';
  181. // Parameters in database
  182. print load_fiche_titre($langs->trans("Database"));
  183. print '<table class="noborder">';
  184. print '<tr class="liste_titre">';
  185. print '<td>'.$langs->trans("Parameter").'</td>';
  186. print '<td>'.$langs->trans("Value").'</td>';
  187. if (!isModEnabled('multicompany') || !$user->entity) {
  188. print '<td>'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
  189. }
  190. print "</tr>\n";
  191. $sql = "SELECT";
  192. $sql .= " rowid";
  193. $sql .= ", ".$db->decrypt('name')." as name";
  194. $sql .= ", ".$db->decrypt('value')." as value";
  195. $sql .= ", type";
  196. $sql .= ", note";
  197. $sql .= ", entity";
  198. $sql .= " FROM ".MAIN_DB_PREFIX."const";
  199. if (!isModEnabled('multicompany')) {
  200. // If no multicompany mode, admins can see global and their constantes
  201. $sql .= " WHERE entity IN (0,".$conf->entity.")";
  202. } else {
  203. // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
  204. if ($user->entity) {
  205. $sql .= " WHERE entity IN (".$db->sanitize($user->entity.",".$conf->entity).")";
  206. }
  207. }
  208. $sql .= " ORDER BY entity, name ASC";
  209. $resql = $db->query($sql);
  210. if ($resql) {
  211. $num = $db->num_rows($resql);
  212. $i = 0;
  213. while ($i < $num) {
  214. $obj = $db->fetch_object($resql);
  215. print '<tr class="oddeven">';
  216. print '<td>'.$obj->name.'</td>'."\n";
  217. print '<td>'.$obj->value.'</td>'."\n";
  218. if (!isModEnabled('multicompany') || !$user->entity) {
  219. print '<td>'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
  220. }
  221. print "</tr>\n";
  222. $i++;
  223. }
  224. }
  225. print '</table>';
  226. // End of page
  227. llxFooter();
  228. $db->close();