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
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
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
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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
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
- 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
- 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
found out that the 'Config' class is too static - it shares its static
data with the 'Lang' child class.
This caused a conflict because we have $CONF[transport] and
$PALANG[transport], and Config::read('transport') returned the $PALANG
text.
To fix this, all texts are now stored as $CONF[__LANG].
I also dropped the 'Lang' class.
model/Config.php:
- mark the 'Config' class as final to ensure we don't trap into the
"too static" problem again.
- bool(): display and log an error message if a $CONF option does not
contain YES or NO (that would have uncovered this bug much earlier)
- add lang() and lang_f() wrapper functions to get $PALANG texts
- remove unused $__cache and $__objects
model/Lang.php:
- deleted
common.php:
- store $PALANG as $CONF[__LANG]
lots of files:
- replace Lang::read() and Lang::read_f() calls with Config::lang()
and Config::lang_f()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1536 a1433add-5e2c-0410-b055-b7f2511e0802
- initStruct(): set default for 'goto' to empty array()
This fixes a problem with the cli when --goto was not specified
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1530 a1433add-5e2c-0410-b055-b7f2511e0802
- check_domain(), check_email(): instead of calling flash_error(),
return string with error message - or empty string if everything is ok
model/AdminHandler.php, model/AliasHandler.php,
model/DomainHandler.php, model/MailboxHandler.php,
sendmail.php, users/edit-alias.php:
- adopt to changed check_domain() and check_email() return value
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1451 a1433add-5e2c-0410-b055-b7f2511e0802
- initStruct(): add some comments
- add calledBy() and protected $called_by - calledBy() should be called if one
*Handler class calls another one (to avoid loops etc.)
AliasHandler.php:
- replace $called_by_MailboxHandler / MailboxAliasConfig() with $called_by
(code moved to PFAHandler->calledBy())
MailboxHandler.php:
- beforestore(): update alias active status on edit
(contains some whitespace changes - basically I removed "if ($this->new)"
around most parts of the code)
- use calledBy() instead of MailboxAliasConfig()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1449 a1433add-5e2c-0410-b055-b7f2511e0802
- add MailboxAliasConfig() and $called_by_MailboxHandler for special
handling if called by MailboxHandler
- create_allowed(): always allow creating an alias for a mailbox
- remove _missing_on_vacation() and _missing_active() which returned the
default from $this->struct. This is now done by default, see previous
change in PFAHandler
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1424 a1433add-5e2c-0410-b055-b7f2511e0802
- prefill all $formconf['prefill'] fields from URL parameters (typically
used for the domain)
model/AliasdomainHandler.php:
- allow to prefill alias_domain and target_domain from URL parameters
model/AliasHandler.php:
- allow to prefill domain from URL parameters
- some whitespace changes
- add storemore() with a TODO note
model/MailboxHandler.php:
- allow to prefill domain from URL parameters
- some whitespace changes
- add some TODO notes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1422 a1433add-5e2c-0410-b055-b7f2511e0802
- set(): call $this->_missing_$fieldname() if a field is not set on $new
- new function set_default_value() - typically called from
_missing_$fieldname to set the default from $struct
AliasHandler:
- set default values on $new:
- on_vacation and active from $struct default
- localpart and domain based on address
scripts/shells/alias.php:
- convert AddTask to *Handler syntax. It was broken before, see
https://sourceforge.net/tracker/?func=detail&aid=3232719&group_id=191583&atid=937964
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1364 a1433add-5e2c-0410-b055-b7f2511e0802
- move getVacationAlias to AliasHandler (the only code that uses it)
AliasHandler:
- insert (and rewrite) function getVacationAlias()
- change $vh->getVacationAlias() calls to $this->getVacationAlias.
This also means we don't need to call VacationHandler anymore to get
the vacation alias.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1359 a1433add-5e2c-0410-b055-b7f2511e0802
AliasHandler.php:
- remove obsolete functions update(), is_mailbox_alias(),
is_vacation_address(), hasAliasRecord()
- updated delete() to use new *Handler syntax (most of it should be
moved to PFAHandler, but that's another story ;-)
users/edit-alias.php:
- replace $ah->update with $ah->set / $ah->store
- use 0/1 for $fForward_and_store instead of YES/NO
- use safepost instead of isset()
templates/users_edit-alias.tpl:
- use 0/1 for $fForward_and_store instead of YES/NO
xmlrpc.php:
- replace $ah->update with new *Handler syntax
Note: the changes in xmlrpc.php are untested again ;-)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1358 a1433add-5e2c-0410-b055-b7f2511e0802
- remove deprecated functions get() and hasStoreAndForward()
scripts/shells/alias.php:
- ViewTask: switch to *Handler syntax
- ViewTask: display is_mailbox, goto_mailbox and on_vacation status
users/edit-alias.php:
- replace $ah->get() and $ah->hasStoreAndForward() with *Handler syntax
- remove outdated comment in header
xmlrpc.php:
- switch get() and hasStoreAndForward() to *Handler syntax
Note: the changes in xmlrpc.php are untested!
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1357 a1433add-5e2c-0410-b055-b7f2511e0802
- use new *Handler syntax to add/remove vacation alias
(implemented as function updateAlias() to avoid code duplication)
AliasHandler:
- setmore(): only use $oldvalues if no new on_vacation value is given
- setmore(): fix "undefined index" warning
edit.php:
- only set $values if a field is editable and displayed in the form
- do not set default values in $values
(without those changes, the vacation alias was always removed when
editing an alias)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1356 a1433add-5e2c-0410-b055-b7f2511e0802
- add support for LIMIT/OFFSET to getList()
AliasHandler:
- overload getList() to only return non-mailbox aliases
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1353 a1433add-5e2c-0410-b055-b7f2511e0802
- setmore(): keep/(re-)add vacation and mailbox alias to goto
- hide 'goto_mailbox' if the alias does not belong to a mailbox
(done in initStruct for $new, otherwise in init())
edit.php:
- set $form_fields and $id_field later (after $hander->init()) - needed
for AliasHandler to decide if goto_mailbox should be displayed
With this commit, AliasHandler is feature-complete for usage with
edit.php. We even get a "deliver to local mailbox" checkbox :-)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1348 a1433add-5e2c-0410-b055-b7f2511e0802