Uniformise look of PHP Info page.

This commit is contained in:
Laurent Destailleur 2012-09-21 00:13:20 +02:00
parent c5bda9b1d5
commit 5e9cd37107
9 changed files with 309 additions and 82 deletions

View File

@ -39,7 +39,7 @@ $form=new Form($db);
llxHeader();
print_fiche_titre($langs->trans("DatabaseConfiguration"),'','setup');
print_fiche_titre($langs->trans("InfoDatabase"),'','setup');
// Database
print '<table class="noborder" width="100%">';

View File

@ -42,7 +42,7 @@ $form=new Form($db);
llxHeader();
print_fiche_titre("Dolibarr",'','setup');
print_fiche_titre($langs->trans("InfoDolibarr"),'','setup');
// Version
$var=true;
@ -212,6 +212,228 @@ print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("File encodin
print '</table>';
print '<br>';
// Parameters in conf.php file (when a parameter start with ?, it is shown only if defined)
$configfileparameters=array(
'dolibarr_main_url_root',
'dolibarr_main_url_root_alt',
'dolibarr_main_document_root',
'dolibarr_main_document_root_alt',
'dolibarr_main_data_root',
'separator',
'dolibarr_main_db_host',
'dolibarr_main_db_port',
'dolibarr_main_db_name',
'dolibarr_main_db_type',
'dolibarr_main_db_user',
'dolibarr_main_db_pass',
'dolibarr_main_db_character_set',
'dolibarr_main_db_collation',
'?dolibarr_main_db_prefix',
'separator',
'dolibarr_main_authentication',
'separator',
'?dolibarr_main_auth_ldap_login_attribute',
'?dolibarr_main_auth_ldap_host',
'?dolibarr_main_auth_ldap_port',
'?dolibarr_main_auth_ldap_version',
'?dolibarr_main_auth_ldap_dn',
'?dolibarr_main_auth_ldap_admin_login',
'?dolibarr_main_auth_ldap_admin_pass',
'?dolibarr_main_auth_ldap_debug',
'separator',
'?dolibarr_lib_ADODB_PATH',
'?dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDI_PATH',
'?dolibarr_lib_NUSOAP_PATH',
'?dolibarr_lib_PHPEXCEL_PATH',
'?dolibarr_lib_GEOIP_PATH',
'?dolibarr_lib_ODTPHP_PATH',
'?dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'?dolibarr_js_CKEDITOR',
'?dolibarr_js_JQUERY',
'?dolibarr_js_JQUERY_UI',
'?dolibarr_js_JQUERY_FLOT',
'?dolibarr_font_DOL_DEFAULT_TTF',
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator',
'?dolibarr_mailing_limit_sendbyweb',
'?dolibarr_strict_mode'
);
$configfilelib=array(
// 'separator',
$langs->trans("URLRoot"),
$langs->trans("URLRoot").' (alt)',
$langs->trans("DocumentRootServer"),
$langs->trans("DocumentRootServer").' (alt)',
$langs->trans("DataRootServer"),
'separator',
$langs->trans("DatabaseServer"),
$langs->trans("DatabasePort"),
$langs->trans("DatabaseName"),
$langs->trans("DriverType"),
$langs->trans("DatabaseUser"),
$langs->trans("DatabasePassword"),
$langs->trans("DBStoringCharset"),
$langs->trans("DBSortingCharset"),
$langs->trans("Prefix"),
'separator',
$langs->trans("AuthenticationMode"),
'separator',
'dolibarr_main_auth_ldap_login_attribute',
'dolibarr_main_auth_ldap_host',
'dolibarr_main_auth_ldap_port',
'dolibarr_main_auth_ldap_version',
'dolibarr_main_auth_ldap_dn',
'dolibarr_main_auth_ldap_admin_login',
'dolibarr_main_auth_ldap_admin_pass',
'dolibarr_main_auth_ldap_debug',
'separator',
'dolibarr_lib_ADODB_PATH',
'dolibarr_lib_TCPDF_PATH',
'dolibarr_lib_FPDI_PATH',
'dolibarr_lib_NUSOAP_PATH',
'dolibarr_lib_PHPEXCEL_PATH',
'dolibarr_lib_GEOIP_PATH',
'dolibarr_lib_ODTPHP_PATH',
'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'dolibarr_js_CKEDITOR',
'dolibarr_js_JQUERY',
'dolibarr_js_JQUERY_UI',
'dolibarr_js_JQUERY_FLOT',
'dolibarr_font_DOL_DEFAULT_TTF',
'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator',
'Limit nb of email sent by page',
'Strict mode is on/off'
);
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="300">'.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print '</td>';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '</tr>'."\n";
$i=0;
foreach($configfileparameters as $key)
{
$ignore=0;
if ($key == 'dolibarr_main_url_root_alt' && empty(${
$key})) $ignore=1;
if ($key == 'dolibarr_main_document_root_alt' && empty(${
$key})) $ignore=1;
if (empty($ignore))
{
$newkey = preg_replace('/^\?/','',$key);
if (preg_match('/^\?/',$key) && empty(${
$newkey}))
{
$i++;
continue; // We discard parametes starting with ?
}
if ($newkey == 'separator' && $lastkeyshown == 'separator')
{
$i++;
continue;
}
$var=!$var;
print "<tr ".$bc[$var].">";
if ($newkey == 'separator')
{
print '<td colspan="3">&nbsp;</td>';
}
else
{
// Label
print "<td>".$configfilelib[$i].'</td>';
// Key
print '<td>'.$newkey.'</td>';
// Value
print "<td>";
if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${
$newkey});
else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${
$newkey})) print ${
$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${
$newkey})) print ${
$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
else print ${
$newkey};
if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently used by autodetect: '.DOL_MAIN_URL_ROOT.')';
print "</td>";
}
print "</tr>\n";
$lastkeyshown=$newkey;
}
$i++;
}
print '</table>';
print '<br>';
// Parameters in database
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").' '.$langs->trans("Database").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
if (empty($conf->multicompany->enabled) || !$user->entity) print '<td align="center">'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
print "</tr>\n";
$sql = "SELECT";
$sql.= " rowid";
$sql.= ", ".$db->decrypt('name')." as name";
$sql.= ", ".$db->decrypt('value')." as value";
$sql.= ", type";
$sql.= ", note";
$sql.= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
if (empty($conf->multicompany->enabled))
{
// If no multicompany mode, admins can see global and their constantes
$sql.= " WHERE entity IN (0,".$conf->entity.")";
}
else
{
// If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
if ($user->entity) $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
}
$sql.= " ORDER BY entity, name ASC";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$obj->name.'</td>'."\n";
print '<td>'.$obj->value.'</td>'."\n";
if (empty($conf->multicompany->enabled) || !$user->entity) print '<td align="center">'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
print "</tr>\n";
$i++;
}
}
print '</table>';
llxFooter();
$db->close();

