/** * Показ статической страницы: */ public function indexAction(Application $application, Template $template) { if (($page = StaticModel::GetPage($_GET['page'])) != false) { if ($page['published'] == true) { $template->setParameter('title', $page['title']); $this['page'] = $page['name']; return true; } } $application->go('errors_error404'); return false; }
/** * Редактирование страницы: */ public function staticEditAction(Application $application, Template $template) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_POST['old_page'] != $_POST['page']) { StaticModel::RemovePage($_POST['old_page']); } StaticModel::SetPage($_POST['page'], $_POST['title'], $_POST['content'], $_POST['published']); $template->headerSeeOther('http://' . TemplateHelper::getSiteUrl() . '/admin/staticEdit?page=' . $_POST['page']); exit; } $template->setParameter('menu', 'static'); $this['page'] = StaticModel::GetPage($_GET['page']); return true; }