📄 t_functions.php
字号:
if(empty($tr['tempid']))
{return "";}
//限制条数
if($cline)
{
$limit=" limit ".$cline;
}
//字段
$ret_r=ReturnAddF($r,$tr[modid],$userid,$username,2,2,0);
//栏目字段
if($dofirstinfo==1)
{
$addclassfield=',classname,classimg,intro';
}
$csql=$empire->query("select classid".$addclassfield." from {$dbtbpre}enewsclass where ".$where." order by myorder,classid".$limit);
while($cr=$empire->fetch($csql))
{
sys_GetEcmsInfoMore($cr[classid],$line,$strlen,$have_class,$enews,$tr,$doing,$ret_r,$cr,$dofirstinfo,$fsubtitle,$fsubnews,$fdoing);
}
}
//带模板的栏目导航标签
function sys_ShowClassByTemp($classid,$tempid,$show=0,$cline=0){
global $navclassid,$empire,$class_r,$public_r,$dbtbpre;
//当前栏目
if($classid=="selfinfo")
{
if(empty($navclassid))
{$classid=0;}
else
{
$classid=$navclassid;
//终极类别则显示同级类别
if($class_r[$classid][islast]&&$class_r[$classid][bclassid])
{
$classid=$class_r[$classid][bclassid];
}
if($class_r[$classid][islast]&&empty($class_r[$classid][bclassid]))
{$classid=0;}
}
}
//取得模板
$tr=sys_ReturnBqTemp($tempid);
if(empty($tr['tempid']))
{return "";}
$listtemp=$tr[temptext];
$subnews=$tr[subnews];
$listvar=$tr[listvar];
$rownum=$tr[rownum];
$formatdate=$tr[showdate];
if(empty($rownum))
{$rownum=1;}
//限制条数
if($cline)
{
$limit=" limit ".$cline;
}
//替换变量
$bclassname=$class_r[$classid][classname];
$br[classid]=$classid;
$bclassurl=sys_ReturnBqClassname($br,9);
$listtemp=str_replace("[!--bclassname--]",$bclassname,$listtemp);
$listtemp=str_replace("[!--bclassurl--]",$bclassurl,$listtemp);
$listtemp=str_replace("[!--bclassid--]",$classid,$listtemp);
//列表
$list_exp="[!--empirenews.listtemp--]";
$list_r=explode($list_exp,$listtemp);
$listtext=$list_r[1];
$no=1;
$changerow=1;
$sql=$empire->query("select classid,classname,islast,sonclass,tbname,intro,classimg from {$dbtbpre}enewsclass where bclassid='$classid' and showclass=0 order by myorder,classid".$limit);
while($r=$empire->fetch($sql))
{
//显示类别数据数
if($show)
{
//终极类别
if($r[islast])
{
$where="classid='$r[classid]'";
}
else
{
$where=ReturnClass($r[sonclass]);
}
$cr=$empire->fetch1("select count(*) as total from {$dbtbpre}ecms_".$r[tbname]." where ".$where." and checked=1");
$num=$cr[total];
}
//替换列表变量
$repvar=ReplaceShowClassVars($no,$listvar,$r,$num,0,$subnews);
$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
$changerow+=1;
//超过行数
if($changerow>$rownum)
{
$changerow=1;
$string.=$listtext;
$listtext=$list_r[1];
}
$no++;
}
//多余数据
if($changerow<=$rownum&&$listtext<>$list_r[1])
{
$string.=$listtext;
}
$string=$list_r[0].$string.$list_r[2];
echo $string;
}
//替换栏目导航标签
function ReplaceShowClassVars($no,$listtemp,$r,$num,$ecms=0,$subnews=0){
global $public_r,$class_r;
//栏目链接
if($ecms==1)
{
$classurl=sys_ReturnBqZtname($r);
$r['classname']=$r['ztname'];
$r['classid']=$r['ztid'];
$r['classimg']=$r['ztimg'];
}
else
{
$classurl=sys_ReturnBqClassname($r,9);
}
if($subnews)
{
$r[intro]=sub($r[intro],0,$subnews,false);
}
$listtemp=str_replace("[!--classurl--]",$classurl,$listtemp);
//栏目名称
$listtemp=str_replace("[!--classname--]",$r[classname],$listtemp);
//栏目id
$listtemp=str_replace("[!--classid--]",$r[classid],$listtemp);
//栏目图片
if(empty($r[classimg]))
{
$r[classimg]=$public_r[newsurl]."e/data/images/notimg.gif";
}
$listtemp=str_replace("[!--classimg--]",$r[classimg],$listtemp);
//栏目简介
$listtemp=str_replace("[!--intro--]",nl2br($r[intro]),$listtemp);
//记录数
$listtemp=str_replace("[!--num--]",$num,$listtemp);
//序号
$listtemp=str_replace("[!--no--]",$no,$listtemp);
return $listtemp;
}
//留言调用
function sys_ShowLyInfo($line,$tempid,$bid=0){
global $empire,$dbtbpre;
$a="";
if($bid)
{
$a=" and bid='$bid'";
}
//取得模板
$tr=sys_ReturnBqTemp($tempid);
if(empty($tr['tempid']))
{return "";}
$listtemp=$tr[temptext];
$subnews=$tr[subnews];
$listvar=$tr[listvar];
$rownum=$tr[rownum];
$formatdate=$tr[showdate];
if(empty($rownum))
{$rownum=1;}
//列表
$list_exp="[!--empirenews.listtemp--]";
$list_r=explode($list_exp,$listtemp);
$listtext=$list_r[1];
$no=1;
$changerow=1;
$sql=$empire->query("select lyid,name,email,lytime,lytext,retext from {$dbtbpre}enewsgbook where checked=0".$a." order by lyid desc limit ".$line);
while($r=$empire->fetch($sql))
{
//替换列表变量
$repvar=ReplaceShowLyVars($no,$listvar,$r,$formatdate,$subnews);
$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
$changerow+=1;
//超过行数
if($changerow>$rownum)
{
$changerow=1;
$string.=$listtext;
$listtext=$list_r[1];
}
$no++;
}
//多余数据
if($changerow<=$rownum&&$listtext<>$list_r[1])
{
$string.=$listtext;
}
$string=$list_r[0].$string.$list_r[2];
echo $string;
}
//替换留言标签
function ReplaceShowLyVars($no,$listtemp,$r,$formatdate,$subnews=0){
global $public_r;
if($subnews)
{
$r['lytext']=sub($r['lytext'],0,$subnews,false);
}
$listtemp=str_replace("[!--lyid--]",$r['lyid'],$listtemp);//id
$listtemp=str_replace("[!--lytext--]",nl2br($r['lytext']),$listtemp);//留言内容
$listtemp=str_replace("[!--retext--]",nl2br($r['retext']),$listtemp);//回复
$listtemp=str_replace("[!--lytime--]",format_datetime($r['lytime'],$formatdate),$listtemp);
$listtemp=str_replace("[!--name--]",$r['name'],$listtemp);
$listtemp=str_replace("[!--email--]",$r['email'],$listtemp);
//序号
$listtemp=str_replace("[!--no--]",$no,$listtemp);
return $listtemp;
}
//专题调用
function sys_ShowZtData($tempid,$zcid=0,$cline=0){
global $empire,$dbtbpre;
$a="";
if($zcid)
{
$a=" and zcid='$zcid'";
}
//取得模板
$tr=sys_ReturnBqTemp($tempid);
if(empty($tr['tempid']))
{return "";}
$listtemp=$tr[temptext];
$subnews=$tr[subnews];
$listvar=$tr[listvar];
$rownum=$tr[rownum];
$formatdate=$tr[showdate];
if(empty($rownum))
{$rownum=1;}
//限制条数
if($cline)
{
$limit=" limit ".$cline;
}
//列表
$list_exp="[!--empirenews.listtemp--]";
$list_r=explode($list_exp,$listtemp);
$listtext=$list_r[1];
$no=1;
$changerow=1;
$sql=$empire->query("select ztid,ztname,intro,ztimg from {$dbtbpre}enewszt where showzt=0".$a." order by myorder,ztid desc".$limit);
while($r=$empire->fetch($sql))
{
//替换列表变量
$repvar=ReplaceShowClassVars($no,$listvar,$r,$num,1,$subnews);
$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
$changerow+=1;
//超过行数
if($changerow>$rownum)
{
$changerow=1;
$string.=$listtext;
$listtext=$list_r[1];
}
$no++;
}
//多余数据
if($changerow<=$rownum&&$listtext<>$list_r[1])
{
$string.=$listtext;
}
$string=$list_r[0].$string.$list_r[2];
echo $string;
}
//图库模型分页标签
function sys_PhotoMorepage($tempid,$spicwidth=0,$spicheight=0){
global $navinfor;
$morepic=$navinfor['morepic'];
if(empty($morepic))
{
return "";
}
//取得标签
$tempr=sys_ReturnBqTemp($tempid);
if(empty($tempr['tempid']))
{return "";}
$rexp="\r\n";
$fexp="::::::";
$gs="";
if($spicwidth)
{$gs=" width='".$spicwidth."'";}
if($spicheight)
{$gs.=" height='".$spicheight."'";}
$rstr="";
$sdh="";
$firstpic="";
$optionstr="";
$titleoption="";
$listpage="";
$nbsp="";
$rr=explode($rexp,$morepic);
$count=count($rr);
for($i=0;$i<$count;$i++)
{
$j=$i+1;
$fr=explode($fexp,$rr[$i]);
$smallpic=$fr[0]; //小图
$bigpic=$fr[1]; //大图
if(empty($bigpic))
{
$bigpic=$smallpic;
}
$picname=htmlspecialchars($fr[2]); //名称
$showpic=ReplaceMorePagelistvar($tempr['listvar'],$picname,$bigpic);
$sdh.=$nbsp."<a href='#ecms' onclick='GotoPhPage(".$j.");' title='".$picname."'><img src='".$smallpic."' alt='".$picname."' border=0".$gs."></a>";
if($i==0)
{
$firstpic=$showpic;
}
$rstr.="photosr[".$j."]=\"".addslashes($showpic)."\";
";
$optionstr.="<option value=".$j.">第 ".$j." 页</option>";
$titleoption.="<option value=".$j.">".$j."、".$picname."</option>";
$listpage.=$nbsp."<a href='#ecms' onclick='GotoPhPage(".$j.");' title='".$picname."'>".$j."</a>";
$nbsp=" ";
}
echo ReplaceMorePagetemp($tempr['temptext'],$rstr,$sdh,$optionstr,$titleoption,$firstpic,$listpage);
}
//替换图片集分页模板
function ReplaceMorePagetemp($temp,$rstr,$sdh,$select,$titleselect,$showpic,$listpage){
$temp=str_replace("[!--photor--]",$rstr,$temp);
$temp=str_replace("[!--smalldh--]",$sdh,$temp);
$temp=str_replace("[!--select--]",$select,$temp);
$temp=str_replace("[!--titleselect--]",$titleselect,$temp);
$temp=str_replace("[!--listpage--]",$listpage,$temp);
$temp=str_replace("<!--list.var1-->",$showpic,$temp);
return $temp;
}
//替换图片集listvar模板
function ReplaceMorePagelistvar($temp,$picname,$picurl){
$temp=str_replace("[!--picname--]",$picname,$temp);
$temp=str_replace("[!--picurl--]",$picurl,$temp);
return $temp;
}
//输出复选框字段内容
function sys_EchoCheckboxFValue($f,$exp='<br>'){
global $navinfor;
$r=explode('|',$navinfor[$f]);
$count=count($r);
for($i=1;$i<$count-1;$i++)
{
if($i==1)
{
$str.=$r[$i];
}
else
{
$str.=$exp.$r[$i];
}
}
echo $str;
}
//评论调用
function sys_ShowPlInfo($line,$tempid,$classid=0,$id=0,$isgood=0,$enews=0){
global $empire,$dbtbpre,$class_r;
$a="";
if($isgood)
{
$a.=" and isgood='$isgood'";
}
if($classid)
{
if($class_r[$classid][islast])
{
$where="classid='$classid'";
}
else
{
$where=ReturnClass($class_r[$classid][sonclass]);
}
$a.=" and ".$where;
}
if($id)
{
$a.=" and id='$id'";
}
//排序
if($enews==1)//支持
{
$order='zcnum desc,plid desc';
}
elseif($enews==2)//反对
{
$order='fdnum desc,plid desc';
}
else//发布时间
{
$order='plid desc';
}
//取得模板
$tr=sys_ReturnBqTemp($tempid);
if(empty($tr['tempid']))
{return "";}
$listtemp=$tr[temptext];
$subnews=$tr[subnews];
$listvar=$tr[listvar];
$rownum=$tr[rownum];
$formatdate=$tr[showdate];
if(empty($rownum))
{$rownum=1;}
//列表
$list_exp="[!--empirenews.listtemp--]";
$list_r=explode($list_exp,$listtemp);
$listtext=$list_r[1];
$no=1;
$changerow=1;
$sql=$empire->query("select plid,userid,username,saytext,saytime,id,classid,zcnum,fdnum from {$dbtbpre}enewspl where checked=0".$a." order by ".$order." limit ".$line);
while($r=$empire->fetch($sql))
{
//替换列表变量
$repvar=ReplaceShowPlVars($no,$listvar,$r,$formatdate,$subnews);
$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
$changerow+=1;
//超过行数
if($changerow>$rownum)
{
$changerow=1;
$string.=$listtext;
$listtext=$list_r[1];
}
$no++;
}
//多余数据
if($changerow<=$rownum&&$listtext<>$list_r[1])
{
$string.=$listtext;
}
$string=$list_r[0].$string.$list_r[2];
echo $string;
}
//替换评论标签
function ReplaceShowPlVars($no,$listtemp,$r,$formatdate,$subnews=0){
global $public_r,$empire,$dbtbpre,$class_r;
//标题
$infor=$empire->fetch1("select titleurl,groupid,classid,newspath,filename,id,title from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='$r[id]' limit 1");
$r['saytext']=stripSlashes($r['saytext']);
if($subnews)
{
$r['saytext']=sub($r['saytext'],0,$subnews,false);
}
if($r['userid'])
{
$r['username']="<a href='".$public_r[newsurl]."e/space/?userid=$r[userid]' target='_blank'>$r[username]</a>";
}
if(empty($r['username']))
{
$r['username']='匿名';
}
$titleurl=sys_ReturnBqTitleLink($infor);
$listtemp=str_replace("[!--titleurl--]",$titleurl,$listtemp);
$listtemp=str_replace("[!--title--]",$infor['title'],$listtemp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -