@ -218,6 +218,7 @@ abstract class PFAHandler {
* text one line of text
* text one line of text
* *vtxt "virtual" line of text, coming from JOINs etc.
* *vtxt "virtual" line of text, coming from JOINs etc.
* pass password (will be encrypted with pacrypt())
* pass password (will be encrypted with pacrypt())
* b64p password (will be stored with base64_encode())
* num number
* num number
* txtl text "list" - array of one line texts
* txtl text "list" - array of one line texts
* *vnum "virtual" number, coming from JOINs etc.
* *vnum "virtual" number, coming from JOINs etc.
@ -228,7 +229,7 @@ abstract class PFAHandler {
* list like enum, but allow multiple selections
* list like enum, but allow multiple selections
* *quot used / total quota ("5 / 10") - for field "quotausage", there must also be a "_quotausage_percent" (type vnum)
* *quot used / total quota ("5 / 10") - for field "quotausage", there must also be a "_quotausage_percent" (type vnum)
* You can use custom types, but you'll have to add handling for them in *Handler and the smarty templates
* You can use custom types, but you'll have to add handling for them in *Handler and the smarty templates
*
*
* Field types marked with * will automatically be skipped in store().
* Field types marked with * will automatically be skipped in store().
*
*
* All database tables should have a 'created' and a 'modified' column.
* All database tables should have a 'created' and a 'modified' column.
@ -398,7 +399,12 @@ abstract class PFAHandler {
}
}
} else { # field is editable
} else { # field is editable
if (isset($values[$key])) {
if (isset($values[$key])) {
if ($row['type'] != "pass" || strlen($values[$key]) > 0 || $this->new == 1 || $this->skip_empty_pass != true) { # skip on empty (aka unchanged) password on edit
if (
($row['type'] != "pass" & & $row['type'] != 'b64p') || # field type is NOT 'pass' or 'b64p' - or -
strlen($values[$key]) > 0 || # new value is not empty - or -
$this->new == 1 || # create mode - or -
$this->skip_empty_pass != true # skip on empty (aka unchanged) password on edit
) {
# TODO: do not skip "password2" if "password" is filled, but "password2" is empty
# TODO: do not skip "password2" if "password" is filled, but "password2" is empty
$valid = true; # trust input unless validator objects
$valid = true; # trust input unless validator objects
@ -474,6 +480,9 @@ abstract class PFAHandler {
case 'pass':
case 'pass':
$db_values[$key] = pacrypt($db_values[$key]);
$db_values[$key] = pacrypt($db_values[$key]);
break;
break;
case 'b64p':
$db_values[$key] = base64_encode($db_values[$key]);
break;
case 'quot':
case 'quot':
case 'vnum':
case 'vnum':
case 'vtxt':
case 'vtxt':
@ -549,8 +558,10 @@ abstract class PFAHandler {
if (db_pgsql()) {
if (db_pgsql()) {
$formatted_date = "TO_DATE(text(###KEY###), '" . escape_string(Config::Lang('dateformat_pgsql')) . "')";
$formatted_date = "TO_DATE(text(###KEY###), '" . escape_string(Config::Lang('dateformat_pgsql')) . "')";
$base64_decode = "DECODE(###KEY###, 'base64')";
} else {
} else {
$formatted_date = "DATE_FORMAT(###KEY###, '" . escape_string(Config::Lang('dateformat_mysql')) . "')";
$formatted_date = "DATE_FORMAT(###KEY###, '" . escape_string(Config::Lang('dateformat_mysql')) . "')";
$base64_decode = "FROM_BASE64(###KEY###)";
}
}
$colformat = array(
$colformat = array(
@ -559,6 +570,7 @@ abstract class PFAHandler {
# 'bool' fields are always returned as 0/1, additonally _$field contains yes/no (already translated)
# 'bool' fields are always returned as 0/1, additonally _$field contains yes/no (already translated)
'bool' => "CASE ###KEY### WHEN '" . db_get_boolean(true) . "' THEN '1' WHEN '" . db_get_boolean(false) . "' THEN '0' END as ###KEY###," .
'bool' => "CASE ###KEY### WHEN '" . db_get_boolean(true) . "' THEN '1' WHEN '" . db_get_boolean(false) . "' THEN '0' END as ###KEY###," .
"CASE ###KEY### WHEN '" . db_get_boolean(true) . "' THEN '$yes' WHEN '" . db_get_boolean(false) . "' THEN '$no' END as _###KEY###",
"CASE ###KEY### WHEN '" . db_get_boolean(true) . "' THEN '$yes' WHEN '" . db_get_boolean(false) . "' THEN '$no' END as _###KEY###",
'b64p' => "$base64_decode AS ###KEY###",
);
);
# get list of fields to display
# get list of fields to display