mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
bumping php-cs-fixer; formatting rules change slightly
This commit is contained in:
parent
3472897527
commit
b18ed591a2
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// vim:ts=4:sw=4:et
|
// vim:ts=4:sw=4:et
|
||||||
ini_set('include_path', get_include_path() . ':' . dirname(__FILE__));
|
ini_set('include_path', get_include_path() . ':' . dirname(__FILE__));
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/common.php');
|
require_once(dirname(__FILE__) . '/common.php');
|
||||||
|
|
||||||
$xmlrpc = get_xmlrpc();
|
$xmlrpc = get_xmlrpc();
|
||||||
|
@ -99,7 +99,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||||||
$$key = $_POST[$key];
|
$$key = $_POST[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($fBack)) {
|
if (!empty($fBack)) {
|
||||||
$success = $vacation->remove();
|
$success = $vacation->remove();
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// vim:ts=4:sw=4:et
|
// vim:ts=4:sw=4:et
|
||||||
if (!defined('SM_PATH')) {
|
if (!defined('SM_PATH')) {
|
||||||
die("Invalid internal state (don't access file directly)");
|
die("Invalid internal state (don't access file directly)");
|
||||||
|
@ -1955,7 +1955,7 @@ function db_insert($table, array $values, $timestamp = array('created', 'modifie
|
|||||||
* @param array $timestamp (optional) - array of fields to set to now() - default: array('modified')
|
* @param array $timestamp (optional) - array of fields to set to now() - default: array('modified')
|
||||||
* @return int - number of updated rows
|
* @return int - number of updated rows
|
||||||
*/
|
*/
|
||||||
function db_update(string $table, string $where_col, string $where_value, array $values, array $timestamp = array('modified'), bool $throw_exceptions = false):int {
|
function db_update(string $table, string $where_col, string $where_value, array $values, array $timestamp = array('modified'), bool $throw_exceptions = false): int {
|
||||||
$table_key = table_by_key($table);
|
$table_key = table_by_key($table);
|
||||||
|
|
||||||
$pvalues = array();
|
$pvalues = array();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
//
|
//
|
||||||
// Postfix Admin
|
// Postfix Admin
|
||||||
// by Mischa Peters <mischa at high5 dot net>
|
// by Mischa Peters <mischa at high5 dot net>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
class AdminHandler extends PFAHandler {
|
class AdminHandler extends PFAHandler {
|
||||||
@ -123,7 +124,7 @@ class AdminHandler extends PFAHandler {
|
|||||||
* called by $this->store() after storing $this->values in the database
|
* called by $this->store() after storing $this->values in the database
|
||||||
* can be used to update additional tables, call scripts etc.
|
* 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
|
# store list of allowed domains in the domain_admins table
|
||||||
if (isset($this->values['domains'])) {
|
if (isset($this->values['domains'])) {
|
||||||
if (is_array($this->values['domains'])) {
|
if (is_array($this->values['domains'])) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
class AdminpasswordHandler extends PFAHandler {
|
class AdminpasswordHandler extends PFAHandler {
|
||||||
@ -35,7 +36,7 @@ class AdminpasswordHandler extends PFAHandler {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init(string $id) :bool {
|
public function init(string $id): bool {
|
||||||
# hardcode to logged in admin
|
# hardcode to logged in admin
|
||||||
if ($this->admin_username == '') {
|
if ($this->admin_username == '') {
|
||||||
die("No admin logged in");
|
die("No admin logged in");
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,7 +137,7 @@ class AliasHandler extends PFAHandler {
|
|||||||
* AliasHandler needs some special handling in init() and therefore overloads the function.
|
* AliasHandler needs some special handling in init() and therefore overloads the function.
|
||||||
* It also calls parent::init()
|
* It also calls parent::init()
|
||||||
*/
|
*/
|
||||||
public function init(string $id) : bool {
|
public function init(string $id): bool {
|
||||||
$bits = explode('@', $id);
|
$bits = explode('@', $id);
|
||||||
if (sizeof($bits) == 2) {
|
if (sizeof($bits) == 2) {
|
||||||
$local_part = $bits[0];
|
$local_part = $bits[0];
|
||||||
@ -151,7 +152,7 @@ class AliasHandler extends PFAHandler {
|
|||||||
if (!$retval) {
|
if (!$retval) {
|
||||||
return false;
|
return false;
|
||||||
} # parent::init() failed, no need to continue
|
} # parent::init() failed, no need to continue
|
||||||
|
|
||||||
# hide 'goto_mailbox' for non-mailbox aliases
|
# hide 'goto_mailbox' for non-mailbox aliases
|
||||||
# parent::init called view() before, so we can rely on having $this->result filled
|
# parent::init called view() before, so we can rely on having $this->result filled
|
||||||
# (only validate_new_id() is called from parent::init and could in theory change $this->result)
|
# (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');
|
$this->errormsg[$this->id_field] = Config::lang('pCreate_alias_address_text_error3');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: already checked in set() - does it make sense to check it here also? Only advantage: it's an early check
|
# 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)) {
|
# if (!in_array($domain, $this->allowed_domains)) {
|
||||||
# $this->errormsg[] = Config::lang('pCreate_alias_address_text_error1');
|
# $this->errormsg[] = Config::lang('pCreate_alias_address_text_error1');
|
||||||
@ -303,7 +304,7 @@ class AliasHandler extends PFAHandler {
|
|||||||
$this->values['goto'] = join(',', $values['goto']);
|
$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
|
# TODO: if alias belongs to a mailbox, update mailbox active status
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -357,7 +358,7 @@ class AliasHandler extends PFAHandler {
|
|||||||
return array($condition, $searchmode);
|
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);
|
list($condition, $searchmode) = $this->condition_ignore_mailboxes($condition, $searchmode);
|
||||||
$this->set_is_mailbox_extrafrom($condition, $searchmode);
|
$this->set_is_mailbox_extrafrom($condition, $searchmode);
|
||||||
$result = parent::getList($condition, $searchmode, $limit, $offset);
|
$result = parent::getList($condition, $searchmode, $limit, $offset);
|
||||||
@ -452,7 +453,7 @@ class AliasHandler extends PFAHandler {
|
|||||||
$vacation_goto = str_replace('@', '#', $this->id);
|
$vacation_goto = str_replace('@', '#', $this->id);
|
||||||
return $vacation_goto . '@' . Config::read_string('vacation_domain');
|
return $vacation_goto . '@' . Config::read_string('vacation_domain');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +52,7 @@ class AliasdomainHandler extends PFAHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init(string $id) : bool {
|
public function init(string $id): bool {
|
||||||
$success = parent::init($id);
|
$success = parent::init($id);
|
||||||
if ($success) {
|
if ($success) {
|
||||||
if (count($this->struct['alias_domain']['options']) == 0 && $this->new) {
|
if (count($this->struct['alias_domain']['options']) == 0 && $this->new) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
/**
|
/**
|
||||||
* class to handle 'delete' in Cli
|
* class to handle 'delete' in Cli
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CliDelete extends Shell {
|
class CliDelete extends Shell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execution method always used for tasks
|
* Execution method always used for tasks
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
class CliHelp extends Shell {
|
class CliHelp extends Shell {
|
||||||
@ -14,7 +15,7 @@ class CliHelp extends Shell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function help() {
|
public function help() {
|
||||||
$handler = new $this->handler_to_use;
|
$handler = new $this->handler_to_use();
|
||||||
# TODO: adjust help text according to $handler->taskNames
|
# TODO: adjust help text according to $handler->taskNames
|
||||||
|
|
||||||
$module = preg_replace('/Handler$/', '', $this->handler_to_use);
|
$module = preg_replace('/Handler$/', '', $this->handler_to_use);
|
||||||
@ -35,7 +36,7 @@ class CliHelp extends Shell {
|
|||||||
|
|
||||||
View $module <address> in non-interactive mode.
|
View $module <address> in non-interactive mode.
|
||||||
"); */
|
"); */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$head = "Usage: postfixadmin-cli $module <task> [<address>] [--option value] [--option value]\n";
|
$head = "Usage: postfixadmin-cli $module <task> [<address>] [--option value] [--option value]\n";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
/**
|
/**
|
||||||
* class to display the database scheme (for usage in upgrade.php) in Cli
|
* class to display the database scheme (for usage in upgrade.php) in Cli
|
||||||
@ -57,7 +58,7 @@ class CliScheme extends Shell {
|
|||||||
$this->out(" PRIMARY KEY (" . $handler->getId_field() . ")");
|
$this->out(" PRIMARY KEY (" . $handler->getId_field() . ")");
|
||||||
$this->out(' ) {MYISAM} ');
|
$this->out(' ) {MYISAM} ');
|
||||||
$this->out('");');
|
$this->out('");');
|
||||||
|
|
||||||
$this->out('');
|
$this->out('');
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out('For adding fields with upgrade.php:');
|
$this->out('For adding fields with upgrade.php:');
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
/**
|
/**
|
||||||
* class to handle 'view' in Cli
|
* class to handle 'view' in Cli
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CliView extends Shell {
|
class CliView extends Shell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execution method always used for tasks
|
* Execution method always used for tasks
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
# This class is too static - if you inherit a class from it, it will share the static $instance and all its contents
|
# This class is too static - if you inherit a class from it, it will share the static $instance and all its contents
|
||||||
@ -45,7 +46,7 @@ final class Config {
|
|||||||
* @param string $var
|
* @param string $var
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function read_array(string $var) : array {
|
public static function read_array(string $var): array {
|
||||||
$stuff = self::read($var);
|
$stuff = self::read($var);
|
||||||
|
|
||||||
if (!is_array($stuff)) {
|
if (!is_array($stuff)) {
|
||||||
@ -55,7 +56,7 @@ final class Config {
|
|||||||
return $stuff;
|
return $stuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function has(string $var) : bool {
|
public static function has(string $var): bool {
|
||||||
$x = self::getInstance()->getAll();
|
$x = self::getInstance()->getAll();
|
||||||
return array_key_exists($var, $x);
|
return array_key_exists($var, $x);
|
||||||
}
|
}
|
||||||
@ -63,7 +64,7 @@ final class Config {
|
|||||||
* @param string $var
|
* @param string $var
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function read_string(string $var) : string {
|
public static function read_string(string $var): string {
|
||||||
$stuff = self::read($var);
|
$stuff = self::read($var);
|
||||||
|
|
||||||
if ($stuff === null) {
|
if ($stuff === null) {
|
||||||
@ -110,7 +111,7 @@ final class Config {
|
|||||||
* @param string $value Value to use as sprintf parameter
|
* @param string $value Value to use as sprintf parameter
|
||||||
* @return string value of Config::$var, parsed by sprintf
|
* @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);
|
$text = self::read_string($var);
|
||||||
|
|
||||||
$newtext = sprintf($text, $value);
|
$newtext = sprintf($text, $value);
|
||||||
@ -133,7 +134,7 @@ final class Config {
|
|||||||
* @param string $var Variable to obtain
|
* @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)
|
* @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);
|
$value = self::read($var);
|
||||||
|
|
||||||
if (is_bool($value)) {
|
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)
|
* Used to read Config::$var, converted to bool, returned as integer (0 or 1)
|
||||||
* @see bool()
|
* @see bool()
|
||||||
*/
|
*/
|
||||||
public static function intbool($var) : int {
|
public static function intbool($var): int {
|
||||||
return Config::bool($var) ? 1 : 0;
|
return Config::bool($var) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +178,7 @@ final class Config {
|
|||||||
* @return string value of $PALANG[$var]
|
* @return string value of $PALANG[$var]
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public static function lang(string $var) : string {
|
public static function lang(string $var): string {
|
||||||
$languages = self::read_array('__LANG');
|
$languages = self::read_array('__LANG');
|
||||||
|
|
||||||
$value = $languages[$var] ?? '';
|
$value = $languages[$var] ?? '';
|
||||||
@ -197,7 +198,7 @@ final class Config {
|
|||||||
* @param string $value Value to use as sprintf parameter
|
* @param string $value Value to use as sprintf parameter
|
||||||
* @return string value of $PALANG[$var], parsed by sprintf
|
* @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');
|
$all = self::read_array('__LANG');
|
||||||
|
|
||||||
$text = $all[$var] ?? '';
|
$text = $all[$var] ?? '';
|
||||||
@ -215,7 +216,7 @@ final class Config {
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAll() : array {
|
public function getAll(): array {
|
||||||
return $this->config;
|
return $this->config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,7 +149,7 @@ class DomainHandler extends PFAHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function preSave() : bool {
|
protected function preSave(): bool {
|
||||||
# TODO: is this function superfluous? _can_edit should already cover this
|
# TODO: is this function superfluous? _can_edit should already cover this
|
||||||
if ($this->is_superadmin) {
|
if ($this->is_superadmin) {
|
||||||
return true;
|
return true;
|
||||||
@ -161,7 +162,7 @@ class DomainHandler extends PFAHandler {
|
|||||||
* called by $this->store() after storing $this->values in the database
|
* called by $this->store() after storing $this->values in the database
|
||||||
* can be used to update additional tables, call scripts etc.
|
* 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']) {
|
if ($this->new && $this->values['default_aliases']) {
|
||||||
foreach (Config::read_array('default_aliases') as $address=>$goto) {
|
foreach (Config::read_array('default_aliases') as $address=>$goto) {
|
||||||
$address = $address . "@" . $this->id;
|
$address = $address . "@" . $this->id;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +61,7 @@ class MailboxHandler extends PFAHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init(string $id) : bool {
|
public function init(string $id): bool {
|
||||||
if (!parent::init($id)) {
|
if (!parent::init($id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -217,7 +218,7 @@ class MailboxHandler extends PFAHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function preSave() : bool {
|
protected function preSave(): bool {
|
||||||
if (isset($this->values['quota']) && $this->values['quota'] != -1 && is_numeric($this->values['quota'])) {
|
if (isset($this->values['quota']) && $this->values['quota'] != -1 && is_numeric($this->values['quota'])) {
|
||||||
$multiplier = Config::read_string('quota_multiplier');
|
$multiplier = Config::read_string('quota_multiplier');
|
||||||
if ($multiplier == 0 || !is_numeric($multiplier)) { // or empty string, or null, or false...
|
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);
|
return $ok && parent::set($values);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function postSave() : bool {
|
protected function postSave(): bool {
|
||||||
if ($this->new) {
|
if ($this->new) {
|
||||||
if (!$this->mailbox_post_script()) {
|
if (!$this->mailbox_post_script()) {
|
||||||
# return false; # TODO: should this be fatal?
|
# return false; # TODO: should this be fatal?
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
abstract class PFAHandler {
|
|
||||||
|
|
||||||
|
abstract class PFAHandler {
|
||||||
/**
|
/**
|
||||||
* public variables
|
* public variables
|
||||||
*/
|
*/
|
||||||
@ -337,7 +337,7 @@ abstract class PFAHandler {
|
|||||||
* initialize with $id and check if it is valid
|
* initialize with $id and check if it is valid
|
||||||
* @param string $id
|
* @param string $id
|
||||||
*/
|
*/
|
||||||
public function init(string $id) : bool {
|
public function init(string $id): bool {
|
||||||
|
|
||||||
// postfix treats address lookups (aliases, mailboxes) as if they were lowercase.
|
// postfix treats address lookups (aliases, mailboxes) as if they were lowercase.
|
||||||
// MySQL is normally case insenstive, PostgreSQL is case sensitive.
|
// MySQL is normally case insenstive, PostgreSQL is case sensitive.
|
||||||
@ -534,7 +534,7 @@ abstract class PFAHandler {
|
|||||||
* @return bool - true if all values were stored in the database, otherwise false
|
* @return bool - true if all values were stored in the database, otherwise false
|
||||||
* error messages (if any) are stored in $this->errormsg
|
* error messages (if any) are stored in $this->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().
|
# 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')) {
|
if (method_exists($this, 'store')) {
|
||||||
error_log('store() is deprecated, please rename it to save()');
|
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
|
* called by $this->save() before storing the values in the database
|
||||||
* @return bool - if false, save() will abort
|
* @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().
|
# 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.
|
# Note: if a child class also has preSave(), it will override this function and obviously also the compability code.
|
||||||
if (method_exists($this, 'beforestore')) {
|
if (method_exists($this, 'beforestore')) {
|
||||||
@ -623,7 +623,7 @@ abstract class PFAHandler {
|
|||||||
* called by $this->save() after storing $this->values in the database
|
* called by $this->save() after storing $this->values in the database
|
||||||
* can be used to update additional tables, call scripts etc.
|
* 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().
|
# 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.
|
# Note: if a child class also has postSave(), it will override this function and obviously also the compability code.
|
||||||
if (method_exists($this, 'storemore')) {
|
if (method_exists($this, 'storemore')) {
|
||||||
@ -755,7 +755,7 @@ abstract class PFAHandler {
|
|||||||
* @param int $offset - number of first row to return
|
* @param int $offset - number of first row to return
|
||||||
* @return array - rows (as associative array, with the ID as key)
|
* @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);
|
$queryparts = $this->build_select_query($condition, $searchmode);
|
||||||
|
|
||||||
$query = $queryparts['select_cols'] . $queryparts['from_where_order'];
|
$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)
|
* @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)
|
* 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)) {
|
if (is_array($condition)) {
|
||||||
$real_condition = array();
|
$real_condition = array();
|
||||||
foreach ($condition as $key => $value) {
|
foreach ($condition as $key => $value) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
class VacationHandler extends PFAHandler {
|
class VacationHandler extends PFAHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ class VacationHandler extends PFAHandler {
|
|||||||
*/
|
*/
|
||||||
protected $domain_field = 'domain';
|
protected $domain_field = 'domain';
|
||||||
|
|
||||||
public function init(string $id) : bool {
|
public function init(string $id): bool {
|
||||||
throw new \Exception('VacationHandler is not yet ready to be used with *Handler methods');
|
throw new \Exception('VacationHandler is not yet ready to be used with *Handler methods');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
|||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
} else {
|
} else {
|
||||||
fwrite($fh, $header);
|
fwrite($fh, $header);
|
||||||
|
|
||||||
$tables = array(
|
$tables = array(
|
||||||
'admin',
|
'admin',
|
||||||
'alias',
|
'alias',
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/../common.php');
|
require_once(dirname(__FILE__) . '/../common.php');
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
//
|
//
|
||||||
// File: index.php
|
// File: index.php
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php /**
|
<?php
|
||||||
|
/**
|
||||||
* Postfix Admin
|
* Postfix Admin
|
||||||
*
|
*
|
||||||
* LICENSE
|
* LICENSE
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
||||||
|
|
||||||
# Note: run with upgrade.php?debug=1 to see all SQL error messages
|
# Note: run with upgrade.php?debug=1 to see all SQL error messages
|
||||||
|
@ -66,7 +66,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$error = true;
|
$error = true;
|
||||||
flash_error(Config::lang('pPassword_password_text_error'));
|
flash_error(Config::lang('pPassword_password_text_error'));
|
||||||
} else {
|
} else {
|
||||||
$handler = $context === 'admin' ? new AdminHandler : new MailboxHandler;
|
$handler = $context === 'admin' ? new AdminHandler() : new MailboxHandler();
|
||||||
if (!$handler->checkPasswordRecoveryCode($tUsername, $tCode)) {
|
if (!$handler->checkPasswordRecoveryCode($tUsername, $tCode)) {
|
||||||
flash_error(Config::lang('pPassword_code_text_error'));
|
flash_error(Config::lang('pPassword_code_text_error'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -207,7 +207,7 @@ if (!$details['active']) {
|
|||||||
if ($tActiveFrom < $now) {
|
if ($tActiveFrom < $now) {
|
||||||
$tActiveFrom = $now;
|
$tActiveFrom = $now;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tActiveUntil < $now) {
|
if ($tActiveUntil < $now) {
|
||||||
$tActiveUntil = $now;
|
$tActiveUntil = $now;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,6 @@ echo $server->handle();
|
|||||||
|
|
||||||
|
|
||||||
class UserProxy {
|
class UserProxy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $old_password
|
* @param string $old_password
|
||||||
* @param string $new_password
|
* @param string $new_password
|
||||||
|
@ -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)
|
# 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') {
|
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)) {
|
if (in_array($task, $handler->taskNames)) {
|
||||||
$this->shiftArgs();
|
$this->shiftArgs();
|
||||||
$shell->startup();
|
$shell->startup();
|
||||||
|
@ -1,24 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Crypt {
|
class Crypt {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
protected $plain = '';
|
protected $plain = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
protected $password;
|
protected $password;
|
||||||
|
|
||||||
protected $size;
|
protected $size;
|
||||||
|
|
||||||
|
|
||||||
public function __construct($plaintext) {
|
public function __construct($plaintext) {
|
||||||
$this->plain = $plaintext;
|
$this->plain = $plaintext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -16,7 +16,7 @@ class CheckLanguageTest extends \PHPUnit\Framework\TestCase {
|
|||||||
$this->assertEquals('test', $lang);
|
$this->assertEquals('test', $lang);
|
||||||
|
|
||||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en';
|
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en';
|
||||||
|
|
||||||
$lang = check_language(false);
|
$lang = check_language(false);
|
||||||
$this->assertEquals('en', $lang);
|
$this->assertEquals('en', $lang);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ConfigTest extends \PHPUnit\Framework\TestCase {
|
class ConfigTest extends \PHPUnit\Framework\TestCase {
|
||||||
public function setUp() : void {
|
public function setUp(): void {
|
||||||
$c = Config::getInstance();
|
$c = Config::getInstance();
|
||||||
|
|
||||||
$all = $c->getAll();
|
$all = $c->getAll();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class CreatePageBrowserTest extends \PHPUnit\Framework\TestCase {
|
class CreatePageBrowserTest extends \PHPUnit\Framework\TestCase {
|
||||||
public function tearDown() : void {
|
public function tearDown(): void {
|
||||||
$this->cleanup();
|
$this->cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
class DbBasicTest extends \PHPUnit\Framework\TestCase {
|
class DbBasicTest extends \PHPUnit\Framework\TestCase {
|
||||||
private $test_domain;
|
private $test_domain;
|
||||||
|
|
||||||
public function setUp() : void {
|
public function setUp(): void {
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$test_domain = 'test' . uniqid() . '.com';
|
$test_domain = 'test' . uniqid() . '.com';
|
||||||
$this->test_domain = $test_domain;
|
$this->test_domain = $test_domain;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class MailboxHandlerTest extends \PHPUnit\Framework\TestCase {
|
class MailboxHandlerTest extends \PHPUnit\Framework\TestCase {
|
||||||
public function tearDown() : void {
|
public function tearDown(): void {
|
||||||
db_query('DELETE FROM mailbox');
|
db_query('DELETE FROM mailbox');
|
||||||
db_query('DELETE FROM alias');
|
db_query('DELETE FROM alias');
|
||||||
db_query('DELETE FROM domain_admins');
|
db_query('DELETE FROM domain_admins');
|
||||||
@ -10,7 +10,7 @@ class MailboxHandlerTest extends \PHPUnit\Framework\TestCase {
|
|||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp() : void {
|
public function setUp(): void {
|
||||||
global $CONF;
|
global $CONF;
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ class MailboxHandlerTest extends \PHPUnit\Framework\TestCase {
|
|||||||
$this->assertEmpty($h->infomsg);
|
$this->assertEmpty($h->infomsg);
|
||||||
$this->assertTrue($r);
|
$this->assertTrue($r);
|
||||||
$this->assertTrue($h->save());
|
$this->assertTrue($h->save());
|
||||||
|
|
||||||
$h->getList('');
|
$h->getList('');
|
||||||
$list = $h->result();
|
$list = $h->result();
|
||||||
$this->assertEquals(1, count($list));
|
$this->assertEquals(1, count($list));
|
||||||
|
@ -12,7 +12,7 @@ abstract class RemoteTest extends \PHPUnit\Framework\TestCase {
|
|||||||
|
|
||||||
protected $xmlrpc_client;
|
protected $xmlrpc_client;
|
||||||
|
|
||||||
public function setUp() : void {
|
public function setUp(): void {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
if ($this->server_url == 'http://change.me/to/work') {
|
if ($this->server_url == 'http://change.me/to/work') {
|
||||||
|
@ -8,12 +8,10 @@
|
|||||||
require_once('RemoteTest.php');
|
require_once('RemoteTest.php');
|
||||||
|
|
||||||
class RemoteVacationTest extends RemoteTest {
|
class RemoteVacationTest extends RemoteTest {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the test recipient data to the database.
|
* Adds the test recipient data to the database.
|
||||||
*/
|
*/
|
||||||
public function setUp() : void {
|
public function setUp(): void {
|
||||||
// Ensure config.inc.php is vaguely correct.
|
// Ensure config.inc.php is vaguely correct.
|
||||||
global $CONF;
|
global $CONF;
|
||||||
if ($CONF['vacation'] != 'YES' || $CONF['vacation_control'] != "YES") {
|
if ($CONF['vacation'] != 'YES' || $CONF['vacation_control'] != "YES") {
|
||||||
|
Loading…
Reference in New Issue
Block a user