Skip to content

Commit 1c7340c

Browse files
bertvandepoelleenooks
authored andcommitted
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.
1 parent 24ce5d5 commit 1c7340c

File tree

1 file changed

+59
-59
lines changed

1 file changed

+59
-59
lines changed

lib/functions.php

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -687,16 +687,16 @@ function get_request($attr,$type='POST',$die=false,$default=null,$preventXSS=tru
687687
* Return valor escape XSS.
688688
*/
689689
function preventXSS($data){
690-
if (gettype($data) == 'array') {
691-
foreach ($data as $key => $value) {
692-
if (gettype($value) == 'array')
693-
$data[$key] = preventXSS($value);
694-
else
695-
$data[$key] = htmlspecialchars($value);
696-
}
697-
return $data;
698-
}
699-
return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
690+
if (gettype($data) == 'array') {
691+
foreach ($data as $key => $value) {
692+
if (gettype($value) == 'array')
693+
$data[$key] = preventXSS($value);
694+
else
695+
$data[$key] = htmlspecialchars($value);
696+
}
697+
return $data;
698+
}
699+
return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
700700
}
701701

702702
/*
@@ -1298,29 +1298,29 @@ function is_url_string($str) {
12981298
/**
12991299
* Compares 2 DNs. If they are equivelant, returns 0, otherwise,
13001300
* returns their sorting order (similar to strcmp()):
1301-
* Returns < 0 if dn1 is less than dn2.
1302-
* Returns > 0 if dn1 is greater than dn2.
1301+
* Returns < 0 if dn1 is less than dn2.
1302+
* Returns > 0 if dn1 is greater than dn2.
13031303
*
13041304
* The comparison is performed starting with the top-most element
13051305
* of the DN. Thus, the following list:
1306-
* <code>
1307-
* ou=people,dc=example,dc=com
1308-
* cn=Admin,ou=People,dc=example,dc=com
1309-
* cn=Joe,ou=people,dc=example,dc=com
1310-
* dc=example,dc=com
1311-
* cn=Fred,ou=people,dc=example,dc=org
1312-
* cn=Dave,ou=people,dc=example,dc=org
1313-
* </code>
1306+
* <code>
1307+
* ou=people,dc=example,dc=com
1308+
* cn=Admin,ou=People,dc=example,dc=com
1309+
* cn=Joe,ou=people,dc=example,dc=com
1310+
* dc=example,dc=com
1311+
* cn=Fred,ou=people,dc=example,dc=org
1312+
* cn=Dave,ou=people,dc=example,dc=org
1313+
* </code>
13141314
* Will be sorted thus using usort( $list, "pla_compare_dns" ):
1315-
* <code>
1316-
* dc=com
1317-
* dc=example,dc=com
1318-
* ou=people,dc=example,dc=com
1319-
* cn=Admin,ou=People,dc=example,dc=com
1320-
* cn=Joe,ou=people,dc=example,dc=com
1321-
* cn=Dave,ou=people,dc=example,dc=org
1322-
* cn=Fred,ou=people,dc=example,dc=org
1323-
* </code>
1315+
* <code>
1316+
* dc=com
1317+
* dc=example,dc=com
1318+
* ou=people,dc=example,dc=com
1319+
* cn=Admin,ou=People,dc=example,dc=com
1320+
* cn=Joe,ou=people,dc=example,dc=com
1321+
* cn=Dave,ou=people,dc=example,dc=org
1322+
* cn=Fred,ou=people,dc=example,dc=org
1323+
* </code>
13241324
*
13251325
* @param string The first of two DNs to compare
13261326
* @param string The second of two DNs to compare
@@ -2151,7 +2151,7 @@ function password_types() {
21512151
return array(
21522152
''=>'clear',
21532153
'bcrypt'=>'bcrypt',
2154-
'blowfish'=>'blowfish',
2154+
'blowfish'=>'blowfish',
21552155
'crypt'=>'crypt',
21562156
'ext_des'=>'ext_des',
21572157
'md5'=>'md5',
@@ -2246,17 +2246,17 @@ function pla_password_hash($password_clear,$enc_type) {
22462246

22472247
break;
22482248

2249-
case 'bcrypt':
2250-
$options = [
2251-
'cost' => 8,
2252-
];
2253-
#Checking if password_hash() function is available.
2254-
if (function_exists('password_hash'))
2255-
$new_value = sprintf('{BCRYPT}%s',base64_encode(password_hash($password_clear, PASSWORD_BCRYPT, $options)));
2256-
else
2257-
error(_('Your PHP install does not have the password_hash() function. Cannot do BCRYPT hashes.'),'error','index.php');
2249+
case 'bcrypt':
2250+
$options = [
2251+
'cost' => 8,
2252+
];
2253+
#Checking if password_hash() function is available.
2254+
if (function_exists('password_hash'))
2255+
$new_value = sprintf('{BCRYPT}%s',base64_encode(password_hash($password_clear, PASSWORD_BCRYPT, $options)));
2256+
else
2257+
error(_('Your PHP install does not have the password_hash() function. Cannot do BCRYPT hashes.'),'error','index.php');
22582258

2259-
break;
2259+
break;
22602260

22612261

22622262
case 'smd5':
@@ -2329,7 +2329,7 @@ function pla_password_hash($password_clear,$enc_type) {
23292329
* @return Boolean True if the clear password matches the hash, and false otherwise.
23302330
*/
23312331
function password_check($cryptedpassword,$plainpassword,$attribute='userpassword') {
2332-
$plainpassword = htmlspecialchars_decode($plainpassword);
2332+
$plainpassword = htmlspecialchars_decode($plainpassword);
23332333
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
23342334
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
23352335

@@ -2376,23 +2376,23 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
23762376
return false;
23772377

23782378
break;
2379-
2380-
#BCRYPT hashed passwords
2381-
case 'bcrypt':
2382-
# Check php password_verify support before using it
2383-
if (function_exists('password_verify')) {
2384-
$hash = base64_decode($cryptedpassword);
2385-
if (password_verify($plainpassword, $hash)) {
2386-
return true;
2387-
} else {
2388-
return false;
2389-
}
2390-
2391-
} else {
2392-
error(_('Your PHP install does not have the password_verify() function. Cannot do Bcrypt hashes.'),'error','index.php');
2393-
}
2394-
2395-
break;
2379+
2380+
#BCRYPT hashed passwords
2381+
case 'bcrypt':
2382+
# Check php password_verify support before using it
2383+
if (function_exists('password_verify')) {
2384+
$hash = base64_decode($cryptedpassword);
2385+
if (password_verify($plainpassword, $hash)) {
2386+
return true;
2387+
} else {
2388+
return false;
2389+
}
2390+
2391+
} else {
2392+
error(_('Your PHP install does not have the password_verify() function. Cannot do Bcrypt hashes.'),'error','index.php');
2393+
}
2394+
2395+
break;
23962396

23972397
# Salted MD5
23982398
case 'smd5':
@@ -3311,7 +3311,7 @@ function IsRobot($gResponse){
33113311
$options = array(
33123312
'http' => array (
33133313
'method' => 'POST','header' =>
3314-
'Content-Type: application/x-www-form-urlencoded',
3314+
'Content-Type: application/x-www-form-urlencoded',
33153315
'content' => http_build_query($data)
33163316
)
33173317
);

0 commit comments

Comments
 (0)