Crypt field
Archived from the Xataface Users forum.
siainmi — Tue Oct 09, 2007 1:59 am
Hi,
I have some field as name and surname crypted in database, and, if is set session var with password, I have to
decrypt it with mcrypt function.
where I can modify record view value for all result set?
I try to work on function block__before_result_list with
$app =& Dataface_Application::getInstance(); // reference to Dataface_Application object
$query =& $app->getQuery();
$records =& df_get_records_array($query[‘-table’], $query);
foreach ($records as $record)
{
$record->htmlValue (“Nome”,$record->val(“Nome”).”criptato”);
}
but don’t work.
Thanks for help!!
shannah — Tue Oct 09, 2007 9:00 am
Probably better to do this by way of the xxx__display() methods in the delegate class. This allows you to override how a value is displayed.
e.g.
- Code: Select all
function Nome__display(&$record){ return my_decryption_function($record->val('Nome')); }
siainmi — Tue Oct 16, 2007 4:11 am
Hi now I have problems when edit fields,
Before edit I want that the fieds is decrypt and before update on databese is crypt,
there are a function like:
Nome__beforeEdit($records) and Nome__afterEdit($records)?
Thanks for all!!
shannah — Tue Oct 16, 2007 4:23 pm
I believe your are probably looking for xxx__pushValue() and xxx__pullValue().
http://weblite.ca/dataface/documentation/how-to/how-to-define-custom-serialization-for-fields
-Steve