- 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
- 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
- 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
(as discussed with GingerDog on IRC yesterday).
Also renamed user to mailbox in the CLI.
- renamed model/UserHandler.php to MailboxHandler.php
- renamed scripts/shells/user.php to mailbox.php
- replaced UserHandler / user with MailboxHandler / mailbox in various files
- unrelated cleanup: deleted obsolete scripts/models-ext directory
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1019 a1433add-5e2c-0410-b055-b7f2511e0802
- set_away() killed the existing aliases and replaced them with the vacation
alias instead of adding it. Fixed.
- remove array() from db_update calls for vacation table (introduced by valkum
in r981) - the vacation table has created/modified columns since r945
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@988 a1433add-5e2c-0410-b055-b7f2511e0802
*fixed VacationHandler.php
*changed edit-vacation to us VacationHandler
*added todopoint to upgrade.php
*fixed problem in AliasHandler
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@981 a1433add-5e2c-0410-b055-b7f2511e0802
easy-to-edit field lists. With lots of inspiration from fetchmail.php
and a base class I started 2.5 years ago.
model/DomainHandler.php
- base on PFAHandler (see below)
- new protected variables
- $id_field (column that contains $username)
- $struct (field list)
- $defaults (default values, option lists)
- $new (switch between new and edit mode)
- change $username to protected (preparation for move to PFAHandler)
- add optional $new parameter to __construct. Targets (not yet implemented):
- early validation of $username (domain name in this case)
- if $new == 1, check that item does NOT exist and is a valid domain
- else: check if item exists. error out if not.
- new function initStruct to fill $id_field, $struct, $defaults
- add():
- use an array as parameter instead of single parameters
Advantage: this makes it easy to add another field
- use _inp_* base validation
- create default aliases only in create mode, not in edit mode
- view(): fix error message
- added various TODO notes. Some affect design questions - feedback welcome ;-)
scripts/shells/domain.php:
- change $handler->add call to array usage
- add some TODO notes
- some whitespace fixes in execute()
model/PFAHandler.php:
- new base class for *Handler classes
- contains only some generic input validation for now
- more code will be moved from DomainHandler to PFAHandler later
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@978 a1433add-5e2c-0410-b055-b7f2511e0802
- implement delete()
Note that this is a dummy function at the moment. It doesn't work,
it just errors out with "not implemented yet" ;-)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@961 a1433add-5e2c-0410-b055-b7f2511e0802
- use $this->username for the domain name (I know the variable name is
confusing, but I'd like to be consistent with the other classes)
- remove $domain parameter in add() and view(), use $this->username instead
- escape domain in view() for select query
- removed unused "global $config" in view()
- remove superfluous created/modified arrays in db_insert calls
- added some TODO notes
- changed db_log to 'CONSOLE' instead of $this-username for consistency
with other classes. Long-term fix is to remove the first parameter of
db_log and let it detect the username automatically.
- various whitespace fixes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@958 a1433add-5e2c-0410-b055-b7f2511e0802
- added several TODO notes
- use db_insert/db_update/db_delete instead of raw queries
- get_details(): error check first (for better readable code),
whitespace fix
- getVacationAlias: str_replace is enough
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@938 a1433add-5e2c-0410-b055-b7f2511e0802
column and value are separate parameters now
functions.inc.php:
- changed function db_update() parameters - column name and value for the WHERE
condition are now two separate parameters. This means we don't need to
escape_string(), add quotes etc. for most UPDATE queries.
Example call: db_update('alias', 'address', $this->username, $values_array)
- the previous db_update() is now called db_update_q()
model/UserHandler.php:
- changed db_update call to the new parameters
- removed now unused variables
- renamed $username to $E_username
- call pacrypt directly when setting the $set array, no need for $new_db_password
model/AliasHandler.php
- changed db_update call to the new parameters
edit-mailbox.php
- switched to db_update_q()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@931 a1433add-5e2c-0410-b055-b7f2511e0802
shells/alias.php:
- execute still called help() instead of __handle()
model/AliasHandler.php - delete():
- remove useless $address parameter from delete() (we have $this->username)
- added error messages
- fixed variable names for db_log
Reason for the "mostly":
The $this->is_mailbox_alias() in delete() always returns true and therefore
forbids deletion.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@930 a1433add-5e2c-0410-b055-b7f2511e0802
- moved scripts/models-ext/DomainHandler.php to model/
- deleted redirect scripts in scripts/models-ext/ (UserHandler.php,
AliasHandler.php)
- changed scripts/common.php to include the files from ../model/
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@925 a1433add-5e2c-0410-b055-b7f2511e0802
-added alias delete function
-remove silly password function in domain and alias
-changed some $this->err to $this->error
-error ends with stop(1) which returns 1 in *unix shells
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@920 a1433add-5e2c-0410-b055-b7f2511e0802
- if you want to verify the old password, you should compare it against
the OLD and not the NEW password ;-)
- fix database calls
In other words: changing the password in users/password.php works again ;-)
users/password.php:
- switch from obsolete change_pass() to change_pw()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@916 a1433add-5e2c-0410-b055-b7f2511e0802
- pass $username through strtolower()
- get(): error check first for better readability (avoids long if block)
- get(): fixed a forgotten return behaviour change
- get(): renamed $new_list to $filtered_list (self-explaining code)
- update(): migrated to new return behaviour of get()
- update(): use db_update etc.
- some minor changes
- added various TODO notes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@915 a1433add-5e2c-0410-b055-b7f2511e0802
changed behaviour of get()
- get() now returns only true (success) / false (failure) instead of
the alias list
(result of partly merging in scripts/models-ext/AliasHandler.php)
- new method result() to get the real result (alias targets)
- added TODO on if(sizeof($addresses) == 0) - this should never happen
model/VacationHandler.php:
- updated for new AliasHandler bevaviour
xmlrpc.php:
- updated for new AliasHandler bevaviour
- switched from obsolete change_pass to change_pw method
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@912 a1433add-5e2c-0410-b055-b7f2511e0802
- change_pass() now returns the return value of change_pw()
- made most variables un-escaped (as expected by db_insert/db_update/
db_delete). This means they HAVE TO BE ESCAPED when using them in a
hand-written query. (Error messages also need escaping - the
backslashes from escape_string wouldn't help there anyways.)
- escaped variables renamed to $E_whatever
- changed all return values to true (success) and false (failure)
instead of shell-like 0 (success) and 1 (failure)
- removed unused global $config at various places
- removed timestamp columns from db_insert and db_update call where they
match the default
- added db_log() for some (but not all) failures
- honor $CONF[maildir_name_hook] when creating a mailbox
- splitting a mail address is now done with list(...) = explode(...)
- switched to db_begin(), db_commit(), db_rollback()
- let smtp_mail create the mail header
- added missing db_commit in delete()
- various minor fixes, code cleanup, comments and TODO notes
To sum it up: all code in UserHandler.php that does not have a TODO
attached should be fine :-)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@908 a1433add-5e2c-0410-b055-b7f2511e0802
- merged in all new functions and changes (by valkum + some bugfixes
and notes from me) - for details see r831, r888 and r891 of
scripts/models-ext/UserHandler.php
- re-added change_pass() function (was removed/renamed by valkum) for
backward compatibility.
IMPORTANT: change_pass will only exist temporarily and is deprecated.
Besides that, the new implementation has different return values etc.
so existing code might break already.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@896 a1433add-5e2c-0410-b055-b7f2511e0802
- hand over $search to smarty templates
templates/list-virtual_alias.tpl, templates/list-virtual_alias_domain.tpl:
- add search result highlighting
templates/list-virtual_mailbox.tpl:
- add search result highlighting
- move output of "Mailbox" / "Forward only" outside the foreach loop
(was displayed once per mailbox alias target)
css/default.css:
- add style for ".searchresult"
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@868 a1433add-5e2c-0410-b055-b7f2511e0802
- remove session_start() - the session is already started in common.php
model/UserHandler.php:
- db_log() used undefined variable $USERID_USERNAME - use $username instead
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@625 a1433add-5e2c-0410-b055-b7f2511e0802