insert('pages', $_POST, true); if ($_POST['parent'] != 'none') { $data = array( 'title' => $_POST['title'], 'parent' => $_POST['parent'], 'type' => 'page', 'link_id' => $id ); $mysql->insert('groups', $data); } redirect('admin/pages.php'); break; case 'edit': $id = intval($_POST['id']); if ($id) { $mysql->update('pages', $_POST, $id); $mysql->query("DELETE FROM groups WHERE type = 'page' AND link_id = $id"); if ($_POST['parent'] != 'none') { $data = array( 'title' => $_POST['title'], 'parent' => $_POST['parent'], 'type' => 'page', 'link_id' => $id ); $mysql->insert('groups', $data); } } redirect('admin/pages.php'); break; } $oFCKeditor = new FCKeditor('content'); $oFCKeditor->BasePath = URL . 'admin/fckeditor/'; $oFCKeditor->Config['ToolbarCanCollapse'] = false; $oFCKeditor->Config['AutoDetectLanguage'] = false; $oFCKeditor->Config['DefaultLanguage'] = 'ru'; $oFCKeditor->Config['EditorAreaCSS'] = URL . 'admin/css/site.css'; $oFCKeditor->Height = 400; //$oFCKeditor->Config['SkinPath'] = $oFCKeditor->BasePath . 'editor/skins/default_backup/'; switch (GET_ACTION) { case 'add' : $data['title'] = 'Новая страница'; $page = '_add'; break; case 'edit' : $data['page'] = new Page($_GET['id']); $oFCKeditor->Value = $data['page']->content; $data['title'] = 'Редактировать'; $page = '_edit'; break; } $data['editor'] = $oFCKeditor->CreateHtml(); load_template('admin/page' . $page, $data); ?>