示例#1
0
文件: setgood.php 项目: thu0ng91/jmc
 * @category   jieqicms
 * @package    obook
 * @copyright  Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://www.jieqi.com)
 * @author     $Author: juny $
 * @version    $Id: setgood.php 231 2008-11-27 08:46:26Z juny $
 */
define('JIEQI_MODULE_NAME', 'obook');
require_once '../../../global.php';
jieqi_getconfigs(JIEQI_MODULE_NAME, 'power');
jieqi_checkpower($jieqiPower['obook']['manageallobook'], $jieqiUsersStatus, $jieqiUsersGroup, false, true);
jieqi_loadlang('manage', JIEQI_MODULE_NAME);
if (empty($_REQUEST['id'])) {
    jieqi_printfail($jieqiLang['obook']['obook_not_exists']);
}
include_once $jieqiModules['obook']['path'] . '/class/obook.php';
$obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler');
$obook = $obook_handler->get($_REQUEST['id']);
if (!is_object($obook)) {
    jieqi_printfail($jieqiLang['obook']['obook_not_exists']);
}
if ($_REQUEST['action'] == 'no') {
    $obook->setVar('toptime', 0);
} else {
    $obook->setVar('toptime', JIEQI_NOW_TIME);
}
$obook_handler->insert($obook);
if ($_REQUEST['action'] == 'no') {
    jieqi_msgwin(LANG_DO_SUCCESS, $jieqiLang['obook']['obook_notgood_success']);
} else {
    jieqi_msgwin(LANG_DO_SUCCESS, $jieqiLang['obook']['obook_setgood_success']);
}
示例#2
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     global $jieqiSort;
     $obookrows = array();
     if (count($this->exevars) > 0) {
         include_once $GLOBALS['jieqiModules']['obook']['path'] . '/class/obook.php';
         jieqi_getconfigs('obook', 'configs');
         $obook_static_url = empty($jieqiConfigs['obook']['staticurl']) ? $GLOBALS['jieqiModules']['obook']['url'] : $jieqiConfigs['obook']['staticurl'];
         $obook_dynamic_url = empty($jieqiConfigs['obook']['dynamicurl']) ? $GLOBALS['jieqiModules']['obook']['url'] : $jieqiConfigs['obook']['dynamicurl'];
         $jieqiTpl->assign('obook_static_url', $obook_static_url);
         $jieqiTpl->assign('obook_dynamic_url', $obook_dynamic_url);
         $tmpvar = explode('-', date('Y-m-d', JIEQI_NOW_TIME));
         $daystart = mktime(0, 0, 0, (int) $tmpvar[1], (int) $tmpvar[2], (int) $tmpvar[0]);
         $monthstart = mktime(0, 0, 0, (int) $tmpvar[1], 1, (int) $tmpvar[0]);
         $tmpvar = date('w', JIEQI_NOW_TIME);
         if ($tmpvar == 0) {
             $tmpvar = 7;
         }
         //星期天是0,国人习惯作为作为一星期的最后一天
         $weekstart = $daystart;
         if ($tmpvar > 1) {
             $weekstart -= ($tmpvar - 1) * 86400;
         }
         $obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler');
         $criteria = new CriteriaCompo();
         $criteria->add(new Criteria('obookid', '(0,' . implode(',', $this->exevars) . ')', 'IN'));
         $criteria->add(new Criteria('display', 0, '='));
         $criteria->setLimit(100);
         $criteria->setStart(0);
         $obook_handler->queryObjects($criteria);
         jieqi_getconfigs('obook', 'sort');
         $k = 0;
         while ($v = $obook_handler->getObject()) {
             $obookrows[$k]['order'] = $k + 1;
             $obookrows[$k]['obookid'] = $v->getVar('obookid');
             //文章序号
             $obookrows[$k]['obookname'] = $v->getVar('obookname');
             //文章名称
             $obookrows[$k]['articleid'] = $v->getVar('articleid');
             //文章序号
             if ($jieqiConfigs['obook']['fakeinfo'] == 1) {
                 $obookrows[$k]['obooksubdir'] = jieqi_getsubdir($v->getVar('obookid'));
                 //子目录
                 if (!empty($jieqiConfigs['obook']['fakeprefix'])) {
                     $tmpvar = '/' . $jieqiConfigs['obook']['fakeprefix'] . 'info';
                 } else {
                     $tmpvar = '/files/obook/info';
                 }
                 $obookrows[$k]['url_obookinfo'] = $obook_dynamic_url . $tmpvar . $obookrows[$k]['obooksubdir'] . '/' . $v->getVar('obookid') . $jieqiConfigs['obook']['fakefile'];
                 //子目录
             } else {
                 $obookrows[$k]['obooksubdir'] = '';
                 $obookrows[$k]['url_obookinfo'] = $obook_dynamic_url . '/obookinfo.php?id=' . $v->getVar('obookid');
                 //子目录
             }
             if ($v->getVar('lastchapter') == '') {
                 $obookrows[$k]['lastchapterid'] = 0;
                 //章节序号
                 $obookrows[$k]['lastchapter'] = '';
                 //章节名称
                 $obookrows[$k]['url_lastchapter'] = '';
                 //章节地址
             } else {
                 $obookrows[$k]['lastchapterid'] = $v->getVar('lastchapterid');
                 $obookrows[$k]['lastchapter'] = $v->getVar('lastchapter');
                 $obookrows[$k]['url_lastchapter'] = $obook_static_url . '/reader.php?aid=' . $v->getVar('obookid') . '&cid=' . $v->getVar('lastchapterid');
             }
             //公众章节
             if ($obookrows[$k]['articleid'] > 0) {
                 if ($jieqiConfigs['article']['makehtml'] == 0 || JIEQI_CHAR_SET != JIEQI_SYSTEM_CHARSET) {
                     $obookrows[$k]['url_read'] = $article_static_url . '/reader.php?aid=' . $obookrows[$k]['articleid'];
                 } else {
                     $obookrows[$k]['url_read'] = jieqi_uploadurl($jieqiConfigs['article']['htmldir'], $jieqiConfigs['article']['htmlurl'], 'article', $article_static_url) . jieqi_getsubdir($obookrows[$k]['articleid']) . '/' . $obookrows[$k]['articleid'] . '/index' . $jieqiConfigs['article']['htmlfile'];
                 }
             }
             $obookrows[$k]['lastvolume'] = $v->getVar('lastvolumeid');
             //分卷序号
             $obookrows[$k]['lastvolume'] = $v->getVar('lastvolume');
             //分卷名称
             $obookrows[$k]['authorid'] = $v->getVar('authorid');
             //作者
             $obookrows[$k]['author'] = $v->getVar('author');
             $obookrows[$k]['posterid'] = $v->getVar('posterid');
             //发表者
             $obookrows[$k]['poster'] = $v->getVar('poster');
             $obookrows[$k]['agentid'] = $v->getVar('agentid');
             //代理者
             $obookrows[$k]['agent'] = $v->getVar('agent');
             $obookrows[$k]['sortid'] = $v->getVar('sortid');
             //类别序号
             $obookrows[$k]['sort'] = $jieqiSort['obook'][$v->getVar('sortid')]['shortname'];
             //类别
             $obookrows[$k]['size'] = $v->getVar('size');
             $obookrows[$k]['size_k'] = ceil($v->getVar('size') / 1024);
             $obookrows[$k]['size_c'] = ceil($v->getVar('size') / 2);
             $obookrows[$k]['daysale'] = $v->getVar('daysale');
             $obookrows[$k]['weeksale'] = $v->getVar('weeksale');
             $obookrows[$k]['monthsale'] = $v->getVar('monthsale');
             $obookrows[$k]['sumegold'] = $v->getVar('sumegold');
             $obookrows[$k]['sumesilver'] = $v->getVar('sumesilver');
             $obookrows[$k]['sumemoney'] = $obookrows[$k]['sumegold'] + $obookrows[$k]['sumesilver'];
             $obookrows[$k]['payprice'] = $v->getVar('payprice');
             $obookrows[$k]['allsale'] = $v->getVar('allsale');
             $obookrows[$k]['lastupdate'] = date('y-m-d', $v->getVar('lastupdate'));
             //最后更新日期
             $obookrows[$k]['update'] = date('m-d', $v->getVar('lastupdate'));
             //最后更新日期
             $obookrows[$k]['display'] = $v->getVar('display');
             if ($v->getVar('imgflag') > 0) {
                 $obookrows[$k]['url_image'] = jieqi_uploadurl($jieqiConfigs['obook']['imagedir'], $jieqiConfigs['obook']['imageurl'], 'obook', $obook_static_url) . jieqi_getsubdir($v->getVar('obookid')) . '/' . $v->getVar('obookid') . '/' . $v->getVar('obookid') . 's' . $jieqiConfigs['obook']['imagetype'];
             } else {
                 $obookrows[$k]['url_image'] = $obook_static_url . '/images/nocover.jpg';
             }
             $k++;
         }
     }
     $jieqiTpl->assign_by_ref('obookrows', $obookrows);
 }
