refactor: add modules folder to phpstan paths + fix errors

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,6 @@ use App\Models\PodcastModel;
use CodeIgniter\Database\Exceptions\DatabaseException;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Cache;
use Modules\Media\FileManagers\FileManagerInterface;
class HomeController extends BaseController
@ -54,7 +53,7 @@ class HomeController extends BaseController
}
// --- 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.';
}

View file

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

View file

@ -37,7 +37,7 @@ class PostController extends FediversePostController
protected $post;
/**
* @var string[]
* @var list<string>
*/
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\HTTP\Files\UploadedFile;
use CodeIgniter\I18n\Time;
use Config\Images;
use Exception;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\Autolink\AutolinkExtension;
@ -201,7 +200,7 @@ class Episode extends Entity
} else {
$cover = new Image([
'file_key' => 'podcasts/' . $this->getPodcast()->handle . '/' . $this->attributes['slug'] . '.' . $file->getExtension(),
'sizes' => config(Images::class)
'sizes' => config('Images')
->podcastCoverSizes,
'uploaded_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\Files\File;
use CodeIgniter\HTTP\Files\UploadedFile;
use Config\Images;
use Modules\Media\Entities\Image;
use Modules\Media\Models\MediaModel;
use RuntimeException;
@ -72,7 +71,7 @@ class Person extends Entity
} else {
$avatar = new Image([
'file_key' => 'persons/' . $this->attributes['unique_name'] . '.' . $file->getExtension(),
'sizes' => config(Images::class)
'sizes' => config('Images')
->personAvatarSizes,
'uploaded_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\I18n\Time;
use CodeIgniter\Shield\Entities\User;
use Config\Images;
use Exception;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\Autolink\AutolinkExtension;
@ -255,7 +254,7 @@ class Podcast extends Entity
} else {
$cover = new Image([
'file_key' => 'podcasts/' . $this->attributes['handle'] . '/cover.' . $file->getExtension(),
'sizes' => config(Images::class)
'sizes' => config('Images')
->podcastCoverSizes,
'uploaded_by' => $this->attributes['updated_by'],
'updated_by' => $this->attributes['updated_by'],
@ -298,7 +297,7 @@ class Podcast extends Entity
} else {
$banner = new Image([
'file_key' => 'podcasts/' . $this->attributes['handle'] . '/banner.' . $file->getExtension(),
'sizes' => config(Images::class)
'sizes' => config('Images')
->podcastBannerSizes,
'uploaded_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\Podcast;
use Cocur\Slugify\Slugify;
use Config\App;
use Config\Images;
use Modules\Media\Entities\Image;
@ -25,7 +24,7 @@ if (! function_exists('get_browser_language')) {
function get_browser_language(?string $httpAcceptLanguage = null): string
{
if ($httpAcceptLanguage === null) {
return config(App::class)->defaultLocale;
return config('App')->defaultLocale;
}
$langs = explode(',', $httpAcceptLanguage);
@ -192,7 +191,7 @@ if (! function_exists('format_bytes')) {
if (! function_exists('get_site_icon_url')) {
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 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
{
if (! $podcast->banner instanceof Image) {
$defaultBanner = config(Images::class)
$defaultBanner = config('Images')
->podcastBannerDefaultPaths[service('settings')->get('App.theme')] ?? config(
Images::class
)->podcastBannerDefaultPaths['default'];
$sizes = config(Images::class)
$sizes = config('Images')
->podcastBannerSizes;
$sizeConfig = $sizes[$size];
@ -231,7 +230,7 @@ if (! function_exists('get_podcast_banner_mimetype')) {
function get_podcast_banner_mimetype(Podcast $podcast, string $size): string
{
if (! $podcast->banner instanceof Image) {
$sizes = config(Images::class)
$sizes = config('Images')
->podcastBannerSizes;
$sizeConfig = $sizes[$size];
@ -252,10 +251,10 @@ if (! function_exists('get_avatar_url')) {
function get_avatar_url(Person $person, string $size): string
{
if (! $person->avatar instanceof Image) {
$defaultAvatarPath = config(Images::class)
$defaultAvatarPath = config('Images')
->avatarDefaultPath;
$sizes = config(Images::class)
$sizes = config('Images')
->personAvatarSizes;
$sizeConfig = $sizes[$size];

View file

@ -9,7 +9,6 @@ declare(strict_types=1);
*/
use App\Models\PageModel;
use Config\App;
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 (config(App::class)->legalNoticeURL !== null) {
$links .= anchor(config(App::class)->legalNoticeURL, lang('Common.legal_notice'), [
if (config('App')->legalNoticeURL !== null) {
$links .= anchor(config('App')->legalNoticeURL, lang('Common.legal_notice'), [
'class' => 'px-2 py-1 underline hover:no-underline focus:ring-accent',
'target' => '_blank',
'rel' => 'noopener noreferrer',

View file

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

View file

@ -81,7 +81,7 @@ class Router extends CodeIgniterRouter
);
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,
// from trying to find a route
throw PageNotFoundException::forLocaleNotSupported($matched['locale']);

View file

@ -14,7 +14,6 @@ use App\Entities\Actor;
use App\Entities\Podcast;
use CodeIgniter\HTTP\URI;
use CodeIgniter\Model;
use Config\Fediverse;
use phpseclib\Crypt\RSA;
class PodcastModel extends Model
@ -349,7 +348,7 @@ class PodcastModel extends Model
// delete all cache for podcast actor
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.
cache()

View file

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

View file

@ -9,7 +9,7 @@
"php": "^8.1",
"adaures/ipcat-php": "^v1.0.0",
"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",
"cocur/slugify": "^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",
"This file is @generated automatically"
],
"content-hash": "063a673edd8a39e318bae89316709ef0",
"content-hash": "b0b783684ed8d36e636fac3632c78c27",
"packages": [
{
"name": "adaures/ipcat-php",
@ -188,16 +188,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.305.3",
"version": "3.305.4",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "b190e24bd6568713436e1f13f9022bf28f491fc1"
"reference": "fc26a2ebf720e0b75a353d7e8fe206796671e00b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b190e24bd6568713436e1f13f9022bf28f491fc1",
"reference": "b190e24bd6568713436e1f13f9022bf28f491fc1",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fc26a2ebf720e0b75a353d7e8fe206796671e00b",
"reference": "fc26a2ebf720e0b75a353d7e8fe206796671e00b",
"shasum": ""
},
"require": {
@ -273,31 +273,31 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"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",
"version": "0.11.0",
"version": "0.12.1",
"source": {
"type": "git",
"url": "https://github.com/brick/math.git",
"reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478"
"reference": "f510c0a40911935b77b86859eb5223d58d660df1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478",
"reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478",
"url": "https://api.github.com/repos/brick/math/zipball/f510c0a40911935b77b86859eb5223d58d660df1",
"reference": "f510c0a40911935b77b86859eb5223d58d660df1",
"shasum": ""
},
"require": {
"php": "^8.0"
"php": "^8.1"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^9.0",
"vimeo/psalm": "5.0.0"
"phpunit/phpunit": "^10.1",
"vimeo/psalm": "5.16.0"
},
"type": "library",
"autoload": {
@ -315,12 +315,17 @@
"arithmetic",
"bigdecimal",
"bignum",
"bignumber",
"brick",
"math"
"decimal",
"integer",
"math",
"mathematics",
"rational"
],
"support": {
"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": [
{
@ -328,7 +333,7 @@
"type": "github"
}
],
"time": "2023-01-15T23:15:59+00:00"
"time": "2023-11-29T23:19:16+00:00"
},
{
"name": "chrisjean/php-ico",
@ -2796,20 +2801,20 @@
},
{
"name": "ramsey/uuid",
"version": "4.7.5",
"version": "4.7.6",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
"reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e"
"reference": "91039bc1faa45ba123c4328958e620d382ec7088"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e",
"reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/91039bc1faa45ba123c4328958e620d382ec7088",
"reference": "91039bc1faa45ba123c4328958e620d382ec7088",
"shasum": ""
},
"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": "*",
"php": "^8.0",
"ramsey/collection": "^1.2 || ^2.0"
@ -2864,7 +2869,7 @@
"keywords": ["guid", "identifier", "uuid"],
"support": {
"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": [
{
@ -2876,7 +2881,7 @@
"type": "tidelift"
}
],
"time": "2023-11-08T05:53:05+00:00"
"time": "2024-04-27T21:32:50+00:00"
},
{
"name": "symfony/deprecation-contracts",
@ -3393,12 +3398,12 @@
"source": {
"type": "git",
"url": "https://github.com/yassinedoghri/podcast-feed.git",
"reference": "366ddcedfb4b89c7093d03b2398184435f930843"
"reference": "f34156e62c9eef8bd5561f8a585d99501e235505"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yassinedoghri/podcast-feed/zipball/366ddcedfb4b89c7093d03b2398184435f930843",
"reference": "366ddcedfb4b89c7093d03b2398184435f930843",
"url": "https://api.github.com/repos/yassinedoghri/podcast-feed/zipball/f34156e62c9eef8bd5561f8a585d99501e235505",
"reference": "f34156e62c9eef8bd5561f8a585d99501e235505",
"shasum": ""
},
"require": {
@ -3434,7 +3439,7 @@
"issues": "https://github.com/yassinedoghri/podcast-feed/issues",
"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": [

View file

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

View file

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

View file

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

View file

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

View file

@ -32,7 +32,6 @@ use Modules\Analytics\Models\AnalyticsPodcastModel;
use Modules\Analytics\Models\AnalyticsWebsiteByBrowserModel;
use Modules\Analytics\Models\AnalyticsWebsiteByEntryPageModel;
use Modules\Analytics\Models\AnalyticsWebsiteByRefererModel;
use Modules\Auth\Config\AuthGroups;
use Modules\Media\Entities\Image;
use Modules\Media\FileManagers\FileManagerInterface;
use Modules\Media\Models\MediaModel;
@ -244,7 +243,7 @@ class PodcastController extends BaseController
// generate podcast roles and permissions
// before setting current user as podcast admin
config(AuthGroups::class)
config('AuthGroups')
->generatePodcastAuthorizations($newPodcastId);
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 CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\RedirectResponse;
use Config\Colors;
use Modules\Media\Entities\Transcript;
use Modules\Media\Models\MediaModel;
use Modules\MediaClipper\Config\MediaClipper;
class VideoClipsController extends BaseController
{
@ -91,7 +89,7 @@ class VideoClipsController extends BaseController
return view('episode/video_clips_list', $data);
}
public function view($videoClipId): string
public function view(string $videoClipId): string
{
$videoClip = (new ClipModel())->getVideoClipById((int) $videoClipId);
@ -146,8 +144,8 @@ class VideoClipsController extends BaseController
'title' => 'required',
'start_time' => 'required|greater_than_equal_to[0]',
'duration' => 'required|greater_than[0]',
'format' => 'required|in_list[' . implode(',', array_keys(config(MediaClipper::class)->formats)) . ']',
'theme' => 'required|in_list[' . implode(',', array_keys(config(Colors::class)->themes)) . ']',
'format' => 'required|in_list[' . implode(',', array_keys(config('MediaClipper')->formats)) . ']',
'theme' => 'required|in_list[' . implode(',', array_keys(config('Colors')->themes)) . ']',
];
if (! $this->validate($rules)) {
@ -160,7 +158,7 @@ class VideoClipsController extends BaseController
$validData = $this->validator->getValidated();
$themeName = $validData['theme'];
$themeColors = config(MediaClipper::class)
$themeColors = config('MediaClipper')
->themes[$themeName];
$theme = [
'name' => $themeName,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,7 +11,6 @@ declare(strict_types=1);
use AdAures\Ipcat\IpDb;
use Config\Services;
use GeoIp2\Database\Reader;
use Modules\Analytics\Config\Analytics;
use Opawg\UserAgentsV2Php\UserAgents;
use WhichBrowser\Parser;
@ -41,11 +40,12 @@ if (! function_exists('client_ip')) {
*/
function client_ip(): string
{
if (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
$superglobals = service('superglobals');
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')) {
$playerFound = null;
$userAgent = $_SERVER['HTTP_USER_AGENT'];
$userAgent = service('superglobals')
->server('HTTP_USER_AGENT');
try {
$playerFound = UserAgents::find($userAgent);
@ -175,7 +176,8 @@ if (! function_exists('set_user_session_referer')) {
{
$session = Services::session();
$newreferer = $_SERVER['HTTP_REFERER'] ?? '- Direct -';
$newreferer = service('superglobals')
->server('HTTP_REFERER') ?? '- Direct -';
$newreferer =
parse_url((string) $newreferer, 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();
$entryPage = $_SERVER['REQUEST_URI'];
$entryPage = service('superglobals')
->server('REQUEST_URI');
if (! $session->has('entryPage')) {
$session->set('entryPage', $entryPage);
}
@ -243,10 +246,11 @@ if (! function_exists('podcast_hit')) {
$session->get('player')['bot'] = true;
}
$superglobals = service('superglobals');
//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;
// 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 =
@ -254,11 +258,14 @@ if (! function_exists('podcast_hit')) {
sha1(
$salt . '_' . date(
'Y-m-d'
) . '_' . $clientIp . '_' . $_SERVER['HTTP_USER_AGENT'] . '_' . $episodeId
) . '_' . $clientIp . '_' . $superglobals->server('HTTP_USER_AGENT') . '_' . $episodeId
);
// The cache expires at midnight:
$secondsToMidnight = strtotime('tomorrow') - time();
/** @var int|null $downloadedBytes */
$downloadedBytes = cache($episodeListenerHashId);
if ($downloadedBytes === null) {
// If it was never downloaded that means that zero bytes were downloaded:
$downloadedBytes = 0;
@ -301,13 +308,16 @@ if (! function_exists('podcast_hit')) {
sha1(
$salt . '_' . date(
'Y-m-d'
) . '_' . $clientIp . '_' . $_SERVER['HTTP_USER_AGENT'] . '_' . $podcastId
) . '_' . $clientIp . '_' . $superglobals->server('HTTP_USER_AGENT') . '_' . $podcastId
);
$newListener = 1;
// Has this listener already downloaded an episode today:
/** @var int|null $downloadsByUser */
$downloadsByUser = cache($podcastListenerHashId);
// We add one download
if ($downloadsByUser) {
if ($downloadsByUser === null) {
$newListener = 0;
++$downloadsByUser;
} else {

View file

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

View file

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

View file

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

View file

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

View file

@ -5,17 +5,16 @@ declare(strict_types=1);
namespace Modules\Api\Rest\V1\Config;
use CodeIgniter\Config\BaseService;
use Config\Exceptions as ExceptionsConfig;
use Modules\Api\Rest\V1\Core\Exceptions;
use Modules\Api\Rest\V1\Core\RestApiExceptions;
class Services extends BaseService
{
public static function restApiExceptions(bool $getShared = true)
public static function restApiExceptions(bool $getShared = true): RestApiExceptions
{
if ($getShared) {
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 CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\Response;
use Modules\Api\Rest\V1\Config\RestApi;
use CodeIgniter\HTTP\ResponseInterface;
use Modules\Api\Rest\V1\Config\Services;
class EpisodeController extends Controller
@ -21,7 +20,7 @@ class EpisodeController extends Controller
Services::restApiExceptions()->initialize();
}
public function list(): Response
public function list(): ResponseInterface
{
$query = $this->request->getGet('query');
$order = $this->request->getGet('order') ?? 'newest';
@ -46,7 +45,7 @@ class EpisodeController extends Controller
}
$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')
);
@ -57,7 +56,7 @@ class EpisodeController extends Controller
return $this->respond($data);
}
public function view(int $id): Response
public function view(int $id): ResponseInterface
{
$episode = (new EpisodeModel())->getEpisodeById($id);
@ -65,6 +64,7 @@ class EpisodeController extends Controller
return $this->failNotFound('Episode not found');
}
// @phpstan-ignore-next-line
return $this->respond(static::mapEpisode($episode));
}

View file

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

View file

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

View file

@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Modules\Api\Rest\V1\Core;
use CodeIgniter\Debug\Exceptions;
use Throwable;
class Exceptions extends \CodeIgniter\Debug\Exceptions
class RestApiExceptions extends Exceptions
{
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)
{
/** @var RestApi $restApiConfig */
$restApiConfig = config(RestApi::class);
$restApiConfig = config('RestApi');
if (! $restApiConfig->enabled) {
throw PageNotFoundException::forPageNotFound();

View file

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

View file

@ -44,7 +44,12 @@ class RolesDoc extends BaseCommand
{
// loop over all files in path
$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);
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;
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(
$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;
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(
$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(
string $fileContents,
string $pattern,
@ -171,13 +180,9 @@ class RolesDoc extends BaseCommand
return $newFileContents;
}
private function detectLocaleFromPath($fileKey): string
private function detectLocaleFromPath(string $fileKey): string
{
preg_match(
'~docs\/src\/(?:([a-z]{2}(?:-[A-Za-z]{2,})?)\/)getting-started\/auth\.md~',
(string) $fileKey,
$match
);
preg_match('~docs\/src\/(?:([a-z]{2}(?:-[A-Za-z]{2,})?)\/)getting-started\/auth\.md~', $fileKey, $match);
if ($match === []) {
return 'en';

View file

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

View file

@ -200,7 +200,7 @@ class AuthGroups extends ShieldAuthGroups
/**
* Fill groups, permissions and matrix based on
*/
public function __construct($locale = null)
public function __construct()
{
parent::__construct();
@ -228,7 +228,7 @@ class AuthGroups extends ShieldAuthGroups
*/
$podcasts = (new PodcastModel())->findAll();
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
{
/**
* @var array<string, array<array<string>>>
*/
public array $routes = [
'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.
* According to the specs, this should be `Authorization`, but rare
* circumstances might need a different header.
*
* @var array<string, string>
*/
public array $authenticatorHeader = [
'tokens' => 'Authorization',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,11 +11,11 @@ declare(strict_types=1);
namespace Modules\Fediverse\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;
class ActivityPubController extends Controller
{
public function preflight(): Response
public function preflight(): ResponseInterface
{
return $this->response->setHeader('Access-Control-Allow-Origin', '*') // for allowing any domain, insecure
->setHeader('Access-Control-Allow-Headers', '*') // for allowing any headers, insecure

View file

@ -26,7 +26,7 @@ use Modules\Fediverse\Objects\OrderedCollectionPage;
class ActorController extends Controller
{
/**
* @var string[]
* @var list<string>
*/
protected $helpers = ['fediverse'];
@ -36,7 +36,7 @@ class ActorController extends Controller
public function __construct()
{
$this->config = config(Fediverse::class);
$this->config = config('Fediverse');
}
public function _remap(string $method, string ...$params): mixed
@ -89,7 +89,6 @@ class ActorController extends Controller
);
// switch/case on activity type
/** @phpstan-ignore-next-line */
switch ($payload->type) {
case 'Create':
if ($payload->object->type === 'Note') {
@ -192,7 +191,6 @@ class ActorController extends Controller
->setJSON([]);
case 'Undo':
// switch/case on the type of activity to undo
/** @phpstan-ignore-next-line */
switch ($payload->object->type) {
case 'Follow':
// revert side-effect by removing follow from database

View file

@ -17,7 +17,7 @@ use Exception;
class BlockController extends Controller
{
/**
* @var string[]
* @var list<string>
*/
protected $helpers = ['fediverse'];

View file

@ -12,7 +12,6 @@ namespace Modules\Fediverse\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\ResponseInterface;
use Modules\Auth\Config\Auth;
class NodeInfo2Controller extends Controller
{
@ -36,7 +35,7 @@ class NodeInfo2Controller extends Controller
'version' => CP_VERSION,
],
'protocols' => ['activitypub'],
'openRegistrations' => config(Auth::class)
'openRegistrations' => config('Auth')
->allowRegistration,
'usage' => [
'users' => [

View file

@ -14,7 +14,6 @@ use CodeIgniter\Controller;
use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\I18n\Time;
use Modules\Fediverse\Config\Fediverse;
@ -32,7 +31,7 @@ class PostController extends Controller
protected $request;
/**
* @var string[]
* @var list<string>
*/
protected $helpers = ['fediverse'];
@ -45,7 +44,7 @@ class PostController extends Controller
public function __construct()
{
$this->config = config(Fediverse::class);
$this->config = config('Fediverse');
}
public function _remap(string $method, string ...$params): mixed
@ -65,7 +64,7 @@ class PostController extends Controller
return $this->{$method}(...$params);
}
public function index(): Response
public function index(): ResponseInterface
{
$noteObjectClass = $this->config->noteObject;
$noteObject = new $noteObjectClass($this->post);
@ -75,7 +74,7 @@ class PostController extends Controller
->setBody($noteObject->toJSON());
}
public function replies(): Response
public function replies(): ResponseInterface
{
/**
* get post replies
@ -167,7 +166,7 @@ class PostController extends Controller
->getActorById($validData['actor_id']);
model('FavouriteModel', false)
->toggleFavourite($actor, $this->post->id);
->toggleFavourite($actor, $this->post);
return redirect()->back();
}

View file

@ -24,7 +24,7 @@ abstract class AbstractObject
}
/**
* @return array<string, string|int|bool|array>
* @return array<string, mixed>
*/
public function toArray(): array
{

View file

@ -41,7 +41,7 @@ class Activity extends UuidEntity
protected $uuids = ['id', 'post_id'];
/**
* @var string[]
* @var list<string>
*/
protected $dates = ['scheduled_at', 'created_at'];

View file

@ -10,6 +10,7 @@ declare(strict_types=1);
namespace Modules\Fediverse\Entities;
use CodeIgniter\I18n\Time;
use Michalsn\Uuid\UuidEntity;
use Modules\Fediverse\Models\ActorModel;
use Modules\Fediverse\Models\PostModel;
@ -46,7 +47,7 @@ class Notification extends UuidEntity
protected $uuids = ['post_id', 'activity_id'];
/**
* @var string[]
* @var list<string>
*/
protected $dates = ['read_at', 'created_at', 'updated_at'];

View file

@ -65,7 +65,7 @@ class Post extends UuidEntity
protected $uuids = ['id', 'in_reply_to_id', 'reblog_of_id'];
/**
* @var string[]
* @var list<string>
*/
protected $dates = ['published_at', 'created_at'];

View file

@ -44,6 +44,7 @@ class FediverseFilter implements FilterInterface
}
if (in_array('verify-blocks', $params, true)) {
// @phpstan-ignore-next-line
$payload = $request->getJSON();
$actorUri = $payload->actor;

View file

@ -17,7 +17,6 @@ use Modules\Fediverse\ActivityRequest;
use Modules\Fediverse\Core\ObjectType;
use Modules\Fediverse\Entities\Actor;
use Modules\Fediverse\Entities\PreviewCard;
use Modules\Fediverse\Models\ActivityModel;
if (! function_exists('get_webfinger_data')) {
/**
@ -79,7 +78,7 @@ if (! function_exists('accept_follow')) {
$db = db_connect();
$db->transStart();
$activityModel = model(ActivityModel::class, false);
$activityModel = model('ActivityModel', false);
$activityId = $activityModel->newActivity(
'Accept',
$actor->id,
@ -488,7 +487,7 @@ if (! function_exists('linkify')) {
return preg_replace_callback(
'~<(\d+)>~',
static function (array $match) use (&$links): string {
return $links[$match[1] - 1];
return $links[(int) $match[1] - 1];
},
(string) $text,
);

View file

@ -142,9 +142,10 @@ class HttpSignature
$strings[] = sprintf(
'(request-target): %s %s%s',
$this->request->getMethod(),
'/' . $this->request->uri->getPath(),
$this->request->uri->getQuery() !== ''
? '?' . $this->request->uri->getQuery()
'/' . $this->request->getUri()->getPath(),
$this->request->getUri()
->getQuery() !== ''
? '?' . $this->request->getUri()->getQuery()
: '',
);

View file

@ -14,7 +14,6 @@ use CodeIgniter\Database\BaseResult;
use CodeIgniter\I18n\Time;
use DateTimeInterface;
use Michalsn\Uuid\UuidModel;
use Modules\Fediverse\Config\Fediverse;
use Modules\Fediverse\Entities\Activity;
class ActivityModel extends UuidModel
@ -35,17 +34,17 @@ class ActivityModel extends UuidModel
protected $uuidFields = ['id', 'post_id'];
/**
* @var string[]
* @var list<string>
*/
protected $afterInsert = ['notify'];
/**
* @var string[]
* @var list<string>
*/
protected $afterUpdate = ['notify'];
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = [
'id',
@ -78,7 +77,7 @@ class ActivityModel extends UuidModel
public function getActivityById(string $activityId): ?Activity
{
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix . "activity#{$activityId}";
if (! ($found = cache($cacheName))) {
$found = $this->find($activityId);
@ -133,11 +132,12 @@ class ActivityModel extends UuidModel
}
/**
* @param array<string, array<string|int, mixed>> $data
* @param array<mixed> $data
* @return array<string, array<string|int, mixed>>
*/
protected function notify(array $data): array
{
/** @var ?Activity $activity */
$activity = (new self())->find(is_array($data['id']) ? $data['id'][0] : $data['id']);
if (! $activity instanceof Activity) {

View file

@ -12,7 +12,6 @@ namespace Modules\Fediverse\Models;
use CodeIgniter\Events\Events;
use CodeIgniter\Model;
use Modules\Fediverse\Config\Fediverse;
use Modules\Fediverse\Entities\Actor;
class ActorModel extends Model
@ -23,7 +22,7 @@ class ActorModel extends Model
protected $table = 'fediverse_actors';
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = [
'id',
@ -99,7 +98,7 @@ class ActorModel extends Model
{
$hashedActorUri = md5($actorUri);
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix . "actor-{$hashedActorUri}";
if (! ($found = cache($cacheName))) {
$found = $this->where('uri', $actorUri)
@ -118,7 +117,7 @@ class ActorModel extends Model
public function getFollowers(int $actorId): array
{
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix . "actor#{$actorId}_followers";
if (! ($found = cache($cacheName))) {
$found = $this->join('fediverse_follows', 'fediverse_follows.actor_id = id', 'inner')
@ -151,7 +150,7 @@ class ActorModel extends Model
*/
public function getBlockedActors(): array
{
$cacheName = config(Fediverse::class)
$cacheName = config('Fediverse')
->cachePrefix . 'blocked_actors';
if (! ($found = cache($cacheName))) {
$found = $this->where('is_blocked', 1)
@ -166,7 +165,7 @@ class ActorModel extends Model
public function blockActor(int $actorId): void
{
$prefix = config(Fediverse::class)
$prefix = config('Fediverse')
->cachePrefix;
cache()
->delete($prefix . 'blocked_actors');
@ -182,7 +181,7 @@ class ActorModel extends Model
public function unblockActor(int $actorId): void
{
$prefix = config(Fediverse::class)
$prefix = config('Fediverse')
->cachePrefix;
cache()
->delete($prefix . 'blocked_actors');
@ -200,10 +199,11 @@ class ActorModel extends Model
{
helper('fediverse');
$cacheName = config(Fediverse::class)
$cacheName = config('Fediverse')
->cachePrefix . 'blocked_actors';
if (! ($found = cache($cacheName))) {
$result = $this->select('COUNT(*) as total_local_actors')
$result = $this->builder()
->select('COUNT(*) as total_local_actors')
->where('domain', get_current_domain())
->get()
->getResultArray();
@ -221,15 +221,13 @@ class ActorModel extends Model
{
helper('fediverse');
$cacheName = config(Fediverse::class)
$cacheName = config('Fediverse')
->cachePrefix . 'blocked_actors';
if (! ($found = cache($cacheName))) {
$tablePrefix = config(Database::class)
$tablePrefix = config('Database')
->default['DBPrefix'];
$result = $this->select(
'COUNT(DISTINCT `' . $tablePrefix . 'fediverse_actors`.`id`) as `total_active_actors`',
false
)
$result = $this->builder()
->select('COUNT(DISTINCT `' . $tablePrefix . 'fediverse_actors`.`id`) as `total_active_actors`', false)
->join(
$tablePrefix . 'fediverse_posts',
$tablePrefix . 'fediverse_actors.id = ' . $tablePrefix . 'fediverse_posts.actor_id',
@ -300,7 +298,7 @@ class ActorModel extends Model
public function clearCache(Actor $actor): void
{
$cachePrefix = config(Fediverse::class)
$cachePrefix = config('Fediverse')
->cachePrefix;
$hashedActorUri = md5($actor->uri);
$cacheDomain = str_replace(':', '', $actor->domain);

View file

@ -13,7 +13,6 @@ namespace Modules\Fediverse\Models;
use CodeIgniter\Database\BaseResult;
use CodeIgniter\Events\Events;
use CodeIgniter\Model;
use Modules\Fediverse\Config\Fediverse;
use Modules\Fediverse\Entities\BlockedDomain;
class BlockedDomainModel extends Model
@ -29,7 +28,7 @@ class BlockedDomainModel extends Model
protected $primaryKey = 'name';
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = ['name'];
@ -57,7 +56,7 @@ class BlockedDomainModel extends Model
*/
public function getBlockedDomains(): array
{
$cacheName = config(Fediverse::class)
$cacheName = config('Fediverse')
->cachePrefix . 'blocked_domains';
if (! ($found = cache($cacheName))) {
$found = $this->findAll();
@ -73,7 +72,7 @@ class BlockedDomainModel extends Model
{
$hashedDomainName = md5($name);
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix .
"domain#{$hashedDomainName}_isBlocked";
if (! ($found = cache($cacheName))) {
@ -89,7 +88,7 @@ class BlockedDomainModel extends Model
public function blockDomain(string $name): int | bool
{
$hashedDomain = md5($name);
$prefix = config(Fediverse::class)
$prefix = config('Fediverse')
->cachePrefix;
cache()
->delete($prefix . "domain#{$hashedDomain}_isBlocked");
@ -121,7 +120,7 @@ class BlockedDomainModel extends Model
public function unblockDomain(string $name): BaseResult | bool
{
$hashedDomain = md5($name);
$prefix = config(Fediverse::class)
$prefix = config('Fediverse')
->cachePrefix;
cache()
->delete($prefix . "domain#{$hashedDomain}_isBlocked");

View file

@ -31,7 +31,7 @@ class FavouriteModel extends UuidModel
protected $uuidFields = ['post_id'];
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = ['actor_id', 'post_id'];
@ -57,6 +57,7 @@ class FavouriteModel extends UuidModel
]);
model('PostModel', false)
->builder()
->where('id', service('uuid') ->fromString($post->id) ->getBytes())
->increment('favourites_count');
@ -97,6 +98,7 @@ class FavouriteModel extends UuidModel
$this->db->transStart();
model('PostModel', false)
->builder()
->where('id', service('uuid') ->fromString($post->id) ->getBytes())
->decrement('favourites_count');

View file

@ -27,7 +27,7 @@ class FollowModel extends Model
protected $table = 'fediverse_follows';
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = ['actor_id', 'target_actor_id'];
@ -59,6 +59,7 @@ class FollowModel extends Model
// increment followers_count for target actor
model('ActorModel', false)
->builder()
->where('id', $targetActor->id)
->increment('followers_count');
@ -114,6 +115,7 @@ class FollowModel extends Model
// decrement followers_count for target actor
model('ActorModel', false)
->builder()
->where('id', $targetActor->id)
->decrement('followers_count');

View file

@ -41,7 +41,7 @@ class NotificationModel extends UuidModel
protected $uuidFields = ['post_id', 'activity_id'];
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = [
'actor_id',

View file

@ -20,7 +20,6 @@ use Modules\Fediverse\Activities\AnnounceActivity;
use Modules\Fediverse\Activities\CreateActivity;
use Modules\Fediverse\Activities\DeleteActivity;
use Modules\Fediverse\Activities\UndoActivity;
use Modules\Fediverse\Config\Fediverse;
use Modules\Fediverse\Entities\Actor;
use Modules\Fediverse\Entities\Post;
use Modules\Fediverse\Objects\TombstoneObject;
@ -43,7 +42,7 @@ class PostModel extends UuidModel
protected $uuidFields = ['id', 'in_reply_to_id', 'reblog_of_id'];
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = [
'id',
@ -85,7 +84,7 @@ class PostModel extends UuidModel
];
/**
* @var string[]
* @var list<string>
*/
protected $beforeInsert = ['setPostId'];
@ -98,7 +97,7 @@ class PostModel extends UuidModel
{
$hashedPostUri = md5($postUri);
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix . "post-{$hashedPostUri}";
if (! ($found = cache($cacheName))) {
$found = $this->where('uri', $postUri)
@ -119,7 +118,7 @@ class PostModel extends UuidModel
public function getActorPublishedPosts(int $actorId): array
{
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix .
"actor#{$actorId}_published_posts";
if (! ($found = cache($cacheName))) {
@ -146,7 +145,8 @@ class PostModel extends UuidModel
*/
public function getSecondsToNextUnpublishedPosts(int $actorId): int | false
{
$result = $this->select('TIMESTAMPDIFF(SECOND, UTC_TIMESTAMP(), `published_at`) as timestamp_diff')
$result = $this->builder()
->select('TIMESTAMPDIFF(SECOND, UTC_TIMESTAMP(), `published_at`) as timestamp_diff')
->where([
'actor_id' => $actorId,
])
@ -168,7 +168,7 @@ class PostModel extends UuidModel
public function getPostReplies(string $postId, bool $withBlocked = false): array
{
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix .
"post#{$postId}_replies" .
($withBlocked ? '_withBlocked' : '');
@ -200,7 +200,7 @@ class PostModel extends UuidModel
public function getPostReblogs(string $postId): array
{
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix . "post#{$postId}_reblogs";
if (! ($found = cache($cacheName))) {
@ -265,6 +265,7 @@ class PostModel extends UuidModel
if ($post->in_reply_to_id === null) {
// post is not a reply
model('ActorModel', false)
->builder()
->where('id', $post->actor_id)
->increment('posts_count');
@ -277,7 +278,7 @@ class PostModel extends UuidModel
$post->uri = url_to('post', esc($post->actor->username), $newPostId);
$createActivity = new CreateActivity();
$noteObjectClass = config(Fediverse::class)
$noteObjectClass = config('Fediverse')
->noteObject;
$createActivity
->set('actor', $post->actor->uri)
@ -402,6 +403,7 @@ class PostModel extends UuidModel
if ($post->in_reply_to_id === null && $post->reblog_of_id === null) {
model('ActorModel', false)
->builder()
->where('id', $post->actor_id)
->decrement('posts_count');
@ -409,6 +411,7 @@ class PostModel extends UuidModel
} elseif ($post->in_reply_to_id !== null) {
// Post to remove is a reply
model('PostModel', false)
->builder()
->where('id', $this->uuid->fromString($post->in_reply_to_id) ->getBytes())
->decrement('replies_count');
@ -439,6 +442,7 @@ class PostModel extends UuidModel
$postId = $this->addPost($reply, $createPreviewCard, $registerActivity);
model('PostModel', false)
->builder()
->where('id', $this->uuid->fromString($reply->in_reply_to_id) ->getBytes())
->increment('replies_count');
@ -471,10 +475,12 @@ class PostModel extends UuidModel
$reblogId = $this->insert($reblog);
model('ActorModel', false)
->builder()
->where('id', $actor->id)
->increment('posts_count');
model('PostModel', false)
->builder()
->where('id', $this->uuid->fromString($post->id)->getBytes())
->increment('reblogs_count');
@ -514,10 +520,12 @@ class PostModel extends UuidModel
$this->db->transStart();
model('ActorModel', false)
->builder()
->where('id', $reblogPost->actor_id)
->decrement('posts_count');
model('PostModel', false)
->builder()
->where('id', $this->uuid->fromString($reblogPost->reblog_of_id) ->getBytes())
->decrement('reblogs_count');
@ -592,10 +600,11 @@ class PostModel extends UuidModel
{
helper('fediverse');
$cacheName = config(Fediverse::class)
$cacheName = config('Fediverse')
->cachePrefix . 'blocked_actors';
if (! ($found = cache($cacheName))) {
$result = $this->select('COUNT(*) as total_local_posts')
$result = $this->builder()
->select('COUNT(*) as total_local_posts')
->join('fediverse_actors', 'fediverse_actors.id = fediverse_posts.actor_id')
->where('fediverse_actors.domain', get_current_domain())
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
@ -629,7 +638,8 @@ class PostModel extends UuidModel
public function resetReblogsCount(): int | false
{
$postsReblogsCount = $this->select('fediverse_posts.id, COUNT(*) as `replies_count`')
$postsReblogsCount = $this->builder()
->select('fediverse_posts.id, COUNT(*) as `replies_count`')
->join('fediverse_posts as p2', 'fediverse_posts.id = p2.reblog_of_id')
->groupBy('fediverse_posts.id')
->get()
@ -645,7 +655,8 @@ class PostModel extends UuidModel
public function resetRepliesCount(): int | false
{
$postsRepliesCount = $this->select('fediverse_posts.id, COUNT(*) as `replies_count`')
$postsRepliesCount = $this->builder()
->select('fediverse_posts.id, COUNT(*) as `replies_count`')
->join('fediverse_posts as p2', 'fediverse_posts.id = p2.in_reply_to_id')
->groupBy('fediverse_posts.id')
->get()
@ -661,7 +672,7 @@ class PostModel extends UuidModel
public function clearCache(Post $post): void
{
$cachePrefix = config(Fediverse::class)
$cachePrefix = config('Fediverse')
->cachePrefix;
$hashedPostUri = md5($post->uri);

View file

@ -12,7 +12,6 @@ namespace Modules\Fediverse\Models;
use CodeIgniter\Database\BaseResult;
use CodeIgniter\Model;
use Modules\Fediverse\Config\Fediverse;
use Modules\Fediverse\Entities\PreviewCard;
class PreviewCardModel extends Model
@ -23,7 +22,7 @@ class PreviewCardModel extends Model
protected $table = 'fediverse_preview_cards';
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = [
'id',
@ -58,7 +57,7 @@ class PreviewCardModel extends Model
{
$hashedPreviewCardUrl = md5($url);
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix .
"preview_card-{$hashedPreviewCardUrl}";
if (! ($found = cache($cacheName))) {
@ -74,7 +73,7 @@ class PreviewCardModel extends Model
public function getPostPreviewCard(string $postId): ?PreviewCard
{
$cacheName =
config(Fediverse::class)
config('Fediverse')
->cachePrefix . "post#{$postId}_preview_card";
if (! ($found = cache($cacheName))) {
$found = $this->join(
@ -96,7 +95,7 @@ class PreviewCardModel extends Model
{
$hashedPreviewCardUrl = md5($url);
cache()
->delete(config(Fediverse::class) ->cachePrefix . "preview_card-{$hashedPreviewCardUrl}");
->delete(config('Fediverse') ->cachePrefix . "preview_card-{$hashedPreviewCardUrl}");
return $this->delete($id);
}

View file

@ -68,7 +68,7 @@ class WebFinger
throw new Exception('Could not find actor');
}
$this->aliases = [$actor->id];
$this->aliases = [$actor->uri];
$this->links = [
[
'rel' => 'self',

View file

@ -127,7 +127,6 @@ class CreateSuperadmin extends BaseCommand
unset($passwordRules[$key]);
}
/** @var Auth $config */
$config = config('Auth');
// Add `min_length`

View file

@ -10,7 +10,7 @@ use CodeIgniter\Router\RouteCollection;
// Install Wizard routes
$routes->group(
config(Install::class)
config('Install')
->gateway,
[
'namespace' => 'Modules\Install\Controllers',

View file

@ -17,13 +17,12 @@ use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Shield\Entities\User;
use Config\App;
use CodeIgniter\Shield\Exceptions\ValidationException as ShieldValidationException;
use Config\Database;
use Config\Services;
use Dotenv\Dotenv;
use Dotenv\Exception\ValidationException;
use Modules\Auth\Models\UserModel;
use Modules\Install\Config\Install;
use Psr\Log\LoggerInterface;
use Throwable;
use ViewThemes\Theme;
@ -31,7 +30,7 @@ use ViewThemes\Theme;
class InstallController extends Controller
{
/**
* @var string[]
* @var list<string>
*/
protected $helpers = ['form', 'components', 'svg', 'misc', 'setting'];
@ -160,7 +159,7 @@ class InstallController extends Controller
if (! $this->validate($rules)) {
return redirect()
->to((host_url() ?? config(App::class) ->baseURL) . config(Install::class)->gateway)
->to((host_url() ?? config('App') ->baseURL) . config('Install')->gateway)
->withInput()
->with('errors', $this->validator->getErrors());
}
@ -180,7 +179,7 @@ class InstallController extends Controller
helper('text');
// redirect to full install url with new baseUrl input
return redirect()->to(reduce_double_slashes($baseUrl . '/' . config(Install::class)->gateway));
return redirect()->to(reduce_double_slashes($baseUrl . '/' . config('Install')->gateway));
}
public function databaseConfig(): string
@ -308,7 +307,7 @@ class InstallController extends Controller
$userModel = new UserModel();
try {
$userModel->save($user);
} catch (ValidationException) {
} catch (ShieldValidationException) {
return redirect()->back()
->withInput()
->with('errors', $userModel->errors());

View file

@ -6,7 +6,6 @@ namespace Modules\Media\Config;
use CodeIgniter\Config\BaseService;
use Exception;
use Modules\Media\Config\Media as MediaConfig;
use Modules\Media\FileManagers\FileManagerInterface;
/**
@ -27,7 +26,7 @@ class Services extends BaseService
return self::getSharedInstance('file_manager');
}
$config = config(MediaConfig::class);
$config = config('Media');
$fileManagerClass = $config->fileManagers[$config->fileManager];
$fileManager = new $fileManagerClass($config);

View file

@ -36,7 +36,7 @@ class BaseMedia extends Entity
protected File $file;
/**
* @var string[]
* @var list<string>
*/
protected $dates = ['uploaded_at', 'updated_at'];

View file

@ -32,7 +32,11 @@ class Chapters extends BaseMedia
{
parent::setFile($file);
$metadata = lstat((string) $file) ?? [];
$metadata = lstat((string) $file);
if (! $metadata) {
$metadata = [];
}
helper('filesystem');

View file

@ -12,6 +12,7 @@ namespace Modules\Media\Entities;
use CodeIgniter\Files\File;
use Config\Services;
use GdImage;
/**
* @property array $sizes
@ -137,6 +138,7 @@ class Image extends BaseMedia
->withFile($this->attributes['file']->getRealPath())
->resize($size['width'], $size['height']);
/** @var GdImage $resizedImageResource */
$resizedImageResource = $resizedImage->getResource();
// set resolution to 72 by 72 for all sizes

View file

@ -39,7 +39,11 @@ class Transcript extends BaseMedia
{
parent::setFile($file);
$metadata = lstat((string) $file) ?? [];
$metadata = lstat((string) $file);
if (! $metadata) {
$metadata = [];
}
helper('filesystem');

View file

@ -144,6 +144,6 @@ class FS implements FileManagerInterface
$uri = trim($uri, '/');
return config(MediaConfig::class)->storage . '/' . config(MediaConfig::class)->root . '/' . $uri;
return config('Media')->storage . '/' . config('Media')->root . '/' . $uri;
}
}

View file

@ -3,22 +3,21 @@
declare(strict_types=1);
use CodeIgniter\HTTP\URI;
use Modules\Media\Config\Media;
if (! function_exists('media_url')) {
/**
* Returns a media URL as defined by the Media config.
*
* @param array|string $relativePath URI string or array of URI segments
* @param array<string>|string $relativePath URI string or array of URI segments
*/
function media_url($relativePath = '', ?string $scheme = null): string
function media_url(array|string $relativePath = '', ?string $scheme = null): string
{
// Convert array of segments to a string
if (is_array($relativePath)) {
$relativePath = implode('/', $relativePath);
}
$uri = new URI(rtrim(config(Media::class)->baseURL, '/') . '/' . ltrim($relativePath));
$uri = new URI(rtrim(config('Media')->baseURL, '/') . '/' . ltrim($relativePath));
return URI::createURIString(
$scheme ?? $uri->getScheme(),

View file

@ -48,7 +48,7 @@ class MediaModel extends Model
protected $createdField = 'uploaded_at';
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = [
'id',
@ -66,12 +66,12 @@ class MediaModel extends Model
/**
* clear cache before update if by any chance, the podcast name changes, so will the podcast link
*
* @var string[]
* @var list<string>
*/
protected $beforeUpdate = ['clearCache'];
/**
* @var string[]
* @var list<string>
*/
protected $beforeDelete = ['clearCache'];

View file

@ -156,7 +156,7 @@ class TranscriptParser
case VTT_STATE_TEXT:
if (trim($line) === '') {
$state = VTT_STATE_TIME;
//$subs[] = $sub;
// @phpstan-ignore-next-line
} elseif ($subText !== '') {
$subText .= PHP_EOL . $line;
} else {

View file

@ -9,7 +9,6 @@ use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\Files\File;
use CodeIgniter\I18n\Time;
use Exception;
use Modules\Admin\Config\Admin;
use Modules\MediaClipper\VideoClipper;
class Generate extends BaseCommand
@ -25,7 +24,7 @@ class Generate extends BaseCommand
// get number of running clips to prevent from having too much running in parallel
// TODO: get the number of running ffmpeg processes directly from the machine?
$runningVideoClips = (new ClipModel())->getRunningVideoClipsCount();
if ($runningVideoClips >= config(Admin::class)->videoClipWorkers) {
if ($runningVideoClips >= config('Admin')->videoClipWorkers) {
return;
}

View file

@ -15,7 +15,6 @@ use Exception;
use GdImage;
use Modules\Media\Entities\Transcript;
use Modules\Media\FileManagers\FileManagerInterface;
use Modules\MediaClipper\Config\MediaClipper;
/**
* TODO: refactor this by splitting process modules into different classes (image generation, subtitles clip, video
@ -81,9 +80,9 @@ class VideoClipper
) {
$this->duration = $end - $start;
$this->episodeNumbering = $this->episodeNumbering($this->episode->number, $this->episode->season_number);
$this->dimensions = config(MediaClipper::class)
$this->dimensions = config('MediaClipper')
->formats[$format];
$this->colors = config(MediaClipper::class)
$this->colors = config('MediaClipper')
->themes[$theme];
/** @var FileManagerInterface $fileManager */
@ -239,7 +238,7 @@ class VideoClipper
) . ":text='%{pts\:gmtime\:{$this->start}\:%H\\\\\\\\\\:%M\\\\\\\\\\:%S\}':x={$this->dimensions['timestamp']['x']}:y={$this->dimensions['timestamp']['y']}:fontsize={$this->dimensions['timestamp']['fontsize']}:fontcolor=0x{$this->colors['timestampText']}:box=1:boxcolor=0x{$this->colors['timestampBg']}:boxborderw={$this->dimensions['timestamp']['padding']}[v3]",
"color=c=0x{$this->colors['progressbar']}:s={$this->dimensions['width']}x{$this->dimensions['progressbar']['height']}[progressbar]",
"[v3][progressbar]overlay=-w+(w/{$this->duration})*t:0:shortest=1:format=rgb,subtitles={$this->subtitlesClipOutput}:fontsdir=" . config(
MediaClipper::class
'MediaClipper'
)->fontsFolder . ":force_style='Fontname=" . self::FONTS['subtitles'] . ",Alignment=5,Fontsize={$this->dimensions['subtitles']['fontsize']},PrimaryColour=&H{$this->colors['subtitles']}&,BorderStyle=1,Outline=0,Shadow=0,MarginL={$this->dimensions['subtitles']['marginL']},MarginR={$this->dimensions['subtitles']['marginR']},MarginV={$this->dimensions['subtitles']['marginV']}'[outv]",
"[6:v]scale={$this->dimensions['watermark']['width']}:{$this->dimensions['watermark']['height']}[watermark]",
"color=0x{$this->colors['watermarkBg']}:{$this->dimensions['watermark']['width']}x{$this->dimensions['watermark']['height']}[over]",
@ -248,7 +247,7 @@ class VideoClipper
'[watermarked]scale=w=-1:h=-1:out_color_matrix=bt709[outfinal]',
];
$watermark = config(MediaClipper::class)
$watermark = config('MediaClipper')
->watermark;
$videoClipCmd = [
@ -403,7 +402,7 @@ class VideoClipper
);
// Add quotes for subtitles
$quotes = imagecreatefrompng(config(MediaClipper::class)->quotesImage);
$quotes = imagecreatefrompng(config('MediaClipper')->quotesImage);
if (! $quotes) {
return false;
@ -481,7 +480,7 @@ class VideoClipper
private function getFont(string $name): string
{
return config(MediaClipper::class)->fontsFolder . self::FONTS[$name];
return config('MediaClipper')->fontsFolder . self::FONTS[$name];
}
private function generateBackground(int $width, int $height): ?GdImage

View file

@ -5,15 +5,14 @@ declare(strict_types=1);
namespace Modules\PremiumPodcasts\Config;
use CodeIgniter\Router\RouteCollection;
use Modules\Admin\Config\Admin;
$routes->addPlaceholder('platformType', '\bpodcasting|\bsocial|\bfunding');
/** @var RouteCollection $routes */
$routes->addPlaceholder('platformType', '\bpodcasting|\bsocial|\bfunding');
// Admin routes for subscriptions
$routes->group(
config(Admin::class)
config('Admin')
->gateway,
[
'namespace' => 'Modules\Platforms\Controllers',

View file

@ -73,7 +73,7 @@ class PlatformController extends BaseController
as $platformSlug => $podcastPlatform
) {
$podcastPlatformUrl = trim((string) $podcastPlatform['url']);
if ($podcastPlatformUrl === null) {
if ($podcastPlatformUrl === '') {
continue;
}

View file

@ -28,7 +28,7 @@ class PlatformModel extends Model
protected $primaryKey = 'id';
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = ['podcast_id', 'type', 'slug', 'link_url', 'account_id', 'is_visible'];
@ -127,6 +127,8 @@ class PlatformModel extends Model
}
/**
* @param array<array<string, string|int>> $data
*
* @return int|false Number of rows inserted or FALSE on failure
*/
public function savePlatforms(int $podcastId, string $platformType, array $data): int | false

View file

@ -19,7 +19,6 @@ use CodeIgniter\Shield\Entities\User;
use Config\Services;
use Exception;
use League\HTMLToMarkdown\HtmlConverter;
use Modules\Auth\Config\AuthGroups;
use Modules\Auth\Models\UserModel;
use Modules\Platforms\Models\PlatformModel;
use Modules\PodcastImport\Entities\PodcastImportTask;
@ -266,7 +265,7 @@ class PodcastImport extends BaseCommand
// set current user as podcast admin
// 1. create new group
config(AuthGroups::class)
config('AuthGroups')
->generatePodcastAuthorizations($podcast->id);
add_podcast_group($this->user, $podcast->id, 'admin');
@ -332,23 +331,19 @@ class PodcastImport extends BaseCommand
$personGroup = $person->getAttribute('group');
$personRole = $person->getAttribute('role');
$isTaxonomyFound = false;
// set default group and role if taxonomy is not found
$personGroupSlug = 'cast';
$personRoleSlug = 'host';
if (array_key_exists(strtolower((string) $personGroup), ReversedTaxonomy::$taxonomy)) {
$personGroup = ReversedTaxonomy::$taxonomy[strtolower((string) $personGroup)];
$personGroupSlug = $personGroup['slug'];
if (array_key_exists(strtolower((string) $personRole), $personGroup['roles'])) {
$personRoleSlug = $personGroup['roles'][strtolower((string) $personRole)]['slug'];
$isTaxonomyFound = true;
}
}
if (! $isTaxonomyFound) {
// taxonomy was not found, set default group and role
$personGroupSlug = 'cast';
$personRoleSlug = 'host';
}
$podcastPersonModel = new PersonModel();
if (! $podcastPersonModel->addPodcastPerson(
$this->podcast->id,
@ -410,7 +405,7 @@ class PodcastImport extends BaseCommand
'slug' => $platformSlug,
'link_url' => $platform->getAttribute($platformType['account_url_key']),
'account_id' => $platform->getAttribute($platformType['account_id_key']),
'is_visible' => false,
'is_visible' => 0,
];
}
@ -556,23 +551,19 @@ class PodcastImport extends BaseCommand
$personGroup = $person->getAttribute('group');
$personRole = $person->getAttribute('role');
$isTaxonomyFound = false;
// set default group and role if taxonomy is not found
$personGroupSlug = 'cast';
$personRoleSlug = 'host';
if (array_key_exists(strtolower((string) $personGroup), ReversedTaxonomy::$taxonomy)) {
$personGroup = ReversedTaxonomy::$taxonomy[strtolower((string) $personGroup)];
$personGroupSlug = $personGroup['slug'];
if (array_key_exists(strtolower((string) $personRole), $personGroup['roles'])) {
$personRoleSlug = $personGroup['roles'][strtolower((string) $personRole)]['slug'];
$isTaxonomyFound = true;
}
}
if (! $isTaxonomyFound) {
// taxonomy was not found, set default group and role
$personGroupSlug = 'cast';
$personRoleSlug = 'host';
}
$episodePersonModel = new PersonModel();
if (! $episodePersonModel->addEpisodePerson(
$this->podcast->id,

View file

@ -5,13 +5,12 @@ declare(strict_types=1);
namespace Modules\PodcastImport\Config;
use CodeIgniter\Router\RouteCollection;
use Modules\Admin\Config\Admin;
/** @var RouteCollection $routes */
// Admin routes for imports
$routes->group(
config(Admin::class)
config('Admin')
->gateway,
[
'namespace' => 'Modules\PodcastImport\Controllers',

View file

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

View file

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Modules\PremiumPodcasts\Config;
use CodeIgniter\Router\RouteCollection;
use Modules\Admin\Config\Admin;
/** @var RouteCollection $routes */
@ -13,7 +12,7 @@ $routes->addPlaceholder('podcastHandle', '[a-zA-Z0-9\_]{1,32}');
// Admin routes for subscriptions
$routes->group(
config(Admin::class)
config('Admin')
->gateway,
[
'namespace' => 'Modules\PremiumPodcasts\Controllers',

View file

@ -20,7 +20,7 @@ class Services extends BaseService
$premiumPodcasts = new PremiumPodcasts();
$subscriptionModel ??= model(SubscriptionModel::class);
$subscriptionModel ??= model('SubscriptionModel');
return $premiumPodcasts
->setSubscriptionModel($subscriptionModel);

View file

@ -38,7 +38,7 @@ class Subscription extends Entity
protected ?Podcast $podcast = null;
/**
* @var string[]
* @var list<string>
*/
protected $dates = ['expires_at', 'created_at', 'updated_at'];

View file

@ -28,7 +28,7 @@ class SubscriptionModel extends Model
protected $primaryKey = 'id';
/**
* @var string[]
* @var list<string>
*/
protected $allowedFields = [
'id',
@ -55,17 +55,17 @@ class SubscriptionModel extends Model
protected $useTimestamps = true;
/**
* @var string[]
* @var list<string>
*/
protected $afterInsert = ['clearCache'];
/**
* @var string[]
* @var list<string>
*/
protected $afterUpdate = ['clearCache'];
/**
* @var string[]
* @var list<string>
*/
protected $beforeDelete = ['clearCache'];
@ -131,8 +131,13 @@ class SubscriptionModel extends Model
*/
protected function clearCache(array $data): array
{
/** @var ?Subscription */
$subscription = (new self())->find(is_array($data['id']) ? $data['id'][0] : $data['id']);
if (! $subscription instanceof Subscription) {
return $data;
}
cache()
->delete("subscription#{$subscription->id}");
cache()

View file

@ -9,7 +9,6 @@ use App\Models\PodcastModel;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\HTTP\CURLRequest;
use Exception;
use Modules\WebSub\Config\WebSub;
class Publish extends BaseCommand
{
@ -56,7 +55,7 @@ class Publish extends BaseCommand
],
];
$hubUrls = config(WebSub::class)
$hubUrls = config('WebSub')
->hubs;
foreach ($podcasts as $podcast) {
@ -78,7 +77,7 @@ class Publish extends BaseCommand
// set podcast feed as having been pushed onto hubs
(new PodcastModel())->update($podcast->id, [
'is_published_on_hubs' => true,
'is_published_on_hubs' => 1,
]);
// set newly published episodes as pushed onto hubs

View file

@ -4,6 +4,7 @@ parameters:
checkGenericClassInNonGenericObjectType: false
paths:
- app
- modules
- tests
bootstrapFiles:
- vendor/codeigniter4/framework/system/Test/bootstrap.php
@ -37,12 +38,13 @@ parameters:
- Modules\Fediverse\Models\
- Modules\Media\Models\
- Modules\PremiumPodcasts\Models\
- CodeIgniter\Shield\Models\
additionalServices:
- CodeIgniter\Settings\Config\Services
- CodeIgniter\Shield\Config\Services
- Michalsn\Uuid\Config\Services
- Modules\PremiumPodcasts\Config\Services
- Modules\Media\Config\Services
- Modules\Platforms\Config\Services
- Modules\PremiumPodcasts\Config\Services
ignoreErrors:
- '#^Call to an undefined method CodeIgniter\\Cache\\CacheInterface\:\:deleteMatching\(\)#'

View file

@ -9,7 +9,6 @@ use CodeIgniter\Database\Seeder;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\DatabaseTestTrait;
use CodeIgniter\Test\FeatureTestTrait;
use Modules\Api\Rest\V1\Config\RestApi;
class EpisodeTest extends CIUnitTestCase
{
@ -56,7 +55,7 @@ class EpisodeTest extends CIUnitTestCase
$this->episode['created_at'] = [];
$this->episode['updated_at'] = [];
$this->apiUrl = config(RestApi::class)
$this->apiUrl = config('RestApi')
->gateway;
}

View file

@ -9,7 +9,6 @@ use CodeIgniter\Database\Seeder;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\DatabaseTestTrait;
use CodeIgniter\Test\FeatureTestTrait;
use Modules\Api\Rest\V1\Config\RestApi;
class PodcastTest extends CIUnitTestCase
{
@ -54,7 +53,7 @@ class PodcastTest extends CIUnitTestCase
$this->podcast = FakeSinglePodcastApiSeeder::podcast();
$this->podcast['created_at'] = [];
$this->podcast['updated_at'] = [];
$this->podcastApiUrl = config(RestApi::class)
$this->podcastApiUrl = config('RestApi')
->gateway;
}

View file

@ -1,8 +1,6 @@
<?php declare(strict_types=1);
use Config\Embed;
$embedHeight = config(Embed::class)->height;
$embedHeight = config('Embed')->height;
?>

View file

@ -1,7 +1,5 @@
<?php declare(strict_types=1);
use Modules\MediaClipper\Config\MediaClipper;
?>
<?= $this->extend('_layout') ?>
@ -61,7 +59,7 @@ use Modules\MediaClipper\Config\MediaClipper;
<fieldset>
<legend><?= lang('VideoClip.form.theme') ?></legend>
<div class="grid gap-x-4 gap-y-2 grid-cols-colorButtons">
<?php foreach (config(MediaClipper::class)->themes as $themeName => $colors): ?>
<?php foreach (config('MediaClipper')->themes as $themeName => $colors): ?>
<Forms.ColorRadioButton
class="mx-auto"
value="<?= esc($themeName) ?>"

View file

@ -46,9 +46,12 @@ use Modules\PodcastImport\Entities\TaskStatus;
[
'header' => lang('PodcastImport.queue.feed'),
'cell' => function (PodcastImportTask $importTask) {
$externalLink = icon('external-link-fill', [
'class' => 'ml-1',
]);
return <<<HTML
<div class="flex flex-col">
<a href="{$importTask->feed_url}" class="flex items-center underline hover:no-underline" target="_blank" rel="noopener noreferrer">{$importTask->feed_url}<?= icon('external-link-fill', ['class' => 'ml-1']) ?></a>
<a href="{$importTask->feed_url}" class="flex items-center underline hover:no-underline" target="_blank" rel="noopener noreferrer">{$importTask->feed_url}{$externalLink}</a>
<span class="text-sm text-gray-600">@{$importTask->handle}</span>
</div>
HTML;

View file

@ -1,7 +1,5 @@
<?php declare(strict_types=1);
use Config\App;
?>
<?= $this->extend('_layout') ?>
@ -49,7 +47,7 @@ use Config\App;
accept=".png,.jpeg,.jpg"
class="flex-1"
/>
<?php if (config(App::class)->siteIcon['ico'] !== service('settings')->get('App.siteIcon')['ico']): ?>
<?php if (config('App')->siteIcon['ico'] !== service('settings')->get('App.siteIcon')['ico']): ?>
<div class="relative ml-2">
<a href="<?= route_to('settings-instance-delete-icon') ?>" class="absolute p-1 text-red-700 bg-red-100 border-2 rounded-full hover:text-red-900 border-contrast -top-3 -right-3 focus:ring-accent" title="<?= lang('Settings.instance.site_icon_delete') ?>" data-tooltip="top"><?= icon('delete-bin-fill') ?></a>
<img src="<?= get_site_icon_url('64') ?>" alt="<?= esc(service('settings')->get('App.siteName')) ?> Favicon" class="w-10 h-10 aspect-square" loading="lazy" />

View file

@ -1,7 +1,5 @@
<?php declare(strict_types=1);
use Config\Colors;
?>
<?= $this->extend('_layout') ?>
@ -23,7 +21,7 @@ use Config\Colors;
subtitle="<?= lang('Settings.theme.accent_section_subtitle') ?>">
<div class="grid gap-4 grid-cols-colorButtons">
<?php foreach (config(Colors::class)->themes as $themeName => $color): ?>
<?php foreach (config('Colors')->themes as $themeName => $color): ?>
<Forms.ColorRadioButton
class="theme-<?= $themeName ?> mx-auto"
value="<?= esc($themeName) ?>"

View file

@ -45,11 +45,13 @@
style="--vm-player-box-shadow:0; --vm-player-theme: hsl(var(--color-accent-base)); --vm-control-focus-color: hsl(var(--color-accent-contrast)); --vm-control-spacing: 4px; --vm-menu-item-focus-bg: hsl(var(--color-background-highlight)); --vm-control-icon-size: 24px; <?= str_ends_with($theme, 'transparent') ? '--vm-controls-bg: transparent;' : '' ?>"
>
<vm-audio preload="none">
<?php $source = auth()->loggedIn() ? $episode->audio_url : $episode->audio_url .
(isset($_SERVER['HTTP_REFERER'])
? '?_from=' .
parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)
: '') ?>
<?php
$superglobals = service('superglobals');
$source = auth()->loggedIn() ? $episode->audio_url : $episode->audio_url .
($superglobals->server('HTTP_REFERER') === null
? '?_from=' .
parse_url($superglobals->server('HTTP_REFERER'), PHP_URL_HOST)
: '') ?>
<source src="<?= $source ?>" type="<?= $episode->audio->file_mimetype ?>" />
</vm-audio>
<vm-ui>

View file

@ -1,11 +1,9 @@
<?php declare(strict_types=1);
use Modules\Auth\Config\Auth;
?>
<?= helper('form') ?>
<?= $this->extend(config(Auth::class)->views['layout']) ?>
<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?><?= lang('Auth.email2FATitle') ?> <?= $this->endSection() ?>

View file

@ -1,10 +1,8 @@
<?php declare(strict_types=1);
use Modules\Auth\Config\Auth;
?>
<?= helper('form') ?>
<?= $this->extend(config(Auth::class)->views['layout']) ?>
<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?><?= lang('Auth.emailEnterCode') ?> <?= $this->endSection() ?>

View file

@ -1,10 +1,8 @@
<?php declare(strict_types=1);
use Modules\Auth\Config\Auth;
?>
<?= helper('form') ?>
<?= $this->extend(config(Auth::class)->views['layout']) ?>
<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?><?= lang('Auth.emailActivateTitle') ?><?= $this->endSection() ?>

View file

@ -1,10 +1,8 @@
<?php declare(strict_types=1);
use Modules\Auth\Config\Auth;
?>
<?= helper('form') ?>
<?= $this->extend(config(Auth::class)->views['layout']) ?>
<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?><?= lang('Auth.login') ?><?= $this->endSection() ?>

View file

@ -1,10 +1,8 @@
<?php declare(strict_types=1);
use Modules\Auth\Config\Auth;
?>
<?= helper('form') ?>
<?= $this->extend(config(Auth::class)->views['layout']) ?>
<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?><?= lang('Auth.useMagicLink') ?> <?= $this->endSection() ?>

View file

@ -1,9 +1,7 @@
<?php declare(strict_types=1);
use Modules\Auth\Config\Auth;
?>
<?= $this->extend(config(Auth::class)->views['layout']) ?>
<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?><?= lang('Auth.useMagicLink') ?> <?= $this->endSection() ?>

View file

@ -1,10 +1,8 @@
<?php declare(strict_types=1);
use Modules\Auth\Config\Auth;
?>
<?= helper('form') ?>
<?= $this->extend(config(Auth::class)->views['layout']) ?>
<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?>
<?= lang('Auth.set_password') ?>

View file

@ -1,10 +1,8 @@
<?php declare(strict_types=1);
use Modules\Auth\Config\Auth;
?>
<?= helper('form') ?>
<?= $this->extend(config(Auth::class)->views['layout']) ?>
<?= $this->extend(config('Auth')->views['layout']) ?>
<?= $this->section('title') ?>
<?= lang('Auth.register') ?>

View file

@ -1,7 +1,5 @@
<?php declare(strict_types=1);
use Config\Database;
?>
<?= $this->extend('_layout') ?>
@ -26,27 +24,27 @@ use Config\Database;
<Forms.Field
name="db_hostname"
label="<?= esc(lang('Install.form.db_hostname')) ?>"
value="<?= config(Database::class)->default['hostname'] ?>"
value="<?= config('Database')->default['hostname'] ?>"
required="true"
/>
<Forms.Field
name="db_name"
label="<?= esc(lang('Install.form.db_name')) ?>"
value="<?= config(Database::class)->default['database'] ?>"
value="<?= config('Database')->default['database'] ?>"
required="true" />
<Forms.Field
name="db_username"
label="<?= esc(lang('Install.form.db_username')) ?>"
value="<?= config(Database::class)->default['username'] ?>"
value="<?= config('Database')->default['username'] ?>"
required="true"
autocomplete="off" />
<Forms.Field
name="db_password"
label="<?= esc(lang('Install.form.db_password')) ?>"
value="<?= config(Database::class)->default['password'] ?>"
value="<?= config('Database')->default['password'] ?>"
type="password"
required="true"
autocomplete="off" />
@ -55,7 +53,7 @@ use Config\Database;
name="db_prefix"
label="<?= esc(lang('Install.form.db_prefix')) ?>"
hint="<?= esc(lang('Install.form.db_prefix_hint')) ?>"
value="<?= config(Database::class)->default['DBPrefix'] ?>" />
value="<?= config('Database')->default['DBPrefix'] ?>" />
<?php // @icon('arrow-right-fill')?>
<Button variant="primary" type="submit" class="self-end" iconRight="arrow-right-fill"><?= lang('Install.form.next') ?></Button>

View file

@ -1,16 +1,11 @@
<?php declare(strict_types=1);
use Config\App;
use Modules\Admin\Config\Admin;
use Modules\Auth\Config\Auth;
use Modules\Install\Config\Install;
?>
<?= $this->extend('_layout') ?>
<?= $this->section('content') ?>
<form action="<?= '/' . config(Install::class)->gateway . '/instance-config' ?>" class="flex flex-col w-full max-w-sm gap-y-4" method="post" accept-charset="utf-8">
<form action="<?= '/' . config('Install')->gateway . '/instance-config' ?>" class="flex flex-col w-full max-w-sm gap-y-4" method="post" accept-charset="utf-8">
<?= csrf_field() ?>
<div class="flex items-center mb-2">
@ -21,7 +16,7 @@ use Modules\Install\Config\Install;
<Forms.Field
name="hostname"
label="<?= esc(lang('Install.form.hostname')) ?>"
value="<?= host_url() === null ? config(App::class)->baseURL : host_url() ?>"
value="<?= host_url() === null ? config('App')->baseURL : host_url() ?>"
required="true" />
<Forms.Field
@ -33,14 +28,14 @@ use Modules\Install\Config\Install;
name="admin_gateway"
label="<?= esc(lang('Install.form.admin_gateway')) ?>"
hint="<?= esc(lang('Install.form.admin_gateway_hint')) ?>"
value="<?= config(Admin::class)->gateway ?>"
value="<?= config('Admin')->gateway ?>"
required="true" />
<Forms.Field
name="auth_gateway"
label="<?= esc(lang('Install.form.auth_gateway')) ?>"
hint="<?= esc(lang('Install.form.auth_gateway_hint')) ?>"
value="<?= config(Auth::class)->gateway ?>"
value="<?= config('Auth')->gateway ?>"
required="true" />
<?php // @icon('arrow-right-fill')?>
<Button class="self-end" variant="primary" type="submit" iconRight="arrow-right-fill"><?= lang('Install.form.next') ?></Button>