added user_model.php for user handling
added user_controller.php for controlling user missgin view for output.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@933 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
- fix example /etc/passwd line (had too many fields)
- moved no_address_mappings to the smtpd on port 25
- removed no_unknown_recipient_checks on port 10025
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@923 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 AliasHandler->get call - it does not need the address as parameter
- adopted to true/false return values
- some minor changes and TODO notes
models-ext/AliasHandler.php
- deleted, replaced with a redirect to ../model/AliasHandler.php
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@913 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
- prepared for updated AliasHandler from scripts/
- user could cause an empty alias with a trick (or form manipulation).
Checking forward_and_store for != YES instead of == NO fixes this.
- don't replace spaces in the middle of an (BTW: invalid) alias target
- preserve user input on validation error
- allowed displaying of multiple error messages
- removed unused $_POST[fVacation] variable
- some whitespace fixes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@911 a1433add-5e2c-0410-b055-b7f2511e0802
- adopted return value checks to true/false instead of shell-like 0/1
- fixed some messages in interactive mode
- various minor fixes
- added some TODO notes, but didn't do a full proofreading
scripts/models-ext/UserHandler.php:
- deleted, replaced with a redirect to /model/UserHandler.php
scripts/common.php, scripts/shells/shell.php:
- replaced obsolete "... =& new ..." with "... = new ..."
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@909 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
- smtp_mail(): added another (currently optional) parameter.
It can now be called with subject and body, no need to build the mail
header in every script that needs to send a mail.
- db_delete() did not use table_by_key. Fixed, backport queued for
2.3 branch
- db_insert() now has array(created,modified) as default for timestamp
columns so that most calls can be done without that parameter
- db_update() now has array(modified) as default for timestamp column
so that most calls can be done without that parameter
- new functions db_begin / db_commit / db_rollback - BEGIN / COMMIT /
ROLLBACK wrapped in a check for $CONF['database_type'] == "pgsql".
One more step to get rid of database-specific code in all files.
- db_log():
- migrated to db_insert. This should also fix some missing quoting.
- sorted $action_list to make it more readable
- backport queued for 2.3 branch for both changes
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@907 a1433add-5e2c-0410-b055-b7f2511e0802
- check_domain(): don't trim() the domain - whitespace is an error.
This catches "foo@ domain.com" that wasn't catched before.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@902 a1433add-5e2c-0410-b055-b7f2511e0802
some small fixes that came up while integrating the multiple alias
target patch from anexius (r898 [2.3]/r900 [trunk]):
- replace spaces only at the start and end of a line, not in the
middle of an (BTW: invalid) mail address
- prevent input data loss on validation errors
- allow multiple error messages (separated by <br />)
- removed some obsolete comments
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@901 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
- db_insert and db_delete need the default table name as parameter
('alias', not $table_alias aka table_by_key('alias') )
DomainHandler.php
- removed now unused $table_domain and $table_alias
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@891 a1433add-5e2c-0410-b055-b7f2511e0802
some changes after using perlcritic.org - in detail:
- removed unused variable $spam
- use ':encoding(UTF-8)' instead of ':utf8' to validate input against
invalid utf8 sequences
- foreach creates its own instance of $item - marking it with "my $item"
- replaced lots of "..." with '...'
BTW: Thanks to the nice guy who recommended perlcritic.org at the
openSUSE conference!
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@881 a1433add-5e2c-0410-b055-b7f2511e0802