/** * Move a page * * @param array $page * @param array $post * @param string $cabin * @param string $dir * @return bool */ protected function processMovePage(array $page, array $post, string $cabin, string $dir) : bool { if (\is_numeric($post['directory'])) { $post['cabin'] = $this->pg->getCabinForDirectory($post['directory']); } elseif (\is_string($post['directory'])) { // We're setting this to the root directory of a cabin $post['cabin'] = $post['directory']; $post['directory'] = 0; } else { // Invalid input. return false; } // Actually process the new page: if ($page['directory'] !== $post['directory'] || $page['cabin'] !== $post['cabin'] || $page['url'] !== $post['url']) { $this->pg->movePage((int) $page['pageid'], $post['url'], (int) $post['directory']); if (!empty($post['create_redirect'])) { $this->pg->createPageRedirect(\Airship\keySlice($page, ['cabin', 'directory', 'url']), \Airship\keySlice($post, ['cabin', 'directory', 'url'])); } \Airship\redirect($this->airship_cabin_prefix . '/pages/' . $cabin, ['dir' => $dir]); } return false; }