0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00
Commit Graph

491 Commits

Author SHA1 Message Date
David Goodwin
b48f99d4c6 reformat (phpcs) 2018-05-02 12:54:17 +01:00
David Goodwin
94f05bf9e4 switch to store $config internally within an array 2018-04-29 21:52:57 +01:00
Christian Boltz
24ad5cc3d8
Set $reset_by_sms even if password reset is disabled
... to avoid an "undefined variable" warning
2018-04-27 23:23:57 +02:00
Christian Boltz
3f1866d041
display phone number field only if $CONF[sms_send_function] is set
Without a way to send a SMS, asking users for their mobile number is
pointless.
2018-04-22 22:55:55 +02:00
Christian Boltz
cdf3c9acb9
initStruct(): use multiopt for 'id' 'dont_write_to_db'
This also means we can drop the 0 for not_in_db because this is the
default.
2018-04-22 20:09:38 +02:00
Christian Boltz
d2588a4de2
Fix phpcs whitespace breakage in initStruct etc. 2018-04-22 18:24:41 +02:00
Christian Boltz
12c4a4f29e
move shells/shell.php to model/Shell.php
... and drop a few lines in postfixadmin-cli.php that became superfluous
by this move (thanks autoloader!)
2018-03-25 21:44:42 +02:00
Christian Boltz
500c847fe0
re-add lost comment 2018-03-25 19:16:21 +02:00
Christian Boltz
91c07c9eae
VacationHandler: re-enable and fix code in validate_new_id()
Note that vacation.php doesn't use this function yet, so it's not
surprising that users didn't notice the broken code.
2018-03-25 15:22:51 +02:00
David Goodwin
4fb4d406ee phpdoc; disable function init() - seems invalid 2018-03-16 20:07:52 +00:00
David Goodwin
fef2591335 phpdoc fixes 2018-03-16 20:07:21 +00:00
David Goodwin
cb34da4f46 phpcs reformat 2018-02-18 19:59:37 +00:00
David Goodwin
152975d05c move to use db_assoc() rather than db_array() (code assumes assoc. array) 2018-02-10 21:08:35 +00:00
David Goodwin
5e1855632a allow local aliases - see #134 2018-02-09 21:19:45 +00:00
Adrien Crivelli
15df6c1d7b
Reformat everything with PHP-Cs-Fixer 2018-01-26 23:54:37 +09:00
Christian Boltz
8fb67e6fbf
Fix broken table names caused by doubled table_by_key() calls
The high-level db_*() functions (like db_update(), and also
_db_add_field() in upgrade.php) call table_by_key() internally, which
also means the unwrangled table name needs to be handed over to them.
If handing over an already table_by_key()'d table name, it gets modified
again and results in something like prefix_prefix_mailbox.
2017-12-30 11:55:55 +01:00
houmingtao
5f1ac12d72 use current time as default token_validity value 2017-11-24 16:04:39 +08:00
root
4670182d79 fix invalid value for token_validity 2017-10-12 14:54:47 +08:00
Sylvain Tissot
ffb84283c2
Harden password reset process
The improvements are:

- Die with an explicit message when a user is trying to reset his lost password and the option is disabled in config
- Redirect user to main page after password change using relative URL
- Don't leak info whether user exists or has recovery info defined
- Throttle password reset requests to prevent brute force attacks
- Show phone/alt email fields in mailbox/admin edit form only when the password reset option is enabled
- Make database upgrade code compatible with other databases types
- Use the existing password generator to generate OTP. It is now stored in database, unique to each user, valid only for 1 hour and can only by used once.
2017-10-09 11:45:51 +09:00
Sylvain Tissot
9c9ba64a7f Allows a user or admin to reset his/her forgotten password with a code sent by email/SMS #18 2017-08-21 13:05:25 +02:00
Christian Boltz
a366654757
Better use Config::Lang instead of global $PALANG 2017-06-25 14:35:27 +02:00
David Goodwin
8508b8e119 global PALANG 2017-06-25 13:29:55 +01:00
Christian Boltz
80d381f644 Make VacationHandler compatible with MySQL strict mode again
The MySQL database layout includes a 'cache' column for historical
reasons, the PostgreSQL database never did.

r1883 removed the 'cache' column from VacationHandler to unbreak
PostgreSQL, and at the same time broke MySQL in strict mode.

This patch re-adds the 'cache' column only for MySQL to fix this
regression.



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1890 a1433add-5e2c-0410-b055-b7f2511e0802
2017-02-09 05:21:12 +00:00
Jan-Frederik Rieckers
800f07816a
Fix wrong way of check for can_delete 2017-02-07 15:54:21 +01:00
Jan-Frederik Rieckers
7bb36d0bbc
Fix security hole in AliasHandler
Without this fix it is possible to delete a protected alias via editing
the request parameter of the alias to delete.
2017-02-03 14:53:10 +01:00
David Goodwin
2f2db5949a fix date formatting in non-english languages, thanks to uz@musoftware.de
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1884 a1433add-5e2c-0410-b055-b7f2511e0802
2016-12-21 10:25:58 +00:00
David Goodwin
bd8e0e3ae3 apparently dead columns - thanks to uz@musoftware.de
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1883 a1433add-5e2c-0410-b055-b7f2511e0802
2016-12-20 08:39:18 +00:00
Christian Boltz
9ba7118d7b AliasHandler: restrict mailbox subquery to requested domains
set_is_mailbox_extrafrom() restricts the domain list to the domain that
needs to be checked (in normal list-virtual listing one domain), and is
then used to restore the default extrafrom.
This improves the performance for most usecases even for superadmins.

Note: Search mode might still be slow because by default it searches in
all domains available to the admin.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1882 a1433add-5e2c-0410-b055-b7f2511e0802
2016-11-09 20:41:24 +00:00
Christian Boltz
40b4fdf61c beautify alias list search parameters
AliasHandler:
- initStruct(): handle __mailbox_username as separate field (needed to
  make it searchable)
- split off a condition_ignore_mailboxes() function (used in getList()
  and getPagebrowser()) to add '__mailbox_username IS NULL' to the search
  condition array. Also, make sure $condition can be an array (preferred)
  or a string with a raw query

list-virtual.php:
- hand over a search array instead of a raw query


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1879 a1433add-5e2c-0410-b055-b7f2511e0802
2016-11-01 17:43:32 +00:00
Christian Boltz
bd28fcb194 AliasHandler: restrict __is_mailbox subquery to allowed domains
This improves performance on setups with lots of mailboxes.
Well, except for superadmins because restricting to "all domains"
doesn't really help ;-)

Thanks to gygy for reporting this on IRC, and for testing the patch.



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1877 a1433add-5e2c-0410-b055-b7f2511e0802
2016-10-31 20:15:31 +00:00
Christian Boltz
c909d4a71e FetchmailHandler: use a valid date as default for 'date'
This fixes an invalid query when using mysql strict mode.

Reported by Martin Kenney, https://sourceforge.net/p/postfixadmin/bugs/380/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1873 a1433add-5e2c-0410-b055-b7f2511e0802
2016-09-30 21:12:15 +00:00
Christian Boltz
386f37dfdb Don't decode b64p (base64-encoded password) fields.
This is not supported in MySQL < 5.6.
Besides that, we don't display the content of b64p fields anywhere, so
the easiest way is not to decode it.

Note: Currently, the only user of b64p is FetchmailHandler.

Fixes https://sourceforge.net/p/postfixadmin/bugs/357/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1847 a1433add-5e2c-0410-b055-b7f2511e0802
2016-05-22 17:44:17 +00:00
Christian Boltz
1d76c5af88 VacationHandler: Fill 'cache' field on INSERT
The 'cache' field is a leftover from PostfixAdmin 2.2 and unused (except
if someone still uses an ancient vacation.pl). However, MySQL in strict
mode errors out if isn't included in INSERTs because it doesn't have a
default value.

Fixes https://sourceforge.net/p/postfixadmin/bugs/345/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1845 a1433add-5e2c-0410-b055-b7f2511e0802
2016-05-22 16:17:46 +00:00
Christian Boltz
b261db86c7 Merge pull request #9 from phyrog/master
Add sqlite backend option (thank you @phyrog for doing this)

(imported from github)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1824 a1433add-5e2c-0410-b055-b7f2511e0802
2016-02-04 22:30:06 +00:00
Christian Boltz
c837eac20a DomainHandler:
- initStruct(): in 'aliases_quot' and '_aliases_quot_percent', use
  coalesce(__mailbox_count,0) - without, we always get _0_ aliases if
  a domain doesn't have mailboxes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1783 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 23:30:44 +00:00
Christian Boltz
23bdd02dcb broadcast-message.php, sendmail.php, MailboxHandler, *.lang:
- include mailbox name in pSendmail_result_error and
  pSendmail_result_success



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1781 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 22:44:51 +00:00
Christian Boltz
37bba15625 Use list.tpl to display the alias list
list-virtual.php:
- use list.tpl for aliases
- move show_gen_status handling for aliases to AliasHandler

AliasHandler:
- initStruct():
  - add 'status' column (hidden by default)
  - hide 'created'
  - move 'active' after 'modified' to match old list-virtual.php layout
- initMsg: add list_header
- webformConfig(): if $CONF[show_status], set display_in_list for
  'status' column. Also set a (whitespace) label to make sure it's
  displayed
- db_read_from_db_postprocess(): if 'status' column is requested, call
  gen_show_status() for each row

list-virtual.tpl
- remove alias table header and create alias button (which should have
  been in list-virtual_alias.tpl)

list-virtual_alias.tpl:
- replace code to generate the alias table with {include 'list.tpl'}
  (and some variable assignments)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1777 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 22:09:18 +00:00
Christian Boltz
adc038e218 list.tpl:
- add support for list_header (like ":: Alias" in list-virtual)

PFAHandler:
- add empty default for $msg['list_header']


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1776 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 21:58:58 +00:00
Christian Boltz
35fad174f7 smarty.inc.php:
- assign(): additionally provide the unsanitized values as RAW_$key

PFAHandler.php:
- document 'html' field type (used for raw html), including a big warning

list.tpl:
- add handling to display raw html fields

This is a preparation to use the status markers with list.tpl without
introducing too big changes.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1775 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 21:09:54 +00:00
Christian Boltz
3a72203de4 AliasHandler:
- initStruct(): replace (wrong) 'editable' with '_can_edit' and '_can_delete'
- read_from_db_postprocess(): disable _can_edit and _can_delete for
  default aliases if special_alias_control is off and not superadmin

list.tpl:
- use $item._can_edit instead of $check_alias_owner

list-virtual.php:
- drop $check_alias_owner variable and check_alias_owner() call
  (replaced by the code added in AliasHandler)
- drop unused $sql_domain

functions.inc.php:
- delete no longer used check_alias_owner() function



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1774 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 20:35:19 +00:00
Christian Boltz
8043515fdf migrate search input field to use search[_], and use list.tpl for alias domains
User-visible changes:
- alias domain list can be downloaded as CSV
- no more search highlighting for alias domains

list-virtual.php:
- expect $search to be an array
- change alias domain handling to use list.php instead of
  list-virtual_alias_domain.tpl, and move some logic from the template
  to list-virtual.php. (The template file is kept as list.tpl wrapper.)
