} else { $tempr = $empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from " . GetTemptb("enewssearchtemp") . " where tempid='" . $class_r[$search_r[trueclassid]][searchtempid] . "' limit 1"); } $have_class = 1; //替换公共模板变量 $listtemp = $tempr[temptext]; if ($public_r['searchtempvar']) { $listtemp = ReplaceTempvar($listtemp); } $search_r[keyboard] = ehtmlspecialchars($search_r[keyboard]); $listtemp = str_replace("[!--show.page--]", $listpage, $listtemp); $listtemp = str_replace("[!--keyboard--]", $search_r[keyboard], $listtemp); $listtemp = str_replace("[!--ecms.num--]", $num, $listtemp); $url = "<a href='" . ReturnSiteIndexUrl() . "'>" . $fun_r['index'] . "</a> > " . $fun_r['adsearch']; $pagetitle = $fun_r['adsearch'] . " " . $search_r[keyboard]; $listtemp = ReplaceSvars($listtemp, $url, 0, $pagetitle, $pagetitle, $pagetitle, $add, 0); $rownum = $tempr[rownum]; if (empty($rownum)) { $rownum = 1; } $formatdate = $tempr[showdate]; $subnews = $tempr[subnews]; $subtitle = $tempr[subtitle]; $docode = $tempr[docode]; $modid = $tempr[modid]; $listvar = str_replace('[!--news.url--]', $public_r[newsurl], $tempr[listvar]); //字段 $ret_r = ReturnReplaceListF($tempr[modid]); //取得列表模板 $list_exp = "[!--empirenews.listtemp--]"; $list_r = explode($list_exp, $listtemp);
function PreviewIndexpage($tempid, $userid, $username) { global $empire, $dbtbpre, $public_r, $emod_r, $class_r, $class_zr, $fun_r, $navclassid, $navinfor, $class_tr, $level_r, $etable_r; //验证权限 CheckLevel($userid, $username, $classid, "template"); $tempid = (int) $tempid; if (!$tempid) { printerror('ErrorUrl', ''); } $tempr = $empire->fetch1("select tempid,temptext from {$dbtbpre}enewsindexpage where tempid='{$tempid}'"); if (!$tempr['tempid']) { printerror('ErrorUrl', ''); } $indextext = stripSlashes($tempr['temptext']); $indextext = ReplaceTempvar($indextext); //替换全局模板变量 $pr = $empire->fetch1("select sitekey,siteintro from {$dbtbpre}enewspublic limit 1"); //页面 $pagetitle = ehtmlspecialchars($public_r['sitename']); $pagekey = ehtmlspecialchars($pr['sitekey']); $pagedes = ehtmlspecialchars($pr['siteintro']); $url = "<a href=\"" . ReturnSiteIndexUrl() . "\">" . $fun_r['index'] . "</a>"; //栏目导航 $onclick = ''; $file = ECMS_PATH . DASHBOARD . '/data/tmp/indexpage' . $tempid . '.php'; $indextext = ReplaceSvars($indextext, $url, 0, $pagetitle, $pagekey, $pagedes, $add, 0); $indextext = str_replace("[!--page.stats--]", $onclick, $indextext); //替换标签 $indextext = DoRepEcmsLoopBq($indextext); $indextext = RepBq($indextext); //写文件 WriteFiletext($file, AddCheckViewTempCode() . $indextext); //读取文件内容 ob_start(); include $file; $string = ob_get_contents(); ob_end_clean(); $string = RepExeCode($string); //解析代码 echo stripSlashes($string); exit; }
function ReSchAlltemp() { global $empire, $public_r, $fun_r, $dbtbpre; $tfile = "../data/template/schalltemp.txt"; $file = "../sch/index.php"; $temp = ReadFiletext($tfile); //取得页面模板 $pr = $empire->fetch1("select schalltemp,schallsubnum,schalldate from " . GetTemptb("enewspubtemp") . " limit 1"); $url = "<?=\$url?>"; $pagetitle = $fun_r['SearchAllNav']; $pr['schalltemp'] = ReplaceSvars($pr['schalltemp'], $url, 0, $pagetitle, $pagetitle, $pagetitle, $add, 1); $temp = str_replace("<!--empire.listtemp.subnum-->", $pr['schallsubnum'], $temp); $temp = str_replace("<!--empire.listtemp.formatdate-->", $pr['schalldate'], $temp); $pr['schalltemp'] = str_replace("[!--keyboard--]", "<?=\$keyboard?>", $pr['schalltemp']); $pr['schalltemp'] = str_replace("[!--num--]", "<?=\$num?>", $pr['schalltemp']); $pr['schalltemp'] = str_replace("[!--listpage--]", "<?=\$listpage?>", $pr['schalltemp']); $listtemp_r = explode("[!--empirenews.listtemp--]", $pr['schalltemp']); $temp = str_replace("<!--empire.listtemp.top-->", $listtemp_r[0], $temp); $temp = str_replace("<!--empire.listtemp.footer-->", $listtemp_r[2], $temp); //---列表中间 $listtemp_center = str_replace("[!--no.num--]", "<?=\$no?>", $listtemp_r[1]); $listtemp_center = str_replace("[!--titleurl--]", "<?=\$titleurl?>", $listtemp_center); $listtemp_center = str_replace("[!--id--]", "<?=\$r[id]?>", $listtemp_center); $listtemp_center = str_replace("[!--classid--]", "<?=\$r[classid]?>", $listtemp_center); $listtemp_center = str_replace("[!--titlepic--]", "<?=\$titlepic?>", $listtemp_center); $listtemp_center = str_replace("[!--newstime--]", "<?=\$newstime?>", $listtemp_center); $listtemp_center = str_replace("[!--title--]", "<?=\$title?>", $listtemp_center); $listtemp_center = str_replace("[!--smalltext--]", "<?=\$smalltext?>", $listtemp_center); $temp = str_replace("<!--empire.listtemp.center-->", $listtemp_center, $temp); WriteFiletext($file, $temp); }
function ReFeedbackClassFile($bid) { global $empire, $dbtbpre; $r = $empire->fetch1("select btemp from {$dbtbpre}enewsfeedbackclass where bid='{$bid}'"); //替换公共变量 $url = "<?=\$url?>"; $pagetitle = "<?=\$bname?>"; $btemp = ReplaceSvars($r['btemp'], $url, 0, $pagetitle, $pagetitle, $pagetitle, $add, 1); $btemp = str_replace("[!--cp.header--]", "<? include(\"../../data/template/cp_1.php\");?>", $btemp); $btemp = str_replace("[!--cp.footer--]", "<? include(\"../../data/template/cp_2.php\");?>", $btemp); $file = "../../tool/feedback/temp/feedback" . $bid . ".php"; $btemp = "<?\r\nif(!defined('InEmpireCMS'))\r\n{exit();}\r\n?>" . $btemp; WriteFiletext($file, $btemp); }