diff --git a/INSTALL.md b/INSTALL.md
index 295c4e74..826458f3 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -7,10 +7,10 @@ or shared hosting, you can install it on most PHP-MySQL compatible web servers.
- [Install instructions](#install-instructions)
- [0. Pre-requisites](#0-pre-requisites)
- - [1. Install Wizard](#1-install-wizard)
- - [1-alt Manual configuration](#1-alt-manual-configuration)
+ - [(recommended) Install Wizard](#recommended-install-wizard)
+ - [(alternative) Manual configuration](#alternative-manual-configuration)
- [Web Server Requirements](#web-server-requirements)
- - [PHP v8.0 or higher](#php-v73-or-higher)
+ - [PHP v8.0 or higher](#php-v80-or-higher)
- [MySQL compatible database](#mysql-compatible-database)
- [Privileges](#privileges)
- [(Optional) Other recommendations](#optional-other-recommendations)
@@ -39,17 +39,20 @@ or shared hosting, you can install it on most PHP-MySQL compatible web servers.
> ⚠️ Social features will not work properly if you do not set the task. It is
> used to broadcast social activities to the fediverse.
-### 1. Install Wizard
+### (recommended) Install Wizard
1. Run the Castopod Host install script by going to the install wizard page
(`https://your_domain_name.com/cp-install`) in your favorite web browser.
2. Follow the instructions on your screen.
3. Start podcasting!
-### 1-alt Manual configuration
+> **Note:**
+>
+> The install script writes a `.env` file in the package root. If you cannot go
+> through the install wizard, you can
+> [create and update the `.env` file manually](#alternative-manual-configuration).
-The install script writes a `.env` file in the package root. If you cannot go
-through the install wizard, you can create and update the `.env` file yourself:
+### (alternative) Manual configuration
1. Rename the `.env.example` file to `.env` and update the default values with
your own.
diff --git a/app/Authorization/FlatAuthorization.php b/app/Authorization/FlatAuthorization.php
index 2e706b64..31d90630 100644
--- a/app/Authorization/FlatAuthorization.php
+++ b/app/Authorization/FlatAuthorization.php
@@ -1,5 +1,7 @@
permissionModel->doesGroupHavePermission($groupId, $permissionId,);
+ return $this->permissionModel->doesGroupHavePermission($groupId, $permissionId);
}
/**
diff --git a/app/Authorization/GroupModel.php b/app/Authorization/GroupModel.php
index f48ab40c..1e2e74a3 100644
--- a/app/Authorization/GroupModel.php
+++ b/app/Authorization/GroupModel.php
@@ -1,5 +1,7 @@
respond();
}
});
@@ -76,47 +78,109 @@ Events::on('logout', function (User $user): void {
* --------------------------------------------------------------------
* ActivityPub events
* --------------------------------------------------------------------
- * Update episode metadata counts
*/
-Events::on('on_note_add', function (Note $note): void {
+/**
+ * @param Actor $actor
+ * @param Actor $targetActor
+ */
+Events::on('on_follow', function ($actor, $targetActor): void {
+ if ($actor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$actor->podcast->id}*");
+ }
+
+ if ($targetActor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$targetActor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$targetActor->podcast->id}*");
+ }
+});
+
+/**
+ * @param Actor $actor
+ * @param Actor $targetActor
+ */
+Events::on('on_undo_follow', function ($actor, $targetActor): void {
+ if ($actor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$actor->podcast->id}*");
+ }
+
+ if ($targetActor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$targetActor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$targetActor->podcast->id}*");
+ }
+});
+
+/**
+ * @param Note $note
+ */
+Events::on('on_note_add', function ($note): void {
+ if ($note->is_reply) {
+ $note = $note->reply_to_note;
+ }
+
if ($note->episode_id) {
model('EpisodeModel')
->where('id', $note->episode_id)
->increment('notes_total');
}
- // Removing all of the podcast pages is a bit overkill, but works perfectly
- // same for other events below
- cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
- cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ if ($note->actor->is_podcast) {
+ // Removing all of the podcast pages is a bit overkill, but works to avoid caching bugs
+ // same for other events below
+ cache()
+ ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ }
});
-Events::on('on_note_remove', function (Note $note): void {
- if ($note->episode_id) {
+/**
+ * @param Note $note
+ */
+Events::on('on_note_remove', function ($note): void {
+ if ($note->is_reply) {
+ Events::trigger('on_note_remove', $note->reply_to_note);
+ }
+
+ if ($episodeId = $note->episode_id) {
model('EpisodeModel')
- ->where('id', $note->episode_id)
+ ->where('id', $episodeId)
->decrement('notes_total', 1 + $note->reblogs_count);
model('EpisodeModel')
- ->where('id', $note->episode_id)
+ ->where('id', $episodeId)
->decrement('reblogs_total', $note->reblogs_count);
model('EpisodeModel')
- ->where('id', $note->episode_id)
+ ->where('id', $episodeId)
->decrement('favourites_total', $note->favourites_count);
}
- cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
- cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ if ($note->actor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ }
+
cache()
->deleteMatching("page_note#{$note->id}*");
});
-Events::on('on_note_reblog', function (Actor $actor, Note $note): void {
+/**
+ * @param Actor $actor
+ * @param Note $note
+ */
+Events::on('on_note_reblog', function ($actor, $note): void {
if ($episodeId = $note->episode_id) {
model('EpisodeModel')
->where('id', $episodeId)
@@ -127,19 +191,31 @@ Events::on('on_note_reblog', function (Actor $actor, Note $note): void {
->increment('notes_total');
}
- cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
- cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ if ($note->actor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ }
+
+ if ($actor->is_podcast) {
+ cache()->deleteMatching("podcast#{$actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$actor->podcast->id}*");
+ }
+
cache()
->deleteMatching("page_note#{$note->id}*");
- if ($actor->is_podcast) {
- cache()->deleteMatching("page_podcast#{$actor->podcast->id}*");
+ if ($note->is_reply) {
+ cache()->deleteMatching("page_note#{$note->in_reply_to_id}");
}
});
-Events::on('on_note_undo_reblog', function (Note $reblogNote): void {
+/**
+ * @param Note $reblogNote
+ */
+Events::on('on_note_undo_reblog', function ($reblogNote): void {
$note = $reblogNote->reblog_of_note;
if ($episodeId = $note->episode_id) {
model('EpisodeModel')
@@ -151,74 +227,128 @@ Events::on('on_note_undo_reblog', function (Note $reblogNote): void {
->decrement('notes_total');
}
- cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
- cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ if ($note->actor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ }
+
cache()
->deleteMatching("page_note#{$note->id}*");
+ cache()
+ ->deleteMatching("page_note#{$reblogNote->id}*");
+
+ if ($note->is_reply) {
+ cache()->deleteMatching("page_note#{$note->in_reply_to_id}");
+ }
if ($reblogNote->actor->is_podcast) {
- cache()->deleteMatching("page_podcast#{$reblogNote->actor->podcast->id}*",);
+ cache()
+ ->deleteMatching("podcast#{$reblogNote->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$reblogNote->actor->podcast->id}*");
}
});
-Events::on('on_note_reply', function (Note $reply): void {
+/**
+ * @param Note $reply
+ */
+Events::on('on_note_reply', function ($reply): void {
$note = $reply->reply_to_note;
- cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ if ($note->actor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ }
+
cache()
->deleteMatching("page_note#{$note->id}*");
});
-Events::on('on_reply_remove', function (Note $reply): void {
+/**
+ * @param Note $reply
+ */
+Events::on('on_reply_remove', function ($reply): void {
$note = $reply->reply_to_note;
- cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
- cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ if ($note->actor->is_podcast) {
+ cache()
+ ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ }
+
cache()
->deleteMatching("page_note#{$note->id}*");
+ cache()
+ ->deleteMatching("page_note#{$reply->id}*");
});
-Events::on('on_note_favourite', function (Actor $actor, Note $note): void {
+/**
+ * @param Actor $actor
+ * @param Note $note
+ */
+Events::on('on_note_favourite', function ($actor, $note): void {
if ($note->episode_id) {
model('EpisodeModel')
->where('id', $note->episode_id)
->increment('favourites_total');
}
- cache()
- ->deleteMatching("page_podcast#{$actor->podcast->id}*");
- cache()
- ->deleteMatching("podcast#{$actor->podcast->id}*");
+ if ($note->actor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ }
+
cache()
->deleteMatching("page_note#{$note->id}*");
- if ($note->in_reply_to_id) {
+ if ($note->is_reply) {
cache()->deleteMatching("page_note#{$note->in_reply_to_id}*");
}
+
+ if ($actor->is_podcast) {
+ cache()->deleteMatching("podcast#{$actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$actor->podcast->id}*");
+ }
});
-Events::on('on_note_undo_favourite', function (Actor $actor, Note $note): void {
+/**
+ * @param Actor $actor
+ * @param Note $note
+ */
+Events::on('on_note_undo_favourite', function ($actor, $note): void {
if ($note->episode_id) {
model('EpisodeModel')
->where('id', $note->episode_id)
->decrement('favourites_total');
}
- cache()
- ->deleteMatching("page_podcast#{$actor->podcast->id}*");
- cache()
- ->deleteMatching("podcast#{$actor->podcast->id}*");
+ if ($note->actor->is_podcast) {
+ cache()
+ ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ }
+
cache()
->deleteMatching("page_note#{$note->id}*");
- if ($note->in_reply_to_id) {
+ if ($note->is_reply) {
cache()->deleteMatching("page_note#{$note->in_reply_to_id}*");
}
+
+ if ($actor->is_podcast) {
+ cache()->deleteMatching("podcast#{$actor->podcast->id}*");
+ cache()
+ ->deleteMatching("page_podcast#{$actor->podcast->id}*");
+ }
});
Events::on('on_block_actor', function (int $actorId): void {
diff --git a/app/Config/Exceptions.php b/app/Config/Exceptions.php
index f264eee9..84f48647 100644
--- a/app/Config/Exceptions.php
+++ b/app/Config/Exceptions.php
@@ -1,5 +1,7 @@
addPlaceholder('slug', '[a-zA-Z0-9\-]{1,191}');
$routes->addPlaceholder('base64', '[A-Za-z0-9\.\_]+\-{0,2}');
$routes->addPlaceholder('platformType', '\bpodcasting|\bsocial|\bfunding');
$routes->addPlaceholder('noteAction', '\bfavourite|\breblog|\breply');
-$routes->addPlaceholder('embeddablePlayerTheme', '\blight|\bdark|\blight-transparent|\bdark-transparent',);
+$routes->addPlaceholder('embeddablePlayerTheme', '\blight|\bdark|\blight-transparent|\bdark-transparent');
$routes->addPlaceholder(
'uuid',
'[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}',
@@ -59,10 +61,10 @@ $routes->group(config('App')->installGateway, function ($routes): void {
]);
$routes->post('instance-config', 'InstallController::attemptInstanceConfig', [
'as' => 'instance-config',
- ],);
+ ]);
$routes->post('database-config', 'InstallController::attemptDatabaseConfig', [
'as' => 'database-config',
- ],);
+ ]);
$routes->post('cache-config', 'InstallController::attemptCacheConfig', [
'as' => 'cache-config',
]);
@@ -626,7 +628,7 @@ $routes->group(
'as' => 'change-password',
],
);
- $routes->post('change-password', 'MyAccountController::attemptChange/$1',);
+ $routes->post('change-password', 'MyAccountController::attemptChange/$1');
});
},
);
diff --git a/app/Config/Security.php b/app/Config/Security.php
index d0f31414..9334bbe9 100644
--- a/app/Config/Security.php
+++ b/app/Config/Security.php
@@ -1,5 +1,7 @@
registerPodcastWebpageHit($this->actor->podcast->id);
}
diff --git a/app/Controllers/Admin/BaseController.php b/app/Controllers/Admin/BaseController.php
index 207698fa..a5629f25 100644
--- a/app/Controllers/Admin/BaseController.php
+++ b/app/Controllers/Admin/BaseController.php
@@ -1,5 +1,7 @@
transcript_file = $transcriptFile;
} elseif ($transcriptChoice === 'remote-url') {
- $newEpisode->transcript_file_remote_url = $this->request->getPost('transcript_file_remote_url',);
+ $newEpisode->transcript_file_remote_url = $this->request->getPost('transcript_file_remote_url');
}
$chaptersChoice = $this->request->getPost('chapters-choice');
@@ -171,7 +173,7 @@ class EpisodeController extends BaseController
) {
$newEpisode->chapters_file = $chaptersFile;
} elseif ($chaptersChoice === 'remote-url') {
- $newEpisode->chapters_file_remote_url = $this->request->getPost('chapters_file_remote_url',);
+ $newEpisode->chapters_file_remote_url = $this->request->getPost('chapters_file_remote_url');
}
$episodeModel = new EpisodeModel();
@@ -187,7 +189,7 @@ class EpisodeController extends BaseController
$podcastModel = new PodcastModel();
if ($this->podcast->hasChanged('episode_description_footer_markdown')) {
- $this->podcast->episode_description_footer_markdown = $this->request->getPost('description_footer',);
+ $this->podcast->episode_description_footer_markdown = $this->request->getPost('description_footer');
if (! $podcastModel->update($this->podcast->id, $this->podcast)) {
return redirect()
@@ -237,8 +239,8 @@ class EpisodeController extends BaseController
$this->episode->title = $this->request->getPost('title');
$this->episode->slug = $this->request->getPost('slug');
- $this->episode->description_markdown = $this->request->getPost('description',);
- $this->episode->location = new Location($this->request->getPost('location_name'),);
+ $this->episode->description_markdown = $this->request->getPost('description');
+ $this->episode->location = new Location($this->request->getPost('location_name'));
$this->episode->parental_advisory =
$this->request->getPost('parental_advisory') !== 'undefined'
? $this->request->getPost('parental_advisory')
@@ -251,7 +253,7 @@ class EpisodeController extends BaseController
: null;
$this->episode->type = $this->request->getPost('type');
$this->episode->is_blocked = $this->request->getPost('block') === 'yes';
- $this->episode->custom_rss_string = $this->request->getPost('custom_rss',);
+ $this->episode->custom_rss_string = $this->request->getPost('custom_rss');
$this->episode->updated_by = (int) user_id();
@@ -278,7 +280,7 @@ class EpisodeController extends BaseController
(($transcriptFile = $this->episode->transcript_file) &&
$transcriptFile !== null)
) {
- unlink($transcriptFile);
+ unlink((string) $transcriptFile);
$this->episode->transcript_file_path = null;
}
$this->episode->transcript_file_remote_url = $transcriptFileRemoteUrl;
@@ -297,7 +299,7 @@ class EpisodeController extends BaseController
(($chaptersFile = $this->episode->chapters_file) &&
$chaptersFile !== null)
) {
- unlink($chaptersFile);
+ unlink((string) $chaptersFile);
$this->episode->chapters_file_path = null;
}
$this->episode->chapters_file_remote_url = $chaptersFileRemoteUrl;
@@ -313,7 +315,7 @@ class EpisodeController extends BaseController
}
// update podcast's episode_description_footer_markdown if changed
- $this->podcast->episode_description_footer_markdown = $this->request->getPost('description_footer',);
+ $this->podcast->episode_description_footer_markdown = $this->request->getPost('description_footer');
if ($this->podcast->hasChanged('episode_description_footer_markdown')) {
$podcastModel = new PodcastModel();
@@ -330,7 +332,7 @@ class EpisodeController extends BaseController
public function transcriptDelete(): RedirectResponse
{
- unlink($this->episode->transcript_file);
+ unlink((string) $this->episode->transcript_file);
$this->episode->transcript_file_path = null;
$episodeModel = new EpisodeModel();
@@ -347,7 +349,7 @@ class EpisodeController extends BaseController
public function chaptersDelete(): RedirectResponse
{
- unlink($this->episode->chapters_file);
+ unlink((string) $this->episode->chapters_file);
$this->episode->chapters_file_path = null;
$episodeModel = new EpisodeModel();
@@ -409,7 +411,7 @@ class EpisodeController extends BaseController
$publishMethod = $this->request->getPost('publication_method');
if ($publishMethod === 'schedule') {
- $scheduledPublicationDate = $this->request->getPost('scheduled_publication_date',);
+ $scheduledPublicationDate = $this->request->getPost('scheduled_publication_date');
if ($scheduledPublicationDate) {
$this->episode->published_at = Time::createFromFormat(
'Y-m-d H:i',
@@ -498,7 +500,7 @@ class EpisodeController extends BaseController
$publishMethod = $this->request->getPost('publication_method');
if ($publishMethod === 'schedule') {
- $scheduledPublicationDate = $this->request->getPost('scheduled_publication_date',);
+ $scheduledPublicationDate = $this->request->getPost('scheduled_publication_date');
if ($scheduledPublicationDate) {
$this->episode->published_at = Time::createFromFormat(
'Y-m-d H:i',
@@ -516,7 +518,7 @@ class EpisodeController extends BaseController
$this->episode->published_at = Time::now();
}
- $note = (new NoteModel())->getNoteById($this->request->getPost('note_id'),);
+ $note = (new NoteModel())->getNoteById($this->request->getPost('note_id'));
if ($note !== null) {
$note->message = $this->request->getPost('message');
@@ -688,7 +690,7 @@ class EpisodeController extends BaseController
public function soundbiteDelete(int $soundbiteId): RedirectResponse
{
- (new SoundbiteModel())->deleteSoundbite($this->podcast->id, $this->episode->id, $soundbiteId,);
+ (new SoundbiteModel())->deleteSoundbite($this->podcast->id, $this->episode->id, $soundbiteId);
return redirect()->route('soundbites-edit', [$this->podcast->id, $this->episode->id]);
}
diff --git a/app/Controllers/Admin/EpisodePersonController.php b/app/Controllers/Admin/EpisodePersonController.php
index 4257bef2..50289a7a 100644
--- a/app/Controllers/Admin/EpisodePersonController.php
+++ b/app/Controllers/Admin/EpisodePersonController.php
@@ -1,5 +1,7 @@
removePersonFromEpisode($this->podcast->id, $this->episode->id, $personId,);
+ (new PersonModel())->removePersonFromEpisode($this->podcast->id, $this->episode->id, $personId);
return redirect()->back();
}
diff --git a/app/Controllers/Admin/FediverseController.php b/app/Controllers/Admin/FediverseController.php
index 29a5188d..a51dc095 100644
--- a/app/Controllers/Admin/FediverseController.php
+++ b/app/Controllers/Admin/FediverseController.php
@@ -1,5 +1,7 @@
route('page-list')
->with('message', lang('Page.messages.createSuccess', [
'pageTitle' => $page->title,
- ]),);
+ ]));
}
public function edit(): string
diff --git a/app/Controllers/Admin/PersonController.php b/app/Controllers/Admin/PersonController.php
index 7de6ae42..d8cb6bca 100644
--- a/app/Controllers/Admin/PersonController.php
+++ b/app/Controllers/Admin/PersonController.php
@@ -1,5 +1,7 @@
person->full_name = $this->request->getPost('full_name');
$this->person->unique_name = $this->request->getPost('unique_name');
- $this->person->information_url = $this->request->getPost('information_url',);
+ $this->person->information_url = $this->request->getPost('information_url');
$imageFile = $this->request->getFile('image');
if ($imageFile !== null && $imageFile->isValid()) {
$this->person->image = new Image($imageFile);
diff --git a/app/Controllers/Admin/PodcastController.php b/app/Controllers/Admin/PodcastController.php
index 47717682..f68ef5e3 100644
--- a/app/Controllers/Admin/PodcastController.php
+++ b/app/Controllers/Admin/PodcastController.php
@@ -1,5 +1,7 @@
group('podcast_admin');
- $podcastModel->addPodcastContributor(user_id(), $newPodcastId, $podcastAdminGroup->id,);
+ $podcastModel->addPodcastContributor(user_id(), $newPodcastId, $podcastAdminGroup->id);
// set Podcast categories
(new CategoryModel())->setPodcastCategories(
@@ -276,7 +278,7 @@ class PodcastController extends BaseController
}
$this->podcast->title = $this->request->getPost('title');
- $this->podcast->description_markdown = $this->request->getPost('description',);
+ $this->podcast->description_markdown = $this->request->getPost('description');
$image = $this->request->getFile('image');
if ($image !== null && $image->isValid()) {
@@ -293,12 +295,12 @@ class PodcastController extends BaseController
$this->podcast->owner_email = $this->request->getPost('owner_email');
$this->podcast->type = $this->request->getPost('type');
$this->podcast->copyright = $this->request->getPost('copyright');
- $this->podcast->location = new Location($this->request->getPost('location_name'),);
- $this->podcast->payment_pointer = $this->request->getPost('payment_pointer',);
- $this->podcast->custom_rss_string = $this->request->getPost('custom_rss',);
+ $this->podcast->location = new Location($this->request->getPost('location_name'));
+ $this->podcast->payment_pointer = $this->request->getPost('payment_pointer');
+ $this->podcast->custom_rss_string = $this->request->getPost('custom_rss');
$this->podcast->partner_id = $this->request->getPost('partner_id');
- $this->podcast->partner_link_url = $this->request->getPost('partner_link_url',);
- $this->podcast->partner_image_url = $this->request->getPost('partner_image_url',);
+ $this->podcast->partner_link_url = $this->request->getPost('partner_link_url');
+ $this->podcast->partner_image_url = $this->request->getPost('partner_image_url');
$this->podcast->is_blocked = $this->request->getPost('block') === 'yes';
$this->podcast->is_completed =
$this->request->getPost('complete') === 'yes';
diff --git a/app/Controllers/Admin/PodcastImportController.php b/app/Controllers/Admin/PodcastImportController.php
index 1f669a2a..a7962f96 100644
--- a/app/Controllers/Admin/PodcastImportController.php
+++ b/app/Controllers/Admin/PodcastImportController.php
@@ -1,5 +1,7 @@
request->getPost('imported_feed_url'),);
+ $feed = simplexml_load_file($this->request->getPost('imported_feed_url'));
} catch (ErrorException $errorException) {
return redirect()
->back()
@@ -92,11 +94,11 @@ class PodcastImportController extends BaseController
' ⎋',
]);
}
- $nsItunes = $feed->channel[0]->children('http://www.itunes.com/dtds/podcast-1.0.dtd',);
+ $nsItunes = $feed->channel[0]->children('http://www.itunes.com/dtds/podcast-1.0.dtd');
$nsPodcast = $feed->channel[0]->children(
'https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md',
);
- $nsContent = $feed->channel[0]->children('http://purl.org/rss/1.0/modules/content/',);
+ $nsContent = $feed->channel[0]->children('http://purl.org/rss/1.0/modules/content/');
if ((string) $nsPodcast->locked === 'yes') {
return redirect()
@@ -114,9 +116,9 @@ class PodcastImportController extends BaseController
property_exists($nsItunes, 'image') && $nsItunes->image !== null &&
$nsItunes->image->attributes()['href'] !== null
) {
- $imageFile = download_file((string) $nsItunes->image->attributes()['href'],);
+ $imageFile = download_file((string) $nsItunes->image->attributes()['href']);
} else {
- $imageFile = download_file((string) $feed->channel[0]->image->url,);
+ $imageFile = download_file((string) $feed->channel[0]->image->url);
}
$location = null;
@@ -195,7 +197,7 @@ class PodcastImportController extends BaseController
$authorize = Services::authorization();
$podcastAdminGroup = $authorize->group('podcast_admin');
- $podcastModel->addPodcastContributor(user_id(), $newPodcastId, $podcastAdminGroup->id,);
+ $podcastModel->addPodcastContributor(user_id(), $newPodcastId, $podcastAdminGroup->id);
$podcastsPlatformsData = [];
$platformTypes = [
@@ -230,7 +232,7 @@ class PodcastImportController extends BaseController
}
if (count($podcastsPlatformsData) > 1) {
- $platformModel->createPodcastPlatforms($newPodcastId, $podcastsPlatformsData,);
+ $platformModel->createPodcastPlatforms($newPodcastId, $podcastsPlatformsData);
}
foreach ($nsPodcast->person as $podcastPerson) {
@@ -291,11 +293,11 @@ class PodcastImportController extends BaseController
for ($itemNumber = 1; $itemNumber <= $lastItem; ++$itemNumber) {
$item = $feed->channel[0]->item[$numberItems - $itemNumber];
- $nsItunes = $item->children('http://www.itunes.com/dtds/podcast-1.0.dtd',);
+ $nsItunes = $item->children('http://www.itunes.com/dtds/podcast-1.0.dtd');
$nsPodcast = $item->children(
'https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md',
);
- $nsContent = $item->children('http://purl.org/rss/1.0/modules/content/',);
+ $nsContent = $item->children('http://purl.org/rss/1.0/modules/content/');
$slug = slugify(
$this->request->getPost('slug_field') === 'title'
@@ -321,7 +323,7 @@ class PodcastImportController extends BaseController
property_exists($nsItunes, 'image') && $nsItunes->image !== null &&
$nsItunes->image->attributes()['href'] !== null
) {
- $episodeImage = new Image(download_file((string) $nsItunes->image->attributes()['href'],),);
+ $episodeImage = new Image(download_file((string) $nsItunes->image->attributes()['href'],));
} else {
$episodeImage = null;
}
diff --git a/app/Controllers/Admin/PodcastPersonController.php b/app/Controllers/Admin/PodcastPersonController.php
index cd4c5a36..8bab93ba 100644
--- a/app/Controllers/Admin/PodcastPersonController.php
+++ b/app/Controllers/Admin/PodcastPersonController.php
@@ -1,5 +1,7 @@
removePersonFromPodcast($this->podcast->id, $personId,);
+ (new PersonModel())->removePersonFromPodcast($this->podcast->id, $personId);
return redirect()->back();
}
diff --git a/app/Controllers/Admin/PodcastPlatformController.php b/app/Controllers/Admin/PodcastPlatformController.php
index 7a38a8ba..a8ed9dde 100644
--- a/app/Controllers/Admin/PodcastPlatformController.php
+++ b/app/Controllers/Admin/PodcastPlatformController.php
@@ -1,5 +1,7 @@
with('message', lang('Platforms.messages.updateSuccess'));
}
- $platformModel->savePodcastPlatforms($this->podcast->id, $platformType, $podcastsPlatformsData,);
+ $platformModel->savePodcastPlatforms($this->podcast->id, $platformType, $podcastsPlatformsData);
return redirect()
->back()
@@ -102,7 +104,7 @@ class PodcastPlatformController extends BaseController
public function removePodcastPlatform(string $platformSlug): RedirectResponse
{
- (new PlatformModel())->removePodcastPlatform($this->podcast->id, $platformSlug,);
+ (new PlatformModel())->removePodcastPlatform($this->podcast->id, $platformSlug);
return redirect()
->back()
diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php
index 185dc156..f6b5096b 100644
--- a/app/Controllers/Admin/UserController.php
+++ b/app/Controllers/Admin/UserController.php
@@ -1,5 +1,7 @@
route('user-list')
->with('message', lang('User.messages.createSuccess', [
'username' => $user->username,
- ]),);
+ ]));
}
public function edit(): string
@@ -148,7 +150,7 @@ class UserController extends BaseController
->route('user-list')
->with('message', lang('User.messages.rolesEditSuccess', [
'username' => $this->user->username,
- ]),);
+ ]));
}
public function forcePassReset(): RedirectResponse
@@ -200,7 +202,7 @@ class UserController extends BaseController
->route('user-list')
->with('message', lang('User.messages.banSuccess', [
'username' => $this->user->username,
- ]),);
+ ]));
}
public function unBan(): RedirectResponse
@@ -218,7 +220,7 @@ class UserController extends BaseController
->route('user-list')
->with('message', lang('User.messages.unbanSuccess', [
'username' => $this->user->username,
- ]),);
+ ]));
}
public function delete(): RedirectResponse
@@ -240,6 +242,6 @@ class UserController extends BaseController
->back()
->with('message', lang('User.messages.deleteSuccess', [
'username' => $this->user->username,
- ]),);
+ ]));
}
}
diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php
index fad88706..9160453a 100644
--- a/app/Controllers/AuthController.php
+++ b/app/Controllers/AuthController.php
@@ -1,5 +1,7 @@
config->validFields, $this->config->personalFields,);
+ $allowedPostFields = array_merge(['password'], $this->config->validFields, $this->config->personalFields);
$user = new User($this->request->getPost($allowedPostFields));
$this->config->requireActivation === null
@@ -80,7 +82,7 @@ class AuthController extends MythAuthController
return redirect()
->back()
->withInput()
- ->with('error', $activator->error() ?? lang('Auth.unknownError'),);
+ ->with('error', $activator->error() ?? lang('Auth.unknownError'));
}
// Success!
diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php
index c3320c05..b76cf7b2 100644
--- a/app/Controllers/BaseController.php
+++ b/app/Controllers/BaseController.php
@@ -1,5 +1,7 @@
start();
if (isset($_SERVER['HTTP_REFERER'])) {
- $session->set('embeddable_player_domain', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST),);
+ $session->set('embeddable_player_domain', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST));
}
$locale = service('request')
@@ -159,7 +161,7 @@ class EpisodeController extends BaseController
public function oembedXML(): ResponseInterface
{
- $oembed = new SimpleXMLElement("",);
+ $oembed = new SimpleXMLElement("");
$oembed->addChild('type', 'rich');
$oembed->addChild('version', '1.0');
@@ -182,6 +184,6 @@ class EpisodeController extends BaseController
$oembed->addChild('width', '600');
$oembed->addChild('height', '200');
- return $this->response->setXML($oembed);
+ return $this->response->setXML((string) $oembed);
}
}
diff --git a/app/Controllers/FeedController.php b/app/Controllers/FeedController.php
index 3fca2376..ab0d26a4 100644
--- a/app/Controllers/FeedController.php
+++ b/app/Controllers/FeedController.php
@@ -1,5 +1,7 @@
getMessage());
}
- $serviceSlug = null;
+ $serviceSlug = '';
if ($service) {
$serviceSlug = $service['slug'];
}
diff --git a/app/Controllers/HomeController.php b/app/Controllers/HomeController.php
index 99e4d2bc..26c7e480 100644
--- a/app/Controllers/HomeController.php
+++ b/app/Controllers/HomeController.php
@@ -1,5 +1,7 @@
setFlashdata('error', lang('Install.messages.databaseConnectError'),);
+ ->setFlashdata('error', lang('Install.messages.databaseConnectError'));
return view('install/database_config');
}
@@ -171,7 +173,7 @@ class InstallController extends Controller
helper('text');
// redirect to full install url with new baseUrl input
- return redirect()->to(reduce_double_slashes($baseUrl . '/' . config('App')->installGateway,),);
+ return redirect()->to(reduce_double_slashes($baseUrl . '/' . config('App')->installGateway,));
}
public function databaseConfig(): string
diff --git a/app/Controllers/NoteController.php b/app/Controllers/NoteController.php
index 35c1fd08..90524b54 100644
--- a/app/Controllers/NoteController.php
+++ b/app/Controllers/NoteController.php
@@ -1,5 +1,7 @@
1 &&
- ! ($this->note = model('NoteModel')->getNoteById($params[1]))
+ ! ($this->note = (new NoteModel())->getNoteById($params[1]))
) {
throw PageNotFoundException::forPageNotFound();
}
@@ -129,14 +132,15 @@ class NoteController extends ActivityPubNoteController
$newNote->message = $message;
+ $noteModel = new NoteModel();
if (
- ! model('NoteModel')
+ ! $noteModel
->addNote($newNote, ! (bool) $newNote->episode_id, true,)
) {
return redirect()
->back()
->withInput()
- ->with('errors', model('NoteModel')->errors());
+ ->with('errors', $noteModel->errors());
}
// Note has been successfully created
@@ -164,11 +168,12 @@ class NoteController extends ActivityPubNoteController
'created_by' => user_id(),
]);
- if (! model('NoteModel')->addReply($newNote)) {
+ $noteModel = new NoteModel();
+ if (! $noteModel->addReply($newNote)) {
return redirect()
->back()
->withInput()
- ->with('errors', model('NoteModel')->errors());
+ ->with('errors', $noteModel->errors());
}
// Reply note without preview card has been successfully created
@@ -177,14 +182,14 @@ class NoteController extends ActivityPubNoteController
public function attemptFavourite(): RedirectResponse
{
- model('FavouriteModel')->toggleFavourite(interact_as_actor(), $this->note,);
+ model('FavouriteModel')->toggleFavourite(interact_as_actor(), $this->note);
return redirect()->back();
}
public function attemptReblog(): RedirectResponse
{
- model('NoteModel')->toggleReblog(interact_as_actor(), $this->note);
+ (new NoteModel())->toggleReblog(interact_as_actor(), $this->note);
return redirect()->back();
}
diff --git a/app/Controllers/PageController.php b/app/Controllers/PageController.php
index d3476ecc..499dabd0 100644
--- a/app/Controllers/PageController.php
+++ b/app/Controllers/PageController.php
@@ -1,5 +1,7 @@
request->getGet('season');
if (! $yearQuery && ! $seasonQuery) {
- $defaultQuery = (new PodcastModel())->getDefaultQuery($this->podcast->id,);
+ $defaultQuery = (new PodcastModel())->getDefaultQuery($this->podcast->id);
if ($defaultQuery) {
if ($defaultQuery['type'] === 'season') {
$seasonQuery = $defaultQuery['data']['season_number'];
diff --git a/app/Database/Migrations/2017-12-01-160000_add_podcasts_platforms.php b/app/Database/Migrations/2017-12-01-160000_add_podcasts_platforms.php
index d65ca3e9..70180803 100644
--- a/app/Database/Migrations/2017-12-01-160000_add_podcasts_platforms.php
+++ b/app/Database/Migrations/2017-12-01-160000_add_podcasts_platforms.php
@@ -1,5 +1,7 @@
forge->addUniqueKey('name');
$this->forge->addUniqueKey('actor_id');
- $this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE',);
+ $this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
$this->forge->addForeignKey('category_id', 'categories', 'id');
$this->forge->addForeignKey('language_code', 'languages', 'code');
$this->forge->addForeignKey('created_by', 'users', 'id');
diff --git a/app/Database/Migrations/2020-06-05-170000_add_episodes.php b/app/Database/Migrations/2020-06-05-170000_add_episodes.php
index b65a09b9..e54794a6 100644
--- a/app/Database/Migrations/2020-06-05-170000_add_episodes.php
+++ b/app/Database/Migrations/2020-06-05-170000_add_episodes.php
@@ -1,5 +1,7 @@
forge->addPrimaryKey('id');
$this->forge->addUniqueKey(['podcast_id', 'slug']);
- $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE',);
+ $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE');
$this->forge->addForeignKey('created_by', 'users', 'id');
$this->forge->addForeignKey('updated_by', 'users', 'id');
$this->forge->createTable('episodes');
diff --git a/app/Database/Migrations/2020-06-05-180000_add_soundbites.php b/app/Database/Migrations/2020-06-05-180000_add_soundbites.php
index 68eecadc..cf20ee1d 100644
--- a/app/Database/Migrations/2020-06-05-180000_add_soundbites.php
+++ b/app/Database/Migrations/2020-06-05-180000_add_soundbites.php
@@ -1,5 +1,7 @@
forge->addKey('id', true);
$this->forge->addUniqueKey(['episode_id', 'start_time', 'duration']);
- $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE',);
- $this->forge->addForeignKey('episode_id', 'episodes', 'id', '', 'CASCADE',);
+ $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('episode_id', 'episodes', 'id', '', 'CASCADE');
$this->forge->addForeignKey('created_by', 'users', 'id');
$this->forge->addForeignKey('updated_by', 'users', 'id');
$this->forge->createTable('soundbites');
diff --git a/app/Database/Migrations/2020-06-05-190000_add_platforms.php b/app/Database/Migrations/2020-06-05-190000_add_platforms.php
index 4bb7ba80..24dec943 100644
--- a/app/Database/Migrations/2020-06-05-190000_add_platforms.php
+++ b/app/Database/Migrations/2020-06-05-190000_add_platforms.php
@@ -1,5 +1,7 @@
forge->addField('`created_at` timestamp NOT NULL DEFAULT NOW()');
- $this->forge->addField('`updated_at` timestamp NOT NULL DEFAULT NOW() ON UPDATE NOW()',);
+ $this->forge->addField('`updated_at` timestamp NOT NULL DEFAULT NOW() ON UPDATE NOW()');
$this->forge->addPrimaryKey('slug');
$this->forge->createTable('platforms');
}
diff --git a/app/Database/Migrations/2020-07-03-191500_add_podcasts_users.php b/app/Database/Migrations/2020-07-03-191500_add_podcasts_users.php
index 18ca8dd0..75810948 100644
--- a/app/Database/Migrations/2020-07-03-191500_add_podcasts_users.php
+++ b/app/Database/Migrations/2020-07-03-191500_add_podcasts_users.php
@@ -1,5 +1,7 @@
forge->addPrimaryKey(['user_id', 'podcast_id']);
$this->forge->addForeignKey('user_id', 'users', 'id', '', 'CASCADE');
- $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE',);
- $this->forge->addForeignKey('group_id', 'auth_groups', 'id', '', 'CASCADE',);
+ $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('group_id', 'auth_groups', 'id', '', 'CASCADE');
$this->forge->createTable('podcasts_users');
}
diff --git a/app/Database/Migrations/2020-08-17-150000_add_pages.php b/app/Database/Migrations/2020-08-17-150000_add_pages.php
index 6ee21b07..cee4ef58 100644
--- a/app/Database/Migrations/2020-08-17-150000_add_pages.php
+++ b/app/Database/Migrations/2020-08-17-150000_add_pages.php
@@ -1,5 +1,7 @@
forge->addPrimaryKey(['podcast_id', 'category_id']);
- $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE',);
- $this->forge->addForeignKey('category_id', 'categories', 'id', '', 'CASCADE',);
+ $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('category_id', 'categories', 'id', '', 'CASCADE');
$this->forge->createTable('podcasts_categories');
}
diff --git a/app/Database/Migrations/2020-12-25-120000_add_persons.php b/app/Database/Migrations/2020-12-25-120000_add_persons.php
index c7953010..3067905b 100644
--- a/app/Database/Migrations/2020-12-25-120000_add_persons.php
+++ b/app/Database/Migrations/2020-12-25-120000_add_persons.php
@@ -1,5 +1,7 @@
forge->addKey('id', true);
$this->forge->addUniqueKey(['podcast_id', 'person_id', 'person_group', 'person_role']);
- $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE',);
- $this->forge->addForeignKey('person_id', 'persons', 'id', '', 'CASCADE',);
+ $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('person_id', 'persons', 'id', '', 'CASCADE');
$this->forge->createTable('podcasts_persons');
}
diff --git a/app/Database/Migrations/2020-12-25-140000_add_episodes_persons.php b/app/Database/Migrations/2020-12-25-140000_add_episodes_persons.php
index 74ef6bca..c52f8c15 100644
--- a/app/Database/Migrations/2020-12-25-140000_add_episodes_persons.php
+++ b/app/Database/Migrations/2020-12-25-140000_add_episodes_persons.php
@@ -1,5 +1,7 @@
forge->addPrimaryKey('id');
$this->forge->addUniqueKey(['podcast_id', 'episode_id', 'person_id', 'person_group', 'person_role']);
- $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE',);
- $this->forge->addForeignKey('episode_id', 'episodes', 'id', '', 'CASCADE',);
- $this->forge->addForeignKey('person_id', 'persons', 'id', '', 'CASCADE',);
+ $this->forge->addForeignKey('podcast_id', 'podcasts', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('episode_id', 'episodes', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('person_id', 'persons', 'id', '', 'CASCADE');
$this->forge->createTable('episodes_persons');
}
diff --git a/app/Database/Migrations/2020-12-25-150000_add_credit_view.php b/app/Database/Migrations/2020-12-25-150000_add_credit_view.php
index ee61e0f2..11029be2 100644
--- a/app/Database/Migrations/2020-12-25-150000_add_credit_view.php
+++ b/app/Database/Migrations/2020-12-25-150000_add_credit_view.php
@@ -1,5 +1,7 @@
forge->dropForeignKey('activitypub_notes', 'activitypub_notes_episode_id_foreign',);
+ $this->forge->dropForeignKey('activitypub_notes', 'activitypub_notes_episode_id_foreign');
$this->forge->dropColumn('activitypub_notes', 'episode_id');
}
}
diff --git a/app/Database/Migrations/2021-03-09-113000_add_created_by_to_notes.php b/app/Database/Migrations/2021-03-09-113000_add_created_by_to_notes.php
index 035a2b57..496bf902 100644
--- a/app/Database/Migrations/2021-03-09-113000_add_created_by_to_notes.php
+++ b/app/Database/Migrations/2021-03-09-113000_add_created_by_to_notes.php
@@ -1,5 +1,7 @@
forge->dropForeignKey('activitypub_notes', 'activitypub_notes_created_by_foreign',);
+ $this->forge->dropForeignKey('activitypub_notes', 'activitypub_notes_created_by_foreign');
$this->forge->dropColumn('activitypub_notes', 'created_by');
}
}
diff --git a/app/Database/Seeds/AppSeeder.php b/app/Database/Seeds/AppSeeder.php
index 0e32cc83..5101c8e2 100644
--- a/app/Database/Seeds/AppSeeder.php
+++ b/app/Database/Seeds/AppSeeder.php
@@ -1,5 +1,7 @@
where('`published_at` <= NOW()', null, false)
->findAll();
foreach ($episodes as $episode) {
- $age = floor(($date - strtotime($episode->published_at)) / 86400,);
+ $age = floor(($date - strtotime($episode->published_at)) / 86400);
$probability1 = (int) floor(exp(3 - $age / 40)) + 1;
for (
@@ -95,7 +97,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder
'.' .
rand(0, 255);
- $cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb',);
+ $cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb');
$countryCode = 'N/A';
$regionCode = 'N/A';
diff --git a/app/Database/Seeds/FakeWebsiteAnalyticsSeeder.php b/app/Database/Seeds/FakeWebsiteAnalyticsSeeder.php
index ac105498..6dc97eea 100644
--- a/app/Database/Seeds/FakeWebsiteAnalyticsSeeder.php
+++ b/app/Database/Seeds/FakeWebsiteAnalyticsSeeder.php
@@ -1,5 +1,7 @@
where('`published_at` <= NOW()', null, false)
->findAll();
foreach ($episodes as $episode) {
- $age = floor(($date - strtotime($episode->published_at)) / 86400,);
+ $age = floor(($date - strtotime($episode->published_at)) / 86400);
$probability1 = (int) floor(exp(3 - $age / 40)) + 1;
for (
diff --git a/app/Database/Seeds/LanguageSeeder.php b/app/Database/Seeds/LanguageSeeder.php
index eefa2ded..b4080f97 100644
--- a/app/Database/Seeds/LanguageSeeder.php
+++ b/app/Database/Seeds/LanguageSeeder.php
@@ -1,5 +1,7 @@
podcast !== null;
+ return $this->getPodcast() !== null;
}
public function getPodcast(): ?Podcast
{
if ($this->id === null) {
- throw new RuntimeException('Podcast id must be set before getting associated podcast.',);
+ throw new RuntimeException('Podcast id must be set before getting associated podcast.');
}
if ($this->podcast === null) {
- $this->podcast = (new PodcastModel())->getPodcastByActorId($this->id,);
+ $this->podcast = (new PodcastModel())->getPodcastByActorId($this->id);
}
return $this->podcast;
diff --git a/app/Entities/Category.php b/app/Entities/Category.php
index e3d9cead..c29e37d2 100644
--- a/app/Entities/Category.php
+++ b/app/Entities/Category.php
@@ -1,5 +1,7 @@
person_id === null) {
- throw new RuntimeException('Credit must have person_id before getting person.',);
+ throw new RuntimeException('Credit must have person_id before getting person.');
}
if ($this->person === null) {
- $this->person = (new PersonModel())->getPersonById($this->person_id,);
+ $this->person = (new PersonModel())->getPersonById($this->person_id);
}
return $this->person;
@@ -67,11 +69,11 @@ class Credit extends Entity
public function getPodcast(): ?Podcast
{
if ($this->podcast_id === null) {
- throw new RuntimeException('Credit must have podcast_id before getting podcast.',);
+ throw new RuntimeException('Credit must have podcast_id before getting podcast.');
}
if ($this->podcast === null) {
- $this->podcast = (new PodcastModel())->getPodcastById($this->podcast_id,);
+ $this->podcast = (new PodcastModel())->getPodcastById($this->podcast_id);
}
return $this->podcast;
@@ -80,11 +82,11 @@ class Credit extends Entity
public function getEpisode(): ?Episode
{
if ($this->episode_id === null) {
- throw new RuntimeException('Credit must have episode_id before getting episode.',);
+ throw new RuntimeException('Credit must have episode_id before getting episode.');
}
if ($this->episode === null) {
- $this->episode = (new EpisodeModel())->getPublishedEpisodeById($this->podcast_id, $this->episode_id,);
+ $this->episode = (new EpisodeModel())->getPublishedEpisodeById($this->podcast_id, $this->episode_id);
}
return $this->episode;
@@ -109,6 +111,6 @@ class Credit extends Entity
return '';
}
- return lang("PersonsTaxonomy.persons.{$this->person_group}.roles.{$this->person_role}.label",);
+ return lang("PersonsTaxonomy.persons.{$this->person_group}.roles.{$this->person_role}.label");
}
}
diff --git a/app/Entities/Episode.php b/app/Entities/Episode.php
index b54c4376..4b4b63d3 100644
--- a/app/Entities/Episode.php
+++ b/app/Entities/Episode.php
@@ -1,5 +1,7 @@
saveImage('podcasts/' . $this->getPodcast()->name, $this->attributes['slug'],);
+ $image->saveImage('podcasts/' . $this->getPodcast()->name, $this->attributes['slug']);
$this->attributes['image_mimetype'] = $image->mimetype;
$this->attributes['image_path'] = $image->path;
@@ -189,7 +191,7 @@ class Episode extends Entity
public function getImage(): Image
{
if ($imagePath = $this->attributes['image_path']) {
- return new Image(null, $imagePath, $this->attributes['image_mimetype'],);
+ return new Image(null, $imagePath, $this->attributes['image_mimetype']);
}
return $this->getPodcast()
@@ -266,7 +268,7 @@ class Episode extends Entity
if ($this->attributes['transcript_file_path']) {
helper('media');
- return new File(media_path($this->attributes['transcript_file_path']),);
+ return new File(media_path($this->attributes['transcript_file_path']));
}
return null;
@@ -277,7 +279,7 @@ class Episode extends Entity
if ($this->attributes['chapters_file_path']) {
helper('media');
- return new File(media_path($this->attributes['chapters_file_path']),);
+ return new File(media_path($this->attributes['chapters_file_path']));
}
return null;
@@ -348,11 +350,11 @@ class Episode extends Entity
public function getPersons(): array
{
if ($this->id === null) {
- throw new RuntimeException('Episode must be created before getting persons.',);
+ throw new RuntimeException('Episode must be created before getting persons.');
}
if ($this->persons === null) {
- $this->persons = (new PersonModel())->getEpisodePersons($this->podcast_id, $this->id,);
+ $this->persons = (new PersonModel())->getEpisodePersons($this->podcast_id, $this->id);
}
return $this->persons;
@@ -366,11 +368,11 @@ class Episode extends Entity
public function getSoundbites(): array
{
if ($this->id === null) {
- throw new RuntimeException('Episode must be created before getting soundbites.',);
+ throw new RuntimeException('Episode must be created before getting soundbites.');
}
if ($this->soundbites === null) {
- $this->soundbites = (new SoundbiteModel())->getEpisodeSoundbites($this->getPodcast() ->id, $this->id,);
+ $this->soundbites = (new SoundbiteModel())->getEpisodeSoundbites($this->getPodcast() ->id, $this->id);
}
return $this->soundbites;
@@ -382,7 +384,7 @@ class Episode extends Entity
public function getNotes(): array
{
if ($this->id === null) {
- throw new RuntimeException('Episode must be created before getting soundbites.',);
+ throw new RuntimeException('Episode must be created before getting soundbites.');
}
if ($this->notes === null) {
@@ -394,7 +396,7 @@ class Episode extends Entity
public function getLink(): string
{
- return base_url(route_to('episode', $this->getPodcast() ->name, $this->attributes['slug'],),);
+ return base_url(route_to('episode', $this->getPodcast() ->name, $this->attributes['slug'],));
}
public function getEmbeddablePlayerUrl(string $theme = null): string
@@ -421,7 +423,7 @@ class Episode extends Entity
public function getPodcast(): ?Podcast
{
- return (new PodcastModel())->getPodcastById($this->attributes['podcast_id'],);
+ return (new PodcastModel())->getPodcastById($this->podcast_id);
}
public function setDescriptionMarkdown(string $descriptionMarkdown): static
@@ -432,7 +434,7 @@ class Episode extends Entity
]);
$this->attributes['description_markdown'] = $descriptionMarkdown;
- $this->attributes['description_html'] = $converter->convertToHtml($descriptionMarkdown,);
+ $this->attributes['description_html'] = $converter->convertToHtml($descriptionMarkdown);
return $this;
}
@@ -525,7 +527,7 @@ class Episode extends Entity
}
if ($this->location === null) {
- $this->location = new Location($this->location_name, $this->location_geo, $this->location_osm,);
+ $this->location = new Location($this->location_name, $this->location_geo, $this->location_osm);
}
return $this->location;
@@ -549,7 +551,7 @@ class Episode extends Entity
->addChild('item');
array_to_rss([
'elements' => $this->custom_rss,
- ], $xmlNode,);
+ ], $xmlNode);
return str_replace(['- ', '
'], '', $xmlNode->asXML());
}
@@ -573,7 +575,7 @@ class Episode extends Entity
)['elements'][0]['elements'][0];
if (array_key_exists('elements', $customRssArray)) {
- $this->attributes['custom_rss'] = json_encode($customRssArray['elements'],);
+ $this->attributes['custom_rss'] = json_encode($customRssArray['elements']);
} else {
$this->attributes['custom_rss'] = null;
}
diff --git a/app/Entities/Image.php b/app/Entities/Image.php
index 5997ac41..799840c8 100644
--- a/app/Entities/Image.php
+++ b/app/Entities/Image.php
@@ -1,5 +1,7 @@
config = config('Images');
diff --git a/app/Entities/Language.php b/app/Entities/Language.php
index d42814b4..f8cf6daf 100644
--- a/app/Entities/Language.php
+++ b/app/Entities/Language.php
@@ -1,5 +1,7 @@
getBody(), false, 512, JSON_THROW_ON_ERROR,);
+ $places = json_decode($response->getBody(), false, 512, JSON_THROW_ON_ERROR);
if ($places === []) {
return $this;
diff --git a/app/Entities/Note.php b/app/Entities/Note.php
index 4fa60d10..68d39c4f 100644
--- a/app/Entities/Note.php
+++ b/app/Entities/Note.php
@@ -1,5 +1,7 @@
episode_id === null) {
- throw new RuntimeException('Note must have an episode_id before getting episode.',);
+ throw new RuntimeException('Note must have an episode_id before getting episode.');
}
if ($this->episode === null) {
- $this->episode = (new EpisodeModel())->getEpisodeById($this->episode_id,);
+ $this->episode = (new EpisodeModel())->getEpisodeById($this->episode_id);
}
return $this->episode;
diff --git a/app/Entities/Page.php b/app/Entities/Page.php
index 85f60d19..7cf868a0 100644
--- a/app/Entities/Page.php
+++ b/app/Entities/Page.php
@@ -1,5 +1,7 @@
attributes['content_markdown'] = $contentMarkdown;
- $this->attributes['content_html'] = $converter->convertToHtml($contentMarkdown,);
+ $this->attributes['content_html'] = $converter->convertToHtml($contentMarkdown);
return $this;
}
diff --git a/app/Entities/Person.php b/app/Entities/Person.php
index 3e298f4d..5f7f0f22 100644
--- a/app/Entities/Person.php
+++ b/app/Entities/Person.php
@@ -1,5 +1,7 @@
attributes['image_path'], $this->attributes['image_mimetype'],);
+ return new Image(null, $this->attributes['image_path'], $this->attributes['image_mimetype']);
}
/**
@@ -80,14 +82,14 @@ class Person extends Entity
public function getRoles(): array
{
if ($this->attributes['podcast_id'] === null) {
- throw new RuntimeException('Person must have a podcast_id before getting roles.',);
+ throw new RuntimeException('Person must have a podcast_id before getting roles.');
}
if ($this->roles === null) {
$this->roles = (new PersonModel())->getPersonRoles(
$this->id,
- $this->attributes['podcast_id'],
- $this->attributes['episode_id'] ?? null
+ (int) $this->attributes['podcast_id'],
+ array_key_exists('episode_id', $this->attributes) ? (int) $this->attributes['episode_id'] : null
);
}
diff --git a/app/Entities/Platform.php b/app/Entities/Platform.php
index cfa50a52..34965c94 100644
--- a/app/Entities/Platform.php
+++ b/app/Entities/Platform.php
@@ -1,5 +1,7 @@
actor_id === 0) {
- throw new RuntimeException('Podcast must have an actor_id before getting actor.',);
+ throw new RuntimeException('Podcast must have an actor_id before getting actor.');
}
if ($this->actor === null) {
@@ -220,11 +222,11 @@ class Podcast extends Entity
public function getEpisodes(): array
{
if ($this->id === null) {
- throw new RuntimeException('Podcast must be created before getting episodes.',);
+ throw new RuntimeException('Podcast must be created before getting episodes.');
}
if ($this->episodes === null) {
- $this->episodes = (new EpisodeModel())->getPodcastEpisodes($this->id, $this->type,);
+ $this->episodes = (new EpisodeModel())->getPodcastEpisodes($this->id, $this->type);
}
return $this->episodes;
@@ -238,7 +240,7 @@ class Podcast extends Entity
public function getPersons(): array
{
if ($this->id === null) {
- throw new RuntimeException('Podcast must be created before getting persons.',);
+ throw new RuntimeException('Podcast must be created before getting persons.');
}
if ($this->persons === null) {
@@ -254,11 +256,11 @@ class Podcast extends Entity
public function getCategory(): ?Category
{
if ($this->id === null) {
- throw new RuntimeException('Podcast must be created before getting category.',);
+ throw new RuntimeException('Podcast must be created before getting category.');
}
if ($this->category === null) {
- $this->category = (new CategoryModel())->getCategoryById($this->category_id,);
+ $this->category = (new CategoryModel())->getCategoryById($this->category_id);
}
return $this->category;
@@ -272,11 +274,11 @@ class Podcast extends Entity
public function getContributors(): array
{
if ($this->id === null) {
- throw new RuntimeException('Podcasts must be created before getting contributors.',);
+ throw new RuntimeException('Podcasts must be created before getting contributors.');
}
if ($this->contributors === null) {
- $this->contributors = (new UserModel())->getPodcastContributors($this->id,);
+ $this->contributors = (new UserModel())->getPodcastContributors($this->id);
}
return $this->contributors;
@@ -290,7 +292,7 @@ class Podcast extends Entity
]);
$this->attributes['description_markdown'] = $descriptionMarkdown;
- $this->attributes['description_html'] = $converter->convertToHtml($descriptionMarkdown,);
+ $this->attributes['description_html'] = $converter->convertToHtml($descriptionMarkdown);
return $this;
}
@@ -333,11 +335,11 @@ class Podcast extends Entity
public function getPodcastingPlatforms(): array
{
if ($this->id === null) {
- throw new RuntimeException('Podcast must be created before getting podcasting platform links.',);
+ throw new RuntimeException('Podcast must be created before getting podcasting platform links.');
}
if ($this->podcasting_platforms === null) {
- $this->podcasting_platforms = (new PlatformModel())->getPodcastPlatforms($this->id, 'podcasting',);
+ $this->podcasting_platforms = (new PlatformModel())->getPodcastPlatforms($this->id, 'podcasting');
}
return $this->podcasting_platforms;
@@ -351,11 +353,11 @@ class Podcast extends Entity
public function getSocialPlatforms(): array
{
if ($this->id === null) {
- throw new RuntimeException('Podcast must be created before getting social platform links.',);
+ throw new RuntimeException('Podcast must be created before getting social platform links.');
}
if ($this->social_platforms === null) {
- $this->social_platforms = (new PlatformModel())->getPodcastPlatforms($this->id, 'social',);
+ $this->social_platforms = (new PlatformModel())->getPodcastPlatforms($this->id, 'social');
}
return $this->social_platforms;
@@ -369,11 +371,11 @@ class Podcast extends Entity
public function getFundingPlatforms(): array
{
if ($this->id === null) {
- throw new RuntimeException('Podcast must be created before getting funding platform links.',);
+ throw new RuntimeException('Podcast must be created before getting funding platform links.');
}
if ($this->funding_platforms === null) {
- $this->funding_platforms = (new PlatformModel())->getPodcastPlatforms($this->id, 'funding',);
+ $this->funding_platforms = (new PlatformModel())->getPodcastPlatforms($this->id, 'funding');
}
return $this->funding_platforms;
@@ -385,11 +387,11 @@ class Podcast extends Entity
public function getOtherCategories(): array
{
if ($this->id === null) {
- throw new RuntimeException('Podcast must be created before getting other categories.',);
+ throw new RuntimeException('Podcast must be created before getting other categories.');
}
if ($this->other_categories === null) {
- $this->other_categories = (new CategoryModel())->getPodcastCategories($this->id,);
+ $this->other_categories = (new CategoryModel())->getPodcastCategories($this->id);
}
return $this->other_categories;
@@ -401,7 +403,7 @@ class Podcast extends Entity
public function getOtherCategoriesIds(): array
{
if ($this->other_categories_ids === null) {
- $this->other_categories_ids = array_column($this->getOtherCategories(), 'id',);
+ $this->other_categories_ids = array_column($this->getOtherCategories(), 'id');
}
return $this->other_categories_ids;
@@ -441,7 +443,7 @@ class Podcast extends Entity
}
if ($this->location === null) {
- $this->location = new Location($this->location_name, $this->location_geo, $this->location_osm,);
+ $this->location = new Location($this->location_name, $this->location_geo, $this->location_osm);
}
return $this->location;
@@ -463,7 +465,7 @@ class Podcast extends Entity
))->addChild('channel');
array_to_rss([
'elements' => $this->custom_rss,
- ], $xmlNode,);
+ ], $xmlNode);
return str_replace(['', ''], '', $xmlNode->asXML());
}
@@ -487,7 +489,7 @@ class Podcast extends Entity
)['elements'][0];
if (array_key_exists('elements', $customRssArray)) {
- $this->attributes['custom_rss'] = json_encode($customRssArray['elements'],);
+ $this->attributes['custom_rss'] = json_encode($customRssArray['elements']);
} else {
$this->attributes['custom_rss'] = null;
}
diff --git a/app/Entities/Soundbite.php b/app/Entities/Soundbite.php
index 081cb1a6..f6e85cfd 100644
--- a/app/Entities/Soundbite.php
+++ b/app/Entities/Soundbite.php
@@ -1,5 +1,7 @@
id === null) {
- throw new RuntimeException('Users must be created before getting podcasts.',);
+ throw new RuntimeException('Users must be created before getting podcasts.');
}
if ($this->podcasts === null) {
diff --git a/app/Filters/PermissionFilter.php b/app/Filters/PermissionFilter.php
index cb389343..5a338c34 100644
--- a/app/Filters/PermissionFilter.php
+++ b/app/Filters/PermissionFilter.php
@@ -1,5 +1,7 @@
has('interact_as_actor_id')) {
- return model('ActorModel')->getActorById($session->get('interact_as_actor_id'),);
+ return model('ActorModel')->getActorById($session->get('interact_as_actor_id'));
}
return false;
diff --git a/app/Helpers/breadcrumb_helper.php b/app/Helpers/breadcrumb_helper.php
index 6de3e855..4e9b6a2e 100644
--- a/app/Helpers/breadcrumb_helper.php
+++ b/app/Helpers/breadcrumb_helper.php
@@ -1,5 +1,7 @@
$buttonClass,
- ], $customAttributes,),);
+ ], $customAttributes,));
}
$defaultButtonAttributes = [
'type' => 'button',
];
- $attributes = stringify_attributes(array_merge($defaultButtonAttributes, $customAttributes),);
+ $attributes = stringify_attributes(array_merge($defaultButtonAttributes, $customAttributes));
return <<
@@ -258,7 +260,7 @@ if (! function_exists('publication_pill')) {
'',
];
- $label = lang('Episode.publication_status.' . $publicationStatus, $langOptions,);
+ $label = lang('Episode.publication_status.' . $publicationStatus, $langOptions);
return '