示例#3
0
function makestaticinfo($article_id)
{
    global $jieqiConfigs;
    global $jieqiSort;
    global $jieqiTpl;
    global $jieqiBlocks;
    global $jieqi_file_postfix;
    global $jieqiOption;
    if (!is_object($jieqiTpl)) {
        $jieqiTpl =& JieqiTpl::getInstance();
    }
    if (empty($article_id) || !is_numeric($article_id)) {
        return false;
    }
    $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
    $article = $article_handler->get($article_id);
    if (!$article) {
        return false;
    }
    //包含区块参数(定制)
    jieqi_getconfigs(JIEQI_MODULE_NAME, 'sort');
    jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
    $jieqi_pagetitle = $article->getVar('articlename');
    if ($article->getVar('lastvolume') != '') {
        $jieqi_pagetitle .= '-' . $article->getVar('lastvolume');
    }
    $jieqi_pagetitle .= '-' . $article->getVar('lastchapter') . '-' . JIEQI_SITE_NAME;
    $jieqiTpl->assign('jieqi_pagetitle', $jieqi_pagetitle);
    $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl'];
    $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
    $jieqiTpl->assign('article_static_url', $article_static_url);
    $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
    $jieqiTpl->assign('articlename', $article->getVar('articlename'));
    $jieqiTpl->assign('postdate', date('Y-m-d', $article->getVar('postdate')));
    $jieqiTpl->assign('lastupdate', date('Y-m-d', $article->getVar('lastupdate')));
    if ($article->getVar('authorid') > 0) {
        $jieqiTpl->assign('author', '<a href="' . jieqi_geturl('system', 'user', $article->getVar('authorid')) . '" target="_blank">' . $article->getVar('author') . '</a>');
    } else {
        $jieqiTpl->assign('author', $article->getVar('author'));
    }
    if ($article->getVar('agentid') > 0) {
        $jieqiTpl->assign('agent', '<a href="' . jieqi_geturl('system', 'user', $article->getVar('agentid')) . '" target="_blank">' . $article->getVar('agent') . '</a>');
    } else {
        $jieqiTpl->assign('agent', $article->getVar('agent'));
    }
    $jieqiTpl->assign('sortid', $article->getVar('sortid'));
    $jieqiTpl->assign('sort', $jieqiSort['article'][$article->getVar('sortid')]['caption']);
    $jieqiTpl->assign('intro', $article->getVar('intro'));
    $jieqiTpl->assign('notice', $article->getVar('notice'));
    $imgflag = $article->getVar('imgflag');
    //小图
    if (($imgflag & 1) > 0) {
        $jieqiTpl->assign('hasimage', 1);
        $jieqiTpl->assign('url_simage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 's' . $jieqiConfigs['article']['imagetype']);
    } else {
        $jieqiTpl->assign('hasimage', 0);
        $jieqiTpl->assign('url_simage', '');
    }
    //大图
    if (($imgflag & 2) > 0) {
        $jieqiTpl->assign('url_limage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 'l' . $jieqiConfigs['article']['imagetype']);
    } elseif (($imgflag & 1) > 0) {
        $jieqiTpl->assign('url_limage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 's' . $jieqiConfigs['article']['imagetype']);
    } else {
        $jieqiTpl->assign('url_limage', '');
    }
    $lastchapter = $article->getVar('lastchapter');
    if ($lastchapter != '') {
        if ($article->getVar('lastvolume') != '') {
            $lastchapter = $article->getVar('lastvolume') . ' ' . $lastchapter;
        }
        $jieqiTpl->assign('url_lastchapter', jieqi_geturl('article', 'chapter', $article->getVar('lastchapterid'), $article->getVar('articleid')));
    } else {
        $jieqiTpl->assign('url_lastchapter', '');
    }
    //显示多个最新章节
    if (is_numeric($jieqiConfigs['article']['infochapternum']) && intval($jieqiConfigs['article']['infochapternum']) > 0) {
        $jieqiConfigs['article']['infochapternum'] = intval($jieqiConfigs['article']['infochapternum']);
        include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/chapter.php';
        $chapter_handler =& JieqiChapterHandler::getInstance('JieqiChapterHandler');
        $criteria = new CriteriaCompo(new Criteria('articleid', $article->getVar('articleid'), '='));
        $criteria->setSort('chapterorder');
        $criteria->setOrder('DESC');
        $criteria->setLimit($jieqiConfigs['article']['infochapternum'] + ceil($jieqiConfigs['article']['infochapternum'] / 4));
        $chapter_handler->queryObjects($criteria);
        $chapterrows = array();
        $k = 0;
        $volumename = $article->getVar('lastvolume');
        while ($chapter = $chapter_handler->getObject()) {
            if ($chapter->getVar('chaptertype') == 1) {
                $volumename = $chapter->getVar('chaptername');
            } else {
                $chapterrows[$k]['volumename'] = $volumename;
                $chapterrows[$k]['chaptername'] = $chapter->getVar('chaptername');
                if ($chapterrows[$k]['volumename'] != '') {
                    $chapterrows[$k]['chapter'] = $chapterrows[$k]['volumename'] . ' ' . $chapterrows[$k]['chaptername'];
                } else {
                    $chapterrows[$k]['chapter'] = $chapterrows[$k]['chaptername'];
                }
                $chapterrows[$k]['chapterid'] = $chapter->getVar('chapterid');
                $chapterrows[$k]['url_chapter'] = jieqi_geturl('article', 'chapter', $chapter->getVar('chapterid'), $article->getVar('articleid'));
                $k++;
                if ($k >= $jieqiConfigs['article']['infochapternum']) {
                    break;
                }
            }
        }
        $jieqiTpl->assign_by_ref('chapterrows', $chapterrows);
    }
    $jieqiTpl->assign('lastchapter', $lastchapter);
    $jieqiTpl->assign('size', $article->getVar('size'));
    $jieqiTpl->assign('size_k', ceil($article->getVar('size') / 1024));
    $jieqiTpl->assign('size_c', ceil($article->getVar('size') / 2));
    $jieqiTpl->assign('dayvisit', $article->getVar('dayvisit'));
    $jieqiTpl->assign('weekvisit', $article->getVar('weekvisit'));
    $jieqiTpl->assign('monthvisit', $article->getVar('monthvisit'));
    $jieqiTpl->assign('allvisit', $article->getVar('allvisit'));
    $jieqiTpl->assign('dayvote', $article->getVar('dayvote'));
    $jieqiTpl->assign('weekvote', $article->getVar('weekvote'));
    $jieqiTpl->assign('monthvote', $article->getVar('monthvote'));
    $jieqiTpl->assign('allvote', $article->getVar('allvote'));
    $jieqiTpl->assign('goodnum', $article->getVar('goodnum'));
    $jieqiTpl->assign('badnum', $article->getVar('badnum'));
    jieqi_getconfigs('article', 'option', 'jieqiOption');
    $tmpvar = $article->getVar('fullflag');
    if (isset($jieqiOption['article']['fullflag']['items'][$tmpvar])) {
        $jieqiTpl->assign('fullflag', $jieqiOption['article']['fullflag']['items'][$tmpvar]);
    } else {
        $jieqiTpl->assign('fullflag', $jieqiOption['article']['fullflag']['items'][$jieqiOption['article']['fullflag']['default']]);
    }
    $tmpvar = $article->getVar('permission');
    if (isset($jieqiOption['article']['permission']['items'][$tmpvar])) {
        $jieqiTpl->assign('permission', $jieqiOption['article']['permission']['items'][$tmpvar]);
    } else {
        $jieqiTpl->assign('permission', $jieqiOption['article']['permission']['items'][$jieqiOption['article']['permission']['default']]);
    }
    $tmpvar = $article->getVar('firstflag');
    if (isset($jieqiOption['article']['firstflag']['items'][$tmpvar])) {
        $jieqiTpl->assign('firstflag', $jieqiOption['article']['firstflag']['items'][$tmpvar]);
    } else {
        $jieqiTpl->assign('firstflag', $jieqiOption['article']['firstflag']['items'][$jieqiOption['article']['firstflag']['default']]);
    }
    //管理
    $jieqiTpl->assign('url_manage', $article_static_url . '/articlemanage.php?id=' . $article->getVar('articleid'));
    //举报
    $tmpstr = sprintf($jieqiLang['article']['article_report_reason'], jieqi_geturl('article', 'article', $article->getVar('articleid'), 'info'));
    $jieqiTpl->assign('url_report', $article_dynamic_url . '/newmessage.php?tosys=1&title=' . urlencode(sprintf($jieqiLang['article']['article_report_title'], $article->getVar('articlename', 'n'))) . '&content=' . urlencode($tmpstr));
    //采集
    $setting = unserialize($article->getVar('setting', 'n'));
    $url_collect = $article_static_url . '/collect.php?toid=' . $article->getVar('articleid', 'n');
    if (is_numeric($setting['fromarticle'])) {
        $url_collect .= '&fromid=' . $setting['fromarticle'];
    }
    if (is_numeric($setting['fromsite'])) {
        $url_collect .= '&siteid=' . $setting['fromsite'];
    }
    $jieqiTpl->assign('url_collect', $url_collect);
    //文章序号
    $jieqiTpl->assign('articleid', $article->getVar('articleid'));
    //点击阅读,全文阅读
    if ($article->getVar('chapters', 'n') > 0) {
        $jieqiTpl->assign('url_read', jieqi_geturl('article', 'article', $article->getVar('articleid'), 'index'));
        if ($jieqiConfigs['article']['makefull'] == 0 || JIEQI_CHAR_SET != JIEQI_SYSTEM_CHARSET) {
            $jieqiTpl->assign('url_fullpage', $article_static_url . '/reader.php?aid=' . $article->getVar('articleid'));
        } else {
            $jieqiTpl->assign('url_fullpage', jieqi_uploadurl($jieqiConfigs['article']['fulldir'], $jieqiConfigs['article']['fullurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . $jieqiConfigs['article']['htmlfile']);
        }
    } else {
        $jieqiTpl->assign('url_read', '#');
        $jieqiTpl->assign('url_fullpage', '#');
    }
    //放入书架
    $jieqiTpl->assign('url_bookcase', $article_dynamic_url . '/addbookcase.php?bid=' . $article->getVar('articleid'));
    //推荐本书
    $jieqiTpl->assign('url_uservote', $article_dynamic_url . '/uservote.php?id=' . $article->getVar('articleid'));
    //作家专栏
    if ($article->getVar('authorid') > 0) {
        $jieqiTpl->assign('url_authorpage', $article_dynamic_url . '/authorpage.php?id=' . $article->getVar('authorid'));
    } else {
        $jieqiTpl->assign('url_authorpage', '#');
    }
    //打包下载
    if ($article->getVar('chapters', 'n') > 0) {
        if ($jieqiConfigs['article']['makehtml'] == 0) {
            $jieqiTpl->assign('url_download', '#');
        } else {
            $jieqiTpl->assign('url_download', jieqi_uploadurl($jieqiConfigs['article']['zipdir'], $jieqiConfigs['article']['zipurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . $jieqi_file_postfix['zip']);
        }
    } else {
        $jieqiTpl->assign('url_download', '#');
    }
    //电子书部分
    $articletype = intval($article->getVar('articletype'));
    if (($articletype & 1) > 0) {
        $hasebook = 1;
    } else {
        $hasebook = 0;
    }
    if (($articletype & 2) > 0) {
        $hasobook = 1;
    } else {
        $hasobook = 0;
    }
    if (($articletype & 4) > 0) {
        $hastbook = 1;
    } else {
        $hastbook = 0;
    }
    if ($hasobook == 1) {
        include_once $GLOBALS['jieqiModules']['obook']['path'] . '/class/obook.php';
        $obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler');
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('articleid', $article->getVar('articleid'), '='));
        $obook_handler->queryObjects($criteria);
        $obook = $obook_handler->getObject();
        if (is_object($obook) && $obook->getVar('display') == 0 && $obook->getVar('size') > 0) {
            $jieqiTpl->assign('obook_obookid', $obook->getVar('obookid'));
            $jieqiTpl->assign('obook_lastvolume', $obook->getVar('lastvolume'));
            $jieqiTpl->assign('obook_lastvolumeid', $obook->getVar('lastvolumeid'));
            $jieqiTpl->assign('obook_lastchapter', $obook->getVar('lastchapter'));
            $jieqiTpl->assign('obook_lastchapterid', $obook->getVar('lastchapterid'));
            $jieqiTpl->assign('obook_lastupdate', date(JIEQI_DATE_FORMAT, $obook->getVar('lastupdate')));
            $jieqiTpl->assign('obook_size', $obook->getVar('size'));
            $jieqiTpl->assign('obook_publishid', $obook->getVar('publishid'));
        } else {
            $hasobook = 0;
        }
    }
    $jieqiTpl->assign('articletype', $articletype);
    $jieqiTpl->assign('hasebook', $hasebook);
    $jieqiTpl->assign('hasobook', $hasobook);
    $jieqiTpl->assign('hastbook', $hastbook);
    $jieqiTpl->assign('url_goodreview', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid') . '&type=good');
    $jieqiTpl->assign('url_allreview', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid') . '&type=all');
    $jieqiTpl->assign('url_review', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid'));
    if (!empty($_SESSION['jieqiUserId'])) {
        $jieqiTpl->assign('enablepost', 1);
    } else {
        $jieqiTpl->assign('enablepost', 0);
    }
    $jieqiTpl->setCaching(0);
    $jieqiTpl->assign('jieqi_contents', $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/staticinfo.html'));
    ob_start();
    include JIEQI_ROOT_PATH . '/footer.php';
    $pagecontent = ob_get_contents();
    ob_end_clean();
    if (!empty($jieqiConfigs['article']['fakeprefix'])) {
        $dirname = JIEQI_ROOT_PATH . '/' . $jieqiConfigs['article']['fakeprefix'] . 'info';
    } else {
        $dirname = JIEQI_ROOT_PATH . '/files/article/info';
    }
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname = $dirname . jieqi_getsubdir($article->getVar('articleid', 'n'));
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname .= '/' . $article->getVar('articleid', 'n') . $jieqiConfigs['article']['fakefile'];
    jieqi_writefile($dirname, $pagecontent);
    return true;
}
示例#4
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     global $jieqiSort;
     include_once $GLOBALS['jieqiModules']['obook']['path'] . '/class/obook.php';
     jieqi_getconfigs('obook', 'configs');
     $obook_static_url = empty($jieqiConfigs['obook']['staticurl']) ? $GLOBALS['jieqiModules']['obook']['url'] : $jieqiConfigs['obook']['staticurl'];
     $obook_dynamic_url = empty($jieqiConfigs['obook']['dynamicurl']) ? $GLOBALS['jieqiModules']['obook']['url'] : $jieqiConfigs['obook']['dynamicurl'];
     $jieqiTpl->assign('obook_static_url', $obook_static_url);
     $jieqiTpl->assign('obook_dynamic_url', $obook_dynamic_url);
     $tmpvar = explode('-', date('Y-m-d', JIEQI_NOW_TIME));
     $daystart = mktime(0, 0, 0, (int) $tmpvar[1], (int) $tmpvar[2], (int) $tmpvar[0]);
     $monthstart = mktime(0, 0, 0, (int) $tmpvar[1], 1, (int) $tmpvar[0]);
     $tmpvar = date('w', JIEQI_NOW_TIME);
     if ($tmpvar == 0) {
         $tmpvar = 7;
     }
     //星期天是0,国人习惯作为作为一星期的最后一天
     $weekstart = $daystart;
     if ($tmpvar > 1) {
         $weekstart -= ($tmpvar - 1) * 86400;
     }
     $obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler');
     $sql = 'SELECT * FROM ' . jieqi_dbprefix('obook_obook') . ' WHERE display=0 AND size>0';
     if (!empty($this->exevars['sortid'])) {
         $sortstr = '';
         $sortnum = 0;
         $sortary = explode('|', $this->exevars['sortid']);
         foreach ($sortary as $v) {
             if (is_numeric($v)) {
                 if (!empty($sortstr)) {
                     $sortstr .= ' OR ';
                 }
                 $sortstr .= 'sortid=' . intval($v);
                 $sortnum++;
             }
         }
         if ($sortnum == 1) {
             $sql .= ' AND ' . $sortstr;
         } elseif ($sortnum > 1) {
             $sql .= ' AND (' . $sortstr . ')';
         }
     }
     if (isset($this->exevars['publishid']) && $this->exevars['publishid'] !== '') {
         $publishstr = '';
         $publishnum = 0;
         $publishary = explode('|', $this->exevars['publishid']);
         foreach ($publishary as $v) {
             if (is_numeric($v)) {
                 if (!empty($publishstr)) {
                     $publishstr .= ' OR ';
                 }
                 $publishstr .= 'publishid=' . intval($v);
                 $publishnum++;
             }
         }
         if ($publishnum == 1) {
             $sql .= ' AND ' . $publishstr;
         } elseif ($publishnum > 1) {
             $sql .= ' AND (' . $publishstr . ')';
         }
     }
     if ($this->exevars['isfull'] == 1) {
         $sql .= ' AND fullflag=1';
     } elseif ($this->exevars['isfull'] == 2) {
         $sql .= ' AND fullflag=0';
     }
     switch ($this->exevars['field']) {
         case 'monthsale':
             $sql .= ' AND lastsale>=' . $monthstart;
             break;
         case 'weeksale':
             $sql .= ' AND lastsale>=' . $weekstart;
             break;
         case 'daysale':
             $sql .= ' AND lastsale>=' . $daystart;
             break;
     }
     $sql .= ' ORDER BY ' . $this->exevars['field'];
     if ($this->exevars['asc'] == 1) {
         $sql .= ' ASC';
     } else {
         $sql .= ' DESC';
     }
     $sql .= ' LIMIT 0, ' . $this->exevars['listnum'];
     $res = $obook_handler->db->query($sql);
     jieqi_getconfigs('obook', 'sort');
     $obookrows = array();
     $k = 0;
     while ($v = $obook_handler->getObject($res)) {
         $obookrows[$k]['order'] = $k + 1;
         $obookrows[$k]['obookid'] = $v->getVar('obookid');
         //文章序号
         $obookrows[$k]['obookname'] = $v->getVar('obookname');
         //文章名称
         $obookrows[$k]['articleid'] = $v->getVar('articleid');
         //文章序号
         if ($jieqiConfigs['obook']['fakeinfo'] == 1) {
             $obookrows[$k]['obooksubdir'] = jieqi_getsubdir($v->getVar('obookid'));
             //子目录
             if (!empty($jieqiConfigs['obook']['fakeprefix'])) {
                 $tmpvar = '/' . $jieqiConfigs['obook']['fakeprefix'] . 'info';
             } else {
                 $tmpvar = '/files/obook/info';
             }
             $obookrows[$k]['url_obookinfo'] = $obook_dynamic_url . $tmpvar . $obookrows[$k]['obooksubdir'] . '/' . $v->getVar('obookid') . $jieqiConfigs['obook']['fakefile'];
             //子目录
         } else {
             $obookrows[$k]['obooksubdir'] = '';
             $obookrows[$k]['url_obookinfo'] = $obook_dynamic_url . '/obookinfo.php?id=' . $v->getVar('obookid');
             //子目录
         }
         if ($v->getVar('lastchapter') == '') {
             $obookrows[$k]['lastchapterid'] = 0;
             //章节序号
             $obookrows[$k]['lastchapter'] = '';
             //章节名称
             $obookrows[$k]['url_lastchapter'] = '';
             //章节地址
         } else {
             $obookrows[$k]['lastchapterid'] = $v->getVar('lastchapterid');
             $obookrows[$k]['lastchapter'] = $v->getVar('lastchapter');
             $obookrows[$k]['url_lastchapter'] = $obook_static_url . '/reader.php?aid=' . $v->getVar('obookid') . '&cid=' . $v->getVar('lastchapterid');
         }
         //公众章节
         if ($obookrows[$k]['articleid'] > 0) {
             if ($jieqiConfigs['article']['makehtml'] == 0 || JIEQI_CHAR_SET != JIEQI_SYSTEM_CHARSET) {
                 $obookrows[$k]['url_read'] = $article_static_url . '/reader.php?aid=' . $obookrows[$k]['articleid'];
             } else {
                 $obookrows[$k]['url_read'] = jieqi_uploadurl($jieqiConfigs['article']['htmldir'], $jieqiConfigs['article']['htmlurl'], 'article', $article_static_url) . jieqi_getsubdir($obookrows[$k]['articleid']) . '/' . $obookrows[$k]['articleid'] . '/index' . $jieqiConfigs['article']['htmlfile'];
             }
         }
         $obookrows[$k]['lastvolume'] = $v->getVar('lastvolumeid');
         //分卷序号
         $obookrows[$k]['lastvolume'] = $v->getVar('lastvolume');
         //分卷名称
         $obookrows[$k]['authorid'] = $v->getVar('authorid');
         //作者
         $obookrows[$k]['author'] = $v->getVar('author');
         $obookrows[$k]['posterid'] = $v->getVar('posterid');
         //发表者
         $obookrows[$k]['poster'] = $v->getVar('poster');
         $obookrows[$k]['agentid'] = $v->getVar('agentid');
         //代理者
         $obookrows[$k]['agent'] = $v->getVar('agent');
         $obookrows[$k]['sortid'] = $v->getVar('sortid');
         //类别序号
         $obookrows[$k]['sort'] = $jieqiSort['obook'][$v->getVar('sortid')]['shortname'];
         //类别
         $obookrows[$k]['size'] = $v->getVar('size');
         $obookrows[$k]['size_k'] = ceil($v->getVar('size') / 1024);
         $obookrows[$k]['size_c'] = ceil($v->getVar('size') / 2);
         $obookrows[$k]['daysale'] = $v->getVar('daysale');
         $obookrows[$k]['weeksale'] = $v->getVar('weeksale');
         $obookrows[$k]['monthsale'] = $v->getVar('monthsale');
         $obookrows[$k]['sumegold'] = $v->getVar('sumegold');
         $obookrows[$k]['sumesilver'] = $v->getVar('sumesilver');
         $obookrows[$k]['sumemoney'] = $obookrows[$k]['sumegold'] + $obookrows[$k]['sumesilver'];
         $obookrows[$k]['payprice'] = $v->getVar('payprice');
         $obookrows[$k]['allsale'] = $v->getVar('allsale');
         $obookrows[$k]['lastupdate'] = date('y-m-d', $v->getVar('lastupdate'));
         //最后更新日期
         $obookrows[$k]['update'] = date('m-d', $v->getVar('lastupdate'));
         //最后更新日期
         $obookrows[$k]['display'] = $v->getVar('display');
         $obookrows[$k]['url_image'] = jieqi_uploadurl($jieqiConfigs['obook']['imagedir'], $jieqiConfigs['obook']['imageurl'], 'obook', $obook_static_url) . jieqi_getsubdir($v->getVar('obookid')) . '/' . $v->getVar('obookid') . '/' . $v->getVar('obookid') . 's' . $jieqiConfigs['obook']['imagetype'];
         $k++;
     }
     $jieqiTpl->assign_by_ref('obookrows', $obookrows);
     $toptype = $this->exevars['field'];
     if ($jieqiConfigs['obook']['faketoplist'] == 1) {
         if (!empty($jieqiConfigs['obook']['fakeprefix'])) {
             $tmpvar = '/' . $jieqiConfigs['obook']['fakeprefix'] . 'top' . $toptype;
         } else {
             $tmpvar = '/files/obook/top' . $toptype;
         }
         $jieqiTpl->assign('url_more', $obook_dynamic_url . $tmpvar . '/0/1' . $jieqiConfigs['obook']['fakefile']);
     } else {
         $jieqiTpl->assign('url_more', $obook_dynamic_url . '/obooklist.php?sort=' . $toptype);
     }
 }