Skip to content

Commit

Permalink
Check for LOWER() when building filter key for encyrpted fields, and …
Browse files Browse the repository at this point in the history
…build the LOWER(CONVERT(AES_DECRYPT())) command.
  • Loading branch information
cheesegrits committed Dec 8, 2017
1 parent d2497f2 commit c1d1217
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/com_fabrik/models/element.php
Expand Up @@ -4697,7 +4697,15 @@ public function encryptFieldName(&$key)
{
$db = FabrikWorker::getDbo();
$secret = $this->config->get('secret');
$key = 'AES_DECRYPT(' . $key . ', ' . $db->q($secret) . ')';
$matches = array();
if (preg_match('/LOWER\((.*)\)/', $key, $matches))
{
$key = 'LOWER(CONVERT(AES_DECRYPT(' . $matches[1] . ', ' . $db->q($secret) . ') USING utf8))';
}
else
{
$key = 'AES_DECRYPT(' . $key . ', ' . $db->q($secret) . ')';
}
}
}

Expand Down

0 comments on commit c1d1217

Please sign in to comment.