$tmpdir = dirname($url); while (strpos($imageurl, '../') === 0) { $tmpdir = dirname($tmpdir); $imageurl = substr($imageurl, 3); } $imageurl = $tmpdir . '/' . $imageurl; } $chaptercontent = str_replace($v, $imageurl, $chaptercontent); } } } } //转换成文本 $chaptercontent = jieqi_textstr($chaptercontent, true); //内容排版 $chaptercontent = $texttypeset->doTypeset($chaptercontent); //如果是插入章节,则原来章节的序号加一位 if ($q < $tonum) { $criteria = new CriteriaCompo(new Criteria('articleid', $_REQUEST['toid'])); $criteria->add(new Criteria('chapterorder', $q, '>')); $chapter_handler->updatefields('chapterorder=chapterorder+1', $criteria); unset($criteria); } $newChapter = $chapter_handler->create(); $newChapter->setVar('siteid', JIEQI_SITE_ID); $chaptersize = strlen(str_replace(array(" ", " ", "\r", "\n"), '', $chaptercontent)); $newChapter->setVar('articleid', $_REQUEST['toid']); $newChapter->setVar('articlename', $article->getVar('articlename', 'n')); $newChapter->setVar('volumeid', 0); if (!empty($_SESSION['jieqiUserId'])) { $newChapter->setVar('posterid', $_SESSION['jieqiUserId']);
$chapter->setVar('poster', ''); } $chapter->setVar('lastupdate', JIEQI_NOW_TIME); $chapter->setVar('chaptername', $_POST['chaptername']); if ($_REQUEST['chaptertype'] == 0) { //文字过滤 if (!empty($jieqiConfigs['article']['hidearticlewords'])) { $articlewordssplit = strlen($jieqiConfigs['article']['articlewordssplit']) == 0 ? ' ' : $jieqiConfigs['article']['articlewordssplit']; $filterary = explode($articlewordssplit, $jieqiConfigs['article']['hidearticlewords']); $_POST['chaptercontent'] = str_replace($filterary, '', $_POST['chaptercontent']); } //内容排版 if ($jieqiConfigs['article']['authtypeset'] == 2 || $jieqiConfigs['article']['authtypeset'] == 1 && $_POST['typeset'] == 1) { include_once JIEQI_ROOT_PATH . '/lib/text/texttypeset.php'; $texttypeset = new TextTypeset(); $_POST['chaptercontent'] = $texttypeset->doTypeset($_POST['chaptercontent']); } $chaptersize = strlen(str_replace(array(" ", " ", "\r", "\n"), '', $_POST['chaptercontent'])); $beforesize = $chapter->getVar('size'); $chapter->setVar('size', $chaptersize); } else { $_POST['chaptercontent'] = ''; } if (!$chapter_handler->insert($chapter)) { jieqi_printfail($jieqiLang['article']['chapter_edit_failure']); } else { if ($_REQUEST['chaptertype'] == 0) { $article->setVar('size', $article->getVar('size') + $chaptersize - $beforesize); if ($chapter->getVar('chapterid') == $article->getVar('lastchapterid')) { $article->setVar('lastchapter', $_POST['chaptername']); }
case 'newdraft': $_POST['draftname'] = trim($_POST['draftname']); $errtext = ''; //检查标题 if (strlen($_POST['draftname']) == 0) { $errtext .= $jieqiLang['article']['need_draft_title'] . '<br />'; } if (strlen($_POST['draftcontent']) == 0) { $errtext .= $jieqiLang['article']['need_draft_content'] . '<br />'; } if (empty($errtext)) { //内容排版 if ($jieqiConfigs['article']['authtypeset'] == 2 || $jieqiConfigs['article']['authtypeset'] == 1 && $_POST['typeset'] == 1) { include_once JIEQI_ROOT_PATH . '/lib/text/texttypeset.php'; $texttypeset = new TextTypeset(); $_POST['draftcontent'] = $texttypeset->doTypeset($_POST['draftcontent']); } //保存到草稿箱 include_once $jieqiModules['article']['path'] . '/class/draft.php'; $draft_handler =& JieqiDraftHandler::getInstance('JieqiDraftHandler'); $newDraft = $draft_handler->create(); $draftsize = strlen(str_replace(array(" ", " ", "\r", "\n"), '', $_POST['draftcontent'])); include_once $jieqiModules['article']['path'] . '/class/article.php'; $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler'); $article = $article_handler->get($_POST['articleid']); $newDraft->setVar('articleid', $_POST['articleid']); if (is_object($article)) { $newDraft->setVar('articlename', $article->getVar('articlename', 'n')); } else { $newDraft->setVar('articlename', ''); }