1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-08-09 05:02:44 +03:00

token formatting changes

This commit is contained in:
David Goodwin
2024-05-17 22:03:55 +01:00
parent 56dd787ce2
commit f3ce7e232d

View File

@@ -197,7 +197,7 @@ abstract class PFAHandler
$this->is_superadmin = 0;
}
if ($username != "" && (! authentication_has_role('global-admin'))) {
if ($username != "" && (!authentication_has_role('global-admin'))) {
$this->is_superadmin = 0;
}
@@ -413,7 +413,7 @@ abstract class PFAHandler
*/
public function prefill($field, $val)
{
$func = "_prefill_".$field;
$func = "_prefill_" . $field;
if (method_exists($this, $func)) {
$this->{$func}($field, $val); # call _missing_$fieldname()
} else {
@@ -452,7 +452,7 @@ abstract class PFAHandler
* - otherwise use the default value from $this->struct
* (if you don't want this, create an empty _missing_$fieldname() function)
*/
$func = "_missing_".$key;
$func = "_missing_" . $key;
if (method_exists($this, $func)) {
$this->{$func}($key); # call _missing_$fieldname()
} else {
@@ -485,7 +485,7 @@ abstract class PFAHandler
$valid = true; # trust input unless validator objects
# validate based on field type ($this->_inp_$type)
$func = "_inp_".$row['type'];
$func = "_inp_" . $row['type'];
if (method_exists($this, $func)) {
if (!$this->{$func}($key, $values[$key])) {
$valid = false;
@@ -495,7 +495,7 @@ abstract class PFAHandler
}
# validate based on field name (_validate_$fieldname)
$func = "_validate_".$key;
$func = "_validate_" . $key;
if (method_exists($this, $func)) {
if (!$this->{$func}($key, $values[$key])) {
$valid = false;
@@ -567,11 +567,11 @@ abstract class PFAHandler
foreach ($db_values as $key => $val) {
switch ($this->struct[$key]['type']) { # modify field content for some types
case 'bool':
$val = (string) $val;
$val = (string)$val;
$db_values[$key] = db_get_boolean($val);
break;
case 'pass':
$val = (string) $val;
$val = (string)$val;
$db_values[$key] = pacrypt($val); // throws Exception
break;
case 'b64p':
@@ -593,7 +593,7 @@ abstract class PFAHandler
try {
if ($this->new) {
$result = db_insert($this->db_table, $db_values, array('created', 'modified'),true);
$result = db_insert($this->db_table, $db_values, array('created', 'modified'), true);
} else {
$result = db_update($this->db_table, $this->id_field, $this->id, $db_values, array('modified'), true);
}
@@ -863,7 +863,7 @@ abstract class PFAHandler
}
/**
* Verify user's one time password reset token
* Verify user's one time password reset token.
* @param string $username
* @param string $token
* @return boolean true on success (i.e. code matches etc)