From b9a56701940ad24e47019212d23829014fc0aaf0 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 2 Dec 2009 19:01:08 +0000 Subject: [PATCH] check for ssh2 --- lam/lib/modules/posixAccount.inc | 8 +++++--- lam/lib/modules/quota.inc | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index fa4f838a..4de3357c 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -960,7 +960,9 @@ class posixAccount extends baseModule implements passwordService { array('kind' => 'text', 'text' => _('Home directory').'*'), array('kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]), array('kind' => 'help', 'value' => 'homeDirectory')); - if ($this->getAccountContainer()->isNewAccount && ($_SESSION['config']->get_scriptPath() != null) && ($_SESSION['config']->get_scriptPath() != '')) { + if ($this->getAccountContainer()->isNewAccount && ($_SESSION['config']->get_scriptPath() != null) + && ($_SESSION['config']->get_scriptPath() != '') + && extension_loaded('ssh2')) { // get list of lamdaemon servers $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); for ($i = 0; $i < sizeof($lamdaemonServers); $i++) { @@ -1006,7 +1008,7 @@ class posixAccount extends baseModule implements passwordService { * @return meta HTML code */ function display_html_delete() { - if ($this->get_scope() == 'user' && ($_SESSION['config']->get_scriptPath() != null)) { + if ($this->get_scope() == 'user' && ($_SESSION['config']->get_scriptPath() != null) && extension_loaded('ssh2')) { $return[] = array ( array('kind' => 'text', 'text' => _('Delete home directory')), array('kind' => 'input', 'name' => 'deletehomedir', 'type' => 'checkbox'), @@ -1096,7 +1098,7 @@ class posixAccount extends baseModule implements passwordService { array('kind' => 'select', 'name' => 'posixAccount_loginShell', 'options' => $shelllist, 'options_selected' => array("/bin/bash")), array('kind' => 'help', 'value' => 'loginShell', 'scope' => 'user')); // lamdaemon settings - if ($_SESSION['config']->get_scriptPath() != null) { + if (($_SESSION['config']->get_scriptPath() != null) && extension_loaded('ssh2')) { $return[] = array( array('kind' => 'text', 'text' => _('Create home directory') . ": "), array('kind' => 'input', 'type' => 'checkbox', 'name' => 'posixAccount_createHomedir'), diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index 0ae441df..f98ee941 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -155,6 +155,7 @@ class quota extends baseModule { * */ function initQuotas() { + if (!extension_loaded('ssh2')) return; if (isset($this->quota)) return; $userName = '+'; if (($this->getAccountContainer() != null) && !$this->getAccountContainer()->isNewAccount) { @@ -356,6 +357,11 @@ class quota extends baseModule { * @return array HTML meta data */ function display_html_attributes() { + if (!extension_loaded('ssh2')) { + return array( + array(array('kind' => 'text', 'text' => _('This module requires the PHP ssh2 extension.')) + )); + } $return = array(); $this->initQuotas(); if (!is_array($this->quota)) return $return;