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.

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