From 5ce44eff57c622c4a8b7283c17f0cbe7624e022e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 21 Sep 2012 08:50:23 +0200 Subject: [PATCH] Fix: more simple Fix: eclipse auto align is bad !!! ;-) --- htdocs/admin/system/dolibarr.php | 367 +++++++++++++------------------ 1 file changed, 151 insertions(+), 216 deletions(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 63e8088e62c..8ad87f5112d 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -213,224 +213,159 @@ print ''; print '
'; - -// 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 ''; + +// Parameters in conf.php file (when a parameter start with ?, it is shown only if defined) +$configfileparameters=array( + 'dolibarr_main_url_root' => $langs->trans("URLRoot"), + 'dolibarr_main_url_root_alt' => $langs->trans("URLRoot").' (alt)', + 'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"), + 'dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)', + 'dolibarr_main_data_root' => $langs->trans("DataRootServer"), + 'separator' => '', + 'dolibarr_main_db_host' => $langs->trans("DatabaseServer"), + 'dolibarr_main_db_port' => $langs->trans("DatabasePort"), + 'dolibarr_main_db_name' => $langs->trans("DatabaseName"), + 'dolibarr_main_db_type' => $langs->trans("DriverType"), + 'dolibarr_main_db_user' => $langs->trans("DatabaseUser"), + 'dolibarr_main_db_pass' => $langs->trans("DatabasePassword"), + 'dolibarr_main_db_character_set' => $langs->trans("DBStoringCharset"), + 'dolibarr_main_db_collation' => $langs->trans("DBSortingCollation"), + '?dolibarr_main_db_prefix' => $langs->trans("Prefix"), + 'separator' => '', + 'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"), + 'separator'=> '', + '?dolibarr_main_auth_ldap_login_attribute' => 'dolibarr_main_auth_ldap_login_attribute', + '?dolibarr_main_auth_ldap_host' => 'dolibarr_main_auth_ldap_host', + '?dolibarr_main_auth_ldap_port' => 'dolibarr_main_auth_ldap_port', + '?dolibarr_main_auth_ldap_version' => 'dolibarr_main_auth_ldap_version', + '?dolibarr_main_auth_ldap_dn' => 'dolibarr_main_auth_ldap_dn', + '?dolibarr_main_auth_ldap_admin_login' => 'dolibarr_main_auth_ldap_admin_login', + '?dolibarr_main_auth_ldap_admin_pass' => 'dolibarr_main_auth_ldap_admin_pass', + '?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug', + 'separator' => '', + '?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH', + '?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH', + '?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH', + '?dolibarr_lib_NUSOAP_PATH' => 'dolibarr_lib_NUSOAP_PATH', + '?dolibarr_lib_PHPEXCEL_PATH' => 'dolibarr_lib_PHPEXCEL_PATH', + '?dolibarr_lib_GEOIP_PATH' => 'dolibarr_lib_GEOIP_PATH', + '?dolibarr_lib_ODTPHP_PATH' => 'dolibarr_lib_ODTPHP_PATH', + '?dolibarr_lib_ODTPHP_PATHTOPCLZIP' => 'dolibarr_lib_ODTPHP_PATHTOPCLZIP', + '?dolibarr_js_CKEDITOR' => 'dolibarr_js_CKEDITOR', + '?dolibarr_js_JQUERY' => 'dolibarr_js_JQUERY', + '?dolibarr_js_JQUERY_UI' => 'dolibarr_js_JQUERY_UI', + '?dolibarr_js_JQUERY_FLOT' => 'dolibarr_js_JQUERY_FLOT', + '?dolibarr_font_DOL_DEFAULT_TTF' => 'dolibarr_font_DOL_DEFAULT_TTF', + '?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD', + 'separator' => '', + '?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page', + '?dolibarr_strict_mode' => 'Strict mode is on/off' +); + +$var=true; +print '
'; print ''; print ''; -print ''; -print ''; -print ''."\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 ""; - if ($newkey == 'separator') - { - print ''; - } - else - { - // Label - print "'; - // Key - print ''; - // Value - print ""; - } - print "\n"; - $lastkeyshown=$newkey; - } - $i++; -} -print '
'.$langs->trans("Parameters").' '; -print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')'; -print ''.$langs->trans("Parameter").''.$langs->trans("Value").'
 ".$configfilelib[$i].''.$newkey.'"; - 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 "
'; -print '
'; - - - -// Parameters in database -print ''; -print ''; -print ''; -print ''; -if (empty($conf->multicompany->enabled) || !$user->entity) print ''; // If superadmin or multicompany disabled -print "\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 ''; - print ''."\n"; - print ''."\n"; - if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled - print "\n"; - - $i++; - } -} - -print '
'.$langs->trans("Parameters").' '.$langs->trans("Database").''.$langs->trans("Value").''.$langs->trans("Entity").'
'.$obj->name.''.$obj->value.''.$obj->entity.'
'; +print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')'; +print ''; +print ''.$langs->trans("Parameter").''; +print ''.$langs->trans("Value").''; +print ''."\n"; + +foreach($configfileparameters as $key => $value) +{ + $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})) continue; // We discard parametes starting with ? + if ($newkey == 'separator' && $lastkeyshown == 'separator') continue; + + $var=!$var; + print ""; + if ($newkey == 'separator') + { + print ' '; + } + else + { + // Label + print "".$value.''; + // Key + print ''.$newkey.''; + // Value + print ""; + 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 ""; + } + print "\n"; + $lastkeyshown=$newkey; + } +} +print ''; +print '
'; + + + +// Parameters in database +print ''; +print ''; +print ''; +print ''; +if (empty($conf->multicompany->enabled) || !$user->entity) print ''; // If superadmin or multicompany disabled +print "\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 ''; + print ''."\n"; + print ''."\n"; + if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled + print "\n"; + + $i++; + } +} + +print '
'.$langs->trans("Parameters").' '.$langs->trans("Database").''.$langs->trans("Value").''.$langs->trans("Entity").'
'.$obj->name.''.$obj->value.''.$obj->entity.'
';