Exemplo n.º 1
0
 function setContent()
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     if (empty($_SESSION['jieqiUserId'])) {
         return false;
     } else {
         jieqi_getconfigs('article', 'configs');
         $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);
         include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/article.php';
         $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
         $criteria = new CriteriaCompo(new Criteria('authorid', $_SESSION['jieqiUserId']));
         $article_handler->queryObjects($criteria);
         $articles = array();
         $i = 0;
         while ($v = $article_handler->getObject()) {
             $articles[$i]['url'] = $article_static_url . '/articlemanage.php?id=' . $v->getVar('articleid');
             $articles[$i]['caption'] = $v->getVar('articlename');
             $articles[$i]['goodnum'] = $v->getVar('goodnum');
             $articles[$i]['lastupdate'] = $v->getVar('lastupdate');
             $articles[$i]['id'] = $v->getVar('articleid');
             $i++;
         }
         $jieqiTpl->assign_by_ref('articles', $articles);
     }
 }
Exemplo n.º 2
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     global $jieqiSort;
     jieqi_getconfigs('article', 'configs');
     jieqi_getconfigs('article', 'sort');
     $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);
     include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/article.php';
     //载入相关处理函数
     include_once $GLOBALS['jieqiModules']['article']['path'] . '/include/funarticle.php';
     $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('authorid', $this->blockvars['cacheid']));
     if ($this->exevars['isfull'] == 1) {
         $criteria->add(new Criteria('isfull', 1));
     } elseif ($this->exevars['isfull'] == 2) {
         $criteria->add(new Criteria('isfull', 0));
     }
     $criteria->setSort($this->exevars['field']);
     if ($this->exevars['asc'] == 1) {
         $criteria->setOrder('ASC');
     } else {
         $criteria->setOrder('DESC');
     }
     $criteria->setLimit($this->exevars['listnum']);
     $criteria->setStart(0);
     $article_handler->queryObjects($criteria);
     $articlerows = array();
     $k = 0;
     while ($v = $article_handler->getObject()) {
         $articlerows[$k] = jieqi_article_vars($v);
         $articlerows[$k]['order'] = $k + 1;
         if ($this->exevars['field'] == 'goodnew') {
             $articlerows[$k]['visitnum'] = $v->getVar('allvisit');
         } else {
             $articlerows[$k]['visitnum'] = $v->getVar($this->exevars['field']);
         }
         if ($this->exevars['field'] == 'size') {
             $articlerows[$k]['visitnum'] = ceil($articlerows[$k]['visitnum'] / 1024) . 'K';
         } elseif ($this->exevars['field'] == 'lastupdate' || $this->exevars['field'] == 'postdate' || $this->exevars['field'] == 'toptime') {
             $articlerows[$k]['visitnum'] = date('m-d', $articlerows[$k]['visitnum']);
         }
         $k++;
     }
     $jieqiTpl->assign_by_ref('articlerows', $articlerows);
     $jieqiTpl->assign('ownerid', $this->blockvars['cacheid']);
 }
Exemplo n.º 3
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     global $jieqiSort;
     include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/article.php';
     //载入相关处理函数
     include_once $GLOBALS['jieqiModules']['article']['path'] . '/include/funarticle.php';
     jieqi_getconfigs('article', 'configs');
     jieqi_getconfigs('article', 'sort');
     $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);
     $articlerows = array();
     if (count($this->exevars) > 0) {
         $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
         $sql = 'SELECT * FROM ' . jieqi_dbprefix('article_article') . ' WHERE articleid IN (0,' . implode(',', $this->exevars) . ')';
         $sql .= ' LIMIT 0, 100';
         $res = $article_handler->db->query($sql);
         $k = 0;
         while ($v = $article_handler->getObject($res)) {
             $articlerows[$k] = jieqi_article_vars($v);
             $articlerows[$k]['order'] = $k + 1;
             $k++;
         }
     }
     $i = 0;
     $maxrow = count($articlerows);
     $sortrows = array();
     foreach ($this->exevars as $aid) {
         $k = 0;
         while ($k < $maxrow && $articlerows[$k]['articleid'] != $aid) {
             $k++;
         }
         if ($k < $maxrow) {
             $articlerows[$k]['order'] = $i + 1;
             $sortrows[$i] =& $articlerows[$k];
             $i++;
         }
     }
     $jieqiTpl->assign_by_ref('articlerows', $sortrows);
 }
