- 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
- $struct: add is_mailbox (does the alias belong to a mailbox?)
- $struct: add goto_mailbox (if the alias is a mailbox, does it point
to the mailbox or is it forward-only?)
- set goto_mailbox in read_from_db_postprocess()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1347 a1433add-5e2c-0410-b055-b7f2511e0802
- initStruct(): add 'on_vacation'
- read_from_db_postprocess(): split off vacation alias from $goto
and store vacation status in on_vacation (honors the vacation alias
only, not the details from the vacation table)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1344 a1433add-5e2c-0410-b055-b7f2511e0802
- override init() - change '*@domain' -> '@domain', then call parent::init()
- validate_new_id(): allow catchall ('@domain'), check only domain in this case
- create_allowed(): copy of check_alias() from functions.inc.php, with
superfluous { ... } removed
- remove forgotten debugging from mergeId()
- _field_goto():
- allow '@domain' targets (domain-wide forward)
- use an array to collect error messages - that avoids 'uninitialized'
warnings and allows to easily change the join() glue if needed
Overall status:
- create-alias is now fully supported
- handling of vacation and mailbox aliases is still on my TODO list, which
means we still need edit-alias for now
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1316 a1433add-5e2c-0410-b055-b7f2511e0802
(TODO: catchall handling, mailbox and vacation aliases)
AliasHandler.php
- drop unused $username
- set $domain_field
- initStruct():
- use correct labels
- set 'domain' field options to allowed domains
- add (virtual) 'localpart' field
- add comments for more virtual fields
- add webformConfig() (note: modifies $struct on $new - otherwise we
couldn't use the domain dropdown in the web interface)
- add mergeId to merge localpart and domain to address (called by
edit.php _before_ ->init)
- add validate_new_id() (doesn't work for catchall yet)
- add setmore() to
- fill 'domain' based on 'address'
- convert $values[goto] from array to comma-separated string
- add read_from_db_postprocess to split goto to an array
(TODO: handling of mailbox and vacation aliases)
- add _field_goto() validator
- add empty, commented dummy delete() that will replace the "old"
delete function one day
- make hasAliasRecord() private (only used internally)
- mark all "old" functions as obsolete
edit.php:
- add handling of txtl field (convert textarea to array)
- call $handler->mergeId if $id_field is editable, but not displayed
in form (usecase: merge localpart + domain to address)
editform.tpl:
- add handling of txtl fields (textarea, filled by array)
PFAHandler.php:
- add setmore() hook function - runs at the end of set()
AdminHandler.php:
- add a comment for 'txtl' (array of one line texts, like alias goto)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1311 a1433add-5e2c-0410-b055-b7f2511e0802
- add initStruct() (not the final version, but works for now)
- add initMsg()
- replace $this->username with $this->id everywhere
- drop __construct() - default __construct will be used now
users/edit-alias.php, xmlrpc.php, VacationHandler.php, scripts/shells/alias.php:
- use default init sequence for AliasHandler (new, then ->init())
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1310 a1433add-5e2c-0410-b055-b7f2511e0802
*fixed VacationHandler.php
*changed edit-vacation to us VacationHandler
*added todopoint to upgrade.php
*fixed problem in AliasHandler
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@981 a1433add-5e2c-0410-b055-b7f2511e0802
column and value are separate parameters now
functions.inc.php:
- changed function db_update() parameters - column name and value for the WHERE
condition are now two separate parameters. This means we don't need to
escape_string(), add quotes etc. for most UPDATE queries.
Example call: db_update('alias', 'address', $this->username, $values_array)
- the previous db_update() is now called db_update_q()
model/UserHandler.php:
- changed db_update call to the new parameters
- removed now unused variables
- renamed $username to $E_username
- call pacrypt directly when setting the $set array, no need for $new_db_password
model/AliasHandler.php
- changed db_update call to the new parameters
edit-mailbox.php
- switched to db_update_q()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@931 a1433add-5e2c-0410-b055-b7f2511e0802
shells/alias.php:
- execute still called help() instead of __handle()
model/AliasHandler.php - delete():
- remove useless $address parameter from delete() (we have $this->username)
- added error messages
- fixed variable names for db_log
Reason for the "mostly":
The $this->is_mailbox_alias() in delete() always returns true and therefore
forbids deletion.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@930 a1433add-5e2c-0410-b055-b7f2511e0802
-added alias delete function
-remove silly password function in domain and alias
-changed some $this->err to $this->error
-error ends with stop(1) which returns 1 in *unix shells
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@920 a1433add-5e2c-0410-b055-b7f2511e0802
- pass $username through strtolower()
- get(): error check first for better readability (avoids long if block)
- get(): fixed a forgotten return behaviour change
- get(): renamed $new_list to $filtered_list (self-explaining code)
- update(): migrated to new return behaviour of get()
- update(): use db_update etc.
- some minor changes
- added various TODO notes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@915 a1433add-5e2c-0410-b055-b7f2511e0802
changed behaviour of get()
- get() now returns only true (success) / false (failure) instead of
the alias list
(result of partly merging in scripts/models-ext/AliasHandler.php)
- new method result() to get the real result (alias targets)
- added TODO on if(sizeof($addresses) == 0) - this should never happen
model/VacationHandler.php:
- updated for new AliasHandler bevaviour
xmlrpc.php:
- updated for new AliasHandler bevaviour
- switched from obsolete change_pass to change_pw method
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@912 a1433add-5e2c-0410-b055-b7f2511e0802