From 026cf124afe72d417a9d8947df6f2a55d177e0ff Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 9 Aug 2012 16:35:39 +0200 Subject: [PATCH] Fix: avoid php warning --- htdocs/admin/security_other.php | 48 ++++++++++++++------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 2ba43a0aedf..dab17330f27 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * * 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 @@ -30,7 +30,10 @@ $langs->load("users"); $langs->load("admin"); $langs->load("other"); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$action=GETPOST('action','alpha'); $upload_dir=$conf->admin->dir_temp; @@ -46,57 +49,51 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) dol_add_file_process($upload_dir,0,0); } -if ($_GET["action"] == 'activate_captcha') +if ($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') +else if ($action == 'disable_captcha') { dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity); header("Location: security_other.php"); exit; } - -if ($_GET["action"] == 'activate_advancedperms') +else if ($action == 'activate_advancedperms') { dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity); header("Location: security_other.php"); exit; } -else if ($_GET["action"] == 'disable_advancedperms') +else if ($action == 'disable_advancedperms') { dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity); header("Location: security_other.php"); exit; } - -if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT') +else if ($action == 'MAIN_SESSION_TIMEOUT') { if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_UPLOAD_DOC') +else if ($action == 'MAIN_UPLOAD_DOC') { if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_UMASK') +else if ($action == 'MAIN_UMASK') { if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND') +else if ($action == 'MAIN_ANTIVIRUS_COMMAND') { if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_ANTIVIRUS_PARAM') +else if ($action == 'MAIN_ANTIVIRUS_PARAM') { if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); @@ -168,11 +165,11 @@ print ''.$langs->trans("UseCaptchaCode").''; print ''; if (function_exists("imagecreatefrompng")) { - if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0) + if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } - if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1) + else { print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } @@ -193,11 +190,11 @@ $var=!$var; print ""; print ''.$langs->trans("UseAdvancedPerms").''; print ''; -if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0) +if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } -if($conf->global->MAIN_USE_ADVANCED_PERMS == 1) +else { print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } @@ -274,7 +271,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 ''; +print ''; print ""; print ''; print ''; @@ -291,7 +288,7 @@ print ''.$langs->trans("AntiVirusParam").'
'; print $langs->trans("AntiVirusParamExample"); print ''; print ''; -print ''; +print ''; print ""; print ''; print ''; @@ -303,17 +300,12 @@ print ''; print ''; - // Form to test upload -dol_htmloutput_mesg($mesg); - -// Affiche formulaire upload print '
'; $formfile=new FormFile($db); $formfile->form_attach_new_file(DOL_URL_ROOT.'/admin/security_other.php',$langs->trans("FormToTestFileUploadForm"),0,0,1); llxFooter(); - $db->close(); ?>