diff --git a/app/Authorization/PermissionModel.php b/app/Authorization/PermissionModel.php index 8809818dd8555e9ec85ab7e1bb1ac8bcc7df8652..72329220d521524c83778b96cff4c81de3379fd2 100644 --- a/app/Authorization/PermissionModel.php +++ b/app/Authorization/PermissionModel.php @@ -34,7 +34,7 @@ class PermissionModel extends MythAuthPermissionModel $groupPermissions = $this->db ->table('auth_groups_permissions') ->select('id, auth_permissions.name') - ->join('auth_permissions', 'auth_permissions.id = permission_id', 'inner',) + ->join('auth_permissions', 'auth_permissions.id = permission_id', 'inner') ->where('group_id', $groupId) ->get() ->getResultObject(); diff --git a/app/Config/Events.php b/app/Config/Events.php index 4de3cedb8b345ca3846d5ce87d2c907948799cea..0ed8a4131b71a603a76a73e46d85b9538d3f5601 100644 --- a/app/Config/Events.php +++ b/app/Config/Events.php @@ -123,7 +123,7 @@ Events::on('on_undo_follow', function ($actor, $targetActor): void { * @param Note $note */ Events::on('on_note_add', function ($note): void { - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { $note = $note->reply_to_note; } @@ -147,7 +147,7 @@ Events::on('on_note_add', function ($note): void { * @param Note $note */ Events::on('on_note_remove', function ($note): void { - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { Events::trigger('on_note_remove', $note->reply_to_note); } @@ -207,7 +207,7 @@ Events::on('on_note_reblog', function ($actor, $note): void { cache() ->deleteMatching("page_note#{$note->id}*"); - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { cache()->deleteMatching("page_note#{$note->in_reply_to_id}"); } }); @@ -239,7 +239,7 @@ Events::on('on_note_undo_reblog', function ($reblogNote): void { cache() ->deleteMatching("page_note#{$reblogNote->id}*"); - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { cache()->deleteMatching("page_note#{$note->in_reply_to_id}"); } @@ -308,7 +308,7 @@ Events::on('on_note_favourite', function ($actor, $note): void { cache() ->deleteMatching("page_note#{$note->id}*"); - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { cache()->deleteMatching("page_note#{$note->in_reply_to_id}*"); } @@ -340,7 +340,7 @@ Events::on('on_note_undo_favourite', function ($actor, $note): void { cache() ->deleteMatching("page_note#{$note->id}*"); - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { cache()->deleteMatching("page_note#{$note->in_reply_to_id}*"); } diff --git a/app/Controllers/Admin/ContributorController.php b/app/Controllers/Admin/ContributorController.php index fb2acb95cb0a20275f1a15ed8b7da5808994a549..9df5bc9bbabef0c44feff8068ce99337d28eba35 100644 --- a/app/Controllers/Admin/ContributorController.php +++ b/app/Controllers/Admin/ContributorController.php @@ -27,19 +27,24 @@ class ContributorController extends BaseController public function _remap(string $method, string ...$params): mixed { - $this->podcast = (new PodcastModel())->getPodcastById((int) $params[0]); + if (count($params) === 0) { + throw PageNotFoundException::forPageNotFound(); + } - if (count($params) <= 1) { - return $this->{$method}(); + if (($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) === null) { + throw PageNotFoundException::forPageNotFound(); } + $this->podcast = $podcast; + if ( - ($this->user = (new UserModel())->getPodcastContributor((int) $params[1], (int) $params[0],)) !== null + count($params) > 1 && + ($this->user = (new UserModel())->getPodcastContributor((int) $params[1], (int) $params[0])) === null ) { - return $this->{$method}(); + throw PageNotFoundException::forPageNotFound(); } - throw PageNotFoundException::forPageNotFound(); + return $this->{$method}(); } public function list(): string @@ -57,7 +62,7 @@ class ContributorController extends BaseController public function view(): string { $data = [ - 'contributor' => (new UserModel())->getPodcastContributor($this->user->id, $this->podcast->id,), + 'contributor' => (new UserModel())->getPodcastContributor($this->user->id, $this->podcast->id), ]; replace_breadcrumb_params([ @@ -173,7 +178,7 @@ class ContributorController extends BaseController $podcastModel = new PodcastModel(); if ( - ! $podcastModel->removePodcastContributor($this->user->id, $this->podcast->id,) + ! $podcastModel->removePodcastContributor($this->user->id, $this->podcast->id) ) { return redirect() ->back() diff --git a/app/Controllers/Admin/EpisodeController.php b/app/Controllers/Admin/EpisodeController.php index df6c21ee0b7a9ec1850fb2e009a8747fcc5f984f..2a847444eecd780087bce39db60374b441f3668d 100644 --- a/app/Controllers/Admin/EpisodeController.php +++ b/app/Controllers/Admin/EpisodeController.php @@ -33,11 +33,13 @@ class EpisodeController extends BaseController public function _remap(string $method, string ...$params): mixed { if ( - ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) === null + ($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) === null ) { throw PageNotFoundException::forPageNotFound(); } + $this->podcast = $podcast; + if (count($params) > 1) { if ( ! ($this->episode = (new EpisodeModel()) @@ -135,7 +137,7 @@ class EpisodeController extends BaseController 'audio_file' => $this->request->getFile('audio_file'), 'description_markdown' => $this->request->getPost('description'), 'image' => $image, - 'location' => new Location($this->request->getPost('location_name'),), + 'location' => new Location($this->request->getPost('location_name')), 'transcript' => $this->request->getFile('transcript'), 'chapters' => $this->request->getFile('chapters'), 'parental_advisory' => @@ -276,7 +278,7 @@ class EpisodeController extends BaseController } } elseif ($transcriptChoice === 'remote-url') { if ( - ($transcriptFileRemoteUrl = $this->request->getPost('transcript_file_remote_url',)) && + ($transcriptFileRemoteUrl = $this->request->getPost('transcript_file_remote_url')) && (($transcriptFile = $this->episode->transcript_file) && $transcriptFile !== null) ) { @@ -295,7 +297,7 @@ class EpisodeController extends BaseController } } elseif ($chaptersChoice === 'remote-url') { if ( - ($chaptersFileRemoteUrl = $this->request->getPost('chapters_file_remote_url',)) && + ($chaptersFileRemoteUrl = $this->request->getPost('chapters_file_remote_url')) && (($chaptersFile = $this->episode->chapters_file) && $chaptersFile !== null) ) { diff --git a/app/Controllers/Admin/EpisodePersonController.php b/app/Controllers/Admin/EpisodePersonController.php index fd54851bc3f577bef03cfae529162ca460d3dd69..771311fec09a54c11068e15d6871816bab1f959e 100644 --- a/app/Controllers/Admin/EpisodePersonController.php +++ b/app/Controllers/Admin/EpisodePersonController.php @@ -31,7 +31,7 @@ class EpisodePersonController extends BaseController } if ( - ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) && + ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0])) && ($this->episode = (new EpisodeModel()) ->where([ 'id' => $params[1], diff --git a/app/Controllers/Admin/PersonController.php b/app/Controllers/Admin/PersonController.php index d8cb6bca80b186be894e681035ca8f222b1a2c13..468f836374b421bb3d8f6016bbe40d949966885b 100644 --- a/app/Controllers/Admin/PersonController.php +++ b/app/Controllers/Admin/PersonController.php @@ -27,7 +27,7 @@ class PersonController extends BaseController } if ( - ($this->person = (new PersonModel())->getPersonById((int) $params[0],)) !== null + ($this->person = (new PersonModel())->getPersonById((int) $params[0])) !== null ) { return $this->{$method}(); } diff --git a/app/Controllers/Admin/PodcastController.php b/app/Controllers/Admin/PodcastController.php index ac7464f0bab67d3ae1ad71012d08e920264a0ee1..d6b0e577f3b8957c226e592f0b9d525a9675181e 100644 --- a/app/Controllers/Admin/PodcastController.php +++ b/app/Controllers/Admin/PodcastController.php @@ -33,7 +33,7 @@ class PodcastController extends BaseController } if ( - ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) !== null + ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0])) !== null ) { return $this->{$method}(); } @@ -45,7 +45,7 @@ class PodcastController extends BaseController { if (! has_permission('podcasts-list')) { $data = [ - 'podcasts' => (new PodcastModel())->getUserPodcasts((int) user_id(),), + 'podcasts' => (new PodcastModel())->getUserPodcasts((int) user_id()), ]; } else { $data = [ @@ -162,7 +162,7 @@ class PodcastController extends BaseController $data = [ 'languageOptions' => $languageOptions, 'categoryOptions' => $categoryOptions, - 'browserLang' => get_browser_language($this->request->getServer('HTTP_ACCEPT_LANGUAGE'),), + 'browserLang' => get_browser_language($this->request->getServer('HTTP_ACCEPT_LANGUAGE')), ]; return view('admin/podcast/create', $data); @@ -207,7 +207,7 @@ class PodcastController extends BaseController 'publisher' => $this->request->getPost('publisher'), 'type' => $this->request->getPost('type'), 'copyright' => $this->request->getPost('copyright'), - 'location' => new Location($this->request->getPost('location_name'),), + 'location' => new Location($this->request->getPost('location_name')), 'payment_pointer' => $this->request->getPost( 'payment_pointer' ) === '' ? null : $this->request->getPost('payment_pointer'), diff --git a/app/Controllers/Admin/PodcastImportController.php b/app/Controllers/Admin/PodcastImportController.php index 1a393e0de76fe723655b41869de780bbe43962c9..908a1b4d82bee910bdbb9b84652cdb09127dd980 100644 --- a/app/Controllers/Admin/PodcastImportController.php +++ b/app/Controllers/Admin/PodcastImportController.php @@ -56,7 +56,7 @@ class PodcastImportController extends BaseController $data = [ 'languageOptions' => $languageOptions, 'categoryOptions' => $categoryOptions, - 'browserLang' => get_browser_language($this->request->getServer('HTTP_ACCEPT_LANGUAGE'),), + 'browserLang' => get_browser_language($this->request->getServer('HTTP_ACCEPT_LANGUAGE')), ]; return view('admin/podcast/import', $data); @@ -132,10 +132,10 @@ class PodcastImportController extends BaseController $podcast = new Podcast([ 'name' => $this->request->getPost('name'), - 'imported_feed_url' => $this->request->getPost('imported_feed_url',), - 'new_feed_url' => base_url(route_to('podcast_feed', $this->request->getPost('name')),), + 'imported_feed_url' => $this->request->getPost('imported_feed_url'), + 'new_feed_url' => base_url(route_to('podcast_feed', $this->request->getPost('name'))), 'title' => (string) $feed->channel[0]->title, - 'description_markdown' => $converter->convert($channelDescriptionHtml,), + 'description_markdown' => $converter->convert($channelDescriptionHtml), 'description_html' => $channelDescriptionHtml, 'image' => new Image($imageFile), 'language_code' => $this->request->getPost('language'), @@ -323,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; } @@ -342,8 +342,8 @@ class PodcastImportController extends BaseController 'guid' => $item->guid ?? null, 'title' => $item->title, 'slug' => $slug, - 'audio_file' => download_file((string) $item->enclosure->attributes()['url'],), - 'description_markdown' => $converter->convert($itemDescriptionHtml,), + 'audio_file' => download_file((string) $item->enclosure->attributes()['url']), + 'description_markdown' => $converter->convert($itemDescriptionHtml), 'description_html' => $itemDescriptionHtml, 'image' => $episodeImage, 'parental_advisory' => diff --git a/app/Controllers/Admin/PodcastPersonController.php b/app/Controllers/Admin/PodcastPersonController.php index 00811f1838fb37e808df73572804e0defbb32f8e..db5e2df0149ac5056d8c0e49e4aef6994af40ec6 100644 --- a/app/Controllers/Admin/PodcastPersonController.php +++ b/app/Controllers/Admin/PodcastPersonController.php @@ -27,7 +27,7 @@ class PodcastPersonController extends BaseController } if ( - ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) !== null + ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0])) !== null ) { unset($params[0]); return $this->{$method}(...$params); @@ -42,7 +42,7 @@ class PodcastPersonController extends BaseController $data = [ 'podcast' => $this->podcast, - 'podcastPersons' => (new PersonModel())->getPodcastPersons($this->podcast->id,), + 'podcastPersons' => (new PersonModel())->getPodcastPersons($this->podcast->id), 'personOptions' => (new PersonModel())->getPersonOptions(), 'taxonomyOptions' => (new PersonModel())->getTaxonomyOptions(), ]; diff --git a/app/Controllers/Admin/PodcastPlatformController.php b/app/Controllers/Admin/PodcastPlatformController.php index 0f8d6b0a599156313e3193eb1c9dd833eb930233..4b1cb539a66d75b1f79f8b11a56b1127844f014e 100644 --- a/app/Controllers/Admin/PodcastPlatformController.php +++ b/app/Controllers/Admin/PodcastPlatformController.php @@ -28,7 +28,7 @@ class PodcastPlatformController extends BaseController } if ( - ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0],)) !== null + ($this->podcast = (new PodcastModel())->getPodcastById((int) $params[0])) !== null ) { unset($params[0]); return $this->{$method}(...$params); @@ -49,7 +49,7 @@ class PodcastPlatformController extends BaseController $data = [ 'podcast' => $this->podcast, 'platformType' => $platformType, - 'platforms' => (new PlatformModel())->getPlatformsWithLinks($this->podcast->id, $platformType,), + 'platforms' => (new PlatformModel())->getPlatformsWithLinks($this->podcast->id, $platformType), ]; replace_breadcrumb_params([ diff --git a/app/Controllers/EpisodeController.php b/app/Controllers/EpisodeController.php index f94fb386c8fd08180c2bb39a2654926450ae74dc..89c6fac2b06c8b5b663740f818bbd2b18551f9b3 100644 --- a/app/Controllers/EpisodeController.php +++ b/app/Controllers/EpisodeController.php @@ -35,20 +35,25 @@ class EpisodeController extends BaseController } if ( - ($this->podcast = (new PodcastModel())->getPodcastByName($params[0],)) === null + ($podcast = (new PodcastModel())->getPodcastByName($params[0])) === null ) { throw PageNotFoundException::forPageNotFound(); } + $this->podcast = $podcast; + if ( - ($this->episode = (new EpisodeModel())->getEpisodeBySlug($params[0], $params[1],)) !== null + ($episode = (new EpisodeModel())->getEpisodeBySlug($params[0], $params[1])) === null ) { - unset($params[1]); - unset($params[0]); - return $this->{$method}(...$params); + throw PageNotFoundException::forPageNotFound(); } - throw PageNotFoundException::forPageNotFound(); + $this->episode = $episode; + + unset($params[1]); + unset($params[0]); + + return $this->{$method}(...$params); } public function index(): string diff --git a/app/Controllers/InstallController.php b/app/Controllers/InstallController.php index 9873ac500348548e61aab7d99d49a4daeec7fa4f..828a6bbd928db1c81c98ac6cafe00e13ba4e2d5f 100644 --- a/app/Controllers/InstallController.php +++ b/app/Controllers/InstallController.php @@ -155,7 +155,7 @@ class InstallController extends Controller if (! $this->validate($rules)) { return redirect() - ->to((host_url() === null ? config('App') ->baseURL : host_url()) . config('App')->installGateway,) + ->to((host_url() === null ? config('App') ->baseURL : host_url()) . config('App')->installGateway) ->withInput() ->with('errors', $this->validator->getErrors()); } @@ -173,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 @@ -198,10 +198,10 @@ class InstallController extends Controller } self::writeEnv([ - 'database.default.hostname' => $this->request->getPost('db_hostname',), + 'database.default.hostname' => $this->request->getPost('db_hostname'), 'database.default.database' => $this->request->getPost('db_name'), - 'database.default.username' => $this->request->getPost('db_username',), - 'database.default.password' => $this->request->getPost('db_password',), + 'database.default.username' => $this->request->getPost('db_username'), + 'database.default.password' => $this->request->getPost('db_password'), 'database.default.DBPrefix' => $this->request->getPost('db_prefix'), ]); diff --git a/app/Controllers/NoteController.php b/app/Controllers/NoteController.php index 90524b54d24418d08faaec3c3250a59a18b079f8..a5ddd3d8357b2a4f5ca08cb28f41479dc90ac724 100644 --- a/app/Controllers/NoteController.php +++ b/app/Controllers/NoteController.php @@ -39,8 +39,12 @@ class NoteController extends ActivityPubNoteController public function _remap(string $method, string ...$params): mixed { + if (count($params) < 2) { + throw PageNotFoundException::forPageNotFound(); + } + if ( - ($this->podcast = (new PodcastModel())->getPodcastByName($params[0],)) === null + ($this->podcast = (new PodcastModel())->getPodcastByName($params[0])) === null ) { throw PageNotFoundException::forPageNotFound(); } @@ -48,11 +52,13 @@ class NoteController extends ActivityPubNoteController $this->actor = $this->podcast->actor; if ( - count($params) > 1 && - ! ($this->note = (new NoteModel())->getNoteById($params[1])) + ($note = (new NoteModel())->getNoteById($params[1])) === null ) { throw PageNotFoundException::forPageNotFound(); } + + $this->note = $note; + unset($params[0]); unset($params[1]); @@ -125,7 +131,7 @@ class NoteController extends ActivityPubNoteController if ( $episodeUri && ($params = extract_params_from_episode_uri(new URI($episodeUri))) && - ($episode = (new EpisodeModel())->getEpisodeBySlug($params['podcastName'], $params['episodeSlug'],)) + ($episode = (new EpisodeModel())->getEpisodeBySlug($params['podcastName'], $params['episodeSlug'])) ) { $newNote->episode_id = $episode->id; } @@ -135,7 +141,7 @@ class NoteController extends ActivityPubNoteController $noteModel = new NoteModel(); if ( ! $noteModel - ->addNote($newNote, ! (bool) $newNote->episode_id, true,) + ->addNote($newNote, ! (bool) $newNote->episode_id, true) ) { return redirect() ->back() diff --git a/app/Controllers/PageController.php b/app/Controllers/PageController.php index 0ad1553ae1015301f30dd6d076b6aeac78688aba..7f3302320d1c52271febbdd60880e61ca5798897 100644 --- a/app/Controllers/PageController.php +++ b/app/Controllers/PageController.php @@ -16,7 +16,7 @@ use CodeIgniter\Exceptions\PageNotFoundException; class PageController extends BaseController { - protected ?Page $page = null; + protected Page $page; public function _remap(string $method, string ...$params): mixed { @@ -25,12 +25,14 @@ class PageController extends BaseController } if ( - $this->page = (new PageModel())->where('slug', $params[0])->first() + ($page = (new PageModel())->where('slug', $params[0])->first()) === null ) { - return $this->{$method}(); + throw PageNotFoundException::forPageNotFound(); } - throw PageNotFoundException::forPageNotFound(); + $this->page = $page; + + return $this->{$method}(); } public function index(): string diff --git a/app/Controllers/PodcastController.php b/app/Controllers/PodcastController.php index 07fbc1b0d7c80fbfda4e0b083a8cbf8431ed3e38..793352512a910999f4893f3abdefbdea8adf7486 100644 --- a/app/Controllers/PodcastController.php +++ b/app/Controllers/PodcastController.php @@ -30,13 +30,15 @@ class PodcastController extends BaseController } if ( - ($this->podcast = (new PodcastModel())->getPodcastByName($params[0],)) !== null + ($podcast = (new PodcastModel())->getPodcastByName($params[0])) === null ) { - unset($params[0]); - return $this->{$method}(...$params); + throw PageNotFoundException::forPageNotFound(); } - throw PageNotFoundException::forPageNotFound(); + $this->podcast = $podcast; + + unset($params[0]); + return $this->{$method}(...$params); } public function activity(): string @@ -61,7 +63,7 @@ class PodcastController extends BaseController if (! ($cachedView = cache($cacheName))) { $data = [ 'podcast' => $this->podcast, - 'notes' => (new NoteModel())->getActorPublishedNotes($this->podcast->actor_id,), + 'notes' => (new NoteModel())->getActorPublishedNotes($this->podcast->actor_id), ]; // if user is logged in then send to the authenticated activity view diff --git a/app/Database/Seeds/AuthSeeder.php b/app/Database/Seeds/AuthSeeder.php index 3905e55d6aa1f5ed04f89608ae1dce6e2edebbfc..88e4baa8035b555a1f9efab29a439e05f8be7910 100644 --- a/app/Database/Seeds/AuthSeeder.php +++ b/app/Database/Seeds/AuthSeeder.php @@ -277,7 +277,7 @@ class AuthSeeder extends Seeder foreach ($action['has_permission'] as $role) { // link permission to specified groups $dataGroupsPermissions[] = [ - 'group_id' => $this->getGroupIdByName($role, $dataGroups,), + 'group_id' => $this->getGroupIdByName($role, $dataGroups), 'permission_id' => $permissionId, ]; } diff --git a/app/Database/Seeds/FakePodcastsAnalyticsSeeder.php b/app/Database/Seeds/FakePodcastsAnalyticsSeeder.php index b6d2b345f758c1b8bdaa1762b2cb49962e39109a..b97c1c9da0fb31bcc722c0552ba565a822179fca 100644 --- a/app/Database/Seeds/FakePodcastsAnalyticsSeeder.php +++ b/app/Database/Seeds/FakePodcastsAnalyticsSeeder.php @@ -24,7 +24,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder public function run(): void { $jsonUserAgents = json_decode( - file_get_contents('https://raw.githubusercontent.com/opawg/user-agents/master/src/user-agents.json',), + file_get_contents('https://raw.githubusercontent.com/opawg/user-agents/master/src/user-agents.json'), true, 512, JSON_THROW_ON_ERROR, @@ -63,7 +63,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder ->where('`published_at` <= NOW()', null, false) ->findAll(); foreach ($episodes as $episode) { - $age = floor(($date - strtotime((string) $episode->published_at)) / 86400,); + $age = floor(($date - strtotime((string) $episode->published_at)) / 86400); $probability1 = floor(exp(3 - $age / 40)) + 1; for ( @@ -97,7 +97,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder '.' . rand(0, 255); - $cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb',); + $cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb'); $countryCode = 'N/A'; $regionCode = 'N/A'; diff --git a/app/Entities/Episode.php b/app/Entities/Episode.php index 4b4b63d37807240efcd68d00a85de7b6906b88ba..243586e0eafff733a192424fec9e158d1b77380b 100644 --- a/app/Entities/Episode.php +++ b/app/Entities/Episode.php @@ -396,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 @@ -410,7 +410,7 @@ class Episode extends Entity $this->attributes['slug'], $theme, ) - : route_to('embeddable-player', $this->getPodcast() ->name, $this->attributes['slug'],), + : route_to('embeddable-player', $this->getPodcast() ->name, $this->attributes['slug']), ); } @@ -471,7 +471,7 @@ class Episode extends Entity { if ($this->description === null) { $this->description = trim( - preg_replace('~\s+~', ' ', strip_tags($this->attributes['description_html']),), + preg_replace('~\s+~', ' ', strip_tags($this->attributes['description_html'])), ); } diff --git a/app/Entities/Note.php b/app/Entities/Note.php index 68d39c4fbed0c22e16a96525f2ebd21aeee54b01..5dc0c8bde8461306b9637d33cd7e7ae952e296ca 100644 --- a/app/Entities/Note.php +++ b/app/Entities/Note.php @@ -17,9 +17,6 @@ use RuntimeException; /** * @property int|null $episode_id * @property Episode|null $episode - * @property Actor $actor - * @property Note $reblog_of_note - * @property Note $reply_to_note */ class Note extends ActivityPubNote { diff --git a/app/Entities/Podcast.php b/app/Entities/Podcast.php index bf1b92b6d131ef8cece3c373684c42fd30eb816c..ddde24bf0f90a00bf987465a2ce2097a4c1512fc 100644 --- a/app/Entities/Podcast.php +++ b/app/Entities/Podcast.php @@ -320,7 +320,7 @@ class Podcast extends Entity { if ($this->description === null) { $this->description = trim( - (string) preg_replace('~\s+~', ' ', strip_tags($this->attributes['description_html']),), + (string) preg_replace('~\s+~', ' ', strip_tags($this->attributes['description_html'])), ); } diff --git a/app/Helpers/components_helper.php b/app/Helpers/components_helper.php index 5cb29ff2fe5b468afb3250fb2d4dddf4929446f9..53d1f524fa72881fcf2e4c87cc466c17781e946f 100644 --- a/app/Helpers/components_helper.php +++ b/app/Helpers/components_helper.php @@ -96,7 +96,7 @@ if (! function_exists('button')) { if ($uri !== '') { return anchor($uri, $label, array_merge([ 'class' => $buttonClass, - ], $customAttributes,)); + ], $customAttributes)); } $defaultButtonAttributes = [ diff --git a/app/Helpers/form_helper.php b/app/Helpers/form_helper.php index 2111845a55c579c27f7b724e4df7d05ea0bf8b76..69edf75e8dc9668c4a0529bfe08b85eb90b18bc7 100644 --- a/app/Helpers/form_helper.php +++ b/app/Helpers/form_helper.php @@ -159,9 +159,9 @@ if (! function_exists('form_multiselect')) { 'data-class' => $customExtra['class'], 'data-select-text' => lang('Common.forms.multiSelect.selectText'), 'data-loading-text' => lang('Common.forms.multiSelect.loadingText'), - 'data-no-results-text' => lang('Common.forms.multiSelect.noResultsText',), - 'data-no-choices-text' => lang('Common.forms.multiSelect.noChoicesText',), - 'data-max-item-text' => lang('Common.forms.multiSelect.maxItemText',), + 'data-no-results-text' => lang('Common.forms.multiSelect.noResultsText'), + 'data-no-choices-text' => lang('Common.forms.multiSelect.noChoicesText'), + 'data-max-item-text' => lang('Common.forms.multiSelect.maxItemText'), ]; $extra = stringify_attributes(array_merge($defaultExtra, $customExtra)); diff --git a/app/Helpers/rss_helper.php b/app/Helpers/rss_helper.php index 4b95ecf3fbad441123d10b8aa2671b82f0bbaccb..fd2af8d7c7d34fe556823bd0e06d46116a345e55 100644 --- a/app/Helpers/rss_helper.php +++ b/app/Helpers/rss_helper.php @@ -84,7 +84,7 @@ if (! function_exists('get_rss_feed')) { $recipientElement->addAttribute('split', '100'); } $channel - ->addChild('locked', $podcast->is_locked ? 'yes' : 'no', $podcastNamespace,) + ->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); @@ -142,13 +142,13 @@ if (! function_exists('get_rss_feed')) { $personElement->addAttribute( 'role', htmlspecialchars( - lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en',), + lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en'), ), ); $personElement->addAttribute( 'group', - htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en',),), + htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en')), ); } } @@ -253,7 +253,7 @@ if (! function_exists('get_rss_feed')) { $transcriptElement->addAttribute('url', $episode->transcript_file_url); $transcriptElement->addAttribute( 'type', - Mimes::guessTypeFromExtension(pathinfo($episode->transcript_file_url, PATHINFO_EXTENSION,),), + Mimes::guessTypeFromExtension(pathinfo($episode->transcript_file_url, PATHINFO_EXTENSION)), ); $transcriptElement->addAttribute('language', $podcast->language_code); } @@ -281,13 +281,13 @@ if (! function_exists('get_rss_feed')) { $personElement->addAttribute( 'role', htmlspecialchars( - lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en',), + lang("PersonsTaxonomy.persons.{$role->group}.roles.{$role->role}.label", [], 'en'), ), ); $personElement->addAttribute( 'group', - htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en',),), + htmlspecialchars(lang("PersonsTaxonomy.persons.{$role->group}.label", [], 'en')), ); $personElement->addAttribute('img', $person->image->large_url); diff --git a/app/Libraries/ActivityPub/Controllers/ActorController.php b/app/Libraries/ActivityPub/Controllers/ActorController.php index 7e68c63516bddd696c9d518f00967fba05d4ce67..8b8705b4a1877fabba50d02bdd9393512f5df16a 100644 --- a/app/Libraries/ActivityPub/Controllers/ActorController.php +++ b/app/Libraries/ActivityPub/Controllers/ActorController.php @@ -39,12 +39,17 @@ class ActorController extends Controller public function _remap(string $method, string ...$params): mixed { + if (count($params) < 1) { + throw PageNotFoundException::forPageNotFound(); + } + if ( - count($params) > 0 && - ! ($this->actor = model('ActorModel')->getActorByUsername($params[0],)) + ($actor = model('ActorModel')->getActorByUsername($params[0])) === null ) { throw PageNotFoundException::forPageNotFound(); } + + $this->actor = $actor; unset($params[0]); return $this->{$method}(...$params); @@ -109,7 +114,7 @@ class ActorController extends Controller 'actor_id' => $payloadActor->id, 'in_reply_to_id' => $replyToNote->id, 'message' => $payload->object->content, - 'published_at' => Time::parse($payload->object->published,), + 'published_at' => Time::parse($payload->object->published), ]); } @@ -295,7 +300,7 @@ class ActorController extends Controller { // get followers for a specific actor $followers = model('ActorModel') - ->join('activitypub_follows', 'activitypub_follows.actor_id = id', 'inner',) + ->join('activitypub_follows', 'activitypub_follows.actor_id = id', 'inner') ->where('activitypub_follows.target_actor_id', $this->actor->id) ->orderBy('activitypub_follows.created_at', 'DESC'); @@ -364,7 +369,7 @@ class ActorController extends Controller } return redirect()->to( - str_replace('{uri}', urlencode($this->actor->uri), $data->links[$ostatusKey]->template,), + str_replace('{uri}', urlencode($this->actor->uri), $data->links[$ostatusKey]->template), ); } diff --git a/app/Libraries/ActivityPub/Controllers/BlockController.php b/app/Libraries/ActivityPub/Controllers/BlockController.php index 09882421b2bc68c9e53a7339d536665b7cee35af..4111e08f0677a809d1a03219ef232827511298ef 100644 --- a/app/Libraries/ActivityPub/Controllers/BlockController.php +++ b/app/Libraries/ActivityPub/Controllers/BlockController.php @@ -37,7 +37,7 @@ class BlockController extends Controller if ($parts = split_handle($handle)) { if ( - ($actor = get_or_create_actor($parts['username'], $parts['domain'],)) === null + ($actor = get_or_create_actor($parts['username'], $parts['domain'])) === null ) { return redirect() ->back() diff --git a/app/Libraries/ActivityPub/Controllers/NoteController.php b/app/Libraries/ActivityPub/Controllers/NoteController.php index 017d709c0407d40dd00f7ddfbfcf82d2805d5fd9..10cac4a5f7fbdaa75db911d557f2201dae2a5bca 100644 --- a/app/Libraries/ActivityPub/Controllers/NoteController.php +++ b/app/Libraries/ActivityPub/Controllers/NoteController.php @@ -39,9 +39,16 @@ class NoteController extends Controller public function _remap(string $method, string ...$params): mixed { - if (! ($this->note = model('NoteModel')->getNoteById($params[0]))) { + if (count($params) < 1) { throw PageNotFoundException::forPageNotFound(); } + + if (($note = model('NoteModel')->getNoteById($params[0])) === null) { + throw PageNotFoundException::forPageNotFound(); + } + + $this->note = $note; + unset($params[0]); return $this->{$method}(...$params); @@ -69,7 +76,7 @@ class NoteController extends Controller * get note replies */ $noteReplies = model('NoteModel') - ->where('in_reply_to_id', service('uuid') ->fromString($this->note->id) ->getBytes(),) + ->where('in_reply_to_id', service('uuid') ->fromString($this->note->id) ->getBytes()) ->where('`published_at` <= NOW()', null, false) ->orderBy('published_at', 'ASC'); @@ -252,7 +259,7 @@ class NoteController extends Controller } return redirect()->to( - str_replace('{uri}', urlencode($this->note->uri), $data->links[$ostatusKey]->template,), + str_replace('{uri}', urlencode($this->note->uri), $data->links[$ostatusKey]->template), ); } diff --git a/app/Libraries/ActivityPub/Entities/Activity.php b/app/Libraries/ActivityPub/Entities/Activity.php index 967e48a595d1a3bd005a6c663fa35364777d2178..cd9996f54f39dc35211a2e28a78e1a025095bfd2 100644 --- a/app/Libraries/ActivityPub/Entities/Activity.php +++ b/app/Libraries/ActivityPub/Entities/Activity.php @@ -18,9 +18,9 @@ use RuntimeException; * @property int $actor_id * @property Actor $actor * @property int|null $target_actor_id - * @property Actor|null $target_actor + * @property Actor $target_actor * @property string|null $note_id - * @property Note|null $note + * @property Note $note * @property string $type * @property object $payload * @property string|null $status @@ -65,7 +65,7 @@ class Activity extends UuidEntity } if ($this->actor === null) { - $this->actor = model('ActorModel') + $this->actor = model('ActorModel', false) ->getActorById($this->actor_id); } @@ -79,7 +79,7 @@ class Activity extends UuidEntity } if ($this->target_actor === null) { - $this->target_actor = model('ActorModel') + $this->target_actor = model('ActorModel', false) ->getActorById($this->target_actor_id); } @@ -93,7 +93,7 @@ class Activity extends UuidEntity } if ($this->note === null) { - $this->note = model('NoteModel') + $this->note = model('NoteModel', false) ->getNoteById($this->note_id); } diff --git a/app/Libraries/ActivityPub/Entities/Actor.php b/app/Libraries/ActivityPub/Entities/Actor.php index d55b21136c4ee8bcd4ed6c5dbb696b8661a5d550..0e7746c73c94ea7d7ef3a0398e46cfeea6ec21c4 100644 --- a/app/Libraries/ActivityPub/Entities/Actor.php +++ b/app/Libraries/ActivityPub/Entities/Actor.php @@ -101,7 +101,7 @@ class Actor extends Entity } if ($this->followers === null) { - $this->followers = (array) model('ActorModel') + $this->followers = (array) model('ActorModel', false) ->getFollowers($this->id); } diff --git a/app/Libraries/ActivityPub/Entities/Note.php b/app/Libraries/ActivityPub/Entities/Note.php index 2491c7021c2a233f5f24b14171b29b3b61804060..06199303fc2dee4dfd1d03f0815ea46ef1884de0 100644 --- a/app/Libraries/ActivityPub/Entities/Note.php +++ b/app/Libraries/ActivityPub/Entities/Note.php @@ -18,12 +18,10 @@ use RuntimeException; * @property string $id * @property string $uri * @property int $actor_id - * @property Actor|null $actor + * @property Actor $actor * @property string|null $in_reply_to_id - * @property bool $is_reply * @property Note|null $reply_to_note * @property string|null $reblog_of_id - * @property bool $is_reblog * @property Note|null $reblog_of_note * @property string $message * @property string $message_html @@ -44,12 +42,8 @@ class Note extends UuidEntity { protected ?Actor $actor = null; - protected bool $is_reply = false; - protected ?Note $reply_to_note = null; - protected bool $is_reblog = false; - protected ?Note $reblog_of_note = null; protected ?PreviewCard $preview_card = null; @@ -97,14 +91,14 @@ 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.'); } if ($this->actor === null) { - $this->actor = model('ActorModel') + $this->actor = model('ActorModel', false) ->getActorById($this->actor_id); } @@ -118,7 +112,7 @@ class Note extends UuidEntity } if ($this->preview_card === null) { - $this->preview_card = model('PreviewCardModel') + $this->preview_card = model('PreviewCardModel', false) ->getNotePreviewCard($this->id); } @@ -130,11 +124,6 @@ class Note extends UuidEntity return $this->getPreviewCard() !== null; } - public function getIsReply(): bool - { - return $this->in_reply_to_id && ($this->getReplyToNote() !== null); - } - /** * @return Note[] */ @@ -145,7 +134,7 @@ class Note extends UuidEntity } if ($this->replies === null) { - $this->replies = (array) model('NoteModel') + $this->replies = (array) model('NoteModel', false) ->getNoteReplies($this->id); } @@ -164,7 +153,7 @@ class Note extends UuidEntity } if ($this->reply_to_note === null) { - $this->reply_to_note = model('NoteModel') + $this->reply_to_note = model('NoteModel', false) ->getNoteById($this->in_reply_to_id); } @@ -181,18 +170,13 @@ class Note extends UuidEntity } if ($this->reblogs === null) { - $this->reblogs = (array) model('NoteModel') + $this->reblogs = (array) model('NoteModel', false) ->getNoteReblogs($this->id); } return $this->reblogs; } - public function getIsReblog(): bool - { - return $this->reblog_of_id !== null; - } - public function getReblogOfNote(): ?self { if ($this->reblog_of_id === null) { @@ -200,7 +184,7 @@ class Note extends UuidEntity } if ($this->reblog_of_note === null) { - $this->reblog_of_note = model('NoteModel') + $this->reblog_of_note = model('NoteModel', false) ->getNoteById($this->reblog_of_id); } diff --git a/app/Libraries/ActivityPub/Helpers/activitypub_helper.php b/app/Libraries/ActivityPub/Helpers/activitypub_helper.php index 8c3b214b26533424234c042d808c9b693fb5b4d2..7902c55680e1595dc36dc7420751e28d96a60e69 100644 --- a/app/Libraries/ActivityPub/Helpers/activitypub_helper.php +++ b/app/Libraries/ActivityPub/Helpers/activitypub_helper.php @@ -45,7 +45,7 @@ if (! function_exists('split_handle')) { function split_handle(string $handle): array | false { if ( - ! preg_match('~^@?(?P<username>[\w\.\-]+)@(?P<domain>[\w\.\-]+)(?P<port>:[\d]+)?$~', $handle, $matches,) + ! preg_match('~^@?(?P<username>[\w\.\-]+)@(?P<domain>[\w\.\-]+)(?P<port>:[\d]+)?$~', $handle, $matches) ) { return false; } @@ -171,7 +171,7 @@ if (! function_exists('create_preview_card_from_url')) { ]); if ( - ! ($newPreviewCardId = model('PreviewCardModel')->insert($newPreviewCard, true,)) + ! ($newPreviewCardId = model('PreviewCardModel')->insert($newPreviewCard, true)) ) { return null; } @@ -194,7 +194,7 @@ if (! function_exists('get_or_create_preview_card_from_url')) { // check if preview card has already been generated if ( $previewCard = model('PreviewCardModel') - ->getPreviewCardFromUrl((string) $url,) + ->getPreviewCardFromUrl((string) $url) ) { return $previewCard; } @@ -361,7 +361,7 @@ if (! function_exists('linkify')) { if ( $actor = model( 'ActorModel', - )->getActorByUsername($match['username'], $match['domain'],) + )->getActorByUsername($match['username'], $match['domain']) ) { // TODO: check that host is local to remove target blank? return '<' . @@ -394,11 +394,11 @@ if (! function_exists('linkify')) { } } else { if ( - $actor = model('ActorModel',) + $actor = model('ActorModel') ->getActorByUsername($match['username']) ) { return '<' . - array_push($links, anchor($actor->uri, $match[0]),) . + array_push($links, anchor($actor->uri, $match[0])) . '>'; } diff --git a/app/Libraries/ActivityPub/HttpSignature.php b/app/Libraries/ActivityPub/HttpSignature.php index 046a1cf62d1bc710b4d0f944694896110ff09e71..a630613c714a5bb812597d8b9f2ccb8a5b08587d 100644 --- a/app/Libraries/ActivityPub/HttpSignature.php +++ b/app/Libraries/ActivityPub/HttpSignature.php @@ -35,7 +35,7 @@ class HttpSignature ([\w\-\.#\/@]+) )", algorithm="(?P<algorithm>[\w\-]+)", - (headers="\(request-target\) (?P<headers>[\w\\-\s]+)",)? + (headers="\(request-target\) (?P<headers>[\w\\-\s]+)")? signature="(?P<signature>[\w+\/]+={0,2})" /x'; diff --git a/app/Libraries/ActivityPub/Models/ActorModel.php b/app/Libraries/ActivityPub/Models/ActorModel.php index ff5b7e3a05d134bc207a2289db5c7f4b3d8a81fb..aff67eb2e230b8c121def509698e5bd2bae8198d 100644 --- a/app/Libraries/ActivityPub/Models/ActorModel.php +++ b/app/Libraries/ActivityPub/Models/ActorModel.php @@ -129,7 +129,7 @@ class ActorModel extends Model config('ActivityPub') ->cachePrefix . "actor#{$actorId}_followers"; if (! ($found = cache($cacheName))) { - $found = $this->join('activitypub_follows', 'activitypub_follows.actor_id = id', 'inner',) + $found = $this->join('activitypub_follows', 'activitypub_follows.actor_id = id', 'inner') ->where('activitypub_follows.target_actor_id', $actorId) ->findAll(); diff --git a/app/Libraries/ActivityPub/Models/FavouriteModel.php b/app/Libraries/ActivityPub/Models/FavouriteModel.php index 84d375713a271124e1f1679b9c9557aa616a5419..57ac63ae06b7bebe190059e5927c52cb8d9cfe8c 100644 --- a/app/Libraries/ActivityPub/Models/FavouriteModel.php +++ b/app/Libraries/ActivityPub/Models/FavouriteModel.php @@ -57,7 +57,7 @@ class FavouriteModel extends UuidModel ]); model('NoteModel') - ->where('id', service('uuid') ->fromString($note->id) ->getBytes(),) + ->where('id', service('uuid') ->fromString($note->id) ->getBytes()) ->increment('favourites_count'); if ($registerActivity) { @@ -97,7 +97,7 @@ class FavouriteModel extends UuidModel $this->db->transStart(); model('NoteModel') - ->where('id', service('uuid') ->fromString($note->id) ->getBytes(),) + ->where('id', service('uuid') ->fromString($note->id) ->getBytes()) ->decrement('favourites_count'); $this->db @@ -125,7 +125,7 @@ class FavouriteModel extends UuidModel $likeActivity = new LikeActivity(); $likeActivity - ->set('id', base_url(route_to('activity', $actor->username, $activity->id),),) + ->set('id', base_url(route_to('activity', $actor->username, $activity->id))) ->set('actor', $actor->uri) ->set('object', $note->uri); diff --git a/app/Libraries/ActivityPub/Models/FollowModel.php b/app/Libraries/ActivityPub/Models/FollowModel.php index b54069b59ce072fb7c66050b66ed67ee9bafb2ec..62e2c654753c0f638dbf1fcccd2a2d99de608986 100644 --- a/app/Libraries/ActivityPub/Models/FollowModel.php +++ b/app/Libraries/ActivityPub/Models/FollowModel.php @@ -83,7 +83,7 @@ class FollowModel extends Model 'queued', ); - $followActivity->set('id', base_url(route_to('activity', $actor->username, $activityId),)); + $followActivity->set('id', base_url(route_to('activity', $actor->username, $activityId))); model('ActivityModel') ->update($activityId, [ diff --git a/app/Libraries/ActivityPub/Models/NoteModel.php b/app/Libraries/ActivityPub/Models/NoteModel.php index 2da2fdc53659837f60db128ccc57f1c09b29c455..5662bec37adeaa09f3fc1099affc450cffe444d7 100644 --- a/app/Libraries/ActivityPub/Models/NoteModel.php +++ b/app/Libraries/ActivityPub/Models/NoteModel.php @@ -155,7 +155,7 @@ class NoteModel extends UuidModel */ public function getSecondsToNextUnpublishedNote(int $actorId): int | false { - $result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff',) + $result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff') ->where([ 'actor_id' => $actorId, ]) @@ -185,11 +185,11 @@ class NoteModel extends UuidModel if (! ($found = cache($cacheName))) { if (! $withBlocked) { $this->select('activitypub_notes.*') - ->join('activitypub_actors', 'activitypub_actors.id = activitypub_notes.actor_id', 'inner',) + ->join('activitypub_actors', 'activitypub_actors.id = activitypub_notes.actor_id', 'inner') ->where('activitypub_actors.is_blocked', 0); } - $this->where('in_reply_to_id', $this->uuid->fromString($noteId) ->getBytes(),) + $this->where('in_reply_to_id', $this->uuid->fromString($noteId) ->getBytes()) ->where('`published_at` <= NOW()', null, false) ->orderBy('published_at', 'ASC'); $found = $this->findAll(); @@ -213,7 +213,7 @@ class NoteModel extends UuidModel ->cachePrefix . "note#{$noteId}_reblogs"; if (! ($found = cache($cacheName))) { - $found = $this->where('reblog_of_id', $this->uuid->fromString($noteId) ->getBytes(),) + $found = $this->where('reblog_of_id', $this->uuid->fromString($noteId) ->getBytes()) ->where('`published_at` <= NOW()', null, false) ->orderBy('published_at', 'ASC') ->findAll(); @@ -262,7 +262,7 @@ class NoteModel extends UuidModel if ( $messageUrls !== [] && - ($previewCard = get_or_create_preview_card_from_url(new URI($messageUrls[0]),)) && + ($previewCard = get_or_create_preview_card_from_url(new URI($messageUrls[0]))) && ! $this->addPreviewCard($newNoteId, $previewCard->id) ) { $this->db->transRollback(); @@ -298,7 +298,7 @@ class NoteModel extends UuidModel 'queued', ); - $createActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId),)); + $createActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId))); model('ActivityModel') ->update($activityId, [ @@ -361,10 +361,10 @@ class NoteModel extends UuidModel ->where('id', $note->actor_id) ->decrement('notes_count'); - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { // Note to remove is a reply model('NoteModel') - ->where('id', $this->uuid->fromString($note->in_reply_to_id) ->getBytes(),) + ->where('id', $this->uuid->fromString($note->in_reply_to_id) ->getBytes()) ->decrement('replies_count'); Events::trigger('on_reply_remove', $note); @@ -372,6 +372,7 @@ class NoteModel extends UuidModel // remove all note reblogs foreach ($note->reblogs as $reblog) { + // FIXME: issue when actor is not local, can't get actor information $this->removeNote($reblog); } @@ -410,7 +411,7 @@ class NoteModel extends UuidModel 'queued', ); - $deleteActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId),)); + $deleteActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId))); model('ActivityModel') ->update($activityId, [ @@ -444,7 +445,7 @@ class NoteModel extends UuidModel $noteId = $this->addNote($reply, $createPreviewCard, $registerActivity); model('NoteModel') - ->where('id', $this->uuid->fromString($reply->in_reply_to_id) ->getBytes(),) + ->where('id', $this->uuid->fromString($reply->in_reply_to_id) ->getBytes()) ->increment('replies_count'); Events::trigger('on_note_reply', $reply); @@ -491,7 +492,7 @@ class NoteModel extends UuidModel 'queued', ); - $announceActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId),)); + $announceActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId))); model('ActivityModel') ->update($activityId, [ @@ -517,7 +518,7 @@ class NoteModel extends UuidModel ->decrement('notes_count'); model('NoteModel') - ->where('id', $this->uuid->fromString($reblogNote->reblog_of_id) ->getBytes(),) + ->where('id', $this->uuid->fromString($reblogNote->reblog_of_id) ->getBytes()) ->decrement('reblogs_count'); if ($registerActivity) { @@ -536,7 +537,7 @@ class NoteModel extends UuidModel $announceActivity = new AnnounceActivity($reblogNote); $announceActivity->set( 'id', - base_url(route_to('activity', $reblogNote->actor->username, $activity->id,),), + base_url(route_to('activity', $reblogNote->actor->username, $activity->id)), ); $undoActivity @@ -554,10 +555,7 @@ class NoteModel extends UuidModel 'queued', ); - $undoActivity->set( - 'id', - base_url(route_to('activity', $reblogNote->actor->username, $activityId,),), - ); + $undoActivity->set('id', base_url(route_to('activity', $reblogNote->actor->username, $activityId))); model('ActivityModel') ->update($activityId, [ @@ -607,11 +605,11 @@ class NoteModel extends UuidModel cache() ->deleteMatching($cachePrefix . "note-{$hashedNoteUri}*"); - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { $this->clearCache($note->reply_to_note); } - if ($note->is_reblog) { + if ($note->reblog_of_id !== null) { $this->clearCache($note->reblog_of_note); } } @@ -627,7 +625,7 @@ class NoteModel extends UuidModel if (! isset($data['data']['uri'])) { $actor = model('ActorModel') - ->getActorById($data['data']['actor_id']); + ->getActorById((int) $data['data']['actor_id']); $data['data']['uri'] = base_url(route_to('note', $actor->username, $uuid4->toString())); } diff --git a/app/Libraries/ActivityPub/Models/PreviewCardModel.php b/app/Libraries/ActivityPub/Models/PreviewCardModel.php index 90c404eb83c564850c13e5f36dd86a3184afcfef..340dbe05b08a71ce4f2d4cde55ee27ed03f38ea2 100644 --- a/app/Libraries/ActivityPub/Models/PreviewCardModel.php +++ b/app/Libraries/ActivityPub/Models/PreviewCardModel.php @@ -81,7 +81,7 @@ class PreviewCardModel extends Model 'activitypub_notes_preview_cards.preview_card_id = id', 'inner', ) - ->where('note_id', service('uuid') ->fromString($noteId) ->getBytes(),) + ->where('note_id', service('uuid') ->fromString($noteId) ->getBytes()) ->first(); cache() diff --git a/app/Libraries/ActivityPub/Objects/NoteObject.php b/app/Libraries/ActivityPub/Objects/NoteObject.php index e308706241b50e4fb993a316c5facb55149920f5..31e1b67b4f96b218e12ea403ee7c28b4fa321e2d 100644 --- a/app/Libraries/ActivityPub/Objects/NoteObject.php +++ b/app/Libraries/ActivityPub/Objects/NoteObject.php @@ -35,7 +35,7 @@ class NoteObject extends ObjectType $this->published = $note->published_at->format(DATE_W3C); $this->attributedTo = $note->actor->uri; - if ($note->is_reply) { + if ($note->in_reply_to_id !== null) { $this->inReplyTo = $note->reply_to_note->uri; } diff --git a/app/Libraries/ActivityPub/WebFinger.php b/app/Libraries/ActivityPub/WebFinger.php index f81779adf05ebfd70d52b09e7f8c5b64b880045d..e472ff246111a882c54ff8315f7666f02f34f94e 100644 --- a/app/Libraries/ActivityPub/WebFinger.php +++ b/app/Libraries/ActivityPub/WebFinger.php @@ -62,7 +62,7 @@ class WebFinger } if ( - ! ($actor = model('ActorModel')->getActorByUsername($username, $domain,)) + ! ($actor = model('ActorModel')->getActorByUsername($username, $domain)) ) { throw new Exception('Could not find actor'); } diff --git a/app/Libraries/Analytics/Controllers/EpisodeController.php b/app/Libraries/Analytics/Controllers/EpisodeController.php index f94fb386c8fd08180c2bb39a2654926450ae74dc..2fb5ede17d2274a33baa5cf9a5847c0611a3b6ba 100644 --- a/app/Libraries/Analytics/Controllers/EpisodeController.php +++ b/app/Libraries/Analytics/Controllers/EpisodeController.php @@ -35,13 +35,13 @@ class EpisodeController extends BaseController } if ( - ($this->podcast = (new PodcastModel())->getPodcastByName($params[0],)) === null + ($this->podcast = (new PodcastModel())->getPodcastByName($params[0])) === null ) { throw PageNotFoundException::forPageNotFound(); } if ( - ($this->episode = (new EpisodeModel())->getEpisodeBySlug($params[0], $params[1],)) !== null + ($this->episode = (new EpisodeModel())->getEpisodeBySlug($params[0], $params[1])) !== null ) { unset($params[1]); unset($params[0]); diff --git a/app/Libraries/Analytics/Helpers/analytics_helper.php b/app/Libraries/Analytics/Helpers/analytics_helper.php index 838ad78e6023e0abb616890c63993161ee84ae5e..726e4db7255c8a37e74fe96be155d02580891c9f 100644 --- a/app/Libraries/Analytics/Helpers/analytics_helper.php +++ b/app/Libraries/Analytics/Helpers/analytics_helper.php @@ -64,7 +64,7 @@ if (! function_exists('generate_episode_analytics_url')) { $audioFileDuration <= 60 ? $audioFileSize : $audioFileHeaderSize + - floor((($audioFileSize - $audioFileHeaderSize) / $audioFileDuration) * 60,), + floor((($audioFileSize - $audioFileHeaderSize) / $audioFileDuration) * 60), $audioFileSize, $audioFileDuration, $publicationDate->getTimestamp(), diff --git a/app/Libraries/Analytics/Models/AnalyticsPodcastByCountryModel.php b/app/Libraries/Analytics/Models/AnalyticsPodcastByCountryModel.php index 0b65fffc3b669022d705d632366cb3f1ef6e2ed7..c15b671fe15761880443795a1c837c495361a2b2 100644 --- a/app/Libraries/Analytics/Models/AnalyticsPodcastByCountryModel.php +++ b/app/Libraries/Analytics/Models/AnalyticsPodcastByCountryModel.php @@ -45,7 +45,7 @@ class AnalyticsPodcastByCountryModel extends Model public function getDataWeekly(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcast_by_country_weekly",)) + ! ($found = cache("{$podcastId}_analytics_podcast_by_country_weekly")) ) { $oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $found = $this->select('country_code as labels') @@ -73,7 +73,7 @@ class AnalyticsPodcastByCountryModel extends Model public function getDataYearly(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcast_by_country_yearly",)) + ! ($found = cache("{$podcastId}_analytics_podcast_by_country_yearly")) ) { $oneYearAgo = date('Y-m-d', strtotime('-1 year')); $found = $this->select('country_code as labels') diff --git a/app/Libraries/Analytics/Models/AnalyticsPodcastByEpisodeModel.php b/app/Libraries/Analytics/Models/AnalyticsPodcastByEpisodeModel.php index a3fc88df5ba3db8a152096781aea3cef8a64be09..a1a633885cf27c9cd0ea48da009d927ea063e842 100644 --- a/app/Libraries/Analytics/Models/AnalyticsPodcastByEpisodeModel.php +++ b/app/Libraries/Analytics/Models/AnalyticsPodcastByEpisodeModel.php @@ -43,7 +43,7 @@ class AnalyticsPodcastByEpisodeModel extends Model public function getDataByDay(int $podcastId, int $episodeId): array { if ( - ! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_day",)) + ! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_day")) ) { $found = $this->select('date as labels') ->selectSum('hits', 'values') @@ -69,7 +69,7 @@ class AnalyticsPodcastByEpisodeModel extends Model public function getDataByMonth(int $podcastId, int $episodeId = null): array { if ( - ! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_month",)) + ! ($found = cache("{$podcastId}_{$episodeId}_analytics_podcast_by_episode_by_month")) ) { $found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels') ->selectSum('hits', 'values') diff --git a/app/Libraries/Analytics/Models/AnalyticsPodcastByPlayerModel.php b/app/Libraries/Analytics/Models/AnalyticsPodcastByPlayerModel.php index b8b8f32acd291c6a42ddafaeb576c8def41d7c77..76da85df056967e2088bdd0363a08c3f68e38589 100644 --- a/app/Libraries/Analytics/Models/AnalyticsPodcastByPlayerModel.php +++ b/app/Libraries/Analytics/Models/AnalyticsPodcastByPlayerModel.php @@ -45,7 +45,7 @@ class AnalyticsPodcastByPlayerModel extends Model public function getDataByAppWeekly(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_app_weekly",)) + ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_app_weekly")) ) { $oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $found = $this->select('app as labels') @@ -73,7 +73,7 @@ class AnalyticsPodcastByPlayerModel extends Model public function getDataByAppYearly(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_app_yearly",)) + ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_app_yearly")) ) { $oneYearAgo = date('Y-m-d', strtotime('-1 year')); $found = $this->select('app as labels') @@ -101,7 +101,7 @@ class AnalyticsPodcastByPlayerModel extends Model public function getDataByOsWeekly(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_os_weekly",)) + ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_os_weekly")) ) { $oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $found = $this->select('os as labels') @@ -130,7 +130,7 @@ class AnalyticsPodcastByPlayerModel extends Model public function getDataByDeviceWeekly(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_device_weekly",)) + ! ($found = cache("{$podcastId}_analytics_podcasts_by_player_by_device_weekly")) ) { $oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $found = $this->select('device as labels') diff --git a/app/Libraries/Analytics/Models/AnalyticsPodcastByRegionModel.php b/app/Libraries/Analytics/Models/AnalyticsPodcastByRegionModel.php index be9b5af347f982e0da09919a6e33ae7f398dd7d0..22d59d6fcd861e534e465b0cb3ba82daf4b9b533 100644 --- a/app/Libraries/Analytics/Models/AnalyticsPodcastByRegionModel.php +++ b/app/Libraries/Analytics/Models/AnalyticsPodcastByRegionModel.php @@ -47,7 +47,7 @@ class AnalyticsPodcastByRegionModel extends Model $locale = service('request') ->getLocale(); if ( - ! ($found = cache("{$podcastId}_analytics_podcast_by_region_{$locale}",)) + ! ($found = cache("{$podcastId}_analytics_podcast_by_region_{$locale}")) ) { $found = $this->select('country_code, region_code') ->selectSum('hits', 'value') diff --git a/app/Libraries/Analytics/Models/AnalyticsPodcastByServiceModel.php b/app/Libraries/Analytics/Models/AnalyticsPodcastByServiceModel.php index b0519119b496c8445e23dd821dd1256fccb8e3df..160c8327875067eec711d5888df710cea889c298 100644 --- a/app/Libraries/Analytics/Models/AnalyticsPodcastByServiceModel.php +++ b/app/Libraries/Analytics/Models/AnalyticsPodcastByServiceModel.php @@ -45,7 +45,7 @@ class AnalyticsPodcastByServiceModel extends Model public function getDataByServiceWeekly(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcasts_by_service_weekly",)) + ! ($found = cache("{$podcastId}_analytics_podcasts_by_service_weekly")) ) { $oneWeekAgo = date('Y-m-d', strtotime('-1 week')); $found = $this->select('service as labels') diff --git a/app/Libraries/Analytics/Models/AnalyticsPodcastModel.php b/app/Libraries/Analytics/Models/AnalyticsPodcastModel.php index 630c7c413357ddac642b6257b6c17993f14f31fe..f2f2a7025ddef9775d6ca63efa4592240c2aead6 100644 --- a/app/Libraries/Analytics/Models/AnalyticsPodcastModel.php +++ b/app/Libraries/Analytics/Models/AnalyticsPodcastModel.php @@ -67,7 +67,7 @@ class AnalyticsPodcastModel extends Model public function getDataByWeekday(int $podcastId): array { if (! ($found = cache("{$podcastId}_analytics_podcasts_by_weekday"))) { - $found = $this->select('LEFT(DAYNAME(date),3) as labels, WEEKDAY(date) as sort_labels',) + $found = $this->select('LEFT(DAYNAME(date),3) as labels, WEEKDAY(date) as sort_labels') ->selectSum('hits', 'values') ->where([ 'podcast_id' => $podcastId, @@ -91,7 +91,7 @@ class AnalyticsPodcastModel extends Model public function getDataBandwidthByDay(int $podcastId): array { if (! ($found = cache("{$podcastId}_analytics_podcast_by_bandwidth"))) { - $found = $this->select('date as labels, round(bandwidth / 1048576, 1) as `values`',) + $found = $this->select('date as labels, round(bandwidth / 1048576, 1) as `values`') ->where([ 'podcast_id' => $podcastId, 'date >' => date('Y-m-d', strtotime('-60 days')), @@ -136,7 +136,7 @@ class AnalyticsPodcastModel extends Model public function getDataUniqueListenersByDay(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcast_unique_listeners_by_day",)) + ! ($found = cache("{$podcastId}_analytics_podcast_unique_listeners_by_day")) ) { $found = $this->select('date as labels, unique_listeners as values') ->where([ @@ -160,7 +160,7 @@ class AnalyticsPodcastModel extends Model public function getDataUniqueListenersByMonth(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcast_unique_listeners_by_month",)) + ! ($found = cache("{$podcastId}_analytics_podcast_unique_listeners_by_month")) ) { $found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels') ->selectSum('unique_listeners', 'values') @@ -185,7 +185,7 @@ class AnalyticsPodcastModel extends Model public function getDataTotalListeningTimeByDay(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcast_listening_time_by_day",)) + ! ($found = cache("{$podcastId}_analytics_podcast_listening_time_by_day")) ) { $found = $this->select('date as labels') ->selectSum('duration', 'values') @@ -211,7 +211,7 @@ class AnalyticsPodcastModel extends Model public function getDataTotalListeningTimeByMonth(int $podcastId): array { if ( - ! ($found = cache("{$podcastId}_analytics_podcast_listening_time_by_month",)) + ! ($found = cache("{$podcastId}_analytics_podcast_listening_time_by_month")) ) { $found = $this->select('DATE_FORMAT(date,"%Y-%m-01") as labels') ->selectSum('duration', 'values') diff --git a/app/Libraries/Analytics/Models/AnalyticsWebsiteByEntryPageModel.php b/app/Libraries/Analytics/Models/AnalyticsWebsiteByEntryPageModel.php index fa425e8dc50c8eaf584bfc6ded01b2ef81d4b066..b49bb1a6ca619b167201ad6c3ce81d801ed1cab2 100644 --- a/app/Libraries/Analytics/Models/AnalyticsWebsiteByEntryPageModel.php +++ b/app/Libraries/Analytics/Models/AnalyticsWebsiteByEntryPageModel.php @@ -46,7 +46,7 @@ class AnalyticsWebsiteByEntryPageModel extends Model { if (! ($found = cache("{$podcastId}_analytics_website_by_entry_page"))) { $oneWeekAgo = date('Y-m-d', strtotime('-1 week')); - $found = $this->select("IF(entry_page_url='/','/',SUBSTRING_INDEX(entry_page_url,'/',-1)) as labels",) + $found = $this->select("IF(entry_page_url='/','/',SUBSTRING_INDEX(entry_page_url,'/',-1)) as labels") ->selectSum('hits', 'values') ->where([ 'podcast_id' => $podcastId, diff --git a/app/Libraries/Router.php b/app/Libraries/Router.php index 368c64f5db7d6df04365de94426c97c17ea7890b..3f59a70bb9c7b20fbdd33cbdc05a7b9a1775dcfc 100644 --- a/app/Libraries/Router.php +++ b/app/Libraries/Router.php @@ -54,7 +54,7 @@ class Router extends CodeIgniterRouter if (str_contains($key, '{locale}')) { $localeSegment = array_search( '{locale}', - preg_split('~[\/]*((^[a-zA-Z0-9])|\(([^()]*)\))*[\/]+~m', $key,), + preg_split('~[\/]*((^[a-zA-Z0-9])|\(([^()]*)\))*[\/]+~m', $key), true, ); @@ -104,7 +104,7 @@ class Router extends CodeIgniterRouter // check if the alternate-content has been requested in the accept // header and overwrite the $val with the matching controller method if ( - array_key_exists('alternate-content', $this->matchedRouteOptions,) && + array_key_exists('alternate-content', $this->matchedRouteOptions) && is_array($this->matchedRouteOptions['alternate-content']) ) { $request = Services::request(); @@ -119,7 +119,7 @@ class Router extends CodeIgniterRouter $expectedContentType = $parsedHeader[0]; foreach ($supported as $available) { if ( - $negotiate->callMatch($expectedContentType, $available, true,) + $negotiate->callMatch($expectedContentType, $available, true) ) { if ( array_key_exists( diff --git a/app/Models/CategoryModel.php b/app/Models/CategoryModel.php index fe91ac4f4f7d0c6c4daab4529a946e7d774f48e7..5bfc38aae62824b480bc7069705dc54bf3b6b75b 100644 --- a/app/Models/CategoryModel.php +++ b/app/Models/CategoryModel.php @@ -130,7 +130,7 @@ class CategoryModel extends Model $cacheName = "podcast#{$podcastId}_categories"; if (! ($categories = cache($cacheName))) { $categories = $this->select('categories.*') - ->join('podcasts_categories', 'podcasts_categories.category_id = categories.id',) + ->join('podcasts_categories', 'podcasts_categories.category_id = categories.id') ->where('podcasts_categories.podcast_id', $podcastId) ->findAll(); diff --git a/app/Models/EpisodeModel.php b/app/Models/EpisodeModel.php index b3bff1275f848896497e1104c25da54953d8ce19..275c753ffbbccbe6849b551fff6eaae4c255215b 100644 --- a/app/Models/EpisodeModel.php +++ b/app/Models/EpisodeModel.php @@ -265,7 +265,7 @@ class EpisodeModel extends Model */ public function getSecondsToNextUnpublishedEpisode(int $podcastId): int | false { - $result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff',) + $result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff') ->where([ 'podcast_id' => $podcastId, ]) diff --git a/app/Models/PersonModel.php b/app/Models/PersonModel.php index 20eed991bb7e3e1e77ce2273eb9e1d35c4ce2054..7b9aca804c053030a52a2e9b5cef5c9e7a0ead74 100644 --- a/app/Models/PersonModel.php +++ b/app/Models/PersonModel.php @@ -423,7 +423,7 @@ class PersonModel extends Model */ protected function clearCache(array $data): array { - $personId = is_array($data['id']) ? $data['id']['id'] : $data['id']; + $personId = is_array($data['id']) ? $data['id'][0] : $data['id']; cache() ->delete('person_options'); diff --git a/app/Models/PlatformModel.php b/app/Models/PlatformModel.php index ab7f1f5a3ab175bd0be3c94c0cb809aeebbf5a1f..5eb5727939f07734d6e855d8a70537a15916902b 100644 --- a/app/Models/PlatformModel.php +++ b/app/Models/PlatformModel.php @@ -99,7 +99,7 @@ class PlatformModel extends Model public function getPlatformsWithLinks(int $podcastId, string $platformType): array { if ( - ! ($found = cache("podcast#{$podcastId}_platforms_{$platformType}_withLinks",)) + ! ($found = cache("podcast#{$podcastId}_platforms_{$platformType}_withLinks")) ) { $found = $this->select( 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player', @@ -129,7 +129,7 @@ class PlatformModel extends Model $found = $this->select( 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player', ) - ->join('podcasts_platforms', 'podcasts_platforms.platform_slug = platforms.slug',) + ->join('podcasts_platforms', 'podcasts_platforms.platform_slug = platforms.slug') ->where('podcasts_platforms.podcast_id', $podcastId) ->where('platforms.type', $platformType) ->findAll(); diff --git a/app/Models/PodcastModel.php b/app/Models/PodcastModel.php index 05e200bccf46788aa21ee001b9c434305065db58..1b20c1feecc2f79f3aed6eaebc262bd9cb145f10 100644 --- a/app/Models/PodcastModel.php +++ b/app/Models/PodcastModel.php @@ -175,7 +175,7 @@ class PodcastModel extends Model $cacheName = "user{$userId}_podcasts"; if (! ($found = cache($cacheName))) { $found = $this->select('podcasts.*') - ->join('podcasts_users', 'podcasts_users.podcast_id = podcasts.id',) + ->join('podcasts_users', 'podcasts_users.podcast_id = podcasts.id') ->where('podcasts_users.user_id', $userId) ->findAll(); @@ -268,7 +268,7 @@ class PodcastModel extends Model if (! ($found = cache($cacheName))) { $episodeModel = new EpisodeModel(); $found = $episodeModel - ->select('YEAR(published_at) as year, count(*) as number_of_episodes',) + ->select('YEAR(published_at) as year, count(*) as number_of_episodes') ->where([ 'podcast_id' => $podcastId, 'season_number' => null, diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index e228622a98754e4ab25e29c8026468088d8af7ca..63e90f983e8d8fae647d872c4be3b5676e653cf5 100644 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -29,7 +29,7 @@ class UserModel extends MythAuthUserModel if (! ($found = cache($cacheName))) { $found = $this->select('users.*, auth_groups.name as podcast_role') ->join('podcasts_users', 'podcasts_users.user_id = users.id') - ->join('auth_groups', 'auth_groups.id = podcasts_users.group_id',) + ->join('auth_groups', 'auth_groups.id = podcasts_users.group_id') ->where('podcasts_users.podcast_id', $podcastId) ->findAll(); @@ -42,7 +42,7 @@ class UserModel extends MythAuthUserModel public function getPodcastContributor(int $userId, int $podcastId): ?User { - return $this->select('users.*, podcasts_users.podcast_id as podcast_id, auth_groups.name as podcast_role',) + return $this->select('users.*, podcasts_users.podcast_id as podcast_id, auth_groups.name as podcast_role') ->join('podcasts_users', 'podcasts_users.user_id = users.id') ->join('auth_groups', 'auth_groups.id = podcasts_users.group_id') ->where([ diff --git a/app/Views/podcast/activity.php b/app/Views/podcast/activity.php index 45832393b8b9efe41ceeb05d6cf29884c36cfe95..eb6dd5b731f50dfa35ede6e3ae79fcdb34664249 100644 --- a/app/Views/podcast/activity.php +++ b/app/Views/podcast/activity.php @@ -40,7 +40,7 @@ <section class="max-w-2xl px-6 py-8 mx-auto space-y-8"> <?php foreach ($notes as $note): ?> - <?php if ($note->is_reblog): ?> + <?php if ($note->reblog_of_id !== null): ?> <?= view('podcast/_partials/reblog', [ 'note' => $note->reblog_of_note, ]) ?> diff --git a/app/Views/podcast/activity_authenticated.php b/app/Views/podcast/activity_authenticated.php index bffb4f4cb69596ecb847ce239bd8cf4165ff88ca..d74f16c64f3dfa6cd48fcb00f72b2ef7e22d62d0 100644 --- a/app/Views/podcast/activity_authenticated.php +++ b/app/Views/podcast/activity_authenticated.php @@ -85,7 +85,7 @@ <div class="space-y-8"> <?php foreach ($notes as $note): ?> - <?php if ($note->is_reblog): ?> + <?php if ($note->reblog_of_id !== null): ?> <?= view('podcast/_partials/reblog_authenticated', [ 'note' => $note->reblog_of_note, ]) ?>