28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
42$langs->loadLangs(array(
"users",
"admin",
"other"));
48$action =
GETPOST(
'action',
'aZ09');
49$handler =
GETPOST(
'handler',
'aZ09');
56if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
60 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
65} elseif (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
68 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
73} elseif ($action ==
'setcaptchahandler') {
86$wikihelp =
'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
87llxHeader(
'', $langs->trans(
"Miscellaneous"), $wikihelp,
'', 0, 0,
'',
'',
'',
'mod-admin page-security_other');
91print
'<span class="opacitymedium">'.$langs->trans(
"CaptchaDesc").
"</span><br>\n";
94$dirModCaptcha = array_merge(array(
'/core/modules/security/captcha/'), (isset(
$conf->modules_parts[
'captcha']) && is_array(
$conf->modules_parts[
'captcha'])) ?
$conf->modules_parts[
'captcha'] : array());
97$arrayhandler = array();
99foreach ($dirModCaptcha as $dirroot) {
102 $handle = @opendir($dir);
105 if (is_resource($handle)) {
106 while (($file = readdir($handle)) !==
false) {
108 if (preg_match(
'/(modCaptcha[a-z]+)\.class\.php$/i', $file, $reg)) {
110 $classname = $reg[1];
111 require_once $dir.
'/'.$file;
113 $obj =
new $classname($db,
$conf, $langs, $user);
114 '@phan-var-force ModeleCaptcha $obj';
116 $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">';
138print $langs->trans(
"UseCaptchaCode");
139if (!empty(
$conf->use_javascript_ajax)) {
140 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA', array(),
null, 0, 0, 1);
143 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
145 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
149if (isModEnabled(
'ticket')) {
151 print $langs->trans(
"TicketUseCaptchaCodeHelp");
152 if (!empty(
$conf->use_javascript_ajax)) {
153 print ajax_constantonoff(
'MAIN_SECURITY_ENABLECAPTCHA_TICKET', array(),
null, 0, 0, 1);
156 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
158 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_MAIN_SECURITY_ENABLECAPTCHA_TICKET&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
163$showavailablecaptcha = 0;
165 $showavailablecaptcha = 1;
167if (isModEnabled(
'ticket') &&
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_TICKET')) {
168 $showavailablecaptcha = 1;
171$selectedcaptcha =
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_HANDLER',
'standard');
173if ($showavailablecaptcha) {
179 print
'<table class="noborder centpercent">';
180 print
'<tr class="liste_titre">';
181 print
'<td colspan="2">'.$langs->trans(
"Captcha").
'</td>';
182 print
'<td>'.$langs->trans(
"Example").
'</td>';
183 print
'<td class="right" width="100">'.$langs->trans(
"Status").
'</td>';
187 foreach ($arrayhandler as $key => $module) {
188 print
'<tr class="oddeven">';
190 print
img_picto(
'', $module->picto,
'class="width25 size15x marginrightonly"').
' ';
194 print $module->getDescription().
'<br>';
197 print $module->getExample().
'<br>';
199 print
'<td class="right" width="100">';
201 if (function_exists(
"imagecreatefrompng")) {
202 if ($key != $selectedcaptcha) {
203 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=setcaptchahandler&token='.
newToken().
'&value='.$key.
'">';
204 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
207 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
210 $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.
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_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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.