fixed issue when no quotas are found

This commit is contained in:
Roland Gruber 2020-04-20 21:05:11 +02:00
parent 58882affa7
commit a52393dc79
1 changed files with 16 additions and 20 deletions

View File

@ -666,41 +666,37 @@ class quota extends baseModule {
if (empty($dirs)) { if (empty($dirs)) {
continue; continue;
} }
for ($i = 0; $i < sizeof($dirs); $i++) { $quotaDirs = array();
if (strpos($dirs[$i], self::$QUOTA_PREFIX) !== 0) { foreach ($dirs as $dirString) {
unset($dirs[$i]); if (strpos($dirString, self::$QUOTA_PREFIX) !== 0) {
$i--;
continue; continue;
} }
$dirs[$i] = substr($dirs[$i], strlen(self::$QUOTA_PREFIX)); $dirData = explode(",", substr($dirString, strlen(self::$QUOTA_PREFIX)));
$dirs[$i] = explode(",", $dirs[$i]); $quotaDirs[] = $dirData[0];
$dirs[$i] = $dirs[$i][0];
} }
$dirs = array_values($dirs); foreach ($quotaDirs as $dirName) {
for ($i = 0; $i < sizeof($dirs); $i++) { if (!empty($options["quota_softblock_" . $id . "_" . $dirName][0]) && !get_preg($options["quota_softblock_" . $id . "_" . $dirName][0], 'quotaNumber')) {
if (!empty($options["quota_softblock_" . $id . "_" . $dirs[$i]][0]) && !get_preg($options["quota_softblock_" . $id . "_" . $dirs[$i]][0], 'quotaNumber')) {
$return[] = $this->messages['softblock'][0]; $return[] = $this->messages['softblock'][0];
} }
if (!empty($options["quota_hardblock_" . $id . "_" . $dirs[$i]][0]) && !get_preg($options["quota_hardblock_" . $id . "_" . $dirs[$i]][0], 'quotaNumber')) { if (!empty($options["quota_hardblock_" . $id . "_" . $dirName][0]) && !get_preg($options["quota_hardblock_" . $id . "_" . $dirName][0], 'quotaNumber')) {
$return[] = $this->messages['hardblock'][0]; $return[] = $this->messages['hardblock'][0];
} }
if (!empty($options["quota_softinode_" . $id . "_" . $dirs[$i]][0]) && !get_preg($options["quota_softinode_" . $id . "_" . $dirs[$i]][0], 'quotaNumber')) { if (!empty($options["quota_softinode_" . $id . "_" . $dirName][0]) && !get_preg($options["quota_softinode_" . $id . "_" . $dirName][0], 'quotaNumber')) {
$return[] = $this->messages['softinode'][0]; $return[] = $this->messages['softinode'][0];
} }
if (!empty($options["quota_hardinode_" . $id . "_" . $dirs[$i]][0]) && !get_preg($options["quota_hardinode_" . $id . "_" . $dirs[$i]][0], 'quotaNumber')) { if (!empty($options["quota_hardinode_" . $id . "_" . $dirName][0]) && !get_preg($options["quota_hardinode_" . $id . "_" . $dirName][0], 'quotaNumber')) {
$return[] = $this->messages['hardinode'][0]; $return[] = $this->messages['hardinode'][0];
} }
if (!empty($options["quota_softblock_" . $id . "_" . $dirs[$i]][0]) if (!empty($options["quota_softblock_" . $id . "_" . $dirName][0])
&& !empty($options["quota_hardblock_" . $id . "_" . $dirs[$i]][0]) && !empty($options["quota_hardblock_" . $id . "_" . $dirName][0])
&& ($this->getQuotaNumber($options["quota_softblock_" . $id . "_" . $dirs[$i]][0]) > $this->getQuotaNumber($options["quota_hardblock_" . $id . "_" . $dirs[$i]][0]))) { && ($this->getQuotaNumber($options["quota_softblock_" . $id . "_" . $dirName][0]) > $this->getQuotaNumber($options["quota_hardblock_" . $id . "_" . $dirName][0]))) {
$return[] = $this->messages['block_cmp'][0]; $return[] = $this->messages['block_cmp'][0];
} }
if (!empty($options["quota_softinode_" . $id . "_" . $dirs[$i]][0]) if (!empty($options["quota_softinode_" . $id . "_" . $dirName][0])
&& !empty($options["quota_hardinode_" . $id . "_" . $dirs[$i]][0]) && !empty($options["quota_hardinode_" . $id . "_" . $dirName][0])
&& ($this->getQuotaNumber($options["quota_softinode_" . $id . "_" . $dirs[$i]][0]) > $this->getQuotaNumber($options["quota_hardinode_" . $id . "_" . $dirs[$i]][0]))) { && ($this->getQuotaNumber($options["quota_softinode_" . $id . "_" . $dirName][0]) > $this->getQuotaNumber($options["quota_hardinode_" . $id . "_" . $dirName][0]))) {
$return[] = $this->messages['inode_cmp'][0]; $return[] = $this->messages['inode_cmp'][0];
} }
$i++;
} }
} }
return $return; return $return;