Exemple #1
0
 * 
 * 调用模板:/modules/article/templates/admin/articlelog.html
 * 
 * @category   jieqicms
 * @package    article
 * @copyright  Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://www.jieqi.com)
 * @author     $Author: juny $
 * @version    $Id: articlelog.php 326 2009-02-04 00:26:22Z juny $
 */
define('JIEQI_MODULE_NAME', 'article');
require_once '../../../global.php';
//检查权限
jieqi_getconfigs(JIEQI_MODULE_NAME, 'power');
jieqi_checkpower($jieqiPower['article']['manageallarticle'], $jieqiUsersStatus, $jieqiUsersGroup, false, true);
include_once $jieqiModules['article']['path'] . '/class/articlelog.php';
$articlelog_handler = JieqiArticlelogHandler::getInstance('JieqiArticlelogHandler');
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
if (empty($_REQUEST['page']) || !is_numeric($_REQUEST['page'])) {
    $_REQUEST['page'] = 1;
}
include_once JIEQI_ROOT_PATH . '/admin/header.php';
$criteria = new CriteriaCompo();
if (!empty($_REQUEST['keyword'])) {
    if ($_REQUEST['keytype'] == 1) {
        $criteria->add(new Criteria('articlename', $_REQUEST['keyword'], '='));
    } else {
        $criteria->add(new Criteria('username', $_REQUEST['keyword'], '='));
    }
}
$criteria->setSort('logid');
$criteria->setOrder('DESC');
Exemple #2
0
function jieqi_article_delete($aid, $usescore = true)
{
    global $jieqiModules;
    global $article_handler;
    global $chapter_handler;
    global $jieqiArticleuplog;
    global $jieqiConfigs;
    global $jieqi_file_postfix;
    $article = $article_handler->get($aid);
    if (!is_object($article)) {
        return false;
    }
    //删除文章
    $article_handler->delete($aid);
    //更新最新文章
    $jieqiArticleuplog['articleuptime'] = JIEQI_NOW_TIME;
    jieqi_setcachevars('articleuplog', 'jieqiArticleuplog', $jieqiArticleuplog, 'article');
    //删除文本、html及zip
    $package = new JieqiPackage($aid);
    $package->delete();
    //删除章节
    //检查这篇文章章节发表人,扣积分用
    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);
    //删除书评
    $criteria1 = new CriteriaCompo(new Criteria('ownerid', $aid, '='));
    include_once $jieqiModules['article']['path'] . '/class/reviews.php';
    $reviews_handler =& JieqiReviewsHandler::getInstance('JieqiReviewsHandler');
    $reviews_handler->delete($criteria1);
    include_once $jieqiModules['article']['path'] . '/class/replies.php';
    $replies_handler =& JieqiRepliesHandler::getInstance('JieqiRepliesHandler');
    $replies_handler->delete($criteria1);
    /*
    include_once($jieqiModules['article']['path'].'/class/review.php');
    $review_handler =& JieqiReviewHandler::getInstance('JieqiReviewHandler');
    $review_handler->delete($criteria);
    */
    //删除封面
    $imagedir = jieqi_uploadpath($jieqiConfigs['article']['imagedir'], 'article') . jieqi_getsubdir($aid) . '/' . $aid;
    if (is_dir($imagedir)) {
        jieqi_delfolder($imagedir, true);
    }
    //记录删除日志
    include_once $jieqiModules['article']['path'] . '/class/articlelog.php';
    $articlelog_handler =& JieqiArticlelogHandler::getInstance('JieqiArticlelogHandler');
    $newlog = $articlelog_handler->create();
    $newlog->setVar('siteid', JIEQI_SITE_ID);
    $newlog->setVar('logtime', JIEQI_NOW_TIME);
    $newlog->setVar('userid', $_SESSION['jieqiUserId']);
    $newlog->setVar('username', $_SESSION['jieqiUserName']);
    $newlog->setVar('articleid', $article->getVar('articleid', 'n'));
    $newlog->setVar('articlename', $article->getVar('articlename', 'n'));
    $newlog->setVar('chapterid', 0);
    $newlog->setVar('chaptername', '');
    $newlog->setVar('reason', '');
    $newlog->setVar('chginfo', $jieqiLang['article']['delete_article']);
    $newlog->setVar('chglog', '');
    $newlog->setVar('ischapter', '0');
    $newlog->setVar('isdel', '1');
    $newlog->setVar('databak', serialize($article->getVars()));
    $articlelog_handler->insert($newlog);
    //减少文章和章节积分
    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;
}