- adopt mailbox and alias search to $search[_]
- adopt pagebrowser to $search[_]

list-virtual_alias_domain.tpl:
- replace custom output generation with {include 'list.php'} and some
  variable assignments

PFAHandler.php:
- add $this->id_field to $this->msg (avoids another smarty template
  variable)

configs/menu.conf:
- change input name to search[_]

list-virtual_alias.tpl, list-virtual_mailbox.tpl:
- adopt to $search[_] by setting $search in a backwards-compatible way

list.tpl:
- add special handling for aliasdomain.target_domain linking



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1773 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 14:17:25 +00:00
Christian Boltz
cc598d0f3f PFAHandler:
- build_select_query(): add support for $search['_'] (searching if one
  of the $this->searchfields contains the search text)
- getList(): make sure '_' is kept in the search parameters

functions.inc.php:
- db_where_clause(): slightly relax checks - if $condition is empty,
  only error out if $additional_raw_where is also empty


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1772 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 13:39:21 +00:00
Christian Boltz
31006928b4 AliasdomainHandler:
- initStruct(): Adjust columns to match list-virtual.php layout:
  - make 'alias_domain' a link
  - move 'active' after 'modified'
  - don't display 'created'



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1771 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-06 13:29:28 +00:00
Christian Boltz
4ce0a57e83 PFAHandler:
- add protected $searchfields = array(); - list of fields to search by
  default, if just a search term is given. This will be done with
  $search['_'], but that code is not implemented yet.
- add $this->msg['show_simple_search'] (true if $searchfields is non-empty)

list.tpl:
- display search input box and search overview only if $searchfields is
  not empty

AliasdomainHandler:
- add 'alias_domain' and 'target_domain' to $searchfields

MailboxHandler:
- add 'username' to $searchfields

AliasHandler:
- add 'address' and 'goto' to $searchfields

This effectively means that the search input box is no longer displayed
in list.php for admin, domain and fetchmail listings.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1770 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-05 20:23:38 +00:00
Christian Boltz
6e5c8f8054 add 'can_create' flag
PFAHandler:
- add $msg['can_create'] (true by default)

DomainHandler:
- set $msg['can_create'] based on is_superadmin

list.tpl:
- display 'create' button only if $msg['can_create'] is true

Note: This is only an optical improvement, not a permission check.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1769 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-05 19:21:15 +00:00
Christian Boltz
3f451371e3 PFAHandler:
- set(): if errormsg is set for a field, assume it's invalid (even if
  the validator functions did not (or forgot to) return False)

In theory this should never happen, but it's a nice safety net against
programming errors in validator functions that don't have an explicit
    return False;


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1768 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-04 14:37:46 +00:00
Christian Boltz
27bdba3ba2 Add FetchmailHandler.php
- uses list.php and edit.php instead of the fetchmail-specific template
- replaces fetchmail.php and its template

config.inc.php:
- add $CONF['fetchmail_struct_hook']



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1762 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-04 13:58:42 +00:00
Christian Boltz
9f2ae72f08 DomainHandler:
- initStruct(): re-enable total_quota - MailboxHandler needs it


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1758 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-19 23:07:19 +00:00
Christian Boltz
313270c00a PFAHandler.php:
- add getPagebrowser() (returns an array of pagebrowser keys)

AliasHandler.php:
- change getList() to work with empty $condition
- add getPagebrowser() to filter out mailboxes

list-virtual.php:
- replace $alias_pagebrowser_query and the create_page_browser() call
  with $handler->getPagebrowser()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1757 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-19 22:57:23 +00:00
Christian Boltz
28fe7042e8 PFAHandler.php:
- split off build_select_query() from read_from_db() as preparation for
  using build_select_query() to generate the pagebrowser query



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1756 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-19 22:05:49 +00:00
Christian Boltz
46d807c83d DomainHandler.php:
- initStruct():
  - don't display domain_quota if $CONF[quota] == NO or $CONF[domain_quota] is NO
  - drop 'total_quota' column which seems to be unused (and had a non-existing label)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1755 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-19 00:01:35 +00:00
Christian Boltz
dd43f12e9b delete list-admin.php and its template, use list.php instead
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1754 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-17 22:37:34 +00:00
Christian Boltz
add12b9fb4 AdminHandler.php:
- initStruct():
  - link username to domain list
  - hide superadmin, domain list and created columns in list view
  - add label to domain_count to make it visible in list view
- read_from_db_postprocess(): if user is a superadmin, replace domain
  count with "superadmin"



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1753 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-17 22:30:47 +00:00
Christian Boltz
eb7e40cf94 PFAHandler, editform.tpl:
- add support for 'b64p' fields (passwords stored base64-encoded)
  as preparation to migrate fetchmail.php to FetchmailHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1750 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-17 21:19:36 +00:00
Christian Boltz
cc2b157d59 *Handler:
- add $msg['confirm'] (confirmation message when attemping to delete an
  item, displayed by list.php)

*.lang:
- add various confirm_delete_* texts needed by *Handler
- rename confirm_domain to confirm_delete_domain


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1749 a1433add-5e2c-0410-b055-b7f2511e0802
2015-03-17 21:07:59 +00:00
Christian Boltz
1d35ba80ab model/DomainHandler.php:
- initStruct():
  - add optical quota indicators for aliases, mailboxes, domain quota
  - some adjustments to get nice output with list.php (mostly following
    list-domain.php)
- webformConfig(): switch listview to list.php

configs/menu.conf, templates/adminlistadmin.tpl:
- switch list-domain.php to list.php?table=domain



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1745 a1433add-5e2c-0410-b055-b7f2511e0802
2015-02-28 22:42:11 +00:00
Christian Boltz
5706f146d6 MailboxHandler:
- storemore(): store maildir in the correct variable to fix running
  mailbox_postedit script
  Fix by bit-jockey @SF,
  https://sourceforge.net/p/postfixadmin/bugs/342/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1737 a1433add-5e2c-0410-b055-b7f2511e0802
2015-01-24 14:00:35 +00:00
Christian Boltz
087dc34b01 MailboxHandler:
- check_quota(): deny creating an unlimited mailbox if domain quota is set
  (reported by idaho7 in IRC)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1736 a1433add-5e2c-0410-b055-b7f2511e0802
