insert('news', $_POST); $upl = new Uploader('Image'); if ($id && $upl->picture) { $upl->picture->name = $id; $upl->picture->resample(100, 100, 'img/news'); $upl->picture->resample(20, 20, 'img/news/thumbs'); } redirect('admin/news_list.php'); break; case 'edit' : $id = intval($_POST['id']); $upl = new Uploader('Image'); if (isset($_POST['delete_picture'])) { $image = DOCS_DIR . 'img/news/' . $id . '.jpg'; $thumb = DOCS_DIR . 'img/news/thumbs/' . $id . '.jpg'; if (file_exists($image)) unlink($image); if (file_exists($thumb)) unlink($thumb); } if ($id && $upl->picture) { $upl->picture->name = $id; $upl->picture->resample(100, 100, 'img/news'); $upl->picture->resample(20, 20, 'img/news/thumbs'); } $mysql->update('news', $_POST, $id); redirect('admin/news_list.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['news'] = new News($_GET['id']); $oFCKeditor->Value = $data['news']->content; $data['title'] = 'Редактировать'; $page = '_edit'; break; } $data['editor'] = $oFCKeditor->CreateHtml(); load_template('admin/news' . $page, $data); ?>