Skip to content
Snippets Groups Projects
Commit 438e40f5 authored by Prasad's avatar Prasad
Browse files

Added helper methods to persist text with protection

parent 172f26c4
No related branches found
No related tags found
No related merge requests found
......@@ -1376,6 +1376,34 @@ class Vtiger_Functions {
return $jwt;
}
/**
* Function to mask input text.
*/
static function toProtectedText($text) {
require_once 'include/utils/encryption.php';
$encryption = new Encryption();
return '$ve$'.$encryption->encrypt($text);
}
/*
* Function to determine if text is masked.
*/
static function isProtectedText($text) {
return strpos($text, '$ve$') === 0;
}
/*
* Function to unmask the text.
*/
static function fromProtectedText($text) {
if (static::isProtectedText($text)) {
require_once 'include/utils/encryption.php';
$encryption = new Encryption();
return $encryption->decrypt(substr($text, 4));
}
return $text;
}
/*
* Function to convert file size in bytes to user displayable format
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment