예제 #1
0
파일: 15173.php 프로젝트: thu0ng91/jmc
 //是否安全校验,1不校验 2为必校验,推荐
 $key = $jieqiPayset[JIEQI_PAY_TYPE]['paykey'];
 //私钥值。即商户登录15173快钱系统后设定的 商户密钥
 $pid_15173account = $jieqiPayset[JIEQI_PAY_TYPE]['pid_15173account'];
 //代理/合作伙伴商户编号
 $attach = "15173支付";
 //注意正确的参数串拼凑顺序
 $text = "bargainor_id=" . $merchant_id . "&sp_billno=" . $orderid . "&pay_type=" . $_REQUEST['paytype'] . "&return_url=" . $merchant_url . "&attach=" . $attach . "&key=" . $key;
 //md5加密
 $mac = strtoupper(md5($text));
 //对参数串进行私钥加密取得值
 //echo $text;
 //exit();
 include_once JIEQI_ROOT_PATH . '/header.php';
 include_once JIEQI_ROOT_PATH . '/lib/template/template.php';
 $jieqiTpl =& JieqiTpl::getInstance();
 $jieqiTpl->assign('url_pay', $jieqiPayset[JIEQI_PAY_TYPE]['payurl']);
 $jieqiTpl->assign('buyname', $_SESSION['jieqiUserName']);
 $jieqiTpl->assign('egold', $_REQUEST['egold']);
 $jieqiTpl->assign('egoldname', JIEQI_EGOLD_NAME);
 $jieqiTpl->assign('money', sprintf('%0.2f', $money / 100));
 $jieqiTpl->assign('merchant_id', $merchant_id);
 $jieqiTpl->assign('orderid', $orderid);
 $jieqiTpl->assign('paytype', $_REQUEST['paytype']);
 //$jieqiPayset[JIEQI_PAY_TYPE]['paytype']
 $jieqiTpl->assign('amount', $amount);
 $jieqiTpl->assign('attach', $attach);
 $jieqiTpl->assign('currency', $currency);
 $jieqiTpl->assign('merchant_url', $merchant_url);
 $jieqiTpl->assign('notify_url', $jieqiPayset[JIEQI_PAY_TYPE]['paynotify']);
 $jieqiTpl->assign('commodity_info', $commodity_info);
예제 #2
0
파일: package.php 프로젝트: thu0ng91/jmc
 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'));
     }
 }
