tighten psalm checks; fix errors

pull/298/head
David Goodwin 5 years ago
parent 034a50836c
commit 34e6f7829e

@ -78,14 +78,12 @@ class PFASmarty {
if (!is_array($data)) { if (!is_array($data)) {
return htmlentities($data, ENT_QUOTES, 'UTF-8', false); return htmlentities($data, ENT_QUOTES, 'UTF-8', false);
} }
if (is_array($data)) { $clean = array();
$clean = array(); foreach ($data as $key => $value) {
foreach ($data as $key => $value) { /* as this is a nested data structure it's more likely we'll output the key too (at least in my opinion, so we'll sanitise it too */
/* as this is a nested data structure it's more likely we'll output the key too (at least in my opinion, so we'll sanitise it too */ $clean[$this->sanitise($key)] = $this->sanitise($value);
$clean[$this->sanitise($key)] = $this->sanitise($value);
}
return $clean;
} }
return $clean;
} }
} }

@ -55,8 +55,6 @@
<MissingClosureParamType errorLevel="info" /> <MissingClosureParamType errorLevel="info" />
<MissingParamType errorLevel="info" /> <MissingParamType errorLevel="info" />
<RedundantCondition errorLevel="info" />
<DocblockTypeContradiction errorLevel="info" /> <DocblockTypeContradiction errorLevel="info" />
<RedundantConditionGivenDocblockType errorLevel="info" /> <RedundantConditionGivenDocblockType errorLevel="info" />

@ -317,27 +317,27 @@ if (isset($limit)) {
$gen_show_status_mailbox = array(); $gen_show_status_mailbox = array();
$divide_quota = array('current' => array(), 'quota' => array()); $divide_quota = array('current' => array(), 'quota' => array());
if ((is_array($tMailbox) and sizeof($tMailbox) > 0)) {
for ($i = 0; $i < sizeof($tMailbox); $i++) {
$gen_show_status_mailbox [$i] = gen_show_status($tMailbox[$i]['username']);
if (isset($tMailbox[$i]['current'])) { for ($i = 0; $i < sizeof($tMailbox); $i++) {
$divide_quota ['current'][$i] = divide_quota($tMailbox[$i]['current']); $gen_show_status_mailbox [$i] = gen_show_status($tMailbox[$i]['username']);
}
if (isset($tMailbox[$i]['quota'])) { if (isset($tMailbox[$i]['current'])) {
$divide_quota ['quota'][$i] = divide_quota($tMailbox[$i]['quota']); $divide_quota ['current'][$i] = divide_quota($tMailbox[$i]['current']);
} }
if (isset($tMailbox[$i]['quota']) && isset($tMailbox[$i]['current'])) { if (isset($tMailbox[$i]['quota'])) {
$divide_quota ['percent'][$i] = min(100, round(($divide_quota ['current'][$i]/max(1, $divide_quota ['quota'][$i]))*100)); $divide_quota ['quota'][$i] = divide_quota($tMailbox[$i]['quota']);
$divide_quota ['quota_width'][$i] = ($divide_quota ['percent'][$i] / 100 * 120); }
} else { if (isset($tMailbox[$i]['quota']) && isset($tMailbox[$i]['current'])) {
$divide_quota ['current'][$i] = Config::Lang('unknown'); $divide_quota ['percent'][$i] = min(100, round(($divide_quota ['current'][$i]/max(1, $divide_quota ['quota'][$i]))*100));
$divide_quota ['quota_width'][$i] = 0; # TODO: use special value? $divide_quota ['quota_width'][$i] = ($divide_quota ['percent'][$i] / 100 * 120);
} } else {
$divide_quota ['current'][$i] = Config::Lang('unknown');
$divide_quota ['quota_width'][$i] = 0; # TODO: use special value?
} }
} }
class cNav_bar { class cNav_bar {
protected $count; protected $count;
protected $title; protected $title;

@ -167,10 +167,7 @@ class PostfixAdmin {
return 1; return 1;
} }
$command = 'help'; # not the worst default ;-) $command = $this->args[0];
if (isset($this->args[0])) {
$command = $this->args[0];
}
$this->shellCommand = $command; $this->shellCommand = $command;
$this->shellClass = 'Cli' . ucfirst($command); $this->shellClass = 'Cli' . ucfirst($command);

Loading…
Cancel
Save