*
* 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/security_other.php
* \ingroup core
* \brief Security options setup
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
$langs->load("users");
$langs->load("admin");
$langs->load("other");
if (!$user->admin) accessforbidden();
/*
* Actions
*/
if ($_GET["action"] == 'set_main_upload_doc')
{
if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity))
{
dol_print_error($db);
}
else
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
}
if ($_GET["action"] == 'activate_captcha')
{
dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity);
Header("Location: security_other.php");
exit;
}
else if ($_GET["action"] == 'disable_captcha')
{
dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity);
Header("Location: security_other.php");
exit;
}
if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT')
{
dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity);
Header("Location: security_other.php");
exit;
}
if ($_GET["action"] == 'MAIN_UMASK')
{
dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity);
Header("Location: security_other.php");
exit;
}
if ($_GET["action"] == 'activate_avscan')
{
dolibarr_set_const($db, "MAIN_USE_AVSCAN", '1','chaine',0,'',$conf->entity);
Header("Location: security_other.php");
exit;
}
else if ($_GET["action"] == 'disable_avscan')
{
dolibarr_del_const($db, "MAIN_USE_AVSCAN",$conf->entity);
Header("Location: security_other.php");
exit;
}
/*
* Affichage onglet
*/
llxHeader('',$langs->trans("Miscellanous"));
print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
print $langs->trans("MiscellanousDesc")."
\n";
print "
\n";
$head=security_prepare_head();
dol_fiche_head($head, 'misc', $langs->trans("Security"));
$var=false;
$form = new Form($db);
print '
';
print '';
print '| '.$langs->trans("Parameter").' | ';
print ''.$langs->trans("Value").' | ';
print ' | ';
print "
\n";
print '';
$var=!$var;
print '';
$var=!$var;
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=ini_get("session.gc_maxlifetime");
print '';
print '
';
print '
';
// Other Options
$var=true;
print '';
print '';
print '| '.$langs->trans("Parameters").' | ';
print ''.$langs->trans("Activated").' | ';
print ''.$langs->trans("Action").' | ';
print '
';
// Enable Captcha code
$var=!$var;
print "";
print '| '.$langs->trans("UseCaptchaCode").' | ';
print '';
if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1)
{
print img_tick();
}
print ' | ';
print '';
if (function_exists("imagecreatefrompng"))
{
if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0)
{
print ''.$langs->trans("Activate").'';
}
if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1)
{
print ''.$langs->trans("Disable").'';
}
}
else
{
$html = new Form($db);
$desc = $html->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning');
print $desc;
}
print " | ";
print "";
print '
';
print '
';
print '
';
// Antivirus options
$var=true;
print '';
print '';
print '| '.$langs->trans("AntiVirus").' | ';
print ''.$langs->trans("Activated").' | ';
print ''.$langs->trans("Action").' | ';
print '
';
// Enable AV scanner
$var=!$var;
print "";
print '| '.$langs->trans("UseAvToScanUploadedFiles");
if($conf->global->MAIN_USE_AVSCAN == 1)
{
print ' : ';
// Clamav
if (function_exists("cl_scanfile"))
{
print cl_info();
}
}
print ' | ';
print '';
if($conf->global->MAIN_USE_AVSCAN == 1)
{
print img_tick();
}
print ' | ';
print '';
if (function_exists("cl_scanfile")) // Clamav
{
if ($conf->global->MAIN_USE_AVSCAN == 0)
{
print ''.$langs->trans("Activate").'';
}
if($conf->global->MAIN_USE_AVSCAN == 1)
{
print ''.$langs->trans("Disable").'';
}
}
else
{
$html = new Form($db);
$desc = $html->textwithpicto('',$langs->transnoentities("EnablePhpAVModuleDesc"),1,'warning');
print $desc;
}
print " | ";
print "";
print '
';
print '
';
print '';
$db->close();
llxFooter('$Date$ - $Revision$');
?>