Commit Graph
117 Commits
Author SHA1 Message Date
mkocustos 513542370d Let admins store a default for the alias "To" (goto) field (#1061)
adds new db table admin_preferences to store a default goto for aliases etc, which when populated will prefil the forward form with that value.


thanks @mkocustos
2026-07-25 10:56:40 +01:00
Rodrigo Cortés Cano d60ff99e77 Apply user alias ownership check consistently 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 3ab0104d1a Address forwarding editor review feedback 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 8d631d2ce8 Skip internal vacation target validation 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 9a9078ce21 Unify user and admin forwarding editor 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 43fbf7e56b UI improvements for virtual form labels and search spacing (#1052)
small UI and translation fixes for virtual/admin forms.

Changes:

- Adds PALANG entry for the domain search placeholder.
- Replaces the hardcoded domain search placeholder in edit forms.
- Shows the Domain label when creating aliases and mailboxes.
- Uses Bootstrap 5 form-select for generated select controls.
- Adds minor spacing for the virtual search field.

Thanks @trapoSAMA
2026-07-03 18:33:55 +01:00
Justin Warren 2469e045d8 Add 'description' field to alias and alias_domain tables. (#1042)
Adds a `description` field to the `alias` and `alias_domain` tables, so you can add a comment explaining why the alias exists.

Partially addresses #1036

thanks @jpwarren
2026-06-08 09:08:02 +01:00
Kent Riboe 8e6a4f0f4b Add developer documentation for Handler classes, update PFAHandler::pacol() params (#1008)
Add DOCUMENTS/HANDLER_CLASSES.md which attempts to document how the Handler classes work and help future developers/contributors. 

Changes spec of PFAHandler::pacol() to discourage the 9th parameter (was: multiopt) from being passed as an array (param renamed to not_in_db). Previous behaviour is maintained, but a deprecation error should be triggered.
2026-04-18 10:10:00 +01:00
Kent Riboe 26530c5d0b Replace escape_string() concatenation with parameterized queries (#1004)
* Replace most escape_string() usages with parameterized queries (reducing the chance of SQL injection), see also #1003 

thanks @knofte
2026-04-06 20:47:34 +01:00
David Goodwin b092017f9b be more explict over what types class properties should be 2026-01-28 09:50:26 +00:00
David Goodwin 52794bede7 misc fixes for psalm after allowing it to be updated 2026-01-28 09:50:26 +00:00
Sven Strickroth 42981d5b70 Check for address validity before checking domain existence
get_domain_properties might throw.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2026-01-25 16:29:58 +01:00
David Goodwin 0d5edbf099 move pacol() into PFAHandler class, I think it makes more sense for it to be there given the dependency between the two 2025-07-13 10:12:22 +01:00
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