Skip to content

Commit c5efbd8

Browse files
TatevikGrtatevikg1
andauthored
release: dev → main (page data sync, CKEditor uploads, and config updates) (#384)
* remove extra code * syncPageData * load data into page * refactor: restrict getPageData visibility and remove unused setPageData methods * feat: add SubscribePageConfigMigrationService for handling page data migration * After review 0 * feat: add unsubscribe link configuration and implement findPublicPage method * feat: add SubscribePagePlaceholderProcessor * feat: add getByIds method to retrieve and hydrate multiple SubscriberAttributeDefinitions * feat: add extractLegacyOverrides method to process legacy page data * feat: add powered by logo * Feat: config * SubscriberListRepository findById * Fix: make substr safe by checking for false return value * Feat: upload service for ckeditor * Move a few classes around * DirectoryListingService * use application directory for upload * Fix: adjust directory path handling in DirectoryListingService and set default directory in UploadDirectoryValidator * Refactor: introduce DirectoryEntryDto for improved directory listing structure --------- Co-authored-by: Tatevik <tatevikg1@gmail.com>
1 parent 53b1378 commit c5efbd8

58 files changed

Lines changed: 2875 additions & 352 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/parameters.yml.dist

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ parameters:
3535
env(PREFERENCEPAGE_SHOW_PRIVATE_LISTS): '0'
3636
app.rest_api_base_url: '%%env(REST_API_BASE_URL)%%'
3737
env(REST_API_BASE_URL): 'http://api.phplist.local/api/v2'
38+
api_base_url: '%%env(API_BASE_URL)%%'
39+
env(API_BASE_URL): 'http://api.phplist.local/'
3840
app.frontend_base_url: '%%env(FRONT_END_BASE_URL)%%'
3941
env(FRONT_END_BASE_URL): 'http://frontend.phplist.local'
42+
parallel_use_with_phplist3: '%%env(parallel_use_with_phplist3)%%'
43+
env(parallel_use_with_phplist3): '0'
4044

4145
# Email configuration
4246
app.mailer_from: '%%env(MAILER_FROM)%%'
@@ -49,6 +53,8 @@ parameters:
4953
env(SUBSCRIPTION_CONFIRMATION_URL): 'http://api.phplist.local/api/v2/subscription/confirm/'
5054
app.password_reset_url: '%%env(PASSWORD_RESET_URL)%%'
5155
env(PASSWORD_RESET_URL): 'https://example.com/reset/'
56+
app.show_unsubscribe_link: '%%env(SHOW_UNSUBSCRIBELINK)%%'
57+
env(SHOW_UNSUBSCRIBELINK): '1'
5258

5359
# bounce email settings
5460
imap_bounce.email: '%%env(BOUNCE_EMAIL)%%'
@@ -145,10 +151,13 @@ parameters:
145151
phplist.keep_forwarded_attributes: '%%env(KEEPFORWARDERATTRIBUTES)%%'
146152
env(KEEPFORWARDERATTRIBUTES): '0'
147153

148-
phplist.upload_images_dir: '%%env(PHPLIST_UPLOADIMAGES_DIR)%%'
149-
env(PHPLIST_UPLOADIMAGES_DIR): 'images'
150-
phplist.editor_images_dir: '%%env(FCKIMAGES_DIR)%%'
151-
env(FCKIMAGES_DIR): 'uploadimages'
154+
phplist.upload_images_dir: '%%env(UPLOADIMAGES_DIR)%%'
155+
env(UPLOADIMAGES_DIR): 'uploadimages'
156+
phplist.uploads.allowed_mime_types: ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml']
157+
phplist.uploads.allowed_extensions: ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg']
158+
phplist.uploads.max_size: '%%env(PHPLIST_UPLOADS_MAX_SIZE)%%'
159+
env(PHPLIST_UPLOADS_MAX_SIZE): '5M'
160+
152161
phplist.public_schema: '%%env(PUBLIC_SCHEMA)%%'
153162
env(PUBLIC_SCHEMA): 'https'
154163
phplist.attachment_download_url: '%%env(PHPLIST_ATTACHMENT_DOWNLOAD_URL)%%'

config/services/processor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ services:
1919
PhpList\Core\Bounce\Service\Processor\UnidentifiedBounceReprocessor: ~
2020

2121
PhpList\Core\Bounce\Service\Processor\BounceDataProcessor: ~
22+
23+
PhpList\Core\Domain\Subscription\Service\SubscribePagePlaceholderProcessor: ~

config/services/services.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ services:
4343
autoconfigure: true
4444
public: true
4545

46+
PhpList\Core\Domain\Subscription\Service\SubscribePageConfigMigrationService:
47+
autowire: true
48+
autoconfigure: true
49+
50+
PhpList\Core\Domain\Subscription\Service\Manager\SubscribePageManager:
51+
autowire: true
52+
autoconfigure: true
53+
4654
PhpList\Core\Domain\Messaging\Service\MessageProcessingPreparator:
4755
autowire: true
4856
autoconfigure: true
@@ -104,7 +112,7 @@ services:
104112
autoconfigure: true
105113

106114
# External image caching/downloading helper used by TemplateImageEmbedder
107-
PhpList\Core\Domain\Common\ExternalImageService:
115+
PhpList\Core\Domain\Common\Service\ExternalImageService:
108116
autowire: true
109117
autoconfigure: true
110118
arguments:
@@ -259,3 +267,18 @@ services:
259267
$useManualTextPart: '%messaging.use_manual_text_part%'
260268
$uploadImageDir: '%phplist.upload_images_dir%'
261269
$publicSchema: '%phplist.public_schema%'
270+
271+
PhpList\Core\Domain\Common\Service\UploadService:
272+
autowire: true
273+
autoconfigure: true
274+
275+
PhpList\Core\Domain\Common\Service\DirectoryListingService:
276+
autowire: true
277+
autoconfigure: true
278+
279+
PhpList\Core\Domain\Common\Storage\UploadStorageInterface:
280+
alias: PhpList\Core\Domain\Common\Storage\LocalUploadStorage
281+
282+
PhpList\Core\Domain\Common\Storage\LocalUploadStorage:
283+
autowire: true
284+
autoconfigure: true

config/services/validators.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ services:
1010
PhpList\Core\Domain\Subscription\Validator\AttributeTypeValidator:
1111
autowire: true
1212
autoconfigure: true
13+
14+
PhpList\Core\Domain\Common\Validator\UploadValidator:
15+
autowire: true
16+
autoconfigure: true
17+
18+
PhpList\Core\Domain\Common\Validator\UploadDirectoryValidator:
19+
autowire: true
20+
autoconfigure: true

public/power-phplist.png

2.08 KB
Loading

public/uploadimages/.gitkeep

Whitespace-only changes.

src/Domain/Analytics/Service/AnalyticsService.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,9 @@ public function getTopDomains(int $limit = 50, int $minSubscribers = 5): array
153153

154154
$domains = [];
155155
foreach ($subscribers as $subscriber) {
156-
$email = $subscriber->getEmail();
157-
$domain = substr(strrchr($email, '@'), 1) ?: '';
158-
159-
if (!empty($domain)) {
160-
if (!isset($domains[$domain])) {
161-
$domains[$domain] = 0;
162-
}
163-
$domains[$domain]++;
156+
$domain = $this->extractDomain($subscriber->getEmail());
157+
if ($domain !== '') {
158+
$domains[$domain] = ($domains[$domain] ?? 0) + 1;
164159
}
165160
}
166161

@@ -287,12 +282,10 @@ private function calculateChange(float|int $current, float|int $previous): float
287282
public function getDomainConfirmationStatistics(int $limit = 50): array
288283
{
289284
$domains = [];
290-
291285
$subscribers = $this->subscriberRepository->findAll();
292286

293287
foreach ($subscribers as $subscriber) {
294-
$email = $subscriber->getEmail();
295-
$domain = substr(strrchr($email, '@'), 1) ?: '';
288+
$domain = $this->extractDomain($subscriber->getEmail());
296289

297290
if (!empty($domain)) {
298291
if (!isset($domains[$domain])) {
@@ -358,6 +351,19 @@ public function getDomainConfirmationStatistics(int $limit = 50): array
358351
];
359352
}
360353

354+
private function extractDomain(string $email): ?string
355+
{
356+
$atPoint = strrchr($email, '@');
357+
358+
if ($atPoint === false) {
359+
return null;
360+
}
361+
362+
$domain = substr($atPoint, 1);
363+
364+
return $domain !== '' ? $domain : null;
365+
}
366+
361367
private function formatStat(int $count, int $total): int|float
362368
{
363369
$percentage = $total > 0 ? ($count / $total) * 100 : 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Common\Exception;
6+
7+
class InvalidUploadException extends UploadException
8+
{
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Common\Exception;
6+
7+
class MissingUploadException extends UploadException
8+
{
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpList\Core\Domain\Common\Exception;
6+
7+
class StorageException extends UploadException
8+
{
9+
}

0 commit comments

Comments
 (0)