- initStruct():
- don't display domain_quota if $CONF[quota] == NO or $CONF[domain_quota] is NO
- drop 'total_quota' column which seems to be unused (and had a non-existing label)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1755 a1433add-5e2c-0410-b055-b7f2511e0802
- add $msg['confirm'] (confirmation message when attemping to delete an
item, displayed by list.php)
*.lang:
- add various confirm_delete_* texts needed by *Handler
- rename confirm_domain to confirm_delete_domain
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1749 a1433add-5e2c-0410-b055-b7f2511e0802
- initStruct():
- add optical quota indicators for aliases, mailboxes, domain quota
- some adjustments to get nice output with list.php (mostly following
list-domain.php)
- webformConfig(): switch listview to list.php
configs/menu.conf, templates/adminlistadmin.tpl:
- switch list-domain.php to list.php?table=domain
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1745 a1433add-5e2c-0410-b055-b7f2511e0802
- initStruct:
- set column write permissions depending on superadmin status
- add _can_edit and _can_delete (also depending on superadmin status)
- webformConfig(): reduce required permissions to 'admin'
- add beforestore() - aborts writing for non-superadmins
- delete: allow deletion only for superadmins
*.lang:
- new text 'no_delete_permissions'
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1718 a1433add-5e2c-0410-b055-b7f2511e0802
- add note that $CONF[vacation_domain] can't be used for "normal" mails
model/DomainHandler.php:
- validate_new_id():
- error out when trying to add $CONF[vacation_domain]
- some whitespace fixes
- remove superfluous comment on initStruct()
*.lang:
- add 'domain_conflict_vacation_domain' error message
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1694 a1433add-5e2c-0410-b055-b7f2511e0802
- move mailbox_postdeletion() to MailboxHandler
- move domain_postcreation() and domain_postdeletion() to
DomainHandler
- adopt those functions for usage inside the *Handler (replace
print with $this->errormsg etc.)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1579 a1433add-5e2c-0410-b055-b7f2511e0802
- add some _formatted_*() functions to get a more informative output
(currently only used in CLI)
MailboxHandler.php:
- add TODO for reading used quota from quota/quota2 table and adding
a formatted_quota() function
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1573 a1433add-5e2c-0410-b055-b7f2511e0802
- delete(): check if the domain is an alias domain target - if yes, do
not allow to delete it
- better error message if domain_postdeletion() fails
*.lang:
- rename pAdminDelete_domain_error to domain_postdel_failed and change
the text
- add delete_domain_aliasdomain_target
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1567 a1433add-5e2c-0410-b055-b7f2511e0802
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
- add intbool() - similar to bool(), but returns 1/0 instead of true/false
DomainHandler.php
- initStruct(): use Config::intbool() instead of boolconf()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1473 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
- make PFAHandler an "abstract class"
- add functions that must be implemented by every *Handler class
as abstract functions:
- abstract protected function initStruct();
- abstract protected function initMsg();
- abstract public function webformConfig();
- abstract protected function validate_new_id();
- lots of additional comments
AdminHandler, AliasdomainHandler, DomainHandler, MailboxHandler:
- remove comments that are now in PFAHandler
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1385 a1433add-5e2c-0410-b055-b7f2511e0802
- set $domain_field to enable domain permission handling
list-domain.php:
- use permission handling of DomainHandler. This means:
- no need to call list_domains_for_admin()
- no longer hand over SQL sniplets
- much easier handling for superadmins and "simulate admin" mode
- 14 lines less code for permission handling etc.
- remove superfluous/outdated header comments
- move $smarty_assign('select_options') to global section (it's the
same code for domain admins and superadmins)
Note: don't try to read the diff of list-domain.php.
Read the complete file instead ;-)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1267 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
- 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
- move definition of public and protected variables to DomainHandler.php
- move lots of functions from DomainHandler.php to PFAHandler.php:
- __construct()
- init()
- set()
- store()
- read_from_db()
- view()
- getList()
- getStruct()
- getId_field()
All functions and comments were moved without any modification.
See the history of DomainHandler.php if you need to find out something
about the history of the functions listed above.
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1254 a1433add-5e2c-0410-b055-b7f2511e0802
- new file
- generic edit form template that uses $struct to render the form
templates/admin_edit-domain.tpl:
- deleted, obsoleted by editform.tpl
create-domain.php
- use new editform.tpl
- use $errormsg array instead of join't $errortext
- store/move errors related to a display_in_form field in $fielderror
(they will be displayed next to the field)
- display remaining error messages (not related to a field) with
flash_error()
- use "value_$key" instead of "t$Key" as smarty variable name for field
values
model/DomainHandler.php
- store error messages in $this->errormsg[$field] (instead of $this->errormsg[])
- fix label for default_aliases
model/PFAHandler.php:
- store error messages in $this->errormsg[$field] (instead of $this->errormsg[])
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1252 a1433add-5e2c-0410-b055-b7f2511e0802
- initStruct(): fix alias_count ("something - NULL" is always NULL, now
enforces integer 0 for each JOINt in field with NULL value)
- set() now checks if $this->_field_$fieldname exists and calls it as
additional validator
- split store() into store() (stores $this->values in the database) and
storemore() (stores additional things and/or calls scripts)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1249 a1433add-5e2c-0410-b055-b7f2511e0802
- pacol(): new parameter $dont_write_to_db - needed to skip JOINt in
columns which (of course) aren't available on INSERT or UPDATE
model/DomainHandler.php:
- initStruct(): mark JOINt in columns with the dont_write_to_db flag
- store(): skip columns with the dont_write_to_db flag set (not_in_db
columns are also/still skipped)
In non-technical terms: create-domain works now :-)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1244 a1433add-5e2c-0410-b055-b7f2511e0802
- read_from_db(): provide a working $colformat['ts'] for postgresql
_and_ mysql (the only mysql/pgsql-specific code in DomainHandler,
everything else works with both)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1242 a1433add-5e2c-0410-b055-b7f2511e0802
- assign smarty values only for fields that have the display_in_form flag
model/DomainHandler.php:
- initStruct(): make default_aliases display_in_form dependant on $this->new
(it's useless in edit mode)
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1235 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
- split view() into
- read_from_db (with param $condition, can also be used with other
conditions than "domain = $this->username")
- view() - fetches one row
(as preparation before implementing a function to list all domains)
- read_from_db():
- replace $bool_fields with $colformat['bool'] - now the database
results for bool fields are always 0/1 (by using CASE in the query),
and have an additional _$field with yes/no
- resultset is now an array of rows (instead of a single row)
- use db_assoc() instead of db_array()
- view(): use read_from_db()
- store(): change a comment that confused vim autofolding
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1229 a1433add-5e2c-0410-b055-b7f2511e0802
- new function db_where_clause($condition, $struct) to create a WHERE clause.
bool values are converted with db_get_boolean() based on $struct
model/DomainHandler.php - view():
- build WHERE clause with db_where_clause()
- new array $colformat for columns which need special handling in the field list
(that's more readable than tons of elseif on the long term, and allows easier
customization (hook/$CONF value?))
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1228 a1433add-5e2c-0410-b055-b7f2511e0802
- store() can now handle INSERT and UPDATE (depending on $this->new) :-)
- store some texts in $this->msg[] (replaced several $this->variable)
to make functions easier reuseable
- new function initMsg to fill $this->msg[] (can depend on $this->new)
- convert values to a DB-understandable format in store(), not in set()
(affects only bool for now, another candidate is pacrypt()ing passwords)
- check if all fields are set (on new)
- unset all not_in_db fields in $db_values in foreach loop
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1223 a1433add-5e2c-0410-b055-b7f2511e0802
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
- 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
- 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
- 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
- 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
- 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
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