<?php
/**
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
* @version $Id addnew.inc.php 1 2008-08-24 10:25 $
*/
(!defined('IN_ADMIN') || !defined('IN_MUDDER')) && exit('Access Denied');

if($dosubmit) {

    empty($article['subject']) && cpmsg('标题未填写，请返回填写。');
    empty($article['classid']) && cpmsg('分类为选择，请返回选择。');
    empty($article['content']) && cpmsg('内容未填写，请返回填写。');

    $article['introduce'] = nl2br(unite_textarea($article['introduce']));
    $article['dateline'] = $timestamp;

    $articleid = article_add($article);
    $articleid && cpmsg('增加成功！', 'admincp.php?action=article&file=list');

} else {

    // 分类缓存
    $articleclass = read_cache_articleclass();
    if(empty($articleclass)) {
        cpmsg('请先添加文章分类。', 'admincp.php?action=article&file=class');
    }
    // 加载 FCK 编辑器
    require_once(MUDDER_ROOT.'./include/editor/fckeditor.php');
    $fck = new FCKeditor('article[content]');
    $fck->ToolbarSet = 'Admin';
    $fckhtml = $fck->CreateHtml();
    
    include cptpl('artcile_add', MOD_ROOT.'./admin/templates/');
}
?>