/** * Get the data file, get draft file if it exists * */ public function GetFile() { parent::GetFile(); if ($this->draft_exists) { $this->file_sections = \gp\tool\Files::Get($this->draft_file, 'file_sections'); $this->draft_meta = \gp\tool\Files::$last_meta; $this->draft_stats = \gp\tool\Files::$last_stats; } $this->checksum = $this->Checksum(); }
/** * Assign a layout to the $title. Child pages without a layout assigned will inherit this setting * @param string $title */ public function SetLayout() { global $gp_index, $gp_titles, $langmessage, $gpLayouts; $index = $_POST['index']; $title = \gp\tool::IndexToTitle($index); if (!$title) { msg($langmessage['OOPS']); return; } $this->title = $title; $layout = $_POST['layout']; if (!isset($gpLayouts[$layout])) { msg($langmessage['OOPS']); return; } if (!\gp\tool::verify_nonce('use_' . $layout)) { msg($langmessage['OOPS']); return; } //unset, then reset if needed unset($gp_titles[$index]['gpLayout']); $currentLayout = \gp\Page::OrConfig($index, 'gpLayout'); if ($currentLayout != $layout) { $gp_titles[$index]['gpLayout'] = $layout; } return \gp\admin\Tools::SavePagesPHP(true, true); }