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) { $selfclassid = $classid; $doenews = 0; $cr = $empire->fetch1("select classpagekey,intro,classimg,cgroupid from {$dbtbpre}enewsclass where classid='{$classid}'"); $mid = $class_r[$classid][modid]; //权限 if ($cr['cgroupid']) { $classlevel = AddCheckClassLevel($classid, $cr['cgroupid'], ''); } //页面 $pagetitle = htmlspecialchars($class_r[$classid][classname]); $pagekey = htmlspecialchars($cr['classpagekey']); $pagedes = htmlspecialchars($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]; } if ($class_r[$classid][maxnum]) { $limit = " limit " . $class_r[$classid][maxnum]; $limitnum = $class_r[$classid][maxnum]; } //优化 $yhid = $class_r[$classid][yhid]; if ($yhid) { $yhadd = ReturnYhSql($yhid, $yhvar); } $query = "select " . ReturnSqlListF($mid) . " from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where " . $yhadd . "classid='{$classid}' and checked=1 order by " . ReturnSetTopSql('list') . $addorder . $limit; $totalquery = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where " . $yhadd . "classid='{$classid}' and checked=1"; //统计 $doclasspath = ReturnSaveClassPath($classid, 0); $dopath = ECMS_PATH . $doclasspath . "/"; 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 == 1) { $selfclassid = $classid; $doenews = 1; $cr = $empire->fetch1("select ztpagekey,intro,ztimg,classtempid from {$dbtbpre}enewszt where ztid='{$classid}'"); //页面 $pagetitle = htmlspecialchars($class_zr[$classid][ztname]); $pagekey = htmlspecialchars($cr['ztpagekey']); $pagedes = htmlspecialchars($cr['intro']); $classimg = $cr['ztimg']; $url = ReturnZtLink($classid); $haveclass = 1; if ($class_zr[$classid][islist] != 1) { $classtemp = $class_zr[$classid][islist] == 2 ? GetZtText($classid) : GetClassTemp($cr['classtempid']); NewsBq($classid, $classtemp, 3, 0); return ""; } //排序 if (empty($class_zr[$classid][reorder])) { $addorder = "newstime desc"; } else { $addorder = $class_zr[$classid][reorder]; } if ($class_zr[$classid][maxnum]) { $limit = " limit " . $class_zr[$classid][maxnum]; $limitnum = $class_zr[$classid][maxnum]; } //优化 $tbname = $class_zr[$classid][tbname]; $mid = $etable_r[$tbname][mid]; $yhid = $class_zr[$classid][yhid]; if ($yhid) { $yhadd = ReturnYhSql($yhid, $yhvar); } $query = "select " . ReturnSqlListF($mid) . " from {$dbtbpre}ecms_" . $class_zr[$classid][tbname] . " where " . $yhadd . "ztid like '%|" . $classid . "|%' and checked=1 order by " . $addorder . $limit; $totalquery = "select count(*) as total from {$dbtbpre}ecms_" . $class_zr[$classid][tbname] . " where " . $yhadd . "ztid like '%|" . $classid . "|%' and checked=1"; //统计 $doclasspath = ReturnSaveZtPath($classid, 0); $dopath = ECMS_PATH . $doclasspath . "/"; if (empty($class_zr[$classid][zturl])) { $dolink = $public_r[newsurl] . $doclasspath . "/"; } else { $dolink = $class_zr[$classid][zturl] . "/"; } $dotype = $class_zr[$classid][zttype]; $classname = $class_zr[$classid][ztname]; $lencord = $class_zr[$classid][ztnum]; //记录数 $onclick = "<script src='" . $public_r[newsurl] . "e/public/onclick/?enews=dozt&ztid={$classid}'></script>"; //模板 $listtempid = $class_zr[$classid][listtempid]; } elseif ($enews == 3) { $selfclassid = $classid; $doenews = 0; $cr = $empire->fetch1("select classpagekey,intro,classimg,cgroupid from {$dbtbpre}enewsclass where classid='{$classid}'"); $mid = $class_r[$classid][modid]; //权限 if ($cr['cgroupid']) { $classlevel = AddCheckClassLevel($classid, $cr['cgroupid'], ''); } //页面 $pagetitle = htmlspecialchars($class_r[$classid][classname]); $pagekey = htmlspecialchars($cr['classpagekey']); $pagedes = htmlspecialchars($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]; } if ($class_r[$classid][maxnum]) { $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); } $query = "select " . ReturnSqlListF($mid) . " from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where " . $yhadd . "(" . $whereclass . ") and checked=1 order by " . ReturnSetTopSql('list') . $addorder . $limit; $totalquery = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where " . $yhadd . "(" . $whereclass . ") and checked=1"; //统计 $doclasspath = ReturnSaveClassPath($classid, 0); $dopath = ECMS_PATH . $doclasspath . "/"; 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 = htmlspecialchars($userlistr['pagetitle']); $pagekey = $pagetitle; $pagedes = $pagetitle; $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); //分页列表函数 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); $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, $string); WriteFiletext($path, $classlevel . $string); $string = ''; } $no++; } $empire->free($sql); }
printerror("ErrorUrl", "history.go(-1)", 1); } $n_r = $empire->fetch1("select ztid,ztname,intro,ztimg,ztpagekey,restb from {$dbtbpre}enewszt where ztid='{$classid}'"); if (!$n_r['ztid']) { printerror("ErrorUrl", "history.go(-1)", 1); } $pubid = '-' . $classid; $search = "&doaction=dozt&classid={$classid}"; //标题链接 $titleurl = sys_ReturnBqZtname($n_r); $title = stripSlashes($n_r['ztname']); $pagetitle = ehtmlspecialchars($title); //评分 $infopfennum = 0; $pinfopfen = 0; $url = ReturnZtLink($n_r['ztid']) . " > " . $fun_r[pl]; } else { if (empty($id) || empty($classid)) { printerror("ErrorUrl", "history.go(-1)", 1); } if (empty($class_r[$classid][tbname]) || InfoIsInTable($class_r[$classid][tbname])) { printerror("ErrorUrl", "history.go(-1)", 1); } $n_r = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$classid][tbname] . " where id='{$id}' limit 1"); if (!$n_r['id'] || $n_r['classid'] != $classid) { printerror("ErrorUrl", "history.go(-1)", 1); } $pubid = ReturnInfoPubid($classid, $id); $search = "&classid={$classid}&id=" . $id; //标题链接 $titleurl = sys_ReturnBqTitleLink($n_r);
if ($ztid) { $ztid = RepPostVar($ztid); if (strstr($ztid, ',')) { $son_r = sys_ReturnMoreZt($ztid); $trueztid = $son_r[0]; $add .= ' and (' . $son_r[1] . ')'; } else { $trueztid = intval($ztid); $add .= " and ztid like '%|" . $trueztid . "|%'"; if ($pageecms == 1) { $cr = $empire->fetch1("select ztpagekey,intro,ztimg from {$dbtbpre}enewszt where ztid='{$trueztid}'"); $pagetitle = $class_zr[$trueztid]['ztname']; $pagekey = $cr['ztpagekey']; $pagedes = $cr['intro']; $classimg = $cr['ztimg'] ? $cr['ztimg'] : $public_r[newsurl] . 'e/data/images/notimg.gif'; $url = ReturnZtLink($trueztid); $pageclassid = $trueztid; $GLOBALS['navclassid'] = $trueztid; } } if (empty($class_zr[$trueztid][tbname])) { printerror('ErrorUrl', '', 1); } if (empty($tbname)) { $tbname = $class_zr[$trueztid][tbname]; $mid = $etable_r[$tbname][mid]; $yhid = $class_zr[$trueztid][yhid]; } if ($class_zr[$trueztid][reorder] && empty($class_r[$trueclassid][reorder])) { $addorder = $class_zr[$trueztid][reorder]; }