PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/admin/system/constall.php

https://github.com/asterix14/dolibarr
PHP | 240 lines | 181 code | 26 blank | 33 comment | 35 complexity | d4376b082cdf77aa99c6846c84e44e85 MD5 | raw file
Possible License(s): LGPL-2.0
  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@dolibarr.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 2 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/system/constall.php
  21. * \brief Page to show all Dolibarr setup (config file and database constants)
  22. */
  23. require("../../main.inc.php");
  24. $langs->load("admin");
  25. $langs->load("user");
  26. $langs->load("install");
  27. if (!$user->admin)
  28. accessforbidden();
  29. /*
  30. * View
  31. */
  32. llxHeader();
  33. print_fiche_titre($langs->trans("SummaryConst"),'','setup');
  34. print_titre($langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')');
  35. // Parameters in conf.php file
  36. $configfileparameters=array(
  37. // 'separator',
  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. 'separator',
  53. 'dolibarr_main_authentication',
  54. 'separator',
  55. '?dolibarr_main_auth_ldap_login_attribute',
  56. '?dolibarr_main_auth_ldap_host',
  57. '?dolibarr_main_auth_ldap_port',
  58. '?dolibarr_main_auth_ldap_version',
  59. '?dolibarr_main_auth_ldap_dn',
  60. '?dolibarr_main_auth_ldap_admin_login',
  61. '?dolibarr_main_auth_ldap_admin_pass',
  62. '?dolibarr_main_auth_ldap_debug',
  63. 'separator',
  64. '?dolibarr_lib_ADODB_PATH',
  65. '?dolibarr_lib_TCPDF_PATH',
  66. '?dolibarr_lib_FPDFI_PATH',
  67. '?dolibarr_lib_NUSOAP_PATH',
  68. '?dolibarr_lib_PHPEXCEL_PATH',
  69. '?dolibarr_lib_GEOIP_PATH',
  70. '?dolibarr_lib_ODTPHP_PATH',
  71. '?dolibarr_lib_ODTPHP_PATHTOPCLZIP',
  72. '?dolibarr_font_DOL_DEFAULT_TTF',
  73. '?dolibarr_font_DOL_DEFAULT_TTF_BOLD'
  74. );
  75. $configfilelib=array(
  76. // 'separator',
  77. $langs->trans("URLRoot"),
  78. $langs->trans("URLRoot").' (alt)',
  79. $langs->trans("DocumentRootServer"),
  80. $langs->trans("DocumentRootServer").' (alt)',
  81. $langs->trans("DataRootServer"),
  82. 'separator',
  83. $langs->trans("DatabaseServer"),
  84. $langs->trans("DatabasePort"),
  85. $langs->trans("DatabaseName"),
  86. $langs->trans("DriverType"),
  87. $langs->trans("DatabaseUser"),
  88. $langs->trans("DatabasePassword"),
  89. $langs->trans("DBStoringCharset"),
  90. $langs->trans("DBSortingCharset"),
  91. 'separator',
  92. $langs->trans("AuthenticationMode"),
  93. 'separator',
  94. 'dolibarr_main_auth_ldap_login_attribute',
  95. 'dolibarr_main_auth_ldap_host',
  96. 'dolibarr_main_auth_ldap_port',
  97. 'dolibarr_main_auth_ldap_version',
  98. 'dolibarr_main_auth_ldap_dn',
  99. 'dolibarr_main_auth_ldap_admin_login',
  100. 'dolibarr_main_auth_ldap_admin_pass',
  101. 'dolibarr_main_auth_ldap_debug',
  102. 'separator',
  103. 'dolibarr_lib_ADODB_PATH',
  104. 'dolibarr_lib_TCPDF_PATH',
  105. 'dolibarr_lib_FPDFI_PATH',
  106. 'dolibarr_lib_NUSOAP_PATH',
  107. 'dolibarr_lib_PHPEXCEL_PATH',
  108. 'dolibarr_lib_GEOIP_PATH',
  109. 'dolibarr_lib_ODTPHP_PATH',
  110. 'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
  111. 'dolibarr_font_DOL_DEFAULT_TTF',
  112. 'dolibarr_font_DOL_DEFAULT_TTF_BOLD'
  113. );
  114. $var=true;
  115. print '<table class="noborder" width="100%">';
  116. print '<tr class="liste_titre"><td width="280">'.$langs->trans("Label").'</td>';
  117. print '<td>'.$langs->trans("Parameter").'</td>';
  118. print '<td>'.$langs->trans("Value").'</td>';
  119. print '</tr>'."\n";
  120. $i=0;
  121. foreach($configfileparameters as $key)
  122. {
  123. $ignore=0;
  124. if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) $ignore=1;
  125. if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) $ignore=1;
  126. if (empty($ignore))
  127. {
  128. $newkey = preg_replace('/^\?/','',$key);
  129. if (preg_match('/^\?/',$key) && empty(${$newkey}))
  130. {
  131. $i++;
  132. continue; // We discard parametes starting with ?
  133. }
  134. if ($newkey == 'separator' && $lastkeyshown == 'separator')
  135. {
  136. $i++;
  137. continue;
  138. }
  139. $var=!$var;
  140. print "<tr ".$bc[$var].">";
  141. if ($newkey == 'separator')
  142. {
  143. print '<td colspan="3">&nbsp;</td>';
  144. }
  145. else
  146. {
  147. // Label
  148. print "<td>".$configfilelib[$i].'</td>';
  149. // Key
  150. print '<td>'.$newkey.'</td>';
  151. // Value
  152. print "<td>";
  153. if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey});
  154. else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
  155. else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
  156. else print ${$newkey};
  157. print "</td>";
  158. }
  159. print "</tr>\n";
  160. $lastkeyshown=$newkey;
  161. }
  162. $i++;
  163. }
  164. print '</table>';
  165. print '<br>';
  166. // Parameters in database
  167. print_titre($langs->trans("Database"));
  168. print '<table class="noborder">';
  169. print '<tr class="liste_titre">';
  170. print '<td>'.$langs->trans("Parameter").'</td>';
  171. print '<td>'.$langs->trans("Value").'</td>';
  172. if (empty($conf->multicompany->enabled) || !$user->entity) print '<td>'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
  173. print "</tr>\n";
  174. $sql = "SELECT";
  175. $sql.= " rowid";
  176. $sql.= ", ".$db->decrypt('name')." as name";
  177. $sql.= ", ".$db->decrypt('value')." as value";
  178. $sql.= ", type";
  179. $sql.= ", note";
  180. $sql.= ", entity";
  181. $sql.= " FROM ".MAIN_DB_PREFIX."const";
  182. if (empty($conf->multicompany->enabled))
  183. {
  184. // If no multicompany mode, admins can see global and their constantes
  185. $sql.= " WHERE entity IN (0,".$conf->entity.")";
  186. }
  187. else
  188. {
  189. // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
  190. if ($user->entity) $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
  191. }
  192. $sql.= " ORDER BY entity, name ASC";
  193. $resql = $db->query($sql);
  194. if ($resql)
  195. {
  196. $num = $db->num_rows($resql);
  197. $i = 0;
  198. $var=True;
  199. while ($i < $num)
  200. {
  201. $obj = $db->fetch_object($resql);
  202. $var=!$var;
  203. print '<tr '.$bc[$var].'>';
  204. print '<td>'.$obj->name.'</td>'."\n";
  205. print '<td>'.$obj->value.'</td>'."\n";
  206. if (empty($conf->multicompany->enabled) || !$user->entity) print '<td>'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
  207. print "</tr>\n";
  208. $i++;
  209. }
  210. }
  211. print '</table>';
  212. $db->close();
  213. llxFooter();
  214. ?>