Exemplo n.º 4
0
if (!is_array($_REQUEST['packflag']) || count($_REQUEST['packflag']) < 1) {
    exit;
}
$_REQUEST['id'] = intval($_REQUEST['id']);
@ignore_user_abort(true);
@set_time_limit(3600);
@session_write_close();
@ini_set('memory_limit', '64M');
echo '                                                                                                                                                                                                                                                                                                            ';
ob_flush();
flush();
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/article.php';
include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/chapter.php';
include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/package.php';
$article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
$article = $article_handler->get($_REQUEST['id']);
if (!is_object($article)) {
    exit;
} else {
    $package = new JieqiPackage($_REQUEST['id']);
    $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')), false);
    $chapter_handler =& JieqiChapterHandler::getInstance('JieqiChapterHandler');
    $criteria = new CriteriaCompo(new Criteria('articleid', $_REQUEST['id'], '='));
    $criteria->setSort('chapterorder ASC, chapterid');
    $criteria->setOrder('ASC');
    $res = $chapter_handler->queryObjects($criteria);
    $i = 0;
    $articlesize = 0;
    while ($chapter = $chapter_handler->getObject($res)) {
        if ($chapter->getVar('chaptertype', 'n') == 1) {
Exemplo n.º 5
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     global $jieqiSort;
     include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/article.php';
     //载入相关处理函数
     include_once $GLOBALS['jieqiModules']['article']['path'] . '/include/funarticle.php';
     jieqi_getconfigs('article', 'configs');
     jieqi_getconfigs('article', 'sort');
     $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);
     $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;
     }
     $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
     $sql = 'SELECT * FROM ' . jieqi_dbprefix('article_article') . ' 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 ($this->exevars['isauthor'] == 1) {
         $sql .= ' AND authorid>0';
     } elseif ($this->exevars['isauthor'] == 2) {
         $sql .= ' AND authorid=0';
     }
     if ($this->exevars['isfull'] == 1) {
         $sql .= ' AND fullflag=1';
     } elseif ($this->exevars['isfull'] == 2) {
         $sql .= ' AND fullflag=0';
     }
     //授权许可
     if (strlen($this->exevars['permission']) > 0) {
         $perstr = '';
         $pernum = 0;
         $perary = explode('|', $this->exevars['permission']);
         foreach ($perary as $v) {
             if (is_numeric($v)) {
                 if (!empty($perstr)) {
                     $perstr .= ' OR ';
                 }
                 $perstr .= 'permission=' . intval($v);
                 $pernum++;
             }
         }
         if ($pernum == 1) {
             $sql .= ' AND ' . $perstr;
         } elseif ($pernum > 1) {
             $sql .= ' AND (' . $perstr . ')';
         }
     }
     //是否首发
     if (strlen($this->exevars['firstflag']) > 0) {
         $sql .= ' AND firstflag=' . intval($this->exevars['firstflag']);
     }
     //状态标志
     if (strlen($this->exevars['power']) > 0) {
         $sql .= ' AND power=' . intval($this->exevars['power']);
     }
     switch ($this->exevars['field']) {
         case 'monthvisit':
             $sql .= ' AND lastvisit>=' . $monthstart;
             $sql .= ' ORDER BY ' . $this->exevars['field'];
             break;
         case 'monthvote':
             $sql .= ' AND lastvote>=' . $monthstart;
             $sql .= ' ORDER BY ' . $this->exevars['field'];
             break;
         case 'weekvisit':
             $sql .= ' AND lastvisit>=' . $weekstart;
             $sql .= ' ORDER BY ' . $this->exevars['field'];
             break;
         case 'weekvote':
             $sql .= ' AND lastvote>=' . $weekstart;
             $sql .= ' ORDER BY ' . $this->exevars['field'];
             break;
         case 'dayvisit':
             $sql .= ' AND lastvisit>=' . $daystart;
             $sql .= ' ORDER BY ' . $this->exevars['field'];
             break;
         case 'dayvote':
             $sql .= ' AND lastvote>=' . $daystart;
             $sql .= ' ORDER BY ' . $this->exevars['field'];
             break;
         case 'goodnew':
             $sql .= ' AND postdate>=' . (JIEQI_NOW_TIME - 3600 * 24 * 30);
             $sql .= ' ORDER BY allvisit + allvote * 10 + goodnum * 20';
             break;
         default:
             $sql .= ' ORDER BY ' . $this->exevars['field'];
             break;
     }
     if ($this->exevars['asc'] == 1) {
         $sql .= ' ASC';
     } else {
         $sql .= ' DESC';
     }
     $sql .= ' LIMIT 0, ' . $this->exevars['listnum'];
     $res = $article_handler->db->query($sql);
     $articlerows = array();
     $k = 0;
     while ($v = $article_handler->getObject($res)) {
         $articlerows[$k] = jieqi_article_vars($v);
         $articlerows[$k]['order'] = $k + 1;
         if ($this->exevars['field'] == 'goodnew') {
             $articlerows[$k]['visitnum'] = $v->getVar('allvisit');
         } else {
             $articlerows[$k]['visitnum'] = $v->getVar($this->exevars['field']);
         }
         if ($this->exevars['field'] == 'size') {
             $articlerows[$k]['visitnum'] = ceil($articlerows[$k]['visitnum'] / 1024) . 'K';
         } elseif ($this->exevars['field'] == 'lastupdate' || $this->exevars['field'] == 'postdate' || $this->exevars['field'] == 'toptime' || $this->exevars['field'] == 'lastvote') {
             $articlerows[$k]['visitnum'] = date('m-d', $articlerows[$k]['visitnum']);
         }
         $k++;
     }
     $jieqiTpl->assign_by_ref('articlerows', $articlerows);
     $topsort = $this->exevars['field'];
     if ($topsort == 'lastupdate') {
         if ($this->exevars['isauthor'] == 1) {
             $topsort = 'authorupdate';
         } elseif ($this->exevars['isauthor'] == 2) {
             $topsort = 'masterupdate';
         }
     }
     $jieqiTpl->assign('url_more', jieqi_geturl('article', 'toplist', 1, $topsort));
 }
