0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-20 03:36:20 +02:00
Commit Graph

20 Commits

Author SHA1 Message Date
Christian Boltz
95bf0161c6 Make create-domain.php even shorter (109 -> 89 lines) ;-)
create-domain.php
- replace old $form_fields with $handler->getStruct()
- rewrite handling POST data to make it easier to understand
  - move reading POST input to the section handling POST
  - remove condition on POST (we are in the POST block now)
  - check if editing of a field is allowed (use default value if not)
- move validation of 'enum' fields to PFAHandler
- allow changing the "active" state (instead of hardcoding it)

model/PFAHandler.php:
- add check for 'enum' fields

model/DomainHandler.php:
- change default for "active" and "default_aliases" to 1

templates/admin_edit-domain.tpl:
- don't hide the "Active" checkbox on new


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1220 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-18 22:56:33 +00:00
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
2011-10-18 22:11:22 +00:00
Christian Boltz
1aeae661af DomainHandler.php:
- new: public function getStruct()
- make store() public explicitely
- store domain_postcreation error message in $this->errormsg
- use existing error message instead of "invalid domain"



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1216 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-17 23:44:40 +00:00
Christian Boltz
78d15b084d DomainHandler.php:
- split add() function to 
  - set() (validate values) and 
  - store() (write to database)
- set():
  - replace $checked with $this->values
  - store validation summary in $this->values_valid

PFAHandler.php:
- change _inp_* functions to return true/false if value is (in)valid
  instead if the sanitized value. They now also set $this->errormsg[]
  (not the final solution, but works for now)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1210 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 23:37:11 +00:00
Christian Boltz
8ed7747a81 DomainHandler.php:
- view(): 
  - auto-generate field list based on $this->struct
  - use date_format() for timestamp fields in the sql query
  - convert bool fields to integer 0/1 (postgresql uses t/f internally)
    to make the result database independent
- enable "display in list" for "created" column to avoid error in 
  CLI view domain


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1209 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 22:32:22 +00:00
Christian Boltz
bf2d5e0f4b DomainHandler.php:
- validate $username (domain name in this case) in __construct
  (using the new function validate_id)
- make initStruct protected (was private)
- additional parameter for view() to supress error messages



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1207 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 21:41:27 +00:00
Christian Boltz
14c5433faf DomainHandler:
- use ' instead of " for $struct keys
- whitespace changes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1204 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 19:33:31 +00:00
Christian Boltz
1e601ce4d4 DomainHandler.php:
various fixes, implemented some TODOs

- move table name into variable $this->db_table
- use correct config option to detect if quota support is enabled
- fix (virtual) column name for default aliases
- use type 'ts' (timestamp) for created and modified
- fill non-editable rows with defaults if $this->new
- read values from $values instead of safepost()
- unset $db_values['default_aliases'] before writing to database
- some other minor changes


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1203 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-16 18:50:33 +00:00
Christian Boltz
d09ae9e360 model/DomainHandler.php:
- 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
2011-07-29 22:06:52 +00:00
Christian Boltz
9f94438a78 model/DomainHandler.php:
- replace $domain with $this->username in add()
- comment cleanup


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1047 a1433add-5e2c-0410-b055-b7f2511e0802
2011-04-19 22:08:20 +00:00
Christian Boltz
19bf885fa9 model/DomainHandler.php:
- allow editing and viewing of "quota" (domain-level quota) field.
  Otherwise the CLI can't set it ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1044 a1433add-5e2c-0410-b055-b7f2511e0802
2011-04-19 20:32:45 +00:00
Christian Boltz
562f1ac5b8 model/DomainHandler.php:
- get default domain quota from $CONF
- remove unused from "quota" field - it's used now ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1043 a1433add-5e2c-0410-b055-b7f2511e0802
2011-04-19 20:24:09 +00:00
Christian Boltz
721ee60e8d DomainHandler.php:
- convert domain name to lowercase

This is a follow-up to
https://sourceforge.net/tracker/?func=detail&atid=937964&aid=3287965&group_id=191583


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1038 a1433add-5e2c-0410-b055-b7f2511e0802
2011-04-17 16:31:09 +00:00
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
2011-03-02 22:37:22 +00:00
Christian Boltz
6225e555f4 model/AliasHandler.php:
- fix comment for delete() - it no longer has a param

model/*:
- add svn $Id line


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@975 a1433add-5e2c-0410-b055-b7f2511e0802
2011-02-27 23:21:54 +00:00
Christian Boltz
c97e5224dc Remove $username parameter from db_log()
functions.inc.php:
- remove $username parameter from function db_log()
  (now auto-detected with authentication_get_username())

various files:
- remove hardcoded username ('CONSOLE', $username etc.) in db_log() calls


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@966 a1433add-5e2c-0410-b055-b7f2511e0802
2011-02-15 22:20:27 +00:00
Christian Boltz
1de551320b DomainHandler.php:
- 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
2011-02-13 23:35:49 +00:00
Christian Boltz
562842f154 DomainHandler.php:
- return true/false instead of shell-style 0/1


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@959 a1433add-5e2c-0410-b055-b7f2511e0802
2011-02-13 23:15:40 +00:00
Christian Boltz
d21bf2e82d DomainHandler.php: proofreading results: various small changes
- 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
2011-02-13 23:01:44 +00:00
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
2010-12-30 22:34:59 +00:00