Compare commits

..

No commits in common. "d812c031994b387e71619e3ddf9679ffca47b7b7" and "b2c7df32ebb2d491b952776bec051d37cc1943f8" have entirely different histories.

10 changed files with 857 additions and 636 deletions

25
.drone.yml Normal file
View file

@ -0,0 +1,25 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: install dependencies
image: composer
volumes:
- name: composer-cache
path: /tmp/cache
environment:
COMPOSER_CACHE_DIR: /tmp/cache
commands:
- composer install --no-progress --no-interaction --ignore-platform-reqs
- name: run unit tests
image: php:7.4
commands:
- vendor/bin/phpunit -c phpunit.xml
volumes:
- name: composer-cache
host:
path: /tmp/drone/composer-cache

View file

@ -1,4 +1,4 @@
FROM php:8.4-apache AS base FROM php:7.4-apache AS base
WORKDIR /var/www WORKDIR /var/www
@ -11,7 +11,7 @@ RUN apt-get update && \
RUN a2enmod rewrite && \ RUN a2enmod rewrite && \
sed -ri -e 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/*.conf sed -ri -e 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/*.conf
COPY --from=composer:2.10 /usr/bin/composer /usr/bin/composer COPY --from=composer /usr/bin/composer /usr/bin/composer
FROM base AS development FROM base AS development

View file

@ -2,7 +2,7 @@
DOCKER_UID = "$(shell id -u):$(shell id -g)" DOCKER_UID = "$(shell id -u):$(shell id -g)"
# Basic docker-compose command # Basic docker-compose command
DOCKER_COMPOSE = DOCKER_UID=$(DOCKER_UID) docker compose DOCKER_COMPOSE = DOCKER_UID=$(DOCKER_UID) docker-compose
# Commands inside containers # Commands inside containers
DOCKER_RUN = $(DOCKER_COMPOSE) run --rm app DOCKER_RUN = $(DOCKER_COMPOSE) run --rm app

View file

@ -12,13 +12,13 @@
"optimize-autoloader": true "optimize-autoloader": true
}, },
"require": { "require": {
"php": "^8.4", "php": "^7.4",
"ext-pdo": "*", "ext-pdo": "*",
"ext-yaml": "*", "ext-yaml": "*",
"slim/slim": "^4.15", "slim/slim": "^4.8",
"slim/psr7": "^1.8", "slim/psr7": "^1.3",
"php-di/php-di": "^7.1", "php-di/php-di": "^6.3",
"slim/twig-view": "^3.4" "slim/twig-view": "^3.2"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9" "phpunit/phpunit": "^9"

1440
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
name: mail-account-admin version: '3.4'
services: services:
app: app:

View file

@ -46,7 +46,7 @@ abstract class FormData
private static function validateMailAddress(string $address, bool $required = true, string $fieldName = 'Mail address'): ?string private static function validateMailAddress(string $address, bool $required = true, string $fieldName = 'Mail address'): ?string
{ {
// Note: This validator allows '%' as wildcard character inside the username of mail addresses. // Note: This validator allows '%' as wildcard character inside mail addresses.
if (!$required && $address === '') { if (!$required && $address === '') {
return null; return null;
} }
@ -55,7 +55,7 @@ abstract class FormData
self::validateString($address, 3, 100, $fieldName) self::validateString($address, 3, 100, $fieldName)
); );
if (!preg_match('/^[a-z0-9%._+-]+@[a-z0-9.-]+$/', $address) || preg_match('/^\\.|\\.\\.|\\.@|@\\.|\\.$/', $address)) { if (!preg_match('/^[a-z0-9%._+-]+@[a-z0-9%.-]+$/', $address) || preg_match('/^\\.|\\.\\.|\\.@|@\\.|\\.$/', $address)) {
throw new InputValidationError("$fieldName is not valid (must be a valid mail address)."); throw new InputValidationError("$fieldName is not valid (must be a valid mail address).");
} }
return $address; return $address;

View file

@ -45,7 +45,7 @@ class Account
(int)$data['user_id'], (int)$data['user_id'],
$data['username'], $data['username'],
$data['password'], $data['password'],
$data['is_active'] === 1, $data['is_active'] === '1',
$data['home_dir'], $data['home_dir'],
$data['memo'] !== null ? $data['memo'] : '', $data['memo'] !== null ? $data['memo'] : '',
new DateTimeImmutable($data['created_at']), new DateTimeImmutable($data['created_at']),

View file

@ -31,7 +31,7 @@ class AdminUser
(int)$data['admin_id'], (int)$data['admin_id'],
$data['username'], $data['username'],
$data['password'], $data['password'],
$data['is_active'] === 1, $data['is_active'] === '1',
new DateTimeImmutable($data['created_at']), new DateTimeImmutable($data['created_at']),
new DateTimeImmutable($data['modified_at']), new DateTimeImmutable($data['modified_at']),
); );

View file

@ -9,7 +9,7 @@ use PDO;
class AccountRepository extends BaseRepository class AccountRepository extends BaseRepository
{ {
public function fetchAccountList(?string $filterByDomain = null): array public function fetchAccountList(string $filterByDomain = null): array
{ {
$queryWhere = ''; $queryWhere = '';
$queryParams = []; $queryParams = [];