//允许清空,并且不是标记完成的书 if ($jieqiCollect['autoclear'] == 1 && $fromisfull == false) { echo sprintf($jieqiLang['article']['article_collect_clean'], jieqi_htmlstr($article->getVar('articlename'))); //清除文章统计 $oldchapters = $article->getVar('chapters'); $article->setVar('lastchapter', ''); $article->setVar('lastchapterid', 0); $article->setVar('lastvolume', ''); $article->setVar('lastvolumeid', 0); $article->setVar('chapters', 0); $article->setVar('size', 0); $article_handler->insert($article); //删除文本、html及zip include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/package.php'; $package = new JieqiPackage($_REQUEST['toid']); $package->delete(); $package->initPackage(array('id' => $article->getVar('articleid', 'n'), 'title' => $article->getVar('articlename', 'n'), 'creatorid' => $article->getVar('authorid', 'n'), 'creator' => $article->getVar('author', 'n'), 'subject' => $article->getVar('keywords', 'n'), 'description' => $article->getVar('intro', 'n'), 'publisher' => JIEQI_SITE_NAME, 'contributorid' => $article->getVar('posterid', 'n'), 'contributor' => $article->getVar('poster', 'n'), 'sortid' => $article->getVar('sortid', 'n'), 'typeid' => $article->getVar('typeid', 'n'), 'articletype' => $article->getVar('articletype', 'n'), 'permission' => $article->getVar('permission', 'n'), 'firstflag' => $article->getVar('firstflag', 'n'), 'fullflag' => $article->getVar('fullflag', 'n'), 'imgflag' => $article->getVar('imgflag', 'n'), 'power' => $article->getVar('power', 'n'), 'display' => $article->getVar('display', 'n'))); unset($package); //删除章节 $criteria = new CriteriaCompo(new Criteria('articleid', $_REQUEST['toid'], '=')); $chapter_handler->delete($criteria); unset($criteria); $fp = 0; $tp = 0; $torows = array(); $tonum = 0; $maxchapterorder = 0; } else { $fp = $fromnum; $tp = $fromnum; if ($error_continue == true) {
function jieqi_article_clean($aid, $usescore = false) { global $jieqiModules; global $article_handler; global $chapter_handler; global $jieqiArticleuplog; global $jieqiConfigs; $article = $article_handler->get($aid); if (!is_object($article)) { return false; } //清除文章统计 $criteria = new CriteriaCompo(new Criteria('articleid', $aid)); $fields = array('lastchapter' => '', 'lastchapterid' => 0, 'lastvolume' => '', 'lastvolumeid' => 0, 'chapters' => 0, 'size' => 0); $article_handler->updatefields($fields, $criteria); //更新最新文章 $jieqiArticleuplog['articleuptime'] = JIEQI_NOW_TIME; $jieqiArticleuplog['chapteruptime'] = JIEQI_NOW_TIME; jieqi_setcachevars('articleuplog', 'jieqiArticleuplog', $jieqiArticleuplog, 'article'); //删除文本、html及zip $package = new JieqiPackage($aid); $package->delete(); $package->initPackage(array('id' => $article->getVar('articleid', 'n'), 'title' => $article->getVar('articlename', 'n'), 'creatorid' => $article->getVar('authorid', 'n'), 'creator' => $article->getVar('author', 'n'), 'subject' => $article->getVar('keywords', 'n'), 'description' => $article->getVar('intro', 'n'), 'publisher' => JIEQI_SITE_NAME, 'contributorid' => $article->getVar('posterid', 'n'), 'contributor' => $article->getVar('poster', 'n'), 'sortid' => $article->getVar('sortid', 'n'), 'typeid' => $article->getVar('typeid', 'n'), 'articletype' => $article->getVar('articletype', 'n'), 'permission' => $article->getVar('permission', 'n'), 'firstflag' => $article->getVar('firstflag', 'n'), 'fullflag' => $article->getVar('fullflag', 'n'), 'imgflag' => $article->getVar('imgflag', 'n'), 'power' => $article->getVar('power', 'n'), 'display' => $article->getVar('display', 'n'))); //删除章节 //检查这篇文章章节发表人,扣积分用 if ($usescore) { $posterary = array(); if (!empty($jieqiConfigs['article']['scorechapter'])) { $criteria0 = new CriteriaCompo(new Criteria('articleid', $aid, '=')); $chapter_handler->queryObjects($criteria0); while ($chapterobj = $chapter_handler->getObject()) { $posterid = intval($chapterobj->getVar('posterid')); if (isset($posterary[$posterid])) { $posterary[$posterid] += $jieqiConfigs['article']['scorechapter']; } else { $posterary[$posterid] = $jieqiConfigs['article']['scorechapter']; } } unset($criteria0); } } //真正删除章节 $criteria = new CriteriaCompo(new Criteria('articleid', $aid, '=')); $chapter_handler->delete($criteria); //删除附件 include_once $jieqiModules['article']['path'] . '/class/articleattachs.php'; $attachs_handler =& JieqiArticleattachsHandler::getInstance('JieqiArticleattachsHandler'); $attachs_handler->delete($criteria); //减少文章和章节积分 if ($usescore) { include_once JIEQI_ROOT_PATH . '/class/users.php'; $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler'); if (!empty($jieqiConfigs['article']['scorearticle'])) { $posterid = intval($article->getVar('posterid')); if (isset($posterary[$posterid])) { $posterary[$posterid] += $jieqiConfigs['article']['scorearticle']; } else { $posterary[$posterid] = $jieqiConfigs['article']['scorearticle']; } } foreach ($posterary as $pid => $pscore) { $users_handler->changeScore($pid, $pscore, false); } } return $article; }