mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-04 08:22:02 +00:00
fix(types): update fake seeders types + fix bugs
This commit is contained in:
parent
c72f4be6d8
commit
76a4bf3441
@ -107,9 +107,9 @@ class ContributorController extends BaseController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
(new PodcastModel())->addPodcastContributor(
|
(new PodcastModel())->addPodcastContributor(
|
||||||
$this->request->getPost('user'),
|
(int) $this->request->getPost('user'),
|
||||||
$this->podcast->id,
|
$this->podcast->id,
|
||||||
$this->request->getPost('role'),
|
(int) $this->request->getPost('role'),
|
||||||
);
|
);
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
return redirect()
|
return redirect()
|
||||||
@ -157,7 +157,7 @@ class ContributorController extends BaseController
|
|||||||
(new PodcastModel())->updatePodcastContributor(
|
(new PodcastModel())->updatePodcastContributor(
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
$this->podcast->id,
|
$this->podcast->id,
|
||||||
$this->request->getPost('role'),
|
(int) $this->request->getPost('role'),
|
||||||
);
|
);
|
||||||
|
|
||||||
return redirect()->route('contributor-list', [$this->podcast->id]);
|
return redirect()->route('contributor-list', [$this->podcast->id]);
|
||||||
|
@ -661,8 +661,8 @@ class EpisodeController extends BaseController
|
|||||||
$data = [
|
$data = [
|
||||||
'podcast_id' => $this->podcast->id,
|
'podcast_id' => $this->podcast->id,
|
||||||
'episode_id' => $this->episode->id,
|
'episode_id' => $this->episode->id,
|
||||||
'start_time' => (int) $soundbite['start_time'],
|
'start_time' => (float) $soundbite['start_time'],
|
||||||
'duration' => (int) $soundbite['duration'],
|
'duration' => (float) $soundbite['duration'],
|
||||||
'label' => $soundbite['label'],
|
'label' => $soundbite['label'],
|
||||||
'updated_by' => user_id(),
|
'updated_by' => user_id(),
|
||||||
];
|
];
|
||||||
@ -688,9 +688,9 @@ class EpisodeController extends BaseController
|
|||||||
return redirect()->route('soundbites-edit', [$this->podcast->id, $this->episode->id]);
|
return redirect()->route('soundbites-edit', [$this->podcast->id, $this->episode->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function soundbiteDelete(int $soundbiteId): RedirectResponse
|
public function soundbiteDelete(string $soundbiteId): RedirectResponse
|
||||||
{
|
{
|
||||||
(new SoundbiteModel())->deleteSoundbite($this->podcast->id, $this->episode->id, $soundbiteId);
|
(new SoundbiteModel())->deleteSoundbite($this->podcast->id, $this->episode->id, (int) $soundbiteId);
|
||||||
|
|
||||||
return redirect()->route('soundbites-edit', [$this->podcast->id, $this->episode->id]);
|
return redirect()->route('soundbites-edit', [$this->podcast->id, $this->episode->id]);
|
||||||
}
|
}
|
||||||
|
@ -88,9 +88,9 @@ class EpisodePersonController extends BaseController
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove(int $personId): RedirectResponse
|
public function remove(string $personId): RedirectResponse
|
||||||
{
|
{
|
||||||
(new PersonModel())->removePersonFromEpisode($this->podcast->id, $this->episode->id, $personId);
|
(new PersonModel())->removePersonFromEpisode($this->podcast->id, $this->episode->id, (int) $personId);
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
@ -182,6 +182,15 @@ class PodcastController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
($partnerId = $this->request->getPost('partner_id')) === '' ||
|
||||||
|
($partnerLinkUrl = $this->request->getPost('partner_link_url')) === '' ||
|
||||||
|
($partnerImageUrl = $this->request->getPost('partner_image_url')) === '') {
|
||||||
|
$partnerId = null;
|
||||||
|
$partnerLinkUrl = null;
|
||||||
|
$partnerImageUrl = null;
|
||||||
|
}
|
||||||
|
|
||||||
$podcast = new Podcast([
|
$podcast = new Podcast([
|
||||||
'title' => $this->request->getPost('title'),
|
'title' => $this->request->getPost('title'),
|
||||||
'name' => $this->request->getPost('name'),
|
'name' => $this->request->getPost('name'),
|
||||||
@ -199,11 +208,13 @@ class PodcastController extends BaseController
|
|||||||
'type' => $this->request->getPost('type'),
|
'type' => $this->request->getPost('type'),
|
||||||
'copyright' => $this->request->getPost('copyright'),
|
'copyright' => $this->request->getPost('copyright'),
|
||||||
'location' => new Location($this->request->getPost('location_name'),),
|
'location' => new Location($this->request->getPost('location_name'),),
|
||||||
'payment_pointer' => $this->request->getPost('payment_pointer'),
|
'payment_pointer' => $this->request->getPost(
|
||||||
|
'payment_pointer'
|
||||||
|
) === '' ? null : $this->request->getPost('payment_pointer'),
|
||||||
'custom_rss_string' => $this->request->getPost('custom_rss'),
|
'custom_rss_string' => $this->request->getPost('custom_rss'),
|
||||||
'partner_id' => $this->request->getPost('partner_id'),
|
'partner_id' => $partnerId,
|
||||||
'partner_link_url' => $this->request->getPost('partner_link_url'),
|
'partner_link_url' => $partnerLinkUrl,
|
||||||
'partner_image_url' => $this->request->getPost('partner_image_url'),
|
'partner_image_url' => $partnerImageUrl,
|
||||||
'is_blocked' => $this->request->getPost('block') === 'yes',
|
'is_blocked' => $this->request->getPost('block') === 'yes',
|
||||||
'is_completed' => $this->request->getPost('complete') === 'yes',
|
'is_completed' => $this->request->getPost('complete') === 'yes',
|
||||||
'is_locked' => $this->request->getPost('lock') === 'yes',
|
'is_locked' => $this->request->getPost('lock') === 'yes',
|
||||||
@ -227,7 +238,7 @@ class PodcastController extends BaseController
|
|||||||
$authorize = Services::authorization();
|
$authorize = Services::authorization();
|
||||||
$podcastAdminGroup = $authorize->group('podcast_admin');
|
$podcastAdminGroup = $authorize->group('podcast_admin');
|
||||||
|
|
||||||
$podcastModel->addPodcastContributor(user_id(), $newPodcastId, $podcastAdminGroup->id);
|
$podcastModel->addPodcastContributor(user_id(), $newPodcastId, (int) $podcastAdminGroup->id);
|
||||||
|
|
||||||
// set Podcast categories
|
// set Podcast categories
|
||||||
(new CategoryModel())->setPodcastCategories(
|
(new CategoryModel())->setPodcastCategories(
|
||||||
@ -277,6 +288,15 @@ class PodcastController extends BaseController
|
|||||||
->with('errors', $this->validator->getErrors());
|
->with('errors', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
($partnerId = $this->request->getPost('partner_id')) === '' ||
|
||||||
|
($partnerLinkUrl = $this->request->getPost('partner_link_url')) === '' ||
|
||||||
|
($partnerImageUrl = $this->request->getPost('partner_image_url')) === '') {
|
||||||
|
$partnerId = null;
|
||||||
|
$partnerLinkUrl = null;
|
||||||
|
$partnerImageUrl = null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->podcast->title = $this->request->getPost('title');
|
$this->podcast->title = $this->request->getPost('title');
|
||||||
$this->podcast->description_markdown = $this->request->getPost('description');
|
$this->podcast->description_markdown = $this->request->getPost('description');
|
||||||
|
|
||||||
@ -296,11 +316,13 @@ class PodcastController extends BaseController
|
|||||||
$this->podcast->type = $this->request->getPost('type');
|
$this->podcast->type = $this->request->getPost('type');
|
||||||
$this->podcast->copyright = $this->request->getPost('copyright');
|
$this->podcast->copyright = $this->request->getPost('copyright');
|
||||||
$this->podcast->location = new Location($this->request->getPost('location_name'));
|
$this->podcast->location = new Location($this->request->getPost('location_name'));
|
||||||
$this->podcast->payment_pointer = $this->request->getPost('payment_pointer');
|
$this->podcast->payment_pointer = $this->request->getPost(
|
||||||
|
'payment_pointer'
|
||||||
|
) === '' ? null : $this->request->getPost('payment_pointer');
|
||||||
$this->podcast->custom_rss_string = $this->request->getPost('custom_rss');
|
$this->podcast->custom_rss_string = $this->request->getPost('custom_rss');
|
||||||
$this->podcast->partner_id = $this->request->getPost('partner_id');
|
$this->podcast->partner_id = $partnerId;
|
||||||
$this->podcast->partner_link_url = $this->request->getPost('partner_link_url');
|
$this->podcast->partner_link_url = $partnerLinkUrl;
|
||||||
$this->podcast->partner_image_url = $this->request->getPost('partner_image_url');
|
$this->podcast->partner_image_url = $partnerImageUrl;
|
||||||
$this->podcast->is_blocked = $this->request->getPost('block') === 'yes';
|
$this->podcast->is_blocked = $this->request->getPost('block') === 'yes';
|
||||||
$this->podcast->is_completed =
|
$this->podcast->is_completed =
|
||||||
$this->request->getPost('complete') === 'yes';
|
$this->request->getPost('complete') === 'yes';
|
||||||
|
@ -197,7 +197,7 @@ class PodcastImportController extends BaseController
|
|||||||
$authorize = Services::authorization();
|
$authorize = Services::authorization();
|
||||||
$podcastAdminGroup = $authorize->group('podcast_admin');
|
$podcastAdminGroup = $authorize->group('podcast_admin');
|
||||||
|
|
||||||
$podcastModel->addPodcastContributor(user_id(), $newPodcastId, $podcastAdminGroup->id);
|
$podcastModel->addPodcastContributor(user_id(), $newPodcastId, (int) $podcastAdminGroup->id);
|
||||||
|
|
||||||
$podcastsPlatformsData = [];
|
$podcastsPlatformsData = [];
|
||||||
$platformTypes = [
|
$platformTypes = [
|
||||||
@ -218,7 +218,7 @@ class PodcastImportController extends BaseController
|
|||||||
foreach ($platformTypes as $platformType) {
|
foreach ($platformTypes as $platformType) {
|
||||||
foreach ($platformType['elements'] as $platform) {
|
foreach ($platformType['elements'] as $platform) {
|
||||||
$platformLabel = $platform->attributes()['platform'];
|
$platformLabel = $platform->attributes()['platform'];
|
||||||
$platformSlug = slugify($platformLabel);
|
$platformSlug = slugify((string) $platformLabel);
|
||||||
if ($platformModel->getPlatform($platformSlug) !== null) {
|
if ($platformModel->getPlatform($platformSlug) !== null) {
|
||||||
$podcastsPlatformsData[] = [
|
$podcastsPlatformsData[] = [
|
||||||
'platform_slug' => $platformSlug,
|
'platform_slug' => $platformSlug,
|
||||||
@ -246,7 +246,7 @@ class PodcastImportController extends BaseController
|
|||||||
'full_name' => $fullName,
|
'full_name' => $fullName,
|
||||||
'unique_name' => slugify($fullName),
|
'unique_name' => slugify($fullName),
|
||||||
'information_url' => $podcastPerson->attributes()['href'],
|
'information_url' => $podcastPerson->attributes()['href'],
|
||||||
'image' => new Image(download_file($podcastPerson->attributes()['img'])),
|
'image' => new Image(download_file((string) $podcastPerson->attributes()['img'])),
|
||||||
'created_by' => user_id(),
|
'created_by' => user_id(),
|
||||||
'updated_by' => user_id(),
|
'updated_by' => user_id(),
|
||||||
]);
|
]);
|
||||||
@ -301,7 +301,7 @@ class PodcastImportController extends BaseController
|
|||||||
|
|
||||||
$slug = slugify(
|
$slug = slugify(
|
||||||
$this->request->getPost('slug_field') === 'title'
|
$this->request->getPost('slug_field') === 'title'
|
||||||
? $item->title
|
? (string) $item->title
|
||||||
: basename($item->link),
|
: basename($item->link),
|
||||||
);
|
);
|
||||||
if (in_array($slug, $slugs, true)) {
|
if (in_array($slug, $slugs, true)) {
|
||||||
@ -342,7 +342,7 @@ class PodcastImportController extends BaseController
|
|||||||
'guid' => $item->guid ?? null,
|
'guid' => $item->guid ?? null,
|
||||||
'title' => $item->title,
|
'title' => $item->title,
|
||||||
'slug' => $slug,
|
'slug' => $slug,
|
||||||
'audio_file' => download_file($item->enclosure->attributes()['url'],),
|
'audio_file' => download_file((string) $item->enclosure->attributes()['url'],),
|
||||||
'description_markdown' => $converter->convert($itemDescriptionHtml,),
|
'description_markdown' => $converter->convert($itemDescriptionHtml,),
|
||||||
'description_html' => $itemDescriptionHtml,
|
'description_html' => $itemDescriptionHtml,
|
||||||
'image' => $episodeImage,
|
'image' => $episodeImage,
|
||||||
@ -372,7 +372,7 @@ class PodcastImportController extends BaseController
|
|||||||
'location' => $location,
|
'location' => $location,
|
||||||
'created_by' => user_id(),
|
'created_by' => user_id(),
|
||||||
'updated_by' => user_id(),
|
'updated_by' => user_id(),
|
||||||
'published_at' => strtotime($item->pubDate),
|
'published_at' => strtotime((string) $item->pubDate),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$episodeModel = new EpisodeModel();
|
$episodeModel = new EpisodeModel();
|
||||||
@ -396,7 +396,7 @@ class PodcastImportController extends BaseController
|
|||||||
'full_name' => $fullName,
|
'full_name' => $fullName,
|
||||||
'unique_name' => slugify($fullName),
|
'unique_name' => slugify($fullName),
|
||||||
'information_url' => $episodePerson->attributes()['href'],
|
'information_url' => $episodePerson->attributes()['href'],
|
||||||
'image' => new Image(download_file($episodePerson->attributes()['img'])),
|
'image' => new Image(download_file((string) $episodePerson->attributes()['img'])),
|
||||||
'created_by' => user_id(),
|
'created_by' => user_id(),
|
||||||
'updated_by' => user_id(),
|
'updated_by' => user_id(),
|
||||||
]);
|
]);
|
||||||
|
@ -74,9 +74,9 @@ class PodcastPersonController extends BaseController
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove(int $personId): RedirectResponse
|
public function remove(string $personId): RedirectResponse
|
||||||
{
|
{
|
||||||
(new PersonModel())->removePersonFromPodcast($this->podcast->id, $personId);
|
(new PersonModel())->removePersonFromPodcast($this->podcast->id, (int) $personId);
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,6 @@ class PodcastPlatformController extends BaseController
|
|||||||
$podcastPlatform,
|
$podcastPlatform,
|
||||||
) && $podcastPlatform['on_embeddable_player'] === 'yes',
|
) && $podcastPlatform['on_embeddable_player'] === 'yes',
|
||||||
];
|
];
|
||||||
return redirect()
|
|
||||||
->back()
|
|
||||||
->with('message', lang('Platforms.messages.updateSuccess'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$platformModel->savePodcastPlatforms($this->podcast->id, $platformType, $podcastsPlatformsData);
|
$platformModel->savePodcastPlatforms($this->podcast->id, $platformType, $podcastsPlatformsData);
|
||||||
|
@ -143,7 +143,7 @@ class UserController extends BaseController
|
|||||||
$authorize = Services::authorization();
|
$authorize = Services::authorization();
|
||||||
|
|
||||||
$roles = $this->request->getPost('roles');
|
$roles = $this->request->getPost('roles');
|
||||||
$authorize->setUserGroups($this->user->id, $roles);
|
$authorize->setUserGroups($this->user->id, $roles ?? []);
|
||||||
|
|
||||||
// Success!
|
// Success!
|
||||||
return redirect()
|
return redirect()
|
||||||
|
@ -16,7 +16,7 @@ use CodeIgniter\Exceptions\PageNotFoundException;
|
|||||||
|
|
||||||
class PageController extends BaseController
|
class PageController extends BaseController
|
||||||
{
|
{
|
||||||
protected Page $page;
|
protected ?Page $page = null;
|
||||||
|
|
||||||
public function _remap(string $method, string ...$params): mixed
|
public function _remap(string $method, string ...$params): mixed
|
||||||
{
|
{
|
||||||
|
@ -23,8 +23,6 @@ class FakePodcastsAnalyticsSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$podcast = (new PodcastModel())->first();
|
|
||||||
|
|
||||||
$jsonUserAgents = json_decode(
|
$jsonUserAgents = json_decode(
|
||||||
file_get_contents('https://raw.githubusercontent.com/opawg/user-agents/master/src/user-agents.json',),
|
file_get_contents('https://raw.githubusercontent.com/opawg/user-agents/master/src/user-agents.json',),
|
||||||
true,
|
true,
|
||||||
@ -41,13 +39,15 @@ class FakePodcastsAnalyticsSeeder extends Seeder
|
|||||||
JSON_THROW_ON_ERROR,
|
JSON_THROW_ON_ERROR,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($podcast) {
|
$podcast = (new PodcastModel())->first();
|
||||||
|
|
||||||
|
if ($podcast !== null) {
|
||||||
$firstEpisode = (new EpisodeModel())
|
$firstEpisode = (new EpisodeModel())
|
||||||
->selectMin('published_at')
|
->selectMin('published_at')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
for (
|
for (
|
||||||
$date = strtotime($firstEpisode->published_at);
|
$date = strtotime((string) $firstEpisode->published_at);
|
||||||
$date < strtotime('now');
|
$date < strtotime('now');
|
||||||
$date = strtotime(date('Y-m-d', $date) . ' +1 day')
|
$date = strtotime(date('Y-m-d', $date) . ' +1 day')
|
||||||
) {
|
) {
|
||||||
@ -63,15 +63,15 @@ class FakePodcastsAnalyticsSeeder extends Seeder
|
|||||||
->where('`published_at` <= NOW()', null, false)
|
->where('`published_at` <= NOW()', null, false)
|
||||||
->findAll();
|
->findAll();
|
||||||
foreach ($episodes as $episode) {
|
foreach ($episodes as $episode) {
|
||||||
$age = floor(($date - strtotime($episode->published_at)) / 86400);
|
$age = floor(($date - strtotime((string) $episode->published_at)) / 86400,);
|
||||||
$probability1 = (int) floor(exp(3 - $age / 40)) + 1;
|
$probability1 = floor(exp(3 - $age / 40)) + 1;
|
||||||
|
|
||||||
for (
|
for (
|
||||||
$lineNumber = 0;
|
$lineNumber = 0;
|
||||||
$lineNumber < rand(1, $probability1);
|
$lineNumber < rand(1, (int) $probability1);
|
||||||
++$lineNumber
|
++$lineNumber
|
||||||
) {
|
) {
|
||||||
$probability2 = (int) floor(exp(6 - $age / 20)) + 10;
|
$probability2 = floor(exp(6 - $age / 20)) + 10;
|
||||||
|
|
||||||
$player =
|
$player =
|
||||||
$jsonUserAgents[
|
$jsonUserAgents[
|
||||||
@ -97,7 +97,7 @@ class FakePodcastsAnalyticsSeeder extends Seeder
|
|||||||
'.' .
|
'.' .
|
||||||
rand(0, 255);
|
rand(0, 255);
|
||||||
|
|
||||||
$cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb');
|
$cityReader = new Reader(WRITEPATH . 'uploads/GeoLite2-City/GeoLite2-City.mmdb',);
|
||||||
|
|
||||||
$countryCode = 'N/A';
|
$countryCode = 'N/A';
|
||||||
$regionCode = 'N/A';
|
$regionCode = 'N/A';
|
||||||
@ -113,13 +113,13 @@ class FakePodcastsAnalyticsSeeder extends Seeder
|
|||||||
$regionCode = $city->subdivisions === []
|
$regionCode = $city->subdivisions === []
|
||||||
? 'N/A'
|
? 'N/A'
|
||||||
: $city->subdivisions[0]->isoCode;
|
: $city->subdivisions[0]->isoCode;
|
||||||
$latitude = round($city->location->latitude, 3);
|
$latitude = round((float) $city->location->latitude, 3);
|
||||||
$longitude = round($city->location->longitude, 3);
|
$longitude = round((float) $city->location->longitude, 3);
|
||||||
} catch (AddressNotFoundException) {
|
} catch (AddressNotFoundException) {
|
||||||
//Bad luck, bad IP, nothing to do.
|
//Bad luck, bad IP, nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
$hits = rand(0, $probability2);
|
$hits = rand(0, (int) $probability2);
|
||||||
|
|
||||||
$analyticsPodcasts[] = [
|
$analyticsPodcasts[] = [
|
||||||
'podcast_id' => $podcast->id,
|
'podcast_id' => $podcast->id,
|
||||||
|
@ -189,7 +189,7 @@ class FakeWebsiteAnalyticsSeeder extends Seeder
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
for (
|
for (
|
||||||
$date = strtotime($firstEpisode->published_at);
|
$date = strtotime((string) $firstEpisode->published_at);
|
||||||
$date < strtotime('now');
|
$date < strtotime('now');
|
||||||
$date = strtotime(date('Y-m-d', $date) . ' +1 day')
|
$date = strtotime(date('Y-m-d', $date) . ' +1 day')
|
||||||
) {
|
) {
|
||||||
@ -202,7 +202,7 @@ class FakeWebsiteAnalyticsSeeder extends Seeder
|
|||||||
->where('`published_at` <= NOW()', null, false)
|
->where('`published_at` <= NOW()', null, false)
|
||||||
->findAll();
|
->findAll();
|
||||||
foreach ($episodes as $episode) {
|
foreach ($episodes as $episode) {
|
||||||
$age = floor(($date - strtotime($episode->published_at)) / 86400);
|
$age = floor(($date - strtotime((string) $episode->published_at)) / 86400);
|
||||||
$probability1 = (int) floor(exp(3 - $age / 40)) + 1;
|
$probability1 = (int) floor(exp(3 - $age / 40)) + 1;
|
||||||
|
|
||||||
for (
|
for (
|
||||||
|
@ -52,6 +52,25 @@ class BlockController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function attemptUnblockActor(): RedirectResponse
|
||||||
|
{
|
||||||
|
$rules = [
|
||||||
|
'actor_id' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (! $this->validate($rules)) {
|
||||||
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->withInput()
|
||||||
|
->with('errors', $this->validator->getErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
model('ActorModel')
|
||||||
|
->unblockActor((int) $this->request->getPost('actor_id'));
|
||||||
|
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
public function attemptBlockDomain(): RedirectResponse
|
public function attemptBlockDomain(): RedirectResponse
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
@ -71,25 +90,6 @@ class BlockController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function attemptUnblockActor(): RedirectResponse
|
|
||||||
{
|
|
||||||
$rules = [
|
|
||||||
'actor_id' => 'required',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (! $this->validate($rules)) {
|
|
||||||
return redirect()
|
|
||||||
->back()
|
|
||||||
->withInput()
|
|
||||||
->with('errors', $this->validator->getErrors());
|
|
||||||
}
|
|
||||||
|
|
||||||
model('ActorModel')
|
|
||||||
->unblockActor($this->request->getPost('actor_id'));
|
|
||||||
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function attemptUnblockDomain(): RedirectResponse
|
public function attemptUnblockDomain(): RedirectResponse
|
||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
|
@ -102,7 +102,7 @@ class BlockedDomainModel extends Model
|
|||||||
// set all actors from the domain as blocked
|
// set all actors from the domain as blocked
|
||||||
model('ActorModel')
|
model('ActorModel')
|
||||||
->where('domain', $name)
|
->where('domain', $name)
|
||||||
->set('is_blocked', 1)
|
->set('is_blocked', '1')
|
||||||
->update();
|
->update();
|
||||||
|
|
||||||
$result = $this->insert([
|
$result = $this->insert([
|
||||||
@ -133,7 +133,7 @@ class BlockedDomainModel extends Model
|
|||||||
// unblock all actors from the domain
|
// unblock all actors from the domain
|
||||||
model('ActorModel')
|
model('ActorModel')
|
||||||
->where('domain', $name)
|
->where('domain', $name)
|
||||||
->set('is_blocked', 0)
|
->set('is_blocked', '0')
|
||||||
->update();
|
->update();
|
||||||
|
|
||||||
$result = $this->delete($name);
|
$result = $this->delete($name);
|
||||||
|
@ -28,7 +28,7 @@ class PageModel extends Model
|
|||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $allowedFields = ['id', 'title', 'slug', 'content'];
|
protected $allowedFields = ['id', 'title', 'slug', 'content_markdown', 'content_html'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
@ -52,7 +52,7 @@ class PageModel extends Model
|
|||||||
'title' => 'required',
|
'title' => 'required',
|
||||||
'slug' =>
|
'slug' =>
|
||||||
'required|regex_match[/^[a-zA-Z0-9\-]{1,191}$/]|is_unique[pages.slug,id,{id}]',
|
'required|regex_match[/^[a-zA-Z0-9\-]{1,191}$/]|is_unique[pages.slug,id,{id}]',
|
||||||
'content' => 'required',
|
'content_markdown' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
'class' => 'form-textarea',
|
'class' => 'form-textarea',
|
||||||
'required' => 'required',
|
'required' => 'required',
|
||||||
],
|
],
|
||||||
old('content', $page->content, false),
|
old('content', $page->content_markdown, false),
|
||||||
'data-editor="markdown"',
|
'data-editor="markdown"',
|
||||||
) ?>
|
) ?>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user