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')
),
'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',
'',
'',
'',
'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,8 +72,7 @@ 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'
),
' ) 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', ''),

@ -24,27 +24,10 @@ class AdminpasswordHandler extends PFAHandler {
# 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
),
'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',
'',
'',
'',
'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)
),
'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',
'',
'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
),
/*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,
'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,
'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?
/*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
'_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,27 +14,11 @@ 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 */
),
/* 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

@ -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')
),
'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',
'',
'',
'',
'',
'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',
'',
'',
'',
'',
'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'))
),
' 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')
),
'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,
'_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' ),
);
}

@ -18,28 +18,13 @@ class MailboxHandler extends PFAHandler {
# 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
),
'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',
'',
'',
'password2' => pacol(1, 1, 0, 'pass', 'password_again' , '' , '',
/*options*/ '',
/*not_in_db*/ 0,
/*dont_write_to_db*/ 1,
@ -50,17 +35,9 @@ class MailboxHandler extends PFAHandler {
# 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,
'welcome_mail' => pacol($this->new, $this->new, 0, 'bool', 'pCreate_mailbox_mail' , '' , 1,
/*options*/ '',
/*not_in_db*/ 1
),
/*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', '' , '' ),

@ -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'

Loading…
Cancel
Save