PostfixAdmin - web based virtual user administration interface for Postfix mail servers https://postfixadmin.github.io/postfixadmin/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

384 lines
17 KiB

AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
AliasHandler now works with edit.php in many cases (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
14 years ago
  1. <?php
  2. # $Id$
  3. /**
  4. * Handlers User level alias actions - e.g. add alias, get aliases, update etc.
  5. * @property $username name of alias
  6. * @property $return return of methods
  7. */
  8. class AliasHandler extends PFAHandler {
  9. protected $db_table = 'alias';
  10. protected $id_field = 'address';
  11. protected $domain_field = 'domain';
  12. /**
  13. *
  14. * @public
  15. */
  16. public $return = null;
  17. protected function initStruct() {
  18. # hide 'goto_mailbox' if $this->new
  19. # (for existing aliases, init() hides it for non-mailbox aliases)
  20. $mbgoto = 1 - $this->new;
  21. $this->struct=array(
  22. # field name allow display in... type $PALANG label $PALANG description default / ...
  23. # editing? form list
  24. 'address' => pacol( $this->new, 1, 1, 'mail', 'alias' , 'pCreate_alias_catchall_text' ),
  25. 'localpart' => pacol( $this->new, 0, 0, 'text', 'alias' , 'pCreate_alias_catchall_text' , '',
  26. /*options*/ '',
  27. /*not_in_db*/ 1 ),
  28. 'domain' => pacol( $this->new, 0, 0, 'enum', '' , '' , '',
  29. /*options*/ $this->allowed_domains ),
  30. 'goto' => pacol( 1, 1, 1, 'txtl', 'to' , 'pEdit_alias_help' , array() ),
  31. 'is_mailbox' => pacol( 0, 0, 1, 'int', '' , '' , 0 ,
  32. # technically 'is_mailbox' is bool, but the automatic bool conversion breaks the query. Flagging it as int avoids this problem.
  33. # Maybe having a vbool type (without the automatic conversion) would be cleaner - we'll see if we need it.
  34. /*options*/ '',
  35. /*not_in_db*/ 0,
  36. /*dont_write_to_db*/ 1,
  37. /*select*/ 'coalesce(__is_mailbox,0) as is_mailbox',
  38. /*extrafrom*/ 'LEFT JOIN ( ' .
  39. ' SELECT 1 as __is_mailbox, username as __mailbox_username ' .
  40. ' FROM ' . table_by_key('mailbox') .
  41. ' WHERE username IS NOT NULL ' .
  42. ' ) AS __mailbox ON __mailbox_username = address' ),
  43. 'goto_mailbox' => pacol( $mbgoto, $mbgoto,$mbgoto,'bool', 'pEdit_alias_forward_and_store' , '' , 0,
  44. /*options*/ '',
  45. /*not_in_db*/ 1 ), # read_from_db_postprocess() sets the value
  46. 'on_vacation' => pacol( 1, 0, 1, 'bool', 'pUsersMenu_vacation' , '' , 0 ,
  47. /*options*/ '',
  48. /*not_in_db*/ 1 ), # read_from_db_postprocess() sets the value - TODO: read active flag from vacation table instead?
  49. 'active' => pacol( 1, 1, 1, 'bool', 'active' , '' , 1 ),
  50. 'created' => pacol( 0, 0, 1, 'ts', 'created' , '' ),
  51. 'modified' => pacol( 0, 0, 1, 'ts', 'last_modified' , '' ),
  52. 'editable' => pacol( 0, 0, 1, 'int', '' , '' , 0 ,
  53. # aliases listed in $CONF[default_aliases] are read-only for domain admins if $CONF[special_alias_control] is NO.
  54. # technically 'editable' is bool, but the automatic bool conversion breaks the query. Flagging it as int avoids this problem.
  55. # Maybe having a vbool type (without the automatic conversion) would be cleaner - we'll see if we need it.
  56. /*options*/ '',
  57. /*not_in_db*/ 0,
  58. /*dont_write_to_db*/ 1,
  59. /*select*/ '1 as editable' ),
  60. );
  61. }
  62. protected function initMsg() {
  63. $this->msg['error_already_exists'] = 'email_address_already_exists';
  64. $this->msg['error_does_not_exist'] = 'pCreate_alias_address_text_error1'; # TODO: better error message
  65. if ($this->new) {
  66. $this->msg['logname'] = 'create_alias';
  67. $this->msg['store_error'] = 'pCreate_alias_result_error';
  68. $this->msg['successmessage'] = 'pCreate_alias_result_success';
  69. } else {
  70. $this->msg['logname'] = 'edit_alias';
  71. $this->msg['store_error'] = 'pEdit_alias_result_error';
  72. $this->msg['successmessage'] = 'pCreate_alias_result_success'; # TODO: better message for edit
  73. }
  74. }
  75. public function webformConfig() {
  76. if ($this->new) { # the webform will display a localpart field + domain dropdown on $new
  77. $this->struct['address']['display_in_form'] = 0;
  78. $this->struct['localpart']['display_in_form'] = 1;
  79. $this->struct['domain']['display_in_form'] = 1;
  80. }
  81. return array(
  82. # $PALANG labels
  83. 'formtitle_create' => 'pMain_create_alias',
  84. 'formtitle_edit' => 'pEdit_alias_welcome',
  85. 'create_button' => 'add_alias',
  86. # various settings
  87. 'required_role' => 'admin',
  88. 'listview' => 'list-virtual.php',
  89. 'early_init' => 0,
  90. 'prefill' => array('domain'),
  91. );
  92. }
  93. /**
  94. * AliasHandler needs some special handling in init() and therefore overloads the function.
  95. * It also calls parent::init()
  96. */
  97. public function init($id) {
  98. @list($local_part,$domain) = explode ('@', $id); # supress error message if $id doesn't contain '@'
  99. if ($local_part == '*') { # catchall - postfix expects '@domain', not '*@domain'
  100. $id = '@' . $domain;
  101. }
  102. $retval = parent::init($id);
  103. if (!$retval) return false; # parent::init() failed, no need to continue
  104. # hide 'goto_mailbox' for non-mailbox aliases
  105. # parent::init called view() before, so we can rely on having $this->result filled
  106. # (only validate_new_id() is called from parent::init and could in theory change $this->result)
  107. if ($this->new || $this->result['is_mailbox'] == 0) {
  108. $this->struct['goto_mailbox']['editable'] = 0;
  109. $this->struct['goto_mailbox']['display_in_form'] = 0;
  110. $this->struct['goto_mailbox']['display_in_list'] = 0;
  111. }
  112. if ( !$this->new && $this->result['is_mailbox'] && $this->admin_username != ''&& !authentication_has_role('global-admin') ) {
  113. # domain admins are not allowed to change mailbox alias $CONF['alias_control_admin'] = NO
  114. # TODO: apply the same restriction to superadmins?
  115. if (!Config::bool('alias_control_admin')) {
  116. # TODO: make translateable
  117. $this->errormsg[] = "Domain administrators do not have the ability to edit user's aliases (check config.inc.php - alias_control_admin)";
  118. return false;
  119. }
  120. }
  121. return $retval;
  122. }
  123. protected function validate_new_id() {
  124. if ($this->id == '') {
  125. $this->errormsg[$this->id_field] = Config::lang('pCreate_alias_address_text_error1');
  126. return false;
  127. }
  128. list($local_part,$domain) = explode ('@', $this->id);
  129. if(!$this->create_allowed($domain)) {
  130. $this->errormsg[$this->id_field] = Config::lang('pCreate_alias_address_text_error3');
  131. return false;
  132. }
  133. # TODO: already checked in set() - does it make sense to check it here also? Only advantage: it's an early check
  134. # if (!in_array($domain, $this->allowed_domains)) {
  135. # $this->errormsg[] = Config::lang('pCreate_alias_address_text_error1');
  136. # return false;
  137. # }
  138. if ($local_part == '') { # catchall
  139. $valid = true;
  140. } else {
  141. $email_check = check_email($this->id);
  142. if ($email_check == '') {
  143. $valid = true;
  144. } else {
  145. $this->errormsg[$this->id_field] = $email_check;
  146. $valid = false;
  147. }
  148. }
  149. return $valid;
  150. }
  151. /**
  152. * check number of existing aliases for this domain - is one more allowed?
  153. */
  154. private function create_allowed($domain) {
  155. if ($this->called_by == 'MailboxHandler') return true; # always allow creating an alias for a mailbox
  156. $limit = get_domain_properties ($domain);
  157. if ($limit['aliases'] == 0) return true; # unlimited
  158. if ($limit['aliases'] < 0) return false; # disabled
  159. if ($limit['alias_count'] >= $limit['aliases']) return false;
  160. return true;
  161. }
  162. /**
  163. * merge localpart and domain to address
  164. * called by edit.php (if id_field is editable and hidden in editform) _before_ ->init
  165. */
  166. public function mergeId($values) {
  167. if ($this->struct['localpart']['display_in_form'] == 1 && $this->struct['domain']['display_in_form']) { # webform mode - combine to 'address' field
  168. if (empty($values['localpart']) || empty($values['domain']) ) { # localpart or domain not set
  169. return "";
  170. }
  171. if ($values['localpart'] == '*') $values['localpart'] = ''; # catchall
  172. return $values['localpart'] . '@' . $values['domain'];
  173. } else {
  174. return $values[$this->id_field];
  175. }
  176. }
  177. protected function setmore($values) {
  178. if ($this->new) {
  179. if ($this->struct['address']['display_in_form'] == 1) { # default mode - split off 'domain' field from 'address' # TODO: do this unconditional?
  180. list(/*NULL*/,$domain) = explode('@', $values['address']);
  181. $this->values['domain'] = $domain;
  182. }
  183. }
  184. if (! $this->new) { # edit mode - preserve vacation and mailbox alias if they were included before
  185. $old_ah = new AliasHandler();
  186. if (!$old_ah->init($this->id)) {
  187. $this->errormsg[] = $old_ah->errormsg[0];
  188. } elseif (!$old_ah->view()) {
  189. $this->errormsg[] = $old_ah->errormsg[0];
  190. } else {
  191. $oldvalues = $old_ah->result();
  192. if (!isset($values['on_vacation'])) { # no new value given?
  193. $values['on_vacation'] = $oldvalues['on_vacation'];
  194. }
  195. if ($values['on_vacation']) {
  196. $values['goto'][] = $this->getVacationAlias();
  197. }
  198. if ($oldvalues['is_mailbox']) { # alias belongs to a mailbox - add/keep mailbox to/in goto
  199. if (!isset($values['goto_mailbox'])) { # no new value given?
  200. $values['goto_mailbox'] = $oldvalues['goto_mailbox'];
  201. }
  202. if ($values['goto_mailbox']) {
  203. $values['goto'][] = $this->id;
  204. # if the alias points to the mailbox, don't display the "empty goto" error message
  205. if (isset($this->errormsg['goto']) && $this->errormsg['goto'] == Config::lang('pEdit_alias_goto_text_error1') ) {
  206. unset($this->errormsg['goto']);
  207. }
  208. }
  209. }
  210. }
  211. }
  212. $this->values['goto'] = join(',', $values['goto']);
  213. }
  214. protected function storemore() {
  215. # TODO: if alias belongs to a mailbox, update mailbox active status
  216. return true;
  217. }
  218. protected function read_from_db_postprocess($db_result) {
  219. foreach ($db_result as $key => $value) {
  220. # split comma-separated 'goto' into an array
  221. $db_result[$key]['goto'] = explode(',', $db_result[$key]['goto']);
  222. # Vacation enabled?
  223. list($db_result[$key]['on_vacation'], $db_result[$key]['goto']) = remove_from_array($db_result[$key]['goto'], $this->getVacationAlias() );
  224. # if it is a mailbox, does the alias point to the mailbox?
  225. if ($db_result[$key]['is_mailbox']) {
  226. # this intentionally does not match mailbox targets with recipient delimiter.
  227. # if it would, we would have to make goto_mailbox a text instead of a bool (which would annoy 99% of the users)
  228. list($db_result[$key]['goto_mailbox'], $db_result[$key]['goto']) = remove_from_array($db_result[$key]['goto'], $key);
  229. } else { # not a mailbox
  230. $db_result[$key]['goto_mailbox'] = 0;
  231. }
  232. # TODO: set 'editable' to 0 if not superadmin, $CONF[special_alias_control] == NO and alias is in $CONF[default_aliases]
  233. # TODO: see check_alias_owner() in functions.inc.php
  234. }
  235. return $db_result;
  236. }
  237. public function getList($condition, $limit=-1, $offset=-1) {
  238. # only list aliases that do not belong to mailboxes
  239. return parent::getList( "__is_mailbox IS NULL AND ( $condition )", $limit, $offset);
  240. }
  241. /* delete is already implemented in the "old functions" section
  242. public function delete() {
  243. $this->errormsg[] = '*** Alias domain deletion not implemented yet ***';
  244. return false; # XXX function aborts here until TODO below is implemented! XXX
  245. # TODO: move the needed code from delete.php here
  246. }
  247. */
  248. protected function _validate_goto($field, $val) {
  249. if (count($val) == 0) {
  250. # empty is ok for mailboxes - this is checked in setmore() which can clear the error message
  251. $this->errormsg[$field] = Config::lang('pEdit_alias_goto_text_error1');
  252. return false;
  253. }
  254. $errors = array();
  255. foreach ($val as $singlegoto) {
  256. if (substr($singlegoto, 0, 1) == '@') { # domain-wide forward - check only the domain part
  257. # Note: alias domains are better, but we should keep this way supported for backward compatibility
  258. # and because alias domains can't forward to external domains
  259. # TODO: allow this only if $this->id is a catchall?
  260. list (/*NULL*/, $domain) = explode('@', $singlegoto);
  261. $domain_check = check_domain($domain);
  262. if ($domain_check != '') {
  263. $errors[] = "$singlegoto: $domain_check";
  264. }
  265. } else {
  266. $email_check = check_email($singlegoto);
  267. if ($email_check != '') {
  268. $errors[] = "$singlegoto: $email_check";
  269. }
  270. }
  271. }
  272. if (count($errors)) {
  273. $this->errormsg[$field] = join(" ", $errors); # TODO: find a way to display multiple error messages per field
  274. return false;
  275. } else {
  276. return true;
  277. }
  278. }
  279. /**
  280. * on $this->new, set localpart based on address
  281. */
  282. protected function _missing_localpart ($field) {
  283. if (isset($this->RAWvalues['address'])) {
  284. $parts = explode('@', $this->RAWvalues['address']);
  285. if (count($parts) == 2) $this->RAWvalues['localpart'] = $parts[0];
  286. }
  287. }
  288. /**
  289. * on $this->new, set domain based on address
  290. */
  291. protected function _missing_domain ($field) {
  292. if (isset($this->RAWvalues['address'])) {
  293. $parts = explode('@', $this->RAWvalues['address']);
  294. if (count($parts) == 2) $this->RAWvalues['domain'] = $parts[1];
  295. }
  296. }
  297. /**
  298. * Returns the vacation alias for this user.
  299. * i.e. if this user's username was roger@example.com, and the autoreply domain was set to
  300. * autoreply.fish.net in config.inc.php we'd return roger#example.com@autoreply.fish.net
  301. * @return string an email alias.
  302. */
  303. protected function getVacationAlias() {
  304. $vacation_goto = str_replace('@', '#', $this->id);
  305. return $vacation_goto . '@' . Config::read('vacation_domain');
  306. }
  307. /**
  308. * @return true on success false on failure
  309. */
  310. public function delete() {
  311. if( ! $this->view() ) {
  312. $this->errormsg[] = 'An alias with that address does not exist.'; # TODO: make translatable
  313. return false;
  314. }
  315. if ($this->result['is_mailbox']) {
  316. $this->errormsg[] = 'This alias belongs to a mailbox and can\'t be deleted.'; # TODO: make translatable
  317. return false;
  318. }
  319. db_delete('alias', 'address', $this->id);
  320. list(/*NULL*/,$domain) = explode('@', $this->id);
  321. db_log ($domain, 'delete_alias', $this->id);
  322. $this->infomsg[] = Config::Lang_f('pDelete_delete_success', $this->id);
  323. return true;
  324. }
  325. }
  326. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */