Commit Graph

96 Commits (master)

Author SHA1 Message Date
Christian Boltz e3731dc89d scripts/shells/* (alias.php, domain.php, mailbox.php):
- delete AddTask and UpdateTask classes - obsoleted by model/CliEdit.php


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1448 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 7276276ba2 scripts/shells/shell.php:
- 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
11 years ago
Christian Boltz eafc2b6222 model/CliEdit.php:
- 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
11 years ago
Christian Boltz d136b5d466 shells/mailbox.php / AddTask:
- move counting params into if (!empty($this->args[0])) block
  (the previous commit broke interactive mode)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1408 a1433add-5e2c-0410-b055-b7f2511e0802
12 years ago
Christian Boltz c3cc667caf scripts/shells/mailbox.php:
- update add, delete and password tasks to use new MailboxHandler syntax
- (roughly) check number of cmdline arguments for add

Reported by mkathuria at
http://sourceforge.net/projects/postfixadmin/forums/forum/676076/topic/5396581


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1407 a1433add-5e2c-0410-b055-b7f2511e0802
12 years ago
Christian Boltz db8c2df6bc PFAHandler:
- set(): call $this->_missing_$fieldname() if a field is not set on $new
- new function set_default_value() - typically called from
  _missing_$fieldname to set the default from $struct

AliasHandler:
- set default values on $new:
  - on_vacation and active from $struct default
  - localpart and domain based on address

scripts/shells/alias.php:
- convert AddTask to *Handler syntax. It was broken before, see
  https://sourceforge.net/tracker/?func=detail&aid=3232719&group_id=191583&atid=937964 



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1364 a1433add-5e2c-0410-b055-b7f2511e0802
12 years ago
Christian Boltz 56a8d1c52f MailboxHandler:
- start rewrite based on PFAHandler
- add initStruct(), initMsg(), webformConfig(), validate_new_id(), 
  create_allowed()
- drop old __construct() and view()
- replace $this->username with $this->id
- replace check of old password in change_pw() with $this->login 
 
users/password.php:
- adopt to *Handler syntax

scripts/shells/mailbox.php:
- adopt to *Handler view() syntax
- add TODO - maildir column isn't displayed
  
xmlrpc.php:
- adopt to *Handler syntax

Note: as usual, the changes in xmlrpc.php are untested ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1360 a1433add-5e2c-0410-b055-b7f2511e0802
12 years ago
Christian Boltz fff6654634 AliasHandler:
- remove deprecated functions get() and hasStoreAndForward()

scripts/shells/alias.php:
- ViewTask: switch to *Handler syntax
- ViewTask: display is_mailbox, goto_mailbox and on_vacation status

users/edit-alias.php:
- replace $ah->get() and $ah->hasStoreAndForward() with *Handler syntax
- remove outdated comment in header

xmlrpc.php:
- switch get() and hasStoreAndForward() to *Handler syntax

Note: the changes in xmlrpc.php are untested!


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1357 a1433add-5e2c-0410-b055-b7f2511e0802
12 years ago
Christian Boltz da9a69dd0d AliasHandler.php:
- add initStruct() (not the final version, but works for now)
- add initMsg()
- replace $this->username with $this->id everywhere
- drop __construct() - default __construct will be used now

users/edit-alias.php, xmlrpc.php, VacationHandler.php, scripts/shells/alias.php:
- use default init sequence for AliasHandler (new, then ->init())


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1310 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 161c9b1ed2 scripts/shells/domain.php:
- AddTask:
  - use $values[$field] instead of a short variable name for input
  - hand over $values array to __handle as array instead of dozens of variables
- ViewTask: use $struct for printing the output

model/DomainHandler.php:
- use 'created' as label for created



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1259 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 8dda511cd5 scripts/shells/domain.php / AddTask:
- read transport options from $handler->getStruct
  (instead of $handler->getTransports())
- convert selected transport to to transport name directly
  (instead of using $handler->getTransport)

model/DomainHandler.php:
- init_struct: read transport options with Conf::read directly
  (instead of using $this->getTransports()
- delete no longer used functions getTransports() and getTransport()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1256 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 7f9d947e8f model/DomainHandler.php:
- use a new SELECT query syntax (sub-SELECTs) that gets all needed
  information (including alias count, mailbox count and total quota)
  in one query and is fast as light.
  Better don't ask how long it took me to write this query, and I
  seriously hope it works with postgresql. Otherwise...!
- add alias_count, mailbox_count and total_quota (including the required
  SQL magic) to $struct
- add support for funny[tm] query tricks in $struct:
  - replacement for field name in SELECT statement
  - additional SQL after the FROM xy clause - useful for JOINs
- new function getList($condition) to get a list of domains
- order SELECT results by $this->id_field (needed for getList)
- add comment about the values used in $struct[*][type]

functions.inc.php:
- add two more optional parameters to pacrypt(): $select and $extrafrom

scripts/shells/domain.php:
- display number of existing aliases and mailboxes
- display quota sum



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1230 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz f8fb724dcf model/DomainHandler.php:
- split __construct to
  - __construct($new=0) - init $struct etc.   and
  - init($username) - validate $username
  This allows reading of $struct before doing any check on the username,
  and will also avoid problems when I implement a function to list all
  domains
- init(): use direct return values instead of $this->return

scripts/shells/domain.php, create-domain.php
- update to use new DomainHandler->init()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1219 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 646c790371 common.php, scripts/postfixadmin-cli.php:
- init Lang and Config classes in common.php instead of postfixadmin-cli.php -
  they need to be available in the web interface also


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1215 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 4611b111e3 common.php:
- merge with scripts/common.php
- don't start/use session in CLI mode
- don't load smarty.inc.php in CLI mode
- hardcode language to 'en' in CLI mode (was done in postfixadmin-cli.php before)

scripts/postfixadmin-cli.php - __bootstrap():
- use common.php instead of scripts/common.php
- don't load languages/language.php and languages/en.lang (already
  done via common.php)
- don't call language_hook (already done via common.php)

scripts/common.php:
- deleted
- dropped helper functions low(), up(), r() and pr() which were just
  shortnames for existing PHP functions


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1214 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 7bcd041d45 scripts/shells/*.php:
- use strtolower()/strtoupper() instead of low()/up() shortnames.
  This makes the code slightly longer, but easier to understand because
  strtolower()/strtoupper() are well-known function names



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1213 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 1a4bd35e08 Move the classes "Config" and "Lang" to scripts/common.php to model/
Class Lang uses exactly the same code as Class Config - therefore
I replaced its code with a simple "extends Config".



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1212 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 23e6dee1b2 shells/domain.php:
- *Task / __handle(): check $handler->result after calling "new"
- AddTask / __handle():
  - don't set domain in $values - it's already included in the "new" call
  - hardcode "active" to 1 - before, it accidently got the value of "aliases"
  - use $handler->set() and $handler->store instead of $handler->add()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1211 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 69b3df10e4 config.inc.php
- new config option $CONF['password_validation'] - array with regular
  expressions to check if a password is valid/good enough.
  The default configuration enforces:
  - minimum length 5 characters/digits/whatever
  - at least 2 characters
  - at least 2 digits
- removed $CONF['min_password_length'] - it's now handled in /.{5}/ in
  $CONF['password_validation']

functions.inc.php
- new function validate_password to check a given password against
  $CONF['password_validation']
- generate_password: generated password is always 8 chars long
  (instead of $CONF['min_password_length'])

edit-admin.php, users/password.php, edit-mailbox.php, setup.php:
- use validate_password instead of $CONF['min_password_length']

This implements
https://sourceforge.net/tracker/?func=detail&aid=1785513&group_id=191583&atid=937967


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1192 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz a5f3cb9b96 config.inc.php:
- new config option $CONF['language_hook']
  Hook function to override or add translations to $PALANG.
  Example hook function included (commented out).

common.php:
- honor $CONF['language_hook']

scripts/postfixadmin-cli.php:
- honor $CONF['language_hook']
- add TODO - language shouldn't be hardcoded to english

This implements my feature request at
http://sourceforge.net/tracker/?func=detail&aid=3292408&group_id=191583&atid=937967


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1176 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz d01bf7d0c4 scripts/shells/alias.php:
- fixed help() output


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1144 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz e61bffe776 scripts/shells/domain.php:
- add handling of domain-level quotas


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1045 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz a6cc2a2947 Changed delete.php to use flash_error(), removed some HTML from languages/*
delete.php: 
- replace various $tMessage=... with flash_error()
- always redirect to the relevant page, even if an error happened
- fix error check in delete admin
- removed HTML formatting (<b>, <span>) from some error messages
- replaced check for pgsql + BEGIN/COMMIT/ROLLBACK with db_begin(),
  db_commit() and db_rollback()
- the smarty message.tpl is most probably superfluous

languages/*.lang:
- removed HTML (<span>) from messages used by delete.php

fetchmail.php, scripts/snippets/baseclass.php
- remove superfluous </span>


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1036 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 8f174d430a postfixadmin-cli: use readlink if $0 is a symlink
- use readlink if $0 is a symlink (for example in /usr/bin) so that
  postfixadmin-cli.php can be found
  Reported by john doe (johndoe64@SF),
  https://sourceforge.net/tracker/?func=detail&aid=3232183&group_id=191583&atid=937964
- add quoting to all variables


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1023 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz b89b94cf83 Renamed UserHandler to MailboxHandler to make clear it's about mailboxes
(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
13 years ago
Christian Boltz 8560012db8 For reference: the baseclass I was talking about in my previous commit
+ implementation of fetchmail with this class.

Note that those files were last edited on Aug 14 2008, so they probably
contain some outdated stuff ;-)  Nevertheless the baseclass implementation
and the comments it contains are still useful IMHO.

Feedback welcome ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@979 a1433add-5e2c-0410-b055-b7f2511e0802
13 years ago
Christian Boltz 51262b7675 DomainHander: on the way to a common interface for all classes and
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
13 years ago
Christian Boltz ba8fc89347 Preparation for removing the $username parameter from db_log()
(will be detected by authentication_get_username() instead)

scripts/postfixadmin-cli.php:
- define ("POSTFIXADMIN_CLI", 1) (we have no session running and need a
  way to tell authentication_get_username() that this is a CLI access)

functions.inc.php:
- authentication_get_username(): check for POSTFIXADMIN_CLI constant,
  return 'CLI' if set
  (hmmm, do we need a similar thing for XMLRPC?)
- db_log(): override $username parameter with authentication_get_username()
  (removing it from function parameters will be my next big commit)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@965 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz 2668f5a6c3 shells/domain.php: delete handling, adopted parameter changes
- adopted to changed parameters in DomainHander class
- implemented delete handling


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@960 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Sebastian d3e68fdc8a two small bugfixes:
- syntax error
- fix commentation marks

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@944 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Valkum f73c7cbad2 added some things to model class
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
14 years ago
Christian Boltz 9aa96dabd0 (mostly) make CLI "alias delete" working
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
14 years ago
Valkum 20e14ad664 Fixed CRYPT
added CRAM-MD5


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@929 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Valkum 3c7d04e92a Own Crypt Library. Independence of dovecotpw/doveadm pw
added some structure and tried to impelement CRYPT.

Dovecots Version is here (crypt_generate() ) http://hg.dovecot.org/dovecot-1.2/file/84373d238073/src/auth/password-scheme.c

Can someone help me with creating the lib?



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@928 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz f3450acd0a shells/alias.php:
- fixed wrong variable name for user input


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@927 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz fe2d4ba129 moved scripts/models-ext/* to model/
- 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
14 years ago
Valkum 3004a6cafc added some snippets for new model layout. with new database framework
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@921 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Valkum c6771f7f04 some todos done or partially done
-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
14 years ago
Valkum 320a9331f1 added unix return code in user add. please check it!
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@919 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Valkum 02868eb680 Added some TODOs and MARKs
Some lines in the shells are duplicate



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@917 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz da3ef2e1c0 shells/alias.php:
- 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
14 years ago
Christian Boltz f963cc33f1 scripts/shells/user.php:
- 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
14 years ago
Christian Boltz 36bdb2fbd0 postfixadmin-cli:
- don't clear the screen at startup


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@906 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz c6425f695d UserHandler.php, DomainHandler.php
- 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
14 years ago
Christian Boltz fb6ed610fa UserHandler.php:
- add some FIXME and TODO notes

UserHandler.php, AliasHandler.php:
- whitespace fixes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@888 a1433add-5e2c-0410-b055-b7f2511e0802
14 years ago
Christian Boltz 4c912f1da8 list-virtual.php:
- 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
14 years ago