Fix phpcs whitespace breakage in initStruct etc.

pull/167/head
Christian Boltz 6 years ago
parent 5e4e0bb426
commit d2588a4de2
No known key found for this signature in database
GPG Key ID: C6A682EA63C82F1C

@ -16,4 +16,8 @@ return PhpCsFixer\Config::create()
'braces' => array(
'position_after_functions_and_oop_constructs' => 'same',
),
'method_argument_space' => false, # don't break formatting in initStruct()
'no_spaces_inside_parenthesis' => false, # don't break formatting in initStruct()
));
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4 ft=php: */

@ -39,40 +39,16 @@ class AdminHandler extends PFAHandler {
$this->struct=array(
# field name allow display in... type $PALANG label $PALANG description default / options / ...
# editing? form list
'username' => pacol(
$this->new,
1,
1,
'text',
'admin',
'email_address',
'',
'',
array('linkto' => 'list.php?table=domain&username=%s')
),
'password' => pacol(1, 1, 0, 'pass', 'password', ''),
'password2' => pacol(
1,
1,
0,
'pass',
'password_again',
'',
'',
'',
'username' => pacol($this->new, 1, 1, 'text', 'admin' , 'email_address' , '', '',
array('linkto' => 'list.php?table=domain&username=%s') ),
'password' => pacol(1, 1, 0, 'pass', 'password' , '' ),
'password2' => pacol(1, 1, 0, 'pass', 'password_again' , '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ 'password as password2'
),
'superadmin' => pacol(
1,
1,
0,
'bool',
'super_admin',
'super_admin_desc',
0
'superadmin' => pacol(1, 1, 0, 'bool', 'super_admin' , 'super_admin_desc' , 0
# TODO: (finally) replace the ALL domain with a column in the admin table
# TODO: current status: 'superadmin' column exists and is written when storing an admin with AdminHandler,
# TODO: but the superadmin status is still (additionally) stored in the domain_admins table ("ALL" dummy domain)
@ -81,30 +57,14 @@ class AdminHandler extends PFAHandler {
# TODO: Create them with the trunk version to avoid this problem.
),
'domains' => pacol(
1,
1,
0,
'list',
'domain',
'',
array(),
list_domains(),
'domains' => pacol(1, 1, 0, 'list', 'domain' , '' , array(), list_domains(),
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ "coalesce(domains,'') as domains"
/*extrafrom set in domain_count*/
),
'domain_count' => pacol(
0,
0,
1,
'vnum',
'pAdminList_admin_count',
'',
'',
'',
'domain_count' => pacol(0, 0, 1, 'vnum', 'pAdminList_admin_count', '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ 'coalesce(__domain_count,0) as domain_count',
@ -112,16 +72,15 @@ class AdminHandler extends PFAHandler {
' SELECT count(*) AS __domain_count, ' . $domains_grouped . ' AS domains, username AS __domain_username ' .
' FROM ' . table_by_key('domain_admins') .
" WHERE domain != 'ALL' GROUP BY username " .
' ) AS __domain on username = __domain_username'
),
'active' => pacol(1, 1, 1, 'bool', 'active', '', 1),
'phone' => pacol(1, $passwordReset, 0, 'text', 'pCreate_mailbox_phone', 'pCreate_mailbox_phone_desc', ''),
'email_other' => pacol(1, $passwordReset, 0, 'mail', 'pCreate_mailbox_email', 'pCreate_mailbox_email_desc', ''),
'token' => pacol(1, 0, 0, 'text', '', ''),
'token_validity' => pacol(1, 0, 0, 'ts', '', '', date("Y-m-d H:i:s", time())),
'created' => pacol(0, 0, 0, 'ts', 'created', ''),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified', ''),
' ) AS __domain on username = __domain_username'),
'active' => pacol(1, 1, 1, 'bool', 'active' , '' , 1 ),
'phone' => pacol(1, $passwordReset, 0, 'text', 'pCreate_mailbox_phone', 'pCreate_mailbox_phone_desc', ''),
'email_other' => pacol(1, $passwordReset, 0, 'mail', 'pCreate_mailbox_email', 'pCreate_mailbox_email_desc', ''),
'token' => pacol(1, 0, 0, 'text', '' , '' ),
'token_validity' => pacol(1, 0, 0, 'ts', '' , '', date("Y-m-d H:i:s",time())),
'created' => pacol(0, 0, 0, 'ts', 'created' , '' ),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified' , '' ),
);
}

@ -23,28 +23,11 @@ class AdminpasswordHandler extends PFAHandler {
$this->struct=array(
# field name allow display in... type $PALANG label $PALANG description default / options / ...
# editing? form list
'username' => pacol(0, 1, 1, 'text', 'admin', ''),
'oldpass' => pacol(
1,
1,
0,
'pass',
'pPassword_password_current',
'',
'',
'',
/*not_in_db*/ 1
),
'password' => pacol(1, 1, 0, 'pass', 'pPassword_password', ''),
'password2' => pacol(
1,
1,
0,
'pass',
'pPassword_password2',
'',
'',
'',
'username' => pacol(0, 1, 1, 'text', 'admin' , '' ),
'oldpass' => pacol(1, 1, 0, 'pass', 'pPassword_password_current' , '', '', '',
/*not_in_db*/ 1 ),
'password' => pacol(1, 1, 0, 'pass', 'pPassword_password' , '' ),
'password2' => pacol(1, 1, 0, 'pass', 'pPassword_password2' , '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ 'password as password2'

@ -26,104 +26,37 @@ class AliasHandler extends PFAHandler {
$this->struct=array(
# field name allow display in... type $PALANG label $PALANG description default / ...
# editing? form list
'status' => pacol(
0,
0,
0,
'html',
'',
'',
'',
'',
array('not_in_db' => 1)
),
'address' => pacol($this->new, 1, 1, 'mail', 'alias', 'pCreate_alias_catchall_text'),
'localpart' => pacol(
$this->new,
0,
0,
'text',
'alias',
'pCreate_alias_catchall_text',
'',
'status' => pacol(0, 0, 0, 'html', '' , '' , '', '',
array('not_in_db' => 1) ),
'address' => pacol($this->new, 1, 1, 'mail', 'alias' , 'pCreate_alias_catchall_text' ),
'localpart' => pacol($this->new, 0, 0, 'text', 'alias' , 'pCreate_alias_catchall_text' , '',
/*options*/ '',
/*not_in_db*/ 1
),
'domain' => pacol(
$this->new,
0,
1,
'enum',
'',
'',
'',
/*options*/ $this->allowed_domains
),
'goto' => pacol(1, 1, 1, 'txtl', 'to', 'pEdit_alias_help', array()),
'is_mailbox' => pacol(
0,
0,
1,
'int',
'',
'',
0,
/*not_in_db*/ 1 ),
'domain' => pacol($this->new, 0, 1, 'enum', '' , '' , '',
/*options*/ $this->allowed_domains ),
'goto' => pacol(1, 1, 1, 'txtl', 'to' , 'pEdit_alias_help' , array() ),
'is_mailbox' => pacol(0, 0, 1, 'int', '' , '' , 0 ,
# technically 'is_mailbox' is bool, but the automatic bool conversion breaks the query. Flagging it as int avoids this problem.
# Maybe having a vbool type (without the automatic conversion) would be cleaner - we'll see if we need it.
/*options*/ '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ 'coalesce(__is_mailbox,0) as is_mailbox'
),
/*select*/ 'coalesce(__is_mailbox,0) as is_mailbox' ),
/*extrafrom set via set_is_mailbox_extrafrom() */
'__mailbox_username' => pacol(0, 0, 1, 'vtxt', '', '', 0), # filled via is_mailbox
'goto_mailbox' => pacol(
$mbgoto,
$mbgoto,
$mbgoto,
'bool',
'pEdit_alias_forward_and_store',
'',
0,
'__mailbox_username' => pacol( 0, 0, 1, 'vtxt', '' , '' , 0), # filled via is_mailbox
'goto_mailbox' => pacol($mbgoto, $mbgoto,$mbgoto,'bool', 'pEdit_alias_forward_and_store' , '' , 0,
/*options*/ '',
/*not_in_db*/ 1
), # read_from_db_postprocess() sets the value
'on_vacation' => pacol(
1,
0,
1,
'bool',
'pUsersMenu_vacation',
'',
0,
/*not_in_db*/ 1 ), # read_from_db_postprocess() sets the value
'on_vacation' => pacol(1, 0, 1, 'bool', 'pUsersMenu_vacation' , '' , 0 ,
/*options*/ '',
/*not_in_db*/ 1
), # read_from_db_postprocess() sets the value - TODO: read active flag from vacation table instead?
'created' => pacol(0, 0, 0, 'ts', 'created', ''),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified', ''),
'active' => pacol(1, 1, 1, 'bool', 'active', '', 1),
'_can_edit' => pacol(
0,
0,
1,
'vnum',
'',
'',
0,
'',
array('select' => '1 as _can_edit')
),
'_can_delete' => pacol(
0,
0,
1,
'vnum',
'',
'',
0,
'',
array('select' => '1 as _can_delete')
), # read_from_db_postprocess() updates the value
/*not_in_db*/ 1 ), # read_from_db_postprocess() sets the value - TODO: read active flag from vacation table instead?
'created' => pacol(0, 0, 0, 'ts', 'created' , '' ),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified' , '' ),
'active' => pacol(1, 1, 1, 'bool', 'active' , '' , 1 ),
'_can_edit' => pacol(0, 0, 1, 'vnum', '' , '' , 0 , '',
array('select' => '1 as _can_edit') ),
'_can_delete' => pacol(0, 0, 1, 'vnum', '' , '' , 0 , '',
array('select' => '1 as _can_delete') ), # read_from_db_postprocess() updates the value
# aliases listed in $CONF[default_aliases] are read-only for domain admins if $CONF[special_alias_control] is NO.
);

@ -14,30 +14,14 @@ class AliasdomainHandler extends PFAHandler {
$this->struct=array(
# field name allow display in... type $PALANG label $PALANG description default / options / ...
# editing? form list
'alias_domain' => pacol(
$this->new,
1,
1,
'enum',
'pCreate_alias_domain_alias',
'pCreate_alias_domain_alias_text',
'',
'alias_domain' => pacol($this->new, 1, 1, 'enum', 'pCreate_alias_domain_alias' , 'pCreate_alias_domain_alias_text' , '',
/*options, filled below*/ array(),
/* multiopt */ array('linkto' => 'list-virtual.php?domain=%s')
),
'target_domain' => pacol(
1,
1,
1,
'enum',
'pCreate_alias_domain_target',
'pCreate_alias_domain_target_text',
'',
/*options*/ array() /* filled below */
),
'created' => pacol(0, 0, 0, 'ts', 'created', ''),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified', ''),
'active' => pacol(1, 1, 1, 'bool', 'active', '', 1),
/* multiopt */ array('linkto' => 'list-virtual.php?domain=%s') ),
'target_domain' => pacol(1, 1, 1, 'enum', 'pCreate_alias_domain_target' , 'pCreate_alias_domain_target_text', '',
/*options*/ array() /* filled below */ ),
'created' => pacol(0, 0, 0, 'ts', 'created' , '' ),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified' , '' ),
'active' => pacol(1, 1, 1, 'bool', 'active' , '' , 1 ),
);
@ -56,8 +40,9 @@ class AliasdomainHandler extends PFAHandler {
foreach ($this->struct['alias_domain']['options'] as $dom) {
if (isset($used_targets[$dom])) {
# don't allow chained domain aliases (domain1 -> domain2 -> domain3)
unset($this->struct['alias_domain']['options'][$dom]);
} # don't allow chained domain aliases (domain1 -> domain2 -> domain3)
}
}
if (count($this->struct['alias_domain']['options']) == 1) { # only one alias_domain available - filter it out from target_domain list

@ -45,8 +45,8 @@ class CliHelp extends Shell {
$commands = array(
'task' => "\t<task>\n" .
"\t\tAvailable values:\n\n".
"\t\t".sprintf("%-20s %s", "view: ", "View an existing $module.")."\n".
"\t\t".sprintf("%-20s %s", "add: ", "Add a $module.")."\n".
"\t\t".sprintf("%-20s %s", "view: ", "View an existing $module.")."\n".
"\t\t".sprintf("%-20s %s", "add: ", "Add a $module.")."\n".
"\t\t".sprintf("%-20s %s", "update: ", "Update a $module.")."\n".
"\t\t".sprintf("%-20s %s", "delete: ", "Delete a $module")."\n",
'address' => "\t[<address>]\n" .

@ -46,178 +46,64 @@ class DomainHandler extends PFAHandler {
$this->struct=array(
# field name allow display in... type $PALANG label $PALANG description default / options / ...
# editing? form list
'domain' => pacol(
$this->new,
1,
1,
'text',
'domain',
'',
'',
'',
array('linkto' => 'list-virtual.php?domain=%s')
),
'description' => pacol($super, $super, $super, 'text', 'description', ''),
'domain' => pacol($this->new, 1, 1, 'text', 'domain' , '' , '', '',
array('linkto' => 'list-virtual.php?domain=%s') ),
'description' => pacol($super, $super, $super, 'text', 'description' , '' ),
# Aliases
'aliases' => pacol($super, $super, 0, 'num', 'aliases', 'pAdminEdit_domain_aliases_text', Config::read('aliases')),
'alias_count' => pacol(
0,
0,
1,
'vnum',
'',
'',
'',
'',
'aliases' => pacol($super, $super, 0, 'num' , 'aliases' , 'pAdminEdit_domain_aliases_text' , Config::read('aliases') ),
'alias_count' => pacol(0, 0, 1, 'vnum', '' , '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ 'coalesce(__alias_count,0) - coalesce(__mailbox_count,0) as alias_count',
/*extrafrom*/ 'left join ( select count(*) as __alias_count, domain as __alias_domain from ' . table_by_key('alias') .
' group by domain) as __alias on domain = __alias_domain'
),
'aliases_quot' => pacol(
0,
0,
1,
'quot',
'aliases',
'',
0,
'',
array('select' => db_quota_text('__alias_count - coalesce(__mailbox_count,0)', 'aliases', 'aliases_quot'))
),
'_aliases_quot_percent' => pacol(
0,
0,
1,
'vnum',
'',
'',
0,
'',
array('select' => db_quota_percent('__alias_count - coalesce(__mailbox_count,0)', 'aliases', '_aliases_quot_percent'))
),
' group by domain) as __alias on domain = __alias_domain'),
'aliases_quot' => pacol(0, 0, 1, 'quot', 'aliases' , '' , 0, '',
array('select' => db_quota_text( '__alias_count - coalesce(__mailbox_count,0)', 'aliases', 'aliases_quot')) ),
'_aliases_quot_percent' => pacol( 0, 0, 1, 'vnum', '' ,'' , 0, '',
array('select' => db_quota_percent('__alias_count - coalesce(__mailbox_count,0)', 'aliases', '_aliases_quot_percent')) ),
# Mailboxes
'mailboxes' => pacol($super, $super, 0, 'num', 'mailboxes', 'pAdminEdit_domain_aliases_text', Config::read('mailboxes')),
'mailbox_count' => pacol(
0,
0,
1,
'vnum',
'',
'',
'',
'',
'mailboxes' => pacol($super, $super, 0, 'num' , 'mailboxes' , 'pAdminEdit_domain_aliases_text' , Config::read('mailboxes') ),
'mailbox_count' => pacol(0, 0, 1, 'vnum', '' , '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ 'coalesce(__mailbox_count,0) as mailbox_count',
/*extrafrom*/ 'left join ( select count(*) as __mailbox_count, sum(quota) as __total_quota, domain as __mailbox_domain from ' . table_by_key('mailbox') .
' group by domain) as __mailbox on domain = __mailbox_domain'
),
'mailboxes_quot' => pacol(
0,
0,
1,
'quot',
'mailboxes',
'',
0,
'',
array('select' => db_quota_text('__mailbox_count', 'mailboxes', 'mailboxes_quot'))
),
'_mailboxes_quot_percent' => pacol(
0,
0,
1,
'vnum',
'',
'',
0,
'',
array('select' => db_quota_percent('__mailbox_count', 'mailboxes', '_mailboxes_quot_percent'))
),
'maxquota' => pacol($editquota, $editquota, $quota, 'num', 'pOverview_get_quota', 'pAdminEdit_domain_maxquota_text', Config::read('maxquota')),
' group by domain) as __mailbox on domain = __mailbox_domain'),
'mailboxes_quot' => pacol(0, 0, 1, 'quot', 'mailboxes' , '' , 0, '',
array('select' => db_quota_text( '__mailbox_count', 'mailboxes', 'mailboxes_quot')) ),
'_mailboxes_quot_percent' => pacol( 0, 0, 1, 'vnum', '' , '' , 0, '',
array('select' => db_quota_percent('__mailbox_count', 'mailboxes', '_mailboxes_quot_percent')) ),
'maxquota' => pacol($editquota,$editquota,$quota, 'num', 'pOverview_get_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('maxquota') ),
# Domain quota
'quota' => pacol($edit_dom_q, $edit_dom_q, 0, 'num', 'pAdminEdit_domain_quota', 'pAdminEdit_domain_maxquota_text', Config::read('domain_quota_default')),
'total_quota' => pacol(
0,
0,
1,
'vnum',
'',
'',
'',
'',
array('select' => "$query_used_domainquota AS total_quota") /*extrafrom*//* already in mailbox_count */
),
'total_quot' => pacol(
0,
0,
$dom_q,
'quot',
'pAdminEdit_domain_quota',
'',
0,
'',
array('select' => db_quota_text($query_used_domainquota, 'quota', 'total_quot'))
),
'_total_quot_percent'=> pacol(
0,
0,
$dom_q,
'vnum',
'',
'',
0,
'',
array('select' => db_quota_percent($query_used_domainquota, 'quota', '_total_quot_percent'))
),
'transport' => pacol(
$transp,
$transp,
$transp,
'enum',
'transport',
'pAdminEdit_domain_transport_text',
Config::read('transport_default'),
/*options*/ Config::read('transport_options')
),
'backupmx' => pacol($super, $super, 1, 'bool', 'pAdminEdit_domain_backupmx', '', 0),
'active' => pacol($super, $super, 1, 'bool', 'active', '', 1),
'default_aliases' => pacol($this->new, $this->new, 0, 'bool', 'pAdminCreate_domain_defaultaliases', '', 1, '', /*not in db*/ 1),
'created' => pacol(0, 0, 0, 'ts', 'created', ''),
'modified' => pacol(0, 0, $super, 'ts', 'last_modified', ''),
'_can_edit' => pacol(
0,
0,
1,
'int',
'',
'',
0,
'quota' => pacol($edit_dom_q,$edit_dom_q, 0, 'num', 'pAdminEdit_domain_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('domain_quota_default') ),
'total_quota' => pacol(0, 0, 1, 'vnum', '' , '' , '', '',
array('select' => "$query_used_domainquota AS total_quota") /*extrafrom*//* already in mailbox_count */ ),
'total_quot' => pacol( 0, 0, $dom_q, 'quot', 'pAdminEdit_domain_quota' , '' , 0, '',
array('select' => db_quota_text( $query_used_domainquota, 'quota', 'total_quot')) ),
'_total_quot_percent'=> pacol( 0, 0, $dom_q, 'vnum', '' , '' , 0, '',
array('select' => db_quota_percent($query_used_domainquota, 'quota', '_total_quot_percent')) ),
'transport' => pacol($transp, $transp,$transp,'enum', 'transport' , 'pAdminEdit_domain_transport_text' , Config::read('transport_default') ,
/*options*/ Config::read('transport_options') ),
'backupmx' => pacol($super, $super, 1, 'bool', 'pAdminEdit_domain_backupmx' , '' , 0),
'active' => pacol($super, $super, 1, 'bool', 'active' , '' , 1 ),
'default_aliases' => pacol($this->new, $this->new, 0, 'bool', 'pAdminCreate_domain_defaultaliases', '' , 1,'', /*not in db*/ 1 ),
'created' => pacol(0, 0, 0, 'ts', 'created' , '' ),
'modified' => pacol(0, 0, $super, 'ts', 'last_modified' , '' ),
'_can_edit' => pacol(0, 0, 1, 'int', '' , '' , 0 ,
/*options*/ '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ $this->is_superadmin . ' as _can_edit'
),
'_can_delete' => pacol(
0,
0,
1,
'int',
'',
'',
0,
/*select*/ $this->is_superadmin . ' as _can_edit' ),
'_can_delete' => pacol(0, 0, 1, 'int', '' , '' , 0 ,
/*options*/ '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ $this->is_superadmin . ' as _can_delete'
),
/*select*/ $this->is_superadmin . ' as _can_delete' ),
);
}
@ -331,16 +217,16 @@ class DomainHandler extends PFAHandler {
# some tables don't have a domain field, so we need a workaround
$like_domain = "LIKE '" . escape_string('%@' . $this->id) . "'";
db_delete('domain_admins', 'domain', $this->id);
db_delete('alias', 'domain', $this->id);
db_delete('mailbox', 'domain', $this->id);
db_delete('alias_domain', 'alias_domain', $this->id);
db_delete('vacation', 'domain', $this->id);
db_delete('vacation_notification', 'on_vacation', $this->id, "OR on_vacation $like_domain");
db_delete('quota', 'username', $this->id, "OR username $like_domain");
db_delete('quota2', 'username', $this->id, "OR username $like_domain");
db_delete('fetchmail', 'mailbox', $this->id, "OR mailbox $like_domain");
db_delete('log', 'domain', $this->id); # TODO: should we really delete the log?
db_delete('domain_admins', 'domain', $this->id);
db_delete('alias', 'domain', $this->id);
db_delete('mailbox', 'domain', $this->id);
db_delete('alias_domain', 'alias_domain', $this->id);
db_delete('vacation', 'domain', $this->id);
db_delete('vacation_notification', 'on_vacation', $this->id, "OR on_vacation $like_domain");
db_delete('quota', 'username', $this->id, "OR username $like_domain");
db_delete('quota2', 'username', $this->id, "OR username $like_domain");
db_delete('fetchmail', 'mailbox', $this->id, "OR mailbox $like_domain");
db_delete('log', 'domain', $this->id); # TODO: should we really delete the log?
# finally delete the domain
db_delete($this->db_table, $this->id_field, $this->id);

@ -20,29 +20,29 @@ class FetchmailHandler extends PFAHandler {
$this->struct=array(
# field name allow display in... type $PALANG label $PALANG description default / options / ...
# editing? form list
'id' => pacol(0, 0, 1, 'num', '', '', '', array(), 0, 1),
'domain' => pacol(0, 0, 1, 'text', '', ''),
'mailbox' => pacol(1, 1, 1, 'enum', 'pFetchmail_field_mailbox', 'pFetchmail_desc_mailbox'), # mailbox list
'src_server' => pacol(1, 1, 1, 'text', 'pFetchmail_field_src_server', 'pFetchmail_desc_src_server'),
'src_auth' => pacol(1, 1, 1, 'enum', 'pFetchmail_field_src_auth', 'pFetchmail_desc_src_auth', '', $src_auth_options),
'src_user' => pacol(1, 1, 1, 'text', 'pFetchmail_field_src_user', 'pFetchmail_desc_src_user'),
'src_password' => pacol(1, 1, 0, 'b64p', 'pFetchmail_field_src_password', 'pFetchmail_desc_src_password'),
'src_folder' => pacol(1, 1, 1, 'text', 'pFetchmail_field_src_folder', 'pFetchmail_desc_src_folder'),
'poll_time' => pacol(1, 1, 1, 'num', 'pFetchmail_field_poll_time', 'pFetchmail_desc_poll_time', 10),
'fetchall' => pacol(1, 1, 1, 'bool', 'pFetchmail_field_fetchall', 'pFetchmail_desc_fetchall'),
'keep' => pacol(1, 1, 1, 'bool', 'pFetchmail_field_keep', 'pFetchmail_desc_keep'),
'protocol' => pacol(1, 1, 1, 'enum', 'pFetchmail_field_protocol', 'pFetchmail_desc_protocol', '', $src_protocol_options),
'usessl' => pacol(1, 1, 1, 'bool', 'pFetchmail_field_usessl', 'pFetchmail_desc_usessl'),
'sslcertck' => pacol(1, 1, 1, 'bool', 'pFetchmail_field_sslcertck', ''),
'sslcertpath' => pacol($extra, $extra, $extra, 'text', 'pFetchmail_field_sslcertpath', ''),
'sslfingerprint'=> pacol($extra, $extra, $extra, 'text', 'pFetchmail_field_sslfingerprint', ''),
'extra_options' => pacol($extra, $extra, $extra, 'text', 'pFetchmail_field_extra_options', 'pFetchmail_desc_extra_options'),
'mda' => pacol($extra, $extra, $extra, 'text', 'pFetchmail_field_mda', 'pFetchmail_desc_mda'),
'date' => pacol(0, 0, 1, 'text', 'pFetchmail_field_date', 'pFetchmail_desc_date', '2000-01-01'),
'returned_text' => pacol(0, 0, 1, 'text', 'pFetchmail_field_returned_text', 'pFetchmail_desc_returned_text'),
'active' => pacol(1, 1, 1, 'bool', 'active', '', 1),
'created' => pacol(0, 0, 0, 'ts', 'created', ''),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified', ''),
'id' => pacol(0, 0, 1, 'num' , '' , '' , '', array(), 0, 1),
'domain' => pacol(0, 0, 1, 'text', '' , '' ),
'mailbox' => pacol(1, 1, 1, 'enum', 'pFetchmail_field_mailbox' , 'pFetchmail_desc_mailbox' ), # mailbox list
'src_server' => pacol(1, 1, 1, 'text', 'pFetchmail_field_src_server' , 'pFetchmail_desc_src_server' ),
'src_auth' => pacol(1, 1, 1, 'enum', 'pFetchmail_field_src_auth' , 'pFetchmail_desc_src_auth' , '', $src_auth_options),
'src_user' => pacol(1, 1, 1, 'text', 'pFetchmail_field_src_user' , 'pFetchmail_desc_src_user' ),
'src_password' => pacol(1, 1, 0, 'b64p', 'pFetchmail_field_src_password' , 'pFetchmail_desc_src_password' ),
'src_folder' => pacol(1, 1, 1, 'text', 'pFetchmail_field_src_folder' , 'pFetchmail_desc_src_folder' ),
'poll_time' => pacol(1, 1, 1, 'num' , 'pFetchmail_field_poll_time' , 'pFetchmail_desc_poll_time' , 10 ),
'fetchall' => pacol(1, 1, 1, 'bool', 'pFetchmail_field_fetchall' , 'pFetchmail_desc_fetchall' ),
'keep' => pacol(1, 1, 1, 'bool', 'pFetchmail_field_keep' , 'pFetchmail_desc_keep' ),
'protocol' => pacol(1, 1, 1, 'enum', 'pFetchmail_field_protocol' , 'pFetchmail_desc_protocol' , '', $src_protocol_options),
'usessl' => pacol(1, 1, 1, 'bool', 'pFetchmail_field_usessl' , 'pFetchmail_desc_usessl' ),
'sslcertck' => pacol(1, 1, 1, 'bool', 'pFetchmail_field_sslcertck' , '' ),
'sslcertpath' => pacol($extra, $extra, $extra, 'text', 'pFetchmail_field_sslcertpath' , '' ),
'sslfingerprint' => pacol($extra, $extra, $extra, 'text', 'pFetchmail_field_sslfingerprint','' ),
'extra_options' => pacol($extra, $extra, $extra, 'text', 'pFetchmail_field_extra_options', 'pFetchmail_desc_extra_options' ),
'mda' => pacol($extra, $extra, $extra, 'text', 'pFetchmail_field_mda' , 'pFetchmail_desc_mda' ),
'date' => pacol(0, 0, 1, 'text', 'pFetchmail_field_date' , 'pFetchmail_desc_date' , '2000-01-01' ),
'returned_text' => pacol(0, 0, 1, 'text', 'pFetchmail_field_returned_text', 'pFetchmail_desc_returned_text' ),
'active' => pacol(1, 1, 1, 'bool', 'active' , '' , 1 ),
'created' => pacol(0, 0, 0, 'ts', 'created' , '' ),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified' , '' ),
);
# get list of mailboxes (for currently logged in user)

@ -16,57 +16,34 @@ class MailboxHandler extends PFAHandler {
$this->struct=array(
# field name allow display in... type $PALANG label $PALANG description default / options / ...
# editing? form list
'username' => pacol($this->new, 1, 1, 'mail', 'pEdit_mailbox_username', '', ''),
'local_part' => pacol($this->new, 0, 0, 'text', 'pEdit_mailbox_username', '', ''),
'domain' => pacol(
$this->new,
0,
1,
'enum',
'',
'',
'',
/*options*/ $this->allowed_domains
),
'username' => pacol($this->new, 1, 1, 'mail', 'pEdit_mailbox_username' , '' , '' ),
'local_part' => pacol($this->new, 0, 0, 'text', 'pEdit_mailbox_username' , '' , '' ),
'domain' => pacol($this->new, 0, 1, 'enum', '' , '' , '',
/*options*/ $this->allowed_domains ),
# TODO: maildir: display in list is needed to include maildir in SQL result (for post_edit hook)
# TODO: (not a perfect solution, but works for now - maybe we need a separate "include in SELECT query" field?)
'maildir' => pacol($this->new, 0, 1, 'text', '', '', ''),
'password' => pacol(1, 1, 0, 'pass', 'password', 'pCreate_mailbox_password_text', ''),
'password2' => pacol(
1,
1,
0,
'pass',
'password_again',
'',
'',
'maildir' => pacol($this->new, 0, 1, 'text', '' , '' , '' ),
'password' => pacol(1, 1, 0, 'pass', 'password' , 'pCreate_mailbox_password_text' , '' ),
'password2' => pacol(1, 1, 0, 'pass', 'password_again' , '' , '',
/*options*/ '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ 'password as password2'
),
'name' => pacol(1, 1, 1, 'text', 'name', 'pCreate_mailbox_name_text', ''),
'quota' => pacol(1, 1, 1, 'int', 'pEdit_mailbox_quota', 'pEdit_mailbox_quota_text', ''), # in MB
'name' => pacol(1, 1, 1, 'text', 'name' , 'pCreate_mailbox_name_text' , '' ),
'quota' => pacol(1, 1, 1, 'int' , 'pEdit_mailbox_quota' , 'pEdit_mailbox_quota_text' , '' ), # in MB
# read_from_db_postprocess() also sets 'quotabytes' for use in init()
# TODO: read used quota from quota/quota2 table
'active' => pacol(1, 1, 1, 'bool', 'active', '', 1),
'welcome_mail' => pacol(
$this->new,
$this->new,
0,
'bool',
'pCreate_mailbox_mail',
'',
1,
'active' => pacol(1, 1, 1, 'bool', 'active' , '' , 1 ),
'welcome_mail' => pacol($this->new, $this->new, 0, 'bool', 'pCreate_mailbox_mail' , '' , 1,
/*options*/ '',
/*not_in_db*/ 1
),
'phone' => pacol(1, $passwordReset, 0, 'text', 'pCreate_mailbox_phone', 'pCreate_mailbox_phone_desc', ''),
'email_other' => pacol(1, $passwordReset, 0, 'mail', 'pCreate_mailbox_email', 'pCreate_mailbox_email_desc', ''),
'token' => pacol(1, 0, 0, 'text', '', ''),
'token_validity'=> pacol(1, 0, 0, 'ts', '', '', date("Y-m-d H:i:s", time())),
'created' => pacol(0, 0, 1, 'ts', 'created', ''),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified', ''),
/*not_in_db*/ 1 ),
'phone' => pacol(1, $passwordReset, 0, 'text', 'pCreate_mailbox_phone' , 'pCreate_mailbox_phone_desc' , ''),
'email_other' => pacol(1, $passwordReset, 0, 'mail', 'pCreate_mailbox_email' , 'pCreate_mailbox_email_desc' , ''),
'token' => pacol(1, 0, 0, 'text', '' , '' ),
'token_validity' => pacol(1, 0, 0, 'ts', '' , '', date("Y-m-d H:i:s",time())),
'created' => pacol(0, 0, 1, 'ts', 'created' , '' ),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified' , '' ),
# TODO: add virtual 'notified' column and allow to display who received a vacation response?
);
@ -270,7 +247,7 @@ class MailboxHandler extends PFAHandler {
return true; # still here? good!
}
protected function storemore() {
if ($this->new) {
if (!$this->mailbox_post_script()) {
@ -327,13 +304,13 @@ class MailboxHandler extends PFAHandler {
# deleting the mailbox, but it's easier and a bit faster to do it on the database level.
# cleaning up all tables doesn't hurt, even if vacation or displaying the quota is disabled
db_delete('fetchmail', 'mailbox', $this->id);
db_delete('vacation', 'email', $this->id);
db_delete('vacation_notification', 'on_vacation', $this->id); # should be caught by cascade, if PgSQL
db_delete('quota', 'username', $this->id);
db_delete('quota2', 'username', $this->id);
db_delete('alias', 'address', $this->id);
db_delete($this->db_table, $this->id_field, $this->id); # finally delete the mailbox
db_delete('fetchmail', 'mailbox', $this->id);
db_delete('vacation', 'email', $this->id);
db_delete('vacation_notification', 'on_vacation', $this->id); # should be caught by cascade, if PgSQL
db_delete('quota', 'username', $this->id);
db_delete('quota2', 'username', $this->id);
db_delete('alias', 'address', $this->id);
db_delete($this->db_table, $this->id_field, $this->id); # finally delete the mailbox
if (!$this->mailbox_postdeletion()) {
$this->error_msg[] = Config::Lang('mailbox_postdel_failed');

@ -202,15 +202,7 @@ abstract class PFAHandler {
$this->initStruct();
if (!isset($this->struct['_can_edit'])) {
$this->struct['_can_edit'] = pacol(
0,
0,
1,
'vnum',
'',
'',
'',
'',
$this->struct['_can_edit'] = pacol(0, 0, 1, 'vnum', '' , '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ '1 as _can_edit'
@ -218,15 +210,7 @@ abstract class PFAHandler {
}
if (!isset($this->struct['_can_delete'])) {
$this->struct['_can_delete'] = pacol(
0,
0,
1,
'vnum',
'',
'',
'',
'',
$this->struct['_can_delete'] = pacol(0, 0, 1, 'vnum', '' , '' , '', '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
/*select*/ '1 as _can_delete'

@ -32,20 +32,20 @@ class VacationHandler extends PFAHandler {
$this->struct=array(
# field name allow display in... type $PALANG label $PALANG description default / options / ...
# editing? form list
'email' => pacol($this->new, 1, 1, 'text', 'pLogin_username', '', ''),
'domain' => pacol(1, 0, 0, 'text', '', '', ''),
'subject' => pacol(1, 1, 0, 'text', 'pUsersVacation_subject', '', ''),
'body' => pacol(1, 1, 0, 'text', 'pUsersVacation_body', '', ''),
'activefrom' => pacol(1, 1, 1, 'text', 'pUsersVacation_activefrom', '', ''),
'activeuntil' => pacol(1, 1, 1, 'text', 'pUsersVacation_activeuntil', '', ''),
'active' => pacol(1, 1, 1, 'bool', 'active', '', 1),
'created' => pacol(0, 0, 1, 'ts', 'created', ''),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified', ''),
'email' => pacol($this->new, 1, 1, 'text', 'pLogin_username' , '' , '' ),
'domain' => pacol(1, 0, 0, 'text', '' , '' , '' ),
'subject' => pacol(1, 1, 0, 'text', 'pUsersVacation_subject' , '' , '' ),
'body' => pacol(1, 1, 0, 'text', 'pUsersVacation_body' , '' , '' ),
'activefrom' => pacol(1, 1, 1, 'text', 'pUsersVacation_activefrom' , '' , '' ),
'activeuntil' => pacol(1, 1, 1, 'text', 'pUsersVacation_activeuntil' , '' , '' ),
'active' => pacol(1, 1, 1, 'bool', 'active' , '' , 1 ),
'created' => pacol(0, 0, 1, 'ts', 'created' , '' ),
'modified' => pacol(0, 0, 1, 'ts', 'last_modified' , '' ),
# TODO: add virtual 'notified' column and allow to display who received a vacation response?
);
if (! db_pgsql()) {
$this->struct['cache'] = pacol(0, 0, 0, 'text', '', '', ''); # leftover from 2.2
if ( ! db_pgsql() ) {
$this->struct['cache'] = pacol(0, 0, 0, 'text', '' , '' , '' ); # leftover from 2.2
}
}

@ -111,11 +111,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
} elseif ($field['type'] == 'txtl') {
$values[$key] = $inp_values[$key];
$values[$key] = preg_replace('/\\\r\\\n/', ',', $values[$key]);
$values[$key] = preg_replace('/\r\n/', ',', $values[$key]);
$values[$key] = preg_replace('/,[\s]+/i', ',', $values[$key]);
$values[$key] = preg_replace('/[\s]+,/i', ',', $values[$key]);
$values[$key] = preg_replace('/,,*/', ',', $values[$key]);
$values[$key] = preg_replace('/,*$|^,*/', '', $values[$key]);
$values[$key] = preg_replace('/\r\n/', ',', $values[$key]);
$values[$key] = preg_replace('/,[\s]+/i', ',', $values[$key]);
$values[$key] = preg_replace('/[\s]+,/i', ',', $values[$key]);
$values[$key] = preg_replace('/,,*/', ',', $values[$key]);
$values[$key] = preg_replace('/,*$|^,*/', '', $values[$key]);
if ($values[$key] == '') {
$values[$key] = array();
} else {

Loading…
Cancel
Save