better error handling if no server is specified

This commit is contained in:
Roland Gruber 2010-10-10 11:51:31 +00:00
parent f33bc2f3cb
commit a61cd561fb
2 changed files with 9 additions and 0 deletions

View File

@ -104,6 +104,9 @@ function lamdaemon($command, $server) {
* *
*/ */
function lamdaemonSeclib($command, $server) { function lamdaemonSeclib($command, $server) {
if ($server == '') {
return array();
}
// add phpseclib to include path // add phpseclib to include path
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/3rdParty/phpseclib'); set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/3rdParty/phpseclib');
include_once('Net/SSH2.php'); include_once('Net/SSH2.php');

View File

@ -176,6 +176,9 @@ class quota extends baseModule {
$server = $temp[0]; $server = $temp[0];
// get quotas // get quotas
$quotas = lamdaemon(implode(quota::$SPLIT_DELIMITER, array($userName, "quota", "get", $this->get_scope())), $server); $quotas = lamdaemon(implode(quota::$SPLIT_DELIMITER, array($userName, "quota", "get", $this->get_scope())), $server);
if (sizeof($quotas) == 0) {
continue;
}
$allQuotas = explode(":", $quotas[0]); $allQuotas = explode(":", $quotas[0]);
array_pop($allQuotas); // remove empty element at the end array_pop($allQuotas); // remove empty element at the end
for ($i = 0; $i < sizeof($allQuotas); $i++) { for ($i = 0; $i < sizeof($allQuotas); $i++) {
@ -463,6 +466,9 @@ class quota extends baseModule {
} }
// Get quotas // Get quotas
$quotas = lamdaemon(implode(quota::$SPLIT_DELIMITER, array("+", "quota", "get", $this->get_scope())), $server); $quotas = lamdaemon(implode(quota::$SPLIT_DELIMITER, array("+", "quota", "get", $this->get_scope())), $server);
if (sizeof($quotas) == 0) {
continue;
}
$dirs = explode(":", $quotas[0]); $dirs = explode(":", $quotas[0]);
array_pop($dirs); // remove empty element at the end array_pop($dirs); // remove empty element at the end
for ($i = 0; $i < sizeof($dirs); $i++) { for ($i = 0; $i < sizeof($dirs); $i++) {