0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00
Commit Graph

104 Commits

Author SHA1 Message Date
David Goodwin
f01274ec94
try relaxing composer dependencies to allow php8.2 dev support, reformat so composer format passes 2024-04-22 21:02:01 +01:00
David Goodwin
eda637df1a
Merge branch 'master' into michaelkrieger-patch-1 2024-01-11 08:51:17 +00:00
Adrien Crivelli
80e500591f
Avoid deprecation in PHP 8.1 2022-07-15 11:44:58 +02:00
David Goodwin
2d6ded2786 PSR2 -> PSR12 formatting 2022-06-28 13:46:11 +01:00
David Goodwin
2edabc3e03 phpcs insists on some brace changes 2021-04-13 21:19:16 +01:00
David Goodwin
823f27b29d phpcs wants to change ... 2021-03-22 09:28:28 +00:00
David Goodwin
3c7da4f3b8 Refactor some methods
PFAHandler::store() -> PFAHandler::save();
 PFAHandler::storemore() -> PFAHandler::postSave();
 PFAHandler::beforestore() -> PFAHandler::preSave();
2020-09-25 21:29:45 +01:00
David Goodwin
12f68a6e3a composer format time 2020-08-13 15:27:47 +01:00
David Goodwin
5bd5bdc25b merge https://github.com/postfixadmin/postfixadmin/pull/375 add unit test 2020-08-13 15:00:22 +01:00
GermanCoding
fe3e9e2702 Disallow alias that points to itself (fixes #358)
Based on an older commit, but this time done right. This change prevents any user-defined aliases
that point to themselves, because such aliases are not supported by Postfix and cause mail
delivery errors.
2020-08-07 22:15:45 +02:00
David Goodwin
89aebea61d Revert "Disallow aliases that point to themselves (fixes postfixadmin/postfixadmin/issues/358)"
This reverts commit c3d5b26740.
2020-08-06 20:28:20 +01:00
GermanCoding
c3d5b26740 Disallow aliases that point to themselves (fixes postfixadmin/postfixadmin/issues/358)
See github.com/postfixadmin/postfixadmin/issues/358 for details
2020-08-06 16:12:04 +01:00
David Goodwin
e8f27969a3 psalm fixes 2020-06-21 16:44:43 +01:00
David Goodwin
e4158d6d7e psalm fix 2020-04-14 21:25:36 +01:00
David Goodwin
ffc7787b76 psalm fix 2020-04-14 21:09:18 +01:00
David Goodwin
3303f25bcc add some php 7+ array type hints. 2020-03-16 13:11:15 +00:00
Michael Krieger
101490111a
Update AliasHandler.php 2020-03-05 18:06:13 -05:00
Michael Krieger
02e238cf30
Add a local-only domain check 2020-03-05 17:47:04 -05:00
David Goodwin
9dfc866edd composer format 2020-02-23 18:59:07 +00:00
David Goodwin
95d92a2345 psalm fix: rewrite to avoid php error (@) suppression 2020-02-12 21:33:55 +00:00
David Goodwin
1ad184641d php7.4 / psalm fixes 2020-01-31 16:30:46 +00:00
David Goodwin
2742849e7b reformat 2019-09-17 21:06:00 +01:00
David Goodwin
034a50836c tighten psalm checks 2019-09-17 20:50:42 +01:00
David Goodwin
74002bbf57 psalm fixes 2018-12-27 21:43:11 +00:00
Christian Boltz
d2588a4de2
Fix phpcs whitespace breakage in initStruct etc. 2018-04-22 18:24:41 +02:00
David Goodwin
cb34da4f46 phpcs reformat 2018-02-18 19:59:37 +00:00
David Goodwin
5e1855632a allow local aliases - see #134 2018-02-09 21:19:45 +00:00
Adrien Crivelli
15df6c1d7b
Reformat everything with PHP-Cs-Fixer 2018-01-26 23:54:37 +09:00
Jan-Frederik Rieckers
800f07816a
Fix wrong way of check for can_delete 2017-02-07 15:54:21 +01:00
Jan-Frederik Rieckers
7bb36d0bbc
Fix security hole in AliasHandler
Without this fix it is possible to delete a protected alias via editing
the request parameter of the alias to delete.
2017-02-03 14:53:10 +01:00
Christian Boltz
9ba7118d7b AliasHandler: restrict mailbox subquery to requested domains
set_is_mailbox_extrafrom() restricts the domain list to the domain that
needs to be checked (in normal list-virtual listing one domain), and is
then used to restore the default extrafrom.
This improves the performance for most usecases even for superadmins.

Note: Search mode might still be slow because by default it searches in
all domains available to the admin.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1882 a1433add-5e2c-0410-b055-b7f2511e0802
2016-11-09 20:41:24 +00:00
Christian Boltz
40b4fdf61c beautify alias list search parameters
AliasHandler:
- initStruct(): handle __mailbox_username as separate field (needed to
  make it searchable)
- split off a condition_ignore_mailboxes() function (used in getList()
  and getPagebrowser()) to add '__mailbox_username IS NULL' to the search
  condition array. Also, make sure $condition can be an array (preferred)
  or a string with a raw query

list-virtual.php:
- hand over a search array instead of a raw query


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1879 a1433add-5e2c-0410-b055-b7f2511e0802
2016-11-01 17:43:32 +00:00
Christian Boltz
bd28fcb194 AliasHandler: restrict __is_mailbox subquery to allowed domains
This improves performance on setups with lots of mailboxes.
Well, except for superadmins because restricting to "all domains"
doesn't really help ;-)

Thanks to gygy for reporting this on IRC, and for testing the patch.



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1877 a1433add-5e2c-0410-b055-b7f2511e0802
2016-10-31 20:15:31 +00:00
Christian Boltz
37bba15625 Use list.tpl to display the alias list
list-virtual.php:
- use list.tpl for aliases
- move show_gen_status handling for aliases to AliasHandler

AliasHandler:
- initStruct():
  - add 'status' column (hidden by default)
  - hide 'created'
  - move 'active' after 'modified' to match old list-virtual.php layout
- initMsg: add list_header
- webformConfig(): if $CONF[show_status], set display_in_list for
  'status' column. Also set a (whitespace) label to make sure it's
  displayed
- db_read_from_db_postprocess(): if 'status' column is requested, call
  gen_show_status() for each row

list-virtual.tpl
- remove alias table header and create alias button (which should have
  been in list-virtual_alias.tpl)

list-virtual_alias.tpl:
- replace code to generate the alias table with {include 'list.tpl'}
  (and some variable assignments)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1777 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 22:09:18 +00:00
Christian Boltz
3a72203de4 AliasHandler:
- initStruct(): replace (wrong) 'editable' with '_can_edit' and '_can_delete'
- read_from_db_postprocess(): disable _can_edit and _can_delete for
  default aliases if special_alias_control is off and not superadmin

list.tpl:
- use $item._can_edit instead of $check_alias_owner

list-virtual.php:
- drop $check_alias_owner variable and check_alias_owner() call
  (replaced by the code added in AliasHandler)
- drop unused $sql_domain

functions.inc.php:
- delete no longer used check_alias_owner() function



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1774 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 20:35:19 +00:00
Christian Boltz
4ce0a57e83 PFAHandler:
- add protected $searchfields = array(); - list of fields to search by
  default, if just a search term is given. This will be done with
  $search['_'], but that code is not implemented yet.
- add $this->msg['show_simple_search'] (true if $searchfields is non-empty)

list.tpl:
- display search input box and search overview only if $searchfields is
  not empty

AliasdomainHandler:
- add 'alias_domain' and 'target_domain' to $searchfields

MailboxHandler:
- add 'username' to $searchfields

AliasHandler:
- add 'address' and 'goto' to $searchfields

This effectively means that the search input box is no longer displayed
in list.php for admin, domain and fetchmail listings.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1770 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-05 20:23:38 +00:00
Christian Boltz
313270c00a PFAHandler.php:
- add getPagebrowser() (returns an array of pagebrowser keys)

AliasHandler.php:
- change getList() to work with empty $condition
- add getPagebrowser() to filter out mailboxes

list-virtual.php:
- replace $alias_pagebrowser_query and the create_page_browser() call
  with $handler->getPagebrowser()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1757 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-19 22:57:23 +00:00
Christian Boltz
cc2b157d59 *Handler:
- add $msg['confirm'] (confirmation message when attemping to delete an
  item, displayed by list.php)

*.lang:
- add various confirm_delete_* texts needed by *Handler
- rename confirm_domain to confirm_delete_domain


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1749 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-17 21:07:59 +00:00
Christian Boltz
7bf5b74a47 MailboxHandler, AliasHandler:
- initStruct: set "display in list" to 1 to allow searching for domain
  with list.php (nevertheless, the domain won't be displayed because
  it doesn't have a column label set)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1735 a1433add-5e2c-0410-b055-b7f2511e0802
2015-01-07 21:25:20 +00:00
Christian Boltz
13f1a28b6e PFAHandler:
- read_from_db(), getList(): 
  - add $searchmode parameter (_before_ $limit and $offset!) to be able to 
    use query different query modes, not only "="
  - add a warning that $condition will be changed to array only in the future
- getList(): filter $condition for fields that are available to the user
  to avoid information leaks by using search parameters
  (filter is only applied if $condition is an array!)

functions.inc.php: 
- db_where_clause():
  - add $additional_raw_where parameter for additional query parameters
  - add $searchmode parameter to be able to use query different
    query modes, not only "=" (see $allowed_operators)
  - check for allowed operators in $searchmode
  - split query into WHERE and HAVING (if a parameter has
    $struct[select] set, HAVING is used)

list-virtual.php:
- adopt getList() call to the new syntax

AliasHandler:
- adopt getList() definition and call to the new syntax

 


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1731 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-02 22:45:22 +00:00
Christian Boltz
6ec360b0b7 AliasHandler:
- finally fix alias deletion when using MariaDB. The workaround is
  to add another field from the subquery to the outer SELECT so that
  MariaDB can't optimize the subquery to "always 1"
  http://sourceforge.net/p/postfixadmin/bugs/325/
  (I'll open a MariaDB bugreport and add the link to the bugtracker)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1703 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-23 18:26:54 +00:00
Christian Boltz
46a632ec02 AliasHandler:
- initStruct(): revert the MariaDB workaround because PostfixAdmin now
  "thinks" none of the aliases belong to a mailbox (and displays all of
  them in the alias list, even the mailbox aliases)
  - reverts r1699 + the CHANGELOG entry (part of r1700)
  - reopened https://sourceforge.net/p/postfixadmin/bugs/325/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1702 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-22 16:30:25 +00:00
Christian Boltz
d9ff7ece05 AliasHandler:
- initStruct(): use "SELECT COUNT(1)" instead of "SELECT 1" as workaround
  for a MariaDB problem (bug?)
  https://sourceforge.net/p/postfixadmin/bugs/325/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1700 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-22 15:12:08 +00:00
Christian Boltz
c5de88390e PFAHandler.php:
fix logging - log the domain instead of $this->id
- add protected $domain (used for logging)
- add function domain_from_id()
- http://sourceforge.net/p/postfixadmin/bugs/317/

AliasHandler.php:
- add function domain_from_id()

MailboxHandler.php:
- add function domain_from_id()
- init(): use $this->domain instead of splitting $this-id again



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1684 a1433add-5e2c-0410-b055-b7f2511e0802
2014-09-12 09:22:09 +00:00
Christian Boltz
8e5a4551cb AliasHandler:
- fix query in getList(), which caused an empty list on some systems
  https://sourceforge.net/p/postfixadmin/bugs/313/
  Fix by VERSATECH SRL, versatechsrl @SF


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1678 a1433add-5e2c-0410-b055-b7f2511e0802
2014-06-06 19:11:05 +00:00
Christian Boltz
566f2845bd AliasHandler:
- setmore(): use old goto values if no new value is given. Fixes
  'Making alias inactive cleans "goto" field'
  https://sourceforge.net/p/postfixadmin/bugs/316/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1675 a1433add-5e2c-0410-b055-b7f2511e0802
2014-05-27 21:27:20 +00:00
Christian Boltz
801acc6cf2 AliasHandler:
- only allow @domain as target if $this->id is a catchall
- delete commented out version of delete()
- better error messages

languages/*.lang
- add new texts needed for AliasHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1587 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-16 20:20:50 +00:00
Christian Boltz
b3dc3f91ae AliasHandler:
- if parent::init() fails, return false early to avoid warnings about
  undefined $this->result


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1574 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-13 00:40:08 +00:00
Christian Boltz
3b09562fb8 MailboxHandler.php:
- rewrite and simplify delete()
- also cleanup fetchmail, quota	and quota2 tables

AliasHandler.php:
- update delete() to match the workflow in other classes



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1562 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-10 19:38:43 +00:00
Christian Boltz
1b74926afb PFAHandler, *Handler:
- rename _field_$field() to _validate_$field() to make the function name
  more obvious
 


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1555 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-08 21:26:46 +00:00