refactor: add modules folder to phpstan paths + fix errors

This commit is contained in:
Yassine Doghri 2024-04-28 16:39:01 +00:00
parent 7a6d9df6db
commit bb628f355f
166 changed files with 452 additions and 526 deletions

View File

@ -2,7 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Config\View;
use ViewThemes\Theme; use ViewThemes\Theme;
/** /**
@ -37,7 +36,8 @@ if (! function_exists('view')) {
/** @var CodeIgniter\View\View $renderer */ /** @var CodeIgniter\View\View $renderer */
$renderer = single_service('renderer', $path); $renderer = single_service('renderer', $path);
$saveData = config(View::class)->saveData; $saveData = config('View')
->saveData;
if (array_key_exists('saveData', $options)) { if (array_key_exists('saveData', $options)) {
$saveData = (bool) $options['saveData']; $saveData = (bool) $options['saveData'];

View File

@ -34,10 +34,10 @@ class Fediverse extends FediverseBaseConfig
try { try {
$appTheme = service('settings') $appTheme = service('settings')
->get('App.theme'); ->get('App.theme');
$defaultBanner = config(Images::class) $defaultBanner = config('Images')
->podcastBannerDefaultPaths[$appTheme] ?? config(Images::class)->podcastBannerDefaultPaths['default']; ->podcastBannerDefaultPaths[$appTheme] ?? config('Images')->podcastBannerDefaultPaths['default'];
} catch (Exception) { } catch (Exception) {
$defaultBanner = config(Images::class) $defaultBanner = config('Images')
->podcastBannerDefaultPaths['default']; ->podcastBannerDefaultPaths['default'];
} }

View File

@ -18,7 +18,7 @@ class ActorController extends FediverseActorController
use AnalyticsTrait; use AnalyticsTrait;
/** /**
* @var string[] * @var list<string>
*/ */
protected $helpers = ['svg', 'components', 'misc', 'seo']; protected $helpers = ['svg', 'components', 'misc', 'seo'];

View File

@ -12,7 +12,6 @@ namespace App\Controllers;
use CodeIgniter\Controller; use CodeIgniter\Controller;
use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\Response;
use Config\Colors;
class ColorsController extends Controller class ColorsController extends Controller
{ {
@ -29,7 +28,7 @@ class ColorsController extends Controller
if ( if (
! ($colorsCssBody = cache($cacheName)) ! ($colorsCssBody = cache($cacheName))
) { ) {
$colorThemes = config(Colors::class) $colorThemes = config('Colors')
->themes; ->themes;
$colorsCssBody = ''; $colorsCssBody = '';

View File

@ -16,7 +16,6 @@ use App\Entities\Podcast;
use App\Libraries\CommentObject; use App\Libraries\CommentObject;
use App\Models\EpisodeCommentModel; use App\Models\EpisodeCommentModel;
use App\Models\EpisodeModel; use App\Models\EpisodeModel;
use App\Models\LikeModel;
use App\Models\PodcastModel; use App\Models\PodcastModel;
use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
@ -170,7 +169,7 @@ class EpisodeCommentController extends BaseController
return redirect()->back(); return redirect()->back();
} }
model(LikeModel::class) model('LikeModel')
->toggleLike($interactAsActor, $this->comment); ->toggleLike($interactAsActor, $this->comment);
return redirect()->back(); return redirect()->back();
@ -182,7 +181,7 @@ class EpisodeCommentController extends BaseController
return redirect()->back(); return redirect()->back();
} }
model(LikeModel::class) model('LikeModel')
->toggleLike($interactAsActor, $this->comment); ->toggleLike($interactAsActor, $this->comment);
return redirect()->back(); return redirect()->back();

View File

@ -16,13 +16,11 @@ use App\Libraries\NoteObject;
use App\Libraries\PodcastEpisode; use App\Libraries\PodcastEpisode;
use App\Models\EpisodeModel; use App\Models\EpisodeModel;
use App\Models\PodcastModel; use App\Models\PodcastModel;
use App\Models\PostModel;
use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\BaseBuilder;
use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Config\Embed; use Config\Embed;
use Config\Images;
use Config\Services; use Config\Services;
use Modules\Analytics\AnalyticsTrait; use Modules\Analytics\AnalyticsTrait;
use Modules\Fediverse\Objects\OrderedCollectionObject; use Modules\Fediverse\Objects\OrderedCollectionObject;
@ -351,15 +349,15 @@ class EpisodeController extends BaseController
'author_url' => $this->podcast->link, 'author_url' => $this->podcast->link,
'html' => '<iframe src="' . 'html' => '<iframe src="' .
$this->episode->embed_url . $this->episode->embed_url .
'" width="100%" height="' . config(Embed::class)->height . '" frameborder="0" scrolling="no"></iframe>', '" width="100%" height="' . config('Embed')->height . '" frameborder="0" scrolling="no"></iframe>',
'width' => config(Embed::class) 'width' => config('Embed')
->width, ->width,
'height' => config(Embed::class) 'height' => config('Embed')
->height, ->height,
'thumbnail_url' => $this->episode->cover->og_url, 'thumbnail_url' => $this->episode->cover->og_url,
'thumbnail_width' => config(Images::class) 'thumbnail_width' => config('Images')
->podcastCoverSizes['og']['width'], ->podcastCoverSizes['og']['width'],
'thumbnail_height' => config(Images::class) 'thumbnail_height' => config('Images')
->podcastCoverSizes['og']['height'], ->podcastCoverSizes['og']['height'],
]); ]);
} }
@ -376,8 +374,8 @@ class EpisodeController extends BaseController
$oembed->addChild('author_name', $this->podcast->title); $oembed->addChild('author_name', $this->podcast->title);
$oembed->addChild('author_url', $this->podcast->link); $oembed->addChild('author_url', $this->podcast->link);
$oembed->addChild('thumbnail', $this->episode->cover->og_url); $oembed->addChild('thumbnail', $this->episode->cover->og_url);
$oembed->addChild('thumbnail_width', (string) config(Images::class)->podcastCoverSizes['og']['width']); $oembed->addChild('thumbnail_width', (string) config('Images')->podcastCoverSizes['og']['width']);
$oembed->addChild('thumbnail_height', (string) config(Images::class)->podcastCoverSizes['og']['height']); $oembed->addChild('thumbnail_height', (string) config('Images')->podcastCoverSizes['og']['height']);
$oembed->addChild( $oembed->addChild(
'html', 'html',
htmlspecialchars( htmlspecialchars(
@ -388,8 +386,8 @@ class EpisodeController extends BaseController
)->height . '" frameborder="0" scrolling="no"></iframe>', )->height . '" frameborder="0" scrolling="no"></iframe>',
), ),
); );
$oembed->addChild('width', (string) config(Embed::class)->width); $oembed->addChild('width', (string) config('Embed')->width);
$oembed->addChild('height', (string) config(Embed::class)->height); $oembed->addChild('height', (string) config('Embed')->height);
// @phpstan-ignore-next-line // @phpstan-ignore-next-line
return $this->response->setXML($oembed); return $this->response->setXML($oembed);
@ -409,7 +407,7 @@ class EpisodeController extends BaseController
/** /**
* get comments: aggregated replies from posts referring to the episode * get comments: aggregated replies from posts referring to the episode
*/ */
$episodeComments = model(PostModel::class) $episodeComments = model('PostModel')
->whereIn('in_reply_to_id', fn (BaseBuilder $builder): BaseBuilder => $builder->select('id') ->whereIn('in_reply_to_id', fn (BaseBuilder $builder): BaseBuilder => $builder->select('id')
->from('fediverse_posts') ->from('fediverse_posts')
->where('episode_id', $this->episode->id)) ->where('episode_id', $this->episode->id))

View File

@ -14,7 +14,6 @@ use App\Models\PodcastModel;
use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Exceptions\DatabaseException;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Config\Cache;
use Modules\Media\FileManagers\FileManagerInterface; use Modules\Media\FileManagers\FileManagerInterface;
class HomeController extends BaseController class HomeController extends BaseController
@ -54,7 +53,7 @@ class HomeController extends BaseController
} }
// --- Can Castopod connect to the cache handler // --- Can Castopod connect to the cache handler
if (config(Cache::class)->handler !== 'dummy' && cache()->getCacheInfo() === null) { if (config('Cache')->handler !== 'dummy' && cache()->getCacheInfo() === null) {
$errors[] = 'Unable connect to the cache handler.'; $errors[] = 'Unable connect to the cache handler.';
} }

View File

