diff --git a/README.md b/README.md
index 6075f8c6..b809cde8 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ Integrates with :
- Users have the ability to login, change their password or vacation (out of office) status.
- Integration with Squirrelmail / Roundcube (via plugins)
- Optional XMLRPC based API
- - Supports PHP5.4+
+ - Supports PHP5.6+
## Useful Links
diff --git a/common.php b/common.php
index 4766df5f..2c4e741a 100644
--- a/common.php
+++ b/common.php
@@ -8,7 +8,6 @@
*
* Further details on the project are available at http://postfixadmin.sf.net
*
- * @version $Id$
* @license GNU GPL v2 or later.
*
* File: common.php
diff --git a/composer.json b/composer.json
index 33cd3344..0a3b25be 100644
--- a/composer.json
+++ b/composer.json
@@ -34,8 +34,7 @@
"autoload": {
"files": [
"config.inc.php",
- "functions.inc.php",
- "lib/smarty/libs/bootstrap.php"
+ "functions.inc.php"
]
}
}
diff --git a/config.inc.php b/config.inc.php
index 88b9cf79..c6020823 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -8,7 +8,6 @@
*
* Further details on the project are available at http://postfixadmin.sf.net
*
- * @version $Id$
* @license GNU GPL v2 or later.
*
* File: config.inc.php
diff --git a/functions.inc.php b/functions.inc.php
index 5407f7cd..c7f202c9 100644
--- a/functions.inc.php
+++ b/functions.inc.php
@@ -8,7 +8,6 @@
*
* Further details on the project are available at http://postfixadmin.sf.net
*
- * @version $Id$
* @license GNU GPL v2 or later.
*
* File: functions.inc.php
@@ -665,11 +664,6 @@ function list_domains_for_admin($username) {
return array_column($result, 'domain');
}
-
-if (!function_exists('array_column')) {
- require_once(dirname(__FILE__) . '/lib/array_column.php');
-}
-
/**
* List all available domains.
*
@@ -1916,15 +1910,10 @@ function db_in_clause($field, array $values) {
* Note: the $searchmode operator will only be used if a $condition for that field is set.
* This also means you'll need to set a (dummy) condition for NULL and NOTNULL.
*/
-function db_where_clause($condition, $struct, $additional_raw_where = '', $searchmode = array()) {
- if (!is_array($condition)) {
- throw new Exception('db_where_cond: parameter $cond is not an array!');
- } elseif (!is_array($searchmode)) {
- throw new Exception('db_where_cond: parameter $searchmode is not an array!');
- } elseif (count($condition) == 0 && trim($additional_raw_where) == '') {
+function db_where_clause(array $condition, array $struct, $additional_raw_where = '', array $searchmode = array()) {
+
+ if (count($condition) == 0 && trim($additional_raw_where) == '') {
throw new Exception("db_where_cond: parameter is an empty array!");
- } elseif (!is_array($struct)) {
- throw new Exception('db_where_cond: parameter $struct is not an array!');
}
$allowed_operators = array('<', '>', '>=', '<=', '=', '!=', '<>', 'CONT', 'LIKE', 'NULL', 'NOTNULL');
diff --git a/lib/array_column.php b/lib/array_column.php
deleted file mode 100644
index d712823b..00000000
--- a/lib/array_column.php
+++ /dev/null
@@ -1,8 +0,0 @@
-new) {
- $cmd = Config::read('mailbox_postcreation_script');
+ $cmd = Config::read_string('mailbox_postcreation_script');
$warnmsg = Config::Lang('mailbox_postcreate_failed');
} else {
- $cmd = Config::read('mailbox_postedit_script');
+ $cmd = Config::read_string('mailbox_postedit_script');
$warnmsg = Config::Lang('mailbox_postedit_failed');
}
@@ -608,7 +608,7 @@ class MailboxHandler extends PFAHandler {
* also adds a detailed error message to $this->errormsg[]
*/
protected function mailbox_postdeletion() {
- $cmd = Config::read('mailbox_postdeletion_script');
+ $cmd = Config::read_string('mailbox_postdeletion_script');
if (empty($cmd)) {
return true;
@@ -735,8 +735,8 @@ class MailboxHandler extends PFAHandler {
/**
* @return boolean true on success; false on failure
+ * @param string $new_password
* @param string $old_password
- * @param string $new_passwords
* @param bool $match = true
*
* All passwords need to be plain text; they'll be hashed appropriately
diff --git a/model/PFAHandler.php b/model/PFAHandler.php
index 8243d451..97600c04 100644
--- a/model/PFAHandler.php
+++ b/model/PFAHandler.php
@@ -33,12 +33,12 @@ abstract class PFAHandler {
* @var string (default) name of the database table
* (can be overridden by $CONF[database_prefix] and $CONF[database_tables][*] via table_by_key())
*/
- protected $db_table;
+ protected $db_table = '';
/**
* @var string field containing the ID
*/
- protected $id_field;
+ protected $id_field = '';
/**
* @var string field containing the label
@@ -52,7 +52,7 @@ abstract class PFAHandler {
* defaults to $id_field if not set
* @var string
*/
- protected $order_by;
+ protected $order_by = '';
/**
* @var string
@@ -215,6 +215,9 @@ abstract class PFAHandler {
$this->initStruct();
+ /**
+ * @psalm-suppress InvalidArrayOffset
+ */
if (!isset($this->struct['_can_edit'])) {
$this->struct['_can_edit'] = pacol(0, 0, 1, 'vnum', '' , '' , '', array(),
/*not_in_db*/ 0,
@@ -223,6 +226,9 @@ abstract class PFAHandler {
);
}
+ /**
+ * @psalm-suppress InvalidArrayOffset
+ */
if (!isset($this->struct['_can_delete'])) {
$this->struct['_can_delete'] = pacol(0, 0, 1, 'vnum', '' , '' , '', array(),
/*not_in_db*/ 0,
@@ -231,7 +237,10 @@ abstract class PFAHandler {
);
}
- $struct_hook = Config::read($this->db_table . '_struct_hook');
+ if(empty($this->db_table)) {
+ throw new Exception("db_table not defined");
+ }
+ $struct_hook = Config::read_string($this->db_table . '_struct_hook');
if (!empty($struct_hook) && is_string($struct_hook) && $struct_hook != 'NO' && function_exists($struct_hook)) {
$this->struct = $struct_hook($this->struct);
}
@@ -810,15 +819,7 @@ abstract class PFAHandler {
$real_condition = $condition;
}
- $result = $this->read_from_db($real_condition, $searchmode, $limit, $offset);
-
- if (!is_array($result)) {
- error_log('getList: read_from_db didn\'t return an array. table: ' . $this->db_table . ' - condition: $condition - limit: $limit - offset: $offset');
- error_log('getList: This is most probably caused by read_from_db_postprocess()');
- die('Unexpected error while reading from database! (Please check the error log for details, and open a bugreport)');
- }
-
- $this->result = $result;
+ $this->result = $this->read_from_db($real_condition, $searchmode, $limit, $offset);
return true;
}
diff --git a/psalm.xml b/psalm.xml
index df696107..08df1553 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -12,6 +12,7 @@
+
diff --git a/public/upgrade.php b/public/upgrade.php
index 2ae20eef..ac98a077 100644
--- a/public/upgrade.php
+++ b/public/upgrade.php
@@ -7,7 +7,7 @@ if (!defined('POSTFIXADMIN')) {
require_once('common.php');
}
-if (!isset($CONF) || !is_array($CONF)) {
+if (empty($CONF)) {
die("config.inc.php seems invalid");
}