View File

@ -35,7 +35,7 @@ if (!$user->admin)
llxHeader();
print_fiche_titre("OS",'','setup');
print_fiche_titre($langs->trans("InfoOS"),'','setup');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -23,13 +23,13 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin");
if (! $user->admin)
accessforbidden();
$what=GETPOST('what','alpha');
/*
@ -38,85 +38,63 @@ $what=GETPOST('what','alpha');
llxHeader();
/* Style phpinfo
body {background-color: #ffffff; color: #000000;}
body, td, th, h1, h2 {font-family: sans-serif;}
pre {margin: 0px; font-family: monospace;}
$title='InfoPHP';
a:link {color: #000099; text-decoration: none; background-color: #ffffff;}
a:hover {text-decoration: underline;}
table {border-collapse: collapse;}
.center {text-align: center;}
.center table { margin-left: auto; margin-right: auto; text-align: left;}
.center th { text-align: center !important; }
if (isset($title))
{
print_fiche_titre($langs->trans($title), '', 'setup');
}
td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
h1 {font-size: 150%;}
h2 {font-size: 125%;}
.p {text-align: left;}
.e {background-color: #ccccff; font-weight: bold; color: #000000;}
.h {background-color: #9999cc; font-weight: bold; color: #000000;}
.v {background-color: #cccccc; color: #000000;}
.vr {background-color: #cccccc; text-align: right; color: #000000;}
img {float: right; border: 0px;}
hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
*/
ob_start();
if ($what == 'conf')
// Get php_info array
$phparray=phpinfo_array();
foreach($phparray as $key => $value)
{
$title = 'Setup';
phpinfo(INFO_CONFIGURATION);
}
elseif ($what == 'env')
{
$title = 'OSEnv';
phpinfo(INFO_ENVIRONMENT);
}
elseif ($what == 'modules')
{
$title = 'Modules';
phpinfo(INFO_MODULES);
}
else
{
phpinfo();
}
//print_titre($key);
print '<table class="noborder">';
print '<tr class="liste_titre">';
//print '<td width="220px">'.$langs->trans("Parameter").'</td>';
print '<td width="220px">'.$key.'</td>';
print '<td colspan="2">'.$langs->trans("Value").'</td>';
print "</tr>\n";
$chaine = ob_get_contents();
ob_end_clean();
// Nettoie la sortie php pour inclusion dans une page deja existante
$chaine = preg_replace('/^<!DOCTYPE(.*)<div class="center">/ims', '', $chaine);
$chaine = preg_replace('/<\/div><\/body><\/html>$/im', '', $chaine);
$chaine = preg_replace('/table(.*)important; \}/i','',$chaine);
$chaine = str_replace('<hr />', '', $chaine);
$chaine = str_replace('cellpadding="3" ', 'cellpadding="1" cellspacing="1" ', $chaine);
$chaine = str_replace('class="h"','class="liste_titre"', $chaine);
$chaine = str_replace('<th colspan="2">', '<td>', $chaine);
$chaine = str_replace('th>', 'td>', $chaine);
// Titles
$chaine = preg_replace('/<h1([^>]*)>/i','<div class="titre">',$chaine);
$chaine = str_replace('<h2>', '<div class="titre">', $chaine);
$chaine = str_replace('</h1>', '</div><br>', $chaine);
$chaine = str_replace('</h2>', '</div>', $chaine);
$chaine = str_replace('<td class="e">', '<td class="impair">', $chaine);
$chaine = str_replace('<td class="v">', '<td class="pair">', $chaine);
$chaine = str_replace('<div class="titre">Configuration</div><br>', '', $chaine);
// Add LF
$chaine = preg_replace('/(pcntl_[a-z]+),/','$1, ',$chaine);
if (isset($title))
{
print_fiche_titre($langs->trans($title), '', 'setup');
print '<br>';
$var=true;
//var_dump($value);
foreach($value as $keyparam => $keyvalue)
{
if (! is_array($keyvalue))
{
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$keyparam.'</td>';
$valtoshow=$keyvalue;
if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80);
print '<td colspan="2">'.$valtoshow.'</td>';
print '</tr>';
}
else
{
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$keyparam.'</td>';
$i=0;
foreach($keyvalue as $keyparam2 => $keyvalue2)
{
print '<td>';
$valtoshow=$keyvalue2;
if ($keyparam == 'disable_functions') $valtoshow=join(', ',explode(',',trim($valtoshow)));
//print $keyparam2.' = ';
print $valtoshow;
$i++;
print '</td>';
}
print '</tr>';
}
}
print '</table><br>';
}
print "$chaine\n"; // Ne pas centrer la reponse php car certains tableau du bas tres large rendent ceux du haut completement a droite
print "<br>\n";
llxFooter();
$db->close();
?>

