Commit Graph

96 Commits (master)

Author SHA1 Message Date
Christian Boltz ad4142134a
merge __parseParams() into parseParams() 4 years ago
Christian Boltz 9833a8f289
whitespace fix in __parseParams() 4 years ago
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.
4 years ago
David Goodwin 2742849e7b reformat 5 years ago
David Goodwin 34e6f7829e tighten psalm checks; fix errors 5 years ago
David Goodwin 034a50836c tighten psalm checks 5 years ago
David Goodwin f7c7e35b34 fix formatting 5 years ago
David Goodwin 17a50c51f1 drop some dies; use Exception and catch after dispatch() - see #197 5 years ago
David Goodwin 2ff05bc737 typo 5 years ago
David Goodwin 9cd7dac187 initial attempt at trying to return an exit value within the cli 5 years ago
Lars Liedtke 0c94760828
Update postfixadmin-cli
Make this script platform independent to be usable under e.g. FreeBSD, where bash is located in /usr/local/bin/bash and thus the script fails.
5 years ago
David Goodwin 4fcdba9cf4 run php-cs-fixer (code reforamt) 5 years ago
David Goodwin 029c4ffe47 psalm fixes 5 years ago
David Goodwin 6d328795cb remove windows code; remove array_merge (seems to just break parsing) 6 years ago
David Goodwin aa38d0090d token fixes; code looks incomplete anyway 6 years ago
David Goodwin 97c48a0fc9 fix phpdoc 6 years ago
David Goodwin b48f99d4c6 reformat (phpcs) 6 years ago
Christian Boltz c7201afa6c
drop unused shells/mailbox.php 6 years ago
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!)
6 years ago
Christian Boltz 71d61a1d8a
drop superfluous Config::read('all') call 6 years ago
Christian Boltz 48a3709041
postfixadmin-cli: get rid of empty/unused initialize() 6 years ago
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 ;-)
6 years ago
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.
6 years ago
David Goodwin 2f7d3d9534 remove (possibly) unnecessary Config::read(all) calls ... see #144 6 years ago
Adrien Crivelli 15df6c1d7b
Reformat everything with PHP-Cs-Fixer 6 years ago
David Goodwin 252d42dcc0 fix perms (executable) 7 years ago
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
8 years ago
Christian Boltz 694d13f6db delete suprefluous whitespace
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1843 a1433add-5e2c-0410-b055-b7f2511e0802
8 years ago
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
8 years ago
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
8 years ago
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
9 years ago
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
10 years ago
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
10 years ago
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
11 years ago
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
11 years ago
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
11 years ago
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
11 years ago
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
11 years ago
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
11 years ago
Christian Boltz 04cd5c5aa4 model/CliView.php:
- 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
11 years ago
Christian Boltz 0a71a236c2 model/CliDelete.php
- 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
11 years ago
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
11 years ago
Christian Boltz 4fb4ee264a delete some outdated and no longer needed files in snippets/ :
- snippets/baseclass.php
- snippets/fetchmail-class.php
- snippets/fetchmail-remaining.php
- snippets/model.php
- snippets/user_controller.php
- snippets/user_model.php


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1545 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz bb7a3ff04d model/*Handler.php and various other files
- rename $this->return to $this->result


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1534 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz ba7ebe7adb scripts/shells/shell.php:
- disable some unused code


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1531 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
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
11 years ago
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
11 years ago
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
11 years ago
Christian Boltz 85fb572db7 scripts/shells/alias.php, mailbox.php, domain.php:
- various fixes to make deleting aliases / mailboxes / domains work


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1458 a1433add-5e2c-0410-b055-b7f2511e0802
11 years ago
Christian Boltz 7862cca6a2 scripts/inflector.php
- 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
11 years ago