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
- 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
- pacrypt(), dovecot:* method:
- allow "." in dovecot method (to allow a suffix like ".b64")
- blacklist SCRAM-SHA-1 (needs -u)
- check against list of non-salted methods to be backward compatible
with dovecot < 2.1 again
Thanks to Szilagyi Jozsef <szjozsef AT yahoo DOT com> for providing
the list of non-salted methods etc.
functions.inc.php, scripts/postfixadmin-cli.php:
- drop unused global variables $table_admin and $table_alias_domain
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1529 a1433add-5e2c-0410-b055-b7f2511e0802
- pacrypt: digest-md5 hashes include the username - until someone
implements it, let's declare it as unsupported and error out
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1525 a1433add-5e2c-0410-b055-b7f2511e0802
- pacrypt(): some small changes after Szilagyi Jozsef's patch:
- comment out unused $crypt_method
- change $dovecotpw default to "doveadm pw" (unrelated to the patch)
- set $dovepasstest to "-t $pw_db" instead of having two similar
command lines, and also shellescapearg() $pw_db
- use "if (empty($dovepasstest))" instead of "if (empty($pw_db))"
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1524 a1433add-5e2c-0410-b055-b7f2511e0802
doveadmin pw now has an option "-t $hash" which allows to verify
salted passwords (added in dovecot 2.1 AFAIK)
Also, the {METHOD} part is no longer removed.
Patch by Szilagyi Jozsef <szjozsef [at] yahoo.com> - thanks!
(The schemes which requires also the username -u option is still not supported)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1523 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
check_quota()
mailbox_postcreation()
mailbox_postedit()
create_mailbox_subfolders()
- use Config::read() / Config::bool() instead of $CONF
- update comment header
- some minor changes to make the code better readable
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1514 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
- 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
- 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
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
- 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
- create_page_browser(): include MOD(idx.row, $page_size) in outer SELECT.
This is needed on some MySQL setups which otherwise return an empty set.
Thanks to f-dens_ on IRC for helping to debug it.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1387 a1433add-5e2c-0410-b055-b7f2511e0802
- change list_admins() to use AdminHandler (code from list-admin.php)
Note: this changes the return value format to include all details,
not only the usernames. Use array_keys(list_admins()) if you need
the previous return format.
list-admin.php:
- replace code with a list_admins() call
list-domain.php:
- adopt to new list_admins() return value
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1386 a1433add-5e2c-0410-b055-b7f2511e0802
- _flash_string(): also accept an array of messages, not only a string
- comment updates for _flash_info() and flash_error() to reflect this change
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1378 a1433add-5e2c-0410-b055-b7f2511e0802
- PHP around 5.3.8 includes hex2bin as native function - http://php.net/hex2bin
therefore we have to wrap our function (which fortunately gives the same
results) with function_exists().
Reported by MadOtis on #postfixadmin
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1328 a1433add-5e2c-0410-b055-b7f2511e0802
- deleted, obsoleted by edit.php?table=alias
functions.inc.php:
- drop function check_alias() - it was only used by create-alias.php
(AliasHandler has a similar function create_allowed(), which is a
copy of check_alias() with superfluous {...} removed)
configs/menu.conf
- replace create-alias.php with edit.php?table=alias
- append "?" to url_create_mailbox to avoid temporary change in menu.tpl
(create-mailbox is the only one which still needs ? instead of &)
templates/list-virtual.tpl:
- use {#url_create_alias#} instead of hardcoded create-alias.php
templates/menu.tpl:
- $url_domain: url-escape domain, use & instead of ?
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1317 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
- allow log actions create_admin and edit_admin
- add edit_admin_state and delete_admin as comment/reminder that they
should also be logged
*.lang:
- add text for the new "create admin" and "edit admin" log actions
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1298 a1433add-5e2c-0410-b055-b7f2511e0802
- use AdminHandler
- move displaying the superadmin flag to the template
templates/adminlistadmin.tpl:
- update to the fieldnames provided by AdminHandler (name->username)
- move displaying the superadmin flag to the template
functions.inc.php:
- delete function get_admin_properties() (was only used by list-admin
and is not needed anymore) -> 48 lines less :-)
- add TODO to list_admins() to use AdminHandler
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1282 a1433add-5e2c-0410-b055-b7f2511e0802
- add log action 'edit_alias_domain'
- update outdated comment to point to $action_list instead of
maintaining the list as comment _and_ variable
languages/*.lang
- add $PALANG['pViewlog_action_edit_alias_domain']
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1278 a1433add-5e2c-0410-b055-b7f2511e0802
- rewrite to work for superadmins also (will list all domains now
instead of "ALL"), which means we can drop the admin vs. superadmin
check at various places
- escape_string $username
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1265 a1433add-5e2c-0410-b055-b7f2511e0802