Add description field to FTP accounts, fixes #1340
Signed-off-by: Roman Schmerold (BNoiZe) <bnoize@froxlor.org>
This commit is contained in:
@@ -795,7 +795,7 @@ if ($page == 'customers'
|
|||||||
$cryptPassword = makeCryptPassword($password);
|
$cryptPassword = makeCryptPassword($password);
|
||||||
// FTP-User
|
// FTP-User
|
||||||
$ins_stmt = Database::prepare("
|
$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"
|
`password` = :passwd, `homedir` = :homedir, `login_enabled` = 'y', `uid` = :guid, `gid` = :guid"
|
||||||
);
|
);
|
||||||
$ins_data = array(
|
$ins_data = array(
|
||||||
@@ -803,7 +803,8 @@ if ($page == 'customers'
|
|||||||
'username' => $loginname,
|
'username' => $loginname,
|
||||||
'passwd' => $cryptPassword,
|
'passwd' => $cryptPassword,
|
||||||
'homedir' => $documentroot,
|
'homedir' => $documentroot,
|
||||||
'guid' => $guid
|
'guid' => $guid,
|
||||||
|
'desc' => "Default"
|
||||||
);
|
);
|
||||||
Database::pexecute($ins_stmt, $ins_data);
|
Database::pexecute($ins_stmt, $ins_data);
|
||||||
// FTP-Group
|
// FTP-Group
|
||||||
|
|||||||
@@ -35,11 +35,12 @@ if ($page == 'overview') {
|
|||||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
|
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'username' => $lng['login']['username'],
|
'username' => $lng['login']['username'],
|
||||||
'homedir' => $lng['panel']['path']
|
'homedir' => $lng['panel']['path'],
|
||||||
|
'description' => $lng['panel']['ftpdesc']
|
||||||
);
|
);
|
||||||
$paging = new paging($userinfo, TABLE_FTP_USERS, $fields);
|
$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()
|
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
|
||||||
);
|
);
|
||||||
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
|
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 ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') {
|
||||||
if (isset($_POST['send'])
|
if (isset($_POST['send'])
|
||||||
&& $_POST['send'] == 'send') {
|
&& $_POST['send'] == 'send') {
|
||||||
|
$description = validate($_POST['ftp_description'], 'description');
|
||||||
// @FIXME use a good path-validating regex here (refs #1231)
|
// @FIXME use a good path-validating regex here (refs #1231)
|
||||||
$path = validate($_POST['path'], 'path');
|
$path = validate($_POST['path'], 'path');
|
||||||
$password = validate($_POST['ftp_password'], 'password');
|
$password = validate($_POST['ftp_password'], 'password');
|
||||||
@@ -196,12 +198,13 @@ if ($page == 'overview') {
|
|||||||
$cryptPassword = makeCryptPassword($password);
|
$cryptPassword = makeCryptPassword($password);
|
||||||
|
|
||||||
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_USERS . "`
|
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_USERS . "`
|
||||||
(`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`)
|
(`customerid`, `username`, `description`, `password`, `homedir`, `login_enabled`, `uid`, `gid`)
|
||||||
VALUES (:customerid, :username, :password, :homedir, 'y', :guid, :guid)"
|
VALUES (:customerid, :username, :description, :password, :homedir, 'y', :guid, :guid)"
|
||||||
);
|
);
|
||||||
$params = array(
|
$params = array(
|
||||||
"customerid" => $userinfo['customerid'],
|
"customerid" => $userinfo['customerid'],
|
||||||
"username" => $username,
|
"username" => $username,
|
||||||
|
"description" => $description,
|
||||||
"password" => $cryptPassword,
|
"password" => $cryptPassword,
|
||||||
"homedir" => $path,
|
"homedir" => $path,
|
||||||
"guid" => $userinfo['guid']
|
"guid" => $userinfo['guid']
|
||||||
@@ -336,7 +339,7 @@ if ($page == 'overview') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($action == 'edit' && $id != 0) {
|
} 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
|
WHERE `customerid` = :customerid
|
||||||
AND `id` = :id"
|
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));
|
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||||
} else {
|
} else {
|
||||||
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
|
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ CREATE TABLE `ftp_users` (
|
|||||||
`down_count` int(15) NOT NULL default '0',
|
`down_count` int(15) NOT NULL default '0',
|
||||||
`down_bytes` bigint(30) NOT NULL default '0',
|
`down_bytes` bigint(30) NOT NULL default '0',
|
||||||
`customerid` int(11) NOT NULL default '0',
|
`customerid` int(11) NOT NULL default '0',
|
||||||
|
`description` varchar(255) NOT NULL DEFAULT ''
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `username` (`username`),
|
UNIQUE KEY `username` (`username`),
|
||||||
KEY `customerid` (`customerid`)
|
KEY `customerid` (`customerid`)
|
||||||
@@ -525,7 +526,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
|||||||
('panel', 'phpconfigs_hidestdsubdomain', '0'),
|
('panel', 'phpconfigs_hidestdsubdomain', '0'),
|
||||||
('panel', 'allow_theme_change_admin', '1'),
|
('panel', 'allow_theme_change_admin', '1'),
|
||||||
('panel', 'allow_theme_change_customer', '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`;
|
DROP TABLE IF EXISTS `panel_tasks`;
|
||||||
|
|||||||
@@ -2668,3 +2668,15 @@ if (isFroxlorVersion('0.9.32-dev2')) {
|
|||||||
|
|
||||||
updateToVersion('0.9.32-dev3');
|
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');
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ return array(
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'select_var' => (isset($domains) ? $domains : ""),
|
'select_var' => (isset($domains) ? $domains : ""),
|
||||||
),
|
),
|
||||||
|
'ftp_description' => array(
|
||||||
|
'label' => $lng['panel']['ftpdesc'] = 'FTP description',
|
||||||
|
'type' => 'text'
|
||||||
|
),
|
||||||
'path' => array(
|
'path' => array(
|
||||||
'label' => $lng['panel']['path'],
|
'label' => $lng['panel']['path'],
|
||||||
'desc' => (Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null).(isset($pathSelect['note']) ? '<br />'.$pathSelect['value'] : ''),
|
'desc' => (Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null).(isset($pathSelect['note']) ? '<br />'.$pathSelect['value'] : ''),
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ return array(
|
|||||||
'type' => 'label',
|
'type' => 'label',
|
||||||
'value' => $result['username'],
|
'value' => $result['username'],
|
||||||
),
|
),
|
||||||
|
'ftp_description' => array(
|
||||||
|
'label' => $lng['panel']['ftpdesc'] = 'FTP description',
|
||||||
|
'type' => 'text',
|
||||||
|
'value' => $result['description']
|
||||||
|
),
|
||||||
'path' => array(
|
'path' => array(
|
||||||
'label' => $lng['panel']['path'],
|
'label' => $lng['panel']['path'],
|
||||||
'desc' => (Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null).(isset($pathSelect['note']) ? '<br />'.$pathSelect['value'] : ''),
|
'desc' => (Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null).(isset($pathSelect['note']) ? '<br />'.$pathSelect['value'] : ''),
|
||||||
|
|||||||
@@ -51,6 +51,6 @@ define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings');
|
|||||||
define('TABLE_DOMAINTOIP', 'panel_domaintoip');
|
define('TABLE_DOMAINTOIP', 'panel_domaintoip');
|
||||||
|
|
||||||
// VERSION INFO
|
// VERSION INFO
|
||||||
$version = '0.9.32-dev3';
|
$version = '0.9.32-dev4';
|
||||||
$dbversion = '2';
|
$dbversion = '2';
|
||||||
$branding = '';
|
$branding = '';
|
||||||
|
|||||||
@@ -1797,3 +1797,4 @@ $lng['serversettings']['mtaserver']['title'] = "MTA type";
|
|||||||
$lng['serversettings']['mtaserver']['description'] = "Type of the Mail Transfer Agent";
|
$lng['serversettings']['mtaserver']['description'] = "Type of the Mail Transfer Agent";
|
||||||
$lng['serversettings']['mtalog']['title'] = "MTA log";
|
$lng['serversettings']['mtalog']['title'] = "MTA log";
|
||||||
$lng['serversettings']['mtalog']['description'] = "Logfile of the Mail Transfer Agent";
|
$lng['serversettings']['mtalog']['description'] = "Logfile of the Mail Transfer Agent";
|
||||||
|
$lng['panel']['ftpdesc'] = 'FTP description';
|
||||||
|
|||||||
@@ -1523,3 +1523,4 @@ $lng['serversettings']['mtaserver']['title'] = "Typ des MTA";
|
|||||||
$lng['serversettings']['mtaserver']['description'] = "Der eingesetzte Mail Transfer Agent";
|
$lng['serversettings']['mtaserver']['description'] = "Der eingesetzte Mail Transfer Agent";
|
||||||
$lng['serversettings']['mtalog']['title'] = "Logdatei des MTA";
|
$lng['serversettings']['mtalog']['title'] = "Logdatei des MTA";
|
||||||
$lng['serversettings']['mtalog']['description'] = "Die Logdatei des Mail Transfer Agent";
|
$lng['serversettings']['mtalog']['description'] = "Die Logdatei des Mail Transfer Agent";
|
||||||
|
$lng['panel']['ftpdesc'] = 'FTP Beschreibung';
|
||||||
|
|||||||
1
templates/Sparkle/customer/ftp/accounts.tpl
vendored
1
templates/Sparkle/customer/ftp/accounts.tpl
vendored
@@ -28,6 +28,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{$lng['login']['username']} {$arrowcode['username']}</th>
|
<th>{$lng['login']['username']} {$arrowcode['username']}</th>
|
||||||
|
<th>{$lng['panel']['ftpdesc']} {$arrowcode['description']}</th>
|
||||||
<th>{$lng['panel']['path']} {$arrowcode['homedir']}</th>
|
<th>{$lng['panel']['path']} {$arrowcode['homedir']}</th>
|
||||||
<th>{$lng['panel']['options']}</th>
|
<th>{$lng['panel']['options']}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{$row['username']}</td>
|
<td>{$row['username']}</td>
|
||||||
|
<td>{$row['description']}</td>
|
||||||
<td>{$row['documentroot']}</td>
|
<td>{$row['documentroot']}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{$linker->getLink(array('section' => 'ftp', 'page' => 'accounts', 'action' => 'edit', 'id' => $row['id']))}">
|
<a href="{$linker->getLink(array('section' => 'ftp', 'page' => 'accounts', 'action' => 'edit', 'id' => $row['id']))}">
|
||||||
|
|||||||
Reference in New Issue
Block a user