diff --git a/ADDITIONS/squirrelmail-plugin/common.php b/ADDITIONS/squirrelmail-plugin/common.php
index 9774a3d6..0834d98d 100644
--- a/ADDITIONS/squirrelmail-plugin/common.php
+++ b/ADDITIONS/squirrelmail-plugin/common.php
@@ -1,4 +1,5 @@
remove();
diff --git a/ADDITIONS/squirrelmail-plugin/setup.php b/ADDITIONS/squirrelmail-plugin/setup.php
index 95abdb62..a4313d05 100644
--- a/ADDITIONS/squirrelmail-plugin/setup.php
+++ b/ADDITIONS/squirrelmail-plugin/setup.php
@@ -1,4 +1,5 @@
diff --git a/model/AdminHandler.php b/model/AdminHandler.php
index 9a35294f..da2dd125 100644
--- a/model/AdminHandler.php
+++ b/model/AdminHandler.php
@@ -1,4 +1,5 @@
store() after storing $this->values in the database
* can be used to update additional tables, call scripts etc.
*/
- protected function postSave() : bool {
+ protected function postSave(): bool {
# store list of allowed domains in the domain_admins table
if (isset($this->values['domains'])) {
if (is_array($this->values['domains'])) {
diff --git a/model/AdminpasswordHandler.php b/model/AdminpasswordHandler.php
index 96e92d1b..f09ca81b 100644
--- a/model/AdminpasswordHandler.php
+++ b/model/AdminpasswordHandler.php
@@ -1,4 +1,5 @@
admin_username == '') {
die("No admin logged in");
diff --git a/model/AliasHandler.php b/model/AliasHandler.php
index d1f69111..31eeab5f 100644
--- a/model/AliasHandler.php
+++ b/model/AliasHandler.php
@@ -1,4 +1,5 @@
result filled
# (only validate_new_id() is called from parent::init and could in theory change $this->result)
@@ -191,7 +192,7 @@ class AliasHandler extends PFAHandler {
$this->errormsg[$this->id_field] = Config::lang('pCreate_alias_address_text_error3');
return false;
}
-
+
# TODO: already checked in set() - does it make sense to check it here also? Only advantage: it's an early check
# if (!in_array($domain, $this->allowed_domains)) {
# $this->errormsg[] = Config::lang('pCreate_alias_address_text_error1');
@@ -303,7 +304,7 @@ class AliasHandler extends PFAHandler {
$this->values['goto'] = join(',', $values['goto']);
}
- protected function postSave() : bool {
+ protected function postSave(): bool {
# TODO: if alias belongs to a mailbox, update mailbox active status
return true;
}
@@ -357,7 +358,7 @@ class AliasHandler extends PFAHandler {
return array($condition, $searchmode);
}
- public function getList($condition, $searchmode = array(), $limit=-1, $offset=-1) : bool {
+ public function getList($condition, $searchmode = array(), $limit=-1, $offset=-1): bool {
list($condition, $searchmode) = $this->condition_ignore_mailboxes($condition, $searchmode);
$this->set_is_mailbox_extrafrom($condition, $searchmode);
$result = parent::getList($condition, $searchmode, $limit, $offset);
@@ -452,7 +453,7 @@ class AliasHandler extends PFAHandler {
$vacation_goto = str_replace('@', '#', $this->id);
return $vacation_goto . '@' . Config::read_string('vacation_domain');
}
-
+
/**
* @return boolean
*/
diff --git a/model/AliasdomainHandler.php b/model/AliasdomainHandler.php
index 50c4c321..ec0bd6cf 100644
--- a/model/AliasdomainHandler.php
+++ b/model/AliasdomainHandler.php
@@ -1,4 +1,5 @@
struct['alias_domain']['options']) == 0 && $this->new) {
diff --git a/model/CliDelete.php b/model/CliDelete.php
index f032f3aa..6fa93a46 100644
--- a/model/CliDelete.php
+++ b/model/CliDelete.php
@@ -1,11 +1,11 @@
handler_to_use;
+ $handler = new $this->handler_to_use();
# TODO: adjust help text according to $handler->taskNames
$module = preg_replace('/Handler$/', '', $this->handler_to_use);
@@ -35,7 +36,7 @@ class CliHelp extends Shell {
View $module
in non-interactive mode.
"); */
-
+
$head = "Usage: postfixadmin-cli $module [] [--option value] [--option value]\n";
diff --git a/model/CliScheme.php b/model/CliScheme.php
index 878ddeed..7d309f42 100644
--- a/model/CliScheme.php
+++ b/model/CliScheme.php
@@ -1,4 +1,5 @@
out(" PRIMARY KEY (" . $handler->getId_field() . ")");
$this->out(' ) {MYISAM} ');
$this->out('");');
-
+
$this->out('');
$this->hr();
$this->out('For adding fields with upgrade.php:');
diff --git a/model/CliView.php b/model/CliView.php
index a3aa3135..1f62aea5 100644
--- a/model/CliView.php
+++ b/model/CliView.php
@@ -1,11 +1,11 @@
getAll();
return array_key_exists($var, $x);
}
@@ -63,7 +64,7 @@ final class Config {
* @param string $var
* @return string
*/
- public static function read_string(string $var) : string {
+ public static function read_string(string $var): string {
$stuff = self::read($var);
if ($stuff === null) {
@@ -110,7 +111,7 @@ final class Config {
* @param string $value Value to use as sprintf parameter
* @return string value of Config::$var, parsed by sprintf
*/
- public static function read_f(string $var, string $value) : string {
+ public static function read_f(string $var, string $value): string {
$text = self::read_string($var);
$newtext = sprintf($text, $value);
@@ -133,7 +134,7 @@ final class Config {
* @param string $var Variable to obtain
* @return bool value of Configure::$var (TRUE (on YES/yes) or FALSE (on NO/no/not set/unknown value)
*/
- public static function bool(string $var) : bool {
+ public static function bool(string $var): bool {
$value = self::read($var);
if (is_bool($value)) {
@@ -164,7 +165,7 @@ final class Config {
* Used to read Config::$var, converted to bool, returned as integer (0 or 1)
* @see bool()
*/
- public static function intbool($var) : int {
+ public static function intbool($var): int {
return Config::bool($var) ? 1 : 0;
}
@@ -177,7 +178,7 @@ final class Config {
* @return string value of $PALANG[$var]
* @access public
*/
- public static function lang(string $var) : string {
+ public static function lang(string $var): string {
$languages = self::read_array('__LANG');
$value = $languages[$var] ?? '';
@@ -197,7 +198,7 @@ final class Config {
* @param string $value Value to use as sprintf parameter
* @return string value of $PALANG[$var], parsed by sprintf
*/
- public static function lang_f(string $var, $value) : string {
+ public static function lang_f(string $var, $value): string {
$all = self::read_array('__LANG');
$text = $all[$var] ?? '';
@@ -215,7 +216,7 @@ final class Config {
/**
* @return array
*/
- public function getAll() : array {
+ public function getAll(): array {
return $this->config;
}
diff --git a/model/DomainHandler.php b/model/DomainHandler.php
index 4bdc48ba..b420f9fe 100644
--- a/model/DomainHandler.php
+++ b/model/DomainHandler.php
@@ -1,4 +1,5 @@
is_superadmin) {
return true;
@@ -161,7 +162,7 @@ class DomainHandler extends PFAHandler {
* called by $this->store() after storing $this->values in the database
* can be used to update additional tables, call scripts etc.
*/
- protected function postSave() : bool {
+ protected function postSave(): bool {
if ($this->new && $this->values['default_aliases']) {
foreach (Config::read_array('default_aliases') as $address=>$goto) {
$address = $address . "@" . $this->id;
diff --git a/model/FetchmailHandler.php b/model/FetchmailHandler.php
index 163ecae9..a41b2b57 100644
--- a/model/FetchmailHandler.php
+++ b/model/FetchmailHandler.php
@@ -1,4 +1,5 @@
values['quota']) && $this->values['quota'] != -1 && is_numeric($this->values['quota'])) {
$multiplier = Config::read_string('quota_multiplier');
if ($multiplier == 0 || !is_numeric($multiplier)) { // or empty string, or null, or false...
@@ -292,7 +293,7 @@ class MailboxHandler extends PFAHandler {
return $ok && parent::set($values);
}
- protected function postSave() : bool {
+ protected function postSave(): bool {
if ($this->new) {
if (!$this->mailbox_post_script()) {
# return false; # TODO: should this be fatal?
diff --git a/model/PFAHandler.php b/model/PFAHandler.php
index 4a898a6f..2a4aa21b 100644
--- a/model/PFAHandler.php
+++ b/model/PFAHandler.php
@@ -1,6 +1,6 @@
errormsg
*/
- public function save() : bool {
+ public function save(): bool {
# backwards compability: save() was once (up to 3.2.x) named store(). If a child class still uses the old name, let it override save().
if (method_exists($this, 'store')) {
error_log('store() is deprecated, please rename it to save()');
@@ -608,7 +608,7 @@ abstract class PFAHandler {
* called by $this->save() before storing the values in the database
* @return bool - if false, save() will abort
*/
- protected function preSave() : bool {
+ protected function preSave(): bool {
# backwards compability: preSave() was once (up to 3.2.x) named beforestore(). If a child class still uses the old name, let it override preSave().
# Note: if a child class also has preSave(), it will override this function and obviously also the compability code.
if (method_exists($this, 'beforestore')) {
@@ -623,7 +623,7 @@ abstract class PFAHandler {
* called by $this->save() after storing $this->values in the database
* can be used to update additional tables, call scripts etc.
*/
- protected function postSave() : bool {
+ protected function postSave(): bool {
# backwards compability: postSave() was once (up to 3.2.x) named storemore(). If a child class still uses the old name, let it override postSave().
# Note: if a child class also has postSave(), it will override this function and obviously also the compability code.
if (method_exists($this, 'storemore')) {
@@ -755,7 +755,7 @@ abstract class PFAHandler {
* @param int $offset - number of first row to return
* @return array - rows (as associative array, with the ID as key)
*/
- protected function read_from_db($condition, $searchmode = array(), $limit=-1, $offset=-1) : array {
+ protected function read_from_db($condition, $searchmode = array(), $limit=-1, $offset=-1): array {
$queryparts = $this->build_select_query($condition, $searchmode);
$query = $queryparts['select_cols'] . $queryparts['from_where_order'];
@@ -820,7 +820,7 @@ abstract class PFAHandler {
* @return bool - always true, no need to check ;-) (if $result is not an array, getList die()s)
* The data is stored in $this->result (as array of rows, each row is an associative array of column => value)
*/
- public function getList($condition, $searchmode = array(), $limit=-1, $offset=-1) : bool {
+ public function getList($condition, $searchmode = array(), $limit=-1, $offset=-1): bool {
if (is_array($condition)) {
$real_condition = array();
foreach ($condition as $key => $value) {
diff --git a/model/VacationHandler.php b/model/VacationHandler.php
index 82a705ea..279fe780 100644
--- a/model/VacationHandler.php
+++ b/model/VacationHandler.php
@@ -1,8 +1,8 @@
display('index.tpl');
} else {
fwrite($fh, $header);
-
+
$tables = array(
'admin',
'alias',
diff --git a/public/common.php b/public/common.php
index bfe1a15c..913e4d3e 100644
--- a/public/common.php
+++ b/public/common.php
@@ -1,2 +1,3 @@
checkPasswordRecoveryCode($tUsername, $tCode)) {
flash_error(Config::lang('pPassword_code_text_error'));
} else {
diff --git a/public/vacation.php b/public/vacation.php
index 59b662b0..3122edfd 100644
--- a/public/vacation.php
+++ b/public/vacation.php
@@ -207,7 +207,7 @@ if (!$details['active']) {
if ($tActiveFrom < $now) {
$tActiveFrom = $now;
}
-
+
if ($tActiveUntil < $now) {
$tActiveUntil = $now;
}
diff --git a/public/xmlrpc.php b/public/xmlrpc.php
index cd397e09..030c5d2e 100644
--- a/public/xmlrpc.php
+++ b/public/xmlrpc.php
@@ -67,7 +67,6 @@ echo $server->handle();
class UserProxy {
-
/**
* @param string $old_password
* @param string $new_password
diff --git a/scripts/postfixadmin-cli.php b/scripts/postfixadmin-cli.php
index 7b609442..2e17cede 100644
--- a/scripts/postfixadmin-cli.php
+++ b/scripts/postfixadmin-cli.php
@@ -203,7 +203,7 @@ class PostfixAdmin {
# TODO: add a way to Cli* to signal if the selected handler is supported (for example, not all *Handler support changing the password)
if (strtolower(get_parent_class($shell)) == 'shell') {
- $handler = new $shell->handler_to_use;
+ $handler = new $shell->handler_to_use();
if (in_array($task, $handler->taskNames)) {
$this->shiftArgs();
$shell->startup();
diff --git a/scripts/snippets/crypt.php b/scripts/snippets/crypt.php
index 42b77fcd..ab096741 100644
--- a/scripts/snippets/crypt.php
+++ b/scripts/snippets/crypt.php
@@ -1,24 +1,23 @@
plain = $plaintext;
}
-
+
/**
* @return bool
*/
diff --git a/tests/CheckLanguageTest.php b/tests/CheckLanguageTest.php
index 38efcce7..4e0b4733 100644
--- a/tests/CheckLanguageTest.php
+++ b/tests/CheckLanguageTest.php
@@ -16,7 +16,7 @@ class CheckLanguageTest extends \PHPUnit\Framework\TestCase {
$this->assertEquals('test', $lang);
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en';
-
+
$lang = check_language(false);
$this->assertEquals('en', $lang);
}
diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php
index 33a84d62..79b6333d 100644
--- a/tests/ConfigTest.php
+++ b/tests/ConfigTest.php
@@ -1,7 +1,7 @@
getAll();
diff --git a/tests/CreatePageBrowserTest.php b/tests/CreatePageBrowserTest.php
index 2e2beeaf..0913b375 100644
--- a/tests/CreatePageBrowserTest.php
+++ b/tests/CreatePageBrowserTest.php
@@ -1,7 +1,7 @@
cleanup();
}
diff --git a/tests/DbBasicTest.php b/tests/DbBasicTest.php
index c18fb68e..d0bdaedc 100644
--- a/tests/DbBasicTest.php
+++ b/tests/DbBasicTest.php
@@ -3,7 +3,7 @@
class DbBasicTest extends \PHPUnit\Framework\TestCase {
private $test_domain;
- public function setUp() : void {
+ public function setUp(): void {
$db = db_connect();
$test_domain = 'test' . uniqid() . '.com';
$this->test_domain = $test_domain;
diff --git a/tests/MailboxHandlerTest.php b/tests/MailboxHandlerTest.php
index 0bd39a12..9cd8d803 100644
--- a/tests/MailboxHandlerTest.php
+++ b/tests/MailboxHandlerTest.php
@@ -1,7 +1,7 @@
assertEmpty($h->infomsg);
$this->assertTrue($r);
$this->assertTrue($h->save());
-
+
$h->getList('');
$list = $h->result();
$this->assertEquals(1, count($list));
diff --git a/tests/RemoteTest.php b/tests/RemoteTest.php
index b95e077b..1e8830e5 100644
--- a/tests/RemoteTest.php
+++ b/tests/RemoteTest.php
@@ -12,7 +12,7 @@ abstract class RemoteTest extends \PHPUnit\Framework\TestCase {
protected $xmlrpc_client;
- public function setUp() : void {
+ public function setUp(): void {
parent::setUp();
if ($this->server_url == 'http://change.me/to/work') {
diff --git a/tests/RemoteVacationTest.php b/tests/RemoteVacationTest.php
index 3a5f43c3..bdfbaf19 100644
--- a/tests/RemoteVacationTest.php
+++ b/tests/RemoteVacationTest.php
@@ -8,12 +8,10 @@
require_once('RemoteTest.php');
class RemoteVacationTest extends RemoteTest {
-
-
/**
* Adds the test recipient data to the database.
*/
- public function setUp() : void {
+ public function setUp(): void {
// Ensure config.inc.php is vaguely correct.
global $CONF;
if ($CONF['vacation'] != 'YES' || $CONF['vacation_control'] != "YES") {