Exemplo n.º 6
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;
}
Exemplo n.º 7
0
function article_repack($id, $params = array(), $syn = 0)
{
    global $jieqiConfigs;
    global $jieqiModules;
    global $jieqi_file_postfix;
    if (!$syn) {
        $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['staticurl'];
        $url = $article_static_url . '/makepack.php?key=' . urlencode(md5(JIEQI_DB_USER . JIEQI_DB_PASS . JIEQI_DB_NAME)) . '&id=' . intval($id);
        $url = trim($url);
        if (strtolower(substr($url, 0, 7)) != 'http://') {
            $url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
        }
        foreach ($params as $k => $v) {
            if ($v) {
                $url .= '&packflag[]=' . urlencode($k);
            }
        }
        return jieqi_socket_url($url);
    } else {
        $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
        $article = $article_handler->get($id);
        if (!is_object($article)) {
            return false;
        } else {
            $package = new JieqiPackage($id);
            $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')), false);
            $chapter_handler =& JieqiChapterHandler::getInstance('JieqiChapterHandler');
            $criteria = new CriteriaCompo(new Criteria('articleid', $id, '='));
            $criteria->setSort('chapterorder ASC, chapterid');
            $criteria->setOrder('ASC');
            $res = $chapter_handler->queryObjects($criteria);
            $i = 0;
            $articlesize = 0;
            while ($chapter = $chapter_handler->getObject($res)) {
                if ($chapter->getVar('chaptertype', 'n') == 1) {
                    $contenttype = 'volume';
                } else {
                    $contenttype = 'chapter';
                }
                $package->chapters[$i] = array('id' => $chapter->getVar('chaptername', 'n'), 'href' => $chapter->getVar('chapterid', 'n') . $jieqi_file_postfix['txt'], 'media-type' => 'text/html', 'content-type' => $contenttype);
                $i++;
                if ($chapter->getVar('chaptertype', 'n') == 0) {
                    $articlesize = $articlesize + intval($chapter->getVar('size', 'n'));
                }
                if ($chapter->getVar('chapterorder', 'n') != $i) {
                    $chapter->setVar('chapterorder', $i);
                    $chapter_handler->insert($chapter);
                }
            }
            //检查文章信息和统计的是否对应
            $changeflag = false;
            if ($article->getVar('chapters', 'n') != $i) {
                $article->setVar('chapters', $i);
                $changeflag = true;
            }
            if ($article->getVar('size', 'n') != $articlesize) {
                $article->setVar('size', $articlesize);
                $changeflag = true;
            }
            if ($changeflag) {
                $article_handler->insert($article);
            }
            //开始生成
            $package->isload = true;
            //生成opf
            if ($params['makeopf']) {
                $package->createOPF();
            }
            if ($params['makehtml']) {
                $chaptercount = count($package->chapters);
                for ($i = 1; $i <= $chaptercount; $i++) {
                    if ($package->chapters[$i - 1]['content-type'] == 'chapter') {
                        $package->makeHtml($i, false, false, true);
                    }
                }
                //生成html目录
                $package->makeIndex();
            }
            //生成zip
            if ($params['makezip']) {
                $package->makezip();
            }
            //生成全文阅读
            if ($params['makefull']) {
                $package->makefulltext();
            }
            //生成umd
            if ($params['makeumd']) {
                $package->makeumd();
            }
            //生成txt全文
            if ($params['maketxtfull']) {
                $package->maketxtfull();
            }
            //生成jar
            if ($params['makejar']) {
                $package->makejar();
            }
            return true;
        }
    }
}
Exemplo n.º 8
0
function makestatictoplist($sort = '', $class = '', $thispage = 0, $maxpage = 0)
{
    global $jieqiConfigs;
    global $jieqiSort;
    global $jieqiTpl;
    global $jieqiBlocks;
    if (!is_object($jieqiTpl)) {
        $jieqiTpl =& JieqiTpl::getInstance();
    }
    //排序方式
    if (empty($sort)) {
        $sort = 'lastupdate';
    }
    //类别
    if (empty($class) || !is_numeric($class)) {
        $class = 0;
    }
    //页码
    if (empty($thispage) || !is_numeric($thispage)) {
        $thispage = 1;
    }
    //是否缓存
    $content_used_cache = false;
    $jieqiTpl->setCaching(0);
    $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('fakefile', $jieqiConfigs['article']['fakefile']);
    $jieqiTpl->assign('fakeinfo', $jieqiConfigs['article']['fakeinfo']);
    $jieqiTpl->assign('fakesort', $jieqiConfigs['article']['fakesort']);
    $jieqiTpl->assign('fakeinitial', $jieqiConfigs['article']['fakeinitial']);
    $jieqiTpl->assign('faketoplist', $jieqiConfigs['article']['faketoplist']);
    $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
    $criteria = new CriteriaCompo(new Criteria('display', '0', '='));
    $criteria->add(new Criteria('size', '0', '>'));
    //类别
    jieqi_getconfigs('article', 'sort');
    if (!empty($class) && is_numeric($class)) {
        $criteria->add(new Criteria('sortid', $class, '='));
        $classinfo = ' - ' . $jieqiSort['article'][$class]['caption'];
    } else {
        $class = 0;
        $classinfo = '';
    }
    $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;
    }
    switch ($sort) {
        case 'allvisit':
            $criteria->setSort('allvisit');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_allvisit_title'], $classinfo));
            break;
        case 'monthvisit':
            $criteria->add(new Criteria('lastvisit', $monthstart, '>='));
            $criteria->setSort('monthvisit');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_monthvisit_title'], $classinfo));
            break;
        case 'weekvisit':
            $criteria->add(new Criteria('lastvisit', $weekstart, '>='));
            $criteria->setSort('weekvisit');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_weekvisit_title'], $classinfo));
            break;
        case 'dayvisit':
            $criteria->add(new Criteria('lastvisit', $daystart, '>='));
            $criteria->setSort('dayvisit');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_dayvisit_title'], $classinfo));
            break;
        case 'allauthorvisit':
            $criteria->add(new Criteria('authorid', '0', '>'));
            $criteria->setSort('allvisit');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_avall_title'], $classinfo));
            break;
        case 'monthauthorvisit':
            $criteria->add(new Criteria('lastvisit', $monthstart, '>='));
            $criteria->add(new Criteria('authorid', '0', '>'));
            $criteria->setSort('monthvisit');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_avmonth_title'], $classinfo));
            break;
        case 'weekauthorvisit':
            $criteria->add(new Criteria('lastvisit', $weekstart, '>='));
            $criteria->add(new Criteria('authorid', '0', '>'));
            $criteria->setSort('weekvisit');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_avweek_title'], $classinfo));
            break;
        case 'dayauthorvisit':
            $criteria->add(new Criteria('lastvisit', $daystart, '>='));
            $criteria->add(new Criteria('authorid', '0', '>'));
            $criteria->setSort('dayvisit');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_avday_title'], $classinfo));
            break;
        case 'allvote':
            $criteria->setSort('allvote');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_voteall_title'], $classinfo));
            break;
        case 'monthvote':
            $criteria->add(new Criteria('lastvote', $monthstart, '>='));
            $criteria->setSort('monthvote');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_votemonth_title'], $classinfo));
            break;
        case 'weekvote':
            $criteria->add(new Criteria('lastvote', $weekstart, '>='));
            $criteria->setSort('weekvote');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_voteweek_title'], $classinfo));
            break;
        case 'dayvote':
            $criteria->add(new Criteria('lastvote', $daystart, '>='));
            $criteria->setSort('dayvote');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_voteday_titile'], $classinfo));
            break;
        case 'postdate':
            $criteria->setSort('postdate');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_postdate_title'], $classinfo));
            break;
        case 'toptime':
            $criteria->setSort('toptime');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_toptime_title'], $classinfo));
            break;
        case 'goodnum':
            $criteria->setSort('goodnum');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_goodnum_title'], $classinfo));
            break;
        case 'size':
            $criteria->setSort('size');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_size_title'], $classinfo));
            break;
        case 'authorupdate':
            $criteria->setSort('lastupdate');
            $criteria->add(new Criteria('authorid', '0', '>'));
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_authorupdate_title'], $classinfo));
            break;
        case 'masterupdate':
            $criteria->setSort('lastupdate');
            $criteria->add(new Criteria('authorid', '0', '='));
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_masterupdate_title'], $classinfo));
            break;
        case 'lastupdate':
        default:
            $_REQUEST['sort'] = 'lastupdate';
            $criteria->setSort('lastupdate');
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_lastupdate_title'], $classinfo));
            break;
    }
    $criteria->setOrder('DESC');
    $criteria->setLimit($jieqiConfigs['article']['pagenum']);
    $criteria->setStart(($thispage - 1) * $jieqiConfigs['article']['pagenum']);
    $article_handler->queryObjects($criteria);
    $articlerows = array();
    $k = 0;
    while ($v = $article_handler->getObject()) {
        $articlerows[$k] = jieqi_article_vars($v);
        $k++;
    }
    $jieqiTpl->assign_by_ref('articlerows', $articlerows);
    //处理页面跳转
    $toplistrows = $article_handler->getCount($criteria);
    $truemaxpage = ceil($toplistrows / $jieqiConfigs['article']['pagenum']);
    $maxpage = intval($maxpage);
    if (!empty($maxpage) && $maxpage < $truemaxpage) {
        $toplistrows = $maxpage * $jieqiConfigs['article']['pagenum'];
    } else {
        $maxpage = $truemaxpage;
    }
    $jumppage = new JieqiPage($toplistrows, $jieqiConfigs['article']['pagenum'], $thispage, 10, $jieqiConfigs['article']['fakefile']);
    if (!empty($jieqiConfigs['article']['fakeprefix'])) {
        $dirname = '/' . $jieqiConfigs['article']['fakeprefix'] . 'top' . $sort;
    } else {
        $dirname = '/files/article/top' . $sort;
    }
    $jumppage->setlink($article_dynamic_url . $dirname);
    $jieqiTpl->assign('url_jumppage', $jumppage->whole_bar());
    $jieqiTpl->assign('jieqi_contents', $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/toplist.html'));
    ob_start();
    include JIEQI_ROOT_PATH . '/footer.php';
    $pagecontent = ob_get_contents();
    ob_end_clean();
    $dirname = JIEQI_ROOT_PATH . $dirname;
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname = $dirname . jieqi_getsubdir($thispage);
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname .= '/' . $thispage . $jieqiConfigs['article']['fakefile'];
    jieqi_writefile($dirname, $pagecontent);
    return $maxpage;
}
Exemplo n.º 9
0
function makestaticindex($class, $initial, $fullflag, $thispage, $maxpage = 0)
{
    global $jieqiConfigs;
    global $jieqiSort;
    global $jieqiTpl;
    global $jieqiBlocks;
    if (!is_object($jieqiTpl)) {
        $jieqiTpl =& JieqiTpl::getInstance();
    }
    //文章类别
    if (empty($class) || !is_numeric($class)) {
        $class = 0;
    }
    //页码
    if (empty($thispage) || !is_numeric($thispage)) {
        $thispage = 1;
    }
    if (empty($fullflag)) {
        $fullflag = 0;
    } else {
        $fullflag = 1;
    }
    //cache名称
    $cache_id = $fullflag;
    if (isset($initial) && trim(strval($initial)) != '') {
        if ($initial == '~' || $initial == '0') {
            $cache_id .= '_i0';
        } else {
            $cache_id .= '_i' . $initial;
        }
    } else {
        $cache_id .= '_s' . $class;
    }
    $pagecacheid = $cache_id;
    $cache_id .= '_p' . $thispage;
    if (!empty($class)) {
        $jieqi_pagetitle = $jieqiSort['article'][$class]['caption'] . '&gt;&gt;' . JIEQI_SITE_NAME;
        $jieqiTpl->assign('jieqi_pagetitle', $jieqi_pagetitle);
    }
    $jieqiTpl->setCaching(0);
    $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('fakefile', $jieqiConfigs['article']['fakefile']);
    $jieqiTpl->assign('fakeinfo', $jieqiConfigs['article']['fakeinfo']);
    $jieqiTpl->assign('fakesort', $jieqiConfigs['article']['fakesort']);
    $jieqiTpl->assign('fakeinitial', $jieqiConfigs['article']['fakeinitial']);
    $jieqiTpl->assign('faketoplist', $jieqiConfigs['article']['faketoplist']);
    $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
    $criteria = new CriteriaCompo(new Criteria('display', '0', '='));
    $criteria->add(new Criteria('size', '0', '>'));
    if (!empty($fullflag)) {
        $criteria->add(new Criteria('fullflag', '1', '='));
        $fulltitle = $jieqiLang['article']['list_full_title'];
    } else {
        $fulltitle = '';
    }
    if (!empty($initial)) {
        $criteria->add(new Criteria('initial', strtoupper($initial), '='));
        if ($initial == '1') {
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['list_numeric_title'], $fulltitle));
        } elseif ($initial == '~') {
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['list_other_title'], $fulltitle));
        } else {
            $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['list_char_title'], $initial, $fulltitle));
        }
        $criteria->setSort('articlename');
        $criteria->setOrder('ASC');
    } elseif (!empty($class)) {
        $criteria->add(new Criteria('sortid', $class, '='));
        $jieqiTpl->assign('articletitle', $jieqiSort['article'][$class]['caption'] . $fulltitle);
        $criteria->setSort('lastupdate');
        $criteria->setOrder('DESC');
    } else {
        $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['list_all_title'], $fulltitle));
        $criteria->setSort('lastupdate');
        $criteria->setOrder('DESC');
    }
    $criteria->setLimit($jieqiConfigs['article']['pagenum']);
    $criteria->setStart(($thispage - 1) * $jieqiConfigs['article']['pagenum']);
    $article_handler->queryObjects($criteria);
    $articlerows = array();
    $k = 0;
    while ($v = $article_handler->getObject()) {
        $articlerows[$k] = jieqi_article_vars($v);
        $k++;
    }
    $jieqiTpl->assign_by_ref('articlerows', $articlerows);
    $jieqiTpl->assign('url_initial', $article_dynamic_url . '/index.php?initial=');
    //处理页面跳转
    $toplistrows = $article_handler->getCount($criteria);
    $truemaxpage = ceil($toplistrows / $jieqiConfigs['article']['pagenum']);
    $maxpage = intval($maxpage);
    if (!empty($maxpage) && $maxpage < $truemaxpage) {
        $toplistrows = $maxpage * $jieqiConfigs['article']['pagenum'];
    } else {
        $maxpage = $truemaxpage;
    }
    if (!empty($initial)) {
        $jumppage = new JieqiPage($toplistrows, $jieqiConfigs['article']['pagenum'], $thispage, 10, $jieqiConfigs['article']['fakefile']);
        if ($initial == '~') {
            $tmpvar = '0';
        } else {
            $tmpvar = $initial;
        }
        if (!empty($jieqiConfigs['article']['fakeprefix'])) {
            $dirname = '/' . $jieqiConfigs['article']['fakeprefix'] . 'initial' . $tmpvar;
        } else {
            $dirname = '/files/article/initial' . $tmpvar;
        }
        $jumppage->setlink($article_dynamic_url . $dirname);
    } else {
        $jumppage = new JieqiPage($toplistrows, $jieqiConfigs['article']['pagenum'], $thispage, 10, $jieqiConfigs['article']['fakefile']);
        if (!empty($class)) {
            $tmpvar = $class;
        } else {
            $tmpvar = '';
        }
        if (!empty($jieqiConfigs['article']['fakeprefix'])) {
            $dirname = '/' . $jieqiConfigs['article']['fakeprefix'] . 'sort' . $tmpvar;
        } else {
            $dirname = '/files/article/sort' . $tmpvar;
        }
        $jumppage->setlink($article_dynamic_url . $dirname);
    }
    $jieqiTpl->assign('url_jumppage', $jumppage->whole_bar());
    $jieqiTpl->assign('jieqi_contents', $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/articlelist.html'));
    ob_start();
    include JIEQI_ROOT_PATH . '/footer.php';
    $pagecontent = ob_get_contents();
    ob_end_clean();
    $dirname = JIEQI_ROOT_PATH . $dirname;
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname = $dirname . jieqi_getsubdir($thispage);
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname .= '/' . $thispage . $jieqiConfigs['article']['fakefile'];
    jieqi_writefile($dirname, $pagecontent);
    return $maxpage;
}
Exemplo n.º 10
0
/**
 * 根据文章ID获得文章封面图片url
 * 
 * @param      int        $aid 文章id
 * @param      string     $type 显示类型 s - 小图, l - 大图
 * @param      int        $flag 图片类型标志 -1 则自动判断
 * @access     public
 * @return     string
 */