2015-01-12 17:12:07 +00:00
Christian Boltz
7bf5b74a47 MailboxHandler, AliasHandler:
- initStruct: set "display in list" to 1 to allow searching for domain
  with list.php (nevertheless, the domain won't be displayed because
  it doesn't have a column label set)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1735 a1433add-5e2c-0410-b055-b7f2511e0802
2015-01-07 21:25:20 +00:00
Christian Boltz
13f1a28b6e PFAHandler:
- read_from_db(), getList(): 
  - add $searchmode parameter (_before_ $limit and $offset!) to be able to 
    use query different query modes, not only "="
  - add a warning that $condition will be changed to array only in the future
- getList(): filter $condition for fields that are available to the user
  to avoid information leaks by using search parameters
  (filter is only applied if $condition is an array!)

functions.inc.php: 
- db_where_clause():
  - add $additional_raw_where parameter for additional query parameters
  - add $searchmode parameter to be able to use query different
    query modes, not only "=" (see $allowed_operators)
  - check for allowed operators in $searchmode
  - split query into WHERE and HAVING (if a parameter has
    $struct[select] set, HAVING is used)

list-virtual.php:
- adopt getList() call to the new syntax

AliasHandler:
- adopt getList() definition and call to the new syntax

 


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1731 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-02 22:45:22 +00:00
Christian Boltz
b76511628d PFAHandler:
- add $this->order_by to allow ordering by any field(s)
  (defaults to $this->id_field)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1730 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-02 22:07:20 +00:00
Christian Boltz
6bfe6706ba PFAHandler:
- add $this->label_field and $this->label (defaults to $this->id_field 
  and $this->id) to allow nicer messages
- use $this->label in various messages



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1729 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-02 22:03:58 +00:00
Christian Boltz
ca76b0fb6e PFAHandler:
- add getMsg() function (needed by list.php)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1728 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-02 21:55:56 +00:00
Christian Boltz
a4085d287f DomainHandler:
- initStruct: 
  - set column write permissions depending on superadmin status
  - add _can_edit and _can_delete (also depending on superadmin status)
- webformConfig(): reduce required permissions to 'admin'
- add beforestore() - aborts writing for non-superadmins
- delete: allow deletion only for superadmins

*.lang:
- new text 'no_delete_permissions'



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1718 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-01 20:58:01 +00:00
Christian Boltz
e39d13aa52 PFAHandler:
Add $can_edit and $can_delete flags. This makes it possible to make 
some, but not all items non-editable or non-deletable (based on a 
database column/query or read_from_db_postprocess())

- add $can_edit and $can_delete
- after initStruct, check if $struct contains _can_edit and _can_delete.
  If not, fill with default values (allowed)
- init(): set $this->can_edit and $this->can_delete (only in view/edit mode)
- set(): abort if !$this->can_edit



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1716 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-01 19:51:25 +00:00
Christian Boltz
3fe75c117d PFAHandler:
- add handling of users (non-admins), including permission checks



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1715 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-01 19:38:28 +00:00
Christian Boltz
72d9d42601 PFAHandler:
- add protected $is_superadmin = 1;
  will be set to 0 if $admin_username is set and is not a superadmin



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1714 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-01 19:30:54 +00:00
Christian Boltz
f07281cdc1 PFAHandler:
- automatically skip quot, vnum and vtxt fields in store()
  (as if dont_write_to_db == 1)
- document new field types vtxt and quot and mark field types that will
  never be stored in db



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1713 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-01 19:25:11 +00:00
Christian Boltz
647aa39218 PFAHandler:
- add validation for "enma" field type - list of options, must be given
  in column "options" as associative array (value => displayed value)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1711 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-01 18:54:27 +00:00
Christian Boltz
d9e30fb41b Add CliScheme.php:
- displays the database scheme (for usage in upgrade.php)

PFAHandler:
- add "Scheme" to the list of available tasks

postfixadmin-cli.php:
- add "scheme" to help

This is the first patch of a series sponsored by 
    Bund der Deutschen Landjugend (german rural youth)
	http://bdl.landjugend.info/



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1710 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-01 18:08:11 +00:00
Christian Boltz
22839d3695 Cli*.php:
- add SVN $Id header


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1709 a1433add-5e2c-0410-b055-b7f2511e0802
2014-11-01 18:05:39 +00:00
Christian Boltz
6ec360b0b7 AliasHandler:
- finally fix alias deletion when using MariaDB. The workaround is
  to add another field from the subquery to the outer SELECT so that
  MariaDB can't optimize the subquery to "always 1"
  http://sourceforge.net/p/postfixadmin/bugs/325/
  (I'll open a MariaDB bugreport and add the link to the bugtracker)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1703 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-23 18:26:54 +00:00
Christian Boltz
46a632ec02 AliasHandler:
- initStruct(): revert the MariaDB workaround because PostfixAdmin now
  "thinks" none of the aliases belong to a mailbox (and displays all of
  them in the alias list, even the mailbox aliases)
  - reverts r1699 + the CHANGELOG entry (part of r1700)
  - reopened https://sourceforge.net/p/postfixadmin/bugs/325/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1702 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-22 16:30:25 +00:00
Christian Boltz
d9ff7ece05 AliasHandler:
- initStruct(): use "SELECT COUNT(1)" instead of "SELECT 1" as workaround
  for a MariaDB problem (bug?)
  https://sourceforge.net/p/postfixadmin/bugs/325/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1700 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-22 15:12:08 +00:00
David Goodwin
f436a0d17c fix typo in model/CliHelp.php as per ticket 332
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1698 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-20 08:31:57 +00:00
Christian Boltz
fb4af233af config.inc.php:
- add note that $CONF[vacation_domain] can't be used for "normal" mails

model/DomainHandler.php:
- validate_new_id(): 
  - error out when trying to add $CONF[vacation_domain]
  - some whitespace fixes
- remove superfluous comment on initStruct()

*.lang:
- add 'domain_conflict_vacation_domain' error message



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1694 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-07 16:11:49 +00:00
Christian Boltz
b30292c420 MailboxHandler.php:
- storemore(): 
  - fix undefined variable if creating subfolders fails (bug#328)
  - remove some outdated TODO notes
- create_mailbox_subfolders(): add $this->id to error_log


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1693 a1433add-5e2c-0410-b055-b7f2511e0802
2014-10-05 22:09:42 +00:00
Christian Boltz
d80816ad86 DomainHandler:
- $CONF[default_aliases] can now use the new domain as alias target
  http://sourceforge.net/p/postfixadmin/patches/124/

config.inc.php:
- update comment for $CONF[default_aliases]



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1690 a1433add-5e2c-0410-b055-b7f2511e0802
2014-09-28 10:39:42 +00:00
Christian Boltz
c5de88390e PFAHandler.php:
fix logging - log the domain instead of $this->id
- add protected $domain (used for logging)
- add function domain_from_id()
- http://sourceforge.net/p/postfixadmin/bugs/317/

AliasHandler.php:
- add function domain_from_id()

MailboxHandler.php:
- add function domain_from_id()
- init(): use $this->domain instead of splitting $this-id again



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1684 a1433add-5e2c-0410-b055-b7f2511e0802
2014-09-12 09:22:09 +00:00
Christian Boltz
3f62a577a4 CliHelp:
- remove help text about "password" command (not implemented)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1683 a1433add-5e2c-0410-b055-b7f2511e0802
2014-09-11 22:17:59 +00:00
Christian Boltz
8e5a4551cb AliasHandler:
- fix query in getList(), which caused an empty list on some systems
  https://sourceforge.net/p/postfixadmin/bugs/313/
  Fix by VERSATECH SRL, versatechsrl @SF


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1678 a1433add-5e2c-0410-b055-b7f2511e0802
2014-06-06 19:11:05 +00:00
Christian Boltz
566f2845bd AliasHandler:
- setmore(): use old goto values if no new value is given. Fixes
  'Making alias inactive cleans "goto" field'
  https://sourceforge.net/p/postfixadmin/bugs/316/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1675 a1433add-5e2c-0410-b055-b7f2511e0802
2014-05-27 21:27:20 +00:00
Christian Boltz
a8b79b4548 MailboxHandler:
- validate_new_id(): make sure mailbox creation still works if the 
  alias limit for the domain is hit


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1663 a1433add-5e2c-0410-b055-b7f2511e0802
2014-04-28 20:42:38 +00:00
Christian Boltz
bbd7c3af77 CliEdit.php:
- execute(): call __handle_params() also if empty args[0] is given
- __interactive(): only ask for id if $id_field is editable

This fixes two issues with a non-editable auto_increment id field


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1661 a1433add-5e2c-0410-b055-b7f2511e0802
2014-04-27 13:41:41 +00:00
Christian Boltz
2289096ccc Config.php:
- do not error_log() 'undefined config option' for deprecated options



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1659 a1433add-5e2c-0410-b055-b7f2511e0802
2014-03-18 21:57:47 +00:00
Christian Boltz
5fcade96d5 MailboxHandler:
- read_from_db_postprocess(): avoid warning if quota is disabled in $struct


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1655 a1433add-5e2c-0410-b055-b7f2511e0802
2014-03-16 19:29:55 +00:00
David Goodwin
eb2ccbc2e5 typo fix
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1642 a1433add-5e2c-0410-b055-b7f2511e0802
2014-02-19 11:47:17 +00:00
Christian Boltz
8c139c95d6 vacation:
restrict reply type to a list of options ($CONF[vacation_choice_of_reply]),
remove input field for custom interval


config.inc.php:
- change $CONF['vacation_choice_of_reply'] to [seconds] => [$PALANG label]
  (note: reply to every mail is commented by default because it can be
  annoying. Admins will have to explicitely add/enable it in their config.)
- remove $CONF[vacation_replytype_default]
- update comment about dovecot:* for $CONF[encrypt]

*.lang:
- add texts for reply types

VacationHandler.php:
- remove reply_type at various places
- set_away(): remove reply_type from list of function parameters

templates/vacation.tpl:
- update reply type dropdown for the changed $CONF['vacation_choice_of_reply']
- remove the input fields for custom reply delay

vacation.php:
- restrict reply type to a list of options ($CONF[vacation_choice_of_reply])
- if vacation is disabled, but old values are stored in the database,
  change the activeFrom and activeUntil date to today to avoid users
  have to scroll through the calendar a lot

xmlrpc.php:
- update set_away() call to match the removed parameter

upgrade.php:
- comment out upgrade_1345_mysql() which created the reply_type and 
  interval_time fields in the vacation table in mysql
- add upgrade_1610() to add the vacation.interval_time field


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1610 a1433add-5e2c-0410-b055-b7f2511e0802
2013-12-22 16:50:55 +00:00
Christian Boltz
8d99a8a9fb DomainHandler:
- initStruct(): set valid bool default for backupmx


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1604 a1433add-5e2c-0410-b055-b7f2511e0802
2013-12-08 21:30:30 +00:00
Christian Boltz
beffb3ec85 r1595 accidently included more changed files than it should.
This commit contains some dummy changes to get a proper changelog
attached to those files.

VacationHandler:
- (r1595) rewrite based on PFAHandler (not useable yet)
- (this commit) add a dummy init() function that calls die()

DOCUMENTS/DOVECOT.txt:
- (r1595) TODO note
- (this commit) remove the TODO note again

CHANGELOG.TXT:
- (r1595) include changes of 2.3.4, 2.3.5 and 2.3.6 (copied from 2.3 branch)
- (r1595) update some notes about SVN version (still far from complete)	


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1596 a1433add-5e2c-0410-b055-b7f2511e0802
2013-12-01 22:29:25 +00:00
Christian Boltz
57f4ad0b75 functions.inc.php pacrypt():
- for 'system' encryption, use full hashed password as salt 
  https://sourceforge.net/p/postfixadmin/bugs/2/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1595 a1433add-5e2c-0410-b055-b7f2511e0802
2013-12-01 21:48:14 +00:00
Christian Boltz
bafd2f1f58 edit.php:
- use prefill values from $_SESSION (if not provided in GET/POST)
- remember prefill values for next usage of the form

list-virtual.php
- set prefill values for edit.php

PFAHandler.php:
- let prefill() store the value in $struct if no prefill_$field()
  function exists

This fixes the remaining parts of
http://sourceforge.net/p/postfixadmin/bugs/298/



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1594 a1433add-5e2c-0410-b055-b7f2511e0802
2013-12-01 20:45:17 +00:00
Christian Boltz
1688065fca DomainHandler.php:
- better error/info messages
- remove superfluous (and never displayed) success message in storemore()

languages/*.lang:
- add texts for DomainHandler
- delete empty pAdminCreate_domain_defaultaliases_text



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1588 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-16 20:32:37 +00:00
Christian Boltz
801acc6cf2 AliasHandler:
- only allow @domain as target if $this->id is a catchall
- delete commented out version of delete()
- better error messages

languages/*.lang
- add new texts needed for AliasHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1587 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-16 20:20:50 +00:00
Christian Boltz
4e489df526 AliasdomainHandler:
- better error messages

languages/*.lang
- rename pCreate_alias_domain_error3 to alias_domain_create_failed
- add new texts needed for AliasdomainHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1586 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-16 20:02:14 +00:00
Christian Boltz
c11932e58c MailboxHandler:
- use better/translateable messages at various places

languages/*.lang
- add texts needed by MailboxHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1585 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-16 19:49:40 +00:00
Christian Boltz
53c28990ad PFAHandler:
- read_from_db(): convert $limit and $offset with (int) to make sure
  they contain a sane value


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1584 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-16 19:10:15 +00:00
Christian Boltz
79274dcedf AdminHandler:
- clear some TODO notes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1583 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-16 19:02:44 +00:00
Christian Boltz
20d1ffcafc functions.inc.php:
- new function db_pgsql() to replace lots of
  "if ($CONF[database_type] == 'pgsql')) checks
- delete unused function boolconf()

several files:
- use db_pgsql() instead of checking $CONF[database_type]



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1582 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-16 00:00:53 +00:00
Christian Boltz
60297e483c *.lang:
- rename pAdminCreate_admin_username_text to email_address
- rename pAdminEdit_admin_super_admin to super_admin

AdminHandler.php - initStruct(): 
- adopt to the renamed $PALANG texts
- remove some TODOs
- whitespace changes

setup.php, adminlistadmin.tpl:
- adopt to the renamed $PALANG texts


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1580 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-14 22:33:56 +00:00
Christian Boltz
2bf5df92ea functions.inc.php, DomainHandler, MailboxHandler:
- move mailbox_postdeletion() to MailboxHandler
- move domain_postcreation() and domain_postdeletion() to
  DomainHandler
- adopt those functions for usage inside the *Handler (replace
  print with $this->errormsg etc.)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1579 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-14 22:10:05 +00:00
Christian Boltz
c65e3293b6 Quite big CLI cleanup (and more)
model/CliHelp.php:
- new class, used for "postfixadmin-cli $module help"
- replaces the PostfixAdmin* classes in scripts/shells/*.php

model/PFAHandler.php
- add public $taskNames with the list of supported CLI commands

scripts/postfixadmin-cli.php - dispatch():
- directly set the classes to load instead of using shell->loadTasks()
- when "postfixadmin-cli $module" is called, display help instead of 
  error message about "invalid command ''"
- make it more readable by moving error checks to the beginning
  (replaces deeply nested if's with return statements)
- remove unused code parts

scripts/shells/*.php:
- remove PostfixAdmin* classes (obsoleted by CliHelp)
- remove $tasks (now in PFAHandler)
- delete alias.php and domain.php because nothing is left
- mailbox.php still contains PasswordTask

scripts/shells/shell.php:
- remove $taskNames (moved to PFAHandler)
- remove loadTasks() (integrated in postfixadmin-cli.php's dispatch())



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1575 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-13 19:07:12 +00:00
Christian Boltz
b3dc3f91ae AliasHandler:
- if parent::init() fails, return false early to avoid warnings about
  undefined $this->result


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1574 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-13 00:40:08 +00:00
Christian Boltz
39001c3ba4 DomainHandler.php:
- add some _formatted_*() functions to get a more informative output
  (currently only used in CLI)

MailboxHandler.php:
- add TODO for reading used quota from quota/quota2 table and adding
  a formatted_quota() function



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1573 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-12 21:37:08 +00:00
Christian Boltz
04cd5c5aa4 model/CliView.php:
- new file for CLI 'view'
- based on the ViewTask classes in scripts/shells/*.php
- introduces usage of *Handler->_formatted_$field() to get "pretty" 
  output for a field 
  (not sure if this is the final solution, but it works ;-)

scripts/shells/*.php
- remove ViewTask, obsoleted by model/CliView.php
 
scripts/shells/shell.php:
- use CliView instead of ViewTask



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1572 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-12 21:32:49 +00:00
Christian Boltz
f1831975c0 CliDelete:
- execute() and help() must be public


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1571 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-12 21:19:54 +00:00
Christian Boltz
0a71a236c2 model/CliDelete.php
- new file, handles deleting something with the CLI
  (based on DeleteTask in scripts/shells/*.php)

scripts/shells/*.php
- remove DeleteTask, obsoleted by model/CliDelete.php

scripts/shells/shell.php:
- use CliDelete instead of DeleteTask



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1570 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-12 19:32:12 +00:00
Christian Boltz
288ba0e143 DomainHandler.php
- delete(): check if the domain is an alias domain target - if yes, do 
  not allow to delete it
- better error message if domain_postdeletion() fails

*.lang:
- rename pAdminDelete_domain_error to domain_postdel_failed and change 
  the text
- add delete_domain_aliasdomain_target



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1567 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-10 23:05:43 +00:00
Christian Boltz
508d05e1ed AdminHandler.php, AdminpasswordHandler.php:
- initMsg(): better texts for error_already_exists and error_does_not_exist 

*.lang:
- rename pAdminCreate_admin_username_text_error2 to admin_already_exists
  and change the text
- add admin_does_not_exist



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1565 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-10 22:00:16 +00:00
Christian Boltz
3b09562fb8 MailboxHandler.php:
- rewrite and simplify delete()
- also cleanup fetchmail, quota	and quota2 tables

AliasHandler.php:
- update delete() to match the workflow in other classes



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1562 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-10 19:38:43 +00:00
Christian Boltz
bcb38c9664 AliasdomainHandler:
- implement delete()
- rename _field_target_domain() to _validate_target_domain()
  (follow-up for r1555)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1561 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-10 18:55:23 +00:00
Christian Boltz
2f26624ceb DomainHandler.php, AdminHandler.php:
- implement delete()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1560 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-10 17:26:47 +00:00
Christian Boltz
5871516b47 model/Config:
- read_f(): fix error logging - $var can be an array


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1559 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-10 16:00:20 +00:00
Christian Boltz
49573da2d7 PFAHandler:
- make error messages in _inp_*() translateable
- make date format in SQL "translateable"

*.lang:
- add the texts needed for the changes listed above


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1556 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-08 21:49:53 +00:00
Christian Boltz
1b74926afb PFAHandler, *Handler:
- rename _field_$field() to _validate_$field() to make the function name
  more obvious
 


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1555 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-08 21:26:46 +00:00
Christian Boltz
462cb6992f AdminpasswordHandler:
- initStruct(): remove description for current password - it doesn't
  exist in $PALANG and we don't really need a description here


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1550 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-31 21:05:54 +00:00
Christian Boltz
f748f31137 model/Config.php:
- Config::read(): error_log() attemps to read undefined config options


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1549 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-31 21:02:04 +00:00
Christian Boltz
8ea4fd6c82 AliasdomainHandler.php:
- better error/success messages
- cleanup TODO notes

*.lang:
- new texts for alias domains: alias_domain_change_failed, 
  alias_domain_changed, alias_domain_to_itsself


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1541 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-19 18:45:41 +00:00
Christian Boltz
e96544e815 model/PFAHandler.php, setup.php:
- use Config::lang_f() for $this->msg['successmessage']

*.lang:
- add %s to all texts used for 'successmessage'


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1540 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-13 22:07:15 +00:00
Christian Boltz
21aea632b7 model/PFAHandler.php:
- use Config::lang_f() for msg['store_error']

*.lang:
- add %s to all messages that are used as store_error


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1539 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-13 20:33:48 +00:00
Christian Boltz
e809d2c651 MailboxHandler.php:
- _missing_maildir(): fix forgotten $CONF usage
- cleanup outdated TODO notes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1538 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-13 20:07:34 +00:00
Christian Boltz
4d9a338eb2 After hunting an "undefined index transport" error in list-domain, I
found out that the 'Config' class is too static - it shares its static
data with the 'Lang' child class. 

This caused a conflict because we have $CONF[transport] and 
$PALANG[transport], and Config::read('transport') returned the $PALANG 
text.

To fix this, all texts are now stored as $CONF[__LANG].
I also dropped the 'Lang' class.


model/Config.php:
- mark the 'Config' class as final to ensure we don't trap into the 
  "too static" problem again.
- bool(): display and log an error message if a $CONF option does not
  contain YES or NO (that would have uncovered this bug much earlier)
- add lang() and lang_f() wrapper functions to get $PALANG texts
- remove unused $__cache and $__objects

model/Lang.php:
- deleted

common.php:
- store $PALANG as $CONF[__LANG]

lots of files:
- replace Lang::read() and Lang::read_f() calls with Config::lang()
  and Config::lang_f()




git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1536 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-13 18:11:18 +00:00
Christian Boltz
f2c2b554ac model/PFAHandler.php:
- getList: change return value to be always true (even if the database 
  result is an empty array), and die() if the database result is not an 
  array.
  This avoids some if blocks in various files to implement a fallback
  to array() on empty results.

functions.inc.php:
- list_admins(): simplify after the *Handler->getList() change
- get_domain_properties(): change a forgotten $handler->return to 
  $handler->result() (follow-up for r1534)

list-domain, list-virtual.php:
- simplify after the *Handler->getList() change



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1535 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-13 16:11:15 +00:00
Christian Boltz
bb7a3ff04d model/*Handler.php and various other files
- rename $this->return to $this->result


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1534 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-13 15:26:37 +00:00
Christian Boltz
f38b10cd61 PFAHandler.php:
- set(): make "field $key is missing" translateable
- store(): call db_log() even if storemore() failed


MailboxHandler.php
- storemore(): use $this->infomsg instead of flash_info
 
*.lang
- add 'missing_field' = 'Field %s is missing';
- change reate_mailbox_result_success' and
  'pCreate_mailbox_result_succes_nosubfolders'
  to "The mailbox %s ..."

en.lang, nl.lang:
- remove unused texts 'pAdminList_domain_usercontrol',
  'pAdminCreate_domain_usercontrol', 'pAdminEdit_domain_usercontrol'


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1533 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-09 20:11:06 +00:00
Christian Boltz
ade5fd0c24 AliasHandler:
- initStruct(): set default for 'goto' to empty array()
  This fixes a problem with the cli when --goto was not specified				


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1530 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-07 20:01:52 +00:00
Christian Boltz
6ea8b370c0 CliEdit.php:
- make help text (slightly) different for add vs. update


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1528 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-06 22:35:02 +00:00
Christian Boltz
5f94773ae4 MailboxHandler:
- fix syntax error :-/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1518 a1433add-5e2c-0410-b055-b7f2511e0802
2013-08-07 21:46:53 +00:00
Christian Boltz
7b6f3e56cb MailboxHandler.php:
- create_mailbox_subfolders(), check_quota(): 
  use class variables instead of parameters
- create_mailbox_subfolders(): remove check for empty $this-id - this can 
  never happen because it would fail much earlier in the class
- check_quota(), allowed_quota(), mailbox_post_script(), 
  create_mailbox_subfolders(): mark as protected



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1517 a1433add-5e2c-0410-b055-b7f2511e0802
2013-08-07 20:58:02 +00:00
Christian Boltz
f9506d97b1 MailboxHandler.php:
- new function mailbox_post_script()
  - result of merging mailbox_postcreation() and mailbox_postedit(),
    replaces those two functions
  - drop all parameters, read them from class variables instead
  - store warn message in $this->errormsg[] instead of using print
- changed function calls to use mailbox_post_script()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1516 a1433add-5e2c-0410-b055-b7f2511e0802
2013-08-07 20:39:37 +00:00
Christian Boltz
73a793433e moved the following functions from functions.inc.php to MailboxHandler.php:
- check_quota ()
- allowed_quota()
- mailbox_postcreation()
- mailbox_postedit()
- create_mailbox_subfolders()

The code was moved without any changes, except
- added leading whitespace
- removed "TODO: move to MailboxHandler" ;-)


MailboxHandler:
- change function calls for moved functions


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1515 a1433add-5e2c-0410-b055-b7f2511e0802
2013-08-07 20:05:18 +00:00
Christian Boltz
08c9b4e49f *.lang:
- renamed some $PALANG texts:
  - pOverview_button => go
  - pOverview_mailbox_name => name
  - pSendmail_admin => from
  - pAdminEdit_admin_username => admin
  - pEdit_alias_goto => to 
- deleted obsolete or duplicate $PALANG texts:
  - pOverview_alias_goto
  - pCreate_alias_goto
  - pEdit_alias_button
  - pEdit_mailbox_name
  - pEdit_mailbox_button
  - pViewlog_username
  - pViewlog_button
  - pAdminList_admin_username
  - pAdminList_virtual_button
  - pAdminList_virtual_alias_address
  - pAdminList_virtual_alias_goto
  - pAdminList_virtual_mailbox_name
  - pAdminEdit_domain_button
  - pAdminEdit_admin_button
  - pBroadcast_from
  - pBroadcast_send

model/*, setup.php, templates/*, users/edit-alias.php:
- update to use the renamed $PALANG texts


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1513 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-29 22:08:07 +00:00
Christian Boltz
76f66ac8db *.lang:
- rename some $PALANG variables once more because smarty breaks when
  using "-"
  - add-alias => add_alias
  - add-alias-domain => add_alias_domain
  - add-mailbox => add_mailbox
  - email-address-already-exists => email_address_already_exists
  - change-password => change_password
  - password-again => password_again

model/*, setup.php, templates/*
- update to use the changed $PALANG variables


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1511 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-28 22:51:28 +00:00
Christian Boltz
9c0004a431 *.lang:
- rename various $PALANG texts:
  - pMenu_create_alias => add-alias
  - pMenu_create_alias_domain => add-alias-domain
  - pMenu_create_mailbox => add-mailbox
  - pOverview_get_mailboxes => mailboxes
  - pPassword_button => change-password
  - pAdminList_domain_description => description
  - pAdminList_domain_aliases => aliases
  - pAdminEdit_domain_transport => transport
  - pAdminEdit_admin_password2 => password-again
- remove duplicate or unused $PALANG texts:
  - pOverview_alias_alias_count
  - pOverview_alias_mailbox_count
  - pOverview_get_aliases
  - pCreate_alias_domain_button
  - pCreate_alias_welcome
  - pCreate_alias_button
  - pCreate_mailbox_password2
  - pCreate_mailbox_quota_text_error
  - pCreate_mailbox_button
  - pAdminMenu_viewlog
  - pAdminMenu_create_alias
  - pAdminMenu_create_mailbox
  - pAdminList_domain_mailboxes
  - pAdminList_domain_transport
  - pAdminList_virtual_welcome
  - pAdminList_virtual_alias_alias_count
  - pAdminList_virtual_alias_mailbox_count
  - pAdminList_virtual_mailbox_username
  - pAdminList_virtual_mailbox_quota
  - pAdminEdit_domain_description
  - pAdminEdit_domain_aliases
  - pAdminEdit_domain_mailboxes
  - pAdminEdit_domain_mailboxes_text
  - pUsersMenu_password

model/*, seetup.php, templates/*
- use changed $PALANG texts


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1510 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-28 22:33:35 +00:00
Christian Boltz
7bf10e6b91 *.lang:
- rename $PALANG['pEdit_alias_address'] to $PALANG['alias']
  - remove duplicate $PALANG['pOverview_alias_edit']

model/*, templates/*:
- use $PALANG['alias'] everywhere


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1507 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-28 20:22:05 +00:00
Christian Boltz
c70465f0e3 *.lang:
- rename $PALANG['pCreate_alias_address_text_error2'] to 
  $PALANG['email-address-already-exists']
- delete $PALANG['pCreate_mailbox_username_text_error2']

model/*:
- use new $PALANG names


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1506 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-28 20:14:57 +00:00
Christian Boltz
80591f97bc *.lang:
- add $PALANG['password'] to replace duplicate texts
  -$PALANG['pLogin_password']
  -$PALANG['pCreate_mailbox_password']
  -$PALANG['pAdminEdit_admin_password']
- set $PALANG['pFetchmail_field_src_password']= $PALANG['password']; 
  (needed until fetchmail is migrated into FetchmailHandler)

model/*, setup.php, templates/*:
- use $PALANG['password'] everywhere	  


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1504 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-28 19:46:50 +00:00
Christian Boltz
a1646f84b6 *.lang:
- add $PALANG['active'] = 'Active' to replace various duplicates:
  -$PALANG['pOverview_alias_active']
  -$PALANG['pOverview_alias_domain_active']
  -$PALANG['pOverview_mailbox_active']
  -$PALANG['pCreate_alias_active']
  -$PALANG['pEdit_alias_active']
  -$PALANG['pCreate_mailbox_active']
  -$PALANG['pAdminList_admin_active']
  -$PALANG['pAdminList_domain_active']
  -$PALANG['pAdminList_virtual_mailbox_active']
  -$PALANG['pAdminEdit_domain_active']
  -$PALANG['pAdminEdit_admin_active']

model/*, templates/*:
- use $PALANG['active'] everywhere


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1503 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-28 19:24:00 +00:00
Christian Boltz
bf0a5c02f4 *.lang:
- add $PALANG['domain'] = 'Domain'; which replaces duplicate texts:
  -$PALANG['pOverview_get_domain']
  -$PALANG['pViewlog_domain']
  -$PALANG['pAdminList_admin_domain']
  -$PALANG['pAdminList_domain_domain']
  -$PALANG['pAdminEdit_domain_domain']
  -$PALANG['pAdminCreate_admin_address']

model/*, templates/*:
- update to use $PALANG['domain']  


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1502 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-28 18:25:43 +00:00
Christian Boltz
fcee414740 *.lang and various other files:
- rename $PALANG['pAdminList_domain_modified'] to $PALANG['last_modified']


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1500 a1433add-5e2c-0410-b055-b7f2511e0802
2013-07-27 21:52:52 +00:00
Christian Boltz
d3d7249ea0 MailboxHandler.php:
- remove a TODO in store_more() (tested, works already)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1494 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-23 20:23:02 +00:00
Christian Boltz
414c05e678 functions.inc.php:
- db_where_clause(): wrap condition in "(...)"


model/PFAHandler.php:
- read_from_db(): wrap condition in "(...)"


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1493 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-23 20:02:05 +00:00
Christian Boltz
00bc5c6553 AdminpasswordHandler.php:
- new file, used for "change password" for admins

configs/menu.conf:
- switch from password.php to edit.php?table=adminpassword

password.php:
- deleted, replaced by AdminpasswordHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1491 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-23 17:49:54 +00:00
Christian Boltz
ce233789b9 PFAHandler.php:
- add $skip_empty_pass (default: true) - set to false to
  disable skipping empty password fields in edit mode
  (needed for "change password" form)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1490 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-23 17:34:14 +00:00
Christian Boltz
7557ed5fae PFAHandler.php, MailboxHandler.php:
- move login() to PFAHandler.php


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1485 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-23 15:13:33 +00:00
Christian Boltz
8ff856df12 MailboxHandler.php:
- make login() a non-static function
- login: use $this->db_table and $this->id_field instead of hardcoded names

users/login.php, xmlrpc.php:
- adopt to now non-static MailboxHandler->login()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1484 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-23 15:07:17 +00:00
Christian Boltz
9af5a5cc03 *Handler.php:
- set $db_table and $id_field in the class, not inside initStruct()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1483 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-23 15:04:05 +00:00
Christian Boltz
b5aeb5a0a6 MailboxHandler:
- fix 'goto' handling
  https://sourceforge.net/p/postfixadmin/bugs/292/


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1476 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-10 22:18:53 +00:00
Christian Boltz
21494f2a14 Config.php:
- add intbool() - similar to bool(), but returns 1/0 instead of true/false

DomainHandler.php
- initStruct(): use Config::intbool() instead of boolconf()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1473 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-06 20:47:28 +00:00
Christian Boltz
68ae542817 AliasHandler:
- use Config::bool() instead of boolconf()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1472 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-06 20:40:54 +00:00
Christian Boltz
dc8ea753fc Config.php:
- add read_f() - similar to read(), but accepts a second parameter which
  is then included in the text using sprintf
- bool(): change parameter name


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1471 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-05 23:09:10 +00:00
Christian Boltz
29236ffaa4 MailboxHandler.php:
some bugfixes:
- init(): let $domain always base on $this->id (also on $new)
- make mergeId dumber (by removing an error check). This can of course 
  result in an invalid mail address, but this is handled more gracefully 
  than an empty $this->id
- updateMaxquota(): use Lang::read_f instead of sprintf


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1469 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-05 22:48:29 +00:00
Christian Boltz
b15319c21a functions.inc.php, model/Config.php:
- move boolconf() to Config::bool()
  boolconf() will stay for backwards compability, but new code
  should use Config::bool()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1467 a1433add-5e2c-0410-b055-b7f2511e0802
2013-06-05 20:35:30 +00:00
Christian Boltz
c53400ec5f MailboxHandler.php:
- validate_new_id(): store error message in 
  $this->errormsg[$this->id_field] instead of $this->errormsg[]
- beforestore(): use first array key instead of [0] to match the
  change in validate_new_id()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1461 a1433add-5e2c-0410-b055-b7f2511e0802
2013-05-01 19:05:32 +00:00
Christian Boltz
ea7036ae62 AliasdomainHandler:
- delete(): return error message if db_delete fails


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1460 a1433add-5e2c-0410-b055-b7f2511e0802
2013-05-01 19:01:18 +00:00
Christian Boltz
2d127bdec8 AliasHandler:
- validate_new_id(): store errormessages in 
  $this->errormsg[$this->id_field] instead of $this->errormsg[]


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1459 a1433add-5e2c-0410-b055-b7f2511e0802
2013-05-01 18:59:32 +00:00
Christian Boltz
61dfcb9192 AdminHandler.php:
- implement delete()   (untested!)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1456 a1433add-5e2c-0410-b055-b7f2511e0802
2013-04-27 20:31:07 +00:00
Christian Boltz
871bcbbe2f functions.inc.php:
- check_domain(), check_email(): instead of calling flash_error(),
  return string with error message - or empty string if everything is ok

model/AdminHandler.php, model/AliasHandler.php,
model/DomainHandler.php, model/MailboxHandler.php,
sendmail.php, users/edit-alias.php:
- adopt to changed check_domain() and check_email() return value


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1451 a1433add-5e2c-0410-b055-b7f2511e0802
2013-04-01 21:22:30 +00:00
Christian Boltz
f92a32eae1 PFAHandler.php:
- initStruct(): add some comments
- add calledBy() and protected $called_by - calledBy() should be called if one 
  *Handler class calls another one (to avoid loops etc.)

AliasHandler.php:
- replace $called_by_MailboxHandler / MailboxAliasConfig() with $called_by
  (code moved to PFAHandler->calledBy())

MailboxHandler.php:
- beforestore(): update alias active status on edit
  (contains some whitespace changes - basically I removed "if ($this->new)"
  around most parts of the code)
- use calledBy() instead of MailboxAliasConfig()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1449 a1433add-5e2c-0410-b055-b7f2511e0802
2013-04-01 19:57:25 +00:00
Christian Boltz
1e0225e2c2 model/CliEdit.php:
- help(): generate help output based on $handler->struct
  It shows all available options/fields, but might need some finetuning
  to look better



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1441 a1433add-5e2c-0410-b055-b7f2511e0802
2013-03-03 01:23:50 +00:00
Christian Boltz
f240e20831 model/CliEdit.php:
- add __handle_params() to implement non-interactive mode. It
  reads, checks and handles the various --* commandline parameters
- __handle():
  - replace $this->error() calls with $this->err()
  - add missing return on failure



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1440 a1433add-5e2c-0410-b055-b7f2511e0802
2013-03-03 00:57:07 +00:00
Christian Boltz
be84a8b8fc MailboxHandler:
- _field_password(): return true if checks are successful
  (without this, an empty password might have ended up in the database!)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1438 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-26 00:07:34 +00:00
Christian Boltz
eafc2b6222 model/CliEdit.php:
- new class for CLI add and edit
- based on AddTask, but big parts of __interactive()) are rewritten to:
  - use $struct for the user interface (which means it will automatically 
    adopt to changes in the *Handler classes)
  - check all entered data instantly. If an invalid value was entered,
    ask again to give the user a chance to enter valid data.
- CliEdit already replaces all AddTask classes (interactive mode works, 
  commandline parameter mode not implementated yet)
- will also replace all EditTask classes in the future

scripts/shells/shell.php
- loadTasks(): for add, use new CliEdit instead of AddTask class
- in():
  - print additional empty line if $prompt is not empty
  - print error message when invalid option is chosen
  - always return raw $in to avoid '0' vs. ''. vs NULL problems



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1437 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-25 23:43:08 +00:00
Christian Boltz
b878f18dcc MailboxHandler:
- _missing_local_part(), _missing_domain(): remove broken if condition


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1436 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-25 20:23:00 +00:00
Christian Boltz
13f89e339b MailboxHandler.php:
- add _field_password():
  - compare password / password2 field (error message will be displayed 
    at password2 field)
  - autogenerate password if enabled in config and $new
  - display password on $new if enabled in config or autogenerated

This means MailboxHandler now has all needed features to replace 
create-mailbox.php :-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1432 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-19 22:48:02 +00:00
Christian Boltz
227eca6faf PFAHandler.php:
- introduce public array $infomsg[] (for success messages)
- store(): write successmessage to $this->infomsg[]

edit.php:
- display $handler->infomsg instead of hardcoded success message

AdminHandler.php, AliasHandler.php, AliasdomainHandler.php,
DomainHandler.php, MailboxHandler.php:
- move successmsg from webformConfig() to initMsg()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1428 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-16 20:42:17 +00:00
Christian Boltz
5a8ee27af3 displaying the available quota on $new is harder than it looks...
edit.php:
- call $handler->prefill for all prefill fields
- refresh $form_fields after handling prefill fields

model/PFAHandler.php:
- add prefill() to handle prefill fields. If $this->_prefill_$field()
  exists, it will be called

model/MailboxHandler.php:
- init(): error out early if parent::init fails (no need to check the
  available quota if $this->id is invalid ;-)
- move updating the allowed quota to updateMaxquota()
- update the available quota based on the prefill domain. If no prefill
  domain is given, default to the first domain.
- new method _prefill_domain()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1426 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-09 23:52:03 +00:00
Christian Boltz
fad18fc953 MailboxHandler.php: add (nearly) everything for creating a mailbox
(TODO: generating random passwords - when this is done, MailboxHandler
can replace create-mailbox.php)

- initStruct(): 
  - make 'username' a 'mail' field (doesn't really change anything at
    the moment)
  - make 'maildir' editable on $new
- init(): minor cleanup
- validate_new_id(): error out early if check_email() fails
- beforestore(): 
  - convert quota from MB to bytes - previously in setmore()
  - on $new, create mailbox alias
- storemore(): run mailbox_postcreation(), send_welcome_mail() and
  create_mailbox_subfolders() on $new
- add send_welcome_mail()
- _field_quota(): return true on success (otherwise it's interpreted 
  as invalid value)
- add _missing_local_part(), _missing_domain() and _missing_maildir()
  to fill those fields on $new
- remove add() because all the code moved to the functions mentioned 
  above. 
  Known regression: this breaks CLI create mailbox for now



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1425 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-04 23:18:01 +00:00
Christian Boltz
5388bcf4cd AliasHandler.php:
- add MailboxAliasConfig() and $called_by_MailboxHandler for special
  handling if called by MailboxHandler
- create_allowed(): always allow creating an alias for a mailbox
- remove _missing_on_vacation() and _missing_active() which returned the
  default from $this->struct. This is now done by default, see previous
  change in PFAHandler



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1424 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-04 22:33:45 +00:00
Christian Boltz
28f59d8305 PFAHandler.php:
- set(): if a field is not set and there's no _missing_$field() method
  for it, take default value from $this->struct
  (side effect: this automagically fixes CLI create domain)
- store(): add a beforestore() hook that is called at the beginning of
  store()
- add empty beforestore() (will be overwritten by MailboxHandler)
- some comment updates


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1423 a1433add-5e2c-0410-b055-b7f2511e0802
2013-02-04 21:38:59 +00:00
Christian Boltz
a46bcc955c edit.php:
- prefill all $formconf['prefill'] fields from URL parameters (typically
  used for the domain)

model/AliasdomainHandler.php:
- allow to prefill alias_domain and target_domain from URL parameters
 
model/AliasHandler.php:
- allow to prefill domain from URL parameters
- some whitespace changes
- add storemore() with a TODO note

model/MailboxHandler.php:
- allow to prefill domain from URL parameters
- some whitespace changes
- add some TODO notes



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1422 a1433add-5e2c-0410-b055-b7f2511e0802
2013-01-27 19:52:19 +00:00
Christian Boltz
fd7b02c870 MailboxHandler.php:
add everything for editing a mailbox

Details:
- include 'maildir' in "display in list" for now (not really
  needed/wanted in listview, but needed for the postedit hook)
- display max. allowed quota in quota field description (via init())
- add read_from_db_postprocess() - convert quota to MB and store the 
  original value in 'quotabytes'
- add setmore() - convert quota from MB to bytes
- add storemore() - call mailbox_postedit()
- add _field_quota() - quota validation


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1415 a1433add-5e2c-0410-b055-b7f2511e0802
2012-12-28 23:48:33 +00:00
Christian Boltz
d17fb42cde AdminHandler.php:
- initStruct():
  - pgsql doesn't support group_concat, so we need a database-dependent
    query to list the domains :-/
  - change some "..." to '...' to make them pgsql-compatible


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1393 a1433add-5e2c-0410-b055-b7f2511e0802
2012-05-28 17:32:49 +00:00
Christian Boltz
232cee9d5f PFAHandler:
- make PFAHandler an "abstract class"
- add functions that must be implemented by every *Handler class
  as abstract functions:
  - abstract protected function initStruct();
  - abstract protected function initMsg();
  - abstract public function webformConfig();
  - abstract protected function validate_new_id();
- lots of additional comments

AdminHandler, AliasdomainHandler, DomainHandler, MailboxHandler:
- remove comments that are now in PFAHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1385 a1433add-5e2c-0410-b055-b7f2511e0802
2012-05-06 20:01:32 +00:00
Christian Boltz
4bb441d45d PFAHandler:
- mark _inp_* functions as protected


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1384 a1433add-5e2c-0410-b055-b7f2511e0802
2012-05-06 18:36:03 +00:00
Christian Boltz
e36c3e2a23 PFAHandler.php:
- add lots of comments
- sort variables into categories
  - public variables (currently only errorMsg)
  - must be defined in *Handler classes
  - set by methods
- (no "real" code changes)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1383 a1433add-5e2c-0410-b055-b7f2511e0802
2012-05-05 23:09:29 +00:00
Christian Boltz
ca8c27ae93 AliasHandler.php:
- initStruct(): add 'editable' virtual field
- add various comments

AdminHandler.php:
- add some comments


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1382 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-29 20:52:30 +00:00
David Goodwin
ef80736445 Merge jan-kruis's vacation interval reply behaviour - see SF patch 3508083 - https://sourceforge.net/tracker/?func=detail&aid=3508083&group_id=191583&atid=937966 ; Thank you
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1373 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-19 21:55:36 +00:00
Christian Boltz
2e503a3867 MailboxHandler.php:
- initStruct() / $struct:
  - add various labels
  - make local_part and domain editable on $new
  - fill domain option list with allowed_domains
  - add 'welcome_mail' (bool, not in database) for $new
- webformConfig(): 
  - change $struct to display localpart + domain instead of username on $new
  - disable early_init (not needed for mailboxes)
- add function mergeId()
- add function _field_password2 (to compare password/password2)
- drop deprecated function change_pass()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1367 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 22:43:30 +00:00
Christian Boltz
b58d398cf2 AdminHandler:
- initStruct(): add explanation what "superadmin" means
  https://sourceforge.net/tracker/?func=detail&aid=1865123&group_id=191583&atid=937964


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1366 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 20:17:58 +00:00
Christian Boltz
db8c2df6bc PFAHandler:
- set(): call $this->_missing_$fieldname() if a field is not set on $new
- new function set_default_value() - typically called from
  _missing_$fieldname to set the default from $struct

AliasHandler:
- set default values on $new:
  - on_vacation and active from $struct default
  - localpart and domain based on address

scripts/shells/alias.php:
- convert AddTask to *Handler syntax. It was broken before, see
  https://sourceforge.net/tracker/?func=detail&aid=3232719&group_id=191583&atid=937964 



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1364 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 20:01:40 +00:00
Christian Boltz
306c5a9688 PFAHandler:
- add function compare_password_fields() - compares if two fields contain
  the same password (based on _field_password2() from AdminHandler)
  and use pEdit_mailbox_password_text_error as error message because it
  doesn't contain "... or empty"

AdminHandler:
- replace _field_password2() with a call to $this->compare_password_fields()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1361 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 15:41:39 +00:00
Christian Boltz
56a8d1c52f MailboxHandler:
- start rewrite based on PFAHandler
- add initStruct(), initMsg(), webformConfig(), validate_new_id(), 
  create_allowed()
- drop old __construct() and view()
- replace $this->username with $this->id
- replace check of old password in change_pw() with $this->login 
 
users/password.php:
- adopt to *Handler syntax

scripts/shells/mailbox.php:
- adopt to *Handler view() syntax
- add TODO - maildir column isn't displayed
  
xmlrpc.php:
- adopt to *Handler syntax

Note: as usual, the changes in xmlrpc.php are untested ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1360 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 15:02:16 +00:00
Christian Boltz
19c6748988 VacationHandler:
- move getVacationAlias to AliasHandler (the only code that uses it)

AliasHandler:
- insert (and rewrite) function getVacationAlias()
- change $vh->getVacationAlias() calls to $this->getVacationAlias.
  This also means we don't need to call VacationHandler anymore to get
  the vacation alias.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1359 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 02:00:10 +00:00
Christian Boltz
e9d8fa1ff9 remove obsolete functions from AliasHandler (part 2/2)
AliasHandler.php:
- remove obsolete functions update(), is_mailbox_alias(), 
  is_vacation_address(), hasAliasRecord()
- updated delete() to use new *Handler syntax (most of it should be
  moved to PFAHandler, but that's another story ;-)

users/edit-alias.php:
- replace $ah->update with $ah->set / $ah->store
- use 0/1 for $fForward_and_store instead of YES/NO
- use safepost instead of isset()

templates/users_edit-alias.tpl:
- use 0/1 for $fForward_and_store instead of YES/NO

xmlrpc.php:
- replace $ah->update with new *Handler syntax

Note: the changes in xmlrpc.php are untested again ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1358 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 01:48:04 +00:00
Christian Boltz
fff6654634 AliasHandler:
- remove deprecated functions get() and hasStoreAndForward()

scripts/shells/alias.php:
- ViewTask: switch to *Handler syntax
- ViewTask: display is_mailbox, goto_mailbox and on_vacation status

users/edit-alias.php:
- replace $ah->get() and $ah->hasStoreAndForward() with *Handler syntax
- remove outdated comment in header

xmlrpc.php:
- switch get() and hasStoreAndForward() to *Handler syntax

Note: the changes in xmlrpc.php are untested!


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1357 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 01:06:52 +00:00
Christian Boltz
e4d5d4574e VacationHandler:
- use new *Handler syntax to add/remove vacation alias
  (implemented as function updateAlias() to avoid code duplication)

AliasHandler:
- setmore(): only use $oldvalues if no new on_vacation value is given
- setmore(): fix "undefined index" warning

edit.php:
- only set $values if a field is editable and displayed in the form
- do not set default values in $values
  (without those changes, the vacation alias was always removed when
  editing an alias)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1356 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-09 00:34:26 +00:00
Christian Boltz
b99adf6237 PFAHandler:
- add support for LIMIT/OFFSET to getList()

AliasHandler:
- overload getList() to only return non-mailbox aliases


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1353 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-08 23:07:22 +00:00
Christian Boltz
50c7044f72 AliasHandler:
- if the alias points to the mailbox, don't display the "empty goto" 
  error message


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1351 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-08 21:25:25 +00:00
Christian Boltz
cb0cf81b5a AliasHandler:
- add handling for $CONF[alias_control_admin] in init()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1349 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-08 21:17:56 +00:00
Christian Boltz
9b2da37d84 AliasHandler:
- setmore(): keep/(re-)add vacation and mailbox alias to goto
- hide 'goto_mailbox' if the alias does not belong to a mailbox
  (done in initStruct for $new, otherwise in init())

edit.php:
- set $form_fields and $id_field later (after $hander->init()) - needed
  for AliasHandler to decide if goto_mailbox should be displayed

With this commit, AliasHandler is feature-complete for usage with 
edit.php. We even get a "deliver to local mailbox" checkbox :-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1348 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-08 20:16:53 +00:00
Christian Boltz
e66bb02b84 AliasHandler.php:
- $struct: add is_mailbox (does the alias belong to a mailbox?)
- $struct: add goto_mailbox (if the alias is a mailbox, does it point 
  to the mailbox or is it forward-only?)
- set goto_mailbox in read_from_db_postprocess()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1347 a1433add-5e2c-0410-b055-b7f2511e0802
2012-04-08 17:41:02 +00:00
Christian Boltz
3fc6c84e13 AliasHandler.php:
- initStruct(): add 'on_vacation'
- read_from_db_postprocess(): split off vacation alias from $goto
  and store vacation status in on_vacation (honors the vacation alias
  only, not the details from the vacation table)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1344 a1433add-5e2c-0410-b055-b7f2511e0802
2012-02-03 23:53:58 +00:00
Christian Boltz
088fef9bdb AliasHandler.php:
- override init() - change '*@domain' -> '@domain', then call parent::init()
- validate_new_id(): allow catchall ('@domain'), check only domain in this case
- create_allowed(): copy of check_alias() from functions.inc.php, with 
  superfluous { ... } removed
- remove forgotten debugging from mergeId()
- _field_goto(): 
  - allow '@domain' targets (domain-wide forward)
  - use an array to collect error messages - that avoids 'uninitialized'
    warnings and allows to easily change the join() glue if needed

Overall status:
- create-alias is now fully supported
- handling of vacation and mailbox aliases is still on my TODO list, which
  means we still need edit-alias for now


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1316 a1433add-5e2c-0410-b055-b7f2511e0802
2012-01-10 00:07:09 +00:00
Christian Boltz
d39a802d00 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
2011-12-27 18:13:32 +00:00
Christian Boltz
da9a69dd0d AliasHandler.php:
- add initStruct() (not the final version, but works for now)
- add initMsg()
- replace $this->username with $this->id everywhere
- drop __construct() - default __construct will be used now

users/edit-alias.php, xmlrpc.php, VacationHandler.php, scripts/shells/alias.php:
- use default init sequence for AliasHandler (new, then ->init())


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1310 a1433add-5e2c-0410-b055-b7f2511e0802
2011-12-26 20:54:40 +00:00
Christian Boltz
b8812686aa AliasdomainHandler.php, PFAHandler.php:
- move empty storemore() function from AliasdomainHandler to PFAHandler



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1309 a1433add-5e2c-0410-b055-b7f2511e0802
2011-12-26 18:27:25 +00:00
Christian Boltz
18b8564b64 Make $struct in the *Handler classes customizeable
config.inc.php:
- add $CONF['*_struct_hook'] to modify $struct in the *Handler classes

PFAHandler.php:
- call $CONF['*_struct_hook'] hook

AdminHandler.php, AliasdomainHandler.php, DomainHandler.php:
- remove now outdated TODO notes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1303 a1433add-5e2c-0410-b055-b7f2511e0802
2011-12-20 23:07:34 +00:00
Christian Boltz
6eb7e9f794 PFAHandler.php:
- encrypt passwords ("pass" fields) with pacrypt()

AdminHandler.php:
- update/remove various TODO notes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1302 a1433add-5e2c-0410-b055-b7f2511e0802
2011-12-20 16:46:08 +00:00
Christian Boltz
ee33647232 setup.php
- add rewritten function create_admin() (now using AdminHandler, 
  which means 25 instead of 80 lines)
- various follow-up changes to match the rewritten function create_admin()

functions.inc.php:
- delete function create_admin() - setup.php was the last file calling it
- honor POSTFIXADMIN_SETUP in authentification_get_username() to avoid
  a redirect to login.php after creating an admin with setup.php and to
  get "SETUP.PHP" for db_log()

model/AdminHandler.php:
- add TODO: implement generate_password


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1301 a1433add-5e2c-0410-b055-b7f2511e0802
2011-12-20 01:06:49 +00:00
Christian Boltz
23c08bc02e PFAHandler.php:
- store unchecked input values given to set() in $this->RAWvalues before
  running the validation functions. This is needed to make comparing 
  password and password2 possible.
  (uppercase RAW intentional to make usage harder - hopefully hard enough
  to give everybody who wants to use it some time to think over secure
  programming when working with unchecked input ;-)

AdminHandler.php:
- compare password and password2

This commit means AdminHandler is complete :-)

(Note: db_log can't handle the admin-related log actions yet.)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1297 a1433add-5e2c-0410-b055-b7f2511e0802
2011-12-19 22:50:12 +00:00
Christian Boltz
3a8a738585 PFAHandler.php:
- fix field type for skipping password fields (must be 'pass', not 'password')
- implement validation of 'pass' fields with validate_password()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1293 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-29 00:23:55 +00:00
Christian Boltz
300f096025 AdminHandler.php:
- add empty no_domain_field() to disable default die() from PFAHandler
- $struct: 
  - changed 'superadmin' to normal bool field (+ TODO note)
  - changed 'password2' to be an alias of password in SELECT
  - init 'domains' default with array() and options with list_domains(),
- storemore():
  - implement storing domains in domain_admins table
  - implement storing ALL in domain_admins table for superadmins to 
    keep the database backwards-compatible with 2.3.x for now
- add read_from_db_postprocess() to convert the domains list to an array

This makes AdminHandler working with edit.php?table=admin
(Some fine-tuning at various places/files is still missing.)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1291 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-28 00:36:12 +00:00
Christian Boltz
7773c537cc PFAHandler.php - read_from_db():
- also include column in SELECT if display_in_form != 0
- call read_from_db_postprocess() hook before returning data


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1287 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-27 22:03:34 +00:00
Christian Boltz
0f0b7d336c PFAHandler:
- split code to handle domain_field == "" && admin_username != ""
  from __construct() to no_domain_field().
  Default behaviour stays to die(), but AdminHandler will override it


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1286 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-27 21:29:00 +00:00
Christian Boltz
36e31b9e23 AdminHandler.php (new file):
- Handler for admins
- list mode works
- edit mode not implemented yet


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1281 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-26 00:50:44 +00:00
Christian Boltz
8f267c1b7f Use edit.php to create/edit domains
model/DomainHandler.php:
- add webformConfig()

configs/menu.conf:
- change url_edit_domain to edit.php?table=domain
- drop url_create_domain (use url_edit_domain instead)

templates/*:
- replace #url_create_domain# with #url_edit_domain#
- replace ? with &

create-domain.php:
- deleted :-)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1276 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-13 22:59:21 +00:00
Christian Boltz
9cf7c7799a Use edit.php to edit/create for alias domains
(yes, we get edit mode "for free")

model/AliasdomainHandler.php:
- add webformConfig()

configs/menu.conf:
- change url_create_alias_domain to edit.php?table=aliasdomain

templates/list-virtual_alias_domain.tpl
- change ?target_domain to &target_domain 
  (TODO: this is currently ignored by edit.php)
- add edit link (TODO: add log action to avoid the error message)

create-alias-domain.php:
- deleted :-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1275 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-13 22:48:22 +00:00
Christian Boltz
bfd4981433 PFAHandler.php:
- fix view() to use associative array key


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1273 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-13 22:15:04 +00:00
Christian Boltz
63f20c28da AliasdomainHandler.php - initStruct():
- if only one alias_domain available, filter it out from target_domain list


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1271 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-13 16:19:53 +00:00
Christian Boltz
06ffffae7d AliasdomainHandler.php:
- set $domain_field to enable permission handling (and to get a list of
  allowed/available domains)
- fill $this->struct['alias_domain']['options'] and 
  $this->struct['target_domain']['options'] with available domains that
  are not yet used as alias domain
- override init() to get "All domains are already aliased" error message
  out as early as possible (and let init() fail in this case)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1269 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-12 23:41:17 +00:00
Christian Boltz
157034d8fe PFAHandler.php:
- read_from_db(): use associative array for database content
  (with $this->id_field as key)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1268 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-12 23:28:03 +00:00
Christian Boltz
a0e59f82b9 model/DomainHandler.php:
- set $domain_field to enable domain permission handling

list-domain.php:
- use permission handling of DomainHandler. This means:
  - no need to call list_domains_for_admin() 
  - no longer hand over SQL sniplets
  - much easier handling for superadmins and "simulate admin" mode
  - 14 lines less code for permission handling etc.
- remove superfluous/outdated header comments
- move $smarty_assign('select_options') to global section (it's the
  same code for domain admins and superadmins)

Note: don't try to read the diff of list-domain.php.
Read the complete file instead ;-)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1267 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-12 22:01:45 +00:00
Christian Boltz
68c79b9013 PFAHandler.php:
allow restriction to an admin's domain permissions

- new protected variables:
  $admin_username  - if set, restrict $allowed_domains to this admin
  $domain_field    - column containing the domain
  $allowed_domains - if $domain_field is set, this is an array with
                     the domain list
- __construct: new optional parameter $admin_username to restrict
  allowed domains to this admin's permissions
- read_from_db(): handle $allowed_domains
- read_from_db(): fix query if $condition == ""

PS: Yes, I know some people would like to kill me for including 
    permission stuff in PFAHandler, but it's the best (and shortest,
    only +20 lines) way to handle it.



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1266 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-12 21:46:25 +00:00
Christian Boltz
398ce70132 model/AliasdomainHandler.php:
- new file
- handler class for alias domains
- completely working (except delete)
- some TODOs included


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1261 a1433add-5e2c-0410-b055-b7f2511e0802
2011-11-01 00:00:13 +00:00
Christian Boltz
161c9b1ed2 scripts/shells/domain.php:
- AddTask:
  - use $values[$field] instead of a short variable name for input
  - hand over $values array to __handle as array instead of dozens of variables
- ViewTask: use $struct for printing the output

model/DomainHandler.php:
- use 'created' as label for created



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1259 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-31 20:57:43 +00:00
Christian Boltz
8dda511cd5 scripts/shells/domain.php / AddTask:
- read transport options from $handler->getStruct
  (instead of $handler->getTransports())
- convert selected transport to to transport name directly
  (instead of using $handler->getTransport)

model/DomainHandler.php:
- init_struct: read transport options with Conf::read directly
  (instead of using $this->getTransports()
- delete no longer used functions getTransports() and getTransport()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1256 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-30 21:25:57 +00:00
Christian Boltz
e4fc3623cc PFAHandler.php:
- add/update several comments



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1255 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-30 21:21:39 +00:00
Christian Boltz
ae52f243e5 PFAHandler.php, DomainHandler.php:
- move definition of public and protected variables to DomainHandler.php
- move lots of functions from DomainHandler.php to PFAHandler.php:
  - __construct()
  - init()
  - set()
  - store()
  - read_from_db()
  - view()
  - getList()
  - getStruct()
  - getId_field()
  All functions and comments were moved without any modification.
  See the history of DomainHandler.php if you need to find out something 
  about the history of the functions listed above.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1254 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-30 20:58:00 +00:00
Christian Boltz
7a236d401c DomainHandler.php:
- rename $this->username to $this->id
- rename function validate_id() to validate_new_id()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1253 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-30 20:39:14 +00:00
Christian Boltz
7ac37cfbff templates/editform.tpl:
- new file
- generic edit form template that uses $struct to render the form

templates/admin_edit-domain.tpl:
- deleted, obsoleted by editform.tpl

create-domain.php
- use new editform.tpl
- use $errormsg array instead of join't $errortext
- store/move errors related to a display_in_form field in $fielderror
  (they will be displayed next to the field)
- display remaining error messages (not related to a field) with 
  flash_error()
- use "value_$key" instead of "t$Key" as smarty variable name for field 
  values

model/DomainHandler.php
- store error messages in $this->errormsg[$field] (instead of $this->errormsg[])
- fix label for default_aliases

model/PFAHandler.php:
- store error messages in $this->errormsg[$field] (instead of $this->errormsg[])



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1252 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-30 20:27:08 +00:00
Christian Boltz
102d4c8c32 DomainHandler.php:
- whitespace fixes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1250 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-29 23:48:18 +00:00
Christian Boltz
eac2564c40 DomainHandler.php:
- initStruct(): fix alias_count ("something - NULL" is always NULL, now 
  enforces integer 0 for each JOINt in field with NULL value)
- set() now checks if $this->_field_$fieldname exists and calls it as
  additional validator
- split store() into store() (stores $this->values in the database) and
  storemore() (stores additional things and/or calls scripts)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1249 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-29 23:44:37 +00:00
Christian Boltz
a03a020095 MailboxHandler.php:
- delete(): use escaped $E_domain instead of $domain in some queries


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1247 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-29 22:29:16 +00:00
Christian Boltz
a8e626fe7f functions.inc.php:
- pacol(): new parameter $dont_write_to_db - needed to skip JOINt in 
  columns which (of course) aren't available on INSERT or UPDATE

model/DomainHandler.php:
- initStruct(): mark JOINt in columns with the dont_write_to_db flag
- store(): skip columns with the dont_write_to_db flag set (not_in_db
  columns are also/still skipped)

In non-technical terms: create-domain works now :-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1244 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-25 21:28:55 +00:00
Christian Boltz
a1dba20aff model/DomainHandler:
- read_from_db(): provide a working $colformat['ts'] for postgresql
  _and_ mysql (the only mysql/pgsql-specific code in DomainHandler,
  everything else works with both)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1242 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-24 23:32:45 +00:00
David Goodwin
5a18a1e48b postgresql fixes for DomainHandler perhaps
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1240 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-24 23:08:46 +00:00
David Goodwin
563e401c92 make Config.php a php5 compatible object; remove strict standards warnings
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1236 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-24 22:24:21 +00:00
Christian Boltz
72441d7dd6 create-domain.php:
- assign smarty values only for fields that have the display_in_form flag

model/DomainHandler.php:
- initStruct(): make default_aliases display_in_form dependant on $this->new
  (it's useless in edit mode)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1235 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-24 22:17:43 +00:00
Christian Boltz
a1fdd87360 MailboxHandler.php:
- add comment about forcing $CONF['domain_in_mailbox] = YES if 
  $CONF['domain_path'] == NO. 
  
Without this comment, the code might look buggy - confirmed ;-) in
https://sourceforge.net/tracker/?func=detail&atid=937964&aid=3427498&group_id=191583



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1232 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-23 14:09:39 +00:00
Christian Boltz
7f9d947e8f model/DomainHandler.php:
- use a new SELECT query syntax (sub-SELECTs) that gets all needed
  information (including alias count, mailbox count and total quota)
  in one query and is fast as light.
  Better don't ask how long it took me to write this query, and I
  seriously hope it works with postgresql. Otherwise...!
- add alias_count, mailbox_count and total_quota (including the required
  SQL magic) to $struct
- add support for funny[tm] query tricks in $struct:
  - replacement for field name in SELECT statement
  - additional SQL after the FROM xy clause - useful for JOINs
- new function getList($condition) to get a list of domains
- order SELECT results by $this->id_field (needed for getList)
- add comment about the values used in $struct[*][type]

functions.inc.php:
- add two more optional parameters to pacrypt(): $select and $extrafrom

scripts/shells/domain.php:
- display number of existing aliases and mailboxes
- display quota sum



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1230 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-22 22:49:01 +00:00
Christian Boltz
532712303a model/DomainHandler.php:
- split view() into 
  - read_from_db (with param $condition, can also be used with other 
    conditions than "domain = $this->username")
  - view() - fetches one row
  (as preparation before implementing a function to list all domains)
- read_from_db():
  - replace $bool_fields with $colformat['bool'] - now the database
    results for bool fields are always 0/1 (by using CASE in the query),
    and have an additional _$field with yes/no
  - resultset is now an array of rows (instead of a single row)
  - use db_assoc() instead of db_array()
- view(): use read_from_db()
- store(): change a comment that confused vim autofolding



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1229 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-22 13:10:44 +00:00
Christian Boltz
429ef27031 functions.inc.php:
- new function db_where_clause($condition, $struct) to create a WHERE clause.
  bool values are converted with db_get_boolean() based on $struct

model/DomainHandler.php - view():
- build WHERE clause with db_where_clause()
- new array $colformat for columns which need special handling in the field list
  (that's more readable than tons of elseif on the long term, and allows easier
  customization (hook/$CONF value?))



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1228 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-22 11:12:03 +00:00
Christian Boltz
7a237c98f4 DomainHandler:
- new function getId_field()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1224 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-19 20:21:43 +00:00
Christian Boltz
c87a0b97f4 DomainHandler.php:
- store() can now handle INSERT and UPDATE (depending on $this->new) :-)
- store some texts in $this->msg[] (replaced several $this->variable)
  to make functions easier reuseable
- new function initMsg to fill $this->msg[] (can depend on $this->new)
- convert values to a DB-understandable format in store(), not in set()
  (affects only bool for now, another candidate is pacrypt()ing passwords)
- check if all fields are set (on new)
- unset all not_in_db fields in $db_values in foreach loop



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1223 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-19 17:52:26 +00:00
Christian Boltz
95bf0161c6 Make create-domain.php even shorter (109 -> 89 lines) ;-)
create-domain.php
- replace old $form_fields with $handler->getStruct()
- rewrite handling POST data to make it easier to understand
  - move reading POST input to the section handling POST
  - remove condition on POST (we are in the POST block now)
  - check if editing of a field is allowed (use default value if not)
- move validation of 'enum' fields to PFAHandler
- allow changing the "active" state (instead of hardcoding it)

model/PFAHandler.php:
- add check for 'enum' fields

model/DomainHandler.php:
- change default for "active" and "default_aliases" to 1

templates/admin_edit-domain.tpl:
- don't hide the "Active" checkbox on new


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1220 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-18 22:56:33 +00:00
Christian Boltz
f8fb724dcf model/DomainHandler.php:
- split __construct to
  - __construct($new=0) - init $struct etc.   and
  - init($username) - validate $username
  This allows reading of $struct before doing any check on the username,
  and will also avoid problems when I implement a function to list all
  domains
- init(): use direct return values instead of $this->return

scripts/shells/domain.php, create-domain.php
- update to use new DomainHandler->init()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1219 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-18 22:11:22 +00:00
Christian Boltz
1aeae661af DomainHandler.php:
- new: public function getStruct()
- make store() public explicitely
- store domain_postcreation error message in $this->errormsg
- use existing error message instead of "invalid domain"



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1216 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-17 23:44:40 +00:00
Christian Boltz
1a4bd35e08 Move the classes "Config" and "Lang" to scripts/common.php to model/
Class Lang uses exactly the same code as Class Config - therefore
I replaced its code with a simple "extends Config".



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1212 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-17 21:47:58 +00:00
Christian Boltz
78d15b084d DomainHandler.php:
- split add() function to 
  - set() (validate values) and 
  - store() (write to database)
- set():
  - replace $checked with $this->values
  - store validation summary in $this->values_valid

PFAHandler.php:
- change _inp_* functions to return true/false if value is (in)valid
  instead if the sanitized value. They now also set $this->errormsg[]
  (not the final solution, but works for now)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1210 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 23:37:11 +00:00
Christian Boltz
8ed7747a81 DomainHandler.php:
- view(): 
  - auto-generate field list based on $this->struct
  - use date_format() for timestamp fields in the sql query
  - convert bool fields to integer 0/1 (postgresql uses t/f internally)
    to make the result database independent
- enable "display in list" for "created" column to avoid error in 
  CLI view domain


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1209 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 22:32:22 +00:00
Christian Boltz
bf2d5e0f4b DomainHandler.php:
- validate $username (domain name in this case) in __construct
  (using the new function validate_id)
- make initStruct protected (was private)
- additional parameter for view() to supress error messages



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1207 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 21:41:27 +00:00
Christian Boltz
7a9a993083 PFAHandler, AliasHandler:
- move result() from AliasHandler to PFAHandler
- AliasHandler now extends PFAHandler


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1205 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 20:31:46 +00:00
Christian Boltz
14c5433faf DomainHandler:
- use ' instead of " for $struct keys
- whitespace changes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1204 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 19:33:31 +00:00
Christian Boltz
1e601ce4d4 DomainHandler.php:
various fixes, implemented some TODOs

- move table name into variable $this->db_table
- use correct config option to detect if quota support is enabled
- fix (virtual) column name for default aliases
- use type 'ts' (timestamp) for created and modified
- fill non-editable rows with defaults if $this->new
- read values from $values instead of safepost()
- unset $db_values['default_aliases'] before writing to database
- some other minor changes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1203 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 18:50:33 +00:00
Christian Boltz
ed7019ff5c MailboxHandler:
- whitespace changes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1200 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-10 22:15:16 +00:00
Christian Boltz
d09ae9e360 model/DomainHandler.php:
- integrate $defaults in $struct to have everything in one place
- integrate field labels, descriptions etc. in $struct
- $struct now has named keys and is filled with the new pacal() helper function
- replaced TODO comments with new ones ;-)

functions.inc.php:
- new function pacol() to fill $struct with an associative array


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1145 a1433add-5e2c-0410-b055-b7f2511e0802
2011-07-29 22:06:52 +00:00
Christian Boltz
c4fd99baa7 MailboxHandler.php:
- use smtp_get_admin_email() to get the sender for the welcome mail
- add a check for empty (shouldn't happen in theory) or 'CLI' username
  and use the mailbox address as fallback

This is based on Dale's patch, but completely rewritten (what a big word
for two lines of code ;-)  Dale had only added the line
 if(empty($fFrom)) $fFrom = $this->username;

My version is tested with CLI with both $CONF[admin_email] set and empty.

This commit is part of the huge cleanup patch by Dale Blount (lnxus@SF),
https://sourceforge.net/tracker/?func=detail&atid=937966&aid=3370510&group_id=191583


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1127 a1433add-5e2c-0410-b055-b7f2511e0802
2011-07-25 22:38:11 +00:00
Christian Boltz
931a375255 VacationHandler:
- check_vacation() used outdated syntax $ah->get() which nowadays only
  returns true/false. Fixed to fetch $ah->result() and added at least
  basic error handling.
Indirectly ;-) reported by supa_user on IRC


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1075 a1433add-5e2c-0410-b055-b7f2511e0802
2011-07-14 20:29:10 +00:00
Christian Boltz
9f94438a78 model/DomainHandler.php:
- replace $domain with $this->username in add()
- comment cleanup


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1047 a1433add-5e2c-0410-b055-b7f2511e0802
2011-04-19 22:08:20 +00:00