View File

@ -42,7 +42,7 @@ if (!$user->admin) accessforbidden();
llxHeader();
print_fiche_titre($langs->trans("WebServer"),'','setup');
print_fiche_titre($langs->trans("InfoWebServer"),'','setup');
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\"><td>".$langs->trans("Parameter")."</td><td>".$langs->trans("Value")."</td></tr>\n";

View File

@ -1202,4 +1202,33 @@ function delDocumentModel($name, $type)
}
}
/**
* Return the php_info into an array
*
* @return array Array with PHP infos
*/
function phpinfo_array()
{
ob_start();
phpinfo();
$info_arr = array();
$info_lines = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>")); // end of ob_start()
$cat = "General";
foreach($info_lines as $line)
{
// new cat?
preg_match("~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] : null;
if(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
{
$info_arr[trim($cat)][trim($val[1])] = $val[2];
}
elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
{
$info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]);
}
}
return $info_arr;
}
?>

View File

@ -36,7 +36,6 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk
-- Home - Sytem info
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 202__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/constall.php?leftmenu=admintools', 'AllParameters', 2, 'admin', '', '', 2, 1, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 208__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu==\'admintools\'', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 1, __ENTITY__);

View File

@ -690,7 +690,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
if (preg_match('/^admintools/',$leftmenu))
{
$newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1);
if ($leftmenu=='admintools_info') $newmenu->add('/admin/system/constall.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('AllParameters'), 2);
if ($leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2);
if ($leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2);
$newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1);

View File

@ -105,7 +105,7 @@ SendMailing=Envoi emailing
SendMail=Envoi mail
SentBy=Envoyé par
MailingNeedCommand=Pour des raisons de sécurité, il est recommandé de faire les envois d'un mailing de masse depuis une ligne de commande. Demandez à votre administrateur de lancer la commande suivante pour envoyer le mailing à tous les destinataires :
MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer en ligne en ajoutant le paramètre MAILING_LIMIT_SENDBYWEB avec la valeur du nombre max de mails envoyés par session d'envoi. Pour cela, aller dans Accueil - Configuration - Divers.
MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer par l'interface écrans en ajoutant le paramètre MAILING_LIMIT_SENDBYWEB avec la valeur du nombre max de mails envoyés par session d'envoi. Pour cela, aller dans Accueil - Configuration - Divers.
ConfirmSendingEmailing=Confirmez-vous l'envoi de l'emailing depuis le mode web ?
LimitSendingEmailing=L'envoi d'un emailing depuis les écrans est limité pour raisons de sécurité et de timeout à <b>%s</b> destinataires par session d'envoi.
TargetsReset=Vider liste