- 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
- 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
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
- refresh $form_fields after ->set(). This fixes a wrong "allowed quota"
if creating a mailbox ends up with an error message because of invalid
values.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1468 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
- change $PALANG['pCreate_alias_result_success'] to 'The alias %s has
been created!' (%s added, less technical wording)
nl.lang:
- removed duplicated $PALANG['pVacation_result_added']
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1462 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
- marked camelize(), underscore() and variable() as public static
function to avoid PHP warnings with latest PHP (5.4.x)
- removed unused methods humanize(), tableize(), classify() and slug()
- removed unused function __enclose()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1457 a1433add-5e2c-0410-b055-b7f2511e0802
- move postfixadmin_autoload() and spl_autoload_register upwards
(it's needed earlier after using the Config class in more functions)
- call Config::write earlier (as soon as $CONF is complete)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1454 a1433add-5e2c-0410-b055-b7f2511e0802
- check_domain(), check_email():
use Lang::read and Config::read instead of global variables
(global variables, at least $PALANG, don't seem to work with CLI)
- boolconf():
- use Config::read instead of global $CONF
- drop isset() check - doesn't make sense when using Config::read
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1452 a1433add-5e2c-0410-b055-b7f2511e0802
- check_domain(), check_email(): instead of calling flash_error(),
return string with error message - or empty string if everything is ok
model/AdminHandler.php, model/AliasHandler.php,
model/DomainHandler.php, model/MailboxHandler.php,
sendmail.php, users/edit-alias.php:
- adopt to changed check_domain() and check_email() return value
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1451 a1433add-5e2c-0410-b055-b7f2511e0802
- initStruct(): add some comments
- add calledBy() and protected $called_by - calledBy() should be called if one
*Handler class calls another one (to avoid loops etc.)
AliasHandler.php:
- replace $called_by_MailboxHandler / MailboxAliasConfig() with $called_by
(code moved to PFAHandler->calledBy())
MailboxHandler.php:
- beforestore(): update alias active status on edit
(contains some whitespace changes - basically I removed "if ($this->new)"
around most parts of the code)
- use calledBy() instead of MailboxAliasConfig()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1449 a1433add-5e2c-0410-b055-b7f2511e0802
- implement "update" for all *Handler classes by using CliEdit class
(yes, it's really that easy ;-)
This gives us a working *) CLI for "update" in interactive and
non-interactive mode.
*) TODO: test if everything works ;-)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1447 a1433add-5e2c-0410-b055-b7f2511e0802
- 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