mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-06 18:31:05 +00:00
refactor: use Validation::getValidated() when using $this->validate() in controllers
This commit is contained in:
parent
ff0e681763
commit
2c07070b2c
@ -125,7 +125,9 @@ class PostController extends FediversePostController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $this->request->getPost('message');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
$message = $validData['message'];
|
||||||
|
|
||||||
$newPost = new CastopodPost([
|
$newPost = new CastopodPost([
|
||||||
'actor_id' => interact_as_actor_id(),
|
'actor_id' => interact_as_actor_id(),
|
||||||
@ -134,7 +136,7 @@ class PostController extends FediversePostController
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// get episode if episodeUrl has been set
|
// get episode if episodeUrl has been set
|
||||||
$episodeUri = $this->request->getPost('episode_url');
|
$episodeUri = $validData['episode_url'];
|
||||||
if (
|
if (
|
||||||
$episodeUri &&
|
$episodeUri &&
|
||||||
($params = extract_params_from_episode_uri(new URI($episodeUri))) &&
|
($params = extract_params_from_episode_uri(new URI($episodeUri))) &&
|
||||||
@ -173,10 +175,12 @@ class PostController extends FediversePostController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$newPost = new CastopodPost([
|
$newPost = new CastopodPost([
|
||||||
'actor_id' => interact_as_actor_id(),
|
'actor_id' => interact_as_actor_id(),
|
||||||
'in_reply_to_id' => $this->post->id,
|
'in_reply_to_id' => $this->post->id,
|
||||||
'message' => $this->request->getPost('message'),
|
'message' => $validData['message'],
|
||||||
'published_at' => Time::now(),
|
'published_at' => Time::now(),
|
||||||
'created_by' => user_id(),
|
'created_by' => user_id(),
|
||||||
]);
|
]);
|
||||||
@ -224,7 +228,9 @@ class PostController extends FediversePostController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = $this->request->getPost('action');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
$action = $validData['action'];
|
||||||
return match ($action) {
|
return match ($action) {
|
||||||
'favourite' => $this->attemptFavourite(),
|
'favourite' => $this->attemptFavourite(),
|
||||||
'reblog' => $this->attemptReblog(),
|
'reblog' => $this->attemptReblog(),
|
||||||
|
@ -175,9 +175,11 @@ class EpisodeController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
if ((new EpisodeModel())
|
if ((new EpisodeModel())
|
||||||
->where([
|
->where([
|
||||||
'slug' => $this->request->getPost('slug'),
|
'slug' => $validData['slug'],
|
||||||
'podcast_id' => $this->podcast->id,
|
'podcast_id' => $this->podcast->id,
|
||||||
])
|
])
|
||||||
->first()) {
|
->first()) {
|
||||||
@ -310,8 +312,10 @@ class EpisodeController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$this->episode->title = $this->request->getPost('title');
|
$this->episode->title = $this->request->getPost('title');
|
||||||
$this->episode->slug = $this->request->getPost('slug');
|
$this->episode->slug = $validData['slug'];
|
||||||
$this->episode->description_markdown = $this->request->getPost('description');
|
$this->episode->description_markdown = $this->request->getPost('description');
|
||||||
$this->episode->location = $this->request->getPost('location_name') === '' ? null : new Location(
|
$this->episode->location = $this->request->getPost('location_name') === '' ? null : new Location(
|
||||||
$this->request->getPost('location_name')
|
$this->request->getPost('location_name')
|
||||||
@ -745,7 +749,9 @@ class EpisodeController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$newPublicationDate = $this->request->getPost('new_publication_date');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
$newPublicationDate = $validData['new_publication_date'];
|
||||||
|
|
||||||
$newPublicationDate = Time::createFromFormat(
|
$newPublicationDate = Time::createFromFormat(
|
||||||
'Y-m-d H:i',
|
'Y-m-d H:i',
|
||||||
@ -994,12 +1000,12 @@ class EpisodeController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $this->request->getPost('message');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$newComment = new EpisodeComment([
|
$newComment = new EpisodeComment([
|
||||||
'actor_id' => interact_as_actor_id(),
|
'actor_id' => interact_as_actor_id(),
|
||||||
'episode_id' => $this->episode->id,
|
'episode_id' => $this->episode->id,
|
||||||
'message' => $message,
|
'message' => $validData['message'],
|
||||||
'created_at' => new Time('now'),
|
'created_at' => new Time('now'),
|
||||||
'created_by' => user_id(),
|
'created_by' => user_id(),
|
||||||
]);
|
]);
|
||||||
@ -1031,12 +1037,12 @@ class EpisodeController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $this->request->getPost('message');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$newReply = new EpisodeComment([
|
$newReply = new EpisodeComment([
|
||||||
'actor_id' => interact_as_actor_id(),
|
'actor_id' => interact_as_actor_id(),
|
||||||
'episode_id' => $this->episode->id,
|
'episode_id' => $this->episode->id,
|
||||||
'message' => $message,
|
'message' => $validData['message'],
|
||||||
'in_reply_to_id' => $commentId,
|
'in_reply_to_id' => $commentId,
|
||||||
'created_at' => new Time('now'),
|
'created_at' => new Time('now'),
|
||||||
'created_by' => user_id(),
|
'created_by' => user_id(),
|
||||||
|
@ -78,10 +78,12 @@ class EpisodePersonController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
(new PersonModel())->addEpisodePersons(
|
(new PersonModel())->addEpisodePersons(
|
||||||
$this->podcast->id,
|
$this->podcast->id,
|
||||||
$this->episode->id,
|
$this->episode->id,
|
||||||
$this->request->getPost('persons'),
|
$validData['persons'],
|
||||||
$this->request->getPost('roles') ?? [],
|
$this->request->getPost('roles') ?? [],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -650,12 +650,14 @@ class PodcastController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$db->transStart();
|
$db->transStart();
|
||||||
|
|
||||||
$publishMethod = $this->request->getPost('publication_method');
|
$publishMethod = $validData['publication_method'];
|
||||||
if ($publishMethod === 'schedule') {
|
if ($publishMethod === 'schedule') {
|
||||||
$scheduledPublicationDate = $this->request->getPost('scheduled_publication_date');
|
$scheduledPublicationDate = $validData['scheduled_publication_date'];
|
||||||
if ($scheduledPublicationDate) {
|
if ($scheduledPublicationDate) {
|
||||||
$this->podcast->published_at = Time::createFromFormat(
|
$this->podcast->published_at = Time::createFromFormat(
|
||||||
'Y-m-d H:i',
|
'Y-m-d H:i',
|
||||||
@ -783,12 +785,14 @@ class PodcastController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$db->transStart();
|
$db->transStart();
|
||||||
|
|
||||||
$publishMethod = $this->request->getPost('publication_method');
|
$publishMethod = $validData['publication_method'];
|
||||||
if ($publishMethod === 'schedule') {
|
if ($publishMethod === 'schedule') {
|
||||||
$scheduledPublicationDate = $this->request->getPost('scheduled_publication_date');
|
$scheduledPublicationDate = $validData['scheduled_publication_date'];
|
||||||
if ($scheduledPublicationDate) {
|
if ($scheduledPublicationDate) {
|
||||||
$this->podcast->published_at = Time::createFromFormat(
|
$this->podcast->published_at = Time::createFromFormat(
|
||||||
'Y-m-d H:i',
|
'Y-m-d H:i',
|
||||||
|
@ -65,9 +65,11 @@ class PodcastPersonController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
(new PersonModel())->addPodcastPersons(
|
(new PersonModel())->addPodcastPersons(
|
||||||
$this->podcast->id,
|
$this->podcast->id,
|
||||||
$this->request->getPost('persons'),
|
$validData['persons'],
|
||||||
$this->request->getPost('roles') ?? [],
|
$this->request->getPost('roles') ?? [],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -114,10 +114,12 @@ class SoundbiteController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$newSoundbite = new Soundbite([
|
$newSoundbite = new Soundbite([
|
||||||
'title' => $this->request->getPost('title'),
|
'title' => $validData['title'],
|
||||||
'start_time' => (float) $this->request->getPost('start_time'),
|
'start_time' => (float) $validData['start_time'],
|
||||||
'duration' => (float) $this->request->getPost('duration'),
|
'duration' => (float) $validData['duration'],
|
||||||
'type' => 'audio',
|
'type' => 'audio',
|
||||||
'status' => '',
|
'status' => '',
|
||||||
'podcast_id' => $this->podcast->id,
|
'podcast_id' => $this->podcast->id,
|
||||||
|
@ -157,7 +157,9 @@ class VideoClipsController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$themeName = $this->request->getPost('theme');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
$themeName = $validData['theme'];
|
||||||
$themeColors = config(MediaClipper::class)
|
$themeColors = config(MediaClipper::class)
|
||||||
->themes[$themeName];
|
->themes[$themeName];
|
||||||
$theme = [
|
$theme = [
|
||||||
@ -166,11 +168,11 @@ class VideoClipsController extends BaseController
|
|||||||
];
|
];
|
||||||
|
|
||||||
$videoClip = new VideoClip([
|
$videoClip = new VideoClip([
|
||||||
'title' => $this->request->getPost('title'),
|
'title' => $validData['title'],
|
||||||
'start_time' => (float) $this->request->getPost('start_time'),
|
'start_time' => (float) $validData['start_time'],
|
||||||
'duration' => (float) $this->request->getPost('duration'),
|
'duration' => (float) $validData['duration'],
|
||||||
'theme' => $theme,
|
'theme' => $theme,
|
||||||
'format' => $this->request->getPost('format'),
|
'format' => $validData['format'],
|
||||||
'type' => 'video',
|
'type' => 'video',
|
||||||
'status' => 'queued',
|
'status' => 'queued',
|
||||||
'podcast_id' => $this->podcast->id,
|
'podcast_id' => $this->podcast->id,
|
||||||
|
@ -27,9 +27,11 @@ class InteractController extends Controller
|
|||||||
->with('errors', service('validation')->getErrors());
|
->with('errors', service('validation')->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
helper('auth');
|
helper('auth');
|
||||||
|
|
||||||
set_interact_as_actor((int) $this->request->getPost('actor_id'));
|
set_interact_as_actor((int) $validData['actor_id']);
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,12 @@ class MagicLinkController extends ShieldMagicLinkController
|
|||||||
->with('errors', $userModel->errors());
|
->with('errors', $userModel->errors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
// set new password to user
|
// set new password to user
|
||||||
auth()
|
auth()
|
||||||
->user()
|
->user()
|
||||||
->password = $this->request->getPost('new_password');
|
->password = $validData['new_password'];
|
||||||
|
|
||||||
if (! $userModel->update(auth()->user()->id, auth()->user())) {
|
if (! $userModel->update(auth()->user()->id, auth()->user())) {
|
||||||
return redirect()
|
return redirect()
|
||||||
|
@ -43,12 +43,14 @@ class MyAccountController extends BaseController
|
|||||||
->with('errors', $userModel->errors());
|
->with('errors', $userModel->errors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
// check credentials with the old password if logged in without magic link
|
// check credentials with the old password if logged in without magic link
|
||||||
$credentials = [
|
$credentials = [
|
||||||
'email' => auth()
|
'email' => auth()
|
||||||
->user()
|
->user()
|
||||||
->email,
|
->email,
|
||||||
'password' => $this->request->getPost('password'),
|
'password' => $validData['password'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$validCreds = auth()
|
$validCreds = auth()
|
||||||
@ -62,7 +64,7 @@ class MyAccountController extends BaseController
|
|||||||
// set new password to user
|
// set new password to user
|
||||||
auth()
|
auth()
|
||||||
->user()
|
->user()
|
||||||
->password = $this->request->getPost('new_password');
|
->password = $validData['new_password'];
|
||||||
|
|
||||||
if (! $userModel->update(auth()->user()->id, auth()->user())) {
|
if (! $userModel->update(auth()->user()->id, auth()->user())) {
|
||||||
return redirect()
|
return redirect()
|
||||||
|
@ -334,13 +334,15 @@ class ActorController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
helper('text');
|
helper('text');
|
||||||
|
|
||||||
// get webfinger data from actor
|
// get webfinger data from actor
|
||||||
// parse actor id to get actor and domain
|
// parse actor id to get actor and domain
|
||||||
// check if actor and domain exist
|
// check if actor and domain exist
|
||||||
|
|
||||||
$handle = $this->request->getPost('handle');
|
$handle = $validData['handle'];
|
||||||
$parts = split_handle($handle);
|
$parts = split_handle($handle);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -34,7 +34,9 @@ class BlockController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle = $this->request->getPost('handle');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
$handle = $validData['handle'];
|
||||||
|
|
||||||
if ($parts = split_handle($handle)) {
|
if ($parts = split_handle($handle)) {
|
||||||
try {
|
try {
|
||||||
@ -69,8 +71,10 @@ class BlockController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
model('ActorModel', false)
|
model('ActorModel', false)
|
||||||
->unblockActor((int) $this->request->getPost('actor_id'));
|
->unblockActor((int) $validData['actor_id']);
|
||||||
|
|
||||||
return redirect()->back()
|
return redirect()->back()
|
||||||
->with('message', lang('Fediverse.messages.unblockActorSuccess'));
|
->with('message', lang('Fediverse.messages.unblockActorSuccess'));
|
||||||
@ -89,7 +93,9 @@ class BlockController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$domain = $this->request->getPost('domain');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
$domain = $validData['domain'];
|
||||||
model('BlockedDomainModel', false)
|
model('BlockedDomainModel', false)
|
||||||
->blockDomain($domain);
|
->blockDomain($domain);
|
||||||
|
|
||||||
@ -112,7 +118,9 @@ class BlockController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$domain = $this->request->getPost('domain');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
$domain = $validData['domain'];
|
||||||
model('BlockedDomainModel', false)
|
model('BlockedDomainModel', false)
|
||||||
->unblockDomain($domain);
|
->unblockDomain($domain);
|
||||||
|
|
||||||
|
@ -123,9 +123,11 @@ class PostController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$newPost = new Post([
|
$newPost = new Post([
|
||||||
'actor_id' => $this->request->getPost('actor_id'),
|
'actor_id' => $validData['actor_id'],
|
||||||
'message' => $this->request->getPost('message'),
|
'message' => $validData['message'],
|
||||||
'published_at' => Time::now(),
|
'published_at' => Time::now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -155,8 +157,10 @@ class PostController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$actor = model('ActorModel', false)
|
$actor = model('ActorModel', false)
|
||||||
->getActorById($this->request->getPost('actor_id'));
|
->getActorById($validData['actor_id']);
|
||||||
|
|
||||||
model('FavouriteModel', false)
|
model('FavouriteModel', false)
|
||||||
->toggleFavourite($actor, $this->post->id);
|
->toggleFavourite($actor, $this->post->id);
|
||||||
@ -177,8 +181,10 @@ class PostController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$actor = model('ActorModel', false)
|
$actor = model('ActorModel', false)
|
||||||
->getActorById($this->request->getPost('actor_id'));
|
->getActorById($validData['actor_id']);
|
||||||
|
|
||||||
model('PostModel', false)
|
model('PostModel', false)
|
||||||
->toggleReblog($actor, $this->post);
|
->toggleReblog($actor, $this->post);
|
||||||
@ -200,10 +206,12 @@ class PostController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
$newReplyPost = new Post([
|
$newReplyPost = new Post([
|
||||||
'actor_id' => $this->request->getPost('actor_id'),
|
'actor_id' => $validData['actor_id'],
|
||||||
'in_reply_to_id' => $this->post->id,
|
'in_reply_to_id' => $this->post->id,
|
||||||
'message' => $this->request->getPost('message'),
|
'message' => $validData['message'],
|
||||||
'published_at' => Time::now(),
|
'published_at' => Time::now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -232,13 +240,15 @@ class PostController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
helper('text');
|
helper('text');
|
||||||
|
|
||||||
// get webfinger data from actor
|
// get webfinger data from actor
|
||||||
// parse actor id to get actor and domain
|
// parse actor id to get actor and domain
|
||||||
// check if actor and domain exist
|
// check if actor and domain exist
|
||||||
if (
|
if (
|
||||||
! ($parts = split_handle($this->request->getPost('handle'))) ||
|
! ($parts = split_handle($validData['handle'])) ||
|
||||||
! ($data = get_webfinger_data($parts['username'], $parts['domain']))
|
! ($data = get_webfinger_data($parts['username'], $parts['domain']))
|
||||||
) {
|
) {
|
||||||
return redirect()
|
return redirect()
|
||||||
|
@ -167,14 +167,16 @@ class InstallController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseUrl = $this->request->getPost('hostname');
|
$validData = $this->validator->getValidated();
|
||||||
$mediaBaseUrl = $this->request->getPost('media_base_url');
|
|
||||||
|
$baseUrl = $validData['hostname'];
|
||||||
|
$mediaBaseUrl = $validData['media_base_url'];
|
||||||
self::writeEnv([
|
self::writeEnv([
|
||||||
'app.baseURL' => $baseUrl,
|
'app.baseURL' => $baseUrl,
|
||||||
'media.baseURL' => $mediaBaseUrl === '' ? $baseUrl : $mediaBaseUrl,
|
'media.baseURL' => $mediaBaseUrl === '' ? $baseUrl : $mediaBaseUrl,
|
||||||
'analytics.salt' => generate_random_salt(64),
|
'analytics.salt' => generate_random_salt(64),
|
||||||
'admin.gateway' => $this->request->getPost('admin_gateway'),
|
'admin.gateway' => $validData['admin_gateway'],
|
||||||
'auth.gateway' => $this->request->getPost('auth_gateway'),
|
'auth.gateway' => $validData['auth_gateway'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
helper('text');
|
helper('text');
|
||||||
@ -204,11 +206,13 @@ class InstallController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
self::writeEnv([
|
self::writeEnv([
|
||||||
'database.default.hostname' => $this->request->getPost('db_hostname'),
|
'database.default.hostname' => $validData['db_hostname'],
|
||||||
'database.default.database' => $this->request->getPost('db_name'),
|
'database.default.database' => $validData['db_name'],
|
||||||
'database.default.username' => $this->request->getPost('db_username'),
|
'database.default.username' => $validData['db_username'],
|
||||||
'database.default.password' => $this->request->getPost('db_password'),
|
'database.default.password' => $validData['db_password'],
|
||||||
'database.default.DBPrefix' => $this->request->getPost('db_prefix'),
|
'database.default.DBPrefix' => $this->request->getPost('db_prefix'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -233,8 +237,10 @@ class InstallController extends Controller
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
self::writeEnv([
|
self::writeEnv([
|
||||||
'cache.handler' => $this->request->getPost('cache_handler'),
|
'cache.handler' => $validData['cache_handler'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
@ -279,6 +285,8 @@ class InstallController extends Controller
|
|||||||
{
|
{
|
||||||
// validate user password
|
// validate user password
|
||||||
$rules = [
|
$rules = [
|
||||||
|
'username' => 'required',
|
||||||
|
'email' => 'required',
|
||||||
'password' => 'required|strong_password',
|
'password' => 'required|strong_password',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -290,11 +298,13 @@ class InstallController extends Controller
|
|||||||
->with('errors', $userModel->errors());
|
->with('errors', $userModel->errors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
// Save the user
|
// Save the user
|
||||||
$user = new User([
|
$user = new User([
|
||||||
'username' => $this->request->getPost('username'),
|
'username' => $validData['username'],
|
||||||
'email' => $this->request->getPost('email'),
|
'email' => $validData['email'],
|
||||||
'password' => $this->request->getPost('password'),
|
'password' => $validData['password'],
|
||||||
'is_owner' => true,
|
'is_owner' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ class PodcastImportController extends BaseController
|
|||||||
$rules = [
|
$rules = [
|
||||||
'handle' => 'required|regex_match[/^[a-zA-Z0-9\_]{1,32}$/]',
|
'handle' => 'required|regex_match[/^[a-zA-Z0-9\_]{1,32}$/]',
|
||||||
'imported_feed_url' => 'required|valid_url_strict',
|
'imported_feed_url' => 'required|valid_url_strict',
|
||||||
'max_episodes' => 'is_natural_no_zero|permit_empty',
|
'language' => 'required',
|
||||||
|
'category' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (! $this->validate($rules)) {
|
if (! $this->validate($rules)) {
|
||||||
@ -81,13 +82,15 @@ class PodcastImportController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
// TODO: check that handle is not already in use
|
// TODO: check that handle is not already in use
|
||||||
|
|
||||||
$importTask = new PodcastImportTask([
|
$importTask = new PodcastImportTask([
|
||||||
'handle' => $this->request->getPost('handle'),
|
'handle' => $validData['handle'],
|
||||||
'feed_url' => $this->request->getPost('imported_feed_url'),
|
'feed_url' => $validData['imported_feed_url'],
|
||||||
'language' => $this->request->getPost('language'),
|
'language' => $validData['language'],
|
||||||
'category' => $this->request->getPost('category'),
|
'category' => $validData['category'],
|
||||||
'status' => TaskStatus::Queued,
|
'status' => TaskStatus::Queued,
|
||||||
'created_by' => user_id(),
|
'created_by' => user_id(),
|
||||||
'updated_by' => user_id(),
|
'updated_by' => user_id(),
|
||||||
|
@ -70,7 +70,9 @@ class LockController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
$token = (string) $this->request->getPost('token');
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
$token = $validData['token'];
|
||||||
|
|
||||||
// attempt unlocking the podcast with the token
|
// attempt unlocking the podcast with the token
|
||||||
if (! $this->premiumPodcasts->unlock($this->podcast->handle, $token)) {
|
if (! $this->premiumPodcasts->unlock($this->podcast->handle, $token)) {
|
||||||
@ -83,7 +85,8 @@ class LockController extends BaseController
|
|||||||
$redirectURL = session('redirect_url') ?? site_url('/');
|
$redirectURL = session('redirect_url') ?? site_url('/');
|
||||||
unset($_SESSION['redirect_url']);
|
unset($_SESSION['redirect_url']);
|
||||||
|
|
||||||
return redirect()->to($redirectURL)
|
return redirect()
|
||||||
|
->to($redirectURL)
|
||||||
->withCookies()
|
->withCookies()
|
||||||
->with('message', lang('PremiumPodcasts.messages.unlockSuccess'));
|
->with('message', lang('PremiumPodcasts.messages.unlockSuccess'));
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,9 @@ class SubscriptionController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($subscriptionLink = $this->request->getPost('subscription_link')) === '') {
|
$validData = $this->validator->getValidated();
|
||||||
|
|
||||||
|
if (($subscriptionLink = $validData['subscription_link']) === '') {
|
||||||
service('settings')
|
service('settings')
|
||||||
->forget('Subscription.link', 'podcast:' . $this->podcast->id);
|
->forget('Subscription.link', 'podcast:' . $this->podcast->id);
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
x
Reference in New Issue
Block a user