/** * @route blog/series/edit/{id} * * @param string $seriesId */ public function editSeries(string $seriesId) { $seriesId = (int) $seriesId; $author = null; $series = $this->blog->getSeries($seriesId); if (!empty($series['config'])) { $series['config'] = \json_decode($series['config'], true); } else { $series['config'] = []; } $series_items = $this->blog->getSeriesItems($seriesId); $authorsAllowed = []; // Load Data if ($this->isSuperUser()) { $authors = $this->author->getAll(); foreach ($authors as $a) { $authorsAllowed[] = (int) $a['authorid']; if ($a['authorid'] === $series['author']) { $author = $a; } } } else { $authors = $this->author->getForUser($this->getActiveUserId()); foreach ($authors as $a) { $authorsAllowed[] = (int) $a['authorid']; if ($a['authorid'] === $series['author']) { $author = $a; } } if (!\in_array((int) $series['author'], $authorsAllowed)) { // You are not allowed \Airship\redirect($this->airship_cabin_prefix . '/blog/series'); } } $post = $this->post(new EditSeriesFilter()); if (!empty($post)) { if ($this->processEditSeries($post, $seriesId, $this->flattenOld($series_items))) { \Airship\redirect($this->airship_cabin_prefix . '/blog/series'); } } $this->lens('blog/series_edit', ['active_link' => 'bridge-link-blog-series', 'series' => $series, 'series_items' => $series_items, 'authors' => $authors, 'author' => $author, 'title' => \__('Edit Blog Series "%s"', 'default', Util::noHTML($series['name']))]); }