0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00
Commit Graph

47 Commits

Author SHA1 Message Date
David Goodwin
f01274ec94
try relaxing composer dependencies to allow php8.2 dev support, reformat so composer format passes 2024-04-22 21:02:01 +01:00
David Goodwin
2d6ded2786 PSR2 -> PSR12 formatting 2022-06-28 13:46:11 +01:00
David Goodwin
2edabc3e03 phpcs insists on some brace changes 2021-04-13 21:19:16 +01:00
David Goodwin
823f27b29d phpcs wants to change ... 2021-03-22 09:28:28 +00:00
David Goodwin
ddafed6f4d fix php8 moaning about { } on strings 2021-01-18 20:46:25 +00:00
David Goodwin
d49de35189 improve docs 2020-06-23 21:14:29 +01:00
Christian Boltz
ad4142134a
merge __parseParams() into parseParams() 2020-05-02 01:30:25 +02:00
Christian Boltz
9833a8f289
whitespace fix in __parseParams() 2020-05-02 01:26:35 +02:00
Christian Boltz
4e9e3db75d
Fix parameter parsing for '-1'
'--quota -1' gets parsed as two options ("quota" and "1"), but it's
meant to be "quota => -1".

Make sure '-1' is considered as a value, not as an option.

Also get rid of unset()'ing $params[$i] and (now?) superfluous recursive
calls to __parseParams() to make the code less confusing.
2020-05-02 01:24:08 +02:00
David Goodwin
34e6f7829e tighten psalm checks; fix errors 2019-09-17 20:55:14 +01:00
David Goodwin
f7c7e35b34 fix formatting 2019-09-15 11:42:21 +01:00
David Goodwin
17a50c51f1 drop some dies; use Exception and catch after dispatch() - see #197 2019-09-14 21:01:09 +01:00
David Goodwin
2ff05bc737 typo 2019-09-14 20:17:16 +01:00
David Goodwin
9cd7dac187 initial attempt at trying to return an exit value within the cli 2019-09-14 20:09:56 +01:00
David Goodwin
029c4ffe47 psalm fixes 2018-12-27 13:55:41 +00:00
David Goodwin
6d328795cb remove windows code; remove array_merge (seems to just break parsing) 2018-07-02 21:54:49 +01:00
David Goodwin
97c48a0fc9 fix phpdoc 2018-06-18 21:35:20 +01:00
David Goodwin
b48f99d4c6 reformat (phpcs) 2018-05-02 12:54:17 +01:00
Christian Boltz
12c4a4f29e
move shells/shell.php to model/Shell.php
... and drop a few lines in postfixadmin-cli.php that became superfluous
by this move (thanks autoloader!)
2018-03-25 21:44:42 +02:00
Christian Boltz
48a3709041
postfixadmin-cli: get rid of empty/unused initialize() 2018-03-25 21:34:26 +02:00
Christian Boltz
36fe1f6ccc
remove deleted functions from $protectedCommands
If grep -r doesn't find a function, we don't need to keep it in
$protectedCommands ;-)
2018-03-25 21:23:52 +02:00
Christian Boltz
5e93dfe604
postfixadmin-cli: drop (undocumented) -webroot etc.
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.
2018-03-25 21:15:45 +02:00
David Goodwin
2f7d3d9534 remove (possibly) unnecessary Config::read(all) calls ... see #144 2018-02-27 21:16:54 +00:00
Adrien Crivelli
15df6c1d7b
Reformat everything with PHP-Cs-Fixer 2018-01-26 23:54:37 +09:00
Christian Boltz
13cdd50d0a Add checks to login.php and cli to ensure database layout is up to date
- 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
2016-05-22 19:58:54 +00:00
Christian Boltz
694d13f6db delete suprefluous whitespace
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1843 a1433add-5e2c-0410-b055-b7f2511e0802
2016-05-20 20:58:13 +00:00
David Goodwin
54603b0968 reforamt cli commands; update code to php v5 syntax; remove regexp and use filter_var for email validation; use private/protected/public
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1840 a1433add-5e2c-0410-b055-b7f2511e0802
2016-05-20 19:55:55 +00:00
Christian Boltz
5dac4295a4 postfixadmin-cli.php:
- whitelist '-1' as valid value instead of misinterpreting it as option
  https://sourceforge.net/p/postfixadmin/bugs/369/
- don't remove quote chars (") from parameter values


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1837 a1433add-5e2c-0410-b055-b7f2511e0802
2016-05-15 20:04:21 +00:00
Christian Boltz
3640a1b804 postfixadmin-cli.php:
- add fetchmail to module list


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1784 a1433add-5e2c-0410-b055-b7f2511e0802
2015-04-26 18:01:54 +00:00
Christian Boltz
d9e30fb41b Add CliScheme.php:
- 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
2014-11-01 18:08:11 +00:00
Christian Boltz
da14ddf6d7 postfixadmin-cli.php:
- __parse_params(): only check for first character if $params[$i]
  is not empty (avoids PHP warning)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1660 a1433add-5e2c-0410-b055-b7f2511e0802
2014-04-27 13:34:03 +00:00
Christian Boltz
252ae047d5 various files:
- get rid of global $table_* variables, use table_by_key() instead



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1601 a1433add-5e2c-0410-b055-b7f2511e0802
2013-12-08 19:41:01 +00:00
Christian Boltz
a9e0638d82 postfixadmin-cli.php:
- update help()
- comment out commands() - it's outdated and now unused


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1599 a1433add-5e2c-0410-b055-b7f2511e0802
2013-12-08 16:32:14 +00:00
Christian Boltz
9decae80e9 some CLI cleanup
postfixadmin-cli.php:
- better error message for unknown modules or tasks
- remove unused variables
- __bootstrap(): require_once() common.php is enough
  (and inflector.php no longer exists)

shells/shell.php:
- remove unused variables
- no longer print the path in _welcome()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1578 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-14 21:48:52 +00:00
Christian Boltz
72f0818391 scripts/postfixadmin-cli.php
- 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
2013-11-14 21:15:55 +00:00
Christian Boltz
84b160bd8e scripts/postfixadmin-cli.php:
- add myself to copyright header
- whitespace changes in dispatch()



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1576 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-13 19:17:05 +00:00
Christian Boltz
c65e3293b6 Quite big CLI cleanup (and more)
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
2013-11-13 19:07:12 +00:00
Christian Boltz
4785426269 scripts/inflector.php:
- remove unused function variable()

scripts/postfixadmin-cli.php, scripts/shells/shell.php:
- replace user-visible "cake" with "postfixadmin-cli"

scripts/shells/mailbox.php:
- fix/update help text



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1546 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-19 20:48:00 +00:00
Christian Boltz
f444de402b functions.inc.php:
- 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
2013-10-07 18:42:59 +00:00
Christian Boltz
1c27ab9074 postfixadmin-cli.php:
- __initConstants(): substr() is a bad idea to find the parent 
  directory. Use dirname() instead.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1527 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-06 21:00:29 +00:00
Christian Boltz
41a2b72e6d postfixadmin-cli.php
- remove function PostfixAdmin - __construct() is enough ;-)
  and having both caused a redefinition warning


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1526 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-06 20:22:12 +00:00
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
2011-10-17 23:37:52 +00:00
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
2011-10-17 23:19:57 +00:00
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
2011-08-23 21:23:16 +00:00
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
2011-03-28 23:15:11 +00:00
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
2011-02-15 21:59:03 +00:00
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
2010-09-26 23:14:42 +00:00