Exemplo n.º 1
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     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);
     $sorts = array('allvisit', 'monthvisit', 'weekvisit', 'dayvisit', 'allauthorvisit', 'monthauthorvisit', 'weekauthorvisit', 'dayauthorvisit', 'allvote', 'monthvote', 'weekvote', 'dayvote', 'postdate', 'lastupdate', 'authorupdate', 'masterupdate', 'goodnum', 'size', 'weekrate', 'monthrate', 'toptime');
     foreach ($sorts as $sort) {
         $jieqiTpl->assign('url_' . $sort, jieqi_geturl('article', 'toplist', 1, $sort));
     }
 }
Exemplo n.º 2
0
 function setContent($isreturn = false)
 {
     global $jieqiSort;
     global $jieqiTpl;
     global $jieqiConfigs;
     jieqi_getconfigs('article', 'sort');
     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);
     $sortrows = array();
     $jieqiTpl->assign('url_articlelist', jieqi_geturl('article', 'articlelist', 1, 0));
     $i = 0;
     foreach ($jieqiSort['article'] as $k => $v) {
         $sortrows[$i] = array('sortid' => $k, 'sortname' => $v['caption'], 'url_sort' => jieqi_geturl('article', 'articlelist', 1, $k), 'sortlayer' => $v['layer']);
         $i++;
     }
     $jieqiTpl->assign_by_ref('sortrows', $sortrows);
 }