@ -278,11 +278,11 @@ class PodcastController extends BaseController
{ {
if ($this->podcast->type === 'serial') { if ($this->podcast->type === 'serial') {
// podcast is serial // podcast is serial
$episodes = model(EpisodeModel::class) $episodes = model('EpisodeModel')
->where('`published_at` <= UTC_TIMESTAMP()', null, false) ->where('`published_at` <= UTC_TIMESTAMP()', null, false)
->orderBy('season_number DESC, number ASC'); ->orderBy('season_number DESC, number ASC');
} else { } else {
$episodes = model(EpisodeModel::class) $episodes = model('EpisodeModel')
->where('`published_at` <= UTC_TIMESTAMP()', null, false) ->where('`published_at` <= UTC_TIMESTAMP()', null, false)
->orderBy('published_at', 'DESC'); ->orderBy('published_at', 'DESC');
} }

View File

@ -37,7 +37,7 @@ class PostController extends FediversePostController
protected $post; protected $post;
/** /**
* @var string[] * @var list<string>
*/ */
protected $helpers = ['auth', 'fediverse', 'svg', 'components', 'misc', 'seo', 'premium_podcasts']; protected $helpers = ['auth', 'fediverse', 'svg', 'components', 'misc', 'seo', 'premium_podcasts'];

View File

@ -22,7 +22,6 @@ use CodeIgniter\Entity\Entity;
use CodeIgniter\Files\File; use CodeIgniter\Files\File;
use CodeIgniter\HTTP\Files\UploadedFile; use CodeIgniter\HTTP\Files\UploadedFile;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
use Config\Images;
use Exception; use Exception;
use League\CommonMark\Environment\Environment; use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\Autolink\AutolinkExtension; use League\CommonMark\Extension\Autolink\AutolinkExtension;
@ -201,7 +200,7 @@ class Episode extends Entity
} else { } else {
$cover = new Image([ $cover = new Image([
'file_key' => 'podcasts/' . $this->getPodcast()->handle . '/' . $this->attributes['slug'] . '.' . $file->getExtension(), 'file_key' => 'podcasts/' . $this->getPodcast()->handle . '/' . $this->attributes['slug'] . '.' . $file->getExtension(),
'sizes' => config(Images::class) 'sizes' => config('Images')
->podcastCoverSizes, ->podcastCoverSizes,
'uploaded_by' => $this->attributes['updated_by'], 'uploaded_by' => $this->attributes['updated_by'],
'updated_by' => $this->attributes['updated_by'], 'updated_by' => $this->attributes['updated_by'],

View File

@ -14,7 +14,6 @@ use App\Models\PersonModel;
use CodeIgniter\Entity\Entity; use CodeIgniter\Entity\Entity;
use CodeIgniter\Files\File; use CodeIgniter\Files\File;
use CodeIgniter\HTTP\Files\UploadedFile; use CodeIgniter\HTTP\Files\UploadedFile;
use Config\Images;
use Modules\Media\Entities\Image; use Modules\Media\Entities\Image;
use Modules\Media\Models\MediaModel; use Modules\Media\Models\MediaModel;
use RuntimeException; use RuntimeException;
@ -72,7 +71,7 @@ class Person extends Entity
} else { } else {
$avatar = new Image([ $avatar = new Image([
'file_key' => 'persons/' . $this->attributes['unique_name'] . '.' . $file->getExtension(), 'file_key' => 'persons/' . $this->attributes['unique_name'] . '.' . $file->getExtension(),
'sizes' => config(Images::class) 'sizes' => config('Images')
->personAvatarSizes, ->personAvatarSizes,
'uploaded_by' => $this->attributes['updated_by'], 'uploaded_by' => $this->attributes['updated_by'],
'updated_by' => $this->attributes['updated_by'], 'updated_by' => $this->attributes['updated_by'],

View File

@ -20,7 +20,6 @@ use CodeIgniter\Files\File;
use CodeIgniter\HTTP\Files\UploadedFile; use CodeIgniter\HTTP\Files\UploadedFile;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
use CodeIgniter\Shield\Entities\User; use CodeIgniter\Shield\Entities\User;
use Config\Images;
use Exception; use Exception;
use League\CommonMark\Environment\Environment; use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\Autolink\AutolinkExtension; use League\CommonMark\Extension\Autolink\AutolinkExtension;
@ -255,7 +254,7 @@ class Podcast extends Entity
} else { } else {
$cover = new Image([ $cover = new Image([
'file_key' => 'podcasts/' . $this->attributes['handle'] . '/cover.' . $file->getExtension(), 'file_key' => 'podcasts/' . $this->attributes['handle'] . '/cover.' . $file->getExtension(),
'sizes' => config(Images::class) 'sizes' => config('Images')
->podcastCoverSizes, ->podcastCoverSizes,
'uploaded_by' => $this->attributes['updated_by'], 'uploaded_by' => $this->attributes['updated_by'],
'updated_by' => $this->attributes['updated_by'], 'updated_by' => $this->attributes['updated_by'],
@ -298,7 +297,7 @@ class Podcast extends Entity
} else { } else {
$banner = new Image([ $banner = new Image([
'file_key' => 'podcasts/' . $this->attributes['handle'] . '/banner.' . $file->getExtension(), 'file_key' => 'podcasts/' . $this->attributes['handle'] . '/banner.' . $file->getExtension(),
'sizes' => config(Images::class) 'sizes' => config('Images')
->podcastBannerSizes, ->podcastBannerSizes,
'uploaded_by' => $this->attributes['updated_by'], 'uploaded_by' => $this->attributes['updated_by'],
'updated_by' => $this->attributes['updated_by'], 'updated_by' => $this->attributes['updated_by'],

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
use App\Entities\Person; use App\Entities\Person;
use App\Entities\Podcast; use App\Entities\Podcast;
use Cocur\Slugify\Slugify; use Cocur\Slugify\Slugify;
use Config\App;
use Config\Images; use Config\Images;
use Modules\Media\Entities\Image; use Modules\Media\Entities\Image;
@ -25,7 +24,7 @@ if (! function_exists('get_browser_language')) {
function get_browser_language(?string $httpAcceptLanguage = null): string function get_browser_language(?string $httpAcceptLanguage = null): string
{ {
if ($httpAcceptLanguage === null) { if ($httpAcceptLanguage === null) {
return config(App::class)->defaultLocale; return config('App')->defaultLocale;
} }
$langs = explode(',', $httpAcceptLanguage); $langs = explode(',', $httpAcceptLanguage);
@ -192,7 +191,7 @@ if (! function_exists('format_bytes')) {
if (! function_exists('get_site_icon_url')) { if (! function_exists('get_site_icon_url')) {
function get_site_icon_url(string $size): string function get_site_icon_url(string $size): string
{ {
if (config(App::class)->siteIcon['ico'] === service('settings')->get('App.siteIcon')['ico']) { if (config('App')->siteIcon['ico'] === service('settings')->get('App.siteIcon')['ico']) {
// return default site icon url // return default site icon url
return base_url(service('settings')->get('App.siteIcon')[$size]); return base_url(service('settings')->get('App.siteIcon')[$size]);
} }
@ -205,12 +204,12 @@ if (! function_exists('get_podcast_banner')) {
function get_podcast_banner_url(Podcast $podcast, string $size): string function get_podcast_banner_url(Podcast $podcast, string $size): string
{ {
if (! $podcast->banner instanceof Image) { if (! $podcast->banner instanceof Image) {
$defaultBanner = config(Images::class) $defaultBanner = config('Images')
->podcastBannerDefaultPaths[service('settings')->get('App.theme')] ?? config( ->podcastBannerDefaultPaths[service('settings')->get('App.theme')] ?? config(
Images::class Images::class
)->podcastBannerDefaultPaths['default']; )->podcastBannerDefaultPaths['default'];
$sizes = config(Images::class) $sizes = config('Images')
->podcastBannerSizes; ->podcastBannerSizes;
$sizeConfig = $sizes[$size]; $sizeConfig = $sizes[$size];
@ -231,7 +230,7 @@ if (! function_exists('get_podcast_banner_mimetype')) {
function get_podcast_banner_mimetype(Podcast $podcast, string $size): string function get_podcast_banner_mimetype(Podcast $podcast, string $size): string
{ {
if (! $podcast->banner instanceof Image) { if (! $podcast->banner instanceof Image) {
$sizes = config(Images::class) $sizes = config('Images')
->podcastBannerSizes; ->podcastBannerSizes;
$sizeConfig = $sizes[$size]; $sizeConfig = $sizes[$size];
@ -252,10 +251,10 @@ if (! function_exists('get_avatar_url')) {
function get_avatar_url(Person $person, string $size): string function get_avatar_url(Person $person, string $size): string
{ {
if (! $person->avatar instanceof Image) { if (! $person->avatar instanceof Image) {
$defaultAvatarPath = config(Images::class) $defaultAvatarPath = config('Images')
->avatarDefaultPath; ->avatarDefaultPath;
$sizes = config(Images::class) $sizes = config('Images')
->personAvatarSizes; ->personAvatarSizes;
$sizeConfig = $sizes[$size]; $sizeConfig = $sizes[$size];

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
*/ */
use App\Models\PageModel; use App\Models\PageModel;
use Config\App;
if (! function_exists('render_page_links')) { if (! function_exists('render_page_links')) {
/** /**
@ -42,8 +41,8 @@ if (! function_exists('render_page_links')) {
} }
// if set in .env, add legal notice link at the end of page links // if set in .env, add legal notice link at the end of page links
if (config(App::class)->legalNoticeURL !== null) { if (config('App')->legalNoticeURL !== null) {
$links .= anchor(config(App::class)->legalNoticeURL, lang('Common.legal_notice'), [ $links .= anchor(config('App')->legalNoticeURL, lang('Common.legal_notice'), [
'class' => 'px-2 py-1 underline hover:no-underline focus:ring-accent', 'class' => 'px-2 py-1 underline hover:no-underline focus:ring-accent',
'target' => '_blank', 'target' => '_blank',
'rel' => 'noopener noreferrer', 'rel' => 'noopener noreferrer',

View File

@ -8,8 +8,6 @@ use App\Entities\EpisodeComment;
use App\Entities\Page; use App\Entities\Page;
use App\Entities\Podcast; use App\Entities\Podcast;
use App\Entities\Post; use App\Entities\Post;
use Config\Embed;
use Config\Images;
use Melbahja\Seo\MetaTags; use Melbahja\Seo\MetaTags;
use Melbahja\Seo\Schema; use Melbahja\Seo\Schema;
use Melbahja\Seo\Schema\Thing; use Melbahja\Seo\Schema\Thing;
@ -57,8 +55,8 @@ if (! function_exists('get_podcast_metatags')) {
->description(esc($podcast->description)) ->description(esc($podcast->description))
->image((string) $podcast->cover->og_url) ->image((string) $podcast->cover->og_url)
->canonical((string) current_url()) ->canonical((string) current_url())
->og('image:width', (string) config(Images::class)->podcastCoverSizes['og']['width']) ->og('image:width', (string) config('Images')->podcastCoverSizes['og']['width'])
->og('image:height', (string) config(Images::class)->podcastCoverSizes['og']['height']) ->og('image:height', (string) config('Images')->podcastCoverSizes['og']['height'])
->og('locale', $podcast->language_code) ->og('locale', $podcast->language_code)
->og('site_name', esc(service('settings')->get('App.siteName'))) ->og('site_name', esc(service('settings')->get('App.siteName')))
->push('link', [ ->push('link', [
@ -107,8 +105,8 @@ if (! function_exists('get_episode_metatags')) {
->image((string) $episode->cover->og_url, 'player') ->image((string) $episode->cover->og_url, 'player')
->canonical($episode->link) ->canonical($episode->link)
->og('site_name', esc(service('settings')->get('App.siteName'))) ->og('site_name', esc(service('settings')->get('App.siteName')))
->og('image:width', (string) config(Images::class)->podcastCoverSizes['og']['width']) ->og('image:width', (string) config('Images')->podcastCoverSizes['og']['width'])
->og('image:height', (string) config(Images::class)->podcastCoverSizes['og']['height']) ->og('image:height', (string) config('Images')->podcastCoverSizes['og']['height'])
->og('locale', $episode->podcast->language_code) ->og('locale', $episode->podcast->language_code)
->og('audio', $episode->audio_opengraph_url) ->og('audio', $episode->audio_opengraph_url)
->og('audio:type', $episode->audio->file_mimetype) ->og('audio:type', $episode->audio->file_mimetype)
@ -117,8 +115,8 @@ if (! function_exists('get_episode_metatags')) {
->twitter('audio:partner', $episode->podcast->publisher ?? '') ->twitter('audio:partner', $episode->podcast->publisher ?? '')
->twitter('audio:artist_name', esc($episode->podcast->owner_name)) ->twitter('audio:artist_name', esc($episode->podcast->owner_name))
->twitter('player', $episode->getEmbedUrl('light')) ->twitter('player', $episode->getEmbedUrl('light'))
->twitter('player:width', (string) config(Embed::class)->width) ->twitter('player:width', (string) config('Embed')->width)
->twitter('player:height', (string) config(Embed::class)->height) ->twitter('player:height', (string) config('Embed')->height)
->push('link', [ ->push('link', [
'rel' => 'alternate', 'rel' => 'alternate',
'type' => 'application/activity+json', 'type' => 'application/activity+json',

View File

@ -81,7 +81,7 @@ class Router extends CodeIgniterRouter
); );
if ($this->collection->shouldUseSupportedLocalesOnly() if ($this->collection->shouldUseSupportedLocalesOnly()
&& ! in_array($matched['locale'], config(App::class)->supportedLocales, true)) { && ! in_array($matched['locale'], config('App')->supportedLocales, true)) {
// Throw exception to prevent the autorouter, if enabled, // Throw exception to prevent the autorouter, if enabled,
// from trying to find a route // from trying to find a route
throw PageNotFoundException::forLocaleNotSupported($matched['locale']); throw PageNotFoundException::forLocaleNotSupported($matched['locale']);

View File

@ -14,7 +14,6 @@ use App\Entities\Actor;
use App\Entities\Podcast; use App\Entities\Podcast;
use CodeIgniter\HTTP\URI; use CodeIgniter\HTTP\URI;
use CodeIgniter\Model; use CodeIgniter\Model;
use Config\Fediverse;
use phpseclib\Crypt\RSA; use phpseclib\Crypt\RSA;
class PodcastModel extends Model class PodcastModel extends Model
@ -349,7 +348,7 @@ class PodcastModel extends Model
// delete all cache for podcast actor // delete all cache for podcast actor
cache() cache()
->deleteMatching(config(Fediverse::class) ->cachePrefix . "actor#{$podcast->actor_id}*"); ->deleteMatching(config('Fediverse') ->cachePrefix . "actor#{$podcast->actor_id}*");
// delete model requests cache, includes feed / query / episode lists, etc. // delete model requests cache, includes feed / query / episode lists, etc.
cache() cache()

View File

@ -21,7 +21,7 @@ class PostModel extends FediversePostModel
protected $returnType = Post::class; protected $returnType = Post::class;
/** /**
* @var string[] * @var list<string>
*/ */
protected $allowedFields = [ protected $allowedFields = [
'id', 'id',

View File

@ -9,7 +9,7 @@
"php": "^8.1", "php": "^8.1",
"adaures/ipcat-php": "^v1.0.0", "adaures/ipcat-php": "^v1.0.0",
"adaures/podcast-persons-taxonomy": "^v1.0.1", "adaures/podcast-persons-taxonomy": "^v1.0.1",
"aws/aws-sdk-php": "^3.305.3", "aws/aws-sdk-php": "^3.305.4",
"chrisjean/php-ico": "^1.0.4", "chrisjean/php-ico": "^1.0.4",
"cocur/slugify": "^v4.5.1", "cocur/slugify": "^v4.5.1",
"codeigniter4/framework": "v4.5.1", "codeigniter4/framework": "v4.5.1",

61
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "063a673edd8a39e318bae89316709ef0", "content-hash": "b0b783684ed8d36e636fac3632c78c27",
"packages": [ "packages": [
{ {
"name": "adaures/ipcat-php", "name": "adaures/ipcat-php",
@ -188,16 +188,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.305.3", "version": "3.305.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "b190e24bd6568713436e1f13f9022bf28f491fc1" "reference": "fc26a2ebf720e0b75a353d7e8fe206796671e00b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b190e24bd6568713436e1f13f9022bf28f491fc1", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fc26a2ebf720e0b75a353d7e8fe206796671e00b",
"reference": "b190e24bd6568713436e1f13f9022bf28f491fc1", "reference": "fc26a2ebf720e0b75a353d7e8fe206796671e00b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -273,31 +273,31 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.305.3" "source": "https://github.com/aws/aws-sdk-php/tree/3.305.4"
}, },
"time": "2024-04-25T18:07:15+00:00" "time": "2024-04-26T18:06:31+00:00"
}, },
{ {
"name": "brick/math", "name": "brick/math",
"version": "0.11.0", "version": "0.12.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/brick/math.git", "url": "https://github.com/brick/math.git",
"reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478" "reference": "f510c0a40911935b77b86859eb5223d58d660df1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478", "url": "https://api.github.com/repos/brick/math/zipball/f510c0a40911935b77b86859eb5223d58d660df1",
"reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478", "reference": "f510c0a40911935b77b86859eb5223d58d660df1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^8.0" "php": "^8.1"
}, },
"require-dev": { "require-dev": {
"php-coveralls/php-coveralls": "^2.2", "php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^9.0", "phpunit/phpunit": "^10.1",
"vimeo/psalm": "5.0.0" "vimeo/psalm": "5.16.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -315,12 +315,17 @@
"arithmetic", "arithmetic",
"bigdecimal", "bigdecimal",
"bignum", "bignum",
"bignumber",
"brick", "brick",
"math" "decimal",
"integer",
"math",
"mathematics",
"rational"
], ],
"support": { "support": {
"issues": "https://github.com/brick/math/issues", "issues": "https://github.com/brick/math/issues",
"source": "https://github.com/brick/math/tree/0.11.0" "source": "https://github.com/brick/math/tree/0.12.1"
}, },
"funding": [ "funding": [
{ {
@ -328,7 +333,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-01-15T23:15:59+00:00" "time": "2023-11-29T23:19:16+00:00"
}, },
{ {
"name": "chrisjean/php-ico", "name": "chrisjean/php-ico",
@ -2796,20 +2801,20 @@
}, },
{ {
"name": "ramsey/uuid", "name": "ramsey/uuid",
"version": "4.7.5", "version": "4.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ramsey/uuid.git", "url": "https://github.com/ramsey/uuid.git",
"reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e" "reference": "91039bc1faa45ba123c4328958e620d382ec7088"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", "url": "https://api.github.com/repos/ramsey/uuid/zipball/91039bc1faa45ba123c4328958e620d382ec7088",
"reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", "reference": "91039bc1faa45ba123c4328958e620d382ec7088",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11", "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12",
"ext-json": "*", "ext-json": "*",
"php": "^8.0", "php": "^8.0",
"ramsey/collection": "^1.2 || ^2.0" "ramsey/collection": "^1.2 || ^2.0"
@ -2864,7 +2869,7 @@
"keywords": ["guid", "identifier", "uuid"], "keywords": ["guid", "identifier", "uuid"],
"support": { "support": {
"issues": "https://github.com/ramsey/uuid/issues", "issues": "https://github.com/ramsey/uuid/issues",
"source": "https://github.com/ramsey/uuid/tree/4.7.5" "source": "https://github.com/ramsey/uuid/tree/4.7.6"
}, },
"funding": [ "funding": [
{ {
@ -2876,7 +2881,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-08T05:53:05+00:00" "time": "2024-04-27T21:32:50+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -3393,12 +3398,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/yassinedoghri/podcast-feed.git", "url": "https://github.com/yassinedoghri/podcast-feed.git",
"reference": "366ddcedfb4b89c7093d03b2398184435f930843" "reference": "f34156e62c9eef8bd5561f8a585d99501e235505"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/yassinedoghri/podcast-feed/zipball/366ddcedfb4b89c7093d03b2398184435f930843", "url": "https://api.github.com/repos/yassinedoghri/podcast-feed/zipball/f34156e62c9eef8bd5561f8a585d99501e235505",
"reference": "366ddcedfb4b89c7093d03b2398184435f930843", "reference": "f34156e62c9eef8bd5561f8a585d99501e235505",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3434,7 +3439,7 @@
"issues": "https://github.com/yassinedoghri/podcast-feed/issues", "issues": "https://github.com/yassinedoghri/podcast-feed/issues",
"source": "https://github.com/yassinedoghri/podcast-feed/tree/main" "source": "https://github.com/yassinedoghri/podcast-feed/tree/main"
}, },
"time": "2023-06-22T13:54:05+00:00" "time": "2024-04-28T16:17:41+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [

View File

@ -15,7 +15,8 @@ $routes->add('scheduled-video-clips', 'SchedulerController::generateVideoClips',
// Admin area routes // Admin area routes
$routes->group( $routes->group(
config(Admin::class)->gateway, config('Admin')
->gateway,
[ [
'namespace' => 'Modules\Admin\Controllers', 'namespace' => 'Modules\Admin\Controllers',
], ],

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Modules\Admin\Controllers; namespace Modules\Admin\Controllers;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
use Config\App;
use Config\Services; use Config\Services;
class AboutController extends BaseController class AboutController extends BaseController
@ -23,7 +22,7 @@ class AboutController extends BaseController
'version' => CP_VERSION, 'version' => CP_VERSION,
'php_version' => PHP_VERSION, 'php_version' => PHP_VERSION,
'os' => PHP_OS, 'os' => PHP_OS,
'languages' => implode(', ', config(App::class)->supportedLocales), 'languages' => implode(', ', config('App')->supportedLocales),
]; ];
return view('settings/about', [ return view('settings/about', [

View File

@ -13,7 +13,6 @@ namespace Modules\Admin\Controllers;
use App\Models\EpisodeModel; use App\Models\EpisodeModel;
use App\Models\PodcastModel; use App\Models\PodcastModel;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
use Config\App;
use Modules\Media\Models\MediaModel; use Modules\Media\Models\MediaModel;
class DashboardController extends BaseController class DashboardController extends BaseController
@ -51,7 +50,7 @@ class DashboardController extends BaseController
->get() ->get()
->getResultArray()[0]; ->getResultArray()[0];
$appStorageLimit = config(App::class) $appStorageLimit = config('App')
->storageLimit; ->storageLimit;
if ($appStorageLimit === null || $appStorageLimit < 0) { if ($appStorageLimit === null || $appStorageLimit < 0) {
$storageLimitBytes = disk_total_space('./'); $storageLimitBytes = disk_total_space('./');
@ -71,7 +70,7 @@ class DashboardController extends BaseController
->id; ->id;
} }
$bandwidthLimit = config(App::class) $bandwidthLimit = config('App')
->bandwidthLimit; ->bandwidthLimit;
$data = [ $data = [

View File

@ -855,7 +855,7 @@ class EpisodeController extends BaseController
// set podcast is_published_on_hubs to false to trigger websub push // set podcast is_published_on_hubs to false to trigger websub push
(new PodcastModel())->update($this->episode->podcast->id, [ (new PodcastModel())->update($this->episode->podcast->id, [
'is_published_on_hubs' => false, 'is_published_on_hubs' => 0,
]); ]);
$db->transComplete(); $db->transComplete();

View File

@ -32,7 +32,6 @@ use Modules\Analytics\Models\AnalyticsPodcastModel;
use Modules\Analytics\Models\AnalyticsWebsiteByBrowserModel; use Modules\Analytics\Models\AnalyticsWebsiteByBrowserModel;
use Modules\Analytics\Models\AnalyticsWebsiteByEntryPageModel; use Modules\Analytics\Models\AnalyticsWebsiteByEntryPageModel;
use Modules\Analytics\Models\AnalyticsWebsiteByRefererModel; use Modules\Analytics\Models\AnalyticsWebsiteByRefererModel;
use Modules\Auth\Config\AuthGroups;
use Modules\Media\Entities\Image; use Modules\Media\Entities\Image;
use Modules\Media\FileManagers\FileManagerInterface; use Modules\Media\FileManagers\FileManagerInterface;
use Modules\Media\Models\MediaModel; use Modules\Media\Models\MediaModel;
@ -244,7 +243,7 @@ class PodcastController extends BaseController
// generate podcast roles and permissions // generate podcast roles and permissions
// before setting current user as podcast admin // before setting current user as podcast admin
config(AuthGroups::class) config('AuthGroups')
->generatePodcastAuthorizations($newPodcastId); ->generatePodcastAuthorizations($newPodcastId);
add_podcast_group(auth()->user(), (int) $newPodcastId, setting('AuthGroups.mostPowerfulPodcastGroup')); add_podcast_group(auth()->user(), (int) $newPodcastId, setting('AuthGroups.mostPowerfulPodcastGroup'));

View File

@ -18,10 +18,8 @@ use App\Models\EpisodeModel;
use App\Models\PodcastModel; use App\Models\PodcastModel;
use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
use Config\Colors;
use Modules\Media\Entities\Transcript; use Modules\Media\Entities\Transcript;
use Modules\Media\Models\MediaModel; use Modules\Media\Models\MediaModel;
use Modules\MediaClipper\Config\MediaClipper;
class VideoClipsController extends BaseController class VideoClipsController extends BaseController
{ {
@ -91,7 +89,7 @@ class VideoClipsController extends BaseController
return view('episode/video_clips_list', $data); return view('episode/video_clips_list', $data);
} }
public function view($videoClipId): string public function view(string $videoClipId): string
{ {
$videoClip = (new ClipModel())->getVideoClipById((int) $videoClipId); $videoClip = (new ClipModel())->getVideoClipById((int) $videoClipId);
@ -146,8 +144,8 @@ class VideoClipsController extends BaseController
'title' => 'required', 'title' => 'required',
'start_time' => 'required|greater_than_equal_to[0]', 'start_time' => 'required|greater_than_equal_to[0]',
'duration' => 'required|greater_than[0]', 'duration' => 'required|greater_than[0]',
'format' => 'required|in_list[' . implode(',', array_keys(config(MediaClipper::class)->formats)) . ']', 'format' => 'required|in_list[' . implode(',', array_keys(config('MediaClipper')->formats)) . ']',
'theme' => 'required|in_list[' . implode(',', array_keys(config(Colors::class)->themes)) . ']', 'theme' => 'required|in_list[' . implode(',', array_keys(config('Colors')->themes)) . ']',
]; ];
if (! $this->validate($rules)) { if (! $this->validate($rules)) {
@ -160,7 +158,7 @@ class VideoClipsController extends BaseController
$validData = $this->validator->getValidated(); $validData = $this->validator->getValidated();
$themeName = $validData['theme']; $themeName = $validData['theme'];
$themeColors = config(MediaClipper::class) $themeColors = config('MediaClipper')
->themes[$themeName]; ->themes[$themeName];
$theme = [ $theme = [
'name' => $themeName, 'name' => $themeName,

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'الرئيسية', ->gateway => 'الرئيسية',
'podcasts' => 'بودكاستات', 'podcasts' => 'بودكاستات',
'episodes' => 'حلقات', 'episodes' => 'حلقات',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'roll-istor', 'label' => 'roll-istor',
config(Admin::class) config('Admin')
->gateway => 'Degemer', ->gateway => 'Degemer',
'podcasts' => 'podkastoù', 'podcasts' => 'podkastoù',
'episodes' => 'rannoù', 'episodes' => 'rannoù',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'Ruta de navegació', 'label' => 'Ruta de navegació',
config(Admin::class) config('Admin')
->gateway => 'Inici', ->gateway => 'Inici',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodis', 'episodes' => 'episodis',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'brødkrumme', 'label' => 'brødkrumme',
config(Admin::class) config('Admin')
->gateway => 'Hjem', ->gateway => 'Hjem',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episoder', 'episodes' => 'episoder',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'Pfad', 'label' => 'Pfad',
config(Admin::class) config('Admin')
->gateway => 'Startseite', ->gateway => 'Startseite',
'podcasts' => 'Podcasts', 'podcasts' => 'Podcasts',
'episodes' => 'Folgen', 'episodes' => 'Folgen',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'διαδρομή (Breadcrumb)', 'label' => 'διαδρομή (Breadcrumb)',
config(Admin::class) config('Admin')
->gateway => 'Αρχική σελίδα', ->gateway => 'Αρχική σελίδα',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'επεισόδια', 'episodes' => 'επεισόδια',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'ruta de navegación', 'label' => 'ruta de navegación',
config(Admin::class) config('Admin')
->gateway => 'Inicio', ->gateway => 'Inicio',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodios', 'episodes' => 'episodios',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'Fil dAriane', 'label' => 'Fil dAriane',
config(Admin::class) config('Admin')
->gateway => 'Accueil', ->gateway => 'Accueil',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'épisodes', 'episodes' => 'épisodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'fil dAriane', 'label' => 'fil dAriane',
config(Admin::class) config('Admin')
->gateway => 'Accueil', ->gateway => 'Accueil',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'épisodes', 'episodes' => 'épisodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'menú', 'label' => 'menú',
config(Admin::class) config('Admin')
->gateway => 'Inicio', ->gateway => 'Inicio',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodios', 'episodes' => 'episodios',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodi', 'episodes' => 'episodi',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'kruimelpad', 'label' => 'kruimelpad',
config(Admin::class) config('Admin')
->gateway => 'Hoofdpagina', ->gateway => 'Hoofdpagina',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'afleveringen', 'episodes' => 'afleveringen',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'navigeringslenke', 'label' => 'navigeringslenke',
config(Admin::class) config('Admin')
->gateway => 'Heim', ->gateway => 'Heim',
'podcasts' => 'podkastar', 'podcasts' => 'podkastar',
'episodes' => 'episodar', 'episodes' => 'episodar',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'okruszki', 'label' => 'okruszki',
config(Admin::class) config('Admin')
->gateway => 'Początek', ->gateway => 'Początek',
'podcasts' => 'podcasty', 'podcasts' => 'podcasty',
'episodes' => 'odcinki', 'episodes' => 'odcinki',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Início', ->gateway => 'Início',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episódios', 'episodes' => 'episódios',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'навигационная цепочка', 'label' => 'навигационная цепочка',
config(Admin::class) config('Admin')
->gateway => 'Главная', ->gateway => 'Главная',
'podcasts' => 'подкасты', 'podcasts' => 'подкасты',
'episodes' => 'выпуски', 'episodes' => 'выпуски',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'omrvinky', 'label' => 'omrvinky',
config(Admin::class) config('Admin')
->gateway => 'Úvod', ->gateway => 'Úvod',
'podcasts' => 'podcasty', 'podcasts' => 'podcasty',
'episodes' => 'časti', 'episodes' => 'časti',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb polja', 'label' => 'breadcrumb polja',
config(Admin::class) config('Admin')
->gateway => 'Početna', ->gateway => 'Početna',
'podcasts' => 'podkasti', 'podcasts' => 'podkasti',
'episodes' => 'epizode', 'episodes' => 'epizode',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Hem', ->gateway => 'Hem',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'avsnitt', 'episodes' => 'avsnitt',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => '面包屑导航', 'label' => '面包屑导航',
config(Admin::class) config('Admin')
->gateway => '主页', ->gateway => '主页',
'podcasts' => '播客', 'podcasts' => '播客',
'episodes' => '剧集', 'episodes' => '剧集',

View File

@ -2,8 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Admin\Config\Admin;
/** /**
* @copyright 2020 Ad Aures * @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@ -12,7 +10,7 @@ use Modules\Admin\Config\Admin;
return [ return [
'label' => 'breadcrumb', 'label' => 'breadcrumb',
config(Admin::class) config('Admin')
->gateway => 'Home', ->gateway => 'Home',
'podcasts' => 'podcasts', 'podcasts' => 'podcasts',
'episodes' => 'episodes', 'episodes' => 'episodes',

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Analytics\Config\Analytics; use CodeIgniter\Router\RouteCollection;
/** /**
* @copyright 2021 Ad Aures * @copyright 2021 Ad Aures
@ -27,17 +27,17 @@ $routes->addPlaceholder(
$routes->group('', [ $routes->group('', [
'namespace' => 'Modules\Analytics\Controllers', 'namespace' => 'Modules\Analytics\Controllers',
], static function ($routes): void { ], static function ($routes): void {
$routes->group(config(Analytics::class)->gateway . '/(:num)/(:class)', static function ($routes): void { $routes->group(config('Analytics')->gateway . '/(:num)/(:class)', static function ($routes): void {
$routes->get('/', 'AnalyticsController::getData/$1/$2', [ $routes->get('/', 'AnalyticsController::getData/$1/$2', [
'as' => 'analytics-full-data', 'as' => 'analytics-full-data',
'filter' => config(Analytics::class) 'filter' => config('Analytics')
->routeFilters[ ->routeFilters[
'analytics-full-data' 'analytics-full-data'
], ],
]); ]);
$routes->get('(:filter)', 'AnalyticsController::getData/$1/$2/$3', [ $routes->get('(:filter)', 'AnalyticsController::getData/$1/$2/$3', [
'as' => 'analytics-data', 'as' => 'analytics-data',
'filter' => config(Analytics::class) 'filter' => config('Analytics')
->routeFilters['analytics-data'], ->routeFilters['analytics-data'],
]); ]);
$routes->get( $routes->get(
@ -45,14 +45,14 @@ $routes->group('', [
'AnalyticsController::getData/$1/$2/$3/$4', 'AnalyticsController::getData/$1/$2/$3/$4',
[ [
'as' => 'analytics-filtered-data', 'as' => 'analytics-filtered-data',
'filter' => config(Analytics::class) 'filter' => config('Analytics')
->routeFilters[ ->routeFilters[
'analytics-filtered-data' 'analytics-filtered-data'
], ],
], ],
); );
}); });
$routes->get(config(Analytics::class)->gateway . '/(:class)/(:filter)', 'AnalyticsController::getData/$1/$2', [ $routes->get(config('Analytics')->gateway . '/(:class)/(:filter)', 'AnalyticsController::getData/$1/$2', [
'as' => 'analytics-data-instance', 'as' => 'analytics-data-instance',
]); ]);

View File

@ -31,11 +31,13 @@ class AnalyticsController extends Controller
} }
if (! is_numeric($params[0])) { if (! is_numeric($params[0])) {
// @phpstan-ignore-next-line
$this->analyticsModel = model('Analytics' . $params[0] . 'Model'); $this->analyticsModel = model('Analytics' . $params[0] . 'Model');
$this->methodName = 'getData' . $params[1]; $this->methodName = 'getData' . $params[1];
return $this->{$method}(); return $this->{$method}();
} }
// @phpstan-ignore-next-line
$this->analyticsModel = model('Analytics' . $params[1] . 'Model'); $this->analyticsModel = model('Analytics' . $params[1] . 'Model');
$this->methodName = 'getData' . (count($params) >= 3 ? $params[2] : ''); $this->methodName = 'getData' . (count($params) >= 3 ? $params[2] : '');

View File

@ -27,7 +27,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsPodcasts extends Entity class AnalyticsPodcasts extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -26,7 +26,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsPodcastsByCountry extends Entity class AnalyticsPodcastsByCountry extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -25,7 +25,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsPodcastsByEpisode extends Entity class AnalyticsPodcastsByEpisode extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -25,7 +25,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsPodcastsByHour extends Entity class AnalyticsPodcastsByHour extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -28,7 +28,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsPodcastsByPlayer extends Entity class AnalyticsPodcastsByPlayer extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -28,7 +28,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsPodcastsByRegion extends Entity class AnalyticsPodcastsByRegion extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -30,7 +30,7 @@ use Opawg\UserAgentsV2Php\UserAgentsRSS;
class AnalyticsPodcastsByService extends Entity class AnalyticsPodcastsByService extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -24,7 +24,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsPodcastsBySubscription extends Entity class AnalyticsPodcastsBySubscription extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -24,7 +24,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsUnknownUserAgent extends Entity class AnalyticsUnknownUserAgent extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['created_at', 'updated_at']; protected $dates = ['created_at', 'updated_at'];

View File

@ -25,7 +25,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsWebsiteByBrowser extends Entity class AnalyticsWebsiteByBrowser extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -25,7 +25,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsWebsiteByEntryPage extends Entity class AnalyticsWebsiteByEntryPage extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -25,7 +25,7 @@ use CodeIgniter\Entity\Entity;
class AnalyticsWebsiteByReferer extends Entity class AnalyticsWebsiteByReferer extends Entity
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $dates = ['date', 'created_at', 'updated_at']; protected $dates = ['date', 'created_at', 'updated_at'];

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
use AdAures\Ipcat\IpDb; use AdAures\Ipcat\IpDb;
use Config\Services; use Config\Services;
use GeoIp2\Database\Reader; use GeoIp2\Database\Reader;
use Modules\Analytics\Config\Analytics;
use Opawg\UserAgentsV2Php\UserAgents; use Opawg\UserAgentsV2Php\UserAgents;
use WhichBrowser\Parser; use WhichBrowser\Parser;
@ -41,11 +40,12 @@ if (! function_exists('client_ip')) {
*/ */
function client_ip(): string function client_ip(): string
{ {
if (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $superglobals = service('superglobals');
return $_SERVER['HTTP_X_FORWARDED_FOR']; if (! empty($superglobals->server('HTTP_X_FORWARDED_FOR'))) {
return $superglobals->server('HTTP_X_FORWARDED_FOR');
} }
return $_SERVER['REMOTE_ADDR']; return $superglobals->server('REMOTE_ADDR');
} }
} }
@ -109,7 +109,8 @@ if (! function_exists('set_user_session_player')) {
if (! $session->has('player')) { if (! $session->has('player')) {
$playerFound = null; $playerFound = null;
$userAgent = $_SERVER['HTTP_USER_AGENT']; $userAgent = service('superglobals')
->server('HTTP_USER_AGENT');
try { try {
$playerFound = UserAgents::find($userAgent); $playerFound = UserAgents::find($userAgent);
@ -175,7 +176,8 @@ if (! function_exists('set_user_session_referer')) {
{ {
$session = Services::session(); $session = Services::session();
$newreferer = $_SERVER['HTTP_REFERER'] ?? '- Direct -'; $newreferer = service('superglobals')
->server('HTTP_REFERER') ?? '- Direct -';
$newreferer = $newreferer =
parse_url((string) $newreferer, PHP_URL_HOST) === parse_url((string) $newreferer, PHP_URL_HOST) ===
parse_url(current_url(false), PHP_URL_HOST) parse_url(current_url(false), PHP_URL_HOST)
@ -195,7 +197,8 @@ if (! function_exists('set_user_session_entry_page')) {
{ {
$session = Services::session(); $session = Services::session();
$entryPage = $_SERVER['REQUEST_URI']; $entryPage = service('superglobals')
->server('REQUEST_URI');
if (! $session->has('entryPage')) { if (! $session->has('entryPage')) {
$session->set('entryPage', $entryPage); $session->set('entryPage', $entryPage);
} }
@ -243,10 +246,11 @@ if (! function_exists('podcast_hit')) {
$session->get('player')['bot'] = true; $session->get('player')['bot'] = true;
} }
$superglobals = service('superglobals');
//We get the HTTP header field `Range`: //We get the HTTP header field `Range`:
$httpRange = $_SERVER['HTTP_RANGE'] ?? null; $httpRange = $superglobals->server('HTTP_RANGE') ?? null;
$salt = config(Analytics::class) $salt = config('Analytics')
->salt; ->salt;
// We create a sha1 hash for this Salt+Current_Date+IP_Address+User_Agent+Episode_ID (used to count only once multiple episode downloads): // We create a sha1 hash for this Salt+Current_Date+IP_Address+User_Agent+Episode_ID (used to count only once multiple episode downloads):
$episodeListenerHashId = $episodeListenerHashId =
@ -254,11 +258,14 @@ if (! function_exists('podcast_hit')) {
sha1( sha1(
$salt . '_' . date( $salt . '_' . date(
'Y-m-d' 'Y-m-d'
) . '_' . $clientIp . '_' . $_SERVER['HTTP_USER_AGENT'] . '_' . $episodeId ) . '_' . $clientIp . '_' . $superglobals->server('HTTP_USER_AGENT') . '_' . $episodeId
); );
// The cache expires at midnight: // The cache expires at midnight:
$secondsToMidnight = strtotime('tomorrow') - time(); $secondsToMidnight = strtotime('tomorrow') - time();
/** @var int|null $downloadedBytes */
$downloadedBytes = cache($episodeListenerHashId); $downloadedBytes = cache($episodeListenerHashId);
if ($downloadedBytes === null) { if ($downloadedBytes === null) {
// If it was never downloaded that means that zero bytes were downloaded: // If it was never downloaded that means that zero bytes were downloaded:
$downloadedBytes = 0; $downloadedBytes = 0;
@ -301,13 +308,16 @@ if (! function_exists('podcast_hit')) {
sha1( sha1(
$salt . '_' . date( $salt . '_' . date(
'Y-m-d' 'Y-m-d'
) . '_' . $clientIp . '_' . $_SERVER['HTTP_USER_AGENT'] . '_' . $podcastId ) . '_' . $clientIp . '_' . $superglobals->server('HTTP_USER_AGENT') . '_' . $podcastId
); );
$newListener = 1; $newListener = 1;
// Has this listener already downloaded an episode today: // Has this listener already downloaded an episode today:
/** @var int|null $downloadsByUser */
$downloadsByUser = cache($podcastListenerHashId); $downloadsByUser = cache($podcastListenerHashId);
// We add one download // We add one download
if ($downloadsByUser) { if ($downloadsByUser === null) {
$newListener = 0; $newListener = 0;
++$downloadsByUser; ++$downloadsByUser;
} else { } else {

View File

@ -12,7 +12,6 @@ declare(strict_types=1);
namespace Modules\Analytics\Models; namespace Modules\Analytics\Models;
use App\Entities\Media\BaseMedia;
use CodeIgniter\Model; use CodeIgniter\Model;
use Modules\Analytics\Entities\AnalyticsPodcasts; use Modules\Analytics\Entities\AnalyticsPodcasts;
use Modules\Media\Models\MediaModel; use Modules\Media\Models\MediaModel;
@ -263,7 +262,7 @@ class AnalyticsPodcastModel extends Model
/** /**
* Get total storage * Get total storage
* *
* @return BaseMedia[] * @return AnalyticsPodcasts[]
*/ */
public function getDataTotalStorageByMonth(): array public function getDataTotalStorageByMonth(): array
{ {

View File

@ -15,7 +15,7 @@ namespace Modules\Analytics\Models;
use CodeIgniter\Model; use CodeIgniter\Model;
use Modules\Analytics\Entities\AnalyticsUnknownUserAgent; use Modules\Analytics\Entities\AnalyticsUnknownUserAgent;
class AnalyticsUnknownUserAgentModel extends Model class AnalyticsUnknownUserAgentsModel extends Model
{ {
/** /**
* @var string * @var string

View File

@ -8,6 +8,9 @@ use Modules\Api\Rest\V1\Filters\ApiFilter;
class Registrar class Registrar
{ {
/**
* @return array<string, mixed>
*/
public static function Filters(): array public static function Filters(): array
{ {
return [ return [

View File

@ -9,7 +9,7 @@ use CodeIgniter\Router\RouteCollection;
/** @var RouteCollection $routes */ /** @var RouteCollection $routes */
$routes->group( $routes->group(
config(RestApi::class) config('RestApi')
->gateway . 'podcasts', ->gateway . 'podcasts',
[ [
'namespace' => 'Modules\Api\Rest\V1\Controllers', 'namespace' => 'Modules\Api\Rest\V1\Controllers',
@ -23,7 +23,7 @@ $routes->group(
); );
$routes->group( $routes->group(
config(RestApi::class) config('RestApi')
->gateway . 'episodes', ->gateway . 'episodes',
[ [
'namespace' => 'Modules\Api\Rest\V1\Controllers', 'namespace' => 'Modules\Api\Rest\V1\Controllers',

View File

@ -5,17 +5,16 @@ declare(strict_types=1);
namespace Modules\Api\Rest\V1\Config; namespace Modules\Api\Rest\V1\Config;
use CodeIgniter\Config\BaseService; use CodeIgniter\Config\BaseService;
use Config\Exceptions as ExceptionsConfig; use Modules\Api\Rest\V1\Core\RestApiExceptions;
use Modules\Api\Rest\V1\Core\Exceptions;
class Services extends BaseService class Services extends BaseService
{ {
public static function restApiExceptions(bool $getShared = true) public static function restApiExceptions(bool $getShared = true): RestApiExceptions
{ {
if ($getShared) { if ($getShared) {
return static::getSharedInstance('restApiExceptions'); return static::getSharedInstance('restApiExceptions');
} }
return new Exceptions(config(ExceptionsConfig::class), static::request(), static::response()); return new RestApiExceptions(config('Exceptions'));
} }
} }

View File

@ -8,8 +8,7 @@ use App\Entities\Episode;
use App\Models\EpisodeModel; use App\Models\EpisodeModel;
use CodeIgniter\API\ResponseTrait; use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller; use CodeIgniter\Controller;
use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\ResponseInterface;
use Modules\Api\Rest\V1\Config\RestApi;
use Modules\Api\Rest\V1\Config\Services; use Modules\Api\Rest\V1\Config\Services;
class EpisodeController extends Controller class EpisodeController extends Controller
@ -21,7 +20,7 @@ class EpisodeController extends Controller
Services::restApiExceptions()->initialize(); Services::restApiExceptions()->initialize();
} }
public function list(): Response public function list(): ResponseInterface
{ {
$query = $this->request->getGet('query'); $query = $this->request->getGet('query');
$order = $this->request->getGet('order') ?? 'newest'; $order = $this->request->getGet('order') ?? 'newest';
@ -46,7 +45,7 @@ class EpisodeController extends Controller
} }
$data = $builder->findAll( $data = $builder->findAll(
(int) ($this->request->getGet('limit') ?? config(RestApi::class)->limit), (int) ($this->request->getGet('limit') ?? config('RestApi')->limit),
(int) $this->request->getGet('offset') (int) $this->request->getGet('offset')
); );
@ -57,7 +56,7 @@ class EpisodeController extends Controller
return $this->respond($data); return $this->respond($data);
} }
public function view(int $id): Response public function view(int $id): ResponseInterface
{ {
$episode = (new EpisodeModel())->getEpisodeById($id); $episode = (new EpisodeModel())->getEpisodeById($id);
@ -65,6 +64,7 @@ class EpisodeController extends Controller
return $this->failNotFound('Episode not found'); return $this->failNotFound('Episode not found');
} }
// @phpstan-ignore-next-line
return $this->respond(static::mapEpisode($episode)); return $this->respond(static::mapEpisode($episode));
} }

View File

@ -6,13 +6,13 @@ namespace Modules\Api\Rest\V1\Controllers;
use CodeIgniter\API\ResponseTrait; use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller; use CodeIgniter\Controller;
use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\ResponseInterface;
class ExceptionController extends Controller class ExceptionController extends Controller
{ {
use ResponseTrait; use ResponseTrait;
public function notFound(): Response public function notFound(): ResponseInterface
{ {
return $this->failNotFound('Podcast not found'); return $this->failNotFound('Podcast not found');
} }

View File

@ -8,7 +8,7 @@ use App\Entities\Podcast;
use App\Models\PodcastModel; use App\Models\PodcastModel;
use CodeIgniter\API\ResponseTrait; use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller; use CodeIgniter\Controller;
use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\ResponseInterface;
use Modules\Api\Rest\V1\Config\Services; use Modules\Api\Rest\V1\Config\Services;
class PodcastController extends Controller class PodcastController extends Controller
@ -20,7 +20,7 @@ class PodcastController extends Controller
Services::restApiExceptions()->initialize(); Services::restApiExceptions()->initialize();
} }
public function list(): Response public function list(): ResponseInterface
{ {
$data = (new PodcastModel())->findAll(); $data = (new PodcastModel())->findAll();
array_map(static function ($podcast): void { array_map(static function ($podcast): void {
@ -29,13 +29,14 @@ class PodcastController extends Controller
return $this->respond($data); return $this->respond($data);
} }
public function view(int $id): Response public function view(int $id): ResponseInterface
{ {
$podcast = (new PodcastModel())->getPodcastById($id); $podcast = (new PodcastModel())->getPodcastById($id);
if (! $podcast instanceof Podcast) { if (! $podcast instanceof Podcast) {
return $this->failNotFound('Podcast not found'); return $this->failNotFound('Podcast not found');
} }
// @phpstan-ignore-next-line
return $this->respond(self::mapPodcast($podcast)); return $this->respond(self::mapPodcast($podcast));
} }
@ -50,7 +51,7 @@ class PodcastController extends Controller
$categories = [$podcast->getCategory(), ...$podcast->getOtherCategories()]; $categories = [$podcast->getCategory(), ...$podcast->getOtherCategories()];
foreach ($categories as $category) { foreach ($categories as $category) {
$category->translated = lang('Podcast.category_options.' . $category->code, [], null, false); $category->translated = lang('Podcast.category_options.' . $category->code);
} }
$podcast->categories = $categories; $podcast->categories = $categories;

View File

@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Modules\Api\Rest\V1\Core; namespace Modules\Api\Rest\V1\Core;
use CodeIgniter\Debug\Exceptions;
use Throwable; use Throwable;
class Exceptions extends \CodeIgniter\Debug\Exceptions class RestApiExceptions extends Exceptions
{ {
protected function render(Throwable $exception, int $statusCode): void protected function render(Throwable $exception, int $statusCode): void
{ {

View File

@ -21,7 +21,7 @@ class ApiFilter implements FilterInterface
public function before(RequestInterface $request, $arguments = null) public function before(RequestInterface $request, $arguments = null)
{ {
/** @var RestApi $restApiConfig */ /** @var RestApi $restApiConfig */
$restApiConfig = config(RestApi::class); $restApiConfig = config('RestApi');
if (! $restApiConfig->enabled) { if (! $restApiConfig->enabled) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();

View File

@ -6,8 +6,6 @@ namespace Modules\Auth;
use CodeIgniter\Router\RouteCollection; use CodeIgniter\Router\RouteCollection;
use CodeIgniter\Shield\Auth as ShieldAuth; use CodeIgniter\Shield\Auth as ShieldAuth;
use Modules\Auth\Config\Auth as AuthConfig;
use Modules\Auth\Config\AuthRoutes;
class Auth extends ShieldAuth class Auth extends ShieldAuth
{ {
@ -18,13 +16,15 @@ class Auth extends ShieldAuth
* Usage (in Config/Routes.php): * Usage (in Config/Routes.php):
* - auth()->routes($routes); * - auth()->routes($routes);
* - auth()->routes($routes, ['except' => ['login', 'register']]) * - auth()->routes($routes, ['except' => ['login', 'register']])
*
* @param array{except?:list<string>} $config
*/ */
public function routes(RouteCollection &$routes, array $config = []): void public function routes(RouteCollection &$routes, array $config = []): void
{ {
$authRoutes = config(AuthRoutes::class) $authRoutes = config('AuthRoutes')
->routes; ->routes;
$routes->group(config(AuthConfig::class)->gateway, [ $routes->group(config('Auth')->gateway, [
'namespace' => 'Modules\Auth\Controllers', 'namespace' => 'Modules\Auth\Controllers',
], static function (RouteCollection $routes) use ($authRoutes, $config): void { ], static function (RouteCollection $routes) use ($authRoutes, $config): void {
foreach ($authRoutes as $name => $row) { foreach ($authRoutes as $name => $row) {

View File

@ -44,7 +44,12 @@ class RolesDoc extends BaseCommand
{ {
// loop over all files in path // loop over all files in path
$defaultFile = glob(ROOTPATH . 'docs/src/getting-started/auth.md'); $defaultFile = glob(ROOTPATH . 'docs/src/getting-started/auth.md');
$localizedFiles = glob(ROOTPATH . 'docs/src/**/getting-started/auth.md') ?? []; $localizedFiles = glob(ROOTPATH . 'docs/src/**/getting-started/auth.md');
if (! $localizedFiles) {
$localizedFiles = [];
}
$files = array_merge($defaultFile, $localizedFiles); $files = array_merge($defaultFile, $localizedFiles);
CLI::write(implode(', ', $files)); CLI::write(implode(', ', $files));
@ -74,7 +79,7 @@ class RolesDoc extends BaseCommand
} }
} }
protected function handleInstanceRoles($authGroups, string $fileContents, string $pattern): string protected function handleInstanceRoles(AuthGroups $authGroups, string $fileContents, string $pattern): string
{ {
$instanceMatrix = $authGroups->matrix; $instanceMatrix = $authGroups->matrix;
return $this->renderCommentBlock( return $this->renderCommentBlock(
@ -88,7 +93,7 @@ class RolesDoc extends BaseCommand
); );
} }
protected function handleInstancePermissions($authGroups, string $fileContents, string $pattern): string protected function handleInstancePermissions(AuthGroups $authGroups, string $fileContents, string $pattern): string
{ {
return $this->renderCommentBlock( return $this->renderCommentBlock(
$fileContents, $fileContents,
@ -101,7 +106,7 @@ class RolesDoc extends BaseCommand
); );
} }
protected function handlePodcastRoles($authGroups, string $fileContents, string $pattern): string protected function handlePodcastRoles(AuthGroups $authGroups, string $fileContents, string $pattern): string
{ {
$podcastMatrix = $authGroups->podcastMatrix; $podcastMatrix = $authGroups->podcastMatrix;
return $this->renderCommentBlock( return $this->renderCommentBlock(
@ -115,7 +120,7 @@ class RolesDoc extends BaseCommand
); );
} }
protected function handlePodcastPermissions($authGroups, string $fileContents, string $pattern): string protected function handlePodcastPermissions(AuthGroups $authGroups, string $fileContents, string $pattern): string
{ {
return $this->renderCommentBlock( return $this->renderCommentBlock(
$fileContents, $fileContents,
@ -128,6 +133,10 @@ class RolesDoc extends BaseCommand
); );
} }
/**
* @param array<string> $tableHeading
* @param array<string, string>|array<string, array<string, string>> $data
*/
private function renderCommentBlock( private function renderCommentBlock(
string $fileContents, string $fileContents,
string $pattern, string $pattern,
@ -171,13 +180,9 @@ class RolesDoc extends BaseCommand
return $newFileContents; return $newFileContents;
} }
private function detectLocaleFromPath($fileKey): string private function detectLocaleFromPath(string $fileKey): string
{ {
preg_match( preg_match('~docs\/src\/(?:([a-z]{2}(?:-[A-Za-z]{2,})?)\/)getting-started\/auth\.md~', $fileKey, $match);
'~docs\/src\/(?:([a-z]{2}(?:-[A-Za-z]{2,})?)\/)getting-started\/auth\.md~',
(string) $fileKey,
$match
);
if ($match === []) { if ($match === []) {
return 'en'; return 'en';

View File

@ -6,8 +6,9 @@ namespace Modules\Auth\Config;
use CodeIgniter\Shield\Authentication\Actions\ActionInterface; use CodeIgniter\Shield\Authentication\Actions\ActionInterface;
use CodeIgniter\Shield\Authentication\Actions\Email2FA; use CodeIgniter\Shield\Authentication\Actions\Email2FA;
use CodeIgniter\Shield\Authentication\AuthenticatorInterface;
use CodeIgniter\Shield\Config\Auth as ShieldAuth; use CodeIgniter\Shield\Config\Auth as ShieldAuth;
use Modules\Admin\Config\Admin; use CodeIgniter\Shield\Entities\User;
use Modules\Auth\Models\UserModel; use Modules\Auth\Models\UserModel;
class Auth extends ShieldAuth class Auth extends ShieldAuth
@ -123,7 +124,7 @@ class Auth extends ShieldAuth
{ {
parent::__construct(); parent::__construct();
$adminGateway = config(Admin::class) $adminGateway = config('Admin')
->gateway; ->gateway;
$this->redirects = [ $this->redirects = [
@ -155,15 +156,17 @@ class Auth extends ShieldAuth
// activate user upon magic-link login as it is done via email // activate user upon magic-link login as it is done via email
if (! auth()->user()->active) { if (! auth()->user()->active) {
/** @var Session $authenticator */ /** @var AuthenticatorInterface $authenticator */
$authenticator = auth('session') $authenticator = auth('session')
->getAuthenticator(); ->getAuthenticator();
$user = $authenticator->getUser(); $user = $authenticator->getUser();
if ($user instanceof User) {
// Set the user active now // Set the user active now
$user->activate(); $user->activate();
} }
}
// prompt user to change their password // prompt user to change their password
return $this->getUrl(route_to('magic-link-set-password')); return $this->getUrl(route_to('magic-link-set-password'));

View File

@ -200,7 +200,7 @@ class AuthGroups extends ShieldAuthGroups
/** /**
* Fill groups, permissions and matrix based on * Fill groups, permissions and matrix based on
*/ */
public function __construct($locale = null) public function __construct()
{ {
parent::__construct(); parent::__construct();
@ -228,7 +228,7 @@ class AuthGroups extends ShieldAuthGroups
*/ */
$podcasts = (new PodcastModel())->findAll(); $podcasts = (new PodcastModel())->findAll();
foreach ($podcasts as $podcast) { foreach ($podcasts as $podcast) {
$this->generatePodcastAuthorizations($podcast->id, $locale); $this->generatePodcastAuthorizations($podcast->id);
} }
} }

View File

@ -8,6 +8,9 @@ use CodeIgniter\Shield\Config\AuthRoutes as ShieldAuthRoutes;
class AuthRoutes extends ShieldAuthRoutes class AuthRoutes extends ShieldAuthRoutes
{ {
/**
* @var array<string, array<array<string>>>
*/
public array $routes = [ public array $routes = [
'register' => [ 'register' => [
['get', 'register', 'RegisterController::registerView', 'register'], ['get', 'register', 'RegisterController::registerView', 'register'],

View File

@ -31,6 +31,8 @@ class AuthToken extends ShieldAuthToken
* The name of Header that the Authorization token should be found. * The name of Header that the Authorization token should be found.
* According to the specs, this should be `Authorization`, but rare * According to the specs, this should be `Authorization`, but rare
* circumstances might need a different header. * circumstances might need a different header.
*
* @var array<string, string>
*/ */
public array $authenticatorHeader = [ public array $authenticatorHeader = [
'tokens' => 'Authorization', 'tokens' => 'Authorization',

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Modules\Auth\Config; namespace Modules\Auth\Config;
use CodeIgniter\Router\RouteCollection; use CodeIgniter\Router\RouteCollection;
use Modules\Admin\Config\Admin;
/** /**
* @var RouteCollection $routes * @var RouteCollection $routes
@ -16,7 +15,7 @@ service('auth')
// Admin routes for users and podcast contributors // Admin routes for users and podcast contributors
$routes->group( $routes->group(
config(Admin::class) config('Admin')
->gateway, ->gateway,
[ [
'namespace' => 'Modules\Auth\Controllers', 'namespace' => 'Modules\Auth\Controllers',

View File

@ -6,7 +6,6 @@ namespace Modules\Auth\Config;
use Config\Services as BaseService; use Config\Services as BaseService;
use Modules\Auth\Auth; use Modules\Auth\Auth;
use Modules\Auth\Config\Auth as AuthConfig;
class Services extends BaseService class Services extends BaseService
{ {
@ -20,7 +19,7 @@ class Services extends BaseService
return self::getSharedInstance('auth'); return self::getSharedInstance('auth');
} }
$config = config(AuthConfig::class); $config = config('Auth');
return new Auth($config); return new Auth($config);
} }

View File

@ -115,6 +115,7 @@ class ContributorController extends BaseController
public function attemptCreate(): RedirectResponse public function attemptCreate(): RedirectResponse
{ {
/** @var User $user */
$user = (new UserModel())->find((int) $this->request->getPost('user')); $user = (new UserModel())->find((int) $this->request->getPost('user'));
if (get_podcast_group($user, $this->podcast->id)) { if (get_podcast_group($user, $this->podcast->id)) {

View File

@ -8,8 +8,7 @@ use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Shield\Controllers\MagicLinkController as ShieldMagicLinkController; use CodeIgniter\Shield\Controllers\MagicLinkController as ShieldMagicLinkController;
use Modules\Auth\Config\Auth; use CodeIgniter\Shield\Entities\User;
use Modules\Auth\Models\UserModel;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use ViewThemes\Theme; use ViewThemes\Theme;
@ -33,7 +32,7 @@ class MagicLinkController extends ShieldMagicLinkController
public function setPasswordView(): string | RedirectResponse public function setPasswordView(): string | RedirectResponse
{ {
if (! session('magicLogin')) { if (! session('magicLogin')) {
return redirect()->to(config(Auth::class)->loginRedirect()); return redirect()->to(config('Auth')->loginRedirect());
} }
return view(setting('Auth.views')['magic-link-set-password']); return view(setting('Auth.views')['magic-link-set-password']);
@ -54,17 +53,16 @@ class MagicLinkController extends ShieldMagicLinkController
$validData = $this->validator->getValidated(); $validData = $this->validator->getValidated();
// set new password to user $user = auth()
auth() ->user();
->user()
->password = $validData['new_password'];
$userModel = new UserModel(); if ($user instanceof User) {
if (! $userModel->update(auth()->user()->id, auth()->user())) { // set new password to user
return redirect() $user->password = $validData['new_password'];
->back()
->withInput() $userModel = auth()
->with('errors', $userModel->errors()); ->getProvider();
$userModel->save($user);
} }
// remove magic login session to reinstate normal check // remove magic login session to reinstate normal check
@ -73,7 +71,7 @@ class MagicLinkController extends ShieldMagicLinkController
} }
// Success! // Success!
return redirect()->to(config(Auth::class)->loginRedirect()) return redirect()->to(config('Auth')->loginRedirect())
->with('message', lang('MyAccount.messages.passwordChangeSuccess')); ->with('message', lang('MyAccount.messages.passwordChangeSuccess'));
} }
} }

View File

@ -11,8 +11,8 @@ declare(strict_types=1);
namespace Modules\Auth\Controllers; namespace Modules\Auth\Controllers;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\Shield\Entities\User;
use Modules\Admin\Controllers\BaseController; use Modules\Admin\Controllers\BaseController;
use Modules\Auth\Models\UserModel;
class MyAccountController extends BaseController class MyAccountController extends BaseController
{ {
@ -60,17 +60,16 @@ class MyAccountController extends BaseController
->with('error', lang('MyAccount.messages.wrongPasswordError')); ->with('error', lang('MyAccount.messages.wrongPasswordError'));
} }
// set new password to user $user = auth()
auth() ->user();
->user()
->password = $validData['new_password'];
$userModel = new UserModel(); if ($user instanceof User) {
if (! $userModel->update(auth()->user()->id, auth()->user())) { // set new password to user
return redirect() $user->password = $validData['new_password'];
->back()
->withInput() $userModel = auth()
->with('errors', $userModel->errors()); ->getProvider();
$userModel->save($user);
} }
// Success! // Success!

View File

@ -16,7 +16,6 @@ use CodeIgniter\I18n\Time;
use CodeIgniter\Shield\Authentication\Authenticators\Session; use CodeIgniter\Shield\Authentication\Authenticators\Session;
use CodeIgniter\Shield\Entities\User; use CodeIgniter\Shield\Entities\User;
use CodeIgniter\Shield\Exceptions\ValidationException; use CodeIgniter\Shield\Exceptions\ValidationException;
use CodeIgniter\Shield\Models\UserIdentityModel;
use Modules\Admin\Controllers\BaseController; use Modules\Admin\Controllers\BaseController;
use Modules\Auth\Models\UserModel; use Modules\Auth\Models\UserModel;
@ -115,8 +114,7 @@ class UserController extends BaseController
// **** SEND WELCOME LINK FOR FIRST LOGIN **** // **** SEND WELCOME LINK FOR FIRST LOGIN ****
/** @var UserIdentityModel $identityModel */ $identityModel = model('UserIdentityModel');
$identityModel = model(UserIdentityModel::class);
// Delete any previous magic-link identities // Delete any previous magic-link identities
$identityModel->deleteIdentitiesByType($user, Session::ID_TYPE_MAGIC_LINK); $identityModel->deleteIdentitiesByType($user, Session::ID_TYPE_MAGIC_LINK);
@ -137,7 +135,7 @@ class UserController extends BaseController
$email->setTo($user->email); $email->setTo($user->email);
$email->setSubject(lang('Auth.welcomeSubject', [ $email->setSubject(lang('Auth.welcomeSubject', [
'siteName' => setting('App.siteName'), 'siteName' => setting('App.siteName'),
], null, false)); ]));
$email->setMessage(view(setting('Auth.views')['welcome-email'], [ $email->setMessage(view(setting('Auth.views')['welcome-email'], [
'token' => $token, 'token' => $token,
], [ ], [

View File

@ -16,7 +16,7 @@ use CodeIgniter\Shield\Models\UserModel as ShieldUserModel;
class UserModel extends ShieldUserModel class UserModel extends ShieldUserModel
{ {
/** /**
* @var string[] * @var list<string>
*/ */
protected $allowedFields = [ protected $allowedFields = [
'username', 'username',

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Modules\Fediverse\Commands; namespace Modules\Fediverse\Commands;
use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\BaseCommand;
use Modules\Fediverse\Models\ActivityModel;
class Broadcast extends BaseCommand class Broadcast extends BaseCommand
{ {
@ -20,7 +19,7 @@ class Broadcast extends BaseCommand
helper('fediverse'); helper('fediverse');
// retrieve scheduled activities from database // retrieve scheduled activities from database
$scheduledActivities = model(ActivityModel::class, false) $scheduledActivities = model('ActivityModel', false)
->getScheduledActivities(); ->getScheduledActivities();
// Send activity to all followers // Send activity to all followers
@ -43,7 +42,7 @@ class Broadcast extends BaseCommand
} }
// set activity post to delivered // set activity post to delivered
model(ActivityModel::class, false) model('ActivityModel', false)
->update($scheduledActivity->id, [ ->update($scheduledActivity->id, [
'status' => 'delivered', 'status' => 'delivered',
]); ]);

Some files were not shown because too many files have changed in this diff Show More