예제 #3
0
function makestaticinfo($article_id)
{
    global $jieqiConfigs;
    global $jieqiSort;
    global $jieqiTpl;
    global $jieqiBlocks;
    global $jieqi_file_postfix;
    global $jieqiOption;
    if (!is_object($jieqiTpl)) {
        $jieqiTpl =& JieqiTpl::getInstance();
    }
    if (empty($article_id) || !is_numeric($article_id)) {
        return false;
    }
    $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler');
    $article = $article_handler->get($article_id);
    if (!$article) {
        return false;
    }
    //包含区块参数(定制)
    jieqi_getconfigs(JIEQI_MODULE_NAME, 'sort');
    jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
    $jieqi_pagetitle = $article->getVar('articlename');
    if ($article->getVar('lastvolume') != '') {
        $jieqi_pagetitle .= '-' . $article->getVar('lastvolume');
    }
    $jieqi_pagetitle .= '-' . $article->getVar('lastchapter') . '-' . JIEQI_SITE_NAME;
    $jieqiTpl->assign('jieqi_pagetitle', $jieqi_pagetitle);
    $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl'];
    $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
    $jieqiTpl->assign('article_static_url', $article_static_url);
    $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
    $jieqiTpl->assign('articlename', $article->getVar('articlename'));
    $jieqiTpl->assign('postdate', date('Y-m-d', $article->getVar('postdate')));
    $jieqiTpl->assign('lastupdate', date('Y-m-d', $article->getVar('lastupdate')));
    if ($article->getVar('authorid') > 0) {
        $jieqiTpl->assign('author', '<a href="' . jieqi_geturl('system', 'user', $article->getVar('authorid')) . '" target="_blank">' . $article->getVar('author') . '</a>');
    } else {
        $jieqiTpl->assign('author', $article->getVar('author'));
    }
    if ($article->getVar('agentid') > 0) {
        $jieqiTpl->assign('agent', '<a href="' . jieqi_geturl('system', 'user', $article->getVar('agentid')) . '" target="_blank">' . $article->getVar('agent') . '</a>');
    } else {
        $jieqiTpl->assign('agent', $article->getVar('agent'));
    }
    $jieqiTpl->assign('sortid', $article->getVar('sortid'));
    $jieqiTpl->assign('sort', $jieqiSort['article'][$article->getVar('sortid')]['caption']);
    $jieqiTpl->assign('intro', $article->getVar('intro'));
    $jieqiTpl->assign('notice', $article->getVar('notice'));
    $imgflag = $article->getVar('imgflag');
    //小图
    if (($imgflag & 1) > 0) {
        $jieqiTpl->assign('hasimage', 1);
        $jieqiTpl->assign('url_simage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 's' . $jieqiConfigs['article']['imagetype']);
    } else {
        $jieqiTpl->assign('hasimage', 0);
        $jieqiTpl->assign('url_simage', '');
    }
    //大图
    if (($imgflag & 2) > 0) {
        $jieqiTpl->assign('url_limage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 'l' . $jieqiConfigs['article']['imagetype']);
    } elseif (($imgflag & 1) > 0) {
        $jieqiTpl->assign('url_limage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 's' . $jieqiConfigs['article']['imagetype']);
    } else {
        $jieqiTpl->assign('url_limage', '');
    }
    $lastchapter = $article->getVar('lastchapter');
    if ($lastchapter != '') {
        if ($article->getVar('lastvolume') != '') {
            $lastchapter = $article->getVar('lastvolume') . ' ' . $lastchapter;
        }
        $jieqiTpl->assign('url_lastchapter', jieqi_geturl('article', 'chapter', $article->getVar('lastchapterid'), $article->getVar('articleid')));
    } else {
        $jieqiTpl->assign('url_lastchapter', '');
    }
    //显示多个最新章节
    if (is_numeric($jieqiConfigs['article']['infochapternum']) && intval($jieqiConfigs['article']['infochapternum']) > 0) {
        $jieqiConfigs['article']['infochapternum'] = intval($jieqiConfigs['article']['infochapternum']);
        include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/chapter.php';
        $chapter_handler =& JieqiChapterHandler::getInstance('JieqiChapterHandler');
        $criteria = new CriteriaCompo(new Criteria('articleid', $article->getVar('articleid'), '='));
        $criteria->setSort('chapterorder');
        $criteria->setOrder('DESC');
        $criteria->setLimit($jieqiConfigs['article']['infochapternum'] + ceil($jieqiConfigs['article']['infochapternum'] / 4));
        $chapter_handler->queryObjects($criteria);
        $chapterrows = array();
        $k = 0;
        $volumename = $article->getVar('lastvolume');
        while ($chapter = $chapter_handler->getObject()) {
            if ($chapter->getVar('chaptertype') == 1) {
                $volumename = $chapter->getVar('chaptername');
            } else {
                $chapterrows[$k]['volumename'] = $volumename;
                $chapterrows[$k]['chaptername'] = $chapter->getVar('chaptername');
                if ($chapterrows[$k]['volumename'] != '') {
                    $chapterrows[$k]['chapter'] = $chapterrows[$k]['volumename'] . ' ' . $chapterrows[$k]['chaptername'];
                } else {
                    $chapterrows[$k]['chapter'] = $chapterrows[$k]['chaptername'];
                }
                $chapterrows[$k]['chapterid'] = $chapter->getVar('chapterid');
                $chapterrows[$k]['url_chapter'] = jieqi_geturl('article', 'chapter', $chapter->getVar('chapterid'), $article->getVar('articleid'));
                $k++;
                if ($k >= $jieqiConfigs['article']['infochapternum']) {
                    break;
                }
            }
        }
        $jieqiTpl->assign_by_ref('chapterrows', $chapterrows);
    }
    $jieqiTpl->assign('lastchapter', $lastchapter);
    $jieqiTpl->assign('size', $article->getVar('size'));
    $jieqiTpl->assign('size_k', ceil($article->getVar('size') / 1024));
    $jieqiTpl->assign('size_c', ceil($article->getVar('size') / 2));
    $jieqiTpl->assign('dayvisit', $article->getVar('dayvisit'));
    $jieqiTpl->assign('weekvisit', $article->getVar('weekvisit'));
    $jieqiTpl->assign('monthvisit', $article->getVar('monthvisit'));
    $jieqiTpl->assign('allvisit', $article->getVar('allvisit'));
    $jieqiTpl->assign('dayvote', $article->getVar('dayvote'));
    $jieqiTpl->assign('weekvote', $article->getVar('weekvote'));
    $jieqiTpl->assign('monthvote', $article->getVar('monthvote'));
    $jieqiTpl->assign('allvote', $article->getVar('allvote'));
    $jieqiTpl->assign('goodnum', $article->getVar('goodnum'));
    $jieqiTpl->assign('badnum', $article->getVar('badnum'));
    jieqi_getconfigs('article', 'option', 'jieqiOption');
    $tmpvar = $article->getVar('fullflag');
    if (isset($jieqiOption['article']['fullflag']['items'][$tmpvar])) {
        $jieqiTpl->assign('fullflag', $jieqiOption['article']['fullflag']['items'][$tmpvar]);
    } else {
        $jieqiTpl->assign('fullflag', $jieqiOption['article']['fullflag']['items'][$jieqiOption['article']['fullflag']['default']]);
    }
    $tmpvar = $article->getVar('permission');
    if (isset($jieqiOption['article']['permission']['items'][$tmpvar])) {
        $jieqiTpl->assign('permission', $jieqiOption['article']['permission']['items'][$tmpvar]);
    } else {
        $jieqiTpl->assign('permission', $jieqiOption['article']['permission']['items'][$jieqiOption['article']['permission']['default']]);
    }
    $tmpvar = $article->getVar('firstflag');
    if (isset($jieqiOption['article']['firstflag']['items'][$tmpvar])) {
        $jieqiTpl->assign('firstflag', $jieqiOption['article']['firstflag']['items'][$tmpvar]);
    } else {
        $jieqiTpl->assign('firstflag', $jieqiOption['article']['firstflag']['items'][$jieqiOption['article']['firstflag']['default']]);
    }
    //管理
    $jieqiTpl->assign('url_manage', $article_static_url . '/articlemanage.php?id=' . $article->getVar('articleid'));
    //举报
    $tmpstr = sprintf($jieqiLang['article']['article_report_reason'], jieqi_geturl('article', 'article', $article->getVar('articleid'), 'info'));
    $jieqiTpl->assign('url_report', $article_dynamic_url . '/newmessage.php?tosys=1&title=' . urlencode(sprintf($jieqiLang['article']['article_report_title'], $article->getVar('articlename', 'n'))) . '&content=' . urlencode($tmpstr));
    //采集
    $setting = unserialize($article->getVar('setting', 'n'));
    $url_collect = $article_static_url . '/collect.php?toid=' . $article->getVar('articleid', 'n');
    if (is_numeric($setting['fromarticle'])) {
        $url_collect .= '&fromid=' . $setting['fromarticle'];
    }
    if (is_numeric($setting['fromsite'])) {
        $url_collect .= '&siteid=' . $setting['fromsite'];
    }
    $jieqiTpl->assign('url_collect', $url_collect);
    //文章序号
    $jieqiTpl->assign('articleid', $article->getVar('articleid'));
    //点击阅读,全文阅读
    if ($article->getVar('chapters', 'n') > 0) {
        $jieqiTpl->assign('url_read', jieqi_geturl('article', 'article', $article->getVar('articleid'), 'index'));
        if ($jieqiConfigs['article']['makefull'] == 0 || JIEQI_CHAR_SET != JIEQI_SYSTEM_CHARSET) {
            $jieqiTpl->assign('url_fullpage', $article_static_url . '/reader.php?aid=' . $article->getVar('articleid'));
        } else {
            $jieqiTpl->assign('url_fullpage', jieqi_uploadurl($jieqiConfigs['article']['fulldir'], $jieqiConfigs['article']['fullurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . $jieqiConfigs['article']['htmlfile']);
        }
    } else {
        $jieqiTpl->assign('url_read', '#');
        $jieqiTpl->assign('url_fullpage', '#');
    }
    //放入书架
    $jieqiTpl->assign('url_bookcase', $article_dynamic_url . '/addbookcase.php?bid=' . $article->getVar('articleid'));
    //推荐本书
    $jieqiTpl->assign('url_uservote', $article_dynamic_url . '/uservote.php?id=' . $article->getVar('articleid'));
    //作家专栏
    if ($article->getVar('authorid') > 0) {
        $jieqiTpl->assign('url_authorpage', $article_dynamic_url . '/authorpage.php?id=' . $article->getVar('authorid'));
    } else {
        $jieqiTpl->assign('url_authorpage', '#');
    }
    //打包下载
    if ($article->getVar('chapters', 'n') > 0) {
        if ($jieqiConfigs['article']['makehtml'] == 0) {
            $jieqiTpl->assign('url_download', '#');
        } else {
            $jieqiTpl->assign('url_download', jieqi_uploadurl($jieqiConfigs['article']['zipdir'], $jieqiConfigs['article']['zipurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . $jieqi_file_postfix['zip']);
        }
    } else {
        $jieqiTpl->assign('url_download', '#');
    }
    //电子书部分
    $articletype = intval($article->getVar('articletype'));
    if (($articletype & 1) > 0) {
        $hasebook = 1;
    } else {
        $hasebook = 0;
    }
    if (($articletype & 2) > 0) {
        $hasobook = 1;
    } else {
        $hasobook = 0;
    }
    if (($articletype & 4) > 0) {
        $hastbook = 1;
    } else {
        $hastbook = 0;
    }
    if ($hasobook == 1) {
        include_once $GLOBALS['jieqiModules']['obook']['path'] . '/class/obook.php';
        $obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler');
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('articleid', $article->getVar('articleid'), '='));
        $obook_handler->queryObjects($criteria);
        $obook = $obook_handler->getObject();
        if (is_object($obook) && $obook->getVar('display') == 0 && $obook->getVar('size') > 0) {
            $jieqiTpl->assign('obook_obookid', $obook->getVar('obookid'));
            $jieqiTpl->assign('obook_lastvolume', $obook->getVar('lastvolume'));
            $jieqiTpl->assign('obook_lastvolumeid', $obook->getVar('lastvolumeid'));
            $jieqiTpl->assign('obook_lastchapter', $obook->getVar('lastchapter'));
            $jieqiTpl->assign('obook_lastchapterid', $obook->getVar('lastchapterid'));
            $jieqiTpl->assign('obook_lastupdate', date(JIEQI_DATE_FORMAT, $obook->getVar('lastupdate')));
            $jieqiTpl->assign('obook_size', $obook->getVar('size'));
            $jieqiTpl->assign('obook_publishid', $obook->getVar('publishid'));
        } else {
            $hasobook = 0;
        }
    }
    $jieqiTpl->assign('articletype', $articletype);
    $jieqiTpl->assign('hasebook', $hasebook);
    $jieqiTpl->assign('hasobook', $hasobook);
    $jieqiTpl->assign('hastbook', $hastbook);
    $jieqiTpl->assign('url_goodreview', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid') . '&type=good');
    $jieqiTpl->assign('url_allreview', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid') . '&type=all');
    $jieqiTpl->assign('url_review', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid'));
    if (!empty($_SESSION['jieqiUserId'])) {
        $jieqiTpl->assign('enablepost', 1);
    } else {
        $jieqiTpl->assign('enablepost', 0);
    }
    $jieqiTpl->setCaching(0);
    $jieqiTpl->assign('jieqi_contents', $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/staticinfo.html'));
    ob_start();
    include JIEQI_ROOT_PATH . '/footer.php';
    $pagecontent = ob_get_contents();
    ob_end_clean();
    if (!empty($jieqiConfigs['article']['fakeprefix'])) {
        $dirname = JIEQI_ROOT_PATH . '/' . $jieqiConfigs['article']['fakeprefix'] . 'info';
    } else {
        $dirname = JIEQI_ROOT_PATH . '/files/article/info';
    }
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname = $dirname . jieqi_getsubdir($article->getVar('articleid', 'n'));
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname .= '/' . $article->getVar('articleid', 'n') . $jieqiConfigs['article']['fakefile'];
    jieqi_writefile($dirname, $pagecontent);
    return true;
}
예제 #4
0
파일: checklogin.php 프로젝트: thu0ng91/jmc
/**
 * 用户登录后处理
 * 
 * @param      object      $jieqiUsers 用户对象
 * @access     public
 * @return     bool
 */
function jieqi_loginprocess($jieqiUsers, $usecookie = 0)
{
    global $jieqiConfigs;
    global $jieqiHonors;
    global $jieqiGroups;
    if (!isset($jieqiConfigs['system'])) {
        jieqi_getconfigs('system', 'configs');
    }
    include_once JIEQI_ROOT_PATH . '/class/users.php';
    $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler');
    //更新在线用户表
    include_once JIEQI_ROOT_PATH . '/class/online.php';
    $online_handler =& JieqiOnlineHandler::getInstance('JieqiOnlineHandler');
    $criteria = new CriteriaCompo(new Criteria('uid', $jieqiUsers->getVar('uid', 'n')));
    $criteria->setSort('updatetime');
    $criteria->setOrder('DESC');
    $online_handler->queryObjects($criteria);
    $online = $online_handler->getObject();
    //读cookie信息
    $jieqi_user_info = array();
    if (!empty($_COOKIE['jieqiUserInfo'])) {
        $jieqi_user_info = jieqi_strtosary($_COOKIE['jieqiUserInfo']);
    } else {
        $jieqi_user_info = array();
    }
    $jieqi_visit_info = array();
    if (!empty($_COOKIE['jieqiVisitInfo'])) {
        $jieqi_visit_info = jieqi_strtosary($_COOKIE['jieqiVisitInfo']);
    } else {
        $jieqi_visit_info = array();
    }
    if (is_object($online)) {
        $ip = jieqi_userip();
        if (JIEQI_SESSION_EXPRIE > 0) {
            $exprie_time = JIEQI_SESSION_EXPRIE;
        } else {
            $exprie_time = @ini_get('session.gc_maxlifetime');
        }
        if (empty($exprie_time)) {
            $exprie_time = 1800;
        }
        if (defined('JIEQI_DENY_RELOGIN') && JIEQI_DENY_RELOGIN == 1 && JIEQI_NOW_TIME - $online->getVar('updatetime') < $exprie_time && $online->getVar('ip', 'n') != $ip && $jieqi_visit_info['jieqiUserId'] != $jieqiUsers->getVar('uid')) {
            return -8;
        }
        $tmpvar = strlen($jieqiUsers->getVar('name', 'q')) > 0 ? $jieqiUsers->getVar('name', 'q') : $jieqiUsers->getVar('uname', 'q');
        $sql = "UPDATE " . jieqi_dbprefix('system_online') . " SET uid=" . $jieqiUsers->getVar('uid', 'q') . ", sid='" . jieqi_dbslashes(session_id()) . "', uname='" . $jieqiUsers->getVar('uname', 'q') . "', name='" . $tmpvar . "', pass='******'pass', 'q') . "',email='" . $jieqiUsers->getVar('email', 'q') . "', groupid=" . $jieqiUsers->getVar('groupid', 'q') . ", updatetime=" . JIEQI_NOW_TIME . ", ip='" . jieqi_dbslashes($ip) . "' WHERE uid=" . $jieqiUsers->getVar('uid', 'q') . " OR sid='" . jieqi_dbslashes(session_id()) . "'";
        $online_handler->db->query($sql);
    } else {
        include_once JIEQI_ROOT_PATH . '/include/visitorinfo.php';
        $online = $online_handler->create();
        $online->setVar('uid', $jieqiUsers->getVar('uid', 'n'));
        $online->setVar('siteid', JIEQI_SITE_ID);
        $online->setVar('sid', session_id());
        $online->setVar('uname', $jieqiUsers->getVar('uname', 'n'));
        $tmpvar = strlen($jieqiUsers->getVar('name', 'n')) > 0 ? $jieqiUsers->getVar('name', 'n') : $jieqiUsers->getVar('uname', 'n');
        $online->setVar('name', $tmpvar);
        $online->setVar('pass', $jieqiUsers->getVar('pass', 'n'));
        $online->setVar('email', $jieqiUsers->getVar('email', 'n'));
        $online->setVar('groupid', $jieqiUsers->getVar('groupid', 'n'));
        $tmpvar = JIEQI_NOW_TIME;
        $online->setVar('logintime', $tmpvar);
        $online->setVar('updatetime', $tmpvar);
        $online->setVar('operate', '');
        $tmpvar = VisitorInfo::getIp();
        $online->setVar('ip', $tmpvar);
        $online->setVar('browser', VisitorInfo::getBrowser());
        $online->setVar('os', VisitorInfo::getOS());
        $location = VisitorInfo::getIpLocation($tmpvar);
        if (JIEQI_SYSTEM_CHARSET == 'big5') {
            include_once JIEQI_ROOT_PATH . '/include/changecode.php';
            $location = jieqi_gb2big5($location);
        }
        $online->setVar('location', $location);
        $online->setVar('state', '0');
        $online->setVar('flag', '0');
        $online_handler->insert($online);
    }
    //删除过期的在线用户
    unset($criteria);
    $criteria = new CriteriaCompo(new Criteria('updatetime', JIEQI_NOW_TIME - $jieqiConfigs['system']['onlinetime'], '<'));
    $online_handler->delete($criteria);
    //检查短消息
    include_once JIEQI_ROOT_PATH . '/class/message.php';
    $message_handler = JieqiMessageHandler::getInstance('JieqiMessageHandler');
    $criteria = new CriteriaCompo(new Criteria('toid', $jieqiUsers->getVar('uid'), '='));
    $criteria->add(new Criteria('isread', 0, '='));
    $criteria->add(new Criteria('todel', 0, '='));
    $newmsgnum = $message_handler->getCount($criteria);
    unset($criteria);
    //有短消息
    //用户信息
    $previewlogin = intval($jieqiUsers->getVar('lastlogin'));
    $jieqiUsers->setVar('lastlogin', JIEQI_NOW_TIME);
    $userset = unserialize($jieqiUsers->getVar('setting', 'n'));
    if (!isset($userset['lastip']) || $userset['lastip'] != jieqi_userip()) {
        $userset['lastip'] = jieqi_userip();
    }
    if (!isset($userset['logindate']) || $userset['logindate'] != date('Y-m-d')) {
        $userset['logindate'] = date('Y-m-d');
        //增加登陆积分
        $jieqiUsers->setVar('experience', $jieqiUsers->getVar('experience') + $jieqiConfigs['system']['scorelogin']);
        $jieqiUsers->setVar('score', $jieqiUsers->getVar('score') + $jieqiConfigs['system']['scorelogin']);
    }
    //如果换月了,清空月积分
    //if(date('Y-m', $previewlogin) != date('Y-m', JIEQI_NOW_TIME)) $jieqiUsers->setVar('monthscore', 0);
    $jieqiUsers->setVar('setting', serialize($userset));
    $jieqiUsers->unsetNew();
    $users_handler->insert($jieqiUsers);
    header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
    //设置SESSION
    jieqi_setusersession($jieqiUsers);
    if ($newmsgnum > 0) {
        $_SESSION['jieqiNewMessage'] = $newmsgnum;
    }
    //后台登录状态
    $jieqi_online_info = empty($_COOKIE['jieqiOnlineInfo']) ? array() : jieqi_strtosary($_COOKIE['jieqiOnlineInfo']);
    if (isset($jieqi_online_info['jieqiAdminLogin']) && $jieqi_online_info['jieqiAdminLogin'] == 1) {
        $_SESSION['jieqiAdminLogin'] = 1;
    }
    $jieqi_user_info['jieqiUserId'] = $_SESSION['jieqiUserId'];
    $jieqi_user_info['jieqiUserUname'] = $_SESSION['jieqiUserUname'];
    $jieqi_user_info['jieqiUserName'] = $_SESSION['jieqiUserName'];
    $jieqi_user_info['jieqiUserGroup'] = $_SESSION['jieqiUserGroup'];
    $jieqi_user_info['jieqiUserGroupName'] = $jieqiGroups[$_SESSION['jieqiUserGroup']];
    $jieqi_user_info['jieqiUserVip'] = $_SESSION['jieqiUserVip'];
    $jieqi_user_info['jieqiUserHonorId'] = $_SESSION['jieqiUserHonorId'];
    $jieqi_user_info['jieqiUserHonor'] = $_SESSION['jieqiUserHonor'];
    if ($newmsgnum > 0) {
        $jieqi_user_info['jieqiNewMessage'] = $newmsgnum;
    }
    if ($usecookie) {
        $jieqi_user_info['jieqiUserPassword'] = $jieqiUsers->getVar('pass', 'n');
    }
    include_once JIEQI_ROOT_PATH . '/include/changecode.php';
    if (JIEQI_SYSTEM_CHARSET == 'gbk') {
        $jieqi_user_info['jieqiUserUname_un'] = jieqi_gb2unicode($_SESSION['jieqiUserUname']);
        $jieqi_user_info['jieqiUserName_un'] = jieqi_gb2unicode($_SESSION['jieqiUserName']);
        $jieqi_user_info['jieqiUserHonor_un'] = jieqi_gb2unicode($_SESSION['jieqiUserHonor']);
        $jieqi_user_info['jieqiUserGroupName_un'] = jieqi_gb2unicode($jieqiGroups[$_SESSION['jieqiUserGroup']]);
    } else {
        $jieqi_user_info['jieqiUserUname_un'] = jieqi_big52unicode($_SESSION['jieqiUserUname']);
        $jieqi_user_info['jieqiUserName_un'] = jieqi_big52unicode($_SESSION['jieqiUserName']);
        $jieqi_user_info['jieqiUserHonor_un'] = jieqi_big52unicode($_SESSION['jieqiUserHonor']);
        $jieqi_user_info['jieqiUserGroupName_un'] = jieqi_gb2unicode($jieqiGroups[$_SESSION['jieqiUserGroup']]);
    }
    $jieqi_user_info['jieqiUserLogin'] = JIEQI_NOW_TIME;
    if ($usecookie < 0) {
        $usecookie = 0;
    } elseif ($usecookie == 1) {
        $usecookie = 315360000;
    }
    if ($usecookie) {
        $cookietime = JIEQI_NOW_TIME + $usecookie;
    } else {
        $cookietime = 0;
    }
    @setcookie('jieqiUserInfo', jieqi_sarytostr($jieqi_user_info), $cookietime, '/', JIEQI_COOKIE_DOMAIN, 0);
    $jieqi_visit_info['jieqiUserLogin'] = $jieqi_user_info['jieqiUserLogin'];
    $jieqi_visit_info['jieqiUserId'] = $jieqi_user_info['jieqiUserId'];
    @setcookie('jieqiVisitInfo', jieqi_sarytostr($jieqi_visit_info), JIEQI_NOW_TIME + 99999999, '/', JIEQI_COOKIE_DOMAIN, 0);
    //更新在线用户
    include_once JIEQI_ROOT_PATH . '/lib/template/template.php';
    $jieqiTpl =& JieqiTpl::getInstance();
    $jieqiTpl->clear_cache(JIEQI_ROOT_PATH . '/templates/online.html');
    return 0;
}
예제 #5
0
파일: global.php 프로젝트: thu0ng91/jmc
 /**
  * 构造函数,初始参数赋值
  * 
  * @param      array
  * @access     private
  * @return     void
  */
 function JieqiBlock(&$vars)
 {
     global $jieqiModules;
     global $jieqiTpl;
     $this->blockvars = $vars;
     if (empty($this->module)) {
         $this->module = empty($this->blockvars['module']) ? 'system' : $this->blockvars['module'];
     }
     if (empty($this->blockvars['template'])) {
         $this->blockvars['template'] = $this->template;
     }
     if (!empty($this->blockvars['template'])) {
         $this->blockvars['tlpfile'] = $jieqiModules[$this->module]['path'] . '/templates/blocks/' . $this->blockvars['template'];
     } else {
         $this->blockvars['tlpfile'] = '';
     }
     if ($this->cachetime == 0) {
         $this->cachetime = JIEQI_CACHE_LIFETIME;
     }
     if (empty($this->blockvars['cachetime'])) {
         $this->blockvars['cachetime'] = $this->cachetime;
     }
     if (empty($this->blockvars['overtime'])) {
         $this->blockvars['overtime'] = 0;
     }
     if (empty($this->blockvars['cacheid'])) {
         $this->blockvars['cacheid'] = NULL;
     }
     if (empty($this->blockvars['compileid'])) {
         $this->blockvars['compileid'] = NULL;
     }
     if (!empty($this->blockvars['template'])) {
         $this->template = $this->blockvars['template'];
     }
     if (!is_object($jieqiTpl) && !empty($this->blockvars['tlpfile'])) {
         include_once JIEQI_ROOT_PATH . '/lib/template/template.php';
         $jieqiTpl =& JieqiTpl::getInstance();
     }
 }
예제 #6
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;
}
예제 #7
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;
}
예제 #8
0
파일: qqreturn.php 프로젝트: thu0ng91/jmc
function my_msgwin($title, $content, $icon = '')
{
    include_once JIEQI_ROOT_PATH . '/lib/template/template.php';
    $title = jieqi_htmlstr($title);
    $jieqiTpl =& JieqiTpl::getInstance();
    $jieqiTpl->assign(array('jieqi_themeurl' => JIEQI_URL . '/themes/' . JIEQI_THEME_SET . '/', 'jieqi_themecss' => JIEQI_URL . '/themes/' . JIEQI_THEME_SET . '/style.css', 'pagetitle' => $title, 'title' => $title, 'content' => $content, 'copyright' => $jieqiLang['pay']['copy_right'] . '&copy; <a href="' . JIEQI_URL . '/">' . JIEQI_SITE_NAME . '</a>'));
    $jieqiTpl->setCaching(0);
    $jieqiTpl->display('msgwin.html');
    jieqi_freeresource();
}
예제 #9
0
function makestaticreview($article_id)
{
    global $jieqiConfigs;
    global $jieqiTpl;
    global $article_dynamic_url;
    global $article_static_url;
    if (!is_object($jieqiTpl)) {
        $jieqiTpl =& JieqiTpl::getInstance();
    }
    if (empty($article_id) || !is_numeric($article_id)) {
        return false;
    }
    $review_handler =& JieqiReviewHandler::getInstance('JieqiReviewHandler');
    $criteria = new CriteriaCompo(new Criteria('ownerid', $article_id));
    $criteria->setSort('topflag DESC, topicid');
    $criteria->setOrder('DESC');
    $criteria->setLimit($jieqiConfigs['article']['reviewnew']);
    $criteria->setStart(0);
    $review_handler->queryObjects($criteria);
    $reviewrows = array();
    $k = 0;
    while ($v = $review_handler->getObject()) {
        $start = 3;
        if ($v->getVar('topflag') == 1) {
            $reviewrows[$k]['topflag'] = 1;
            $start += 4;
        } else {
            $reviewrows[$k]['topflag'] = 0;
        }
        if ($v->getVar('goodflag') == 1) {
            $reviewrows[$k]['goodflag'] = 1;
            $start += 4;
        } else {
            $reviewrows[$k]['goodflag'] = 0;
        }
        if ($jieqiConfigs['article']['reviewenter'] == '0') {
            $reviewrows[$k]['content'] = jieqi_htmlstr(jieqi_limitwidth(str_replace(array("\r", "\n"), array('', ' '), $v->getVar('reviewtext', 'n')), $jieqiConfigs['article']['reviewwidth'], $start));
        } else {
            $reviewrows[$k]['content'] = jieqi_htmlstr(jieqi_limitwidth($v->getVar('reviewtext', 'n'), $jieqiConfigs['article']['reviewwidth'], $start));
        }
        $reviewrows[$k]['postdate'] = date(JIEQI_DATE_FORMAT . ' ' . JIEQI_TIME_FORMAT, $v->getVar('postdate'));
        $reviewrows[$k]['userid'] = $v->getVar('userid');
        $reviewrows[$k]['username'] = $v->getVar('username');
        $k++;
    }
    $jieqiTpl->assign_by_ref('reviewrows', $reviewrows);
    $jieqiTpl->assign('url_goodreview', $article_dynamic_url . '/review.php?aid=' . $article_id . '&type=good');
    $jieqiTpl->assign('url_allreview', $article_dynamic_url . '/review.php?aid=' . $article_id . '&type=all');
    $jieqiTpl->assign('url_review', $article_dynamic_url . '/review.php?aid=' . $article_id);
    $jieqiTpl->setCaching(0);
    $reviewjs = $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/staticreview.html');
    $reviewjs = "document.write('" . jieqi_setslashes(str_replace(array("\n", "\r"), "", $reviewjs), '"') . "');";
    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_id);
    if (!file_exists($dirname)) {
        jieqi_createdir($dirname);
    }
    $dirname .= '/' . $article_id . 'r.js';
    jieqi_writefile($dirname, $reviewjs);
    return true;
}