- Timestamp:
- Mar 6, 2023 8:19:20 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r781 r783 1017 1017 * @since 09 Jun 2022 07:50:49 1018 1018 */ 1019 function base64 _encode_url($string) {1019 function base64EncodeURL($string) { 1020 1020 return str_replace(['+','/','='], ['-','_',''], base64_encode($string)); 1021 1021 } 1022 function base64 _decode_url($string) {1022 function base64DecodeURL($string) { 1023 1023 return base64_decode(str_replace(['-','_'], ['+','/'], $string)); 1024 1024 } … … 1373 1373 function verifySignature($signed_val, $salt=null, $length=18) 1374 1374 { 1375 $app =& App::getInstance(); 1376 1375 1377 // Strip the value from the signed value. 1376 1378 $val = removeSignature($signed_val); 1379 if ('' == $val) { 1380 // Removing the signature failed because it was empty or did not contain a hyphen. 1381 $app->logMsg(sprintf('Invalid signature ("%s" is not a valid signed value).', $signed_val), LOG_DEBUG, __FILE__, __LINE__); 1382 return false; 1383 } 1377 1384 // If the signed value matches the original signed value we consider the value safe. 1378 1385 if ('' != $signed_val && $signed_val == addSignature($val, $salt, $length)) { … … 1380 1387 return true; 1381 1388 } else { 1382 $app =& App::getInstance();1383 1389 // A signature mismatch might occur if the signing_key is not the same across all environments, apache, cli, etc. 1384 $app->logMsg(sprintf(' Failed signature (%s should be %s).', $signed_val, addSignature($val, $salt, $length)), LOG_DEBUG, __FILE__, __LINE__);1390 $app->logMsg(sprintf('Invalid signature (%s should be %s).', $signed_val, addSignature($val, $salt, $length)), LOG_DEBUG, __FILE__, __LINE__); 1385 1391 return false; 1386 1392 } … … 1443 1449 if (!isset($_SERVER['REMOTE_ADDR'])) { 1444 1450 // In some cases this won't be set, e.g., CLI scripts. 1445 return null;1451 return ''; 1446 1452 } 1447 1453
Note: See TracChangeset
for help on using the changeset viewer.