function DtGetHtml($add, $newstemp_r, $mid, $tbname, $line, $page_line, $start, $page, $search) { global $public_r, $class_r, $class_zr, $class_tr, $fun_r, $empire, $dbtbpre, $emod_r, $level_r; //更新点击 $empire->query("update {$dbtbpre}ecms_" . $tbname . " set onclick=onclick+1 where id='{$add['id']}' limit 1"); $add['onclick'] = $add['onclick'] + 1; //模板参数 $newstemptext = $newstemp_r[temptext]; $formatdate = $newstemp_r[showdate]; //页面 $pagetitle = ehtmlspecialchars($add[title]); $url = ReturnClassLink($add[classid]); //导航 $newstemptext = DtInfo_ReplaceSvars($newstemptext, $url, $add[classid], $pagetitle, $add[keyboard], $pagetitle); //相关信息 if (strstr($newstemptext, '[!--other.link--]')) { $keyboardtext = GetKeyboard($add[keyboard], $add[keyid], $add[classid], $add[id], $class_r[$add[classid]][link_num]); } //分页字段 $ptitle = $add['title']; $truepage = ''; $titleselect = ''; $expage = '[!--empirenews.page--]'; //分页符 $pf = $emod_r[$mid]['pagef']; if ($pf && strstr($add[$pf], $expage)) { $n_r = explode($expage, $add[$pf]); $thispagenum = count($n_r); if ($page < 0 || $page > $thispagenum - 1) { $page = 0; } $add[$pf] = $n_r[$page]; if ($page) { $ti_r = explode('[/!--empirenews.page--]', $n_r[$page]); if (count($ti_r) >= 2) { $ptitle = $ti_r[0]; $add[$pf] = $ti_r[1]; } else { $ptitle = $add['title'] . '(' . ($page + 1) . ')'; } } //伪静态 $pagefunr = eReturnRewriteInfoUrl($add['classid'], $add['id'], 0); $pagefunr['repagenum'] = 0; //取得分页 $truepage = InfoUsePage($thispagenum, $line, $page_line, $start, $page, $search, $pagefunr); //下拉式分页 if (strstr($newstemptext, '[!--title.select--]')) { for ($j = 0; $j < $thispagenum; $j++) { $spurl = eReturnRewritePageLink($pagefunr, $j); if ($j == 0) { $sptitle = $add[title]; } else { $ti_r = explode('[/!--empirenews.page--]', $n_r[$j]); $sptitle = count($ti_r) >= 2 ? $ti_r[0] : $add[title] . '(' . ($j + 1) . ')'; } $select = ''; if ($page == $j) { $ptitle = $sptitle; $select = ' selected'; } $titleselect .= '<option value="' . $spurl . '"' . $select . '>' . $sptitle . '</option>'; } $titleselect = '<select name="titleselect" onchange="self.location.href=this.options[this.selectedIndex].value">' . $titleselect . '</select>'; } //下一页链接 if ($page == $thispagenum - 1) { $thisnextlink = eReturnRewritePageLink($pagefunr, 0); } else { $thisnextlink = eReturnRewritePageLink($pagefunr, $page + 1); } } //返回替换验证字符 $docheckrep = ReturnCheckDoRepStr(); if ($add[newstext]) { if (empty($public_r['dorepword']) && $docheckrep[3]) { $add[newstext] = ReplaceWord($add[newstext]); //过滤字符 } if (empty($public_r['dorepkey']) && $docheckrep[4] && !empty($add[dokey])) { $add[newstext] = ReplaceKey($add['newstext'], $add['classid']); } if ($public_r['opencopytext']) { $add[newstext] = AddNotCopyRndStr($add[newstext]); //随机复制字符 } } //变量 $tempf = $emod_r[$mid]['tempf']; $fr = explode(',', $tempf); $fcount = count($fr) - 1; //变量替换 $newstempstr = $newstemptext; //模板 for ($i = 1; $i < $fcount; $i++) { $f = $fr[$i]; $value = $add[$f]; if ($f == 'downpath') { if (strstr($newstemptext, '[!--downpath--]')) { $value = ReturnDownSoftHtml($add); } } elseif ($f == 'onlinepath') { if (strstr($newstemptext, '[!--onlinepath--]')) { $value = ReturnOnlinepathHtml($add); } } elseif ($f == 'morepic') { if (strstr($newstemptext, '[!--morepic--]')) { $value = ReturnMorepicpathHtml($add); } } elseif ($f == 'newstime') { if (strstr($newstemptext, '[!--newstime--]')) { $value = date($formatdate, $value); } } elseif ($f == 'befrom') { if ($docheckrep[1] && strstr($newstemptext, '[!--befrom--]')) { $value = ReplaceBefrom($value); } } elseif ($f == 'writer') { if ($docheckrep[2] && strstr($newstemptext, '[!--writer--]')) { $value = ReplaceWriter($value); } } elseif ($f == 'titlepic') { if (empty($value)) { $value = $public_r[newsurl] . 'e/data/images/notimg.gif'; } } elseif ($f == 'title') { } else { if (!strstr($emod_r[$mid]['editorf'], ',' . $f . ',')) { if (strstr($emod_r[$mid]['tobrf'], ',' . $f . ',')) { $value = nl2br($value); } if (!strstr($emod_r[$mid]['dohtmlf'], ',' . $f . ',')) { $value = RepFieldtextNbsp(ehtmlspecialchars($value)); } } } $newstempstr = str_replace('[!--' . $f . '--]', $value, $newstempstr); } //固定变量 $newstempstr = str_replace('[!--id--]', $add[id], $newstempstr); $newstempstr = str_replace('[!--classid--]', $add[classid], $newstempstr); $newstempstr = str_replace('[!--class.name--]', $class_r[$add[classid]][classname], $newstempstr); $newstempstr = str_replace('[!--ttid--]', $add[ttid], $newstempstr); $newstempstr = str_replace('[!--tt.name--]', $class_tr[$add[ttid]][tname], $newstempstr); $newstempstr = str_replace('[!--tt.url--]', sys_ReturnBqInfoTypeUrl($add['ttid']), $newstempstr); $newstempstr = str_replace('[!--onclick--]', $add[onclick], $newstempstr); $newstempstr = str_replace('[!--userfen--]', $add[userfen], $newstempstr); $newstempstr = str_replace('[!--username--]', $add[username], $newstempstr); //带链接的用户名 if ($add[ismember] == 1 && $add[userid]) { $newstempstr = str_replace('[!--linkusername--]', "<a href='" . $public_r[newsurl] . "e/space/?userid=" . $add[userid] . "' target=_blank>" . $add[username] . "</a>", $newstempstr); } else { $newstempstr = str_replace('[!--linkusername--]', $add[username], $newstempstr); } $newstempstr = str_replace('[!--userid--]', $add[userid], $newstempstr); $newstempstr = str_replace('[!--other.link--]', $keyboardtext, $newstempstr); $newstempstr = str_replace('[!--news.url--]', $public_r[newsurl], $newstempstr); $newstempstr = str_replace('[!--plnum--]', $add[plnum], $newstempstr); $newstempstr = str_replace('[!--totaldown--]', $add[totaldown], $newstempstr); $newstempstr = str_replace('[!--keyboard--]', $add[keyboard], $newstempstr); //链接 $titleurl = sys_ReturnBqTitleLink($add); $newstempstr = str_replace('[!--titleurl--]', $titleurl, $newstempstr); $newstempstr = str_replace('[!--page.stats--]', '', $newstempstr); $classurl = sys_ReturnBqClassname($add, 9); $newstempstr = str_replace('[!--class.url--]', $classurl, $newstempstr); //下一篇 if (strstr($newstemptext, '[!--info.next--]')) { $next_r = $empire->fetch1("select isurl,titleurl,classid,id,title from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id>{$add['id']} and classid='{$add['classid']}' order by id limit 1"); if (empty($next_r[id])) { $infonext = "<a href='" . $classurl . "'>" . $fun_r['HaveNoNextLink'] . "</a>"; } else { //链接 $nexttitleurl = sys_ReturnBqTitleLink($next_r); $infonext = "<a href='" . $nexttitleurl . "'>" . $next_r[title] . "</a>"; } $newstempstr = str_replace('[!--info.next--]', $infonext, $newstempstr); } //上一篇 if (strstr($newstemptext, '[!--info.pre--]')) { $next_r = $empire->fetch1("select isurl,titleurl,classid,id,title from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id<{$add['id']} and classid='{$add['classid']}' order by id desc limit 1"); if (empty($next_r[id])) { $infonext = "<a href='" . $classurl . "'>" . $fun_r['HaveNoNextLink'] . "</a>"; } else { //链接 $nexttitleurl = sys_ReturnBqTitleLink($next_r); $infonext = "<a href='" . $nexttitleurl . "'>" . $next_r[title] . "</a>"; } $newstempstr = str_replace('[!--info.pre--]', $infonext, $newstempstr); } //投票 if (strstr($newstemptext, '[!--info.vote--]')) { $myvotetext = sys_GetInfoVote($add[classid], $add[id]); $newstempstr = str_replace('[!--info.vote--]', $myvotetext, $newstempstr); } //评分 if (strstr($newstemptext, '[!--pinfopfen--]')) { $pinfopfen = $add[infopfennum] ? round($add[infopfen] / $add[infopfennum]) : 0; $newstempstr = str_replace('[!--pinfopfen--]', $pinfopfen, $newstempstr); $newstempstr = str_replace('[!--infopfennum--]', $add[infopfennum], $newstempstr); } $string = $newstempstr; //替换变量 $string = str_replace('[!--p.title--]', strip_tags($ptitle), $string); $string = str_replace('[!--next.page--]', $thisnextlink, $string); $string = str_replace('[!--page.url--]', $truepage, $string); $string = str_replace('[!--title.select--]', $titleselect, $string); return $string; }
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); $title = stripSlashes($n_r[title]); $pagetitle = ehtmlspecialchars($title); //评分 $infopfennum = $n_r['infopfennum']; $pinfopfen = $infopfennum ? round($n_r['infopfen'] / $infopfennum) : 0; $url = ReturnClassLink($n_r[classid]) . " > <a href=" . $titleurl . ">" . $title . "</a> > " . $fun_r[pl]; } //使用模板 $rewritetempid = 0; if ($_GET['tempid']) { $tempid = (int) $_GET['tempid']; $tempnum = $empire->gettotal("select count(*) as total from " . GetTemptb("enewspltemp") . " where tempid='{$tempid}'"); $tempid = $tempnum ? $tempid : $public_r['defpltempid']; $search .= '&tempid=' . $tempid; $rewritetempid = $tempid; } else { if ($doaction == 'dozt') { $tempid = $class_zr[$classid]['pltempid'] ? $class_zr[$classid]['pltempid'] : $public_r['defpltempid']; } else { $tempid = $class_r[$classid]['pltempid'] ? $class_r[$classid]['pltempid'] : $public_r['defpltempid']; }
} //是否支持动态页 if (empty($class_r[$classid]['listdt']) && !$cr['repagenum']) { $classurl = sys_ReturnBqClassname($cr, 9); Header("Location:{$classurl}"); exit; } //权限 if ($cr['cgroupid']) { $mgroupid = (int) getcvar('mlgroupid'); if (!strstr($cr[cgroupid], ',' . $mgroupid . ',')) { printerror('NotLevelToClass', 'history.go(-1)', 1); } } $GLOBALS['navclassid'] = $classid; $url = ReturnClassLink($classid); $pagetitle = $class_r[$classid]['classname']; $pagekey = $cr['classpagekey']; $pagedes = $cr['intro']; $classimg = $cr['classimg'] ? $cr['classimg'] : $public_r[newsurl] . 'e/data/images/notimg.gif'; //---封面式--- if (!$class_r[$classid][islast] && $cr['islist'] != 1) { if (empty($cr['listdt']) || $cr['islist'] == 3) { printerror("ErrorUrl", "history.go(-1)", 1); } if ($cr[islist] == 2) { $classtemp = GetClassText($classid); $dttempname = 'classpage' . $classid; } else { if (empty($cr['classtempid'])) { printerror('ErrorUrl', '', 1);
function GetHtml($add, $fields, $doall = 0) { global $public_r, $class_r, $class_zr, $fun_r, $empire, $dbtbpre, $emod_r, $class_tr, $level_r, $etable_r; if (empty($doall)) { if ($add['titleurl'] || $add['checked'] == 0 || $class_r[$add[classid]][showdt] == 2 || strstr($public_r['nreinfo'], ',' . $add['classid'] . ',')) { return ''; } } $mid = $class_r[$add[classid]]['modid']; $tbname = $class_r[$add[classid]][tbname]; //副表 if ($emod_r[$mid]['tbdataf'] && $emod_r[$mid]['tbdataf'] != ',') { $selectdataf = substr($emod_r[$mid]['tbdataf'], 1, -1); $addr = $empire->fetch1("select " . $selectdataf . " from {$dbtbpre}ecms_" . $tbname . "_data_" . $add[stb] . " where id='{$add['id']}'"); $add = array_merge($add, $addr); } $iclasspath = ReturnSaveInfoPath($add[classid], $add[id]); $doclasspath = ECMS_PATH . $iclasspath; $createinfopath = $doclasspath; //建立日期目录 $newspath = ''; if ($add[newspath]) { $createpath = $doclasspath . $add[newspath]; if (!file_exists($createpath)) { $r[newspath] = FormatPath($add[classid], $add[newspath], 1); } $createinfopath .= $add[newspath] . '/'; $newspath = $add[newspath] . '/'; } //新建存放目录 if ($class_r[$add[classid]][filename] == 3) { $createinfopath .= ReturnInfoSPath($add['filename']); DoMkdir($createinfopath); $fn3 = 1; } //存文本 if ($emod_r[$mid]['savetxtf']) { $stf = $emod_r[$mid]['savetxtf']; if ($add[$stf]) { $add[$stf] = GetTxtFieldText($add[$stf]); } } $GLOBALS['navclassid'] = $add[classid]; $GLOBALS['navinfor'] = $add; //取得内容模板 $add[newstempid] = $add[newstempid] ? $add[newstempid] : $class_r[$add[classid]][newstempid]; $newstemp_r = GetNewsTemp($add[newstempid]); $newstemptext = $newstemp_r[temptext]; $formatdate = $newstemp_r[showdate]; //页面 $pagetitle = htmlspecialchars($add[title]); $url = ReturnClassLink($add[classid]); //导航 $newstemptext = Info_ReplaceSvars($newstemptext, $url, $add[classid], $pagetitle, $add[keyboard], $pagetitle); //文件类型/权限 if ($add[groupid] || $class_r[$add[classid]]['cgtoinfo']) { if (empty($add[newspath])) { $include = ''; } else { $pr = explode('/', $add[newspath]); for ($i = 0; $i < count($pr); $i++) { $include .= '../'; } } if ($fn3 == 1) { $include .= '../'; } $pr = explode('/', $iclasspath); $pcount = count($pr); for ($i = 0; $i < $pcount - 1; $i++) { $include .= '../'; } $include1 = $include; $include .= 'e/class/CheckLevel.php'; $filetype = '.php'; $addlevel = "<?php\r\n\t\tdefine('empirecms','wm_chief');\r\n\t\t\$check_tbname='" . $class_r[$add[classid]][tbname] . "';\r\n\t\t\$check_infoid=" . $add[id] . ";\r\n\t\t\$check_classid=" . $add[classid] . ";\r\n\t\t\$check_path=\"" . $include1 . "\";\r\n\t\trequire(\"" . $include . "\");\r\n\t\t?>"; } else { $filetype = $class_r[$add[classid]][filetype]; $addlevel = ''; } //取得本目录链接 if ($class_r[$add[classid]][classurl] && $class_r[$add[classid]][ipath] == '') { $dolink = $class_r[$add[classid]][classurl] . '/' . $newspath; } else { $dolink = $public_r[newsurl] . $iclasspath . $newspath; } //相关信息 if (strstr($newstemptext, '[!--other.link--]')) { $keyboardtext = GetKeyboard($add[keyboard], $add[keyid], $add[classid], $add[id], $class_r[$add[classid]][link_num]); } $onclick = "<script src='" . $public_r[newsurl] . "e/public/onclick?enews=donews&classid={$add['classid']}&id=" . $add[id] . "'></script>"; //返回替换验证字符 $docheckrep = ReturnCheckDoRepStr(); if ($add[newstext]) { if (empty($public_r['dorepword']) && $docheckrep[3]) { $add[newstext] = ReplaceWord($add[newstext]); //过滤字符 } if (empty($public_r['dorepkey']) && $docheckrep[4] && !empty($add[dokey])) { $add[newstext] = ReplaceKey($add[newstext]); } if ($public_r['opencopytext']) { $add[newstext] = AddNotCopyRndStr($add[newstext]); //随机复制字符 } } //分页字段 $expage = '[!--empirenews.page--]'; //分页符 $pf = $emod_r[$mid]['pagef']; //变量 $tempf = $emod_r[$mid]['tempf']; if ($pf && strstr($add[$pf], $expage)) { $tempf = str_replace(',' . $pf . ',', ',', $tempf); } $fr = explode(',', $tempf); $fcount = count($fr) - 1; //变量替换 $newstempstr = $newstemptext; //模板 for ($i = 1; $i < $fcount; $i++) { $f = $fr[$i]; $value = $add[$f]; if ($f == 'downpath') { if (strstr($newstemptext, '[!--downpath--]')) { $value = ReturnDownSoftHtml($add); } } elseif ($f == 'onlinepath') { if (strstr($newstemptext, '[!--onlinepath--]')) { $value = ReturnOnlinepathHtml($add); } } elseif ($f == 'morepic') { if (strstr($newstemptext, '[!--morepic--]')) { $value = ReturnMorepicpathHtml($add); } } elseif ($f == 'newstime') { if (strstr($newstemptext, '[!--newstime--]')) { $value = date($formatdate, $value); } } elseif ($f == 'befrom') { if ($docheckrep[1] && strstr($newstemptext, '[!--befrom--]')) { $value = ReplaceBefrom($value); } } elseif ($f == 'writer') { if ($docheckrep[2] && strstr($newstemptext, '[!--writer--]')) { $value = ReplaceWriter($value); } } elseif ($f == 'titlepic') { if (empty($value)) { $value = $public_r[newsurl] . 'e/data/images/notimg.gif'; } } elseif ($f == 'title') { } else { if (!strstr($emod_r[$mid]['editorf'], ',' . $f . ',')) { if (strstr($emod_r[$mid]['tobrf'], ',' . $f . ',')) { $value = nl2br($value); } if (!strstr($emod_r[$mid]['dohtmlf'], ',' . $f . ',')) { $value = RepFieldtextNbsp(htmlspecialchars($value)); } } } $newstempstr = str_replace('[!--' . $f . '--]', $value, $newstempstr); } //固定变量 $newstempstr = str_replace('[!--id--]', $add[id], $newstempstr); $newstempstr = str_replace('[!--classid--]', $add[classid], $newstempstr); $newstempstr = str_replace('[!--class.name--]', $class_r[$add[classid]][classname], $newstempstr); $newstempstr = str_replace('[!--ttid--]', $add[ttid], $newstempstr); $newstempstr = str_replace('[!--tt.name--]', $class_tr[$add[ttid]][tname], $newstempstr); $newstempstr = str_replace('[!--onclick--]', $add[onclick], $newstempstr); $newstempstr = str_replace('[!--userfen--]', $add[userfen], $newstempstr); $newstempstr = str_replace('[!--username--]', $add[username], $newstempstr); //带链接的用户名 if ($add[ismember] == 1 && $add[userid]) { $newstempstr = str_replace('[!--linkusername--]', "<a href='" . $public_r[newsurl] . "e/space/?userid=" . $add[userid] . "' target=_blank>" . $add[username] . "</a>", $newstempstr); } else { $newstempstr = str_replace('[!--linkusername--]', $add[username], $newstempstr); } $newstempstr = str_replace('[!--userid--]', $add[userid], $newstempstr); $newstempstr = str_replace('[!--other.link--]', $keyboardtext, $newstempstr); $newstempstr = str_replace('[!--news.url--]', $public_r[newsurl], $newstempstr); $newstempstr = str_replace('[!--plnum--]', $add[plnum], $newstempstr); $newstempstr = str_replace('[!--totaldown--]', $add[totaldown], $newstempstr); $newstempstr = str_replace('[!--keyboard--]', $add[keyboard], $newstempstr); //链接 $titleurl = sys_ReturnBqTitleLink($add); $newstempstr = str_replace('[!--titleurl--]', $titleurl, $newstempstr); $newstempstr = str_replace('[!--page.stats--]', $onclick, $newstempstr); $classurl = sys_ReturnBqClassname($add, 9); $newstempstr = str_replace('[!--class.url--]', $classurl, $newstempstr); //下一篇 if (strstr($newstemptext, '[!--info.next--]')) { $next_r = $empire->fetch1("select titleurl,groupid,classid,newspath,filename,id,title from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id>{$add['id']} and classid='{$add['classid']}' and checked=1 order by id limit 1"); if (empty($next_r[id])) { $infonext = "<a href='" . $classurl . "'>" . $fun_r['HaveNoNextLink'] . "</a>"; } else { //链接 $nexttitleurl = sys_ReturnBqTitleLink($next_r); $infonext = "<a href='" . $nexttitleurl . "'>" . $next_r[title] . "</a>"; } $newstempstr = str_replace('[!--info.next--]', $infonext, $newstempstr); } //上一篇 if (strstr($newstemptext, '[!--info.pre--]')) { $next_r = $empire->fetch1("select titleurl,groupid,classid,newspath,filename,id,title from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where id<{$add['id']} and classid='{$add['classid']}' and checked=1 order by id desc limit 1"); if (empty($next_r[id])) { $infonext = "<a href='" . $classurl . "'>" . $fun_r['HaveNoNextLink'] . "</a>"; } else { //链接 $nexttitleurl = sys_ReturnBqTitleLink($next_r); $infonext = "<a href='" . $nexttitleurl . "'>" . $next_r[title] . "</a>"; } $newstempstr = str_replace('[!--info.pre--]', $infonext, $newstempstr); } //投票 if (strstr($newstemptext, '[!--info.vote--]')) { $myvotetext = sys_GetInfoVote($add[classid], $add[id]); $newstempstr = str_replace('[!--info.vote--]', $myvotetext, $newstempstr); } //评分 if (strstr($newstemptext, '[!--pinfopfen--]')) { $pinfopfen = $add[infopfennum] ? round($add[infopfen] / $add[infopfennum]) : 0; $newstempstr = str_replace('[!--pinfopfen--]', $pinfopfen, $newstempstr); $newstempstr = str_replace('[!--infopfennum--]', $add[infopfennum], $newstempstr); } if ($pf && strstr($add[$pf], $expage)) { $n_r = explode($expage, $add[$pf]); $thispagenum = count($n_r); //取得分页 $thefun = $public_r['textpagefun'] ? $public_r['textpagefun'] : 'sys_ShowTextPage'; //下拉式分页 if (strstr($newstemptext, '[!--title.select--]')) { $dotitleselect = sys_ShowTextPageSelect($thispagenum, $dolink, $add, $filetype, $n_r); } for ($j = 1; $j <= $thispagenum; $j++) { $string = $newstempstr; //模板 $truepage = ''; $titleselect = ''; //下一页链接 if ($thispagenum == $j) { $thisnextlink = $dolink . $add[filename] . $filetype; } else { $thisj = $j + 1; $thisnextlink = $dolink . $add[filename] . '_' . $thisj . $filetype; } $k = $j - 1; if ($j == 1) { $file = $doclasspath . $newspath . $add[filename] . $filetype; $ptitle = $add[title]; } else { $file = $doclasspath . $newspath . $add[filename] . '_' . $j . $filetype; $ti_r = explode('[/!--empirenews.page--]', $n_r[$k]); if (count($ti_r) >= 2) { $ptitle = $ti_r[0]; $n_r[$k] = $ti_r[1]; } else { $ptitle = $add[title] . '(' . $j . ')'; } } //取得当前页 if ($thispagenum != 1) { $truepage = $thefun($thispagenum, $j, $dolink, $add, $filetype, ''); $titleselect = str_replace("?" . $j . "\">", "?" . $j . "\" selected>", $dotitleselect); } //替换变量 $newstext = $n_r[$k]; if (!strstr($emod_r[$mid]['editorf'], ',' . $pf . ',')) { if (strstr($emod_r[$mid]['tobrf'], ',' . $pf . ',')) { $newstext = nl2br($newstext); } if (!strstr($emod_r[$mid]['dohtmlf'], ',' . $pf . ',')) { $newstext = htmlspecialchars($newstext); $newstext = RepFieldtextNbsp($newstext); } } $string = str_replace('[!--' . $pf . '--]', $newstext, $string); $string = str_replace('[!--p.title--]', $ptitle, $string); $string = str_replace('[!--next.page--]', $thisnextlink, $string); $string = str_replace('[!--page.url--]', $truepage, $string); $string = str_replace('[!--title.select--]', $titleselect, $string); //写文件 WriteFiletext($file, $addlevel . $string); } } else { $file = $doclasspath . $newspath . $add[filename] . $filetype; $string = $newstempstr; //模板 //替换变量 $string = str_replace('[!--p.title--]', $add[title], $string); $string = str_replace('[!--next.page--]', '', $string); $string = str_replace('[!--page.url--]', '', $string); $string = str_replace('[!--title.select--]', '', $string); //写文件 WriteFiletext($file, $addlevel . $string); } //设为已生成 if (empty($add['havehtml'])) { $empire->query("update {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " set havehtml=1 where id='{$add['id']}' limit 1"); } }
} else { $add .= ' and ' . ReturnClass($class_r[$trueclassid][sonclass]); } $cr = $empire->fetch1("select classpagekey,intro,classimg,cgroupid from {$dbtbpre}enewsclass where classid='{$trueclassid}'"); //权限 if ($cr['cgroupid']) { $mgroupid = (int) getcvar('mlgroupid'); if (!strstr($cr[cgroupid], ',' . $mgroupid . ',')) { printerror('NotLevelToClass', 'history.go(-1)', 1); } } $pagetitle = $class_r[$trueclassid]['classname']; $pagekey = $cr['classpagekey']; $pagedes = $cr['intro']; $classimg = $cr['classimg'] ? $cr['classimg'] : $public_r[newsurl] . 'e/data/images/notimg.gif'; $url = ReturnClassLink($trueclassid); $pageecms = 0; $pageclassid = $trueclassid; $GLOBALS['navclassid'] = $trueclassid; } if (empty($class_r[$trueclassid][tbname])) { printerror('ErrorUrl', '', 1); } if (empty($tbname)) { $tbname = $class_r[$trueclassid][tbname]; $mid = $class_r[$trueclassid][modid]; $yhid = $class_r[$trueclassid][yhid]; } if ($class_r[$trueclassid][reorder]) { $addorder = $class_r[$trueclassid][reorder]; }
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); }
$tempnum = $empire->gettotal("select count(*) as total from " . GetTemptb("enewsprinttemp") . " where tempid='{$tempid}'"); $tempid = $tempnum ? $tempid : $public_r['defprinttempid']; } else { $mod_tempr = $empire->fetch1("select printtempid from {$dbtbpre}enewsmod where mid='{$mid}'"); $tempid = $mod_tempr[printtempid] ? $mod_tempr[printtempid] : $public_r['defprinttempid']; } if (empty($tempid)) { $tempid = 1; } //存文本 $savetxtf = $emod_r[$mid]['savetxtf']; if ($savetxtf && $r[$savetxtf]) { $r[$savetxtf] = GetTxtFieldText($r[$savetxtf]); } //分页字段 $pagef = $emod_r[$mid]['pagef']; if ($pagef && $r[$pagef]) { $r[$pagef] = str_replace('[!--empirenews.page--]', '', $r[$pagef]); $r[$pagef] = str_replace('[/!--empirenews.page--]', '', $r[$pagef]); } $url = ReturnClassLink($r[classid]) . " > " . $fun_r['zw']; //标题链接 $titleurl = sys_ReturnBqTitleLink($r); //标题图片 if (empty($r[titlepic])) { $r[titlepic] = $public_r[newsurl] . 'e/data/images/notimg.gif'; } $bclassid = $class_r[$classid][bclassid]; @(require ECMS_PATH . DASHBOARD . '/data/filecache/template/print' . $tempid . '.php'); db_close(); $empire = null;