case 'makereview': if (!is_numeric($_REQUEST['reviewstart']) || !is_numeric($_REQUEST['reviewstop'])) { jieqi_printfail($jieqiLang['article']['create_review_idnum']); } $_REQUEST['reviewstart'] = intval($_REQUEST['reviewstart']); $_REQUEST['reviewstop'] = intval($_REQUEST['reviewstop']); if ($_REQUEST['reviewtart'] > $_REQUEST['reviewstop']) { jieqi_printfail($jieqiLang['article']['create_id_numerror']); } include_once $jieqiModules['article']['path'] . '/include/staticmakereview.php'; echo $header_str; echo sprintf($jieqiLang['article']['create_review_doing'], $_REQUEST['reviewstart'], $_REQUEST['reviewstop']); ob_flush(); flush(); for ($i = $_REQUEST['reviewstart']; $i <= $_REQUEST['reviewstop']; $i++) { makestaticreview($i); echo $i . '..'; ob_flush(); flush(); } jieqi_msgwin(LANG_DO_SUCCESS, $jieqiLang['article']['create_review_success']); break; case 'makesort': include_once JIEQI_ROOT_PATH . '/header.php'; $_REQUEST['maxsortpage'] = intval($_REQUEST['maxsortpage']); echo $header_str; echo sprintf($jieqiLang['article']['create_sort_doing'], '1', $_REQUEST['maxsortpage']); ob_flush(); flush(); include_once $jieqiModules['article']['path'] . '/include/staticmakeindex.php'; $i = 1;
function makeIndex($dynamic = false, $show = false) { global $jieqiConfigs; global $jieqiSort; global $jieqiTpl; global $jieqi_file_postfix; if (!isset($jieqiSort['article'])) { jieqi_getconfigs('article', 'sort'); } if (!in_array($jieqiConfigs['article']['htmlfile'], array('.html', '.htm', '.shtml'))) { $jieqiConfigs['article']['htmlfile'] = '.html'; } if (!is_object($jieqiTpl)) { include_once JIEQI_ROOT_PATH . '/lib/template/template.php'; $jieqiTpl =& JieqiTpl::getInstance(); } //生成index.html $articlename = jieqi_htmlstr($this->metas['dc:Title']); //文章序号及名称 $jieqiTpl->assign('dynamic_url', ARTICLE_DYNAMIC_URL); $jieqiTpl->assign('static_url', ARTICLE_STATIC_URL); $jieqiTpl->assign('article_title', $articlename); $jieqiTpl->assign('sortid', intval($this->metas['dc:Sortid'])); if (!empty($jieqiSort['article'][$this->metas['dc:Sortid']]['caption'])) { $jieqiTpl->assign('sortname', $jieqiSort['article'][$this->metas['dc:Sortid']]['caption']); } $jieqiTpl->assign('articleid', $this->id); $jieqiTpl->assign('chapterid', 0); $jieqiTpl->assign('authorid', intval($this->metas['dc:Creatorid'])); $jieqiTpl->assign('author', jieqi_htmlstr($this->metas['dc:Creator'])); $jieqiTpl->assign('fullflag', intval($this->metas['dc:Fullflag'])); $jieqiTpl->assign('keywords', jieqi_htmlstr($this->metas['dc:Subject'])); $jieqiTpl->assign('intro', jieqi_htmlstr($this->metas['dc:Description'])); $jieqiTpl->assign('posterid', intval($this->metas['dc:Contributorid'])); $jieqiTpl->assign('poster', jieqi_htmlstr($this->metas['dc:Contributor'])); $jieqiTpl->assign('typeid', intval($this->metas['dc:Typeid'])); $jieqiTpl->assign('permission', intval($this->metas['dc:Permission'])); $jieqiTpl->assign('firstflag', intval($this->metas['dc:Firstflag'])); $jieqiTpl->assign('imgflag', intval($this->metas['dc:Imgflag'])); $jieqiTpl->assign('power', intval($this->metas['dc:Power'])); $articletype = intval($this->metas['dc:Articletype']); $jieqiTpl->assign('articletype', $articletype); if (($articletype & 1) > 0) { $jieqiTpl->assign('hasebook', 1); } else { $jieqiTpl->assign('hasebook', 0); } if (($articletype & 2) > 0) { $jieqiTpl->assign('hasobook', 1); } else { $jieqiTpl->assign('hasobook', 0); } if (($articletype & 4) > 0) { $jieqiTpl->assign('hastbook', 1); } else { $jieqiTpl->assign('hastbook', 0); } $jieqiTpl->assign('copy_info', JIEQI_META_COPYRIGHT); $indexrows = array(); $i = 0; $idx = 0; if (isset($jieqiConfigs['article']['indexcols']) && $jieqiConfigs['article']['indexcols'] > 0) { $cols = intval($jieqiConfigs['article']['indexcols']); } else { $cols = 4; } $this->preid = 0; //前一章 $this->nextid = 0; //下一章 $preview_page = ''; $next_page = ''; $lastvolume = ''; $lastchapter = ''; $lastchapterid = 0; $txtdir = $this->getDir('txtdir', true, false); foreach ($this->chapters as $k => $chapter) { //分卷 if ($chapter['content-type'] == 'volume') { if ($i > 0) { $idx++; } $i = 0; $indexrows[$idx]['ctype'] = 'volume'; $indexrows[$idx]['vurl'] = ''; $indexrows[$idx]['vname'] = $chapter['id']; $indexrows[$idx]['vid'] = $this->getCid($chapter['href']); $lastvolume = $chapter['id']; $idx++; } else { $k = $k + 1; if ($k < $this->nowid) { $this->preid = $k; } elseif ($k > $this->nowid && $this->nextid == 0) { $this->nextid = $k; } $tmpvar = $this->getCid($chapter['href']); $i++; $indexrows[$idx]['ctype'] = 'chapter'; $indexrows[$idx]['cname' . $i] = $chapter['id']; $indexrows[$idx]['cid' . $i] = $tmpvar; /* if(true){ //检查文本文件获得章节字数,更新时间和简介 $txtfile=$txtdir.'/'.$chapter['href']; if(is_file($txtfile)){ $indexrows[$idx]['time'.$i] = filemtime($txtfile); $indexrows[$idx]['size'.$i] = filesize($txtfile); $indexrows[$idx]['size_c'.$i] = ceil($indexrows[$idx]['size'.$i]/2); $indexrows[$idx]['intro'.$i] = htmlspecialchars(str_replace(array("\r","\n"),' ',jieqi_substr(jieqi_readfile($txtfile), 0, 200, '...')), ENT_QUOTES); }else{ $indexrows[$idx]['time'.$i] = 0; $indexrows[$idx]['size'.$i] = 0; $indexrows[$idx]['size_c'.$i] = 0; $indexrows[$idx]['intro'.$i] = 'no'; } } */ $lastchapter = $chapter['id']; $lastchapterid = $tmpvar; if ($dynamic) { $indexrows[$idx]['curl' . $i] = ARTICLE_STATIC_URL . '/reader.php?aid=' . $this->id . '&cid=' . $tmpvar; if (empty($next_page)) { $next_page = ARTICLE_STATIC_URL . '/reader.php?aid=' . $this->id . '&cid=' . $tmpvar; } $preview_page = ARTICLE_STATIC_URL . '/reader.php?aid=' . $this->id . '&cid=' . $tmpvar; } else { $indexrows[$idx]['curl' . $i] = $tmpvar . $jieqiConfigs['article']['htmlfile']; if (empty($next_page)) { $next_page = $tmpvar . $jieqiConfigs['article']['htmlfile']; } $preview_page = $tmpvar . $jieqiConfigs['article']['htmlfile']; } if ($i == $cols) { $idx++; $i = 0; } } } $lastvolume = jieqi_htmlstr($lastvolume); $lastchapter = jieqi_htmlstr($lastchapter); $lastchapterid = intval($lastchapterid); if (!empty($lastvolume)) { $lastchapter = $lastvolume . ' ' . $lastchapter; } $jieqiTpl->assign('lastchapter', $lastchapter); $jieqiTpl->assign('lastchapterid', $lastchapterid); if ($dynamic) { $jieqiTpl->assign('url_lastchapter', ARTICLE_STATIC_URL . '/reader.php?aid=' . $this->id . '&cid=' . $lastchapterid); } else { $jieqiTpl->assign('url_lastchapter', $lastchapterid . $jieqiConfigs['article']['htmlfile']); } //如果有关联电子书的处理 if (file_exists(JIEQI_ROOT_PATH . '/files/obook/articlelink') && $jieqiConfigs['article']['obookindex'] == 1) { $linkfile = JIEQI_ROOT_PATH . '/files/obook/articlelink' . jieqi_getsubdir($this->id) . '/' . $this->id . '.php'; if (file_exists($linkfile)) { global $jieqiObookdata; include_once $linkfile; jieqi_getconfigs('obook', 'configs'); $obook_static_url = empty($jieqiConfigs['obook']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['obook']['staticurl']; $obook_dynamic_url = empty($jieqiConfigs['obook']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['obook']['dynamicurl']; if ($i > 0) { $idx++; } $i = 0; $indexrows[$idx]['ctype'] = 'volume'; $indexrows[$idx]['vurl'] = ''; $indexrows[$idx]['vname'] = '<span class="hottext">[VIP章节目录 | <a href="' . $GLOBALS['jieqiModules']['obook']['url'] . '/obookinfo.php?aid=' . $this->id . '" target="_blank">查看本书信息</a> | <a href="' . $GLOBALS['jieqiModules']['pay']['url'] . '/buyegold.php" target="_blank">我的帐户充值</a>]</span>'; $idx++; foreach ($jieqiObookdata['ochapter'] as $chapter) { if ($chapter['display'] == 0) { $i++; $indexrows[$idx]['ctype'] = 'chapter'; $indexrows[$idx]['cname' . $i] = jieqi_htmlstr($chapter['chaptername']); $indexrows[$idx]['curl' . $i] = $obook_static_url . '/reader.php?aid=' . intval($jieqiObookdata['obook']['obookid']) . '&cid=' . intval($chapter['ochapterid']); if ($i == $cols) { $idx++; $i = 0; } } } } } $jieqiTpl->assign_by_ref('indexrows', $indexrows); //页面跳转 if ($dynamic) { $index_page = ARTICLE_STATIC_URL . '/reader.php?aid=' . $this->id; } else { $index_page = 'index' . $jieqiConfigs['article']['htmlfile']; } $jieqiTpl->assign('preview_page', $preview_page); $jieqiTpl->assign('next_page', $next_page); $jieqiTpl->assign('index_page', $index_page); $jieqiTpl->assign('article_id', $this->id); $jieqiTpl->assign('chapter_id', '0'); $jieqiTpl->assign('new_url', JIEQI_LOCAL_URL); //全文阅读 $jieqiTpl->assign('url_fullpage', jieqi_uploadurl($jieqiConfigs['article']['fulldir'], $jieqiConfigs['article']['fullurl'], 'article', ARTICLE_STATIC_URL) . jieqi_getsubdir($this->id) . '/' . $this->id . $jieqiConfigs['article']['htmlfile']); //打包下载 $jieqiTpl->assign('url_download', jieqi_uploadurl($jieqiConfigs['article']['zipdir'], $jieqiConfigs['article']['zipurl'], 'article', ARTICLE_STATIC_URL) . jieqi_getsubdir($this->id) . '/' . $this->id . $jieqi_file_postfix['zip']); $jieqiTpl->assign('articlesubdir', jieqi_getsubdir($this->id)); $jieqiTpl->assign('url_articleinfo', jieqi_geturl('article', 'article', $this->id, 'info')); $jieqiTpl->assign('url_bookroom', ARTICLE_DYNAMIC_URL . '/'); //自己页面 if ($show) { $jieqiTpl->assign('url_thispage', ARTICLE_STATIC_URL . '/reader.php?aid=' . $this->id); } else { $jieqiTpl->assign('url_thispage', $this->getDir('htmldir') . '/index' . $jieqiConfigs['article']['htmlfile']); } //<!--jieqi insert license check--> $jieqiTpl->setCaching(0); if ($show) { $jieqiTpl->display($GLOBALS['jieqiModules']['article']['path'] . '/templates/index.html'); } else { $htmldir = $this->getDir('htmldir'); $jieqiTpl->assign('jieqi_charset', JIEQI_SYSTEM_CHARSET); jieqi_writefile($htmldir . '/index' . $jieqiConfigs['article']['htmlfile'], $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/index.html')); } //生成静态文章信息页 $jieqiConfigs['article']['staticinfo'] //if(is_file($GLOBALS['jieqiModules']['article']['path'].'/include/staticmakeinfo.php') && is_file($GLOBALS['jieqiModules']['article']['path'].'/templates/staticinfo.html')){ if ($jieqiConfigs['article']['fakeinfo'] == 2) { include_once $GLOBALS['jieqiModules']['article']['path'] . '/include/staticmakeinfo.php'; makestaticinfo($this->id); if (!empty($jieqiConfigs['article']['fakeprefix'])) { $dirname = JIEQI_ROOT_PATH . '/' . $jieqiConfigs['article']['fakeprefix'] . 'info'; } else { $dirname = JIEQI_ROOT_PATH . '/files/article/info'; } $dirname = $dirname . jieqi_getsubdir($this->id); $dirname .= '/' . $this->id . 'r.js'; if (!file_exists($dirname)) { include_once $GLOBALS['jieqiModules']['article']['path'] . '/include/staticmakereview.php'; makestaticreview($this->id); } } }
<?php /** * 生成静态最新书评 * * 生成静态最新书评 * * 调用模板:/modules/article/templates/staticreview.html * * @category jieqicms * @package article * @copyright Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://www.jieqi.com) * @author $Author: juny $ * @version $Id: staticreview.php 228 2008-11-27 06:44:31Z juny $ */ include_once 'review.php'; include_once $jieqiModules['article']['path'] . '/include/staticmakereview.php'; makestaticreview($_REQUEST['aid']);