diff --git a/ChangeLog b/ChangeLog index 084246050cd..0da3052021d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,7 +29,8 @@ For users: or credit note invoice. - New: task #10885: Add a week view for calendar - New: task #11018 : Add a status "not applicable" on event -- New: Add region/country statistics for member module. +- New: Add region/country statistics for member module. +- New: Can define a proxy for external web access. - Fix: Better Postgresql compatibility. For developers: diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php new file mode 100755 index 00000000000..0f8724e965c --- /dev/null +++ b/htdocs/admin/proxy.php @@ -0,0 +1,161 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/admin/proxyto.php + * \ingroup core + * \brief Page setup proxy to use for external web access + * \version $Id$ + */ + +require("../main.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); + +$langs->load("users"); +$langs->load("admin"); +$langs->load("other"); + + +if (!$user->admin) accessforbidden(); + +$upload_dir=$conf->admin->dir_temp; + + +/* + * Actions + */ + +if (GETPOST("action") == 'set_proxy') +{ + $result=0; + $result+=dolibarr_set_const($db, 'MAIN_PROXY_USE', $_POST["MAIN_PROXY_USE"], 'chaine',0,'',$conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_HOST',$_POST["MAIN_PROXY_HOST"],'chaine',0,'',$conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_PORT',$_POST["MAIN_PROXY_PORT"],'chaine',0,'',$conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_USER',$_POST["MAIN_PROXY_USER"],'chaine',0,'',$conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_PASS',$_POST["MAIN_PROXY_PASS"],'chaine',0,'',$conf->entity); + if ($result < 5) + { + dol_print_error($db); + } + else + { + $mesg='
'.$langs->trans("RecordModifiedSuccessfully").'
'; + } +} + + +/* + * View + */ + +$form = new Form($db); + +llxHeader('',$langs->trans("Proxy")); + +print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); + +print $langs->trans("ProxyDesc")."
\n"; +print "
\n"; + +$head=security_prepare_head(); + +dol_fiche_head($head, 'proxy', $langs->trans("Security")); + + +// Timeout +$var=true; + +print '
'; +print ''; +print ''; + +print ''; + +print ''; +print ''; +print ''; +print "\n"; + +$var=!$var; +print ''; +print ''; +print ''; +print ''; + +$var=!$var; +print ''; +print ''; +print ''; +print ''; + +$var=!$var; +print ''; +print ''; +print ''; +print ''; + +$var=!$var; +print ''; +print ''; +print ''; +print ''; + +$var=!$var; +print ''; +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("MAIN_PROXY_USE").''; +//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); +print ''; +print $form->selectyesno('MAIN_PROXY_USE',$conf->global->MAIN_PROXY_USE,1); +print '
'.$langs->trans("MAIN_PROXY_HOST").''; +//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); +print ''; +print ''; +print '
'.$langs->trans("MAIN_PROXY_PORT").''; +//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); +print ''; +print ''; +print '
'.$langs->trans("MAIN_PROXY_USER").''; +//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); +print ''; +print ''; +print '
'.$langs->trans("MAIN_PROXY_PASS").''; +//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); +print ''; +print ''; +print '
'; + +dol_fiche_end(); + +print '
'; +print ''; +print '
'; + +print '

