- allowed_quota: if $CONF[quota] == NO, just return 0 (unlimited)
list-virtual.php:
- only eval_size($limit['maxquota']) if $CONF[quota] == YES
($limit['maxquota'] is not set if $CONF[quota] == NO)
Both issues (which caused PHP warnings) were found by TigerP on IRC
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1445 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
- 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
- _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
- 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
configs/menu.conf:
- change url_create_mailbox to edit.php?table=mailbox
templates/list-virtual.tpl:
- replace hardcoded create-mailbox.php with {#url_create_mailbox#}
functions.inc.php:
- delete functions that are now part of MailboxHandler:
- check_mailbox()
- multiply_quota()
- add some TODO notes
config.inc.php:
- rewrite a comment that referenced create-mailbox.php
create-mailbox.php:
- delete - no longer needed
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1433 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
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
(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
- 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
- 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
- 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
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
- add $PALANG['mb_max'] = 'MB (max: %s)';
- $PALANG['pVacation_reply_type']
$PALANG['pVacation_reply_delay_time']
$PALANG['pVacation_reply_delay_time_text']
was only in en.lang - add it to the translations
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1414 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
- _pgsql_field_exists(), _mysql_field_exists():
Those functions are always called with the expanded table name - don't
expand it twice. (The better solution would be to change all calling
code to provide non-expanded tablenames, but that's more work.)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1391 a1433add-5e2c-0410-b055-b7f2511e0802
- create_page_browser(): revert r1387 and...
- db_query(): ...replace it with the correct fix ;-) (avoid mysqli
reconnects)
The problem was that db_query() used is_resource() to check if we
already have a database connection, but a mysqli connection is an
object, not a resource.
This resulted in a new database connection for each query. Therefore
mysqli "forgot" the value of SET @row before executing the following
SELECT query (which used a new mysqli connection).
The fix is to also check with is_object() to avoid mysqli reconnects.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1388 a1433add-5e2c-0410-b055-b7f2511e0802