📄 t_functions.php
字号:
//终极栏目
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];
$newsdata=" (<font color=red>".$num."</font>)";
}
$s.="<tr><td> <img src='".$public_r[newsurl]."e/data/images/class.gif' border=0> <a href=".$classurl.">".$r[classname]."</a>".$newsdata."</td></tr>";
}
$s="<table>".$s."</table>";
echo $s;
}
//显示网站地图
function sys_ShowMap($classid,$line,$bcolor,$color,$shownum=0){
global $empire,$class_r,$dbtbpre;
$sql=$empire->query("select classid,classname,sonclass,islast,tbname from {$dbtbpre}enewsclass where bclassid='$classid' and showclass=0 order by myorder,classid");
while($r=$empire->fetch($sql))
{
//显示栏目数据数
if($shownum)
{
//终极栏目
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 limit 1");
$num=$cr[total];
$newsdata=" <font color=cccccc>(".$num.")</font>";
}
//栏目链接
$classurl=sys_ReturnBqClassname($r,9);
$text.="<table width=100% border=0 cellpadding=5 cellspacing=1 bgcolor=".$bcolor."><tr><td> <a href=\"".$classurl."\" target=\"_blank\">".$r[classname]."</a>".$newsdata."</td></tr><tr><td bgcolor=".$color.">";
$sql1=$empire->query("select classname,classid,islast,sonclass,tbname from {$dbtbpre}enewsclass where bclassid='$r[classid]' and showclass=0 order by myorder,classid");
$i=0;
$class_text="";
while($r1=$empire->fetch($sql1))
{
//显示类别数据数
if($shownum)
{
//终极类别
if($r1[islast])
{
$where="classid='$r1[classid]'";
}
else
{
$where=ReturnClass($r1[sonclass]);
}
$cr=$empire->fetch1("select count(*) as total from {$dbtbpre}ecms_".$r1[tbname]." where ".$where." and checked=1 limit 1");
$num=$cr[total];
$newsdata=" <font color=cccccc>(".$num.")</font>";
}
//栏目链接
$classurl=sys_ReturnBqClassname($r1,9);
$i++;
if(($i-1)%$line==0||$i==1)
{$class_text.="<tr>";}
$class_text.="<td align=center><a href=\"".$classurl."\" target=\"_blank\">".$r1[classname]."</a>".$newsdata."</td>";
//分割
if($i%$line==0)
{$class_text.="</tr>";}
}
if($i<>0)
{
$table="<table width=100% border=0 cellpadding=5 cellspacing=1>";
$table1="</table>";
$ys=$line-$i%$line;
$p=0;
for($j=0;$j<$ys&&$ys!=$line;$j++)
{
$p=1;
$class_text.="<td></td>";
}
if($p==1)
{
$class_text.="</tr>";
}
}
$text.=$table.$class_text.$table1."</td></tr></table>";
}
echo $text;
}
//引用文件
function sys_IncludeFile($file){
@include($file);
}
//读取远程文件
function sys_ReadFile($http){
global $do_openreadfile;
if($do_openreadfile==0&&!strstr($http,"://"))
{
return "";
}
echo ReadFiletext($http);
}
//信息统计
function sys_TotalData($classid,$enews=0,$day=0){
global $empire,$class_r,$class_zr,$dbtbpre;
if(empty($classid))
{
return "";
}
if($day)
{
if($enews==2)
{
$and=' where ';
}
else
{
$and=' and ';
}
if($day==1)//今日信息
{
$date=date("Y-m-d");
$and.="newstime like '".$date."%'";
}
elseif($day==2)//本月信息
{
$date=date("Y-m");
$and.="newstime like '".$date."%'";
}
elseif($day==3)//本年信息
{
$date=date("Y");
$and.="newstime like '".$date."%'";
}
else
{
$and='';
}
}
//统计专题
if($enews==1)
{
if(empty($class_zr[$classid][tbname]))
{
echo $fun_r['BqErrorZid']."=<b>".$classid."</b>".$fun_r['BqErrorNtb'];
return "";
}
$query="select count(*) as total from {$dbtbpre}ecms_".$class_zr[$classid][tbname]." where ztid like '%|".$classid."|%'".$and;
}
//统计数据表
elseif($enews==2)
{
$query="select count(*) as total from {$dbtbpre}ecms_".$classid.$and;
}
//统计栏目数据
else
{
if(empty($class_r[$classid][tbname]))
{
echo $fun_r['BqErrorCid']."=<b>".$classid."</b>".$fun_r['BqErrorNtb'];
return "";
}
//子栏目
if($class_r[$classid][islast])
{
$where="classid='$classid'";
}
//大栏目
else
{
$where=ReturnClass($class_r[$classid][sonclass]);
if(empty($where))
{$where="classid=0";}
}
$query="select count(*) as total from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$where.$and;
}
$num=$empire->gettotal($query);
echo $num;
}
//flash幻灯图片信息调用
function sys_FlashPixpic($classid,$line,$width,$height,$showtitle=true,$strlen,$enews=0,$sec=5){
global $empire,$public_r,$class_r,$class_zr;
$sql=sys_ReturnBqQuery($classid,$line,$enews,1);
if(!$sql)
{return "";}
$i=0;
while($r=$empire->fetch($sql))
{
//标题链接
$titleurl=sys_ReturnBqTitleLink($r);
//------是否显示标题
if($showtitle)
{
$title=sub($r[title],0,$strlen,false);
//标题属性
$title=addslashes(DoTitleFont($r[titlefont],htmlspecialchars($title)));
}
$fh="|";
if($i==0)
{
$fh="";
}
$url.=$fh.$titleurl;
$pic.=$fh.$r[titlepic];
$subject.=$fh.$title;
$i=1;
}
//显示标题
if($showtitle)
{
$text_height=22;
}
else
{
$text_height=0;
}
?>
<script type="text/javascript">
<!--
var interval_time=<?=$sec?>;
var focus_width=<?=$width?>;
var focus_height=<?=$height?>;
var text_height=<?=$text_height?>;
var text_align="center";
var swf_height = focus_height+text_height;
var swfpath="<?=$public_r[newsurl]?>e/data/images/pixviewer.swf";
var swfpatha="<?=$public_r[newsurl]?>e/data/images/pixviewer.swf";
var pics="<?=$pic?>";
var links="<?=$url?>";
var texts="<?=$subject?>";
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="'+swfpath+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'">');
document.write('<embed src="'+swfpath+'" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
//-->
</script>
<?
}
//搜索关键字
function sys_ShowSearchKey($line,$num,$classid=0,$enews=0){
global $empire,$public_r,$dbtbpre;
if($enews)
{
$order="searchid";
}
else
{
$order="onclick";
}
if($classid)
{
$add=" and classid='$classid'";
}
$sql=$empire->query("select searchid,keyboard from {$dbtbpre}enewssearch where iskey=0".$add." order by ".$order." desc limit ".$num);
$i=0;
$returnkey="";
while($r=$empire->fetch($sql))
{
$i++;
$keyurl=$public_r[newsurl]."e/search/result?searchid=$r[searchid]";
$br="";
if($i%$line==0)
{
$br="<br>";
}
$jg=" ";
if($br)
{
$jg="";
}
$returnkey.="<a href='".$keyurl."' target=_blank>".$r[keyboard]."</a>".$jg.$br;
}
echo $returnkey;
}
//带模板的标签显示-循环
function sys_GetEcmsInfoMore($classid,$line,$strlen,$have_class=0,$ecms=0,$tr,$doing=0,$field,$cr,$dofirstinfo=0,$fsubtitle=0,$fsubnews=0,$fdoing=0){
global $empire;
//操作类型
if($ecms==0)//栏目最新
{
$enews=0;
}
elseif($ecms==1)//栏目热门
{
$enews=1;
}
elseif($ecms==2)//栏目推荐
{
$enews=2;
}
elseif($ecms==3)//栏目评论排行
{
$enews=9;
}
elseif($ecms==4)//栏目头条
{
$enews=12;
}
elseif($ecms==5)//栏目下载排行
{
$enews=15;
}
elseif($ecms==6)//栏目评分
{
$enews=25;
}
elseif($ecms==7)//栏目投票
{
$enews=26;
}
else
{
$enews=0;
}
$sql=sys_ReturnBqQuery($classid,$line,$enews,$doing);
if(!$sql)
{return "";}
//取得模板
$listtemp=$tr[temptext];
$subnews=$tr[subnews];
$listvar=$tr[listvar];
$rownum=$tr[rownum];
$formatdate=$tr[showdate];
//替换变量
$listtemp=ReplaceEcmsinfoClassname($listtemp,$enews,$classid);
$listtemp=sys_ForSonclassDataFirstInfo($listtemp,$cr,$dofirstinfo,$fsubtitle,$fsubnews,$fdoing);
if(empty($rownum))
{$rownum=1;}
//列表
$list_exp="[!--empirenews.listtemp--]";
$list_r=explode($list_exp,$listtemp);
$listtext=$list_r[1];
$no=1;
$changerow=1;
while($r=$empire->fetch($sql))
{
$r[oldtitle]=$r[title];
$r[title]=sub($r[title],0,$strlen,false);
//替换列表变量
$repvar=ReplaceListVars($no,$listvar,$subnews,0,$formatdate,$url,$have_class,$r,$field);
$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_ForSonclassDataFirstInfo($temptext,$cr,$ecms=0,$subtitle=0,$subnews=0,$fdoing=0){
global $empire,$class_r,$public_r,$dbtbpre;
if($ecms==2||$ecms==3||$ecms==4)
{
$where=$class_r[$cr[classid]][islast]?"classid='$cr[classid]'":ReturnClass($class_r[$cr[classid]][sonclass]);
}
if($fdoing)
{
$add=" and titlepic<>''";
}
if($ecms==1)//栏目缩图
{
$id=$cr['classid'];
$title=$cr['classname'];
$titleurl=sys_ReturnBqClassname($cr,9);
$titlepic=$cr['classimg'];
$smalltext=$cr['intro'];
}
elseif($ecms==2)//推荐信息
{
$r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$cr[classid]][tbname]." where checked=1 and isgood=1 and (".$where.")".$add." order by newstime desc limit 1");
}
elseif($ecms==3)//头条信息
{
$r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$cr[classid]][tbname]." where checked=1 and firsttitle=1 and (".$where.")".$add." order by newstime desc limit 1");
}
elseif($ecms==4)//最新信息
{
$r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$cr[classid]][tbname]." where checked=1 and (".$where.")".$add." order by newstime desc limit 1");
}
else
{
return $temptext;
}
if($ecms!=1)
{
$id=$r['id'];
$title=$r['title'];
$titleurl=sys_ReturnBqTitleLink($r);
$titlepic=$r['titlepic'];
//简介
if($r['smalltext'])
{$smalltext=$r['smalltext'];}
elseif($r['flashsay'])
{$smalltext=$r['flashsay'];}
elseif($r['softsay'])
{$smalltext=$r['softsay'];}
elseif($r['moviesay'])
{$smalltext=$r['moviesay'];}
elseif($r['picsay'])
{$smalltext=$r['picsay'];}
}
$oldtitle=$title;
if($subtitle)
{$title=sub($title,0,$subtitle,false);}
if(empty($titlepic))
{$titlepic=$public_r[newsurl]."e/data/images/notimg.gif";}
if(!empty($subnews))
{$smalltext=sub($smalltext,0,$subnews,false);}
$temptext=str_replace('[!--sonclass.id--]',$id,$temptext);
$temptext=str_replace('[!--sonclass.title--]',$title,$temptext);
$temptext=str_replace('[!--sonclass.oldtitle--]',$oldtitle,$temptext);
$temptext=str_replace('[!--sonclass.titlepic--]',$titlepic,$temptext);
$temptext=str_replace('[!--sonclass.titleurl--]',$titleurl,$temptext);
$temptext=str_replace('[!--sonclass.text--]',$smalltext,$temptext);
return $temptext;
}
//循环子栏目数据
function sys_ForSonclassData($classid,$line,$strlen,$have_class=0,$enews=0,$tempid,$doing=0,$cline=0,$dofirstinfo=0,$fsubtitle=0,$fsubnews=0,$fdoing=0){
global $empire,$public_r,$class_r,$class_zr,$navclassid,$dbtbpre;
//多栏目
if(strstr($classid,","))
{
$son_r=sys_ReturnMoreClass($classid);
$classid=$son_r[0];
$where=$son_r[1];
}
else
{
//当前栏目
if($classid=="selfinfo")
{
$classid=$navclassid;
}
$where="bclassid='$classid'";
}
//取得模板
$tr=sys_ReturnBqTemp($tempid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -