29require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43$langs->loadLangs(array(
"users",
"admin",
"other"));
49$action =
GETPOST(
'action',
'aZ09');
50$handler =
GETPOST(
'handler',
'aZ09');
57if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
61 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
66} elseif (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
69 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
74} elseif ($action ==
'setcaptchahandler') {
87$wikihelp =
'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
88llxHeader(
'', $langs->trans(
"Miscellaneous"), $wikihelp,
'', 0, 0,
'',
'',
'',
'mod-admin page-security_other');
92print
'<span class="opacitymedium">'.$langs->trans(
"CaptchaDesc").
"</span><br>\n";
95$dirModCaptcha = array_merge(array(
'/core/modules/security/captcha/'), (isset(
$conf->modules_parts[
'captcha']) && is_array(
$conf->modules_parts[
'captcha'])) ?
$conf->modules_parts[
'captcha'] : array());
98$arrayhandler = array();
100foreach ($dirModCaptcha as $dirroot) {
103 $handle = @opendir($dir);
106 if (is_resource($handle)) {
107 while (($file = readdir($handle)) !==
false) {
109 if (preg_match(
'/(modCaptcha[a-z]+)\.class\.php$/i', $file, $reg)) {
111 $classname = $reg[1];
112 require_once $dir.
'/'.$file;
114 $obj =
new $classname(
$db,
$conf, $langs, $user);
115 '@phan-var-force ModeleCaptcha $obj';
117 $arrayhandler[$obj->id] = $obj;
127print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
128print
'<input type="hidden" name="token" value="'.newToken().
'">';
129print
'<input type="hidden" name="action" value="updateform">';
138$showavailablecaptcha = 0;
140 $showavailablecaptcha = 1;
143print
'<div class="div-table-responsive">';
144print
'<table class="noborder centpercent">';
145print
'<tr class="liste_titre">';
146print
'<td>'.$langs->trans(
"Captcha").
'</td>';
147print
'<td class="right" width="100">'.$langs->trans(
"Status").
'</td>';
150print
'<tr class="oddeven"><td>' . $langs->trans(
"UseCaptchaCode").
' - Login</td><td class="right" width="100">';
151if (!empty(
$conf->use_javascript_ajax)) {
152 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA', array(),
null, 0, 0, 1);
155 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
157 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
163 print
'<tr class="oddeven"><td>' . $langs->trans(
"UseCaptchaCode").
' - Thirdparty public contact form</td><td class="right" width="100">';
164 if (!empty(
$conf->use_javascript_ajax)) {
165 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_THIRDPARTY', array(),
null, 0, 0, 1);
168 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_THIRDPARTY&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
170 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_THIRDPARTY&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
175 $showavailablecaptcha = 1;
180 print
'<tr class="oddeven"><td>' . $langs->trans(
"UseCaptchaCode").
' - Public ticket creation</td><td class="right" width="100">';
181 if (!empty(
$conf->use_javascript_ajax)) {
182 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_TICKET', array(),
null, 0, 0, 1);
185 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
187 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
191 $showavailablecaptcha = 1;
197 print
'<tr class="oddeven"><td>' . $langs->trans(
"UseCaptchaCode").
' - Membership public subscription</td><td class="right" width="100">';
198 if (!empty(
$conf->use_javascript_ajax)) {
199 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_MEMBER', array(),
null, 0, 0, 1);
202 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_MEMBER&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
204 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_MEMBER&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
208 $showavailablecaptcha = 1;
214 print
'<tr class="oddeven"><td>' . $langs->trans(
"UseCaptchaCode").
' - Donation public form</td><td class="right" width="100">';
215 if (!empty(
$conf->use_javascript_ajax)) {
216 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_DONATION', array(),
null, 0, 0, 1);
219 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_DONATION&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
221 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_DONATION&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
225 $showavailablecaptcha = 1;
231 print
'<tr class="oddeven"><td>' . $langs->trans(
"UseCaptchaCode").
' - Recruitment public form</td><td class="right" width="100">';
232 if (!empty(
$conf->use_javascript_ajax)) {
233 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_RECRUITMENT', array(),
null, 0, 0, 1);
236 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_RECRUITMENT&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
238 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_RECRUITMENT&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
242 $showavailablecaptcha = 1;
249 print
'<tr class="oddeven"><td>' . $langs->trans(
"UseCaptchaCode").
' - WebPortal public form</td><td class="right" width="100">';
250 if (!empty(
$conf->use_javascript_ajax)) {
251 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_WEBPORTAL', array(),
null, 0, 0, 1);
254 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=MAIN_SECURITY_ENABLECAPTCHA_WEBPORTAL&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
256 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=MAIN_SECURITY_ENABLECAPTCHA_WEBPORTAL&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
260 $showavailablecaptcha = 1;
269$selectedcaptcha =
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_HANDLER',
'standard');
271if ($showavailablecaptcha) {
277 print
'<div class="div-table-responsive">';
278 print
'<table class="noborder centpercent">';
279 print
'<tr class="liste_titre">';
280 print
'<td colspan="3">'.$langs->trans(
"Captcha").
'</td>';
281 print
'<td>'.$langs->trans(
"Example").
'</td>';
282 print
'<td class="right" width="100">'.$langs->trans(
"Status").
'</td>';
286 foreach ($arrayhandler as $key => $module) {
287 print
'<tr class="oddeven">';
288 print
'<td style="width: 26px" class="center">';
289 print
img_picto(
'', $module->picto,
'class="width25 size15x"');
295 print $module->getDescription().
'<br>';
298 print $module->getExample().
'<br>';
300 print
'<td class="right" width="100">';
302 if (function_exists(
"imagecreatefrompng")) {
303 if ($key != $selectedcaptcha) {
304 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=setcaptchahandler&token='.newToken().
'&value='.$key.
'">';
305 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
308 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
311 $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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.