27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33$langs->loadLangs(array(
"users",
"admin",
"other"));
39$action =
GETPOST(
'action',
'aZ09');
47if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
51 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
56} elseif (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
59 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
64} elseif ($action ==
'updateform') {
70 if (GETPOSTISSET(
'MAIN_APPLICATION_TITLE')) {
71 $res1 =
dolibarr_set_const($db,
"MAIN_APPLICATION_TITLE",
GETPOST(
"MAIN_APPLICATION_TITLE",
'alphanohtml'),
'chaine', 0,
'', $conf->entity);
73 if (GETPOSTISSET(
'MAIN_SESSION_TIMEOUT')) {
74 $res2 =
dolibarr_set_const($db,
"MAIN_SESSION_TIMEOUT",
GETPOST(
"MAIN_SESSION_TIMEOUT",
'alphanohtml'),
'chaine', 0,
'', $conf->entity);
76 if (GETPOSTISSET(
'MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT')) {
77 $res3 =
dolibarr_set_const($db,
"MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT",
GETPOST(
"MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT",
'alphanohtml'),
'int', 0,
'', $conf->entity);
79 if (GETPOSTISSET(
'MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS')) {
80 $res4 =
dolibarr_set_const($db,
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS",
GETPOST(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS",
'alphanohtml'),
'int', 0,
'', $conf->entity);
82 if (GETPOSTISSET(
'MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS')) {
83 $res5 =
dolibarr_set_const($db,
"MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS",
GETPOST(
"MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS",
'alphanohtml'),
'int', 0,
'', $conf->entity);
85 if ($res1 && $res2 && $res3 && $res4 && $res5) {
86 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
98$wikihelp =
'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
99llxHeader(
'', $langs->trans(
"Miscellaneous"), $wikihelp,
'', 0, 0,
'',
'',
'',
'mod-admin page-security_other');
103print
'<span class="opacitymedium">'.$langs->trans(
"CaptchaDesc").
"</span><br>\n";
108$dir = DOL_DOCUMENT_ROOT.
"/core/modules/security/captcha";
110$handle = opendir($dir);
112$arrayhandler = array();
113if (is_resource($handle)) {
114 while (($file = readdir($handle)) !==
false) {
116 if (preg_match(
'/(modCaptcha[a-z]+)\.class\.php$/i', $file, $reg)) {
118 $classname = $reg[1];
119 require_once $dir.
'/'.$file;
121 $obj =
new $classname($db, $conf, $langs, $user);
122 '@phan-var-force ModeleCaptcha $obj';
123 $arrayhandler[$obj->id] = $obj;
133print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
134print
'<input type="hidden" name="token" value="'.newToken().
'">';
135print
'<input type="hidden" name="action" value="updateform">';
144print $langs->trans(
"UseCaptchaCode");
145if (!empty($conf->use_javascript_ajax)) {
146 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA', array(),
null, 0, 0, 1);
149 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
151 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
155if (isModEnabled(
'ticket')) {
157 print $langs->trans(
"TicketUseCaptchaCodeHelp");
158 if (!empty($conf->use_javascript_ajax)) {
159 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_TICKET', array(),
null, 0, 0, 1);
162 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
164 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
169$showavailablecaptcha = 0;
171 $showavailablecaptcha = 1;
173if (isModEnabled(
'ticket') &&
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_TICKET')) {
174 $showavailablecaptcha = 1;
177$selectedcaptcha =
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_HANDLER',
'standard');
179if ($showavailablecaptcha) {
185 print
'<table class="noborder centpercent">';
186 print
'<tr class="liste_titre">';
187 print
'<td colspan="2">'.$langs->trans(
"Captcha").
'</td>';
188 print
'<td>'.$langs->trans(
"Example").
'</td>';
189 print
'<td class="right" width="100">'.$langs->trans(
"Status").
'</td>';
193 foreach ($arrayhandler as $key => $module) {
194 print
'<tr class="oddeven">';
196 print
img_picto(
'', $module->picto,
'class="width25 size15x marginrightonly"').
' ';
200 print $module->getDescription().
'<br>';
203 print $module->getExample().
'<br>';
205 print
'<td class="right" width="100">';
207 if (function_exists(
"imagecreatefrompng")) {
208 if ($key != $selectedcaptcha) {
209 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=enabledcaptchahandler&token='.
newToken().
'&handler=standard"><input type="checkbox"></a>';
211 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=disablecaptchahandler&token='.
newToken().
'&handler=standard"><input type="checkbox" checked="checked"';
212 if (count($arrayhandler) <= 1) {
213 print
'disabled="disabled"';
218 $desc = $form->textwithpicto(
'', $langs->transnoentities(
"EnableGDLibraryDesc"), 1,
'warning');
security_prepare_head()
Prepare array with list of tabs.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.