You've already forked postfixadmin
mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2025-07-29 22:41:11 +03:00
run php-cs-fixer (code reforamt)
This commit is contained in:
@ -25,8 +25,7 @@ include_once(dirname(__FILE__) . '/functions.inc.php');
|
||||
|
||||
if (file_exists($validate_file)) {
|
||||
include_once($validate_file);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$validate_file = SM_PATH . '/src/validate.php';
|
||||
if (file_exists($validate_file)) {
|
||||
include_once($validate_file);
|
||||
|
@ -283,7 +283,6 @@ function get_password_expiration_value ($domain) {
|
||||
* @return string empty if it's a valid email address, otherwise string with the errormessage
|
||||
*/
|
||||
function check_email($email) {
|
||||
|
||||
$ce_email=$email;
|
||||
|
||||
//strip the vacation domain out if we are using it
|
||||
@ -373,8 +372,7 @@ function escape_string($string) {
|
||||
* @param string $default (optional) - default value if key is not set.
|
||||
* @return string
|
||||
*/
|
||||
function safeget($param, $default = "")
|
||||
{
|
||||
function safeget($param, $default = "") {
|
||||
$retval = $default;
|
||||
if (isset($_GET[$param])) {
|
||||
$retval = $_GET[$param];
|
||||
@ -389,8 +387,7 @@ function safeget($param, $default = "")
|
||||
* @param string $default (optional) default value (defaults to "")
|
||||
* @return string|array - value in $_POST[$param] or $default
|
||||
*/
|
||||
function safepost($param, $default = "")
|
||||
{
|
||||
function safepost($param, $default = "") {
|
||||
$retval = $default;
|
||||
if (isset($_POST[$param])) {
|
||||
$retval = $_POST[$param];
|
||||
@ -405,8 +402,7 @@ function safepost($param, $default = "")
|
||||
* @param string $default (optional)
|
||||
* @return string value from $_SERVER[$param] or $default
|
||||
*/
|
||||
function safeserver($param, $default = "")
|
||||
{
|
||||
function safeserver($param, $default = "") {
|
||||
$retval = $default;
|
||||
if (isset($_SERVER[$param])) {
|
||||
$retval = $_SERVER[$param];
|
||||
@ -421,8 +417,7 @@ function safeserver($param, $default = "")
|
||||
* @param string $default (optional)
|
||||
* @return string value from $_COOKIE[$param] or $default
|
||||
*/
|
||||
function safecookie($param, $default = "")
|
||||
{
|
||||
function safecookie($param, $default = "") {
|
||||
$retval = $default;
|
||||
if (isset($_COOKIE[$param])) {
|
||||
$retval = $_COOKIE[$param];
|
||||
@ -437,8 +432,7 @@ function safecookie($param, $default = "")
|
||||
* @param string $default (optional)
|
||||
* @return string value from $_SESSION[$param] or $default
|
||||
*/
|
||||
function safesession($param, $default = "")
|
||||
{
|
||||
function safesession($param, $default = "") {
|
||||
$retval = $default;
|
||||
if (isset($_SESSION[$param])) {
|
||||
$retval = $_SESSION[$param];
|
||||
@ -893,7 +887,6 @@ function generate_password($length = 12) {
|
||||
* @return array of error messages, or empty array if the password is ok
|
||||
*/
|
||||
function validate_password($password) {
|
||||
|
||||
$result = array();
|
||||
$val_conf = Config::read_array('password_validation');
|
||||
|
||||
@ -1491,7 +1484,6 @@ function db_connect_with_errors() {
|
||||
static $link;
|
||||
if (isset($link) && $link) {
|
||||
return array($link, $error_text);
|
||||
|
||||
}
|
||||
$link = 0;
|
||||
|
||||
@ -1825,7 +1817,6 @@ function db_assoc($result) {
|
||||
}
|
||||
if ($CONF['database_type'] == "mysqli" && $result instanceof mysqli_result) {
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
|
||||
}
|
||||
if (db_sqlite() && $result instanceof SQLite3Result) {
|
||||
$row = $result->fetchArray(SQLITE3_ASSOC);
|
||||
@ -1899,8 +1890,7 @@ function db_insert ($table, array $values, $timestamp = array('created', 'modifi
|
||||
$password_expiration_value = (int) get_password_expiration_value($domain);
|
||||
$values['password_expiry'] = "now() + interval " . $password_expiration_value . " day";
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($_table == 'mailbox') {
|
||||
unset($values['password_expiry']);
|
||||
}
|
||||
@ -1958,7 +1948,6 @@ function db_update_q($table, $where, $values, $timestamp = array('modified')) {
|
||||
|
||||
if (Config::bool('password_expiration')) {
|
||||
if ($table == 'mailbox') {
|
||||
|
||||
error_log("db_update_q : " . json_Encode($where));
|
||||
$where_type = explode('=', $where);
|
||||
$email = ($where_type[1]);
|
||||
@ -2022,7 +2011,6 @@ function db_log($domain, $action, $data) {
|
||||
* @return string
|
||||
*/
|
||||
function db_in_clause($field, array $values) {
|
||||
|
||||
$v = array_map('escape_string', array_values($values));
|
||||
return " $field IN ('" . implode("','", $v) . "') ";
|
||||
}
|
||||
@ -2079,7 +2067,6 @@ function db_where_clause($condition, $struct, $additional_raw_where = '', $searc
|
||||
} elseif ($operator == "NOTNULL") {
|
||||
$querypart = $field . ' IS NOT NULL';
|
||||
} else {
|
||||
|
||||
$querypart = $field . $operator . "'" . escape_string($value) . "'";
|
||||
|
||||
// might need other types adding here.
|
||||
|
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
class CliDelete extends Shell {
|
||||
|
||||
protected $handler_to_use = '';
|
||||
|
||||
/**
|
||||
|
@ -6,8 +6,7 @@
|
||||
*
|
||||
* extends the "Shell" class
|
||||
*/
|
||||
class CliEdit extends Shell
|
||||
{
|
||||
class CliEdit extends Shell {
|
||||
public $handler_to_use = "";
|
||||
public $new = 0;
|
||||
|
||||
@ -15,8 +14,7 @@ class CliEdit extends Shell
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
public function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
} else {
|
||||
@ -29,8 +27,7 @@ class CliEdit extends Shell
|
||||
* read, check and handle all --* parameters
|
||||
* The list of allowed params is based on $handler->struct
|
||||
*/
|
||||
private function __handle_params()
|
||||
{
|
||||
private function __handle_params() {
|
||||
$handler = new $this->handler_to_use($this->new);
|
||||
$form_fields = $handler->getStruct();
|
||||
$id_field = $handler->getId_field();
|
||||
@ -74,8 +71,7 @@ class CliEdit extends Shell
|
||||
/**
|
||||
* Interactive mode
|
||||
*/
|
||||
private function __interactive()
|
||||
{
|
||||
private function __interactive() {
|
||||
$handler = new $this->handler_to_use($this->new);
|
||||
|
||||
$form_fields = $handler->getStruct();
|
||||
@ -179,8 +175,7 @@ class CliEdit extends Shell
|
||||
/**
|
||||
* (try to) store values
|
||||
*/
|
||||
private function __handle($id, $values)
|
||||
{
|
||||
private function __handle($id, $values) {
|
||||
$handler = new $this->handler_to_use($this->new);
|
||||
if (!$handler->init($id)) {
|
||||
$this->err($handler->errormsg);
|
||||
@ -205,8 +200,7 @@ class CliEdit extends Shell
|
||||
/**
|
||||
* Displays help contents
|
||||
*/
|
||||
public function help()
|
||||
{
|
||||
public function help() {
|
||||
if ($this->new) {
|
||||
$cmd = 'add';
|
||||
$cmdtext = 'Adds';
|
||||
|
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
class CliView extends Shell {
|
||||
|
||||
protected $handler_to_use = 'invalid';
|
||||
|
||||
/**
|
||||
|
@ -217,7 +217,6 @@ class MailboxHandler extends PFAHandler {
|
||||
|
||||
|
||||
protected function beforestore() {
|
||||
|
||||
if (isset($this->values['quota']) && $this->values['quota'] != -1) {
|
||||
$this->values['quota'] = $this->values['quota'] * Config::read_string('quota_multiplier'); # convert quota from MB to bytes
|
||||
}
|
||||
@ -452,7 +451,6 @@ class MailboxHandler extends PFAHandler {
|
||||
* @todo merge with allowed_quota?
|
||||
*/
|
||||
protected function check_quota($quota) {
|
||||
|
||||
if (!Config::bool('quota')) {
|
||||
return true; # enforcing quotas is disabled - just allow it
|
||||
}
|
||||
|
@ -108,7 +108,9 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||
while ($row = db_assoc($result['result'])) {
|
||||
$fields = array_keys($row);
|
||||
$values = array_values($row);
|
||||
$values = array_map(function($str) { return escape_string($str); }, $values);
|
||||
$values = array_map(function ($str) {
|
||||
return escape_string($str);
|
||||
}, $values);
|
||||
|
||||
fwrite($fh, "INSERT INTO ". $tables[$i] . " (". implode(',', $fields) . ") VALUES ('" . implode('\',\'', $values) . "');\n");
|
||||
$fields = "";
|
||||
|
@ -87,7 +87,6 @@ if (count($handler->infomsg)) {
|
||||
|
||||
|
||||
if (safeget('output') == 'csv') {
|
||||
|
||||
$out = fopen('php://output', 'w');
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment;filename='.$table.'.csv');
|
||||
|
@ -76,8 +76,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
error_log("PostfixAdmin admin login failed (username: $fUsername, ip_address: {$_SERVER['REMOTE_ADDR']})");
|
||||
flash_error($PALANG['pLogin_failed']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
session_unset();
|
||||
session_destroy();
|
||||
session_start();
|
||||
|
@ -10,8 +10,6 @@ define('NTLMSSP_HASH_SIZE', 16);
|
||||
|
||||
|
||||
class DovecotCrypt extends Crypt {
|
||||
|
||||
|
||||
private $errormsg = [];
|
||||
|
||||
private $salt_chars = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
@ -52,7 +52,6 @@ class PaCryptTest extends \PHPUnit\Framework\TestCase {
|
||||
'md5' => 'CY9rzUYh03PK3k6DJie09g==',
|
||||
// crypt requires salt ...
|
||||
'SHA' => 'qUqP5cyxm6YcTAhz05Hph5gvu9M='] as $flavour => $hash) {
|
||||
|
||||
$CONF['authlib_default_flavour'] = $flavour;
|
||||
|
||||
$stored = "{" . $flavour . "}$hash";
|
||||
|
@ -3,7 +3,6 @@
|
||||
require_once('common.php');
|
||||
|
||||
class ValidatePasswordTest extends \PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testBasic() {
|
||||
$config = Config::getInstance();
|
||||
|
||||
|
Reference in New Issue
Block a user