From a61cd561fb1b6cfe4ede01b28b1041a75f0b64ba Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 10 Oct 2010 11:51:31 +0000 Subject: [PATCH] better error handling if no server is specified --- lam/lib/lamdaemon.inc | 3 +++ lam/lib/modules/quota.inc | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/lam/lib/lamdaemon.inc b/lam/lib/lamdaemon.inc index 6faef023..e2e7757e 100644 --- a/lam/lib/lamdaemon.inc +++ b/lam/lib/lamdaemon.inc @@ -104,6 +104,9 @@ function lamdaemon($command, $server) { * */ function lamdaemonSeclib($command, $server) { + if ($server == '') { + return array(); + } // add phpseclib to include path set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/3rdParty/phpseclib'); include_once('Net/SSH2.php'); diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index aa6c01f2..b2c38f10 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -176,6 +176,9 @@ class quota extends baseModule { $server = $temp[0]; // get quotas $quotas = lamdaemon(implode(quota::$SPLIT_DELIMITER, array($userName, "quota", "get", $this->get_scope())), $server); + if (sizeof($quotas) == 0) { + continue; + } $allQuotas = explode(":", $quotas[0]); array_pop($allQuotas); // remove empty element at the end for ($i = 0; $i < sizeof($allQuotas); $i++) { @@ -463,6 +466,9 @@ class quota extends baseModule { } // Get quotas $quotas = lamdaemon(implode(quota::$SPLIT_DELIMITER, array("+", "quota", "get", $this->get_scope())), $server); + if (sizeof($quotas) == 0) { + continue; + } $dirs = explode(":", $quotas[0]); array_pop($dirs); // remove empty element at the end for ($i = 0; $i < sizeof($dirs); $i++) {