示例#1
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);
 }
示例#2
0
        $criteria->add(new Criteria('authorid', $_SESSION['jieqiUserId'], '='), 'OR');
        $criteria->add(new Criteria('posterid', $_SESSION['jieqiUserId'], '='), 'OR');
        $criteria->add(new Criteria('agentid', $_SESSION['jieqiUserId'], '='), 'OR');
        $articletitle = $jieqiLang['article']['my_all_article'];
}
$jieqiTpl->assign('articletitle', $articletitle);
$jieqiTpl->assign('url_article', $article_dynamic_url . '/masterpage.php');
$criteria->setSort('initial ASC,articlename');
$criteria->setOrder('ASC');
$criteria->setLimit($jieqiConfigs['article']['pagenum']);
$criteria->setStart(($_REQUEST['page'] - 1) * $jieqiConfigs['article']['pagenum']);
$article_handler->queryObjects($criteria);
$articlerows = array();
$k = 0;
while ($v = $article_handler->getObject()) {
    $articlerows[$k] = jieqi_article_vars($v);
    $articlerows[$k]['checkid'] = $k;
    //显示序号
    $articlerows[$k]['operate'] = ' <a href="' . $article_static_url . '/articlemanage.php?id=' . $v->getVar('articleid') . '" target="_blank">' . $jieqiLang['article']['my_article_manage'] . '</a>';
    $k++;
}
$jieqiTpl->assign_by_ref('articlerows', $articlerows);
//处理页面跳转
include_once JIEQI_ROOT_PATH . '/lib/html/page.php';
$jumppage = new JieqiPage($article_handler->getCount($criteria), $jieqiConfigs['article']['pagenum'], $_REQUEST['page']);
$jumppage->setlink('', true, true);
$jieqiTpl->assign('url_jumppage', $jumppage->whole_bar());
$jieqiTpl->assign('authorarea', 1);
$jieqiTpl->setCaching(0);
$jieqiTset['jieqi_contents_template'] = $jieqiModules['article']['path'] . '/templates/masterpage.html';
include_once JIEQI_ROOT_PATH . '/footer.php';
示例#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);
     $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));
 }
示例#4
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;
}
示例#5
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;
}
示例#6
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']);
 }