check for ssh2

This commit is contained in:
Roland Gruber 2009-12-02 19:01:08 +00:00
parent d4e5575fbb
commit b9a5670194
2 changed files with 11 additions and 3 deletions

View File

@ -960,7 +960,9 @@ class posixAccount extends baseModule implements passwordService {
array('kind' => 'text', 'text' => _('Home directory').'*'), array('kind' => 'text', 'text' => _('Home directory').'*'),
array('kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]), array('kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]),
array('kind' => 'help', 'value' => 'homeDirectory')); 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 // get list of lamdaemon servers
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
for ($i = 0; $i < sizeof($lamdaemonServers); $i++) { for ($i = 0; $i < sizeof($lamdaemonServers); $i++) {
@ -1006,7 +1008,7 @@ class posixAccount extends baseModule implements passwordService {
* @return meta HTML code * @return meta HTML code
*/ */
function display_html_delete() { 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 ( $return[] = array (
array('kind' => 'text', 'text' => _('Delete home directory')), array('kind' => 'text', 'text' => _('Delete home directory')),
array('kind' => 'input', 'name' => 'deletehomedir', 'type' => 'checkbox'), 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' => 'select', 'name' => 'posixAccount_loginShell', 'options' => $shelllist, 'options_selected' => array("/bin/bash")),
array('kind' => 'help', 'value' => 'loginShell', 'scope' => 'user')); array('kind' => 'help', 'value' => 'loginShell', 'scope' => 'user'));
// lamdaemon settings // lamdaemon settings
if ($_SESSION['config']->get_scriptPath() != null) { if (($_SESSION['config']->get_scriptPath() != null) && extension_loaded('ssh2')) {
$return[] = array( $return[] = array(
array('kind' => 'text', 'text' => _('Create home directory') . ": "), array('kind' => 'text', 'text' => _('Create home directory') . ": "),
array('kind' => 'input', 'type' => 'checkbox', 'name' => 'posixAccount_createHomedir'), array('kind' => 'input', 'type' => 'checkbox', 'name' => 'posixAccount_createHomedir'),

View File

@ -155,6 +155,7 @@ class quota extends baseModule {
* *
*/ */
function initQuotas() { function initQuotas() {
if (!extension_loaded('ssh2')) return;
if (isset($this->quota)) return; if (isset($this->quota)) return;
$userName = '+'; $userName = '+';
if (($this->getAccountContainer() != null) && !$this->getAccountContainer()->isNewAccount) { if (($this->getAccountContainer() != null) && !$this->getAccountContainer()->isNewAccount) {
@ -356,6 +357,11 @@ class quota extends baseModule {
* @return array HTML meta data * @return array HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
if (!extension_loaded('ssh2')) {
return array(
array(array('kind' => 'text', 'text' => _('This module requires the PHP ssh2 extension.'))
));
}
$return = array(); $return = array();
$this->initQuotas(); $this->initQuotas();
if (!is_array($this->quota)) return $return; if (!is_array($this->quota)) return $return;