dolibarr  7.0.0-beta
Functions
security2.lib.php File Reference

Set of function used for dolibarr security (not common functions). More...

Go to the source code of this file.

Functions

 dol_getwebuser ($mode)
 Return user/group account of web server. More...
 
 checkLoginPassEntity ($usertotest, $passwordtotest, $entitytotest, $authmode)
 Return a login if login/pass was successfull. More...
 
if(!function_exists('dol_loginfunction')) makesalt ($type=CRYPT_SALT_LENGTH)
 Show Dolibarr default login page. More...
 
 encodedecode_dbpassconf ($level=0)
 Encode or decode database password in config file. More...
 
 getRandomPassword ($generic=false)
 Return a generated password using default module. More...
 

Detailed Description

Set of function used for dolibarr security (not common functions).

Warning, this file must not depends on other library files, except function.lib.php because it is used at low code level.

Definition in file security2.lib.php.

Function Documentation

checkLoginPassEntity (   $usertotest,
  $passwordtotest,
  $entitytotest,
  $authmode 
)

Return a login if login/pass was successfull.

Parameters
string$usertotestLogin value to test
string$passwordtotestPassword value to test
string$entitytotestInstance of data we must check
array$authmodeArray list of selected authentication mode array('http', 'dolibarr', 'xxx'...)
Returns
string Login or ''

Definition at line 52 of file security2.lib.php.

References dol_buildpath(), dol_osencode(), dol_syslog(), and GETPOST().

Referenced by check_authentication(), Login\index(), and Auth\verif().

dol_getwebuser (   $mode)

Return user/group account of web server.

Parameters
string$mode'user' or 'group'
Returns
string Return user or group of web server

Definition at line 35 of file security2.lib.php.

encodedecode_dbpassconf (   $level = 0)

Encode or decode database password in config file.

Parameters
int$levelEncode level: 0 no encoding, 1 encoding
Returns
int <0 if KO, >0 if OK

Definition at line 343 of file security2.lib.php.

References conf(), dol_decode(), dol_encode(), and dol_syslog().

getRandomPassword (   $generic = false)

Return a generated password using default module.

Parameters
boolean$generictrue=Create generic password (32 chars/numbers), false=Use the configured password generation module
Returns
string New value for password

Definition at line 449 of file security2.lib.php.

Referenced by ActionsContactCardCommon\assign_values(), ActionsAdherentCardCommon\assign_values(), BlockedLog\getSignature(), Adherent\setPassword(), and User\setPassword().

if (!function_exists('dol_loginfunction')) makesalt (   $type = CRYPT_SALT_LENGTH)

Show Dolibarr default login page.

Part of this code is also duplicated into main.inc.php::top_htmlhead

Parameters
Translate$langsLang object (must be initialized by a new).
Conf$confConf object
Societe$mysocCompany object
Returns
void Fonction pour initialiser un salt pour la fonction crypt.
Parameters
int$type2=>renvoi un salt pour cryptage DES 12=>renvoi un salt pour cryptage MD5 non defini=>renvoi un salt pour cryptage par defaut
Returns
string Salt string

Definition at line 316 of file security2.lib.php.

References dol_strlen(), and dol_syslog().

Referenced by MailmanSpip\add_to_spip().