mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-16 04:57:46 +02:00
refactor: add strict types declaration before each file and fix activitypub issues
fix some style issues
This commit is contained in:
parent
76afc0cfa2
commit
c72f4be6d8
291 changed files with 8727 additions and 7357 deletions
17
INSTALL.md
17
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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Authorization;
|
||||
|
||||
use Myth\Auth\Authorization\FlatAuthorization as MythAuthFlatAuthorization;
|
||||
|
|
@ -26,7 +28,7 @@ class FlatAuthorization extends MythAuthFlatAuthorization
|
|||
return false;
|
||||
}
|
||||
|
||||
return $this->permissionModel->doesGroupHavePermission($groupId, $permissionId,);
|
||||
return $this->permissionModel->doesGroupHavePermission($groupId, $permissionId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Authorization;
|
||||
|
||||
use Myth\Auth\Authorization\GroupModel as MythAuthGroupModel;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Authorization;
|
||||
|
||||
use Myth\Auth\Authorization\PermissionModel as MythAuthPermissionModel;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* The goal of this file is to allow developers a location where they can overwrite core procedural functions and
|
||||
* replace them with their own. This file is loaded during the bootstrap process and is called during the frameworks
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use ActivityPub\Config\ActivityPub as ActivityPubBase;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use Analytics\Config\Analytics as AnalyticsBase;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use Myth\Auth\Config\Auth as MythAuthConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\AutoloadConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* ERROR DISPLAY
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* ERROR DISPLAY
|
||||
|
|
@ -8,7 +10,7 @@
|
|||
* it and display a generic error message.
|
||||
*/
|
||||
ini_set('display_errors', '0');
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED,);
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* ERROR DISPLAY
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Cache\Handlers\DummyHandler;
|
||||
|
|
@ -74,6 +76,19 @@ class Cache extends BaseConfig
|
|||
*/
|
||||
public string $prefix = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Default TTL
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The default number of seconds to save items when none is specified.
|
||||
*
|
||||
* WARNING: This is not used by framework handlers where 60 seconds is
|
||||
* hard-coded, but may be useful to projects and modules. This will replace
|
||||
* the hard-coded value in a future release.
|
||||
*/
|
||||
public int $ttl = 60;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* File settings
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
| --------------------------------------------------------------------
|
||||
| Castopod Version
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Database\Config;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
class DocTypes
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use App\Entities\Actor;
|
||||
|
|
@ -50,7 +52,7 @@ Events::on('pre_system', function () {
|
|||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
if (CI_DEBUG && ! is_cli()) {
|
||||
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect',);
|
||||
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
|
||||
Services::toolbar()->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 {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use ActivityPub\Filters\ActivityPubFilter;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Modules\Modules as BaseModules;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
// Create a new instance of our RouteCollection class.
|
||||
|
|
@ -34,7 +36,7 @@ $routes->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');
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use App\Authorization\FlatAuthorization;
|
||||
|
|
@ -76,7 +78,7 @@ class Services extends BaseService
|
|||
bool $getShared = true
|
||||
) {
|
||||
if ($getShared) {
|
||||
return self::getSharedInstance('authentication', $lib, $userModel, $loginModel,);
|
||||
return self::getSharedInstance('authentication', $lib, $userModel, $loginModel);
|
||||
}
|
||||
|
||||
// config() checks first in app/Config
|
||||
|
|
@ -108,7 +110,7 @@ class Services extends BaseService
|
|||
bool $getShared = true
|
||||
) {
|
||||
if ($getShared) {
|
||||
return self::getSharedInstance('authorization', $groupModel, $permissionModel, $userModel,);
|
||||
return self::getSharedInstance('authorization', $groupModel, $permissionModel, $userModel);
|
||||
}
|
||||
|
||||
if ($groupModel === null) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use App\Validation\FileRules as AppFileRules;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\View as BaseView;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -24,6 +26,7 @@ class ActorController extends ActivityPubActorController
|
|||
{
|
||||
// Prevent analytics hit when authenticated
|
||||
if (! can_user_interact()) {
|
||||
// @phpstan-ignore-next-line
|
||||
$this->registerPodcastWebpageHit($this->actor->podcast->id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use CodeIgniter\Controller;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -161,7 +163,7 @@ class EpisodeController extends BaseController
|
|||
) {
|
||||
$newEpisode->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]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -88,7 +90,7 @@ class EpisodePersonController extends BaseController
|
|||
|
||||
public function remove(int $personId): RedirectResponse
|
||||
{
|
||||
(new PersonModel())->removePersonFromEpisode($this->podcast->id, $this->episode->id, $personId,);
|
||||
(new PersonModel())->removePersonFromEpisode($this->podcast->id, $this->episode->id, $personId);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -74,7 +76,7 @@ class PageController extends BaseController
|
|||
->route('page-list')
|
||||
->with('message', lang('Page.messages.createSuccess', [
|
||||
'pageTitle' => $page->title,
|
||||
]),);
|
||||
]));
|
||||
}
|
||||
|
||||
public function edit(): string
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -126,7 +128,7 @@ class PersonController extends BaseController
|
|||
|
||||
$this->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);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -225,7 +227,7 @@ class PodcastController extends BaseController
|
|||
$authorize = Services::authorization();
|
||||
$podcastAdminGroup = $authorize->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';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -78,7 +80,7 @@ class PodcastImportController extends BaseController
|
|||
}
|
||||
try {
|
||||
ini_set('user_agent', 'Castopod/' . CP_VERSION);
|
||||
$feed = simplexml_load_file($this->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
|
|||
' ⎋</a>',
|
||||
]);
|
||||
}
|
||||
$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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -74,7 +76,7 @@ class PodcastPersonController extends BaseController
|
|||
|
||||
public function remove(int $personId): RedirectResponse
|
||||
{
|
||||
(new PersonModel())->removePersonFromPodcast($this->podcast->id, $personId,);
|
||||
(new PersonModel())->removePersonFromPodcast($this->podcast->id, $personId);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -93,7 +95,7 @@ class PodcastPlatformController extends BaseController
|
|||
->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()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -108,7 +110,7 @@ class UserController extends BaseController
|
|||
->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,
|
||||
]),);
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -53,7 +55,7 @@ class AuthController extends MythAuthController
|
|||
}
|
||||
|
||||
// Save the user
|
||||
$allowedPostFields = array_merge(['password'], $this->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!
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\Controller;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -100,7 +102,7 @@ class EpisodeController extends BaseController
|
|||
$session = Services::session();
|
||||
$session->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("<?xml version='1.0' encoding='utf-8' standalone='yes'?><oembed></oembed>",);
|
||||
$oembed = new SimpleXMLElement("<?xml version='1.0' encoding='utf-8' standalone='yes'?><oembed></oembed>");
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -33,10 +35,10 @@ class FeedController extends Controller
|
|||
$service = UserAgentsRSS::find($_SERVER['HTTP_USER_AGENT']);
|
||||
} catch (Exception $exception) {
|
||||
// If things go wrong the show must go on and the user must be able to download the file
|
||||
log_message('critical', $exception);
|
||||
log_message('critical', $exception->getMessage());
|
||||
}
|
||||
|
||||
$serviceSlug = null;
|
||||
$serviceSlug = '';
|
||||
if ($service) {
|
||||
$serviceSlug = $service['slug'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -123,7 +125,7 @@ class InstallController extends Controller
|
|||
// Could not connect to the database
|
||||
// show database config view to fix value
|
||||
session()
|
||||
->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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -15,6 +17,7 @@ use App\Entities\Actor;
|
|||
use App\Entities\Note as CastopodNote;
|
||||
use App\Entities\Podcast;
|
||||
use App\Models\EpisodeModel;
|
||||
use App\Models\NoteModel;
|
||||
use App\Models\PodcastModel;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
|
@ -46,7 +49,7 @@ class NoteController extends ActivityPubNoteController
|
|||
|
||||
if (
|
||||
count($params) > 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -94,7 +96,7 @@ class PodcastController extends BaseController
|
|||
$seasonQuery = $this->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'];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddAddPodcastsPlatforms Creates podcasts_platforms table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddCategories Creates categories table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddLanguages Creates languages table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddPodcasts Creates podcasts table in database
|
||||
*
|
||||
|
|
@ -189,7 +191,7 @@ class AddPodcasts extends Migration
|
|||
// TODO: remove name in favor of username from actor
|
||||
$this->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');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddEpisodes Creates episodes table in database
|
||||
*
|
||||
|
|
@ -185,7 +187,7 @@ class AddEpisodes extends Migration
|
|||
]);
|
||||
$this->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');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddSoundbites Creates soundbites table in database
|
||||
*
|
||||
|
|
@ -63,8 +65,8 @@ class AddSoundbites extends Migration
|
|||
]);
|
||||
$this->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');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddPlatforms Creates platforms table in database
|
||||
*
|
||||
|
|
@ -41,7 +43,7 @@ class AddPlatforms extends Migration
|
|||
],
|
||||
]);
|
||||
$this->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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddPodcastUsers Creates podcast_users table in database
|
||||
*
|
||||
|
|
@ -32,8 +34,8 @@ class AddPodcastsUsers extends Migration
|
|||
]);
|
||||
$this->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');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddPages Creates pages table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddPodcastsCategories Creates podcasts_categories table in database
|
||||
*
|
||||
|
|
@ -27,8 +29,8 @@ class AddPodcastsCategories extends Migration
|
|||
],
|
||||
]);
|
||||
$this->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');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class Persons Creates persons table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddPodcastsPersons Creates podcasts_persons table in database
|
||||
*
|
||||
|
|
@ -41,8 +43,8 @@ class AddPodcastsPersons extends Migration
|
|||
]);
|
||||
$this->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');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddEpisodesPersons Creates episodes_persons table in database
|
||||
*
|
||||
|
|
@ -45,9 +47,9 @@ class AddEpisodesPersons extends Migration
|
|||
]);
|
||||
$this->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');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddCreditView Creates Credit View in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddEpisodeIdToNotes Adds episode_id field to activitypub_notes table in database
|
||||
*
|
||||
|
|
@ -28,7 +30,7 @@ class AddEpisodeIdToNotes extends Migration
|
|||
|
||||
public function down(): void
|
||||
{
|
||||
$this->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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddCreatedByToNotes Adds created_by field to activitypub_notes table in database
|
||||
*
|
||||
|
|
@ -28,7 +30,7 @@ class AddCreatedByToNotes extends Migration
|
|||
|
||||
public function down(): void
|
||||
{
|
||||
$this->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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AppSeeder Calls all required seeders for castopod to work properly
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class PermissionSeeder Inserts permissions
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class CategorySeeder Inserts values in categories table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class FakePodcastsAnalyticsSeeder Inserts Fake Analytics in the database
|
||||
*
|
||||
|
|
@ -61,7 +63,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder
|
|||
->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';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class FakeWebsiteAnalyticsSeeder Inserts Fake Analytics in the database
|
||||
*
|
||||
|
|
@ -200,7 +202,7 @@ class FakeWebsiteAnalyticsSeeder extends Seeder
|
|||
->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 (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class LanguageSeeder Inserts values in languages table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class PlatformsSeeder Inserts values in platforms table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class TestSeeder Inserts a superadmin user in the database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -20,21 +22,21 @@ class Actor extends ActivityPubActor
|
|||
{
|
||||
protected ?Podcast $podcast = null;
|
||||
|
||||
protected bool $is_podcast;
|
||||
protected bool $is_podcast = false;
|
||||
|
||||
public function getIsPodcast(): bool
|
||||
{
|
||||
return $this->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;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -54,11 +56,11 @@ class Credit extends Entity
|
|||
public function getPerson(): ?Person
|
||||
{
|
||||
if ($this->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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -178,7 +180,7 @@ class Episode extends Entity
|
|||
}
|
||||
|
||||
// Save image
|
||||
$image->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(['<item>', '</item>'], '', $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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -48,7 +50,7 @@ class Image extends Entity
|
|||
public function __construct(?File $file, string $path = '', string $mimetype = '')
|
||||
{
|
||||
if ($file === null && $path === '') {
|
||||
throw new RuntimeException('File or path must be set to create an Image.',);
|
||||
throw new RuntimeException('File or path must be set to create an Image.');
|
||||
}
|
||||
|
||||
$this->config = config('Images');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -84,7 +86,7 @@ class Location extends Entity
|
|||
],
|
||||
);
|
||||
|
||||
$places = json_decode($response->getBody(), false, 512, JSON_THROW_ON_ERROR,);
|
||||
$places = json_decode($response->getBody(), false, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
if ($places === []) {
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -47,11 +49,11 @@ class Note extends ActivityPubNote
|
|||
public function getEpisode(): ?Episode
|
||||
{
|
||||
if ($this->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;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -53,7 +55,7 @@ class Page extends Entity
|
|||
]);
|
||||
|
||||
$this->attributes['content_markdown'] = $contentMarkdown;
|
||||
$this->attributes['content_html'] = $converter->convertToHtml($contentMarkdown,);
|
||||
$this->attributes['content_html'] = $converter->convertToHtml($contentMarkdown);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -71,7 +73,7 @@ class Person extends Entity
|
|||
|
||||
public function getImage(): Image
|
||||
{
|
||||
return new Image(null, $this->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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -172,7 +174,7 @@ class Podcast extends Entity
|
|||
public function getActor(): Actor
|
||||
{
|
||||
if ($this->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(['<channel>', '</channel>'], '', $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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -52,7 +54,7 @@ class User extends MythAuthUser
|
|||
public function getPodcasts(): array
|
||||
{
|
||||
if ($this->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) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
use App\Models\PodcastModel;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -73,7 +75,7 @@ if (! function_exists('interact_as_actor')) {
|
|||
|
||||
$session = session();
|
||||
if ($session->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;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -94,13 +96,13 @@ if (! function_exists('button')) {
|
|||
if ($uri !== '') {
|
||||
return anchor($uri, $label, array_merge([
|
||||
'class' => $buttonClass,
|
||||
], $customAttributes,),);
|
||||
], $customAttributes,));
|
||||
}
|
||||
|
||||
$defaultButtonAttributes = [
|
||||
'type' => 'button',
|
||||
];
|
||||
$attributes = stringify_attributes(array_merge($defaultButtonAttributes, $customAttributes),);
|
||||
$attributes = stringify_attributes(array_merge($defaultButtonAttributes, $customAttributes));
|
||||
|
||||
return <<<CODE_SAMPLE
|
||||
<button class="{$buttonClass}" {$attributes}>
|
||||
|
|
@ -258,7 +260,7 @@ if (! function_exists('publication_pill')) {
|
|||
'</time>',
|
||||
];
|
||||
|
||||
$label = lang('Episode.publication_status.' . $publicationStatus, $langOptions,);
|
||||
$label = lang('Episode.publication_status.' . $publicationStatus, $langOptions);
|
||||
|
||||
return '<span class="px-1 font-semibold border ' .
|
||||
$class .
|
||||
|
|
@ -290,7 +292,7 @@ if (! function_exists('publication_button')) {
|
|||
break;
|
||||
case 'scheduled':
|
||||
$label = lang('Episode.publish_edit');
|
||||
$route = route_to('episode-publish_edit', $podcastId, $episodeId,);
|
||||
$route = route_to('episode-publish_edit', $podcastId, $episodeId);
|
||||
$variant = 'accent';
|
||||
$iconLeft = 'upload-cloud';
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -20,7 +22,7 @@ if (! function_exists('get_file_tags')) {
|
|||
function get_file_tags(File $file): array
|
||||
{
|
||||
$getID3 = new GetID3();
|
||||
$FileInfo = $getID3->analyze($file);
|
||||
$FileInfo = $getID3->analyze((string) $file);
|
||||
|
||||
return [
|
||||
'filesize' => $FileInfo['filesize'],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -19,7 +21,7 @@ if (! function_exists('get_rss_feed')) {
|
|||
* @param string $serviceSlug The name of the service that fetches the RSS feed for future reference when the audio file is eventually downloaded
|
||||
* @return string rss feed as xml
|
||||
*/
|
||||
function get_rss_feed(Podcast $podcast, ?string $serviceSlug = null): string
|
||||
function get_rss_feed(Podcast $podcast, string $serviceSlug = ''): string
|
||||
{
|
||||
$episodes = $podcast->episodes;
|
||||
|
||||
|
|
@ -34,18 +36,18 @@ if (! function_exists('get_rss_feed')) {
|
|||
|
||||
$channel = $rss->addChild('channel');
|
||||
|
||||
$atomLink = $channel->addChild('atom:link', null, 'http://www.w3.org/2005/Atom',);
|
||||
$atomLink = $channel->addChild('atom:link', null, 'http://www.w3.org/2005/Atom');
|
||||
$atomLink->addAttribute('href', $podcast->feed_url);
|
||||
$atomLink->addAttribute('rel', 'self');
|
||||
$atomLink->addAttribute('type', 'application/rss+xml');
|
||||
|
||||
if ($podcast->new_feed_url !== null) {
|
||||
$channel->addChild('new-feed-url', $podcast->new_feed_url, $itunesNamespace,);
|
||||
$channel->addChild('new-feed-url', $podcast->new_feed_url, $itunesNamespace);
|
||||
}
|
||||
|
||||
// the last build date corresponds to the creation of the feed.xml cache
|
||||
$channel->addChild('lastBuildDate', (new Time('now'))->format(DATE_RFC1123),);
|
||||
$channel->addChild('generator', 'Castopod Host - https://castopod.org/',);
|
||||
$channel->addChild('lastBuildDate', (new Time('now'))->format(DATE_RFC1123));
|
||||
$channel->addChild('generator', 'Castopod Host - https://castopod.org/');
|
||||
$channel->addChild('docs', 'https://cyber.harvard.edu/rss/rss.html');
|
||||
|
||||
$channel->addChild('title', $podcast->title);
|
||||
|
|
@ -71,31 +73,31 @@ if (! function_exists('get_rss_feed')) {
|
|||
}
|
||||
}
|
||||
if ($podcast->payment_pointer !== null) {
|
||||
$valueElement = $channel->addChild('value', null, $podcastNamespace,);
|
||||
$valueElement = $channel->addChild('value', null, $podcastNamespace);
|
||||
$valueElement->addAttribute('type', 'webmonetization');
|
||||
$valueElement->addAttribute('method', '');
|
||||
$valueElement->addAttribute('suggested', '');
|
||||
$recipientElement = $valueElement->addChild('valueRecipient', null, $podcastNamespace,);
|
||||
$recipientElement = $valueElement->addChild('valueRecipient', null, $podcastNamespace);
|
||||
$recipientElement->addAttribute('name', $podcast->owner_name);
|
||||
$recipientElement->addAttribute('type', 'ILP');
|
||||
$recipientElement->addAttribute('address', $podcast->payment_pointer,);
|
||||
$recipientElement->addAttribute('address', $podcast->payment_pointer);
|
||||
$recipientElement->addAttribute('split', '100');
|
||||
}
|
||||
$channel
|
||||
->addChild('locked', $podcast->is_locked ? 'yes' : 'no', $podcastNamespace,)
|
||||
->addAttribute('owner', $podcast->owner_email);
|
||||
if ($podcast->imported_feed_url !== null) {
|
||||
$channel->addChild('previousUrl', $podcast->imported_feed_url, $podcastNamespace,);
|
||||
$channel->addChild('previousUrl', $podcast->imported_feed_url, $podcastNamespace);
|
||||
}
|
||||
|
||||
foreach ($podcast->podcasting_platforms as $podcastingPlatform) {
|
||||
$podcastingPlatformElement = $channel->addChild('id', null, $podcastNamespace,);
|
||||
$podcastingPlatformElement->addAttribute('platform', $podcastingPlatform->slug,);
|
||||
$podcastingPlatformElement = $channel->addChild('id', null, $podcastNamespace);
|
||||
$podcastingPlatformElement->addAttribute('platform', $podcastingPlatform->slug);
|
||||
if ($podcastingPlatform->link_content !== null) {
|
||||
$podcastingPlatformElement->addAttribute('id', $podcastingPlatform->link_content,);
|
||||
$podcastingPlatformElement->addAttribute('id', $podcastingPlatform->link_content);
|
||||
}
|
||||
if ($podcastingPlatform->link_url !== null) {
|
||||
$podcastingPlatformElement->addAttribute('url', htmlspecialchars($podcastingPlatform->link_url),);
|
||||
$podcastingPlatformElement->addAttribute('url', htmlspecialchars($podcastingPlatform->link_url));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,9 +107,9 @@ if (! function_exists('get_rss_feed')) {
|
|||
$socialPlatform->link_content,
|
||||
$podcastNamespace,
|
||||
);
|
||||
$socialPlatformElement->addAttribute('platform', $socialPlatform->slug,);
|
||||
$socialPlatformElement->addAttribute('platform', $socialPlatform->slug);
|
||||
if ($socialPlatform->link_url !== null) {
|
||||
$socialPlatformElement->addAttribute('url', htmlspecialchars($socialPlatform->link_url),);
|
||||
$socialPlatformElement->addAttribute('url', htmlspecialchars($socialPlatform->link_url));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,9 +119,9 @@ if (! function_exists('get_rss_feed')) {
|
|||
$fundingPlatform->link_content,
|
||||
$podcastNamespace,
|
||||
);
|
||||
$fundingPlatformElement->addAttribute('platform', $fundingPlatform->slug,);
|
||||
$fundingPlatformElement->addAttribute('platform', $fundingPlatform->slug);
|
||||
if ($fundingPlatform->link_url !== null) {
|
||||
$fundingPlatformElement->addAttribute('url', htmlspecialchars($fundingPlatform->link_url),);
|
||||
$fundingPlatformElement->addAttribute('url', htmlspecialchars($fundingPlatform->link_url));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +136,7 @@ if (! function_exists('get_rss_feed')) {
|
|||
$personElement->addAttribute('img', $person->image->large_url);
|
||||
|
||||
if ($person->information_url !== null) {
|
||||
$personElement->addAttribute('href', $person->information_url,);
|
||||
$personElement->addAttribute('href', $person->information_url);
|
||||
}
|
||||
|
||||
$personElement->addAttribute(
|
||||
|
|
@ -192,7 +194,7 @@ if (! function_exists('get_rss_feed')) {
|
|||
if ($podcast->custom_rss !== null) {
|
||||
array_to_rss([
|
||||
'elements' => $podcast->custom_rss,
|
||||
], $channel,);
|
||||
], $channel);
|
||||
}
|
||||
|
||||
foreach ($episodes as $episode) {
|
||||
|
|
@ -207,11 +209,11 @@ if (! function_exists('get_rss_feed')) {
|
|||
? ''
|
||||
: '?_from=' . urlencode($serviceSlug)),
|
||||
);
|
||||
$enclosure->addAttribute('length', $episode->audio_file_size);
|
||||
$enclosure->addAttribute('length', (string) $episode->audio_file_size);
|
||||
$enclosure->addAttribute('type', $episode->audio_file_mimetype);
|
||||
|
||||
$item->addChild('guid', $episode->guid);
|
||||
$item->addChild('pubDate', $episode->published_at->format(DATE_RFC1123),);
|
||||
$item->addChild('pubDate', $episode->published_at->format(DATE_RFC1123));
|
||||
if ($episode->location !== null) {
|
||||
$locationElement = $item->addChild(
|
||||
'location',
|
||||
|
|
@ -219,17 +221,17 @@ if (! function_exists('get_rss_feed')) {
|
|||
$podcastNamespace,
|
||||
);
|
||||
if ($episode->location->geo !== null) {
|
||||
$locationElement->addAttribute('geo', $episode->location->geo,);
|
||||
$locationElement->addAttribute('geo', $episode->location->geo);
|
||||
}
|
||||
if ($episode->location->osm !== null) {
|
||||
$locationElement->addAttribute('osm', $episode->location->osm,);
|
||||
$locationElement->addAttribute('osm', $episode->location->osm);
|
||||
}
|
||||
}
|
||||
$item->addChildWithCDATA('description', $episode->getDescriptionHtml($serviceSlug),);
|
||||
$item->addChild('duration', $episode->audio_file_duration, $itunesNamespace,);
|
||||
$item->addChildWithCDATA('description', $episode->getDescriptionHtml($serviceSlug));
|
||||
$item->addChild('duration', $episode->audio_file_duration, $itunesNamespace);
|
||||
$item->addChild('link', $episode->link);
|
||||
$episodeItunesImage = $item->addChild('image', null, $itunesNamespace,);
|
||||
$episodeItunesImage->addAttribute('href', $episode->image->feed_url,);
|
||||
$episodeItunesImage = $item->addChild('image', null, $itunesNamespace);
|
||||
$episodeItunesImage->addAttribute('href', $episode->image->feed_url);
|
||||
|
||||
$episode->parental_advisory &&
|
||||
$item->addChild(
|
||||
|
|
@ -243,29 +245,29 @@ if (! function_exists('get_rss_feed')) {
|
|||
$episode->number &&
|
||||
$item->addChild('episode', $episode->number, $itunesNamespace);
|
||||
$episode->season_number &&
|
||||
$item->addChild('season', $episode->season_number, $itunesNamespace,);
|
||||
$item->addChild('season', $episode->season_number, $itunesNamespace);
|
||||
$item->addChild('episodeType', $episode->type, $itunesNamespace);
|
||||
|
||||
if ($episode->transcript_file_url) {
|
||||
$transcriptElement = $item->addChild('transcript', null, $podcastNamespace,);
|
||||
$transcriptElement->addAttribute('url', $episode->transcript_file_url,);
|
||||
$transcriptElement = $item->addChild('transcript', null, $podcastNamespace);
|
||||
$transcriptElement->addAttribute('url', $episode->transcript_file_url);
|
||||
$transcriptElement->addAttribute(
|
||||
'type',
|
||||
Mimes::guessTypeFromExtension(pathinfo($episode->transcript_file_url, PATHINFO_EXTENSION,),),
|
||||
);
|
||||
$transcriptElement->addAttribute('language', $podcast->language_code,);
|
||||
$transcriptElement->addAttribute('language', $podcast->language_code);
|
||||
}
|
||||
|
||||
if ($episode->chapters_file_url) {
|
||||
$chaptersElement = $item->addChild('chapters', null, $podcastNamespace,);
|
||||
$chaptersElement->addAttribute('url', $episode->chapters_file_url,);
|
||||
$chaptersElement->addAttribute('type', 'application/json+chapters',);
|
||||
$chaptersElement = $item->addChild('chapters', null, $podcastNamespace);
|
||||
$chaptersElement->addAttribute('url', $episode->chapters_file_url);
|
||||
$chaptersElement->addAttribute('type', 'application/json+chapters');
|
||||
}
|
||||
|
||||
foreach ($episode->soundbites as $soundbite) {
|
||||
$soundbiteElement = $item->addChild('soundbite', $soundbite->label, $podcastNamespace,);
|
||||
$soundbiteElement->addAttribute('start_time', $soundbite->start_time,);
|
||||
$soundbiteElement->addAttribute('duration', $soundbite->duration,);
|
||||
$soundbiteElement = $item->addChild('soundbite', $soundbite->label, $podcastNamespace);
|
||||
$soundbiteElement->addAttribute('start_time', $soundbite->start_time);
|
||||
$soundbiteElement->addAttribute('duration', $soundbite->duration);
|
||||
}
|
||||
|
||||
foreach ($episode->persons as $person) {
|
||||
|
|
@ -288,10 +290,10 @@ if (! function_exists('get_rss_feed')) {
|
|||
htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en',),),
|
||||
);
|
||||
|
||||
$personElement->addAttribute('img', $person->image->large_url,);
|
||||
$personElement->addAttribute('img', $person->image->large_url);
|
||||
|
||||
if ($person->information_url !== null) {
|
||||
$personElement->addAttribute('href', $person->information_url,);
|
||||
$personElement->addAttribute('href', $person->information_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -302,7 +304,7 @@ if (! function_exists('get_rss_feed')) {
|
|||
if ($episode->custom_rss !== null) {
|
||||
array_to_rss([
|
||||
'elements' => $episode->custom_rss,
|
||||
], $item,);
|
||||
], $item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -327,8 +329,8 @@ if (! function_exists('add_category_tag')) {
|
|||
);
|
||||
|
||||
if ($category->parent !== null) {
|
||||
$itunesCategoryChild = $itunesCategory->addChild('category', '', $itunesNamespace,);
|
||||
$itunesCategoryChild->addAttribute('text', $category->apple_category,);
|
||||
$itunesCategoryChild = $itunesCategory->addChild('category', '', $itunesNamespace);
|
||||
$itunesCategoryChild->addAttribute('text', $category->apple_category);
|
||||
$node->addChild('category', $category->parent->apple_category);
|
||||
}
|
||||
$node->addChild('category', $category->apple_category);
|
||||
|
|
@ -393,7 +395,7 @@ if (! function_exists('array_to_rss')) {
|
|||
$childArrayNode['attributes']
|
||||
as $attributeKey => $attributeValue
|
||||
) {
|
||||
$childXmlNode->addAttribute($attributeKey, $attributeValue,);
|
||||
$childXmlNode->addAttribute($attributeKey, $attributeValue);
|
||||
}
|
||||
}
|
||||
array_to_rss($childArrayNode, $childXmlNode);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -18,7 +20,7 @@ if (! function_exists('icon')) {
|
|||
{
|
||||
$svgContents = file_get_contents('assets/icons/' . $name . '.svg');
|
||||
if ($class !== '') {
|
||||
$svgContents = str_replace('<svg', '<svg class="' . $class . '"', $svgContents,);
|
||||
$svgContents = str_replace('<svg', '<svg class="' . $class . '"', $svgContents);
|
||||
}
|
||||
|
||||
return $svgContents;
|
||||
|
|
@ -37,7 +39,7 @@ if (! function_exists('svg')) {
|
|||
{
|
||||
$svgContents = file_get_contents('assets/images/' . $name . '.svg');
|
||||
if ($class) {
|
||||
$svgContents = str_replace('<svg', '<svg class="' . $class . '"', $svgContents,);
|
||||
$svgContents = str_replace('<svg', '<svg class="' . $class . '"', $svgContents);
|
||||
}
|
||||
return $svgContents;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* ISO 3166 country codes
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* ISO 3166 country codes
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Activity objects are specializations of the base Object type that provide information about actions that have either
|
||||
* already occurred, are in the process of occurring, or may occur in the future.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Activity objects are specializations of the base Object type that provide information about actions that have either
|
||||
* already occurred, are in the process of occurring, or may occur in the future.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Activity objects are specializations of the base Object type that provide information about actions that have either
|
||||
* already occurred, are in the process of occurring, or may occur in the future.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Activity objects are specializations of the base Object type that provide information about actions that have either
|
||||
* already occurred, are in the process of occurring, or may occur in the future.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Activity objects are specializations of the base Object type that provide information about actions that have either
|
||||
* already occurred, are in the process of occurring, or may occur in the future.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Activity objects are specializations of the base Object type that provide information about actions that have either
|
||||
* already occurred, are in the process of occurring, or may occur in the future.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Activity objects are specializations of the base Object type that provide information about actions that have either
|
||||
* already occurred, are in the process of occurring, or may occur in the future.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -22,7 +24,7 @@ class ActivityRequest
|
|||
|
||||
protected URI $uri;
|
||||
|
||||
protected ?Activity $activity;
|
||||
protected ?Activity $activity = null;
|
||||
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
|
|
@ -49,12 +51,12 @@ class ActivityRequest
|
|||
public function post(): void
|
||||
{
|
||||
// send Message to Fediverse instance
|
||||
$this->request->post($this->uri, $this->options);
|
||||
$this->request->post((string) $this->uri, $this->options);
|
||||
}
|
||||
|
||||
public function get(): ResponseInterface
|
||||
{
|
||||
return $this->request->get($this->uri, $this->options);
|
||||
return $this->request->get((string) $this->uri, $this->options);
|
||||
}
|
||||
|
||||
public function getDomain(): string
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -9,10 +11,10 @@
|
|||
namespace ActivityPub\Controllers;
|
||||
|
||||
use ActivityPub\Config\ActivityPub;
|
||||
use ActivityPub\Entities\Actor;
|
||||
use ActivityPub\Entities\Note;
|
||||
use ActivityPub\Objects\OrderedCollectionObject;
|
||||
use ActivityPub\Objects\OrderedCollectionPage;
|
||||
use App\Entities\Actor;
|
||||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
|
@ -93,26 +95,34 @@ class ActorController extends Controller
|
|||
return $this->response->setStatusCode(501)
|
||||
->setJSON([]);
|
||||
}
|
||||
|
||||
$replyToNote = model('NoteModel')
|
||||
->getNoteByUri($payload->object->inReplyTo,);
|
||||
// TODO: strip content from html to retrieve message
|
||||
// remove all html tags and reconstruct message with mentions?
|
||||
extract_text_from_html($payload->object->content);
|
||||
$reply = new Note([
|
||||
'uri' => $payload->object->id,
|
||||
'actor_id' => $payloadActor->id,
|
||||
'in_reply_to_id' => $replyToNote->id,
|
||||
'message' => $payload->object->content,
|
||||
'published_at' => Time::parse($payload->object->published,),
|
||||
]);
|
||||
$noteId = model('NoteModel')
|
||||
->addReply($reply, true, false);
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => service('uuid')
|
||||
->fromBytes($noteId)
|
||||
->getString(),
|
||||
->getNoteByUri($payload->object->inReplyTo);
|
||||
|
||||
$reply = null;
|
||||
if ($replyToNote !== null) {
|
||||
// TODO: strip content from html to retrieve message
|
||||
// remove all html tags and reconstruct message with mentions?
|
||||
extract_text_from_html($payload->object->content);
|
||||
$reply = new Note([
|
||||
'uri' => $payload->object->id,
|
||||
'actor_id' => $payloadActor->id,
|
||||
'in_reply_to_id' => $replyToNote->id,
|
||||
'message' => $payload->object->content,
|
||||
'published_at' => Time::parse($payload->object->published,),
|
||||
]);
|
||||
}
|
||||
|
||||
if ($reply !== null) {
|
||||
$noteId = model('NoteModel')
|
||||
->addReply($reply, true, false);
|
||||
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $noteId,
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setStatusCode(200)
|
||||
->setJSON([]);
|
||||
}
|
||||
|
|
@ -121,17 +131,19 @@ class ActorController extends Controller
|
|||
->setJSON([]);
|
||||
case 'Delete':
|
||||
$noteToDelete = model('NoteModel')
|
||||
->getNoteByUri($payload->object->id,);
|
||||
->getNoteByUri($payload->object->id);
|
||||
|
||||
model('NoteModel')
|
||||
->removeNote($noteToDelete, false);
|
||||
if ($noteToDelete !== null) {
|
||||
model('NoteModel')
|
||||
->removeNote($noteToDelete, false);
|
||||
}
|
||||
|
||||
return $this->response->setStatusCode(200)
|
||||
->setJSON([]);
|
||||
case 'Follow':
|
||||
// add to followers table
|
||||
model('FollowModel')
|
||||
->addFollower($payloadActor, $this->actor, false,);
|
||||
->addFollower($payloadActor, $this->actor, false);
|
||||
|
||||
// Automatically accept follow by returning accept activity
|
||||
accept_follow($this->actor, $payloadActor, $payload->id);
|
||||
|
|
@ -145,14 +157,16 @@ class ActorController extends Controller
|
|||
$note = model('NoteModel')
|
||||
->getNoteByUri($payload->object);
|
||||
|
||||
// Like side-effect
|
||||
model('FavouriteModel')
|
||||
->addFavourite($payloadActor, $note, false,);
|
||||
if ($note !== null) {
|
||||
// Like side-effect
|
||||
model('FavouriteModel')
|
||||
->addFavourite($payloadActor, $note, false);
|
||||
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $note->id,
|
||||
]);
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $note->id,
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setStatusCode(200)
|
||||
->setJSON([]);
|
||||
|
|
@ -160,13 +174,15 @@ class ActorController extends Controller
|
|||
$note = model('NoteModel')
|
||||
->getNoteByUri($payload->object);
|
||||
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $note->id,
|
||||
]);
|
||||
if ($note !== null) {
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $note->id,
|
||||
]);
|
||||
|
||||
model('NoteModel')
|
||||
->reblog($payloadActor, $note, false);
|
||||
model('NoteModel')
|
||||
->reblog($payloadActor, $note, false);
|
||||
}
|
||||
|
||||
return $this->response->setStatusCode(200)
|
||||
->setJSON([]);
|
||||
|
|
@ -177,46 +193,53 @@ class ActorController extends Controller
|
|||
case 'Follow':
|
||||
// revert side-effect by removing follow from database
|
||||
model('FollowModel')
|
||||
->removeFollower($payloadActor, $this->actor, false,);
|
||||
->removeFollower($payloadActor, $this->actor, false);
|
||||
|
||||
// TODO: undo has been accepted! (202 - Accepted)
|
||||
return $this->response->setStatusCode(202)
|
||||
->setJSON([]);
|
||||
case 'Like':
|
||||
$note = model('NoteModel')
|
||||
->getNoteByUri($payload->object->object,);
|
||||
->getNoteByUri($payload->object->object);
|
||||
|
||||
// revert side-effect by removing favourite from database
|
||||
model('FavouriteModel')
|
||||
->removeFavourite($payloadActor, $note, false,);
|
||||
if ($note !== null) {
|
||||
// revert side-effect by removing favourite from database
|
||||
model('FavouriteModel')
|
||||
->removeFavourite($payloadActor, $note, false);
|
||||
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $note->id,
|
||||
]);
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $note->id,
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setStatusCode(200)
|
||||
->setJSON([]);
|
||||
case 'Announce':
|
||||
$note = model('NoteModel')
|
||||
->getNoteByUri($payload->object->object,);
|
||||
->getNoteByUri($payload->object->object);
|
||||
|
||||
$reblogNote = model('NoteModel')
|
||||
->where([
|
||||
'actor_id' => $payloadActor->id,
|
||||
'reblog_of_id' => service('uuid')
|
||||
->fromString($note->id)
|
||||
->getBytes(),
|
||||
])
|
||||
->first();
|
||||
$reblogNote = null;
|
||||
if ($note !== null) {
|
||||
$reblogNote = model('NoteModel')
|
||||
->where([
|
||||
'actor_id' => $payloadActor->id,
|
||||
'reblog_of_id' => service('uuid')
|
||||
->fromString($note->id)
|
||||
->getBytes(),
|
||||
])
|
||||
->first();
|
||||
}
|
||||
|
||||
model('NoteModel')
|
||||
->undoReblog($reblogNote, false);
|
||||
if ($reblogNote !== null) {
|
||||
model('NoteModel')
|
||||
->undoReblog($reblogNote, false);
|
||||
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $note->id,
|
||||
]);
|
||||
model('ActivityModel')
|
||||
->update($activityId, [
|
||||
'note_id' => $note->id,
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setStatusCode(200)
|
||||
->setJSON([]);
|
||||
|
|
@ -251,7 +274,7 @@ class ActorController extends Controller
|
|||
$pager = $actorActivity->pager;
|
||||
$collection = new OrderedCollectionObject(null, $pager);
|
||||
} else {
|
||||
$paginatedActivity = $actorActivity->paginate(12, 'default', $pageNumber,);
|
||||
$paginatedActivity = $actorActivity->paginate(12, 'default', $pageNumber);
|
||||
$pager = $actorActivity->pager;
|
||||
$orderedItems = [];
|
||||
foreach ($paginatedActivity as $activity) {
|
||||
|
|
@ -283,14 +306,14 @@ class ActorController extends Controller
|
|||
$pager = $followers->pager;
|
||||
$followersCollection = new OrderedCollectionObject(null, $pager);
|
||||
} else {
|
||||
$paginatedFollowers = $followers->paginate(12, 'default', $pageNumber,);
|
||||
$paginatedFollowers = $followers->paginate(12, 'default', $pageNumber);
|
||||
$pager = $followers->pager;
|
||||
|
||||
$orderedItems = [];
|
||||
foreach ($paginatedFollowers as $follower) {
|
||||
$orderedItems[] = $follower->uri;
|
||||
}
|
||||
$followersCollection = new OrderedCollectionPage($pager, $orderedItems,);
|
||||
$followersCollection = new OrderedCollectionPage($pager, $orderedItems);
|
||||
}
|
||||
|
||||
return $this->response
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -64,7 +66,7 @@ class BlockController extends Controller
|
|||
}
|
||||
|
||||
model('BlockedDomainModel')
|
||||
->blockDomain($this->request->getPost('domain'),);
|
||||
->blockDomain($this->request->getPost('domain'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
@ -102,7 +104,7 @@ class BlockController extends Controller
|
|||
}
|
||||
|
||||
model('BlockedDomainModel')
|
||||
->unblockDomain($this->request->getPost('domain'),);
|
||||
->unblockDomain($this->request->getPost('domain'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -15,6 +17,7 @@ use ActivityPub\Objects\OrderedCollectionPage;
|
|||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\Response;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\I18n\Time;
|
||||
|
||||
|
|
@ -44,7 +47,10 @@ class NoteController extends Controller
|
|||
return $this->{$method}(...$params);
|
||||
}
|
||||
|
||||
public function index(): RedirectResponse
|
||||
/**
|
||||
* @noRector ReturnTypeDeclarationRector
|
||||
*/
|
||||
public function index(): Response
|
||||
{
|
||||
$noteObjectClass = $this->config->noteObject;
|
||||
$noteObject = new $noteObjectClass($this->note);
|
||||
|
|
@ -54,7 +60,10 @@ class NoteController extends Controller
|
|||
->setBody($noteObject->toJSON());
|
||||
}
|
||||
|
||||
public function replies(): RedirectResponse
|
||||
/**
|
||||
* @noRector ReturnTypeDeclarationRector
|
||||
*/
|
||||
public function replies(): Response
|
||||
{
|
||||
/**
|
||||
* get note replies
|
||||
|
|
@ -71,7 +80,7 @@ class NoteController extends Controller
|
|||
$pager = $noteReplies->pager;
|
||||
$collection = new OrderedCollectionObject(null, $pager);
|
||||
} else {
|
||||
$paginatedReplies = $noteReplies->paginate(12, 'default', $pageNumber,);
|
||||
$paginatedReplies = $noteReplies->paginate(12, 'default', $pageNumber);
|
||||
$pager = $noteReplies->pager;
|
||||
|
||||
$orderedItems = [];
|
||||
|
|
@ -138,7 +147,7 @@ class NoteController extends Controller
|
|||
}
|
||||
|
||||
$actor = model('ActorModel')
|
||||
->getActorById($this->request->getPost('actor_id'),);
|
||||
->getActorById($this->request->getPost('actor_id'));
|
||||
|
||||
model('FavouriteModel')
|
||||
->toggleFavourite($actor, $this->note->id);
|
||||
|
|
@ -160,7 +169,7 @@ class NoteController extends Controller
|
|||
}
|
||||
|
||||
$actor = model('ActorModel')
|
||||
->getActorById($this->request->getPost('actor_id'),);
|
||||
->getActorById($this->request->getPost('actor_id'));
|
||||
|
||||
model('NoteModel')
|
||||
->toggleReblog($actor, $this->note);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This class defines the Object which is the primary base type for the Activity Streams vocabulary.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Activity objects are specializations of the base Object type that provide information about actions that have either
|
||||
* already occurred, are in the process of occurring, or may occur in the future.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This class defines the Object which is the primary base type for the Activity Streams vocabulary.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddActors Creates activitypub_actors table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddNotes Creates activitypub_notes table in database
|
||||
*
|
||||
|
|
@ -76,9 +78,9 @@ class AddNotes extends Migration
|
|||
$this->forge->addUniqueKey('uri');
|
||||
// FIXME: an actor must reblog a note only once
|
||||
// $this->forge->addUniqueKey(['actor_id', 'reblog_of_id']);
|
||||
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('in_reply_to_id', 'activitypub_notes', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('reblog_of_id', 'activitypub_notes', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
|
||||
$this->forge->addForeignKey('in_reply_to_id', 'activitypub_notes', 'id', '', 'CASCADE');
|
||||
$this->forge->addForeignKey('reblog_of_id', 'activitypub_notes', 'id', '', 'CASCADE');
|
||||
$this->forge->createTable('activitypub_notes');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddActivities Creates activitypub_activities table in database
|
||||
*
|
||||
|
|
@ -58,9 +60,9 @@ class AddActivities extends Migration
|
|||
],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('target_actor_id', 'activitypub_actors', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
|
||||
$this->forge->addForeignKey('target_actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
|
||||
$this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE');
|
||||
$this->forge->createTable('activitypub_activities');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddFavourites Creates activitypub_favourites table in database
|
||||
*
|
||||
|
|
@ -26,10 +28,10 @@ class AddFavourites extends Migration
|
|||
'constraint' => 16,
|
||||
],
|
||||
]);
|
||||
$this->forge->addField('`created_at` timestamp NOT NULL DEFAULT current_timestamp()',);
|
||||
$this->forge->addField('`created_at` timestamp NOT NULL DEFAULT current_timestamp()');
|
||||
$this->forge->addPrimaryKey(['actor_id', 'note_id']);
|
||||
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
|
||||
$this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE');
|
||||
$this->forge->createTable('activitypub_favourites');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddFollowers Creates activitypub_followers table in database
|
||||
*
|
||||
|
|
@ -28,10 +30,10 @@ class AddFollowers extends Migration
|
|||
'comment' => 'Actor that is followed',
|
||||
],
|
||||
]);
|
||||
$this->forge->addField('`created_at` timestamp NOT NULL DEFAULT current_timestamp()',);
|
||||
$this->forge->addField('`created_at` timestamp NOT NULL DEFAULT current_timestamp()');
|
||||
$this->forge->addPrimaryKey(['actor_id', 'target_actor_id']);
|
||||
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('target_actor_id', 'activitypub_actors', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
|
||||
$this->forge->addForeignKey('target_actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
|
||||
$this->forge->createTable('activitypub_follows');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddPreviewCards Creates activitypub_preview_cards table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddNotePreviewCards Creates activitypub_notes_preview_cards table in database
|
||||
*
|
||||
|
|
@ -28,8 +30,8 @@ class AddNotesPreviewCards extends Migration
|
|||
]);
|
||||
|
||||
$this->forge->addPrimaryKey(['note_id', 'preview_card_id']);
|
||||
$this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('preview_card_id', 'activitypub_preview_cards', 'id', '', 'CASCADE',);
|
||||
$this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE');
|
||||
$this->forge->addForeignKey('preview_card_id', 'activitypub_preview_cards', 'id', '', 'CASCADE');
|
||||
$this->forge->createTable('activitypub_notes_preview_cards');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Class AddBlockedDomains Creates activitypub_blocked_domains table in database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -27,11 +29,11 @@ use RuntimeException;
|
|||
*/
|
||||
class Activity extends UuidEntity
|
||||
{
|
||||
protected ?Actor $actor;
|
||||
protected ?Actor $actor = null;
|
||||
|
||||
protected ?Actor $target_actor;
|
||||
protected ?Actor $target_actor = null;
|
||||
|
||||
protected ?Note $note;
|
||||
protected ?Note $note = null;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
|
|
@ -59,7 +61,7 @@ class Activity extends UuidEntity
|
|||
public function getActor(): Actor
|
||||
{
|
||||
if ($this->actor_id === null) {
|
||||
throw new RuntimeException('Activity must have an actor_id before getting the actor.',);
|
||||
throw new RuntimeException('Activity must have an actor_id before getting the actor.');
|
||||
}
|
||||
|
||||
if ($this->actor === null) {
|
||||
|
|
@ -73,12 +75,12 @@ class Activity extends UuidEntity
|
|||
public function getTargetActor(): Actor
|
||||
{
|
||||
if ($this->target_actor_id === null) {
|
||||
throw new RuntimeException('Activity must have a target_actor_id before getting the target actor.',);
|
||||
throw new RuntimeException('Activity must have a target_actor_id before getting the target actor.');
|
||||
}
|
||||
|
||||
if ($this->target_actor === null) {
|
||||
$this->target_actor = model('ActorModel')
|
||||
->getActorById($this->target_actor_id,);
|
||||
->getActorById($this->target_actor_id);
|
||||
}
|
||||
|
||||
return $this->target_actor;
|
||||
|
|
@ -87,7 +89,7 @@ class Activity extends UuidEntity
|
|||
public function getNote(): Note
|
||||
{
|
||||
if ($this->note_id === null) {
|
||||
throw new RuntimeException('Activity must have a note_id before getting note.',);
|
||||
throw new RuntimeException('Activity must have a note_id before getting note.');
|
||||
}
|
||||
|
||||
if ($this->note === null) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -95,12 +97,12 @@ class Actor extends Entity
|
|||
public function getFollowers(): array
|
||||
{
|
||||
if ($this->id === null) {
|
||||
throw new RuntimeException('Actor must be created before getting followers.',);
|
||||
throw new RuntimeException('Actor must be created before getting followers.');
|
||||
}
|
||||
|
||||
if ($this->followers === null) {
|
||||
$this->followers = (array) model('ActorModel')
|
||||
->getFollowers($this->id,);
|
||||
->getFollowers($this->id);
|
||||
}
|
||||
|
||||
return $this->followers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -16,7 +18,7 @@ use RuntimeException;
|
|||
* @property string $id
|
||||
* @property string $uri
|
||||
* @property int $actor_id
|
||||
* @property Actor $actor
|
||||
* @property Actor|null $actor
|
||||
* @property string|null $in_reply_to_id
|
||||
* @property bool $is_reply
|
||||
* @property Note|null $reply_to_note
|
||||
|
|
@ -95,10 +97,10 @@ class Note extends UuidEntity
|
|||
/**
|
||||
* Returns the note's actor
|
||||
*/
|
||||
public function getActor(): Actor
|
||||
public function getActor(): ?Actor
|
||||
{
|
||||
if ($this->actor_id === null) {
|
||||
throw new RuntimeException('Note must have an actor_id before getting actor.',);
|
||||
throw new RuntimeException('Note must have an actor_id before getting actor.');
|
||||
}
|
||||
|
||||
if ($this->actor === null) {
|
||||
|
|
@ -112,12 +114,12 @@ class Note extends UuidEntity
|
|||
public function getPreviewCard(): ?PreviewCard
|
||||
{
|
||||
if ($this->id === null) {
|
||||
throw new RuntimeException('Note must be created before getting preview_card.',);
|
||||
throw new RuntimeException('Note must be created before getting preview_card.');
|
||||
}
|
||||
|
||||
if ($this->preview_card === null) {
|
||||
$this->preview_card = model('PreviewCardModel')
|
||||
->getNotePreviewCard($this->id,);
|
||||
->getNotePreviewCard($this->id);
|
||||
}
|
||||
|
||||
return $this->preview_card;
|
||||
|
|
@ -130,9 +132,7 @@ class Note extends UuidEntity
|
|||
|
||||
public function getIsReply(): bool
|
||||
{
|
||||
$this->is_reply = $this->in_reply_to_id !== null;
|
||||
|
||||
return $this->is_reply;
|
||||
return $this->in_reply_to_id && ($this->getReplyToNote() !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -141,12 +141,12 @@ class Note extends UuidEntity
|
|||
public function getReplies(): array
|
||||
{
|
||||
if ($this->id === null) {
|
||||
throw new RuntimeException('Note must be created before getting replies.',);
|
||||
throw new RuntimeException('Note must be created before getting replies.');
|
||||
}
|
||||
|
||||
if ($this->replies === null) {
|
||||
$this->replies = (array) model('NoteModel')
|
||||
->getNoteReplies($this->id,);
|
||||
->getNoteReplies($this->id);
|
||||
}
|
||||
|
||||
return $this->replies;
|
||||
|
|
@ -157,7 +157,7 @@ class Note extends UuidEntity
|
|||
return $this->getReplies() !== null;
|
||||
}
|
||||
|
||||
public function getReplyToNote(): self
|
||||
public function getReplyToNote(): ?self
|
||||
{
|
||||
if ($this->in_reply_to_id === null) {
|
||||
throw new RuntimeException('Note is not a reply.');
|
||||
|
|
@ -165,7 +165,7 @@ class Note extends UuidEntity
|
|||
|
||||
if ($this->reply_to_note === null) {
|
||||
$this->reply_to_note = model('NoteModel')
|
||||
->getNoteById($this->in_reply_to_id,);
|
||||
->getNoteById($this->in_reply_to_id);
|
||||
}
|
||||
|
||||
return $this->reply_to_note;
|
||||
|
|
@ -177,12 +177,12 @@ class Note extends UuidEntity
|
|||
public function getReblogs(): array
|
||||
{
|
||||
if ($this->id === null) {
|
||||
throw new RuntimeException('Note must be created before getting reblogs.',);
|
||||
throw new RuntimeException('Note must be created before getting reblogs.');
|
||||
}
|
||||
|
||||
if ($this->reblogs === null) {
|
||||
$this->reblogs = (array) model('NoteModel')
|
||||
->getNoteReblogs($this->id,);
|
||||
->getNoteReblogs($this->id);
|
||||
}
|
||||
|
||||
return $this->reblogs;
|
||||
|
|
@ -193,7 +193,7 @@ class Note extends UuidEntity
|
|||
return $this->reblog_of_id !== null;
|
||||
}
|
||||
|
||||
public function getReblogOfNote(): self
|
||||
public function getReblogOfNote(): ?self
|
||||
{
|
||||
if ($this->reblog_of_id === null) {
|
||||
throw new RuntimeException('Note is not a reblog.');
|
||||
|
|
@ -201,7 +201,7 @@ class Note extends UuidEntity
|
|||
|
||||
if ($this->reblog_of_note === null) {
|
||||
$this->reblog_of_note = model('NoteModel')
|
||||
->getNoteById($this->reblog_of_id,);
|
||||
->getNoteById($this->reblog_of_id);
|
||||
}
|
||||
|
||||
return $this->reblog_of_note;
|
||||
|
|
@ -214,7 +214,7 @@ class Note extends UuidEntity
|
|||
$messageWithoutTags = strip_tags($message);
|
||||
|
||||
$this->attributes['message'] = $messageWithoutTags;
|
||||
$this->attributes['message_html'] = str_replace("\n", '<br />', linkify($messageWithoutTags),);
|
||||
$this->attributes['message_html'] = str_replace("\n", '<br />', linkify($messageWithoutTags));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ActivityPub\Filters;
|
||||
|
||||
use ActivityPub\HttpSignature;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright 2021 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
|
|
@ -27,10 +29,10 @@ if (! function_exists('get_webfinger_data')) {
|
|||
$webfingerUri->setPath('/.well-known/webfinger');
|
||||
$webfingerUri->setQuery("resource=acct:{$username}@{$domain}");
|
||||
|
||||
$webfingerRequest = new ActivityRequest($webfingerUri);
|
||||
$webfingerRequest = new ActivityRequest((string) $webfingerUri);
|
||||
$webfingerResponse = $webfingerRequest->get();
|
||||
|
||||
return json_decode($webfingerResponse->getBody(), false, 512, JSON_THROW_ON_ERROR,);
|
||||
return json_decode($webfingerResponse->getBody(), false, 512, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,14 +79,14 @@ if (! function_exists('accept_follow')) {
|
|||
$acceptActivity->toJSON(),
|
||||
);
|
||||
|
||||
$acceptActivity->set('id', url_to('activity', $actor->username, $activityId),);
|
||||
$acceptActivity->set('id', url_to('activity', $actor->username, $activityId));
|
||||
|
||||
$activityModel->update($activityId, [
|
||||
'payload' => $acceptActivity->toJSON(),
|
||||
]);
|
||||
|
||||
try {
|
||||
$acceptRequest = new ActivityRequest($targetActor->inbox_url, $acceptActivity->toJSON(),);
|
||||
$acceptRequest = new ActivityRequest($targetActor->inbox_url, $acceptActivity->toJSON());
|
||||
$acceptRequest->sign($actor->public_key_id, $actor->private_key);
|
||||
$acceptRequest->post();
|
||||
} catch (Exception) {
|
||||
|
|
@ -103,12 +105,12 @@ if (! function_exists('send_activity_to_followers')) {
|
|||
{
|
||||
foreach ($actor->followers as $follower) {
|
||||
try {
|
||||
$acceptRequest = new ActivityRequest($follower->inbox_url, $activityPayload,);
|
||||
$acceptRequest->sign($actor->public_key_id, $actor->private_key,);
|
||||
$acceptRequest = new ActivityRequest($follower->inbox_url, $activityPayload);
|
||||
$acceptRequest->sign($actor->public_key_id, $actor->private_key);
|
||||
$acceptRequest->post();
|
||||
} catch (Exception $exception) {
|
||||
// log error
|
||||
log_message('critical', $exception);
|
||||
log_message('critical', $exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -122,7 +124,7 @@ if (! function_exists('extract_urls_from_message')) {
|
|||
*/
|
||||
function extract_urls_from_message(string $message): array
|
||||
{
|
||||
preg_match_all('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', $message, $match,);
|
||||
preg_match_all('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i', $message, $match);
|
||||
|
||||
return $match[0];
|
||||
}
|
||||
|
|
@ -236,7 +238,7 @@ if (! function_exists('get_or_create_actor')) {
|
|||
|
||||
// get actorUri with webfinger request
|
||||
$webfingerData = get_webfinger_data($username, $domain);
|
||||
$actorUriKey = array_search('self', array_column($webfingerData->links, 'rel'), true,);
|
||||
$actorUriKey = array_search('self', array_column($webfingerData->links, 'rel'), true);
|
||||
|
||||
return create_actor_from_uri($webfingerData->links[$actorUriKey]->href);
|
||||
}
|
||||
|
|
@ -250,7 +252,7 @@ if (! function_exists('create_actor_from_uri')) {
|
|||
{
|
||||
$activityRequest = new ActivityRequest($actorUri);
|
||||
$actorResponse = $activityRequest->get();
|
||||
$actorPayload = json_decode($actorResponse->getBody(), false, 512, JSON_THROW_ON_ERROR,);
|
||||
$actorPayload = json_decode($actorResponse->getBody(), false, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$newActor = new Actor();
|
||||
$newActor->uri = $actorUri;
|
||||
|
|
@ -331,7 +333,7 @@ if (! function_exists('linkify')) {
|
|||
|
||||
helper('text');
|
||||
|
||||
$link = preg_replace('~^www\.(.+\.)~i', '$1', $link,);
|
||||
$link = preg_replace('~^www\.(.+\.)~i', '$1', $link);
|
||||
|
||||
return '<' .
|
||||
array_push(
|
||||
|
|
@ -374,7 +376,7 @@ if (! function_exists('linkify')) {
|
|||
}
|
||||
|
||||
try {
|
||||
$actor = get_or_create_actor($match['username'], $match['domain'],);
|
||||
$actor = get_or_create_actor($match['username'], $match['domain']);
|
||||
return '<' .
|
||||
array_push(
|
||||
$links,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue