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