diff --git a/admin_customers.php b/admin_customers.php index 67a02600..cf308c6c 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -795,7 +795,7 @@ if ($page == 'customers' $cryptPassword = makeCryptPassword($password); // FTP-User $ins_stmt = Database::prepare(" - INSERT INTO `" . TABLE_FTP_USERS . "` SET `customerid` = :customerid, `username` = :username, + INSERT INTO `" . TABLE_FTP_USERS . "` SET `customerid` = :customerid, `username` = :username, `description` = :desc, `password` = :passwd, `homedir` = :homedir, `login_enabled` = 'y', `uid` = :guid, `gid` = :guid" ); $ins_data = array( @@ -803,7 +803,8 @@ if ($page == 'customers' 'username' => $loginname, 'passwd' => $cryptPassword, 'homedir' => $documentroot, - 'guid' => $guid + 'guid' => $guid, + 'desc' => "Default" ); Database::pexecute($ins_stmt, $ins_data); // FTP-Group diff --git a/customer_ftp.php b/customer_ftp.php index 1f687dc9..7385f710 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -35,11 +35,12 @@ if ($page == 'overview') { $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts"); $fields = array( 'username' => $lng['login']['username'], - 'homedir' => $lng['panel']['path'] + 'homedir' => $lng['panel']['path'], + 'description' => $lng['panel']['ftpdesc'] ); $paging = new paging($userinfo, TABLE_FTP_USERS, $fields); - $result_stmt = Database::prepare("SELECT `id`, `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` + $result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() ); Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); @@ -147,6 +148,7 @@ if ($page == 'overview') { if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') { if (isset($_POST['send']) && $_POST['send'] == 'send') { + $description = validate($_POST['ftp_description'], 'description'); // @FIXME use a good path-validating regex here (refs #1231) $path = validate($_POST['path'], 'path'); $password = validate($_POST['ftp_password'], 'password'); @@ -196,12 +198,13 @@ if ($page == 'overview') { $cryptPassword = makeCryptPassword($password); $stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_USERS . "` - (`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) - VALUES (:customerid, :username, :password, :homedir, 'y', :guid, :guid)" + (`customerid`, `username`, `description`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) + VALUES (:customerid, :username, :description, :password, :homedir, 'y', :guid, :guid)" ); $params = array( "customerid" => $userinfo['customerid'], "username" => $username, + "description" => $description, "password" => $cryptPassword, "homedir" => $path, "guid" => $userinfo['guid'] @@ -336,7 +339,7 @@ if ($page == 'overview') { } } } elseif ($action == 'edit' && $id != 0) { - $result_stmt = Database::prepare("SELECT `id`, `username`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "` + $result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid` = :customerid AND `id` = :id" ); @@ -397,6 +400,15 @@ if ($page == 'overview') { } } + $log->logAction(USR_ACTION, LOG_INFO, "edited ftp-account '" . $result['username'] . "'"); + $description = validate($_POST['ftp_description'], 'description'); + $stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` + SET `description` = :desc + WHERE `customerid` = :customerid + AND `id` = :id" + ); + Database::pexecute($stmt, array("desc" => $description, "customerid" => $userinfo['customerid'], "id" => $id)); + redirectTo($filename, array('page' => $page, 's' => $s)); } else { if (strpos($result['homedir'], $userinfo['documentroot']) === 0) { diff --git a/install/froxlor.sql b/install/froxlor.sql index 929076ba..bcb36b12 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -29,6 +29,7 @@ CREATE TABLE `ftp_users` ( `down_count` int(15) NOT NULL default '0', `down_bytes` bigint(30) NOT NULL default '0', `customerid` int(11) NOT NULL default '0', + `description` varchar(255) NOT NULL DEFAULT '' PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), KEY `customerid` (`customerid`) @@ -525,7 +526,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'phpconfigs_hidestdsubdomain', '0'), ('panel', 'allow_theme_change_admin', '1'), ('panel', 'allow_theme_change_customer', '1'), - ('panel', 'version', '0.9.32-dev3'); + ('panel', 'version', '0.9.32-dev4'); DROP TABLE IF EXISTS `panel_tasks`; diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index a5d46901..3113707d 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -2668,3 +2668,15 @@ if (isFroxlorVersion('0.9.32-dev2')) { updateToVersion('0.9.32-dev3'); } + +if (isFroxlorVersion('0.9.32-dev3')) { + + showUpdateStep("Updating from 0.9.32-dev3 to 0.9.32-dev4"); + lastStepStatus(0); + + showUpdateStep("Adding news FTP-description field"); + Database::query("ALTER TABLE `".TABLE_FTP_USERS."` ADD `description` varchar(255) NOT NULL DEFAULT '' AFTER `customerid`;"); + lastStepStatus(0); + + updateToVersion('0.9.32-dev4'); +} diff --git a/lib/formfields/customer/ftp/formfield.ftp_add.php b/lib/formfields/customer/ftp/formfield.ftp_add.php index 115c65b1..e8f84262 100644 --- a/lib/formfields/customer/ftp/formfield.ftp_add.php +++ b/lib/formfields/customer/ftp/formfield.ftp_add.php @@ -34,6 +34,10 @@ return array( 'type' => 'select', 'select_var' => (isset($domains) ? $domains : ""), ), + 'ftp_description' => array( + 'label' => $lng['panel']['ftpdesc'] = 'FTP description', + 'type' => 'text' + ), 'path' => array( 'label' => $lng['panel']['path'], 'desc' => (Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null).(isset($pathSelect['note']) ? '
'.$pathSelect['value'] : ''), diff --git a/lib/formfields/customer/ftp/formfield.ftp_edit.php b/lib/formfields/customer/ftp/formfield.ftp_edit.php index 5915d5d1..84f3c091 100644 --- a/lib/formfields/customer/ftp/formfield.ftp_edit.php +++ b/lib/formfields/customer/ftp/formfield.ftp_edit.php @@ -28,6 +28,11 @@ return array( 'type' => 'label', 'value' => $result['username'], ), + 'ftp_description' => array( + 'label' => $lng['panel']['ftpdesc'] = 'FTP description', + 'type' => 'text', + 'value' => $result['description'] + ), 'path' => array( 'label' => $lng['panel']['path'], 'desc' => (Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null).(isset($pathSelect['note']) ? '
'.$pathSelect['value'] : ''), diff --git a/lib/tables.inc.php b/lib/tables.inc.php index 89777b59..29ab2b9b 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -51,6 +51,6 @@ define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings'); define('TABLE_DOMAINTOIP', 'panel_domaintoip'); // VERSION INFO -$version = '0.9.32-dev3'; +$version = '0.9.32-dev4'; $dbversion = '2'; $branding = ''; diff --git a/lng/english.lng.php b/lng/english.lng.php index 3674a51f..40eaa6bb 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1797,3 +1797,4 @@ $lng['serversettings']['mtaserver']['title'] = "MTA type"; $lng['serversettings']['mtaserver']['description'] = "Type of the Mail Transfer Agent"; $lng['serversettings']['mtalog']['title'] = "MTA log"; $lng['serversettings']['mtalog']['description'] = "Logfile of the Mail Transfer Agent"; +$lng['panel']['ftpdesc'] = 'FTP description'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 3f63369a..b85aff85 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1523,3 +1523,4 @@ $lng['serversettings']['mtaserver']['title'] = "Typ des MTA"; $lng['serversettings']['mtaserver']['description'] = "Der eingesetzte Mail Transfer Agent"; $lng['serversettings']['mtalog']['title'] = "Logdatei des MTA"; $lng['serversettings']['mtalog']['description'] = "Die Logdatei des Mail Transfer Agent"; +$lng['panel']['ftpdesc'] = 'FTP Beschreibung'; diff --git a/templates/Sparkle/customer/ftp/accounts.tpl b/templates/Sparkle/customer/ftp/accounts.tpl index fa49c61d..5f93e052 100644 --- a/templates/Sparkle/customer/ftp/accounts.tpl +++ b/templates/Sparkle/customer/ftp/accounts.tpl @@ -28,6 +28,7 @@ {$lng['login']['username']} {$arrowcode['username']} + {$lng['panel']['ftpdesc']} {$arrowcode['description']} {$lng['panel']['path']} {$arrowcode['homedir']} {$lng['panel']['options']} diff --git a/templates/Sparkle/customer/ftp/accounts_account.tpl b/templates/Sparkle/customer/ftp/accounts_account.tpl index 2382741b..8038e719 100644 --- a/templates/Sparkle/customer/ftp/accounts_account.tpl +++ b/templates/Sparkle/customer/ftp/accounts_account.tpl @@ -1,5 +1,6 @@ {$row['username']} + {$row['description']} {$row['documentroot']}