Exemple #1
0
//保存页面
if ($action == 'add' || $action == 'edit' || $action == 'autosave') {
    $emPage = new Log_Model();
    $Navi_Model = new Navi_Model();
    $title = isset($_POST['title']) ? addslashes(trim($_POST['title'])) : '';
    $content = isset($_POST['content']) ? addslashes(trim($_POST['content'])) : '';
    $editorinfo = isset($_POST['editorinfo']) && $_POST['editorinfo'] == 'markdown' ? '<!--markdown-->' : '';
    $content = $editorinfo . $content;
    $alias = isset($_POST['alias']) ? addslashes(trim($_POST['alias'])) : '';
    $pageId = isset($_POST['as_logid']) ? intval(trim($_POST['as_logid'])) : -1;
    //如被自动保存为草稿则有blog id号
    $ishide = isset($_POST['ishide']) && empty($_POST['ishide']) ? 'n' : addslashes($_POST['ishide']);
    $template = isset($_POST['template']) && $_POST['template'] != 'page' ? addslashes(trim($_POST['template'])) : '';
    $allow_remark = isset($_POST['allow_remark']) ? addslashes(trim($_POST['allow_remark'])) : 'n';
    LoginAuth::checkToken();
    $postTime = $emPage->postDate(Option::get('timezone'));
    //check alias
    if (!empty($alias)) {
        $logalias_cache = $CACHE->readCache('logalias');
        $alias = $emPage->checkAlias($alias, $logalias_cache, $pageId);
    }
    $logData = array('title' => $title, 'content' => $content, 'excerpt' => '', 'date' => $postTime, 'allow_remark' => $allow_remark, 'hide' => $ishide, 'alias' => $alias, 'type' => 'page', 'template' => $template);
    if ($pageId > 0) {
        //自动保存后,添加变为更新
        $emPage->updateLog($logData, $pageId);
    } else {
        $pageId = $emPage->addlog($logData);
    }
    $CACHE->updateCache(array('options', 'logalias'));
    switch ($action) {
        case 'autosave':
Exemple #2
0
$date = isset($_POST['date']) ? addslashes($_POST['date']) : '';
//修改前的文章时间
$sort = isset($_POST['sort']) ? intval($_POST['sort']) : '';
$tagstring = isset($_POST['tag']) ? addslashes(trim($_POST['tag'])) : '';
$content = isset($_POST['content']) ? addslashes(trim($_POST['content'])) : '';
$excerpt = isset($_POST['excerpt']) ? addslashes(trim($_POST['excerpt'])) : '';
$author = isset($_POST['author']) && ROLE == ROLE_ADMIN ? intval(trim($_POST['author'])) : UID;
$blogid = isset($_POST['as_logid']) ? intval(trim($_POST['as_logid'])) : -1;
//如被自动保存为草稿则有blog id号
$alias = isset($_POST['alias']) ? addslashes(trim($_POST['alias'])) : '';
$top = isset($_POST['top']) ? addslashes(trim($_POST['top'])) : 'n';
$sortop = isset($_POST['sortop']) ? addslashes(trim($_POST['sortop'])) : 'n';
$allow_remark = isset($_POST['allow_remark']) ? addslashes(trim($_POST['allow_remark'])) : 'n';
$ishide = isset($_POST['ishide']) && !empty($_POST['ishide']) && !isset($_POST['pubdf']) ? addslashes($_POST['ishide']) : 'n';
$password = isset($_POST['password']) ? addslashes(trim($_POST['password'])) : '';
$postTime = $Log_Model->postDate(Option::get('timezone'), $postDate, $date);
LoginAuth::checkToken();
//check alias
if (!empty($alias)) {
    $logalias_cache = $CACHE->readCache('logalias');
    $alias = $Log_Model->checkAlias($alias, $logalias_cache, $blogid);
}
$logData = array('title' => $title, 'alias' => $alias, 'content' => $content, 'excerpt' => $excerpt, 'author' => $author, 'sortid' => $sort, 'date' => $postTime, 'top ' => $top, 'sortop ' => $sortop, 'allow_remark' => $allow_remark, 'hide' => $ishide, 'checked' => $user_cache[UID]['ischeck'] == 'y' ? 'n' : 'y', 'password' => $password);
if ($blogid > 0) {
    //自动保存草稿后,添加变为更新
    $Log_Model->updateLog($logData, $blogid);
    $Tag_Model->updateTag($tagstring, $blogid);
    $dftnum = '';
} else {
    if (!($blogid = $Log_Model->isRepeatPost($title, $postTime))) {
        $blogid = $Log_Model->addlog($logData);