From ca727ca18e42829f437387a60a34c575ab89b612 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 12 Feb 2012 20:34:40 +0100 Subject: [PATCH] Qual: Move security functions into security2.lib.php --- htdocs/admin/system/web.php | 3 ++- htdocs/core/lib/files.lib.php | 13 ------------- htdocs/core/lib/security2.lib.php | 14 ++++++++++++++ htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/fr_FR/errors.lang | 1 + 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/system/web.php b/htdocs/admin/system/web.php index 4cb4ea4a653..6d237bdfff1 100644 --- a/htdocs/admin/system/web.php +++ b/htdocs/admin/system/web.php @@ -22,6 +22,7 @@ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'); $langs->load("admin"); @@ -62,5 +63,5 @@ print '</table>'; llxFooter(); -$db->close(''); +$db->close(); ?> diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b5843af4b3f..4bb630d685b 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -21,19 +21,6 @@ * \brief Library for file managing functions */ -/** - * Return user/group account of web server - * - * @param string $mode 'user' or 'group' - * @return string Return user or group of web server - */ -function dol_getwebuser($mode) -{ - $t='?'; - if ($mode=='user') $t=getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty - if ($mode=='group') $t=getenv('APACHE_RUN_GROUP'); - return $t; -} /** * Scan a directory and return a list of files/directories. diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 803245a5a84..c6d7863e83d 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -26,6 +26,20 @@ */ +/** + * Return user/group account of web server + * + * @param string $mode 'user' or 'group' + * @return string Return user or group of web server + */ +function dol_getwebuser($mode) +{ + $t='?'; + if ($mode=='user') $t=getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty + if ($mode=='group') $t=getenv('APACHE_RUN_GROUP'); + return $t; +} + /** * Return a login if login/pass was successfull * diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 65a342bf83a..f7451cfc506 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -102,6 +102,7 @@ ErrorLoginDoesNotExists=User with login <b>%s</b> could not be found. ErrorLoginHasNoEmail=This user has no email address. Process aborted. ErrorBadValueForCode=Bad value for security code. Try again with new value... ErrorBothFieldCantBeNegative=Fields %s and %s can't be both negative +ErrorWebServerUserHasNotPermission=User account <b>%s</b> used to execute web server has no permission for that # Warnings WarningSafeModeOnCheckExecDir=Warning, PHP option <b>safe_mode</b> is on so command must be stored inside a directory declared by php parameter <b>safe_mode_exec_dir</b>. diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 870589c8322..3d6cb1bf4dc 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -103,6 +103,7 @@ ErrorLoginDoesNotExists=Le compte utilisateur de login <b>%s</b> n'a pu être tr ErrorLoginHasNoEmail=Cet utilisateur n'a pas d'email. Impossible de continuer. ErrorBadValueForCode=Mauvaise valeur saisie pour le code. Réessayez avec une nouvelle valeur... ErrorBothFieldCantBeNegative=Les champs %s et %s ne peuvent être tous deux négatifs +ErrorWebServerUserHasNotPermission=Le compte d'execution du serveur web <b>%s</b> n'a pas les permissions pour cela # Warnings WarningSafeModeOnCheckExecDir=Attention, l'option PHP <b>safe_mode</b> est active, la commande doit dont être dans un répertoire déclaré dans le paramètre php <b>safe_mode_exec_dir</b>. -- GitLab