Exemplo n.º 3
0
    $articlerows[$k]['postdate'] = date(JIEQI_DATE_FORMAT . ' ' . JIEQI_TIME_FORMAT, $v->getVar('postdate'));
    //发表时间
    $articlerows[$k]['lastupdate'] = date(JIEQI_DATE_FORMAT . ' ' . JIEQI_TIME_FORMAT, $v->getVar('lastupdate'));
    //更新时间
    $articlerows[$k]['size'] = $v->getVar('size');
    //字数
    $articlerows[$k]['size_k'] = ceil($v->getVar('size') / 1024);
    //字数
    $articlerows[$k]['size_c'] = ceil($v->getVar('size') / 2);
    //字数
    $articlerows[$k]['chaptertype'] = $v->getVar('chaptertype');
    //章节类型
    $articlerows[$k]['url_articleinfo'] = jieqi_geturl('article', 'article', $v->getVar('articleid'), 'info');
    //子目录
    if ($articlerows[$k]['chaptertype'] == 0) {
        $articlerows[$k]['url_lastchapter'] = jieqi_geturl('article', 'chapter', $v->getVar('chapterid'), $v->getVar('articleid'));
        $articlerows[$k]['typename'] = $jieqiLang['article']['chapter_name'];
    } else {
        $articlerows[$k]['url_lastchapter'] = '#';
        $articlerows[$k]['typename'] = $jieqiLang['article']['volume_name'];
    }
    $k++;
}
$jieqiTpl->assign_by_ref('articlerows', $articlerows);
//处理页面跳转
include_once JIEQI_ROOT_PATH . '/lib/html/page.php';
$jumppage = new JieqiPage($chapter_handler->getCount($criteria), $jieqiConfigs['article']['pagenum'], $_REQUEST['page']);
$pagelink = '';
if (!empty($_REQUEST['keyword'])) {
    if (empty($pagelink)) {
        $pagelink .= '?';
Exemplo n.º 4
0
    $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 . '/articlelist.php?initial=');
    //处理页面跳转
    include_once JIEQI_ROOT_PATH . '/lib/html/page.php';
    if (JIEQI_USE_CACHE) {
        jieqi_getcachevars('article', 'articlelistlog');
        if (!is_array($jieqiArticlelistlog)) {
            $jieqiArticlelistlog = array();
        }
        if (!isset($jieqiArticlelistlog[$pagecacheid]) || JIEQI_NOW_TIME - $jieqiArticlelistlog[$pagecacheid]['time'] > JIEQI_CACHE_LIFETIME) {
            $jieqiArticlelistlog[$pagecacheid] = array('rows' => $article_handler->getCount($criteria), 'time' => JIEQI_NOW_TIME);
            jieqi_setcachevars('articlelistlog', 'jieqiArticlelistlog', $jieqiArticlelistlog, 'article');
        }
        $toplistrows = $jieqiArticlelistlog[$pagecacheid]['rows'];
    } else {
        $toplistrows = $article_handler->getCount($criteria);
    }
    $jumppage = new JieqiPage($toplistrows, $jieqiConfigs['article']['pagenum'], $_REQUEST['page']);
    if (!empty($_REQUEST['initial']) && !empty($jieqiConfigs['article']['fakeinitial'])) {
        $jumppage->setlink(jieqi_geturl('article', 'initial', 0, $_REQUEST['initial']));
    } elseif (empty($_REQUEST['fullflag']) && !empty($jieqiConfigs['article']['fakesort'])) {
        $jumppage->setlink(jieqi_geturl('article', 'articlelist', 0, $_REQUEST['class']));
    }
    $jieqiTpl->assign('url_jumppage', $jumppage->whole_bar());
}
include_once JIEQI_ROOT_PATH . '/footer.php';
Exemplo n.º 5
0
            $setting = unserialize($article->getVar('setting', 'n'));
            $setting['avoteid'] = 0;
            $article->setVar('setting', serialize($setting));
            $article_handler->insert($article);
            break;
    }
}
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
include_once JIEQI_ROOT_PATH . '/header.php';
$article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['staticurl'];
$article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
$jieqiTpl->assign('article_static_url', $article_static_url);
$jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
$jieqiTpl->assign('articleid', $article->getVar('articleid'));
$jieqiTpl->assign('articlename', $article->getVar('articlename'));
$jieqiTpl->assign('url_articleinfo', jieqi_geturl('article', 'article', $article->getVar('articleid'), 'info'));
include_once $jieqiModules['article']['path'] . '/class/avote.php';
$avote_handler =& JieqiAvoteHandler::getInstance('JieqiAvoteHandler');
$criteria = new CriteriaCompo(new Criteria('articleid', $_REQUEST['id'], '='));
$criteria->setSort('voteid');
$criteria->setOrder('DESC');
$avote_handler->queryObjects($criteria);
$voterows = array();
$k = 0;
while ($vote = $avote_handler->getObject()) {
    $voterows[$k]['order'] = $k + 1;
    $voterows[$k]['voteid'] = $vote->getVar('voteid');
    $voterows[$k]['posttime'] = $vote->getVar('posttime');
    $voterows[$k]['title'] = $vote->getVar('title');
    $voterows[$k]['useitem'] = $vote->getVar('useitem');
    $voterows[$k]['ispublish'] = $vote->getVar('ispublish');
Exemplo n.º 6
0
    $res = $article_handler->queryObjects($criteria);
    $allresults = $article_handler->db->getRowsNum($res);
    if ($allresults <= $jieqiConfigs['article']['pagenum']) {
        $rescount = $allresults;
    } else {
        $rescount = $jieqiConfigs['article']['pagenum'];
    }
    $_REQUEST['page'] = 1;
}
if ($rescount == 1) {
    //只有一个搜索结果直接指向文章信息页面
    $article = $article_handler->getObject();
    if (!is_object($article)) {
        jieqi_printfail($jieqiLang['article']['no_search_result']);
    }
    $url_articleinfo = jieqi_geturl('article', 'article', $article->getVar('articleid'), 'info');
    header('Location: ' . $url_articleinfo);
    if (!$usecache) {
        $aids = $article->getVar('articleid');
        $cleancache = false;
        if (is_object($searchcache)) {
            //以前有缓存,更新
            $searchcache->setVar('searchtime', JIEQI_NOW_TIME);
            $searchcache->setVar('results', $allresults);
            $searchcache->setVar('aids', $aids);
            if (date('s', JIEQI_NOW_TIME) == '00') {
                $cleancache = true;
            }
        } else {
            //以前没缓存,增加
            $searchcache = $searchcache_handler->create();
Exemplo n.º 7
0
 function makefulltext($dynamic = false, $show = false, $vid = 0)
 {
     if (JIEQI_MODULE_VTYPE == '' || JIEQI_MODULE_VTYPE == 'Free') {
         return true;
     }
     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();
     }
     if (!$this->isload) {
         $this->loadOPF();
     }
     //生成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('book_title', '<a name="articletitle">' . $articlename . '</a>');
     $jieqiTpl->assign('copy_info', JIEQI_META_COPYRIGHT);
     $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('new_url', JIEQI_LOCAL_URL);
     //目录阅读
     $jieqiTpl->assign('url_indexpage', jieqi_uploadurl($jieqiConfigs['article']['htmldir'], $jieqiConfigs['article']['htmlurl'], 'article', ARTICLE_STATIC_URL) . jieqi_getsubdir($this->id) . '/' . $this->id . '/index' . $jieqiConfigs['article']['htmlfile']);
     //全文阅读
     $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']);
     //自己页面
     if ($show) {
         $jieqiTpl->assign('url_thispage', ARTICLE_STATIC_URL . '/reader.php?aid=' . $this->id);
     } else {
         $jieqiTpl->assign('url_thispage', $this->getDir('fulldir', false) . '/' . $this->id . $jieqiConfigs['article']['htmlfile']);
     }
     $indexrows = array();
     $idx = 0;
     $i = 0;
     if (isset($jieqiConfigs['article']['indexcols']) && $jieqiConfigs['article']['indexcols'] > 0) {
         $cols = $jieqiConfigs['article']['indexcols'];
     } else {
         $cols = 4;
     }
     $chapters = array();
     $n = 0;
     $txtdir = $this->getDir('txtdir', true, false);
     $vname = '';
     if ($vid > 0) {
         $cstart = false;
     } else {
         $cstart = true;
     }
     foreach ($this->chapters as $k => $chapter) {
         //分卷
         $chapterid = $this->getCid($this->chapters[$k]['href']);
         if ($vid > 0) {
             if ($chapterid == $vid) {
                 $cstart = true;
             } elseif ($cstart == true && $chapter['content-type'] == 'volume') {
                 $cstart = false;
             }
             if (!$cstart) {
                 continue;
             }
         }
         if ($chapter['content-type'] == 'volume') {
             if ($i > 0) {
                 $idx++;
             }
             $i = 0;
             $indexrows[$idx]['ctype'] = 'volume';
             $indexrows[$idx]['vurl'] = '';
             $indexrows[$idx]['vname'] = $chapter['id'];
             $idx++;
             if ($chapter['id'] != $vname) {
                 $vname = $chapter['id'];
             }
         } else {
             $i++;
             $indexrows[$idx]['ctype'] = 'chapter';
             $indexrows[$idx]['cname' . $i] = $chapter['id'];
             $indexrows[$idx]['curl' . $i] = '#' . $chapterid;
             if ($i == $cols) {
                 $idx++;
                 $i = 0;
             }
             if (!empty($vname)) {
                 $tmpvar = $vname . ' ';
             } else {
                 $tmpvar = '';
             }
             $chapters[$n]['title'] = '<a name="' . $chapterid . '">' . $tmpvar . $chapter['id'] . '</a>';
             if (file_exists($txtdir . '/' . $chapterid . $jieqi_file_postfix['txt'])) {
                 $chapters[$n]['content'] = jieqi_htmlstr(jieqi_readfile($txtdir . '/' . $chapterid . $jieqi_file_postfix['txt']));
                 //使链接可点击
                 $patterns = array("/([^]_a-z0-9-=\"'\\/])([a-z]+?):\\/\\/([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\│]+)/i", "/([^]_a-z0-9-=\"'\\/])www\\.([a-z0-9\\-]+)\\.([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\│]+)/i", "/([^]_a-z0-9-=\"'\\/])ftp\\.([a-z0-9\\-]+)\\.([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\│]+)/i", "/([^]_a-z0-9-=\"'\\/:\\.])([a-z0-9\\-_\\.]+?)@([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\│]+)/i");
                 $replacements = array("\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", "\\1<a href=\"http://www.\\2.\\3\" target=\"_blank\">www.\\2.\\3</a>", "\\1<a href=\"ftp://ftp.\\2.\\3\" target=\"_blank\">ftp.\\2.\\3</a>", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>");
                 $chapters[$n]['content'] = preg_replace($patterns, $replacements, $chapters[$n]['content']);
             } else {
                 $chapters[$n]['content'] = '';
             }
             $attachurl = jieqi_uploadurl($jieqiConfigs['article']['attachdir'], $jieqiConfigs['article']['attachurl'], 'article') . jieqi_getsubdir($this->id) . '/' . $this->id . '/' . $chapterid;
             if (!$jieqiConfigs['article']['packdbattach']) {
                 //检查附件(从文件)
                 $attachdir = jieqi_uploadpath($jieqiConfigs['article']['attachdir'], 'article') . jieqi_getsubdir($this->id) . '/' . $this->id . '/' . $chapterid;
                 if (is_dir($attachdir)) {
                     $attachimage = '';
                     $attachfile = '';
                     $files = array();
                     $dirhandle = @opendir($attachdir);
                     while ($file = @readdir($dirhandle)) {
                         if ($file != '.' && $file != '..') {
                             $files[] = $file;
                         }
                     }
                     @closedir($dirhandle);
                     sort($files);
                     foreach ($files as $file) {
                         if (is_file($attachdir . '/' . $file)) {
                             $url = $attachurl . '/' . $file;
                             if (eregi("\\.(gif|jpg|jpeg|png|bmp)\$", $file)) {
                                 $attachimage .= '<div class="divimage" id="' . $file . '" title="' . $url . '"><a style="cursor: pointer;" onclick="imgclickshow(\'' . $file . '\', \'' . $url . '\')">' . $url . '</a>(' . ceil(filesize($attachdir . '/' . $file) / 1024) . 'K)</div>';
                             } else {
                                 $attachfile .= '<strong>file:</strong><a href="' . $url . '">' . $url . '</a>(' . ceil(filesize($attachdir . '/' . $file) / 1024) . 'K)<br /><br />';
                             }
                         }
                     }
                     if (!empty($attachimage) || !empty($attachfile)) {
                         if (!empty($chapters[$n]['content'])) {
                             $chapters[$n]['content'] .= '<br /><br />';
                         }
                         $chapters[$n]['content'] .= $attachimage . $attachfile;
                     }
                 }
             } else {
                 //检查附件,从数据库
                 global $package_query;
                 $sql = "SELECT attachment FROM " . jieqi_dbprefix('article_chapter') . " WHERE chapterid=" . intval($chapterid);
                 $res = $package_query->execute($sql);
                 $row = $package_query->db->fetchArray($res);
                 $attachary = array();
                 if (!empty($row['attachment'])) {
                     $attachary = unserialize($row['attachment']);
                 }
                 if (is_array($attachary) && count($attachary) > 0) {
                     $attachimage = '';
                     $attachfile = '';
                     foreach ($attachary as $attachvar) {
                         $url = $attachurl . '/' . $attachvar['attachid'] . '.' . $attachvar['postfix'];
                         if ($attachvar['class'] == 'image') {
                             $attachimage .= '<strong>image:</strong><a href="' . $url . '" target="_blank">' . $url . '</a>(' . ceil($attachvar['size'] / 1024) . 'K)<br /><br />';
                         } else {
                             $attachfile .= '<strong>file:</strong><a href="' . $url . '">' . $url . '</a>(' . ceil($attachvar['size'] / 1024) . 'K)<br /><br />';
                         }
                     }
                     if (!empty($attachimage) || !empty($attachfile)) {
                         if (!empty($chapters[$n]['content'])) {
                             $chapters[$n]['content'] .= '<br /><br />';
                         }
                         $chapters[$n]['content'] .= $attachimage . $attachfile;
                     }
                 }
             }
             $n++;
         }
     }
     $jieqiTpl->assign_by_ref('indexrows', $indexrows);
     $jieqiTpl->assign_by_ref('chapters', $chapters);
     $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 . '/');
     $jieqiTpl->setCaching(0);
     if ($show) {
         $jieqiTpl->display($GLOBALS['jieqiModules']['article']['path'] . '/templates/fulltext.html');
     } else {
         $htmldir = $this->getDir('fulldir', false);
         $jieqiTpl->assign('jieqi_charset', JIEQI_SYSTEM_CHARSET);
         jieqi_writefile($htmldir . '/' . $this->id . $jieqiConfigs['article']['htmlfile'], $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/fulltext.html'));
     }
 }
Exemplo n.º 8
0
/**
 * 传入帖子实例对象,返回适合模板赋值的帖子信息数组
 * 
 * @param      object      $post 帖子实例
 * @param      array       $configs 配置参数
 * @param      array       $addvars 附加赋值变量
 * @param      bool        $enableubb 是否允许解析UBB代码
 * @access     public
 * @return     array
 */
function jieqi_post_vars($post, $configs = array(), $addvars = array(), $enableubb = true)
{
    global $jieqiTxtcvt;
    global $jieqiHonors;
    global $jieqiGroups;
    global $jieqiModules;
    if (!isset($jieqiHonors)) {
        jieqi_getconfigs('system', 'honors', 'jieqiHonors');
    }
    if (!defined('JIEQI_SHOW_BADGE')) {
        if (!empty($jieqiModules['badge']['publish']) && is_file($GLOBALS['jieqiModules']['badge']['path'] . '/include/badgefunction.php')) {
            include_once $jieqiModules['badge']['path'] . '/include/badgefunction.php';
            define('JIEQI_SHOW_BADGE', 1);
        } else {
            define('JIEQI_SHOW_BADGE', 0);
        }
    }
    if (is_array($addvars)) {
        $ret = $addvars;
    } else {
        $ret = array();
    }
    $ret['postid'] = $post->getVar('postid');
    $ret['siteid'] = $post->getVar('siteid');
    $ret['istopic'] = $post->getVar('istopic');
    $ret['replypid'] = $post->getVar('replypid');
    $ret['ownerid'] = $post->getVar('ownerid');
    $ret['userid'] = intval($post->getVar('uid'));
    $ret['posterid'] = $post->getVar('posterid');
    $ret['poster'] = $ret['username'];
    $ret['posttime'] = $post->getVar('posttime');
    $ret['posterip'] = $post->getVar('posterip');
    $ret['editorid'] = $post->getVar('editorid');
    $ret['editor'] = $post->getVar('editor');
    $ret['edittime'] = $post->getVar('edittime');
    $ret['editorip'] = $post->getVar('editorip');
    $ret['editnote'] = $post->getVar('editnote');
    $ret['iconid'] = $post->getVar('iconid');
    $ret['subject'] = jieqi_substr($post->getVar('subject'), 0, 56);
    $ret['size'] = $post->getVar('size');
    $ret['attachimages'] = array();
    $ret['attachfiles'] = array();
    $tmpvar = $post->getVar('attachment', 'n');
    if (!empty($tmpvar)) {
        $attachs = unserialize($tmpvar);
        foreach ($attachs as $key => $val) {
            $url = jieqi_uploadurl($configs['attachdir'], $configs['attachurl'], JIEQI_MODULE_NAME) . '/' . date('Ymd', $post->getVar('posttime', 'n')) . '/' . $post->getVar('postid', 'n') . '_' . $val['attachid'] . '.' . $val['postfix'];
            if ($val['class'] == 'image') {
                $ret['attachimages'][] = array('id' => $val['attachid'], 'name' => jieqi_htmlstr($val['name']), 'url' => $url, 'posttime' => $post->getVar('posttime', 'n'), 'postid' => $post->getVar('postid', 'n'), 'postfix' => $val['postfix'], 'class' => $val['class'], 'size' => $val['size'], 'size_k' => ceil($val['size'] / 1024));
            } else {
                $ret['attachfiles'][] = array('id' => $val['attachid'], 'name' => jieqi_htmlstr($val['name']), 'url' => $url, 'posttime' => $post->getVar('posttime', 'n'), 'postid' => $post->getVar('postid', 'n'), 'postfix' => $val['postfix'], 'class' => $val['class'], 'size' => $val['size'], 'size_k' => ceil($val['size'] / 1024));
            }
        }
    }
    if ($enableubb) {
        if (!is_object($jieqiTxtcvt)) {
            include_once JIEQI_ROOT_PATH . '/lib/text/textconvert.php';
            $jieqiTxtcvt = TextConvert::getInstance('TextConvert');
        }
        $ret['posttext'] = $jieqiTxtcvt->displayTarea($post->getVar('posttext', 'n'), 0, 1, 1, 1, 1, 'screen.width*0.75');
    } else {
        if (!is_object($jieqiTxtcvt)) {
            include_once JIEQI_ROOT_PATH . '/lib/text/textconvert.php';
            $jieqiTxtcvt = TextConvert::getInstance('TextConvert');
        }
        $ret['posttext'] = jieqi_htmlstr(preg_replace(array('/\\[\\/?(code|url|color|font|align|email|b|i|u|d|img|quote|size)[^\\[\\]]*\\]/is'), '', $post->getVar('posttext', 'n')));
        $ret['posttext'] = $jieqiTxtcvt->smile(preg_replace('/https?:\\/\\/[^\\s\\r\\n\\t\\f<>]+/i', '<a href="\\0">\\0</a>', $ret['posttext']));
    }
    //加入文字水印
    if (!empty($configs['textwatermark']) && !defined('JIEQI_WAP_PAGE')) {
        $contentary = explode('<br />
<br />', $ret['posttext']);
        $ret['posttext'] = '';
        foreach ($contentary as $v) {
            if (empty($ret['posttext'])) {
                $ret['posttext'] .= $v;
            } else {
                srand((double) microtime() * 1000000);
                $randstr = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
                $randlen = rand(10, 20);
                $randtext = '';
                $l = strlen($randstr) - 1;
                for ($i = 0; $i < $randlen; $i++) {
                    $num = rand(0, $l);
                    $randtext .= $randstr[$num];
                }
                $textwatermark = str_replace('<{$randtext}>', $randtext, $configs['textwatermark']);
                $ret['posttext'] .= '<br />
' . $textwatermark . $v;
            }
        }
    }
    //本贴用户信息
    if ($ret['userid'] > 0) {
        $ret['useruname'] = $post->getVar('uname');
        $ret['username'] = $post->getVar('name') == '' ? $post->getVar('uname') : $post->getVar('name');
        $ret['viewemail'] = $post->getVar('viewemail');
        $ret['email'] = $post->getVar('email');
        $ret['qq'] = $post->getVar('qq');
        $ret['msn'] = $post->getVar('msn');
        $ret['groupname'] = $jieqiGroups[$post->getVar('groupid')];
        $ret['regdate'] = $post->getVar('regdate');
        $ret['experience'] = $post->getVar('experience');
        $ret['score'] = $post->getVar('score');
        $ret['sign'] = $post->getVar('sign');
        $ret['avatar'] = $post->getVar('avatar');
        $honorid = intval(jieqi_gethonorid($post->getVar('score'), $jieqiHonors));
        $ret['honor'] = isset($jieqiHonors[$honorid]['name'][intval($post->getVar('workid', 'n'))]) ? $jieqiHonors[$honorid]['name'][intval($post->getVar('workid', 'n'))] : $jieqiHonors[$honorid]['caption'];
        //头像图片
        if ($ret['avatar'] > 0) {
            $tmpary = jieqi_geturl('system', 'avatar', $ret['userid'], 'a', $ret['avatar']);
            $ret['base_avatar'] = $tmpary['d'];
            $ret['url_avatar'] = $tmpary['l'];
            $ret['url_avatars'] = $tmpary['s'];
            $ret['url_avatari'] = $tmpary['i'];
        }
        //徽章图片
        if (JIEQI_SHOW_BADGE == 1) {
            $checkfile = JIEQI_LOCAL_URL == JIEQI_MAIN_URL ? true : false;
            $checkfile = false;
            //等级徽章
            $ret['groupurl'] = getbadgeurl(1, $post->getVar('groupid'), 0, $checkfile);
            //头衔徽章
            $ret['honorurl'] = getbadgeurl(2, $honorid, 0, $checkfile);
            //自定义徽章
            $badgeary = unserialize($post->getVar('badges', 'n'));
            $ret['badgerows'] = array();
            if (is_array($badgeary)) {
                $m = 0;
                foreach ($badgeary as $badge) {
                    $ret['badgerows'][$m]['imageurl'] = getbadgeurl($badge['btypeid'], $badge['linkid'], $badge['imagetype']);
                    $ret['badgerows'][$m]['caption'] = jieqi_htmlstr($badge['caption']);
                    $m++;
                }
            }
        }
    }
    return $ret;
}
Exemplo n.º 9
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.º 10
0
include_once JIEQI_ROOT_PATH . '/header.php';
$article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['staticurl'];
$article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
$jieqiTpl->assign('article_static_url', $article_static_url);
$jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
$jieqiTpl->assign('ownerid', $topic->getVar('ownerid'));
$jieqiTpl->assign('articleid', $topic->getVar('articleid'));
$jieqiTpl->assign('articlename', $topic->getVar('articlename'));
$jieqiTpl->assign('topicid', $topic->getVar('topicid'));
$jieqiTpl->assign('title', $topic->getVar('title'));
if ($canedit) {
    $jieqiTpl->assign('ismaster', 1);
} else {
    $jieqiTpl->assign('ismaster', 0);
}
$jieqiTpl->assign('url_articleinfo', jieqi_geturl('article', 'article', $topic->getVar('ownerid'), 'info'));
//显示列表
$_REQUEST['pagerows'] = intval($jieqiConfigs['article']['reviewnum']);
if (empty($_REQUEST['pagerows'])) {
    $_REQUEST['pagerows'] = 10;
}
include_once JIEQI_ROOT_PATH . '/class/users.php';
jieqi_getconfigs('system', 'honors');
//头衔
//头像参数
if (!isset($jieqiConfigs['system'])) {
    jieqi_getconfigs('system', 'configs');
}
//是否使用徽章
if (!empty($jieqiModules['badge']['publish']) && is_file($jieqiModules['badge']['path'] . '/include/badgefunction.php')) {
    include_once $jieqiModules['badge']['path'] . '/include/badgefunction.php';
Exemplo n.º 11
0
if (empty($_REQUEST['siteid']) || empty($_REQUEST['fromid']) || empty($_REQUEST['toid'])) {
    jieqi_printfail(LANG_ERROR_PARAMETER);
}
jieqi_loadlang('collect', JIEQI_MODULE_NAME);
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
$article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['staticurl'];
$article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
include_once $jieqiModules['article']['path'] . '/include/collectarticle.php';
//0 初始状态 1 采集完成 2 不需要采集 3 采集失败 4 需要采集但是对应不上
if ($retflag == 1) {
    jieqi_getcachevars('article', 'articleuplog');
    if (!is_array($jieqiArticleuplog)) {
        $jieqiArticleuplog = array('articleuptime' => 0, 'chapteruptime' => 0);
    }
    $jieqiArticleuplog['articleuptime'] = JIEQI_NOW_TIME;
    $jieqiArticleuplog['chapteruptime'] = JIEQI_NOW_TIME;
    jieqi_setcachevars('articleuplog', 'jieqiArticleuplog', $jieqiArticleuplog, 'article');
    jieqi_jumppage($article_static_url . '/articlemanage.php?id=' . $_REQUEST['toid'], LANG_DO_SUCCESS, $jieqiLang['article']['update_collect_success']);
} elseif ($retflag == 2) {
    include_once JIEQI_ROOT_PATH . '/admin/header.php';
    $jieqiTpl->assign('jieqi_contents', '<br />' . jieqi_msgbox(LANG_DO_SUCCESS, sprintf($jieqiLang['article']['collect_no_update'], jieqi_geturl('article', 'article', $_REQUEST['toid'], 'info'), $article_static_url . '/articleclean.php?id=' . $_REQUEST['toid'] . '&collecturl=' . urlencode($article_static_url . '/admin/updatecollect.php?siteid=' . $_REQUEST['siteid'] . '&fromid=' . $_REQUEST['fromid'] . '&toid=' . $_REQUEST['toid']), $article_static_url . '/admin/collect.php')) . '<br />');
    include_once JIEQI_ROOT_PATH . '/admin/footer.php';
} elseif ($retflag == 4) {
    include_once JIEQI_ROOT_PATH . '/admin/header.php';
    $errchapter = '';
    foreach ($retchapinfo as $v) {
        $errchapter .= $v['fchapter'] . ' => ' . $v['tchapter'] . '<br />';
    }
    $jieqiTpl->assign('jieqi_contents', '<br />' . jieqi_msgbox(LANG_DO_SUCCESS, sprintf($jieqiLang['article']['collect_cant_update'], $errchapter, $article_static_url . '/articlemanage.php?id=' . $_REQUEST['toid'], $article_static_url . '/articleclean.php?id=' . $_REQUEST['toid'] . '&collecturl=' . urlencode($article_static_url . '/admin/updatecollect.php?siteid=' . $_REQUEST['siteid'] . '&fromid=' . $_REQUEST['fromid'] . '&toid=' . $_REQUEST['toid']), $article_static_url . '/admin/collect.php')) . '<br />');
    include_once JIEQI_ROOT_PATH . '/admin/footer.php';
}
Exemplo n.º 12
0
/**
 * 传入小说实例对象,返回适合模板赋值的小说信息数组
 * 
 * @param      object      $article 论坛实例
 * @access     public
 * @return     array
 */
function jieqi_article_vars($article)
{
    global $jieqiModules;
    global $jieqiSort;
    global $jieqiConfigs;
    global $jieqiLang;
    global $article_static_url;
    global $article_dynamic_url;
    global $jieqiOption;
    if (!isset($jieqiSort['article'])) {
        jieqi_getconfigs('article', 'sort');
    }
    if (!isset($jieqiConfigs['article'])) {
        jieqi_getconfigs('article', 'configs');
    }
    if (!isset($jieqiLang['article'])) {
        jieqi_loadlang('list', JIEQI_MODULE_NAME);
    }
    if (!isset($article_static_url)) {
        $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['staticurl'];
    }
    if (!isset($article_dynamic_url)) {
        $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
    }
    $ret = array();
    $ret['articleid'] = $article->getVar('articleid');
    //文章序号
    $ret['articlename'] = $article->getVar('articlename');
    //文章名称
    $ret['intro'] = htmlspecialchars(jieqi_substr($article->getVar('intro', 'n'), 0, 250));
    $ret['articlesubdir'] = jieqi_getsubdir($article->getVar('articleid'));
    //子目录
    $ret['url_articleinfo'] = jieqi_geturl('article', 'article', $article->getVar('articleid'), 'info');
    if ($article->getVar('lastchapter') == '') {
        $ret['lastchapterid'] = 0;
        //章节序号
        $ret['lastchapter'] = '';
        //章节名称
        $ret['url_lastchapter'] = '';
        //章节地址
    } else {
        $ret['lastchapterid'] = $article->getVar('lastchapterid');
        $ret['lastchapter'] = $article->getVar('lastchapter');
        $ret['url_articleindex'] = jieqi_geturl('article', 'article', $article->getVar('articleid'), 'index');
        $ret['url_lastchapter'] = jieqi_geturl('article', 'chapter', $article->getVar('lastchapterid'), $article->getVar('articleid'));
    }
    $ret['url_index'] = $ret['url_articleindex'];
    $ret['lastvolumeid'] = $article->getVar('lastvolumeid');
    //分卷序号
    $ret['lastvolume'] = $article->getVar('lastvolume');
    //分卷名称
    $ret['authorid'] = $article->getVar('authorid');
    //作者
    $ret['author'] = $article->getVar('author');
    $ret['posterid'] = $article->getVar('posterid');
    //发表者
    $ret['poster'] = $article->getVar('poster');
    $ret['agentid'] = $article->getVar('agentid');
    //代理者
    $ret['agent'] = $article->getVar('agent');
    $ret['sortid'] = $article->getVar('sortid');
    //类别序号
    if (isset($jieqiSort['article'][$ret['sortid']]['caption'])) {
        $ret['sort'] = $jieqiSort['article'][$ret['sortid']]['caption'];
    } else {
        $ret['sort'] = '';
    }
    $ret['typeid'] = $article->getVar('typeid');
    //字类别序号
    if ($ret['typeid'] > 0 && isset($jieqiSort['article'][$ret['sortid']]['types'][$ret['typeid']])) {
        $ret['type'] = $jieqiSort['article'][$ret['sortid']]['types'][$ret['typeid']];
    } else {
        $ret['type'] = '';
    }
    if (empty($ret['type'])) {
        $ret['type'] = $ret['sort'];
    }
    $ret['size'] = $article->getVar('size');
    $ret['size_k'] = ceil($article->getVar('size') / 1024);
    $ret['size_c'] = ceil($article->getVar('size') / 2);
    $ret['dayvisit'] = $article->getVar('dayvisit');
    $ret['weekvisit'] = $article->getVar('weekvisit');
    $ret['monthvisit'] = $article->getVar('monthvisit');
    $ret['allvisit'] = $article->getVar('allvisit');
    $ret['dayvote'] = $article->getVar('dayvote');
    $ret['weekvote'] = $article->getVar('weekvote');
    $ret['monthvote'] = $article->getVar('monthvote');
    $ret['allvote'] = $article->getVar('allvote');
    $ret['goodnum'] = $article->getVar('goodnum');
    $ret['badnum'] = $article->getVar('badnum');
    $ret['display'] = $article->getVar('display');
    $ret['lastupdate'] = date('y-m-d', $article->getVar('lastupdate'));
    $ret['update'] = date('m-d', $article->getVar('lastupdate'));
    $ret['postdate'] = date('m-d', $article->getVar('postdate'));
    $ret['uptime'] = $article->getVar('lastupdate');
    $ret['posttime'] = $article->getVar('postdate');
    $ret['lastvote'] = $article->getVar('lastvote');
    $ret['isfull'] = $article->getVar('fullflag');
    if (!isset($jieqiOption)) {
        jieqi_getconfigs('article', 'option', 'jieqiOption');
    }
    $tmpvar = $article->getVar('fullflag');
    if (isset($jieqiOption['article']['fullflag']['items'][$tmpvar])) {
        $ret['fullflag'] = $jieqiOption['article']['fullflag']['items'][$tmpvar];
    } else {
        $ret['fullflag'] = $jieqiOption['article']['fullflag']['items'][$jieqiOption['article']['fullflag']['default']];
    }
    $tmpvar = $article->getVar('permission');
    if (isset($jieqiOption['article']['permission']['items'][$tmpvar])) {
        $ret['permission'] = $jieqiOption['article']['permission']['items'][$tmpvar];
    } else {
        $ret['permission'] = $jieqiOption['article']['permission']['items'][$jieqiOption['article']['permission']['default']];
    }
    $tmpvar = $article->getVar('firstflag');
    if (isset($jieqiOption['article']['firstflag']['items'][$tmpvar])) {
        $ret['firstflag'] = $jieqiOption['article']['firstflag']['items'][$tmpvar];
    } else {
        $ret['firstflag'] = $jieqiOption['article']['firstflag']['items'][$jieqiOption['article']['firstflag']['default']];
    }
    $ret['imgflag'] = $article->getVar('imgflag', 'n');
    $ret['url_image'] = jieqi_geturl('article', 'cover', $article->getVar('articleid'), 's', $article->getVar('imgflag', 'n'));
    return $ret;
}
Exemplo n.º 13
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     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);
     jieqi_includedb();
     $query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
     $criteria = new CriteriaCompo();
     $criteria->setFields("r.*,a.articlename");
     $criteria->setTables(jieqi_dbprefix('article_reviews') . " AS r LEFT JOIN " . jieqi_dbprefix('article_article') . " AS a ON r.ownerid=a.articleid");
     if ($this->exevars['istop'] == 1) {
         $criteria->add(new Criteria('r.istop', '1'));
     } elseif ($this->exevars['istop'] == 2) {
         $criteria->add(new Criteria('r.istop', '0'));
     }
     if ($this->exevars['isgood'] == 1) {
         $criteria->add(new Criteria('r.isgood', '1'));
     } elseif ($this->exevars['isgood'] == 2) {
         $criteria->add(new Criteria('r.isgood', '0'));
     }
     $criteria->setSort('r.topicid');
     $criteria->setOrder('DESC');
     $criteria->setLimit($this->exevars['listnum']);
     $criteria->setStart(0);
     $query->queryObjects($criteria);
     $reviewrows = array();
     $i = 0;
     while ($v = $query->getObject()) {
         $reviewrows[$i]['reviewtitle'] = jieqi_htmlstr(str_replace(array("\r", "\n"), array('', ' '), $v->getVar('title', 'n')));
         $reviewrows[$i]['ownerid'] = $v->getVar('ownerid');
         $reviewrows[$i]['articlename'] = $v->getVar('articlename');
         $reviewrows[$i]['topicid'] = $v->getVar('topicid');
         $reviewrows[$i]['url_review'] = $article_dynamic_url . '/reviews.php?aid=' . $v->getVar('ownerid');
         $reviewrows[$i]['poster'] = $v->getVar('poster');
         $reviewrows[$i]['posterid'] = $v->getVar('posterid');
         $reviewrows[$i]['postdate'] = date('m-d H:i', $v->getVar('posttime'));
         $reviewrows[$i]['posttime'] = $v->getVar('posttime');
         $reviewrows[$i]['replytime'] = $v->getVar('replytime');
         $reviewrows[$i]['views'] = $v->getVar('views');
         $reviewrows[$i]['replies'] = $v->getVar('replies');
         $reviewrows[$i]['islock'] = $v->getVar('islock');
         $reviewrows[$i]['istop'] = $v->getVar('istop');
         $reviewrows[$i]['isgood'] = $v->getVar('isgood');
         $reviewrows[$i]['topictype'] = $v->getVar('topictype');
         $reviewrows[$i]['url_articleinfo'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'info');
         $reviewrows[$i]['url_articleindex'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'index');
         $reviewrows[$i]['url_articleread'] = $reviewrows[$i]['url_articleindex'];
         $i++;
     }
     $jieqiTpl->assign_by_ref('reviewrows', $reviewrows);
     $jieqiTpl->assign('url_more', $article_dynamic_url . '/reviewslist.php');
 }
Exemplo n.º 14
0
    }
    if ($from_draft) {
        $draft_handler->delete($_REQUEST['draftid']);
    }
    //增加章节积分
    jieqi_getconfigs(JIEQI_MODULE_NAME, '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'];
    if (!empty($jieqiConfigs['article']['scorechapter'])) {
        include_once JIEQI_ROOT_PATH . '/class/users.php';
        $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler');
        $users_handler->changeScore($_SESSION['jieqiUserId'], $jieqiConfigs['article']['scorechapter'], true);
        if ($_REQUEST['userchappid'] > 0 && !empty($jieqiConfigs['article']['scoreauthuserchap'])) {
            $users_handler->changeScore($_REQUEST['userchappid'], $jieqiConfigs['article']['scoreauthuserchap'], true);
        }
    }
    //清空本文章缓存
    if (JIEQI_USE_CACHE) {
        if (!is_a($jieqiTpl, 'JieqiTpl')) {
            include_once JIEQI_ROOT_PATH . '/lib/template/template.php';
            $jieqiTpl =& JieqiTpl::getInstance();
        }
        $jieqiTpl->clear_cache($jieqiModules['article']['path'] . '/templates/articleinfo.html', $_REQUEST['aid']);
    }
    //更新静态页
    if ($jieqiConfigs['article']['fakestatic'] > 0) {
        include_once $jieqiModules['article']['path'] . '/include/funstatic.php';
        article_update_static('chapternew', $article->getVar('articleid', 'n'), $article->getVar('sortid', 'n'));
    }
    jieqi_jumppage($article_static_url . '/articlemanage.php?id=' . $_REQUEST['aid'], LANG_DO_SUCCESS, sprintf($jieqiLang['article']['add_chapter_success'], $article_static_url . '/articlemanage.php?id=' . $_REQUEST['aid'], jieqi_geturl('article', 'article', $_REQUEST['aid'], 'info'), $article_static_url . '/newchapter.php?aid=' . $_REQUEST['aid']));
}
Exemplo n.º 15
0
$chapter_handler =& JieqiChapterHandler::getInstance('JieqiChapterHandler');
$criteria = new CriteriaCompo(new Criteria('articleid', $_REQUEST['id'], '='));
$criteria->setSort('chapterorder');
$criteria->setOrder('ASC');
$chapter_handler->queryObjects($criteria);
$i = 0;
$chapterrows = array();
$k = 0;
while ($chapter = $chapter_handler->getObject()) {
    $chapterrows[$k]['chapterid'] = $chapter->getVar('chapterid');
    $chapterrows[$k]['chaptertype'] = $chapter->getVar('chaptertype');
    $chapterrows[$k]['chaptername'] = $chapter->getVar('chaptername');
    $chapterrows[$k]['chapterorder'] = $chapter->getVar('chapterorder');
    $chapterrows[$k]['url_chapterread'] = $article_static_url . '/reader.php?aid=' . $article->getVar('articleid') . '&cid=' . $chapter->getVar('chapterid');
    if ($chapter->getVar('chaptertype') == 0) {
        $chapterrows[$k]['url_chapterread'] = jieqi_geturl('article', 'chapter', $chapter->getVar('chapterid'), $article->getVar('articleid'));
        $chapterrows[$k]['url_chapteredit'] = $article_static_url . '/chapteredit.php?id=' . $chapter->getVar('chapterid') . '&chaptertype=0';
        $chapterrows[$k]['url_chapterdelete'] = $article_static_url . '/chapterdel.php?id=' . $chapter->getVar('chapterid') . '&chaptertype=0';
    } else {
        $chapterrows[$k]['url_chapterread'] = $article_static_url . '/showvolume.php?aid=' . $article->getVar('articleid') . '&vid=' . $chapter->getVar('chapterid');
        $chapterrows[$k]['url_chapteredit'] = $article_static_url . '/chapteredit.php?id=' . $chapter->getVar('chapterid') . '&chaptertype=1';
        $chapterrows[$k]['url_chapterdelete'] = $article_static_url . '/chapterdel.php?id=' . $chapter->getVar('chapterid') . '&chaptertype=1';
    }
    $k++;
}
$jieqiTpl->assign_by_ref('chapterrows', $chapterrows);
//功能属性
$jieqiTpl->assign('url_chaptersort', $article_static_url . '/chaptersort.php?do=submit');
$jieqiTpl->assign('url_chaptersdel', $article_static_url . '/chaptersdel.php?do=submit');
$jieqiTpl->assign('url_repack', $article_static_url . '/repack.php?do=submit');
$packflag = array();
Exemplo n.º 16
0
        $paylog->setVar('buyinfo', '');
        $paylog->setVar('moneytype', 0);
        $paylog->setVar('money', $money);
        $paylog->setVar('egoldtype', $usesliver);
        $paylog->setVar('egold', $_REQUEST['egold']);
        $paylog->setVar('paytype', 'manual');
        $paylog->setVar('retserialno', '');
        $paylog->setVar('retaccount', '');
        $paylog->setVar('retinfo', '');
        $paylog->setVar('masterid', $_SESSION['jieqiUserId']);
        $paylog->setVar('mastername', $_SESSION['jieqiUserName']);
        $paylog->setVar('masterinfo', '');
        $paylog->setVar('note', '');
        $paylog->setVar('payflag', 1);
        $paylog_handler->insert($paylog);
        jieqi_jumppage(jieqi_geturl('system', 'user', $uid, 'info'), LANG_DO_SUCCESS, sprintf($jieqiLang['pay']['change_egold_success'], $uname));
        break;
    case 'show':
    default:
        include_once JIEQI_ROOT_PATH . '/admin/header.php';
        $jieqiTpl->assign('url_changeegold', $jieqiModules['pay']['url'] . '/admin/changeegold.php');
        $jieqiTpl->assign('uid', $uid);
        $jieqiTpl->assign('uname', $uname);
        $jieqiTpl->assign('egold', $user->getVar('egold'));
        $jieqiTpl->assign('esliver', $user->getVar('esliver'));
        $jieqiTpl->assign('useesliver', JIEQI_SILVER_USAGE);
        $jieqiTpl->setCaching(0);
        $jieqiTset['jieqi_contents_template'] = $jieqiModules['pay']['path'] . '/templates/admin/changeegold.html';
        include_once JIEQI_ROOT_PATH . '/admin/footer.php';
        break;
}
Exemplo n.º 17
0
        $start += 4;
    } else {
        $reviewrows[$k]['isgood'] = 0;
    }
    $reviewrows[$k]['topicid'] = $v->getVar('topicid');
    $reviewrows[$k]['posttime'] = $v->getVar('posttime');
    $reviewrows[$k]['posterid'] = $v->getVar('posterid');
    $reviewrows[$k]['poster'] = $v->getVar('poster');
    $reviewrows[$k]['title'] = $v->getVar('title');
    $reviewrows[$k]['views'] = $v->getVar('views');
    $reviewrows[$k]['replies'] = $v->getVar('replies');
    $reviewrows[$k]['url_top'] = jieqi_addurlvars(array('action' => 'top', 'rid' => $v->getVar('topicid')));
    $reviewrows[$k]['url_untop'] = jieqi_addurlvars(array('action' => 'untop', 'rid' => $v->getVar('topicid')));
    $reviewrows[$k]['url_good'] = jieqi_addurlvars(array('action' => 'good', 'rid' => $v->getVar('topicid')));
    $reviewrows[$k]['url_normal'] = jieqi_addurlvars(array('action' => 'normal', 'rid' => $v->getVar('topicid')));
    $reviewrows[$k]['url_delete'] = jieqi_addurlvars(array('action' => 'del', 'rid' => $v->getVar('topicid')));
    $reviewrows[$k]['checkbox'] = '<input type="checkbox" id="checkid[]" name="checkid[]" value="' . $v->getVar('topicid') . '">';
    $reviewrows[$k]['ownerid'] = $v->getVar('ownerid');
    $reviewrows[$k]['articlename'] = $v->getVar('articlename');
    $reviewrows[$k]['url_articleinfo'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'info');
    $k++;
}
$jieqiTpl->assign_by_ref('reviewrows', $reviewrows);
//处理页面跳转
include_once JIEQI_ROOT_PATH . '/lib/html/page.php';
$jumppage = new JieqiPage($query->getCount($criteria), $jieqiConfigs['article']['reviewnum'], $_REQUEST['page']);
$jumppage->setlink('', true, true);
$jieqiTpl->assign('url_jumppage', $jumppage->whole_bar());
$jieqiTpl->setCaching(0);
$jieqiTset['jieqi_contents_template'] = $jieqiModules['article']['path'] . '/templates/admin/reviews.html';
include_once JIEQI_ROOT_PATH . '/admin/footer.php';
Exemplo n.º 18
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.º 19
0
             $eachlinkcount++;
         }
     }
     $jieqiTpl->assign('eachlinknum', $jieqiConfigs['article']['eachlinknum']);
     $jieqiTpl->assign('eachlinkcount', $eachlinkcount);
     $jieqiTpl->assign_by_ref('eachlinkrows', $eachlinkrows);
 } else {
     $jieqiTpl->assign('eachlinknum', 0);
     $jieqiTpl->assign('eachlinkcount', 0);
 }
 //文章序号
 $jieqiTpl->assign('articleid', $article->getVar('articleid'));
 $jieqiTpl->assign('lastchapterid', $article->getVar('lastchapterid'));
 //点击阅读,全文阅读
 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) {
Exemplo n.º 20
0
$criteria->setOrder('DESC');
$query->queryObjects($criteria);
$voteres = $query->getObject();
if (!$voteres) {
    jieqi_printfail($jieqiLang['article']['avote_not_exists']);
}
//包含区块参数
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
include_once JIEQI_ROOT_PATH . '/header.php';
$article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['staticurl'];
$article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
$jieqiTpl->assign('article_static_url', $article_static_url);
$jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
$articleid = $voteres->getVar('articleid', 'n');
$jieqiTpl->assign('articleid', $articleid);
$jieqiTpl->assign('url_articleinfo', jieqi_geturl('article', 'article', $articleid, 'info'));
$resultrows = array();
$useitem = $voteres->getVar('useitem', 'n');
$statall = $voteres->getVar('statall', 'n');
for ($i = 1; $i <= $useitem; $i++) {
    $resultrows[$i - 1]['item'] = $voteres->getVar('item' . $i);
    $resultrows[$i - 1]['stat'] = $voteres->getVar('stat' . $i);
    if ($statall > 0) {
        $resultrows[$i - 1]['percent'] = sprintf("%0.2f", $voteres->getVar('stat' . $i) * 100 / $statall);
    } else {
        $resultrows[$i - 1]['percent'] = 0;
    }
    $resultrows[$i - 1]['recent'] = 100 - $resultrows[$i - 1]['percent'];
}
$jieqiTpl->assign_by_ref('resultrows', $resultrows);
$jieqiTpl->assign('title', $voteres->getVar('title'));
Exemplo n.º 21
0
include_once JIEQI_ROOT_PATH . '/lib/html/formloader.php';
$showstr = '';
if (is_numeric($_REQUEST['checkchapterid']) && !empty($_REQUEST['checkstring'])) {
    include_once $jieqiModules['obook']['path'] . '/class/obuyinfo.php';
    $buyinfo_handler =& JieqiObuyinfoHandler::getInstance('JieqiObuyinfoHandler');
    $criteria = new CriteriaCompo(new Criteria('ochapterid', $_REQUEST['checkchapterid']));
    $criteria->add(new Criteria('checkcode', $_REQUEST['checkstring']));
    $criteria->setSort('obuyinfoid');
    $criteria->setOrder('DESC');
    $criteria->setLimit(100);
    $buyinfo_handler->queryObjects($criteria);
    $resnum = 0;
    $showstr .= $jieqiLang['obook']['check_search_result'] . '<br />';
    while ($buyinfo = $buyinfo_handler->getObject()) {
        if ($resnum == 0) {
            $showstr .= $jieqiLang['obook']['check_obook_id'] . $buyinfo->getVar('ochapterid') . ' | ' . $jieqiLang['obook']['check_obook_name'] . $buyinfo->getVar('obookname') . ' ' . $buyinfo->getVar('chaptername') . ' | ' . $jieqiLang['obook']['check_check_code'] . $buyinfo->getVar('checkcode') . '<br />';
        }
        $showstr .= $jieqiLang['obook']['check_buy_time'] . date(JIEQI_DATE_FORMAT . ' ' . JIEQI_TIME_FORMAT, $buyinfo->getVar('buytime', 'n')) . ' | ' . $jieqiLang['obook']['check_buy_name'] . '<a href="' . jieqi_geturl('system', 'user', $buyinfo->getVar('userid'), 'info') . '" target="_blank">' . $buyinfo->getVar('username') . '</a> | ' . $jieqiLang['obook']['check_sale_id'] . $buyinfo->getVar('osaleid') . '<br />';
        $resnum++;
    }
}
if (!empty($showstr)) {
    $showstr = '<div style="text-align:left">' . $showstr . '</div>';
}
$check_form = new JieqiThemeForm($jieqiLang['obook']['check_form_title'], 'frmcheckcode', $obook_dynamic_url . '/admin/checkcode.php');
$check_form->addElement(new JieqiFormText($jieqiLang['obook']['check_chapter_id'], 'checkchapterid', 30, 50, ''), true);
$check_form->addElement(new JieqiFormText($jieqiLang['obook']['check_check_string'], 'checkstring', 30, 50, ''), true);
$check_form->addElement(new JieqiFormHidden('action', 'checkcode'));
$check_form->addElement(new JieqiFormButton('&nbsp;', 'submit', $jieqiLang['obook']['check_search_button'], 'submit'));
$jieqiTpl->assign('jieqi_contents', $showstr . '<br />' . $check_form->render(JIEQI_FORM_MIDDLE) . '<br />');
include_once JIEQI_ROOT_PATH . '/admin/footer.php';
Exemplo n.º 22
0
    exit;
}
if (!empty($_REQUEST['cid'])) {
    include_once $jieqiModules['article']['path'] . '/class/chapter.php';
    $chapter_handler =& JieqiChapterHandler::getInstance('JieqiChapterHandler');
    $criteria = new CriteriaCompo(new Criteria('chapterid', $_REQUEST['cid']));
    $criteria->add(new Criteria('articleid', $_REQUEST['aid']));
    $rowsnum = $chapter_handler->getCount($criteria);
    if ($rowsnum > 0) {
        header('Location: ' . jieqi_geturl('article', 'chapter', $_REQUEST['cid'], $_REQUEST['aid']));
        jieqi_upbookcasevisit();
        exit;
    } else {
        $_REQUEST['indexflag'] = 1;
    }
}
if (empty($_REQUEST['indexflag'])) {
    header('Location: ' . jieqi_geturl('article', 'article', $_REQUEST['aid'], 'info'));
} else {
    header('Location: ' . jieqi_geturl('article', 'article', $_REQUEST['aid'], 'index'));
}
jieqi_upbookcasevisit();
//更新书架的最后访问
function jieqi_upbookcasevisit()
{
    if (!empty($_REQUEST['bid'])) {
        include_once $jieqiModules['article']['path'] . '/class/bookcase.php';
        $bookcase_handler =& JieqiBookcaseHandler::getInstance('JieqiBookcaseHandler');
        $bookcase_handler->db->query('UPDATE ' . jieqi_dbprefix('article_bookcase') . ' SET lastvisit=' . JIEQI_NOW_TIME . ' WHERE caseid=' . $_REQUEST['bid']);
    }
}
Exemplo n.º 23
0
                 jieqi_jumppage(JIEQI_URL . '/setavatar.php', LANG_DO_SUCCESS, $jieqiLang['system']['avatar_set_success']);
             }
         }
     } else {
         jieqi_printfail($errtext);
     }
     break;
 case 'show':
 default:
     //显示头像状态,包含区块参数(定制区块)
     jieqi_getconfigs('system', 'userblocks', 'jieqiBlocks');
     include_once JIEQI_ROOT_PATH . '/header.php';
     $avatartype = intval($jieqiUsers->getVar('avatar', 'n'));
     $avatarimg = '';
     if (isset($jieqi_image_type[$avatartype])) {
         $urls = jieqi_geturl('system', 'avatar', $jieqiUsers->getVar('uid', 'n'), 'a', $avatartype);
         if (is_array($urls)) {
             $jieqiTpl->assign('base_avatar', $urls['d']);
             $jieqiTpl->assign('url_avatar', $urls['l']);
             $jieqiTpl->assign('url_avatars', $urls['s']);
             $jieqiTpl->assign('url_avatari', $urls['i']);
         }
     }
     $jieqiTpl->assign('avatartype', $avatartype);
     $jieqiTpl->assign('need_imagetype', $jieqiConfigs['system']['avatartype']);
     $jieqiTpl->assign('max_imagesize', $jieqiConfigs['system']['avatarsize']);
     $jieqiTpl->assign('avatartype', $avatartype);
     if (function_exists('gd_info') && $jieqiConfigs['system']['avatarcut']) {
         $jieqiTpl->assign('avatarcut', 1);
     } else {
         $jieqiTpl->assign('avatarcut', 0);