Dropping the -webroot parameter (which basically means hardcoding that
../common.php has to exist) allows to do quite some cleanup.
Also unconditionally require_once('../common.php') to ensure that
everything we expect in the global namespace (like the 'Conf' class) is
there.
This allows even more cleanup. We get rid of __bootstrap() and some
constants, and can simplify parameter handling.
- add check_db_version() to functions.inc.php
- add $min_db_version (needs to be updated at least before the release)
- call check_db_version in login.php, users/login.php and CLI - they'll
error out if the database layout is outdated
- change setup.php to use check_db_version()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1853 a1433add-5e2c-0410-b055-b7f2511e0802
- displays the database scheme (for usage in upgrade.php)
PFAHandler:
- add "Scheme" to the list of available tasks
postfixadmin-cli.php:
- add "scheme" to help
This is the first patch of a series sponsored by
Bund der Deutschen Landjugend (german rural youth)
http://bdl.landjugend.info/
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1710 a1433add-5e2c-0410-b055-b7f2511e0802
- replace usage of Inflector::camelize() with ucfirst() - for our usage,
it gives the same result with easier understandable code
- remove unused PHP5 define
shells/shell.php:
- remove definition of unused variable $shellKey, which also removes
the last usage of Inflector::underscore
- remove code that was commented out since a while
scripts/inflector.php:
- delete file, no longer needed
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1577 a1433add-5e2c-0410-b055-b7f2511e0802
model/CliHelp.php:
- new class, used for "postfixadmin-cli $module help"
- replaces the PostfixAdmin* classes in scripts/shells/*.php
model/PFAHandler.php
- add public $taskNames with the list of supported CLI commands
scripts/postfixadmin-cli.php - dispatch():
- directly set the classes to load instead of using shell->loadTasks()
- when "postfixadmin-cli $module" is called, display help instead of
error message about "invalid command ''"
- make it more readable by moving error checks to the beginning
(replaces deeply nested if's with return statements)
- remove unused code parts
scripts/shells/*.php:
- remove PostfixAdmin* classes (obsoleted by CliHelp)
- remove $tasks (now in PFAHandler)
- delete alias.php and domain.php because nothing is left
- mailbox.php still contains PasswordTask
scripts/shells/shell.php:
- remove $taskNames (moved to PFAHandler)
- remove loadTasks() (integrated in postfixadmin-cli.php's dispatch())
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1575 a1433add-5e2c-0410-b055-b7f2511e0802
- new file for CLI 'view'
- based on the ViewTask classes in scripts/shells/*.php
- introduces usage of *Handler->_formatted_$field() to get "pretty"
output for a field
(not sure if this is the final solution, but it works ;-)
scripts/shells/*.php
- remove ViewTask, obsoleted by model/CliView.php
scripts/shells/shell.php:
- use CliView instead of ViewTask
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1572 a1433add-5e2c-0410-b055-b7f2511e0802
- new file, handles deleting something with the CLI
(based on DeleteTask in scripts/shells/*.php)
scripts/shells/*.php
- remove DeleteTask, obsoleted by model/CliDelete.php
scripts/shells/shell.php:
- use CliDelete instead of DeleteTask
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1570 a1433add-5e2c-0410-b055-b7f2511e0802
- pacrypt(), dovecot:* method:
- allow "." in dovecot method (to allow a suffix like ".b64")
- blacklist SCRAM-SHA-1 (needs -u)
- check against list of non-salted methods to be backward compatible
with dovecot < 2.1 again
Thanks to Szilagyi Jozsef <szjozsef AT yahoo DOT com> for providing
the list of non-salted methods etc.
functions.inc.php, scripts/postfixadmin-cli.php:
- drop unused global variables $table_admin and $table_alias_domain
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1529 a1433add-5e2c-0410-b055-b7f2511e0802
- marked camelize(), underscore() and variable() as public static
function to avoid PHP warnings with latest PHP (5.4.x)
- removed unused methods humanize(), tableize(), classify() and slug()
- removed unused function __enclose()
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1457 a1433add-5e2c-0410-b055-b7f2511e0802
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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 __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
- 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