PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/admin/system/constall.php

https://bitbucket.org/speedealing/speedealing
PHP | 258 lines | 199 code | 27 blank | 32 comment | 39 complexity | 77cb89e5004441c8256e9ba5a11eb061 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  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@capnetworks.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 <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 (when a parameter start with ?, it is shown only if defined)
  36. $configfileparameters=array(
  37. 'dolibarr_main_url_root',
  38. 'dolibarr_main_url_root_alt',
  39. 'dolibarr_main_document_root',
  40. 'dolibarr_main_document_root_alt',
  41. 'dolibarr_main_data_root',
  42. 'separator',
  43. 'dolibarr_main_db_host',
  44. 'dolibarr_main_db_port',
  45. 'dolibarr_main_db_name',
  46. 'dolibarr_main_db_type',
  47. 'dolibarr_main_db_user',
  48. 'dolibarr_main_db_pass',
  49. 'dolibarr_main_db_character_set',
  50. 'dolibarr_main_db_collation',
  51. '?dolibarr_main_db_prefix',
  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_FPDI_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_js_CKEDITOR',
  73. '?dolibarr_js_JQUERY',
  74. '?dolibarr_js_JQUERY_UI',
  75. '?dolibarr_js_JQUERY_FLOT',
  76. '?dolibarr_font_DOL_DEFAULT_TTF',
  77. '?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
  78. 'separator',
  79. '?dolibarr_mailing_limit_sendbyweb',
  80. '?dolibarr_strict_mode'
  81. );
  82. $configfilelib=array(
  83. // 'separator',
  84. $langs->trans("URLRoot"),
  85. $langs->trans("URLRoot").' (alt)',
  86. $langs->trans("DocumentRootServer"),
  87. $langs->trans("DocumentRootServer").' (alt)',
  88. $langs->trans("DataRootServer"),
  89. 'separator',
  90. $langs->trans("DatabaseServer"),
  91. $langs->trans("DatabasePort"),
  92. $langs->trans("DatabaseName"),
  93. $langs->trans("DriverType"),
  94. $langs->trans("DatabaseUser"),
  95. $langs->trans("DatabasePassword"),
  96. $langs->trans("DBStoringCharset"),
  97. $langs->trans("DBSortingCharset"),
  98. $langs->trans("Prefix"),
  99. 'separator',
  100. $langs->trans("AuthenticationMode"),
  101. 'separator',
  102. 'dolibarr_main_auth_ldap_login_attribute',
  103. 'dolibarr_main_auth_ldap_host',
  104. 'dolibarr_main_auth_ldap_port',
  105. 'dolibarr_main_auth_ldap_version',
  106. 'dolibarr_main_auth_ldap_dn',
  107. 'dolibarr_main_auth_ldap_admin_login',
  108. 'dolibarr_main_auth_ldap_admin_pass',
  109. 'dolibarr_main_auth_ldap_debug',
  110. 'separator',
  111. 'dolibarr_lib_ADODB_PATH',
  112. 'dolibarr_lib_TCPDF_PATH',
  113. 'dolibarr_lib_FPDI_PATH',
  114. 'dolibarr_lib_NUSOAP_PATH',
  115. 'dolibarr_lib_PHPEXCEL_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_js_JQUERY_FLOT',
  123. 'dolibarr_font_DOL_DEFAULT_TTF',
  124. 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
  125. 'separator',
  126. 'Limit nb of email sent by page',
  127. 'Strict mode is on/off'
  128. );
  129. $var=true;
  130. print '<table class="noborder" width="100%">';
  131. print '<tr class="liste_titre"><td width="280">'.$langs->trans("Label").'</td>';
  132. print '<td>'.$langs->trans("Parameter").'</td>';
  133. print '<td>'.$langs->trans("Value").'</td>';
  134. print '</tr>'."\n";
  135. $i=0;
  136. foreach($configfileparameters as $key)
  137. {
  138. $ignore=0;
  139. if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) $ignore=1;
  140. if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) $ignore=1;
  141. if (empty($ignore))
  142. {
  143. $newkey = preg_replace('/^\?/','',$key);
  144. if (preg_match('/^\?/',$key) && empty(${$newkey}))
  145. {
  146. $i++;
  147. continue; // We discard parametes starting with ?
  148. }
  149. if ($newkey == 'separator' && $lastkeyshown == 'separator')
  150. {
  151. $i++;
  152. continue;
  153. }
  154. $var=!$var;
  155. print "<tr ".$bc[$var].">";
  156. if ($newkey == 'separator')
  157. {
  158. print '<td colspan="3">&nbsp;</td>';
  159. }
  160. else
  161. {
  162. // Label
  163. print "<td>".$configfilelib[$i].'</td>';
  164. // Key
  165. print '<td>'.$newkey.'</td>';
  166. // Value
  167. print "<td>";
  168. if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey});
  169. else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
  170. else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
  171. else print ${$newkey};
  172. if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
  173. print "</td>";
  174. }
  175. print "</tr>\n";
  176. $lastkeyshown=$newkey;
  177. }
  178. $i++;
  179. }
  180. print '</table>';
  181. print '<br>';
  182. // Parameters in database
  183. print_titre($langs->trans("Database"));
  184. print '<table class="noborder">';
  185. print '<tr class="liste_titre">';
  186. print '<td>'.$langs->trans("Parameter").'</td>';
  187. print '<td>'.$langs->trans("Value").'</td>';
  188. if (empty($conf->multicompany->enabled) || !$user->entity) print '<td>'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
  189. print "</tr>\n";
  190. $sql = "SELECT";
  191. $sql.= " rowid";
  192. $sql.= ", ".$db->decrypt('name')." as name";
  193. $sql.= ", ".$db->decrypt('value')." as value";
  194. $sql.= ", type";
  195. $sql.= ", note";
  196. $sql.= ", entity";
  197. $sql.= " FROM ".MAIN_DB_PREFIX."const";
  198. if (empty($conf->multicompany->enabled))
  199. {
  200. // If no multicompany mode, admins can see global and their constantes
  201. $sql.= " WHERE entity IN (0,".$conf->entity.")";
  202. }
  203. else
  204. {
  205. // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
  206. if ($user->entity) $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
  207. }
  208. $sql.= " ORDER BY entity, name ASC";
  209. $resql = $db->query($sql);
  210. if ($resql)
  211. {
  212. $num = $db->num_rows($resql);
  213. $i = 0;
  214. $var=True;
  215. while ($i < $num)
  216. {
  217. $obj = $db->fetch_object($resql);
  218. $var=!$var;
  219. print '<tr '.$bc[$var].'>';
  220. print '<td>'.$obj->name.'</td>'."\n";
  221. print '<td>'.$obj->value.'</td>'."\n";
  222. if (empty($conf->multicompany->enabled) || !$user->entity) print '<td>'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
  223. print "</tr>\n";
  224. $i++;
  225. }
  226. }
  227. print '</table>';
  228. print dol_fiche_end();
  229. llxFooter();
  230. $db->close();
  231. ?>