Marius Cramer
2014-05-12 1d258eef7ce12c81cf4707ea62b4d2f1ae7b1a91
 Merge branch 'ftp-autoexpire' into 'master'

Ftp Autoexpire at specific date
8 files modified
1 files added
38 ■■■■ changed files
install/sql/incremental/upd_0076.sql 1 ●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 1 ●●●● patch | view | raw | blame | history
install/tpl/pureftpd_mysql.conf.master 20 ●●●● patch | view | raw | blame | history
interface/lib/classes/tform_actions.inc.php 2 ●●●●● patch | view | raw | blame | history
interface/web/sites/form/ftp_user.tform.php 4 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/de_ftp_user.lng 1 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_ftp_user.lng 1 ●●●● patch | view | raw | blame | history
interface/web/sites/templates/ftp_user_advanced.htm 4 ●●●● patch | view | raw | blame | history
interface/web/sites/templates/ftp_user_advanced_client.htm 4 ●●●● patch | view | raw | blame | history
install/sql/incremental/upd_0076.sql
New file
@@ -0,0 +1 @@
ALTER TABLE `ftp_user` ADD `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `dl_bandwidth` ;
install/sql/ispconfig3.sql
@@ -598,6 +598,7 @@
  `dl_ratio` int(11) NOT NULL default '-1',
  `ul_bandwidth` int(11) NOT NULL default '-1',
  `dl_bandwidth` int(11) NOT NULL default '-1',
  `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY  (`ftp_user_id`),
  KEY `active` (`active`),
  KEY `server_id` (`server_id`),
install/tpl/pureftpd_mysql.conf.master
@@ -59,12 +59,12 @@
# Query to execute in order to fetch the password
MYSQLGetPW      SELECT password FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L"
MYSQLGetPW      SELECT password FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
# Query to execute in order to fetch the system user name or uid
MYSQLGetUID     SELECT uid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L"
MYSQLGetUID     SELECT uid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
# Optional : default UID - if set this overrides MYSQLGetUID
@@ -74,7 +74,7 @@
# Query to execute in order to fetch the system user group or gid
MYSQLGetGID     SELECT gid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L"
MYSQLGetGID     SELECT gid FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
# Optional : default GID - if set this overrides MYSQLGetGID
@@ -84,34 +84,34 @@
# Query to execute in order to fetch the home directory
MYSQLGetDir     SELECT dir FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L"
MYSQLGetDir     SELECT dir FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
# Optional : query to get the maximal number of files 
# Pure-FTPd must have been compiled with virtual quotas support.
MySQLGetQTAFS  SELECT quota_files FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L"
MySQLGetQTAFS  SELECT quota_files FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_files != '-1' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
# Optional : query to get the maximal disk usage (virtual quotas)
# The number should be in Megabytes.
# Pure-FTPd must have been compiled with virtual quotas support.
MySQLGetQTASZ  SELECT quota_size FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_size != '-1' AND username="\L"
MySQLGetQTASZ  SELECT quota_size FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND quota_size != '-1' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
# Optional : ratios. The server has to be compiled with ratio support.
MySQLGetRatioUL SELECT ul_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND ul_ratio != '-1' AND username="\L"
MySQLGetRatioDL SELECT dl_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND dl_ratio != '-1' AND username="\L"
MySQLGetRatioUL SELECT ul_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND ul_ratio != '-1' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
MySQLGetRatioDL SELECT dl_ratio FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND dl_ratio != '-1' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
# Optional : bandwidth throttling.
# The server has to be compiled with throttling support.
# Values are in KB/s .
MySQLGetBandwidthUL SELECT ul_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND ul_bandwidth != '-1' AND username="\L"
MySQLGetBandwidthDL SELECT dl_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND dl_bandwidth != '-1' AND username="\L"
MySQLGetBandwidthUL SELECT ul_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND ul_bandwidth != '-1' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
MySQLGetBandwidthDL SELECT dl_bandwidth FROM ftp_user WHERE active = 'y' AND server_id = '{server_id}' AND dl_bandwidth != '-1' AND username="\L" AND (expires = "0000-00-00 00:00:00" OR expires > NOW())
# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :
# 1) You know what you are doing.
interface/lib/classes/tform_actions.inc.php
@@ -106,6 +106,7 @@
        global $app, $conf;
        $this->onBeforeUpdate();
        $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_update', $this);
        $ext_where = '';
        $sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'UPDATE', $this->id, $ext_where);
@@ -192,6 +193,7 @@
        global $app, $conf;
        $this->onBeforeInsert();
        $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_insert', $this);
        $ext_where = '';
        $sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'INSERT', $this->id, $ext_where);
interface/web/sites/form/ftp_user.tform.php
@@ -273,6 +273,10 @@
}
$form['tabs']['advanced']['fields']['expires'] = array(
    'datatype' => 'DATETIME',
    'formtype' => 'DATETIME'
);
?>
interface/web/sites/lib/lang/de_ftp_user.lng
@@ -31,4 +31,5 @@
$wb['repeat_password_txt'] = 'Passwort wiederholen';
$wb['password_mismatch_txt'] = 'Die Passwörter stimmen nicht überein.';
$wb['password_match_txt'] = 'Die Passwörter stimmen überein.';
$wb['expires_txt'] = 'Zugang läuft ab';
?>
interface/web/sites/lib/lang/en_ftp_user.lng
@@ -32,4 +32,5 @@
$wb['repeat_password_txt'] = 'Repeat Password';
$wb['password_mismatch_txt'] = 'The passwords do not match.';
$wb['password_match_txt'] = 'The passwords do match.';
$wb['expires_txt'] = 'Expire at';
?>
interface/web/sites/templates/ftp_user_advanced.htm
@@ -37,6 +37,10 @@
                <label for="dl_bandwidth">{tmpl_var name='dl_bandwidth_txt'}</label>
                <input name="dl_bandwidth" id="dl_bandwidth" value="{tmpl_var name='dl_bandwidth'}" size="7" maxlength="7" type="text" class="textInput formLengthLimit" /><p class="label">kb/s</p>
            </div>
            <div class="ctrlHolder">
                <label for="expires">{tmpl_var name='expires_txt'}</label>
                {tmpl_var name='expires'}
            </div>
        </fieldset>
        <input type="hidden" name="id" value="{tmpl_var name='id'}">
interface/web/sites/templates/ftp_user_advanced_client.htm
@@ -9,6 +9,10 @@
                <label for="dir">{tmpl_var name='dir_txt'}</label>
                <input name="dir" id="dir" value="{tmpl_var name='dir'}" size="30" maxlength="255" type="text" class="textInput" />
            </div>
            <div class="ctrlHolder">
                <label for="expires">{tmpl_var name='expires_txt'}</label>
                {tmpl_var name='expires'}
            </div>
        </fieldset>
        <input type="hidden" name="id" value="{tmpl_var name='id'}">