Correct incorrent mixing of tabs and spaces.
All code (including code originating from the blowfish PR) now correctly use tabs. Spaces are only used for alignment in comments where necessary.
This commit is contained in:
parent
24ce5d5833
commit
1c7340ce48
@ -687,16 +687,16 @@ function get_request($attr,$type='POST',$die=false,$default=null,$preventXSS=tru
|
|||||||
* Return valor escape XSS.
|
* Return valor escape XSS.
|
||||||
*/
|
*/
|
||||||
function preventXSS($data){
|
function preventXSS($data){
|
||||||
if (gettype($data) == 'array') {
|
if (gettype($data) == 'array') {
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
if (gettype($value) == 'array')
|
if (gettype($value) == 'array')
|
||||||
$data[$key] = preventXSS($value);
|
$data[$key] = preventXSS($value);
|
||||||
else
|
else
|
||||||
$data[$key] = htmlspecialchars($value);
|
$data[$key] = htmlspecialchars($value);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
|
return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1298,29 +1298,29 @@ function is_url_string($str) {
|
|||||||
/**
|
/**
|
||||||
* Compares 2 DNs. If they are equivelant, returns 0, otherwise,
|
* Compares 2 DNs. If they are equivelant, returns 0, otherwise,
|
||||||
* returns their sorting order (similar to strcmp()):
|
* returns their sorting order (similar to strcmp()):
|
||||||
* Returns < 0 if dn1 is less than dn2.
|
* Returns < 0 if dn1 is less than dn2.
|
||||||
* Returns > 0 if dn1 is greater than dn2.
|
* Returns > 0 if dn1 is greater than dn2.
|
||||||
*
|
*
|
||||||
* The comparison is performed starting with the top-most element
|
* The comparison is performed starting with the top-most element
|
||||||
* of the DN. Thus, the following list:
|
* of the DN. Thus, the following list:
|
||||||
* <code>
|
* <code>
|
||||||
* ou=people,dc=example,dc=com
|
* ou=people,dc=example,dc=com
|
||||||
* cn=Admin,ou=People,dc=example,dc=com
|
* cn=Admin,ou=People,dc=example,dc=com
|
||||||
* cn=Joe,ou=people,dc=example,dc=com
|
* cn=Joe,ou=people,dc=example,dc=com
|
||||||
* dc=example,dc=com
|
* dc=example,dc=com
|
||||||
* cn=Fred,ou=people,dc=example,dc=org
|
* cn=Fred,ou=people,dc=example,dc=org
|
||||||
* cn=Dave,ou=people,dc=example,dc=org
|
* cn=Dave,ou=people,dc=example,dc=org
|
||||||
* </code>
|
* </code>
|
||||||
* Will be sorted thus using usort( $list, "pla_compare_dns" ):
|
* Will be sorted thus using usort( $list, "pla_compare_dns" ):
|
||||||
* <code>
|
* <code>
|
||||||
* dc=com
|
* dc=com
|
||||||
* dc=example,dc=com
|
* dc=example,dc=com
|
||||||
* ou=people,dc=example,dc=com
|
* ou=people,dc=example,dc=com
|
||||||
* cn=Admin,ou=People,dc=example,dc=com
|
* cn=Admin,ou=People,dc=example,dc=com
|
||||||
* cn=Joe,ou=people,dc=example,dc=com
|
* cn=Joe,ou=people,dc=example,dc=com
|
||||||
* cn=Dave,ou=people,dc=example,dc=org
|
* cn=Dave,ou=people,dc=example,dc=org
|
||||||
* cn=Fred,ou=people,dc=example,dc=org
|
* cn=Fred,ou=people,dc=example,dc=org
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @param string The first of two DNs to compare
|
* @param string The first of two DNs to compare
|
||||||
* @param string The second of two DNs to compare
|
* @param string The second of two DNs to compare
|
||||||
@ -2151,7 +2151,7 @@ function password_types() {
|
|||||||
return array(
|
return array(
|
||||||
''=>'clear',
|
''=>'clear',
|
||||||
'bcrypt'=>'bcrypt',
|
'bcrypt'=>'bcrypt',
|
||||||
'blowfish'=>'blowfish',
|
'blowfish'=>'blowfish',
|
||||||
'crypt'=>'crypt',
|
'crypt'=>'crypt',
|
||||||
'ext_des'=>'ext_des',
|
'ext_des'=>'ext_des',
|
||||||
'md5'=>'md5',
|
'md5'=>'md5',
|
||||||
@ -2246,17 +2246,17 @@ function pla_password_hash($password_clear,$enc_type) {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'bcrypt':
|
case 'bcrypt':
|
||||||
$options = [
|
$options = [
|
||||||
'cost' => 8,
|
'cost' => 8,
|
||||||
];
|
];
|
||||||
#Checking if password_hash() function is available.
|
#Checking if password_hash() function is available.
|
||||||
if (function_exists('password_hash'))
|
if (function_exists('password_hash'))
|
||||||
$new_value = sprintf('{BCRYPT}%s',base64_encode(password_hash($password_clear, PASSWORD_BCRYPT, $options)));
|
$new_value = sprintf('{BCRYPT}%s',base64_encode(password_hash($password_clear, PASSWORD_BCRYPT, $options)));
|
||||||
else
|
else
|
||||||
error(_('Your PHP install does not have the password_hash() function. Cannot do BCRYPT hashes.'),'error','index.php');
|
error(_('Your PHP install does not have the password_hash() function. Cannot do BCRYPT hashes.'),'error','index.php');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 'smd5':
|
case 'smd5':
|
||||||
@ -2329,7 +2329,7 @@ function pla_password_hash($password_clear,$enc_type) {
|
|||||||
* @return Boolean True if the clear password matches the hash, and false otherwise.
|
* @return Boolean True if the clear password matches the hash, and false otherwise.
|
||||||
*/
|
*/
|
||||||
function password_check($cryptedpassword,$plainpassword,$attribute='userpassword') {
|
function password_check($cryptedpassword,$plainpassword,$attribute='userpassword') {
|
||||||
$plainpassword = htmlspecialchars_decode($plainpassword);
|
$plainpassword = htmlspecialchars_decode($plainpassword);
|
||||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||||
|
|
||||||
@ -2376,23 +2376,23 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#BCRYPT hashed passwords
|
|
||||||
case 'bcrypt':
|
|
||||||
# Check php password_verify support before using it
|
|
||||||
if (function_exists('password_verify')) {
|
|
||||||
$hash = base64_decode($cryptedpassword);
|
|
||||||
if (password_verify($plainpassword, $hash)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
#BCRYPT hashed passwords
|
||||||
error(_('Your PHP install does not have the password_verify() function. Cannot do Bcrypt hashes.'),'error','index.php');
|
case 'bcrypt':
|
||||||
}
|
# Check php password_verify support before using it
|
||||||
|
if (function_exists('password_verify')) {
|
||||||
|
$hash = base64_decode($cryptedpassword);
|
||||||
|
if (password_verify($plainpassword, $hash)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
} else {
|
||||||
|
error(_('Your PHP install does not have the password_verify() function. Cannot do Bcrypt hashes.'),'error','index.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
# Salted MD5
|
# Salted MD5
|
||||||
case 'smd5':
|
case 'smd5':
|
||||||
@ -3311,7 +3311,7 @@ function IsRobot($gResponse){
|
|||||||
$options = array(
|
$options = array(
|
||||||
'http' => array (
|
'http' => array (
|
||||||
'method' => 'POST','header' =>
|
'method' => 'POST','header' =>
|
||||||
'Content-Type: application/x-www-form-urlencoded',
|
'Content-Type: application/x-www-form-urlencoded',
|
||||||
'content' => http_build_query($data)
|
'content' => http_build_query($data)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user