'; + + +if ($mesg) print $mesg.'
'; + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index be98682262c..f84a46a7a27 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -172,7 +172,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $var=!$var; @@ -183,7 +183,7 @@ print ''; print ''; -print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'  
'.$langs->trans("SessionTimeOut").''; print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); print ''; +print ''; print ' '.$langs->trans("seconds"); print ''; @@ -202,14 +202,14 @@ $var=true; print ''; print ''; print ''; -print ''; +print ''; print ''; // Enable Captcha code $var=!$var; print ""; print ''; -print ''; $var=!$var; print ""; print ''; -print '
'.$langs->trans("Parameters").''.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("UseCaptchaCode").''; +print ''; if (function_exists("imagecreatefrompng")) { if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0) @@ -236,7 +236,7 @@ print '
'.$langs->trans("UseAdvancedPerms").''; +print ''; if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0) { print ''.img_picto($langs->trans("Disabled"),'off').''; @@ -262,7 +262,8 @@ $var=false; print ''; print ''; print ''; -print ''; +print ''; +print ''; print ''; print ''; @@ -273,10 +274,10 @@ $max=@ini_get('upload_max_filesize'); if ($max) print ' '.$langs->trans("MustBeLowerThanPHPLimit",$max*1024,$langs->trans("Kb")).'.'; else print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.'; print ''; -print ''; -print ''; print ''; @@ -288,10 +289,10 @@ print ''; print ''; -print ''; -print ''; print ''; @@ -305,7 +306,7 @@ print ''; -print '"; print '"; print ''; -print '"; print '\n"; dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); - + // Replace for encrypt data if (preg_match_all('/__ENCRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) { @@ -233,7 +233,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='') $newsql = str_replace($from,$to,$newsql); } } - + // Replace for decrypt data if (preg_match_all('/__DECRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) { @@ -475,27 +475,32 @@ function security_prepare_head() $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; - $head[$h][1] = $langs->trans("DefaultRights"); - $head[$h][2] = 'default'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/admin/security.php"; - $head[$h][1] = $langs->trans("Passwords"); - $head[$h][2] = 'passwords'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/proxy.php"; + $head[$h][1] = $langs->trans("Proxy"); + $head[$h][2] = 'proxy'; + $h++; $head[$h][0] = DOL_URL_ROOT."/admin/security_other.php"; $head[$h][1] = $langs->trans("Miscellanous"); $head[$h][2] = 'misc'; $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/security.php"; + $head[$h][1] = $langs->trans("Passwords"); + $head[$h][2] = 'passwords'; + $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/events.php"; $head[$h][1] = $langs->trans("Audit"); $head[$h][2] = 'audit'; $h++; - return $head; + $head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; + $head[$h][1] = $langs->trans("DefaultRights"); + $head[$h][2] = 'default'; + $h++; + + return $head; }
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Value").' 
'; +print ''; print ' '.$langs->trans("Kb"); print ''; +print ''; print ''; print '
'.$langs->trans("UMask").''; print $form->textwithpicto('',$langs->trans("UMaskExplanation")); print ''; +print ''; print ''; print ''; +print ''; print ''; print '
'.$langs->trans("AntiVirusCommand").'
'; print $langs->trans("AntiVirusCommandExample"); // Check command in inside safe_mode print '
'; +print ''; if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { $langs->load("errors"); @@ -317,7 +318,7 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); } } -print ''; +print ''; print "'; print ''; @@ -333,8 +334,8 @@ print "
'.$langs->trans("AntiVirusParam").'
'; print $langs->trans("AntiVirusParamExample"); print '
'; -print ''; +print ''; +print ''; print "'; print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b85ee31aa45..e7bec2e41b5 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -819,6 +819,12 @@ SomeTranslationAreUncomplete=Some languages may be partially translated or may c MenuUseLayout=Make vertical menu hidable (option javascript must not be disabled) MAIN_DISABLE_METEO=Disable meteo view TestLoginToAPI=Test login to API +ProxyDesc=Some features of Dolibarr need to have an Internet access to work. If the Dolibarr server is behind a Proxy server, those parameters tells Dolibarr how to access Internet through it. +MAIN_PROXY_USE=Use a proxy server +MAIN_PROXY_HOST=Name/Address of proxy server +MAIN_PROXY_PORT=Port of proxy server +MAIN_PROXY_USER=Login to use the proxy server +MAIN_PROXY_PASS=Password to use the proxy server ##### Module password generation PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 4f31368d7f1..1c88b3c68a7 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -829,7 +829,12 @@ SomeTranslationAreUncomplete=Certaines langues sont traduites partiellement ou p MenuUseLayout=Rendre le menu gauche cachable (L'option javascript ne doit pas avoir été désactivée) MAIN_DISABLE_METEO=Désactiver la vue météo TestLoginToAPI=Tester connexion à l'API - +ProxyDesc=Certaines fonction de Dolibarr nécessite que le serveur ait accès à internet. Si le serveur Dolibarr est derrière un proxy, ces paramètres indiquent à Dolibarr comment le traverser. +MAIN_PROXY_USE=Utiliser un serveur proxy mandataire +MAIN_PROXY_HOST=Nom/Adresse du serveur proxy mandataire +MAIN_PROXY_PORT=Port du serveur proxy mandataire +MAIN_PROXY_USER=Login pour passer le serveur proxy mandataire +MAIN_PROXY_PASS=Mot de passe pour passer le serveur proxy mandataire ##### Module password generation= undefined PasswordGenerationStandard= Renvoie un mot de passe généré selon algorithme interne Dolibarr: 8 caractères, chiffres et caractères en minuscules mélangés. PasswordGenerationNone= Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement. diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index bce9b2c1b97..282e0c2c3d2 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -220,7 +220,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='') // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) if (! $silent) print '
'.$langs->trans("Request").' '.($i+1)." sql='".$newsql."'