New: Can define a proxy for external web access.
This commit is contained in:
parent
65ea695df9
commit
45d5fa60f0
@ -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:
|
||||
|
||||
161
htdocs/admin/proxy.php
Executable file
161
htdocs/admin/proxy.php
Executable file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/* Copyright (C) 20011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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='<div class="ok">'.$langs->trans("RecordModifiedSuccessfully").'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("Proxy"));
|
||||
|
||||
print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
|
||||
|
||||
print $langs->trans("ProxyDesc")."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
$head=security_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'proxy', $langs->trans("Security"));
|
||||
|
||||
|
||||
// Timeout
|
||||
$var=true;
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_proxy">';
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("MAIN_PROXY_USE").'</td><td align="right">';
|
||||
//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print $form->selectyesno('MAIN_PROXY_USE',$conf->global->MAIN_PROXY_USE,1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("MAIN_PROXY_HOST").'</td><td align="right">';
|
||||
//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<input class="flat" name="MAIN_PROXY_HOST" type="text" size="16" value="'.$conf->global->MAIN_PROXY_HOST.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("MAIN_PROXY_PORT").'</td><td align="right">';
|
||||
//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<input class="flat" name="MAIN_PROXY_PORT" type="text" size="4" value="'.$conf->global->MAIN_PROXY_PORT.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("MAIN_PROXY_USER").'</td><td align="right">';
|
||||
//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<input class="flat" name="MAIN_PROXY_USER" type="text" size="16" value="'.$conf->global->MAIN_PROXY_USER.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("MAIN_PROXY_PASS").'</td><td align="right">';
|
||||
//print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<input class="flat" name="MAIN_PROXY_PASS" type="text" size="16" value="'.$conf->global->MAIN_PROXY_PASS.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</center>';
|
||||
|
||||
print '</form><br>';
|
||||
|
||||
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -172,7 +172,7 @@ print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td width="100"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=!$var;
|
||||
@ -183,7 +183,7 @@ print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("SessionTimeOut").'</td><td align="right">';
|
||||
print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<td nowrap="nowrap">';
|
||||
print '<input class="flat" name="MAIN_SESSION_TIMEOUT" type="text" size="6" value="'.htmlentities($conf->global->MAIN_SESSION_TIMEOUT).'"> '.$langs->trans("seconds");
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
@ -202,14 +202,14 @@ $var=true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("Parameters").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right" width="100">'.$langs->trans("Status").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Enable Captcha code
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
|
||||
print '<td align="center">';
|
||||
print '<td align="right">';
|
||||
if (function_exists("imagecreatefrompng"))
|
||||
{
|
||||
if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0)
|
||||
@ -236,7 +236,7 @@ print '</tr>';
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
|
||||
print '<td align="center">';
|
||||
print '<td align="right">';
|
||||
if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0)
|
||||
{
|
||||
print '<a href="security_other.php?action=activate_advancedperms">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
@ -262,7 +262,8 @@ $var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("Value").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td width="100"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?action=set_main_upload_doc" method="POST">';
|
||||
@ -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 '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<td nowrap="nowrap">';
|
||||
print '<input class="flat" name="MAIN_UPLOAD_DOC" type="text" size="6" value="'.htmlentities($conf->global->MAIN_UPLOAD_DOC).'"> '.$langs->trans("Kb");
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<td align="right">';
|
||||
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr></form>';
|
||||
@ -288,10 +289,10 @@ print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("UMask").'</td><td align="right">';
|
||||
print $form->textwithpicto('',$langs->trans("UMaskExplanation"));
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<td nowrap="nowrap">';
|
||||
print '<input class="flat" name="MAIN_UMASK" type="text" size="6" value="'.htmlentities($conf->global->MAIN_UMASK).'">';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<td align="right">';
|
||||
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr></form>';
|
||||
@ -305,7 +306,7 @@ print '<td colspan="2">'.$langs->trans("AntiVirusCommand").'<br>';
|
||||
print $langs->trans("AntiVirusCommandExample");
|
||||
// Check command in inside safe_mode
|
||||
print '</td>';
|
||||
print '<td align="center" width="100">';
|
||||
print '<td align="center">';
|
||||
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 '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size=80 value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND).'">';
|
||||
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND).'">';
|
||||
print "</td>";
|
||||
print '<td align="right">';
|
||||
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
|
||||
@ -333,8 +334,8 @@ print "<tr ".$bc[$var].">";
|
||||
print '<td colspan="2">'.$langs->trans("AntiVirusParam").'<br>';
|
||||
print $langs->trans("AntiVirusParamExample");
|
||||
print '</td>';
|
||||
print '<td align="center" width="100">';
|
||||
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size=80 value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM).'">';
|
||||
print '<td align="center">';
|
||||
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size="72" value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM).'">';
|
||||
print "</td>";
|
||||
print '<td align="right">';
|
||||
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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 '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".$newsql."'</td></tr>\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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user