示例#1
0
文件: index.php 项目: novnan/meiju
if (empty($ttr['typeid']) || empty($tbname) || InfoIsInTable($tbname)) {
    printerror("ErrorUrl", "history.go(-1)", 1);
}
//moreport
if (Moreport_ReturnMustDt()) {
    $ttr['listdt'] = 1;
    $ttr['repagenum'] = 0;
}
//是否支持动态页
if (empty($ttr['listdt']) && !$ttr['repagenum']) {
    $tturl = sys_ReturnBqInfoTypeUrl($ttid);
    Header("Location:{$tturl}");
    exit;
}
$GLOBALS['navclassid'] = $ttid;
$url = ReturnInfoTypeLink($ttid);
$pagetitle = $ttr['tname'];
$pagekey = $ttr['pagekey'];
$pagedes = $ttr['intro'];
$classimg = $ttr['timg'] ? $ttr['timg'] : $public_r[newsurl] . 'e/data/images/notimg.gif';
$add = "ttid='{$ttid}'";
$have_class = 1;
//排序
if (empty($ttr['reorder'])) {
    $addorder = "newstime desc";
} else {
    $addorder = $ttr['reorder'];
}
//列表模板
$tempid = $ttr['listtempid'];
if (empty($tempid)) {
示例#2
0
function ListHtml($classid, $fields, $enews = 0, $userlistr = "")
{
    global $empire, $dbtbpre, $emod_r, $public_r, $class_r, $class_zr, $fun_r, $class_tr, $level_r, $etable_r;
    //不生成栏目
    if (($enews == 0 || $enews == 3) && ($class_r[$classid]['listdt'] || $class_r[$classid]['wburl'] || strstr($public_r['nreclass'], ',' . $classid . ','))) {
        return '';
    }
    $GLOBALS['navclassid'] = $classid;
    $doclass = "index";
    $classlevel = '';
    $yhvar = 'qlist';
    if ($enews == 0) {
        if (InfoIsInTable($class_r[$classid][tbname])) {
            return '';
        }
        $selfclassid = $classid;
        $doenews = 0;
        $cr = $empire->fetch1("select classpagekey,intro,classimg,cgroupid,repagenum,bdinfoid from {$dbtbpre}enewsclass where classid='{$classid}'");
        //绑定信息
        if (!empty($cr['bdinfoid'])) {
            ReClassBdInfo($classid);
            return '';
        }
        $mid = $class_r[$classid][modid];
        //权限
        if ($cr['cgroupid']) {
            $classlevel = AddCheckClassLevel($classid, $cr['cgroupid'], '');
        }
        //页面
        $pagetitle = ehtmlspecialchars($class_r[$classid][classname]);
        $pagekey = ehtmlspecialchars($cr['classpagekey']);
        $pagedes = ehtmlspecialchars($cr['intro']);
        $classimg = $cr['classimg'];
        $url = ReturnClassLink($classid);
        $haveclass = 0;
        //排序
        if (empty($class_r[$classid][reorder])) {
            $addorder = "newstime desc";
        } else {
            $addorder = $class_r[$classid][reorder];
        }
        //分页参数
        $pagefunr = eReturnRewriteLink('classpage', $classid, 0);
        $pagefunr['repagenum'] = $cr['repagenum'];
        $totalrepage = $cr['repagenum'] * $class_r[$classid][lencord];
        if ($totalrepage) {
            $limit = " limit " . $totalrepage;
        }
        if ($class_r[$classid][maxnum]) {
            if ($class_r[$classid][maxnum] < $totalrepage) {
                $limit = " limit " . $class_r[$classid][maxnum];
            }
            $limitnum = $class_r[$classid][maxnum];
        }
        //优化
        $yhid = $class_r[$classid][yhid];
        if ($yhid) {
            $yhadd = ReturnYhSql($yhid, $yhvar, 1);
        }
        $query = "select " . ReturnSqlListF($mid) . " from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where " . $yhadd . "classid='{$classid}' order by " . ReturnSetTopSql('list') . $addorder . $limit;
        $totalquery = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where " . $yhadd . "classid='{$classid}'";
        //统计
        $doclasspath = ReturnSaveClassPath($classid, 0);
        $dopath = eReturnTrueEcmsPath() . $doclasspath . "/";
        //moreport
        if (empty($class_r[$classid][classurl])) {
            $dolink = $public_r[newsurl] . $doclasspath . "/";
        } else {
            $dolink = $class_r[$classid][classurl] . "/";
        }
        $dotype = $class_r[$classid][classtype];
        $classname = $class_r[$classid][classname];
        $lencord = $class_r[$classid][lencord];
        //记录数
        $onclick = "<script src='" . $public_r[newsurl] . "e/public/onclick/?enews=doclass&classid={$classid}'></script>";
        //模板
        $listtempid = $class_r[$classid][listtempid];
    } elseif ($enews == 5) {
        $mid = $class_tr[$classid]['mid'];
        $tbname = $emod_r[$mid]['tbname'];
        if (InfoIsInTable($tbname)) {
            return '';
        }
        $selfclassid = $classid;
        $doenews = 1;
        $cr = $empire->fetch1("select tnum,listtempid,maxnum,reorder,timg,intro,pagekey,listdt,repagenum from {$dbtbpre}enewsinfotype where typeid='{$classid}'");
        //页面
        $pagetitle = ehtmlspecialchars($class_tr[$classid]['tname']);
        $pagekey = ehtmlspecialchars($cr['pagekey']);
        $pagedes = ehtmlspecialchars($cr['intro']);
        $classimg = $cr['timg'];
        $url = ReturnInfoTypeLink($classid);
        $haveclass = 1;
        if ($cr['listdt']) {
            return '';
        }
        //排序
        if (empty($cr['reorder'])) {
            $addorder = 'newstime desc';
        } else {
            $addorder = $cr['reorder'];
        }
        //分页参数
        $pagefunr = eReturnRewriteLink('ttpage', $classid, 0);
        $pagefunr['repagenum'] = $cr['repagenum'];
        $totalrepage = $cr['repagenum'] * $cr['tnum'];
        if ($totalrepage) {
            $limit = " limit " . $totalrepage;
        }
        if ($cr['maxnum']) {
            if ($cr['maxnum'] < $totalrepage) {
                $limit = " limit " . $cr['maxnum'];
            }
            $limitnum = $cr['maxnum'];
        }
        //优化
        $yhid = $class_tr[$classid]['yhid'];
        if ($yhid) {
            $yhadd = ReturnYhSql($yhid, $yhvar, 1);
        }
        $query = "select " . ReturnSqlListF($mid) . " from {$dbtbpre}ecms_" . $tbname . " where " . $yhadd . "ttid='{$classid}' order by " . $addorder . $limit;
        $totalquery = "select count(*) as total from {$dbtbpre}ecms_" . $tbname . " where " . $yhadd . "ttid='{$classid}'";
        //统计
        $doclasspath = ReturnSaveInfoTypePath($classid, 0);
        $dopath = eReturnTrueEcmsPath() . $doclasspath . "/";
        //moreport
        $dolink = $public_r[newsurl] . $doclasspath . "/";
        $dotype = $class_tr[$classid]['ttype'];
        $classname = $class_tr[$classid]['tname'];
        $lencord = $cr['tnum'];
        //记录数
        $onclick = "";
        //模板
        $listtempid = $cr['listtempid'];
    } elseif ($enews == 3) {
        if (InfoIsInTable($class_r[$classid][tbname])) {
            return '';
        }
        $selfclassid = $classid;
        $doenews = 0;
        $cr = $empire->fetch1("select classpagekey,intro,classimg,cgroupid,repagenum from {$dbtbpre}enewsclass where classid='{$classid}'");
        $mid = $class_r[$classid][modid];
        //权限
        if ($cr['cgroupid']) {
            $classlevel = AddCheckClassLevel($classid, $cr['cgroupid'], '');
        }
        //页面
        $pagetitle = ehtmlspecialchars($class_r[$classid][classname]);
        $pagekey = ehtmlspecialchars($cr['classpagekey']);
        $pagedes = ehtmlspecialchars($cr['intro']);
        $classimg = $cr['classimg'];
        $url = ReturnClassLink($classid);
        $haveclass = 1;
        //排序
        if (empty($class_r[$classid][reorder])) {
            $addorder = "newstime desc";
        } else {
            $addorder = $class_r[$classid][reorder];
        }
        //分页参数
        $pagefunr = eReturnRewriteLink('classpage', $classid, 0);
        $pagefunr['repagenum'] = $cr['repagenum'];
        $totalrepage = $cr['repagenum'] * $class_r[$classid][lencord];
        if ($totalrepage) {
            $limit = " limit " . $totalrepage;
        }
        if ($class_r[$classid][maxnum]) {
            if ($class_r[$classid][maxnum] < $totalrepage) {
                $limit = " limit " . $class_r[$classid][maxnum];
            }
            $limitnum = $class_r[$classid][maxnum];
        }
        $whereclass = ReturnClass($class_r[$classid][sonclass]);
        //优化
        $yhid = $class_r[$classid][yhid];
        if ($yhid) {
            $yhadd = ReturnYhSql($yhid, $yhvar, 1);
        }
        $query = "select " . ReturnSqlListF($mid) . " from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where " . $yhadd . "(" . $whereclass . ") order by " . ReturnSetTopSql('list') . $addorder . $limit;
        $totalquery = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where " . $yhadd . "(" . $whereclass . ")";
        //统计
        $doclasspath = ReturnSaveClassPath($classid, 0);
        $dopath = eReturnTrueEcmsPath() . $doclasspath . "/";
        //moreport
        if (empty($class_r[$classid][classurl])) {
            $dolink = $public_r[newsurl] . $doclasspath . "/";
        } else {
            $dolink = $class_r[$classid][classurl] . "/";
        }
        $dotype = $class_r[$classid][classtype];
        $classname = $class_r[$classid][classname];
        $lencord = $class_r[$classid][lencord];
        //记录数
        $onclick = "<script src='" . $public_r[newsurl] . "e/public/onclick/?enews=doclass&classid={$classid}'></script>";
        //模板
        $listtempid = $class_r[$classid][listtempid];
    } elseif ($enews == 4) {
        $selfclassid = 0;
        $doenews = 1;
        $userlistr['listsql'] = RepSqlTbpre($userlistr['listsql']);
        $userlistr['totalsql'] = RepSqlTbpre($userlistr['totalsql']);
        //页面
        $pagetitle = ehtmlspecialchars($userlistr['pagetitle']);
        $pagekey = ehtmlspecialchars($userlistr['pagekeywords']);
        $pagedes = ehtmlspecialchars($userlistr['pagedescription']);
        $haveclass = 1;
        if ($userlistr['maxnum']) {
            $limit = " limit " . $userlistr['maxnum'];
            $limitnum = $userlistr['maxnum'];
        }
        $query = stripSlashes($userlistr['listsql']) . $limit;
        //统计
        $totalquery = stripSlashes($userlistr['totalsql']);
        $dopath = $userlistr['addpath'] . $userlistr['filepath'];
        $dolink = $public_r[newsurl] . str_replace($userlistr['addpath'] . '../../', '', $dopath);
        $dotype = $userlistr['filetype'];
        $classname = $userlistr['pagetitle'];
        $lencord = $userlistr['lencord'];
        //记录数
        $onclick = '';
        $url = ReturnUserPLink($pagetitle, $dolink);
        //模板
        $listtempid = $userlistr['listtempid'];
    }
    if (empty($lencord)) {
        $lencord = 25;
    }
    //列表模板
    $listtemp_r = GetListTemp($listtempid);
    $listtemp = $listtemp_r[temptext];
    $subnews = $listtemp_r[subnews];
    $subtitle = $listtemp_r[subtitle];
    $docode = $listtemp_r[docode];
    $listvar = str_replace('[!--news.url--]', $public_r[newsurl], $listtemp_r[listvar]);
    $rownum = $listtemp_r[rownum];
    $formatdate = $listtemp_r[showdate];
    if (empty($rownum)) {
        $rownum = 1;
    }
    if (empty($mid)) {
        $mid = $listtemp_r[modid];
    }
    $field = ReturnReplaceListF($mid);
    //分页参数
    $pagefunr['dofile'] = $dofile;
    //分页列表函数
    if (!empty($public_r['listpagefun']) || !empty($public_r['listpagelistfun'])) {
        if (strstr($listtemp, '[!--show.page--]')) {
            $thefun = $public_r['listpagefun'];
            $bereplistpage = '[!--show.page--]';
        } else {
            $thefun = $public_r['listpagelistfun'];
            $bereplistpage = '[!--show.listpage--]';
        }
    } else {
        $thefun = 'sys_ShowListPage';
        $bereplistpage = '[!--show.page--]';
    }
    //替换模板变量
    $listtemp = str_replace('[!--newsnav--]', $url, $listtemp);
    //位置导航
    $listtemp = Class_ReplaceSvars($listtemp, $url, $selfclassid, $pagetitle, $pagekey, $pagedes, $classimg, $add, $doenews);
    $listtemp = str_replace('[!--page.stats--]', $onclick, $listtemp);
    $no = 1;
    $ok = 0;
    $changerow = 1;
    $num = $empire->gettotal($totalquery);
    //最大数
    if ($limitnum && $limitnum < $num) {
        $num = $limitnum;
    }
    $page = ceil($num / $lencord);
    //取得列表模板
    $list_exp = "[!--empirenews.listtemp--]";
    $list_r = explode($list_exp, $listtemp);
    //无信息
    if (empty($num)) {
        $noinfopath = $dopath . "index" . $dotype;
        NotinfoListHtml($noinfopath, $list_r, $classlevel);
        return "";
    }
    $sql = $empire->query($query);
    $listtext = $list_r[1];
    while ($k = $empire->fetch($sql)) {
        //替换列表变量
        $repvar = ReplaceListVars($no, $listvar, $subnews, $subtitle, $formatdate, $url, $haveclass, $k, $field, $docode);
        $listtext = str_replace("<!--list.var" . $changerow . "-->", $repvar, $listtext);
        $changerow += 1;
        //超过行数
        if ($changerow > $rownum) {
            $changerow = 1;
            $string .= $listtext;
            $listtext = $list_r[1];
        }
        if ($no % $lencord == 0 || $num % $lencord != 0 && $num == $no) {
            $ok += 1;
            $pagenum = ceil($no / $lencord);
            //首页
            if ($pagenum == 1) {
                $path = $dopath . "index" . $dotype;
            } else {
                $path = $dopath . "index_" . $ok . $dotype;
            }
            //取得分页参数
            $returnpager = $thefun($num, $pagenum, $dolink, $dotype, $page, $lencord, $ok, $myoptions, $pagefunr);
            $showpage = $returnpager['showpage'];
            $myoptions = $returnpager['option'];
            $list1 = str_replace($bereplistpage, $showpage, $list_r[0]);
            $list2 = str_replace($bereplistpage, $showpage, $list_r[2]);
            //多余数据
            if ($changerow <= $rownum && $listtext != $list_r[1]) {
                $string .= $listtext;
            }
            $listtext = $list_r[1];
            $changerow = 1;
            $string = $list1 . $string . $list2;
            //替换分页数
            $string = str_replace('[!--list.pageno--]', $pagenum == 1 ? '' : $pagenum, $string);
            WriteFiletext($path, $classlevel . $string);
            $string = '';
        }
        $no++;
    }
    $empire->free($sql);
}