function jieqi_url_article_cover($aid, $type = 's', $flag = -1)
{
    global $jieqiConfigs;
    global $article_dynamic_url;
    global $article_static_url;
    $nocover = $article_static_url . '/images/nocover.jpg';
    if ($flag < 0) {
        global $article;
        if (!is_a($article, 'JieqiArticle')) {
            include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/article.php';
            $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
            $article = $article_handler->get($aid);
            if (is_object($article)) {
                $flag = $article->getVar('imgflag', 'n');
            }
        }
    }
    $flag = intval($flag);
    if ($flag <= 0) {
        return $nocover;
    }
    $imageinfo = array('stype' => '', 'ltype' => '');
    if (($flag & 1) > 0) {
        $imageinfo['stype'] = $jieqiConfigs['article']['imagetype'];
    }
    if (($flag & 2) > 0) {
        $imageinfo['ltype'] = $jieqiConfigs['article']['imagetype'];
    }
    $imgtype = $flag >> 2;
    if ($imgtype > 0) {
        $imgtary = array(1 => '.gif', 2 => '.jpg', 3 => '.jpeg', 4 => '.png', 5 => '.bmp');
        $tmpvar = round($imgtype & 7);
        if (isset($imgtary[$tmpvar])) {
            $imageinfo['stype'] = $imgtary[$tmpvar];
        }
        $tmpvar = round($imgtype >> 3);
        if (isset($imgtary[$tmpvar])) {
            $imageinfo['ltype'] = $imgtary[$tmpvar];
        }
    }
    switch ($type) {
        case 'l':
            if (!empty($imageinfo['ltype'])) {
                return jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($aid) . '/' . $aid . '/' . $aid . 'l' . $imageinfo['ltype'];
            } elseif (!empty($imageinfo['stype'])) {
                return jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($aid) . '/' . $aid . '/' . $aid . 's' . $imageinfo['stype'];
            } else {
                return '';
            }
            break;
        case 's':
        default:
            if (!empty($imageinfo['stype'])) {
                return jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($aid) . '/' . $aid . '/' . $aid . 's' . $imageinfo['stype'];
            } else {
                return $nocover;
            }
            break;
    }
}